SubGhz: check load type file

This commit is contained in:
gid9798 2023-05-06 17:28:16 +03:00
parent d8631d1489
commit 1387d8d5d6
5 changed files with 19 additions and 2 deletions

View File

@ -80,6 +80,13 @@ typedef enum {
SubGhzViewIdTestPacket,
} SubGhzViewId;
/** SubGhz load type file */
typedef enum {
SubGhzLoadTypeFileNoLoad,
SubGhzLoadTypeFileKey,
SubGhzLoadTypeFileRaw,
} SubGhzLoadTypeFile;
typedef enum {
SubGhzViewReceiverModeLive,
SubGhzViewReceiverModeFile,

View File

@ -4,7 +4,7 @@ void subghz_scene_saved_on_enter(void* context) {
SubGhz* subghz = context;
if(subghz_load_protocol_from_file(subghz)) {
if((!strcmp(subghz->txrx->decoder_result->protocol->name, "RAW"))) {
if((subghz_get_load_type_file(subghz) == SubGhzLoadTypeFileRaw)) {
subghz->txrx->rx_key_state = SubGhzRxKeyStateRAWLoad;
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneReadRAW);
} else {

View File

@ -478,7 +478,7 @@ int32_t subghz_app(void* p) {
if(subghz_key_load(subghz, p, true)) {
furi_string_set(subghz->file_path, (const char*)p);
if((!strcmp(subghz->txrx->decoder_result->protocol->name, "RAW"))) {
if((subghz_get_load_type_file(subghz) == SubGhzLoadTypeFileRaw)) {
//Load Raw TX
subghz->txrx->rx_key_state = SubGhzRxKeyStateRAWLoad;
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneReadRAW);

View File

@ -356,8 +356,10 @@ bool subghz_key_load(SubGhz* subghz, const char* file_path, bool show_dialog) {
}
if(!strcmp(furi_string_get_cstr(temp_str), "RAW")) {
//if RAW
subghz->txrx->load_type_file = SubGhzLoadTypeFileRaw;
subghz_protocol_raw_gen_fff_data(subghz->txrx->fff_data, file_path);
} else {
subghz->txrx->load_type_file = SubGhzLoadTypeFileKey;
stream_copy_full(
flipper_format_get_raw_stream(fff_data_file),
flipper_format_get_raw_stream(subghz->txrx->fff_data));
@ -412,6 +414,11 @@ bool subghz_key_load(SubGhz* subghz, const char* file_path, bool show_dialog) {
}
}
SubGhzLoadTypeFile subghz_get_load_type_file(SubGhz* subghz) {
furi_assert(subghz);
return subghz->txrx->load_type_file;
}
bool subghz_get_next_name_file(SubGhz* subghz, uint8_t max_len) {
furi_assert(subghz);

View File

@ -86,6 +86,7 @@ struct SubGhzTxRx {
bool ignore_magellan;
SubGhzRxKeyState rx_key_state;
SubGhzLoadTypeFile load_type_file;
bool debug_pin_state;
};
@ -189,5 +190,7 @@ void subghz_lock(SubGhz* subghz);
void subghz_unlock(SubGhz* subghz);
bool subghz_is_locked(SubGhz* subghz);
SubGhzLoadTypeFile subghz_get_load_type_file(SubGhz* subghz);
extern const NotificationSequence subghz_sequence_rx;
extern const NotificationSequence subghz_sequence_rx_locked;