forked from TylerWilley/flipper-f-com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scenes.c
61 lines (54 loc) · 1.93 KB
/
scenes.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "flipper.h"
#include "app_state.h"
#include "scenes.h"
/** collection of all scene on_enter handlers */
void (*const fcom_scene_on_enter_handlers[])(void*) = {
fcom_main_menu_scene_on_enter,
fcom_listen_menu_scene_on_enter,
fcom_read_code_scene_on_enter,
fcom_select_code_scene_on_enter,
fcom_send_code_scene_on_enter,
fcom_add_code_scene_on_enter,
fcom_serial_scene_on_enter,
fcom_save_code_scene_on_enter
};
/** collection of all scene on event handlers */
bool (*const fcom_scene_on_event_handlers[])(void*, SceneManagerEvent) = {
fcom_main_menu_scene_on_event,
fcom_listen_menu_scene_on_event,
fcom_read_code_scene_on_event,
fcom_select_code_scene_on_event,
fcom_send_code_scene_on_event,
fcom_add_code_scene_on_event,
fcom_serial_scene_on_event,
fcom_save_code_scene_on_event
};
/** collection of all scene on exit handlers */
void (*const fcom_scene_on_exit_handlers[])(void*) = {
fcom_main_menu_scene_on_exit,
fcom_listen_menu_scene_on_exit,
fcom_read_code_scene_on_exit,
fcom_select_code_scene_on_exit,
fcom_send_code_scene_on_exit,
fcom_add_code_scene_on_exit,
fcom_serial_scene_on_exit,
fcom_save_code_scene_on_exit
};
/** collection of all on_enter, on_event, on_exit handlers */
const SceneManagerHandlers fcom_scene_manager_handlers = {
.on_enter_handlers = fcom_scene_on_enter_handlers,
.on_event_handlers = fcom_scene_on_event_handlers,
.on_exit_handlers = fcom_scene_on_exit_handlers,
.scene_num = FcomSceneCount};
/* callbacks */
/** custom event handler */
bool fcom_custom_callback(void* context, uint32_t custom_event) {
furi_assert(context);
App* app = context;
return scene_manager_handle_custom_event(app->scene_manager, custom_event);
}
bool fcom_back_event_callback(void* context) {
furi_assert(context);
App* app = context;
return scene_manager_handle_back_event(app->scene_manager);
}