2023-10-30 19:20:35 +03:00
|
|
|
#include "../infrared_app_i.h"
|
2022-06-21 15:45:50 +03:00
|
|
|
|
|
|
|
#include "common/infrared_scene_universal_common.h"
|
|
|
|
|
|
|
|
void infrared_scene_universal_tv_on_enter(void* context) {
|
|
|
|
infrared_scene_universal_common_on_enter(context);
|
|
|
|
|
2023-10-30 19:20:35 +03:00
|
|
|
InfraredApp* infrared = context;
|
2022-06-21 15:45:50 +03:00
|
|
|
ButtonPanel* button_panel = infrared->button_panel;
|
|
|
|
InfraredBruteForce* brute_force = infrared->brute_force;
|
|
|
|
|
2022-07-26 15:21:51 +03:00
|
|
|
infrared_brute_force_set_db_filename(brute_force, EXT_PATH("infrared/assets/tv.ir"));
|
2022-06-21 15:45:50 +03:00
|
|
|
|
|
|
|
button_panel_reserve(button_panel, 2, 3);
|
|
|
|
uint32_t i = 0;
|
|
|
|
button_panel_add_item(
|
|
|
|
button_panel,
|
|
|
|
i,
|
|
|
|
0,
|
|
|
|
0,
|
2023-08-23 21:24:47 +03:00
|
|
|
6,
|
|
|
|
16,
|
|
|
|
&I_power_19x20,
|
|
|
|
&I_power_hover_19x20,
|
2022-06-21 15:45:50 +03:00
|
|
|
infrared_scene_universal_common_item_callback,
|
|
|
|
context);
|
2023-08-23 21:24:47 +03:00
|
|
|
button_panel_add_icon(button_panel, 4, 38, &I_power_text_24x5);
|
2022-11-28 22:49:51 +03:00
|
|
|
infrared_brute_force_add_record(brute_force, i++, "Power");
|
2022-06-21 15:45:50 +03:00
|
|
|
button_panel_add_item(
|
|
|
|
button_panel,
|
|
|
|
i,
|
|
|
|
1,
|
|
|
|
0,
|
2023-08-23 21:24:47 +03:00
|
|
|
39,
|
|
|
|
16,
|
|
|
|
&I_mute_19x20,
|
|
|
|
&I_mute_hover_19x20,
|
2022-06-21 15:45:50 +03:00
|
|
|
infrared_scene_universal_common_item_callback,
|
|
|
|
context);
|
2023-08-23 21:24:47 +03:00
|
|
|
button_panel_add_icon(button_panel, 39, 38, &I_mute_text_19x5);
|
|
|
|
|
|
|
|
button_panel_add_icon(button_panel, 0, 66, &I_ch_text_31x34);
|
|
|
|
button_panel_add_icon(button_panel, 35, 66, &I_vol_tv_text_29x34);
|
|
|
|
|
2022-11-28 22:49:51 +03:00
|
|
|
infrared_brute_force_add_record(brute_force, i++, "Mute");
|
2022-06-21 15:45:50 +03:00
|
|
|
button_panel_add_item(
|
|
|
|
button_panel,
|
|
|
|
i,
|
|
|
|
1,
|
2023-08-23 21:24:47 +03:00
|
|
|
1,
|
|
|
|
38,
|
|
|
|
53,
|
|
|
|
&I_volup_24x21,
|
|
|
|
&I_volup_hover_24x21,
|
2022-06-21 15:45:50 +03:00
|
|
|
infrared_scene_universal_common_item_callback,
|
|
|
|
context);
|
2023-08-23 21:24:47 +03:00
|
|
|
|
2022-11-28 22:49:51 +03:00
|
|
|
infrared_brute_force_add_record(brute_force, i++, "Vol_up");
|
2022-06-21 15:45:50 +03:00
|
|
|
button_panel_add_item(
|
|
|
|
button_panel,
|
|
|
|
i,
|
2023-08-23 21:24:47 +03:00
|
|
|
0,
|
2022-06-21 15:45:50 +03:00
|
|
|
1,
|
2023-08-23 21:24:47 +03:00
|
|
|
3,
|
|
|
|
53,
|
|
|
|
&I_ch_up_24x21,
|
|
|
|
&I_ch_up_hover_24x21,
|
2022-06-21 15:45:50 +03:00
|
|
|
infrared_scene_universal_common_item_callback,
|
|
|
|
context);
|
2022-11-28 22:49:51 +03:00
|
|
|
infrared_brute_force_add_record(brute_force, i++, "Ch_next");
|
2022-06-21 15:45:50 +03:00
|
|
|
button_panel_add_item(
|
|
|
|
button_panel,
|
|
|
|
i,
|
2023-08-23 21:24:47 +03:00
|
|
|
1,
|
2022-06-21 15:45:50 +03:00
|
|
|
2,
|
2023-08-23 21:24:47 +03:00
|
|
|
38,
|
|
|
|
91,
|
|
|
|
&I_voldown_24x21,
|
|
|
|
&I_voldown_hover_24x21,
|
2022-06-21 15:45:50 +03:00
|
|
|
infrared_scene_universal_common_item_callback,
|
|
|
|
context);
|
2022-11-28 22:49:51 +03:00
|
|
|
infrared_brute_force_add_record(brute_force, i++, "Vol_dn");
|
2022-06-21 15:45:50 +03:00
|
|
|
button_panel_add_item(
|
|
|
|
button_panel,
|
|
|
|
i,
|
2023-08-23 21:24:47 +03:00
|
|
|
0,
|
2022-06-21 15:45:50 +03:00
|
|
|
2,
|
2023-08-23 21:24:47 +03:00
|
|
|
3,
|
|
|
|
91,
|
|
|
|
&I_ch_down_24x21,
|
|
|
|
&I_ch_down_hover_24x21,
|
2022-06-21 15:45:50 +03:00
|
|
|
infrared_scene_universal_common_item_callback,
|
|
|
|
context);
|
2022-11-28 22:49:51 +03:00
|
|
|
infrared_brute_force_add_record(brute_force, i++, "Ch_prev");
|
2022-06-21 15:45:50 +03:00
|
|
|
|
2023-08-23 21:24:47 +03:00
|
|
|
button_panel_add_label(button_panel, 5, 10, FontPrimary, "TV remote");
|
2022-06-21 15:45:50 +03:00
|
|
|
|
|
|
|
view_set_orientation(view_stack_get_view(infrared->view_stack), ViewOrientationVertical);
|
|
|
|
view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewStack);
|
|
|
|
|
|
|
|
infrared_show_loading_popup(infrared, true);
|
|
|
|
bool success = infrared_brute_force_calculate_messages(brute_force);
|
|
|
|
infrared_show_loading_popup(infrared, false);
|
|
|
|
|
|
|
|
if(!success) {
|
2022-06-21 17:45:55 +03:00
|
|
|
scene_manager_next_scene(infrared->scene_manager, InfraredSceneErrorDatabases);
|
2022-06-21 15:45:50 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool infrared_scene_universal_tv_on_event(void* context, SceneManagerEvent event) {
|
|
|
|
return infrared_scene_universal_common_on_event(context, event);
|
|
|
|
}
|
|
|
|
|
|
|
|
void infrared_scene_universal_tv_on_exit(void* context) {
|
|
|
|
infrared_scene_universal_common_on_exit(context);
|
|
|
|
}
|