|
1 | 1 | namespace microdata { |
2 | | - import AppInterface = user_interface_base.AppInterface |
3 | | - import Scene = user_interface_base.Scene |
4 | | - import SceneManager = user_interface_base.SceneManager |
| 2 | + import AppInterface = user_interface_base.AppInterface |
| 3 | + import Scene = user_interface_base.Scene |
| 4 | + import SceneManager = user_interface_base.SceneManager |
5 | 5 |
|
6 | | - // Auto-save slot |
7 | | - export const SAVESLOT_AUTO = "sa" |
8 | 6 |
|
9 | | - export interface SavedState { |
10 | | - progdef: any |
11 | | - version?: string |
| 7 | + /** |
| 8 | + * Used to control the flow between scenes, |
| 9 | + * The SensorSelect scene is used to set the sensors before the RecordData, DistributedLogging and LiveDataViewer scenes |
| 10 | + * This enum may be passed to the constructors of these scenes so that they can dynamically control this flow. |
| 11 | + */ |
| 12 | + export enum MicroDataSceneEnum { |
| 13 | + LiveDataViewer, |
| 14 | + SensorSelect, |
| 15 | + RecordingConfigSelect, |
| 16 | + RecordData, |
| 17 | + DistributedLogging |
| 18 | + } |
| 19 | + |
| 20 | + // Auto-save slot |
| 21 | + export const SAVESLOT_AUTO = "sa" |
| 22 | + |
| 23 | + export interface SavedState { |
| 24 | + progdef: any |
| 25 | + version?: string |
| 26 | + } |
| 27 | + |
| 28 | + // application configuration |
| 29 | + // user_interface_base.getIcon = (id) => Icons..get(id) |
| 30 | + user_interface_base.getIcon = (id) => microdata.Icons.get(id) |
| 31 | + user_interface_base.resolveTooltip = (ariaId: string) => ariaId |
| 32 | + |
| 33 | + /** |
| 34 | + * If an Arcade Shield is not present when starting MicroData that Microbit will enter DistributedLoggingProtocol. |
| 35 | + * It will show a :) on its LEDs and try to become a Target - where it will receive radio commands from a Commander Microbit (one with an Arcade Shield) |
| 36 | + */ |
| 37 | + export class App implements AppInterface { |
| 38 | + sceneManager: SceneManager |
| 39 | + |
| 40 | + constructor() { |
| 41 | + // One interval delay to ensure all static constructors have executed. |
| 42 | + basic.pause(10) |
| 43 | + reportEvent("app.start") |
| 44 | + |
| 45 | + this.sceneManager = new SceneManager() |
| 46 | + datalogger.includeTimestamp(FlashLogTimeStampFormat.None) |
| 47 | + |
| 48 | + const arcadeShieldConnected = shieldhelpers.shieldPresent(); |
| 49 | + if (arcadeShieldConnected) |
| 50 | + this.pushScene(new microdata.Home(this)); |
| 51 | + else |
| 52 | + new HeadlessMode(this); |
| 53 | + } |
| 54 | + |
| 55 | + public pushScene(scene: Scene) { |
| 56 | + this.sceneManager.pushScene(scene) |
| 57 | + } |
| 58 | + |
| 59 | + public popScene() { |
| 60 | + this.sceneManager.popScene() |
| 61 | + } |
| 62 | + |
| 63 | + public save(slot: string, buffer: Buffer): boolean { |
| 64 | + return true; |
12 | 65 | } |
13 | 66 |
|
14 | | - // application configuration |
15 | | - // user_interface_base.getIcon = (id) => icons.get(id) |
16 | | - user_interface_base.getIcon = (id) => user_interface_base.icons.get(id) |
17 | | - user_interface_base.resolveTooltip = (ariaId: string) => ariaId |
18 | | - |
19 | | - /** |
20 | | - * If an Arcade Shield is not present when starting MicroData that Microbit will enter DistributedLoggingProtocol. |
21 | | - * It will show a :) on its LEDs and try to become a Target - where it will receive radio commands from a Commander Microbit (one with an Arcade Shield) |
22 | | - */ |
23 | | - export class App implements AppInterface { |
24 | | - sceneManager: SceneManager |
25 | | - |
26 | | - constructor() { |
27 | | - // One interval delay to ensure all static constructors have executed. |
28 | | - basic.pause(10) |
29 | | - reportEvent("app.start") |
30 | | - |
31 | | - this.sceneManager = new SceneManager() |
32 | | - datalogger.includeTimestamp(FlashLogTimeStampFormat.None) |
33 | | - |
34 | | - const arcadeShieldConnected = shieldhelpers.shieldPresent(); |
35 | | - if (arcadeShieldConnected) |
36 | | - this.pushScene(new microdata.Home(this)); |
37 | | - else |
38 | | - new HeadlessMode(this); |
39 | | - } |
40 | | - |
41 | | - public pushScene(scene: Scene) { |
42 | | - this.sceneManager.pushScene(scene) |
43 | | - } |
44 | | - |
45 | | - public popScene() { |
46 | | - this.sceneManager.popScene() |
47 | | - } |
48 | | - |
49 | | - public save(slot: string, buffer: Buffer): boolean { |
50 | | - return true; |
51 | | - } |
52 | | - |
53 | | - public load(slot: string): Buffer { |
54 | | - return Buffer.create(0) |
55 | | - } |
| 67 | + public load(slot: string): Buffer { |
| 68 | + return Buffer.create(0) |
56 | 69 | } |
| 70 | + } |
57 | 71 | } |
0 commit comments