1 package kaka.cakelight.mode;
3 import kaka.cakelight.Configuration;
4 import kaka.cakelight.LedFrame;
6 import java.util.function.Consumer;
8 public abstract class Mode {
9 private Consumer<LedFrame> frameListener;
11 public abstract void enter(Configuration config);
12 public abstract void pause();
13 public abstract void resume();
14 public abstract void exit();
16 public void setFrameListener(Consumer<LedFrame> listener) {
17 frameListener = listener;
20 public void updateWithFrame(LedFrame frame) {
21 assert frameListener != null;
22 frameListener.accept(frame);