2022-05-24 20:43:23 +00:00
|
|
|
#include "../subghz_i.h"
|
|
|
|
|
2023-04-21 13:10:08 +00:00
|
|
|
#define TAG "SubGhzSetFix"
|
2022-05-24 20:43:23 +00:00
|
|
|
|
2023-04-21 13:10:08 +00:00
|
|
|
void subghz_scene_set_fix_byte_input_callback(void* context) {
|
2022-05-24 20:43:23 +00:00
|
|
|
SubGhz* subghz = context;
|
|
|
|
|
|
|
|
view_dispatcher_send_custom_event(subghz->view_dispatcher, SubGhzCustomEventByteInputDone);
|
|
|
|
}
|
|
|
|
|
2023-04-21 13:10:08 +00:00
|
|
|
void subghz_scene_set_fix_on_enter(void* context) {
|
2022-05-24 20:43:23 +00:00
|
|
|
SubGhz* subghz = context;
|
|
|
|
|
|
|
|
// Setup view
|
|
|
|
ByteInput* byte_input = subghz->byte_input;
|
|
|
|
byte_input_set_header_text(byte_input, "Enter FIX in hex");
|
|
|
|
byte_input_set_result_callback(
|
|
|
|
byte_input,
|
2023-04-21 13:10:08 +00:00
|
|
|
subghz_scene_set_fix_byte_input_callback,
|
2022-05-24 20:43:23 +00:00
|
|
|
NULL,
|
|
|
|
subghz,
|
2023-05-09 09:07:36 +00:00
|
|
|
subghz->secure_data->fix,
|
2022-05-24 20:43:23 +00:00
|
|
|
4);
|
|
|
|
view_dispatcher_switch_to_view(subghz->view_dispatcher, SubGhzViewIdByteInput);
|
|
|
|
}
|
|
|
|
|
2023-04-21 13:10:08 +00:00
|
|
|
bool subghz_scene_set_fix_on_event(void* context, SceneManagerEvent event) {
|
2022-05-24 20:43:23 +00:00
|
|
|
SubGhz* subghz = context;
|
|
|
|
bool consumed = false;
|
|
|
|
|
|
|
|
if(event.type == SceneManagerEventTypeCustom) {
|
|
|
|
if(event.event == SubGhzCustomEventByteInputDone) {
|
2023-04-21 13:10:08 +00:00
|
|
|
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneSetCnt);
|
2022-05-24 20:43:23 +00:00
|
|
|
consumed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return consumed;
|
|
|
|
}
|
|
|
|
|
2023-04-21 13:10:08 +00:00
|
|
|
void subghz_scene_set_fix_on_exit(void* context) {
|
2022-05-24 20:43:23 +00:00
|
|
|
SubGhz* subghz = context;
|
|
|
|
|
|
|
|
// Clear view
|
|
|
|
byte_input_set_result_callback(subghz->byte_input, NULL, NULL, NULL, NULL, 0);
|
|
|
|
byte_input_set_header_text(subghz->byte_input, "");
|
|
|
|
}
|