timed-remote

Flipper Zero app for sending delayed IR commands
git clone git://src.adamsgaard.dk/timed-remote # fast
git clone https://src.adamsgaard.dk/timed-remote.git # slow
Log | Files | Refs | README | LICENSE Back to index

scene_confirm.c (1474B)


      1 #include "../timed_remote.h"
      2 #include "timed_remote_scene.h"
      3 
      4 static void confirm_popup_callback(void *context) {
      5   TimedRemoteApp *app = context;
      6   view_dispatcher_send_custom_event(app->view_dispatcher,
      7                                     TimedRemoteEventConfirmDone);
      8 }
      9 
     10 void timed_remote_scene_confirm_on_enter(void *context) {
     11   TimedRemoteApp *app = context;
     12 
     13   popup_reset(app->popup);
     14   popup_set_header(app->popup, "Signal Sent!", 64, 20, AlignCenter,
     15                    AlignCenter);
     16   popup_set_text(app->popup, app->signal_name, 64, 35, AlignCenter,
     17                  AlignCenter);
     18   popup_set_timeout(app->popup, 2000); /* 2 seconds */
     19   popup_set_context(app->popup, app);
     20   popup_set_callback(app->popup, confirm_popup_callback);
     21   popup_enable_timeout(app->popup);
     22 
     23   view_dispatcher_switch_to_view(app->view_dispatcher, TimedRemoteViewPopup);
     24 }
     25 
     26 bool timed_remote_scene_confirm_on_event(void *context,
     27                                          SceneManagerEvent event) {
     28   TimedRemoteApp *app = context;
     29   bool consumed = false;
     30 
     31   if (event.type == SceneManagerEventTypeCustom) {
     32     if (event.event == TimedRemoteEventConfirmDone) {
     33       /* Return to file browser */
     34       scene_manager_search_and_switch_to_previous_scene(
     35           app->scene_manager, TimedRemoteSceneIrBrowse);
     36       consumed = true;
     37     }
     38   }
     39 
     40   return consumed;
     41 }
     42 
     43 void timed_remote_scene_confirm_on_exit(void *context) {
     44   TimedRemoteApp *app = context;
     45   popup_reset(app->popup);
     46 }