infrared_scene_universal_tv.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #include "../infrared_i.h"
  2. #include "common/infrared_scene_universal_common.h"
  3. void infrared_scene_universal_tv_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/infrared/assets/tv.ir");
  9. button_panel_reserve(button_panel, 2, 3);
  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+");
  47. button_panel_add_item(
  48. button_panel,
  49. i,
  50. 1,
  51. 1,
  52. 36,
  53. 66,
  54. &I_Up_25x27,
  55. &I_Up_hvr_25x27,
  56. infrared_scene_universal_common_item_callback,
  57. context);
  58. infrared_brute_force_add_record(brute_force, i++, "CH+");
  59. button_panel_add_item(
  60. button_panel,
  61. i,
  62. 0,
  63. 2,
  64. 3,
  65. 98,
  66. &I_Vol_down_25x27,
  67. &I_Vol_down_hvr_25x27,
  68. infrared_scene_universal_common_item_callback,
  69. context);
  70. infrared_brute_force_add_record(brute_force, i++, "VOL-");
  71. button_panel_add_item(
  72. button_panel,
  73. i,
  74. 1,
  75. 2,
  76. 36,
  77. 98,
  78. &I_Down_25x27,
  79. &I_Down_hvr_25x27,
  80. infrared_scene_universal_common_item_callback,
  81. context);
  82. infrared_brute_force_add_record(brute_force, i++, "CH-");
  83. button_panel_add_label(button_panel, 6, 11, FontPrimary, "TV remote");
  84. button_panel_add_label(button_panel, 9, 64, FontSecondary, "Vol");
  85. button_panel_add_label(button_panel, 43, 64, FontSecondary, "Ch");
  86. view_set_orientation(view_stack_get_view(infrared->view_stack), ViewOrientationVertical);
  87. view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewStack);
  88. infrared_show_loading_popup(infrared, true);
  89. bool success = infrared_brute_force_calculate_messages(brute_force);
  90. infrared_show_loading_popup(infrared, false);
  91. if(!success) {
  92. scene_manager_next_scene(infrared->scene_manager, InfraredSceneErrorDatabases);
  93. }
  94. }
  95. bool infrared_scene_universal_tv_on_event(void* context, SceneManagerEvent event) {
  96. return infrared_scene_universal_common_on_event(context, event);
  97. }
  98. void infrared_scene_universal_tv_on_exit(void* context) {
  99. infrared_scene_universal_common_on_exit(context);
  100. }