--- /dev/null
+package kaka.cakelight;
+
+import static kaka.cakelight.Main.timeIt;
+
+public class CakeLight {
+ private Configuration config;
+ private Mode mode;
+
+ public CakeLight(Configuration config) {
+ this.config = config;
+ }
+
+ public void setMode(Mode mode) {
+ cleanup();
+ this.mode = mode;
+ mode.enter(config);
+ }
+
+ public void cleanup() {
+ if (this.mode != null) {
+ this.mode.exit();
+ }
+ }
+
+ public void startLoop() {
+ // TODO
+// FrameGrabber grabber = FrameGrabber.from(config);
+// grabber.prepare();
+// Frame frame = grabber.grabFrame();
+// double time = 0;
+// for (int i = 0; i < 100; i++) {
+// time += timeIt("frame", () -> grabber.grabFrame());
+// }
+// System.out.println("time = " + time);
+// grabber.close();
+// byte[] data = frame.getData();
+// saveFile(data, "/home/kaka/test.img");
+ }
+}