Commit | Line | Data |
---|---|---|
67b0a758 TW |
1 | package kaka.cakelight.mode; |
2 | ||
3 | import kaka.cakelight.Configuration; | |
4 | import kaka.cakelight.LedFrame; | |
4a2d6056 | 5 | |
03b67a73 TW |
6 | import java.util.function.Consumer; |
7 | ||
8 | public abstract class Mode { | |
6b569670 | 9 | private Consumer<LedFrame> frameListener; |
03b67a73 TW |
10 | |
11 | public abstract void enter(Configuration config); | |
12 | public abstract void exit(); | |
13 | ||
14 | public void setFrameListener(Consumer<LedFrame> listener) { | |
15 | frameListener = listener; | |
16 | } | |
6b569670 TW |
17 | |
18 | public void updateWithFrame(LedFrame frame) { | |
19 | assert frameListener != null; | |
20 | frameListener.accept(frame); | |
21 | } | |
4a2d6056 | 22 | } |