WIP
[kaka/cakelight.git] / src / kaka / cakelight / CakeLight.java
1 package kaka.cakelight;
2
3 import static kaka.cakelight.Main.timeIt;
4
5 public class CakeLight {
6     private Configuration config;
7     private Mode mode;
8
9     public CakeLight(Configuration config) {
10         this.config = config;
11     }
12
13     public void setMode(Mode mode) {
14         cleanup();
15         this.mode = mode;
16         mode.enter(config);
17     }
18
19     public void cleanup() {
20         if (this.mode != null) {
21             this.mode.exit();
22         }
23     }
24
25     public void startLoop() {
26         // TODO
27 //        FrameGrabber grabber = FrameGrabber.from(config);
28 //        grabber.prepare();
29 //        Frame frame = grabber.grabFrame();
30 //        double time = 0;
31 //        for (int i = 0; i < 100; i++) {
32 //            time += timeIt("frame", () -> grabber.grabFrame());
33 //        }
34 //        System.out.println("time = " + time);
35 //        grabber.close();
36 //      byte[] data = frame.getData();
37 //      saveFile(data, "/home/kaka/test.img");
38     }
39 }