infrared_scene_universal_projector.c 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #include "../infrared_i.h"
  2. #include "common/infrared_scene_universal_common.h"
  3. void infrared_scene_universal_projector_on_enter(void* context) {
  4. infrared_scene_universal_common_on_enter(context);
  5. Infrared* infrared = context;
  6. ButtonPanel* button_panel = infrared->button_panel;
  7. InfraredBruteForce* brute_force = infrared->brute_force;
  8. infrared_brute_force_set_db_filename(brute_force, EXT_PATH("infrared/assets/projector.ir"));
  9. button_panel_reserve(button_panel, 2, 2);
  10. uint32_t i = 0;
  11. button_panel_add_item(
  12. button_panel,
  13. i,
  14. 0,
  15. 0,
  16. 3,
  17. 19,
  18. &I_Power_25x27,
  19. &I_Power_hvr_25x27,
  20. infrared_scene_universal_common_item_callback,
  21. context);
  22. infrared_brute_force_add_record(brute_force, i++, "Power");
  23. button_panel_add_item(
  24. button_panel,
  25. i,
  26. 1,
  27. 0,
  28. 36,
  29. 19,
  30. &I_Mute_25x27,
  31. &I_Mute_hvr_25x27,
  32. infrared_scene_universal_common_item_callback,
  33. context);
  34. infrared_brute_force_add_record(brute_force, i++, "Mute");
  35. button_panel_add_item(
  36. button_panel,
  37. i,
  38. 0,
  39. 1,
  40. 3,
  41. 66,
  42. &I_Vol_up_25x27,
  43. &I_Vol_up_hvr_25x27,
  44. infrared_scene_universal_common_item_callback,
  45. context);
  46. infrared_brute_force_add_record(brute_force, i++, "Vol_up");
  47. button_panel_add_item(
  48. button_panel,
  49. i,
  50. 1,
  51. 1,
  52. 36,
  53. 66,
  54. &I_Vol_down_25x27,
  55. &I_Vol_down_hvr_25x27,
  56. infrared_scene_universal_common_item_callback,
  57. context);
  58. infrared_brute_force_add_record(brute_force, i++, "Vol_dn");
  59. button_panel_add_label(button_panel, 2, 11, FontPrimary, "Proj. remote");
  60. button_panel_add_label(button_panel, 17, 62, FontSecondary, "Volume");
  61. view_set_orientation(view_stack_get_view(infrared->view_stack), ViewOrientationVertical);
  62. view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewStack);
  63. infrared_show_loading_popup(infrared, true);
  64. bool success = infrared_brute_force_calculate_messages(brute_force);
  65. infrared_show_loading_popup(infrared, false);
  66. if(!success) {
  67. scene_manager_next_scene(infrared->scene_manager, InfraredSceneErrorDatabases);
  68. }
  69. }
  70. bool infrared_scene_universal_projector_on_event(void* context, SceneManagerEvent event) {
  71. return infrared_scene_universal_common_on_event(context, event);
  72. }
  73. void infrared_scene_universal_projector_on_exit(void* context) {
  74. infrared_scene_universal_common_on_exit(context);
  75. }