xremote_scene_sg_list.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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(&browser_options, SUBGHZ_APP_EXTENSION, &I_sg_10px);
  6. browser_options.base_path = SUBGHZ_APP_FOLDER;
  7. FuriString* path;
  8. path = furi_string_alloc();
  9. furi_string_set(path, SUBGHZ_APP_FOLDER);
  10. bool success = dialog_file_browser_show(app->dialogs, app->file_path, path, &browser_options);
  11. furi_string_free(path);
  12. if(success) {
  13. //Load Remote into buffer
  14. view_set_orientation(view_stack_get_view(app->view_stack), ViewOrientationVertical);
  15. view_dispatcher_switch_to_view(app->view_dispatcher, XRemoteViewIdStack);
  16. xremote_sg_remote_load(app->sg_remote_buffer, app->file_path);
  17. xremote_cross_remote_add_subghz(app->cross_remote, app->sg_remote_buffer);
  18. }
  19. if(success) {
  20. //Load Remote Button View
  21. scene_manager_next_scene(app->scene_manager, XRemoteSceneCreate);
  22. } else {
  23. scene_manager_previous_scene(app->scene_manager);
  24. }
  25. }
  26. bool xremote_scene_sg_list_on_event(void* context, SceneManagerEvent event) {
  27. UNUSED(context);
  28. UNUSED(event);
  29. bool consumed = true;
  30. return consumed;
  31. }
  32. void xremote_scene_sg_list_on_exit(void* context) {
  33. UNUSED(context);
  34. }