Add sunrise mode
[kaka/cakelight.git] / src / kaka / cakelight / Commands.java
index f527c12..38fb77e 100644 (file)
@@ -1,9 +1,6 @@
 package kaka.cakelight;
 
-import kaka.cakelight.mode.AmbientMode;
-import kaka.cakelight.mode.SingleColorMode;
-import kaka.cakelight.mode.TwoColorNoiseMode;
-import kaka.cakelight.mode.VideoMode;
+import kaka.cakelight.mode.*;
 
 import java.util.function.BiFunction;
 
@@ -132,4 +129,17 @@ class Commands {
            }
        });
     }
+
+    static Console.Command sunriseMode() {
+        return command(new String[] {"sunrise"}, (console, args) -> {
+           if (args.length == 1) {
+               int durationSeconds = Integer.parseInt(args[0]);
+               console.getCakelight().setMode(new SunriseMode(durationSeconds));
+               console.out("setting sunrise mode with duration " + durationSeconds);
+               return true;
+           } else {
+               return false;
+           }
+       });
+    }
 }