|
@@ -1,33 +1,38 @@
|
|
|
#include "../findmy_i.h"
|
|
#include "../findmy_i.h"
|
|
|
|
|
|
|
|
-void findmy_scene_main_callback(FindMyMainEvent event, void* context) {
|
|
|
|
|
|
|
+void findmy_scene_main_callback(FindMyMainEvent event, void *context)
|
|
|
|
|
+{
|
|
|
furi_assert(context);
|
|
furi_assert(context);
|
|
|
- FindMy* app = context;
|
|
|
|
|
|
|
+ FindMy *app = context;
|
|
|
view_dispatcher_send_custom_event(app->view_dispatcher, event);
|
|
view_dispatcher_send_custom_event(app->view_dispatcher, event);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void findmy_scene_main_on_enter(void* context) {
|
|
|
|
|
- FindMy* app = context;
|
|
|
|
|
|
|
+void findmy_scene_main_on_enter(void *context)
|
|
|
|
|
+{
|
|
|
|
|
+ FindMy *app = context;
|
|
|
|
|
|
|
|
findmy_main_set_callback(app->findmy_main, findmy_scene_main_callback, app);
|
|
findmy_main_set_callback(app->findmy_main, findmy_scene_main_callback, app);
|
|
|
-
|
|
|
|
|
view_dispatcher_switch_to_view(app->view_dispatcher, FindMyViewMain);
|
|
view_dispatcher_switch_to_view(app->view_dispatcher, FindMyViewMain);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-bool findmy_scene_main_on_event(void* context, SceneManagerEvent event) {
|
|
|
|
|
- FindMy* app = context;
|
|
|
|
|
|
|
+bool findmy_scene_main_on_event(void *context, SceneManagerEvent event)
|
|
|
|
|
+{
|
|
|
|
|
+ FindMy *app = context;
|
|
|
bool consumed = false;
|
|
bool consumed = false;
|
|
|
|
|
|
|
|
- if(event.type == SceneManagerEventTypeCustom) {
|
|
|
|
|
|
|
+ if (event.type == SceneManagerEventTypeCustom)
|
|
|
|
|
+ {
|
|
|
consumed = true;
|
|
consumed = true;
|
|
|
- switch(event.event) {
|
|
|
|
|
|
|
+ switch (event.event)
|
|
|
|
|
+ {
|
|
|
case FindMyMainEventToggle:
|
|
case FindMyMainEventToggle:
|
|
|
findmy_toggle_beacon(app);
|
|
findmy_toggle_beacon(app);
|
|
|
break;
|
|
break;
|
|
|
case FindMyMainEventBackground:
|
|
case FindMyMainEventBackground:
|
|
|
app->state.beacon_active = true;
|
|
app->state.beacon_active = true;
|
|
|
findmy_state_save(&app->state);
|
|
findmy_state_save(&app->state);
|
|
|
- if(!furi_hal_bt_extra_beacon_is_active()) {
|
|
|
|
|
|
|
+ if (!furi_hal_bt_extra_beacon_is_active())
|
|
|
|
|
+ {
|
|
|
furi_check(furi_hal_bt_extra_beacon_start());
|
|
furi_check(furi_hal_bt_extra_beacon_start());
|
|
|
}
|
|
}
|
|
|
view_dispatcher_stop(app->view_dispatcher);
|
|
view_dispatcher_stop(app->view_dispatcher);
|
|
@@ -44,7 +49,8 @@ bool findmy_scene_main_on_event(void* context, SceneManagerEvent event) {
|
|
|
case FindMyMainEventQuit:
|
|
case FindMyMainEventQuit:
|
|
|
app->state.beacon_active = false;
|
|
app->state.beacon_active = false;
|
|
|
findmy_state_save(&app->state);
|
|
findmy_state_save(&app->state);
|
|
|
- if(furi_hal_bt_extra_beacon_is_active()) {
|
|
|
|
|
|
|
+ if (furi_hal_bt_extra_beacon_is_active())
|
|
|
|
|
+ {
|
|
|
furi_check(furi_hal_bt_extra_beacon_stop());
|
|
furi_check(furi_hal_bt_extra_beacon_stop());
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
@@ -57,7 +63,8 @@ bool findmy_scene_main_on_event(void* context, SceneManagerEvent event) {
|
|
|
return consumed;
|
|
return consumed;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void findmy_scene_main_on_exit(void* context) {
|
|
|
|
|
- FindMy* app = context;
|
|
|
|
|
|
|
+void findmy_scene_main_on_exit(void *context)
|
|
|
|
|
+{
|
|
|
|
|
+ FindMy *app = context;
|
|
|
UNUSED(app);
|
|
UNUSED(app);
|
|
|
}
|
|
}
|