xremote_scene_sg_list.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include "../xremote.h"
  2. void xremote_scene_sg_list_on_enter(void* context) {
  3. XRemote* app = context;
  4. DialogsFileBrowserOptions browser_options;
  5. dialog_file_browser_set_basic_options(
  6. &browser_options, SUBGHZ_APP_FILENAME_EXTENSION, &I_sg_10px);
  7. browser_options.base_path = SUBGHZ_APP_FOLDER;
  8. FuriString* path;
  9. path = furi_string_alloc();
  10. furi_string_set(path, SUBGHZ_APP_FOLDER);
  11. bool success = dialog_file_browser_show(app->dialogs, app->file_path, path, &browser_options);
  12. furi_string_free(path);
  13. if(success) {
  14. //Load Remote into buffer
  15. view_set_orientation(view_stack_get_view(app->view_stack), ViewOrientationVertical);
  16. view_dispatcher_switch_to_view(app->view_dispatcher, XRemoteViewIdStack);
  17. xremote_sg_remote_load(app->sg_remote_buffer, app->file_path);
  18. xremote_cross_remote_add_subghz(app->cross_remote, app->sg_remote_buffer);
  19. }
  20. if(success) {
  21. //Load Remote Button View
  22. scene_manager_next_scene(app->scene_manager, XRemoteSceneCreate);
  23. } else {
  24. scene_manager_previous_scene(app->scene_manager);
  25. }
  26. }
  27. bool xremote_scene_sg_list_on_event(void* context, SceneManagerEvent event) {
  28. UNUSED(context);
  29. UNUSED(event);
  30. bool consumed = true;
  31. return consumed;
  32. }
  33. void xremote_scene_sg_list_on_exit(void* context) {
  34. UNUSED(context);
  35. }