[FL-2669] SubGhz: add support for loading custom presets (#1398)
* SubGhz: load custom -preset * SubGhz: fix error prt=0 * SubGhz: load custom preset * SubGhz: code refactoring to support custom preset * SubGhz: add custom presert refactoring * SubGhz: fix alloc history alloc preset * SubGhz: fix error load file * SubGhz: fix start custom preset * SubGhz: fix delete custom preset * SubGhz: add description Custom_preset_data for CC1101 * SubGhz: debug logging and buffer size rounding Co-authored-by: あく <alleteam@gmail.com> Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
This commit is contained in:
parent
ed7db336c1
commit
ec19c11dbe
@ -1,5 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "m-string.h"
|
||||||
|
#include <furi.h>
|
||||||
|
#include <furi_hal.h>
|
||||||
|
|
||||||
/** SubGhzNotification state */
|
/** SubGhzNotification state */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SubGhzNotificationStateStarting,
|
SubGhzNotificationStateStarting,
|
||||||
@ -67,3 +71,12 @@ typedef enum {
|
|||||||
SubGhzViewIdTestCarrier,
|
SubGhzViewIdTestCarrier,
|
||||||
SubGhzViewIdTestPacket,
|
SubGhzViewIdTestPacket,
|
||||||
} SubGhzViewId;
|
} SubGhzViewId;
|
||||||
|
|
||||||
|
struct SubGhzPesetDefinition {
|
||||||
|
string_t name;
|
||||||
|
uint32_t frequency;
|
||||||
|
uint8_t* data;
|
||||||
|
size_t data_size;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct SubGhzPesetDefinition SubGhzPesetDefinition;
|
||||||
|
@ -48,8 +48,12 @@ bool subghz_scene_need_saving_on_event(void* context, SceneManagerEvent event) {
|
|||||||
} else if(event.event == SubGhzCustomEventSceneExit) {
|
} else if(event.event == SubGhzCustomEventSceneExit) {
|
||||||
if(subghz->txrx->rx_key_state == SubGhzRxKeyStateExit) {
|
if(subghz->txrx->rx_key_state == SubGhzRxKeyStateExit) {
|
||||||
subghz->txrx->rx_key_state = SubGhzRxKeyStateIDLE;
|
subghz->txrx->rx_key_state = SubGhzRxKeyStateIDLE;
|
||||||
subghz->txrx->frequency = subghz_setting_get_default_frequency(subghz->setting);
|
subghz_preset_init(
|
||||||
subghz->txrx->preset = FuriHalSubGhzPresetOok650Async;
|
subghz,
|
||||||
|
"AM650",
|
||||||
|
subghz_setting_get_default_frequency(subghz->setting),
|
||||||
|
NULL,
|
||||||
|
0);
|
||||||
scene_manager_search_and_switch_to_previous_scene(
|
scene_manager_search_and_switch_to_previous_scene(
|
||||||
subghz->scene_manager, SubGhzSceneStart);
|
subghz->scene_manager, SubGhzSceneStart);
|
||||||
} else {
|
} else {
|
||||||
|
@ -131,8 +131,12 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
|
|||||||
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneNeedSaving);
|
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneNeedSaving);
|
||||||
} else {
|
} else {
|
||||||
//Restore default setting
|
//Restore default setting
|
||||||
subghz->txrx->frequency = subghz_setting_get_default_frequency(subghz->setting);
|
subghz_preset_init(
|
||||||
subghz->txrx->preset = FuriHalSubGhzPresetOok650Async;
|
subghz,
|
||||||
|
"AM650",
|
||||||
|
subghz_setting_get_default_frequency(subghz->setting),
|
||||||
|
NULL,
|
||||||
|
0);
|
||||||
if(!scene_manager_search_and_switch_to_previous_scene(
|
if(!scene_manager_search_and_switch_to_previous_scene(
|
||||||
subghz->scene_manager, SubGhzSceneSaved)) {
|
subghz->scene_manager, SubGhzSceneSaved)) {
|
||||||
if(!scene_manager_search_and_switch_to_previous_scene(
|
if(!scene_manager_search_and_switch_to_previous_scene(
|
||||||
@ -268,13 +272,15 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
|
|||||||
if(subghz_protocol_raw_save_to_file_init(
|
if(subghz_protocol_raw_save_to_file_init(
|
||||||
(SubGhzProtocolDecoderRAW*)subghz->txrx->decoder_result,
|
(SubGhzProtocolDecoderRAW*)subghz->txrx->decoder_result,
|
||||||
RAW_FILE_NAME,
|
RAW_FILE_NAME,
|
||||||
subghz->txrx->frequency,
|
|
||||||
subghz->txrx->preset)) {
|
subghz->txrx->preset)) {
|
||||||
DOLPHIN_DEED(DolphinDeedSubGhzRawRec);
|
DOLPHIN_DEED(DolphinDeedSubGhzRawRec);
|
||||||
if((subghz->txrx->txrx_state == SubGhzTxRxStateIDLE) ||
|
if((subghz->txrx->txrx_state == SubGhzTxRxStateIDLE) ||
|
||||||
(subghz->txrx->txrx_state == SubGhzTxRxStateSleep)) {
|
(subghz->txrx->txrx_state == SubGhzTxRxStateSleep)) {
|
||||||
subghz_begin(subghz, subghz->txrx->preset);
|
subghz_begin(
|
||||||
subghz_rx(subghz, subghz->txrx->frequency);
|
subghz,
|
||||||
|
subghz_setting_get_preset_data_by_name(
|
||||||
|
subghz->setting, string_get_cstr(subghz->txrx->preset->name)));
|
||||||
|
subghz_rx(subghz, subghz->txrx->preset->frequency);
|
||||||
}
|
}
|
||||||
subghz->state_notifications = SubGhzNotificationStateRx;
|
subghz->state_notifications = SubGhzNotificationStateRx;
|
||||||
subghz->txrx->rx_key_state = SubGhzRxKeyStateAddKey;
|
subghz->txrx->rx_key_state = SubGhzRxKeyStateAddKey;
|
||||||
|
@ -75,8 +75,7 @@ static void subghz_scene_add_to_history_callback(
|
|||||||
string_t str_buff;
|
string_t str_buff;
|
||||||
string_init(str_buff);
|
string_init(str_buff);
|
||||||
|
|
||||||
if(subghz_history_add_to_history(
|
if(subghz_history_add_to_history(subghz->txrx->history, decoder_base, subghz->txrx->preset)) {
|
||||||
subghz->txrx->history, decoder_base, subghz->txrx->frequency, subghz->txrx->preset)) {
|
|
||||||
string_reset(str_buff);
|
string_reset(str_buff);
|
||||||
|
|
||||||
subghz->state_notifications = SubGhzNotificationStateRxDone;
|
subghz->state_notifications = SubGhzNotificationStateRxDone;
|
||||||
@ -103,8 +102,8 @@ void subghz_scene_receiver_on_enter(void* context) {
|
|||||||
string_init(str_buff);
|
string_init(str_buff);
|
||||||
|
|
||||||
if(subghz->txrx->rx_key_state == SubGhzRxKeyStateIDLE) {
|
if(subghz->txrx->rx_key_state == SubGhzRxKeyStateIDLE) {
|
||||||
subghz->txrx->frequency = subghz_setting_get_default_frequency(subghz->setting);
|
subghz_preset_init(
|
||||||
subghz->txrx->preset = FuriHalSubGhzPresetOok650Async;
|
subghz, "AM650", subghz_setting_get_default_frequency(subghz->setting), NULL, 0);
|
||||||
subghz_history_reset(subghz->txrx->history);
|
subghz_history_reset(subghz->txrx->history);
|
||||||
subghz->txrx->rx_key_state = SubGhzRxKeyStateStart;
|
subghz->txrx->rx_key_state = SubGhzRxKeyStateStart;
|
||||||
}
|
}
|
||||||
@ -135,8 +134,11 @@ void subghz_scene_receiver_on_enter(void* context) {
|
|||||||
};
|
};
|
||||||
if((subghz->txrx->txrx_state == SubGhzTxRxStateIDLE) ||
|
if((subghz->txrx->txrx_state == SubGhzTxRxStateIDLE) ||
|
||||||
(subghz->txrx->txrx_state == SubGhzTxRxStateSleep)) {
|
(subghz->txrx->txrx_state == SubGhzTxRxStateSleep)) {
|
||||||
subghz_begin(subghz, subghz->txrx->preset);
|
subghz_begin(
|
||||||
subghz_rx(subghz, subghz->txrx->frequency);
|
subghz,
|
||||||
|
subghz_setting_get_preset_data_by_name(
|
||||||
|
subghz->setting, string_get_cstr(subghz->txrx->preset->name)));
|
||||||
|
subghz_rx(subghz, subghz->txrx->preset->frequency);
|
||||||
}
|
}
|
||||||
subghz_view_receiver_set_idx_menu(subghz->subghz_receiver, subghz->txrx->idx_menu_chosen);
|
subghz_view_receiver_set_idx_menu(subghz->subghz_receiver, subghz->txrx->idx_menu_chosen);
|
||||||
|
|
||||||
@ -164,8 +166,12 @@ bool subghz_scene_receiver_on_event(void* context, SceneManagerEvent event) {
|
|||||||
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneNeedSaving);
|
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneNeedSaving);
|
||||||
} else {
|
} else {
|
||||||
subghz->txrx->rx_key_state = SubGhzRxKeyStateIDLE;
|
subghz->txrx->rx_key_state = SubGhzRxKeyStateIDLE;
|
||||||
subghz->txrx->frequency = subghz_setting_get_default_frequency(subghz->setting);
|
subghz_preset_init(
|
||||||
subghz->txrx->preset = FuriHalSubGhzPresetOok650Async;
|
subghz,
|
||||||
|
"AM650",
|
||||||
|
subghz_setting_get_default_frequency(subghz->setting),
|
||||||
|
NULL,
|
||||||
|
0);
|
||||||
scene_manager_search_and_switch_to_previous_scene(
|
scene_manager_search_and_switch_to_previous_scene(
|
||||||
subghz->scene_manager, SubGhzSceneStart);
|
subghz->scene_manager, SubGhzSceneStart);
|
||||||
}
|
}
|
||||||
|
@ -7,20 +7,6 @@ enum SubGhzSettingIndex {
|
|||||||
SubGhzSettingIndexLock,
|
SubGhzSettingIndexLock,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PRESET_COUNT 4
|
|
||||||
const char* const preset_text[PRESET_COUNT] = {
|
|
||||||
"AM270",
|
|
||||||
"AM650",
|
|
||||||
"FM238",
|
|
||||||
"FM476",
|
|
||||||
};
|
|
||||||
const uint32_t preset_value[PRESET_COUNT] = {
|
|
||||||
FuriHalSubGhzPresetOok270Async, /** OOK, bandwidth 270kHz, asynchronous */
|
|
||||||
FuriHalSubGhzPresetOok650Async, /** OOK, bandwidth 650kHz, asynchronous */
|
|
||||||
FuriHalSubGhzPreset2FSKDev238Async, /** FM, deviation 2.380371 kHz, asynchronous */
|
|
||||||
FuriHalSubGhzPreset2FSKDev476Async, /** FM, deviation 4.760742 kHz, asynchronous */
|
|
||||||
};
|
|
||||||
|
|
||||||
#define HOPPING_COUNT 2
|
#define HOPPING_COUNT 2
|
||||||
const char* const hopping_text[HOPPING_COUNT] = {
|
const char* const hopping_text[HOPPING_COUNT] = {
|
||||||
"OFF",
|
"OFF",
|
||||||
@ -31,22 +17,6 @@ const uint32_t hopping_value[HOPPING_COUNT] = {
|
|||||||
SubGhzHopperStateRunnig,
|
SubGhzHopperStateRunnig,
|
||||||
};
|
};
|
||||||
|
|
||||||
uint8_t subghz_scene_receiver_config_uint32_value_index(
|
|
||||||
const uint32_t value,
|
|
||||||
const uint32_t values[],
|
|
||||||
uint8_t values_count) {
|
|
||||||
int64_t last_value = INT64_MIN;
|
|
||||||
uint8_t index = 0;
|
|
||||||
for(uint8_t i = 0; i < values_count; i++) {
|
|
||||||
if((value >= last_value) && (value <= values[i])) {
|
|
||||||
index = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
last_value = values[i];
|
|
||||||
}
|
|
||||||
return index;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t subghz_scene_receiver_config_next_frequency(const uint32_t value, void* context) {
|
uint8_t subghz_scene_receiver_config_next_frequency(const uint32_t value, void* context) {
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhz* subghz = context;
|
SubGhz* subghz = context;
|
||||||
@ -62,6 +32,21 @@ uint8_t subghz_scene_receiver_config_next_frequency(const uint32_t value, void*
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t subghz_scene_receiver_config_next_preset(const char* preset_name, void* context) {
|
||||||
|
furi_assert(context);
|
||||||
|
SubGhz* subghz = context;
|
||||||
|
uint8_t index = 0;
|
||||||
|
for(uint8_t i = 0; i < subghz_setting_get_preset_count(subghz->setting); i++) {
|
||||||
|
if(!strcmp(subghz_setting_get_preset_name(subghz->setting, i), preset_name)) {
|
||||||
|
index = i;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
// index = subghz_setting_get_frequency_default_index(subghz->setting);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t subghz_scene_receiver_config_hopper_value_index(
|
uint8_t subghz_scene_receiver_config_hopper_value_index(
|
||||||
const uint32_t value,
|
const uint32_t value,
|
||||||
const uint32_t values[],
|
const uint32_t values[],
|
||||||
@ -94,7 +79,7 @@ static void subghz_scene_receiver_config_set_frequency(VariableItem* item) {
|
|||||||
subghz_setting_get_frequency(subghz->setting, index) / 1000000,
|
subghz_setting_get_frequency(subghz->setting, index) / 1000000,
|
||||||
(subghz_setting_get_frequency(subghz->setting, index) % 1000000) / 10000);
|
(subghz_setting_get_frequency(subghz->setting, index) % 1000000) / 10000);
|
||||||
variable_item_set_current_value_text(item, text_buf);
|
variable_item_set_current_value_text(item, text_buf);
|
||||||
subghz->txrx->frequency = subghz_setting_get_frequency(subghz->setting, index);
|
subghz->txrx->preset->frequency = subghz_setting_get_frequency(subghz->setting, index);
|
||||||
} else {
|
} else {
|
||||||
variable_item_set_current_value_index(
|
variable_item_set_current_value_index(
|
||||||
item, subghz_setting_get_frequency_default_index(subghz->setting));
|
item, subghz_setting_get_frequency_default_index(subghz->setting));
|
||||||
@ -104,9 +89,14 @@ static void subghz_scene_receiver_config_set_frequency(VariableItem* item) {
|
|||||||
static void subghz_scene_receiver_config_set_preset(VariableItem* item) {
|
static void subghz_scene_receiver_config_set_preset(VariableItem* item) {
|
||||||
SubGhz* subghz = variable_item_get_context(item);
|
SubGhz* subghz = variable_item_get_context(item);
|
||||||
uint8_t index = variable_item_get_current_value_index(item);
|
uint8_t index = variable_item_get_current_value_index(item);
|
||||||
|
variable_item_set_current_value_text(
|
||||||
variable_item_set_current_value_text(item, preset_text[index]);
|
item, subghz_setting_get_preset_name(subghz->setting, index));
|
||||||
subghz->txrx->preset = preset_value[index];
|
subghz_preset_init(
|
||||||
|
subghz,
|
||||||
|
subghz_setting_get_preset_name(subghz->setting, index),
|
||||||
|
subghz->txrx->preset->frequency,
|
||||||
|
subghz_setting_get_preset_data(subghz->setting, index),
|
||||||
|
subghz_setting_get_preset_data_size(subghz->setting, index));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void subghz_scene_receiver_config_set_hopping_runing(VariableItem* item) {
|
static void subghz_scene_receiver_config_set_hopping_runing(VariableItem* item) {
|
||||||
@ -125,7 +115,7 @@ static void subghz_scene_receiver_config_set_hopping_runing(VariableItem* item)
|
|||||||
(VariableItem*)scene_manager_get_scene_state(
|
(VariableItem*)scene_manager_get_scene_state(
|
||||||
subghz->scene_manager, SubGhzSceneReceiverConfig),
|
subghz->scene_manager, SubGhzSceneReceiverConfig),
|
||||||
text_buf);
|
text_buf);
|
||||||
subghz->txrx->frequency = subghz_setting_get_default_frequency(subghz->setting);
|
subghz->txrx->preset->frequency = subghz_setting_get_default_frequency(subghz->setting);
|
||||||
variable_item_set_current_value_index(
|
variable_item_set_current_value_index(
|
||||||
(VariableItem*)scene_manager_get_scene_state(
|
(VariableItem*)scene_manager_get_scene_state(
|
||||||
subghz->scene_manager, SubGhzSceneReceiverConfig),
|
subghz->scene_manager, SubGhzSceneReceiverConfig),
|
||||||
@ -164,7 +154,8 @@ void subghz_scene_receiver_config_on_enter(void* context) {
|
|||||||
subghz_setting_get_frequency_count(subghz->setting),
|
subghz_setting_get_frequency_count(subghz->setting),
|
||||||
subghz_scene_receiver_config_set_frequency,
|
subghz_scene_receiver_config_set_frequency,
|
||||||
subghz);
|
subghz);
|
||||||
value_index = subghz_scene_receiver_config_next_frequency(subghz->txrx->frequency, subghz);
|
value_index =
|
||||||
|
subghz_scene_receiver_config_next_frequency(subghz->txrx->preset->frequency, subghz);
|
||||||
scene_manager_set_scene_state(
|
scene_manager_set_scene_state(
|
||||||
subghz->scene_manager, SubGhzSceneReceiverConfig, (uint32_t)item);
|
subghz->scene_manager, SubGhzSceneReceiverConfig, (uint32_t)item);
|
||||||
variable_item_set_current_value_index(item, value_index);
|
variable_item_set_current_value_index(item, value_index);
|
||||||
@ -193,13 +184,14 @@ void subghz_scene_receiver_config_on_enter(void* context) {
|
|||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
subghz->variable_item_list,
|
subghz->variable_item_list,
|
||||||
"Modulation:",
|
"Modulation:",
|
||||||
PRESET_COUNT,
|
subghz_setting_get_preset_count(subghz->setting),
|
||||||
subghz_scene_receiver_config_set_preset,
|
subghz_scene_receiver_config_set_preset,
|
||||||
subghz);
|
subghz);
|
||||||
value_index = subghz_scene_receiver_config_uint32_value_index(
|
value_index = subghz_scene_receiver_config_next_preset(
|
||||||
subghz->txrx->preset, preset_value, PRESET_COUNT);
|
string_get_cstr(subghz->txrx->preset->name), subghz);
|
||||||
variable_item_set_current_value_index(item, value_index);
|
variable_item_set_current_value_index(item, value_index);
|
||||||
variable_item_set_current_value_text(item, preset_text[value_index]);
|
variable_item_set_current_value_text(
|
||||||
|
item, subghz_setting_get_preset_name(subghz->setting, value_index));
|
||||||
|
|
||||||
if(scene_manager_get_scene_state(subghz->scene_manager, SubGhzSceneReadRAW) !=
|
if(scene_manager_get_scene_state(subghz->scene_manager, SubGhzSceneReadRAW) !=
|
||||||
SubGhzCustomEventManagerSet) {
|
SubGhzCustomEventManagerSet) {
|
||||||
|
@ -27,10 +27,16 @@ static bool subghz_scene_receiver_info_update_parser(void* context) {
|
|||||||
subghz_protocol_decoder_base_deserialize(
|
subghz_protocol_decoder_base_deserialize(
|
||||||
subghz->txrx->decoder_result,
|
subghz->txrx->decoder_result,
|
||||||
subghz_history_get_raw_data(subghz->txrx->history, subghz->txrx->idx_menu_chosen));
|
subghz_history_get_raw_data(subghz->txrx->history, subghz->txrx->idx_menu_chosen));
|
||||||
subghz->txrx->frequency =
|
|
||||||
subghz_history_get_frequency(subghz->txrx->history, subghz->txrx->idx_menu_chosen);
|
SubGhzPesetDefinition* preset =
|
||||||
subghz->txrx->preset =
|
subghz_history_get_presset(subghz->txrx->history, subghz->txrx->idx_menu_chosen);
|
||||||
subghz_history_get_preset(subghz->txrx->history, subghz->txrx->idx_menu_chosen);
|
subghz_preset_init(
|
||||||
|
subghz,
|
||||||
|
string_get_cstr(preset->name),
|
||||||
|
preset->frequency,
|
||||||
|
preset->data,
|
||||||
|
preset->data_size);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -137,8 +143,11 @@ bool subghz_scene_receiver_info_on_event(void* context, SceneManagerEvent event)
|
|||||||
subghz_tx_stop(subghz);
|
subghz_tx_stop(subghz);
|
||||||
}
|
}
|
||||||
if(subghz->txrx->txrx_state == SubGhzTxRxStateIDLE) {
|
if(subghz->txrx->txrx_state == SubGhzTxRxStateIDLE) {
|
||||||
subghz_begin(subghz, subghz->txrx->preset);
|
subghz_begin(
|
||||||
subghz_rx(subghz, subghz->txrx->frequency);
|
subghz,
|
||||||
|
subghz_setting_get_preset_data_by_name(
|
||||||
|
subghz->setting, string_get_cstr(subghz->txrx->preset->name)));
|
||||||
|
subghz_rx(subghz, subghz->txrx->preset->frequency);
|
||||||
}
|
}
|
||||||
if(subghz->txrx->hopper_state == SubGhzHopperStatePause) {
|
if(subghz->txrx->hopper_state == SubGhzHopperStatePause) {
|
||||||
subghz->txrx->hopper_state = SubGhzHopperStateRunnig;
|
subghz->txrx->hopper_state = SubGhzHopperStateRunnig;
|
||||||
|
@ -16,12 +16,13 @@ bool subghz_scene_set_type_submenu_gen_data_protocol(
|
|||||||
uint64_t key,
|
uint64_t key,
|
||||||
uint32_t bit,
|
uint32_t bit,
|
||||||
uint32_t frequency,
|
uint32_t frequency,
|
||||||
FuriHalSubGhzPreset preset) {
|
const char* preset_name) {
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhz* subghz = context;
|
SubGhz* subghz = context;
|
||||||
|
|
||||||
bool res = false;
|
bool res = false;
|
||||||
|
|
||||||
|
subghz_preset_init(subghz, preset_name, frequency, NULL, 0);
|
||||||
subghz->txrx->decoder_result =
|
subghz->txrx->decoder_result =
|
||||||
subghz_receiver_search_decoder_base_by_name(subghz->txrx->receiver, protocol_name);
|
subghz_receiver_search_decoder_base_by_name(subghz->txrx->receiver, protocol_name);
|
||||||
|
|
||||||
@ -35,7 +36,7 @@ bool subghz_scene_set_type_submenu_gen_data_protocol(
|
|||||||
Stream* fff_data_stream = flipper_format_get_raw_stream(subghz->txrx->fff_data);
|
Stream* fff_data_stream = flipper_format_get_raw_stream(subghz->txrx->fff_data);
|
||||||
stream_clean(fff_data_stream);
|
stream_clean(fff_data_stream);
|
||||||
if(!subghz_protocol_decoder_base_serialize(
|
if(!subghz_protocol_decoder_base_serialize(
|
||||||
subghz->txrx->decoder_result, subghz->txrx->fff_data, frequency, preset)) {
|
subghz->txrx->decoder_result, subghz->txrx->fff_data, subghz->txrx->preset)) {
|
||||||
FURI_LOG_E(TAG, "Unable to serialize");
|
FURI_LOG_E(TAG, "Unable to serialize");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -177,12 +178,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
|
|||||||
case SubmenuIndexPricenton:
|
case SubmenuIndexPricenton:
|
||||||
key = (key & 0x00FFFFF0) | 0x4; //btn 0x1, 0x2, 0x4, 0x8
|
key = (key & 0x00FFFFF0) | 0x4; //btn 0x1, 0x2, 0x4, 0x8
|
||||||
if(subghz_scene_set_type_submenu_gen_data_protocol(
|
if(subghz_scene_set_type_submenu_gen_data_protocol(
|
||||||
subghz,
|
subghz, SUBGHZ_PROTOCOL_PRINCETON_NAME, key, 24, 433920000, "AM650")) {
|
||||||
SUBGHZ_PROTOCOL_PRINCETON_NAME,
|
|
||||||
key,
|
|
||||||
24,
|
|
||||||
433920000,
|
|
||||||
FuriHalSubGhzPresetOok650Async)) {
|
|
||||||
uint32_t te = 400;
|
uint32_t te = 400;
|
||||||
flipper_format_update_uint32(subghz->txrx->fff_data, "TE", (uint32_t*)&te, 1);
|
flipper_format_update_uint32(subghz->txrx->fff_data, "TE", (uint32_t*)&te, 1);
|
||||||
generated_protocol = true;
|
generated_protocol = true;
|
||||||
@ -191,60 +187,35 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
|
|||||||
case SubmenuIndexNiceFlo12bit:
|
case SubmenuIndexNiceFlo12bit:
|
||||||
key = (key & 0x0000FFF0) | 0x1; //btn 0x1, 0x2, 0x4
|
key = (key & 0x0000FFF0) | 0x1; //btn 0x1, 0x2, 0x4
|
||||||
if(subghz_scene_set_type_submenu_gen_data_protocol(
|
if(subghz_scene_set_type_submenu_gen_data_protocol(
|
||||||
subghz,
|
subghz, SUBGHZ_PROTOCOL_NICE_FLO_NAME, key, 12, 433920000, "AM650")) {
|
||||||
SUBGHZ_PROTOCOL_NICE_FLO_NAME,
|
|
||||||
key,
|
|
||||||
12,
|
|
||||||
433920000,
|
|
||||||
FuriHalSubGhzPresetOok650Async)) {
|
|
||||||
generated_protocol = true;
|
generated_protocol = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SubmenuIndexNiceFlo24bit:
|
case SubmenuIndexNiceFlo24bit:
|
||||||
key = (key & 0x00FFFFF0) | 0x4; //btn 0x1, 0x2, 0x4, 0x8
|
key = (key & 0x00FFFFF0) | 0x4; //btn 0x1, 0x2, 0x4, 0x8
|
||||||
if(subghz_scene_set_type_submenu_gen_data_protocol(
|
if(subghz_scene_set_type_submenu_gen_data_protocol(
|
||||||
subghz,
|
subghz, SUBGHZ_PROTOCOL_NICE_FLO_NAME, key, 24, 433920000, "AM650")) {
|
||||||
SUBGHZ_PROTOCOL_NICE_FLO_NAME,
|
|
||||||
key,
|
|
||||||
24,
|
|
||||||
433920000,
|
|
||||||
FuriHalSubGhzPresetOok650Async)) {
|
|
||||||
generated_protocol = true;
|
generated_protocol = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SubmenuIndexCAME12bit:
|
case SubmenuIndexCAME12bit:
|
||||||
key = (key & 0x0000FFF0) | 0x1; //btn 0x1, 0x2, 0x4
|
key = (key & 0x0000FFF0) | 0x1; //btn 0x1, 0x2, 0x4
|
||||||
if(subghz_scene_set_type_submenu_gen_data_protocol(
|
if(subghz_scene_set_type_submenu_gen_data_protocol(
|
||||||
subghz,
|
subghz, SUBGHZ_PROTOCOL_CAME_NAME, key, 12, 433920000, "AM650")) {
|
||||||
SUBGHZ_PROTOCOL_CAME_NAME,
|
|
||||||
key,
|
|
||||||
12,
|
|
||||||
433920000,
|
|
||||||
FuriHalSubGhzPresetOok650Async)) {
|
|
||||||
generated_protocol = true;
|
generated_protocol = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SubmenuIndexCAME24bit:
|
case SubmenuIndexCAME24bit:
|
||||||
key = (key & 0x00FFFFF0) | 0x4; //btn 0x1, 0x2, 0x4, 0x8
|
key = (key & 0x00FFFFF0) | 0x4; //btn 0x1, 0x2, 0x4, 0x8
|
||||||
if(subghz_scene_set_type_submenu_gen_data_protocol(
|
if(subghz_scene_set_type_submenu_gen_data_protocol(
|
||||||
subghz,
|
subghz, SUBGHZ_PROTOCOL_CAME_NAME, key, 24, 433920000, "AM650")) {
|
||||||
SUBGHZ_PROTOCOL_CAME_NAME,
|
|
||||||
key,
|
|
||||||
24,
|
|
||||||
433920000,
|
|
||||||
FuriHalSubGhzPresetOok650Async)) {
|
|
||||||
generated_protocol = true;
|
generated_protocol = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SubmenuIndexLinear_300_00:
|
case SubmenuIndexLinear_300_00:
|
||||||
key = (key & 0x3FF);
|
key = (key & 0x3FF);
|
||||||
if(subghz_scene_set_type_submenu_gen_data_protocol(
|
if(subghz_scene_set_type_submenu_gen_data_protocol(
|
||||||
subghz,
|
subghz, SUBGHZ_PROTOCOL_LINEAR_NAME, key, 10, 300000000, "AM650")) {
|
||||||
SUBGHZ_PROTOCOL_LINEAR_NAME,
|
|
||||||
key,
|
|
||||||
10,
|
|
||||||
300000000,
|
|
||||||
FuriHalSubGhzPresetOok650Async)) {
|
|
||||||
generated_protocol = true;
|
generated_protocol = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -252,12 +223,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
|
|||||||
key = (key & 0x0FFFFFF0);
|
key = (key & 0x0FFFFFF0);
|
||||||
key = 0x003FFF7200000000 | (key ^ 0xE0E0E0EE);
|
key = 0x003FFF7200000000 | (key ^ 0xE0E0E0EE);
|
||||||
if(subghz_scene_set_type_submenu_gen_data_protocol(
|
if(subghz_scene_set_type_submenu_gen_data_protocol(
|
||||||
subghz,
|
subghz, SUBGHZ_PROTOCOL_CAME_TWEE_NAME, key, 54, 433920000, "AM650")) {
|
||||||
SUBGHZ_PROTOCOL_CAME_TWEE_NAME,
|
|
||||||
key,
|
|
||||||
54,
|
|
||||||
433920000,
|
|
||||||
FuriHalSubGhzPresetOok650Async)) {
|
|
||||||
generated_protocol = true;
|
generated_protocol = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -271,18 +237,15 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
|
|||||||
key = (key & 0x00F0FF00) | 0xF << 16 | 0x40; //btn 0xF, 0xC, 0xA, 0x6 (?)
|
key = (key & 0x00F0FF00) | 0xF << 16 | 0x40; //btn 0xF, 0xC, 0xA, 0x6 (?)
|
||||||
uint64_t rev_key = subghz_protocol_blocks_reverse_key(key, 24);
|
uint64_t rev_key = subghz_protocol_blocks_reverse_key(key, 24);
|
||||||
if(subghz_scene_set_type_submenu_gen_data_protocol(
|
if(subghz_scene_set_type_submenu_gen_data_protocol(
|
||||||
subghz,
|
subghz, SUBGHZ_PROTOCOL_GATE_TX_NAME, rev_key, 24, 433920000, "AM650")) {
|
||||||
SUBGHZ_PROTOCOL_GATE_TX_NAME,
|
|
||||||
rev_key,
|
|
||||||
24,
|
|
||||||
433920000,
|
|
||||||
FuriHalSubGhzPresetOok650Async)) {
|
|
||||||
generated_protocol = true;
|
generated_protocol = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SubmenuIndexDoorHan_433_92:
|
case SubmenuIndexDoorHan_433_92:
|
||||||
subghz->txrx->transmitter = subghz_transmitter_alloc_init(
|
subghz->txrx->transmitter = subghz_transmitter_alloc_init(
|
||||||
subghz->txrx->environment, SUBGHZ_PROTOCOL_KEELOQ_NAME);
|
subghz->txrx->environment, SUBGHZ_PROTOCOL_KEELOQ_NAME);
|
||||||
|
subghz_preset_init(
|
||||||
|
subghz, "AM650", subghz_setting_get_default_frequency(subghz->setting), NULL, 0);
|
||||||
if(subghz->txrx->transmitter) {
|
if(subghz->txrx->transmitter) {
|
||||||
subghz_protocol_keeloq_create_data(
|
subghz_protocol_keeloq_create_data(
|
||||||
subghz_transmitter_get_protocol_instance(subghz->txrx->transmitter),
|
subghz_transmitter_get_protocol_instance(subghz->txrx->transmitter),
|
||||||
@ -291,8 +254,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
|
|||||||
0x2,
|
0x2,
|
||||||
0x0003,
|
0x0003,
|
||||||
"DoorHan",
|
"DoorHan",
|
||||||
subghz_setting_get_default_frequency(subghz->setting),
|
subghz->txrx->preset);
|
||||||
FuriHalSubGhzPresetOok650Async);
|
|
||||||
generated_protocol = true;
|
generated_protocol = true;
|
||||||
} else {
|
} else {
|
||||||
generated_protocol = false;
|
generated_protocol = false;
|
||||||
@ -307,6 +269,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
|
|||||||
case SubmenuIndexDoorHan_315_00:
|
case SubmenuIndexDoorHan_315_00:
|
||||||
subghz->txrx->transmitter = subghz_transmitter_alloc_init(
|
subghz->txrx->transmitter = subghz_transmitter_alloc_init(
|
||||||
subghz->txrx->environment, SUBGHZ_PROTOCOL_KEELOQ_NAME);
|
subghz->txrx->environment, SUBGHZ_PROTOCOL_KEELOQ_NAME);
|
||||||
|
subghz_preset_init(subghz, "AM650", 315000000, NULL, 0);
|
||||||
if(subghz->txrx->transmitter) {
|
if(subghz->txrx->transmitter) {
|
||||||
subghz_protocol_keeloq_create_data(
|
subghz_protocol_keeloq_create_data(
|
||||||
subghz_transmitter_get_protocol_instance(subghz->txrx->transmitter),
|
subghz_transmitter_get_protocol_instance(subghz->txrx->transmitter),
|
||||||
@ -315,8 +278,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
|
|||||||
0x2,
|
0x2,
|
||||||
0x0003,
|
0x0003,
|
||||||
"DoorHan",
|
"DoorHan",
|
||||||
315000000,
|
subghz->txrx->preset);
|
||||||
FuriHalSubGhzPresetOok650Async);
|
|
||||||
generated_protocol = true;
|
generated_protocol = true;
|
||||||
} else {
|
} else {
|
||||||
generated_protocol = false;
|
generated_protocol = false;
|
||||||
@ -338,7 +300,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
|
|||||||
(uint64_t)key << 32 | 0xE6000000,
|
(uint64_t)key << 32 | 0xE6000000,
|
||||||
42,
|
42,
|
||||||
315000000,
|
315000000,
|
||||||
FuriHalSubGhzPresetOok650Async)) {
|
"AM650")) {
|
||||||
generated_protocol = true;
|
generated_protocol = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -352,13 +314,14 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
|
|||||||
(uint64_t)key << 32 | 0xE6000000,
|
(uint64_t)key << 32 | 0xE6000000,
|
||||||
42,
|
42,
|
||||||
390000000,
|
390000000,
|
||||||
FuriHalSubGhzPresetOok650Async)) {
|
"AM650")) {
|
||||||
generated_protocol = true;
|
generated_protocol = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SubmenuIndexSecPlus_v2_310_00:
|
case SubmenuIndexSecPlus_v2_310_00:
|
||||||
subghz->txrx->transmitter = subghz_transmitter_alloc_init(
|
subghz->txrx->transmitter = subghz_transmitter_alloc_init(
|
||||||
subghz->txrx->environment, SUBGHZ_PROTOCOL_SECPLUS_V2_NAME);
|
subghz->txrx->environment, SUBGHZ_PROTOCOL_SECPLUS_V2_NAME);
|
||||||
|
subghz_preset_init(subghz, "AM650", 310000000, NULL, 0);
|
||||||
if(subghz->txrx->transmitter) {
|
if(subghz->txrx->transmitter) {
|
||||||
subghz_protocol_secplus_v2_create_data(
|
subghz_protocol_secplus_v2_create_data(
|
||||||
subghz_transmitter_get_protocol_instance(subghz->txrx->transmitter),
|
subghz_transmitter_get_protocol_instance(subghz->txrx->transmitter),
|
||||||
@ -366,8 +329,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
|
|||||||
key,
|
key,
|
||||||
0x68,
|
0x68,
|
||||||
0xE500000,
|
0xE500000,
|
||||||
310000000,
|
subghz->txrx->preset);
|
||||||
FuriHalSubGhzPresetOok650Async);
|
|
||||||
generated_protocol = true;
|
generated_protocol = true;
|
||||||
} else {
|
} else {
|
||||||
generated_protocol = false;
|
generated_protocol = false;
|
||||||
@ -377,6 +339,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
|
|||||||
case SubmenuIndexSecPlus_v2_315_00:
|
case SubmenuIndexSecPlus_v2_315_00:
|
||||||
subghz->txrx->transmitter = subghz_transmitter_alloc_init(
|
subghz->txrx->transmitter = subghz_transmitter_alloc_init(
|
||||||
subghz->txrx->environment, SUBGHZ_PROTOCOL_SECPLUS_V2_NAME);
|
subghz->txrx->environment, SUBGHZ_PROTOCOL_SECPLUS_V2_NAME);
|
||||||
|
subghz_preset_init(subghz, "AM650", 315000000, NULL, 0);
|
||||||
if(subghz->txrx->transmitter) {
|
if(subghz->txrx->transmitter) {
|
||||||
subghz_protocol_secplus_v2_create_data(
|
subghz_protocol_secplus_v2_create_data(
|
||||||
subghz_transmitter_get_protocol_instance(subghz->txrx->transmitter),
|
subghz_transmitter_get_protocol_instance(subghz->txrx->transmitter),
|
||||||
@ -384,8 +347,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
|
|||||||
key,
|
key,
|
||||||
0x68,
|
0x68,
|
||||||
0xE500000,
|
0xE500000,
|
||||||
315000000,
|
subghz->txrx->preset);
|
||||||
FuriHalSubGhzPresetOok650Async);
|
|
||||||
generated_protocol = true;
|
generated_protocol = true;
|
||||||
} else {
|
} else {
|
||||||
generated_protocol = false;
|
generated_protocol = false;
|
||||||
@ -395,6 +357,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
|
|||||||
case SubmenuIndexSecPlus_v2_390_00:
|
case SubmenuIndexSecPlus_v2_390_00:
|
||||||
subghz->txrx->transmitter = subghz_transmitter_alloc_init(
|
subghz->txrx->transmitter = subghz_transmitter_alloc_init(
|
||||||
subghz->txrx->environment, SUBGHZ_PROTOCOL_SECPLUS_V2_NAME);
|
subghz->txrx->environment, SUBGHZ_PROTOCOL_SECPLUS_V2_NAME);
|
||||||
|
subghz_preset_init(subghz, "AM650", 390000000, NULL, 0);
|
||||||
if(subghz->txrx->transmitter) {
|
if(subghz->txrx->transmitter) {
|
||||||
subghz_protocol_secplus_v2_create_data(
|
subghz_protocol_secplus_v2_create_data(
|
||||||
subghz_transmitter_get_protocol_instance(subghz->txrx->transmitter),
|
subghz_transmitter_get_protocol_instance(subghz->txrx->transmitter),
|
||||||
@ -402,8 +365,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
|
|||||||
key,
|
key,
|
||||||
0x68,
|
0x68,
|
||||||
0xE500000,
|
0xE500000,
|
||||||
390000000,
|
subghz->txrx->preset);
|
||||||
FuriHalSubGhzPresetOok650Async);
|
|
||||||
generated_protocol = true;
|
generated_protocol = true;
|
||||||
} else {
|
} else {
|
||||||
generated_protocol = false;
|
generated_protocol = false;
|
||||||
|
@ -199,8 +199,11 @@ SubGhz* subghz_alloc() {
|
|||||||
//init Worker & Protocol & History & KeyBoard
|
//init Worker & Protocol & History & KeyBoard
|
||||||
subghz->lock = SubGhzLockOff;
|
subghz->lock = SubGhzLockOff;
|
||||||
subghz->txrx = malloc(sizeof(SubGhzTxRx));
|
subghz->txrx = malloc(sizeof(SubGhzTxRx));
|
||||||
subghz->txrx->frequency = subghz_setting_get_default_frequency(subghz->setting);
|
subghz->txrx->preset = malloc(sizeof(SubGhzPesetDefinition));
|
||||||
subghz->txrx->preset = FuriHalSubGhzPresetOok650Async;
|
string_init(subghz->txrx->preset->name);
|
||||||
|
subghz_preset_init(
|
||||||
|
subghz, "AM650", subghz_setting_get_default_frequency(subghz->setting), NULL, 0);
|
||||||
|
|
||||||
subghz->txrx->txrx_state = SubGhzTxRxStateSleep;
|
subghz->txrx->txrx_state = SubGhzTxRxStateSleep;
|
||||||
subghz->txrx->hopper_state = SubGhzHopperStateOFF;
|
subghz->txrx->hopper_state = SubGhzHopperStateOFF;
|
||||||
subghz->txrx->rx_key_state = SubGhzRxKeyStateIDLE;
|
subghz->txrx->rx_key_state = SubGhzRxKeyStateIDLE;
|
||||||
@ -308,6 +311,8 @@ void subghz_free(SubGhz* subghz) {
|
|||||||
subghz_worker_free(subghz->txrx->worker);
|
subghz_worker_free(subghz->txrx->worker);
|
||||||
flipper_format_free(subghz->txrx->fff_data);
|
flipper_format_free(subghz->txrx->fff_data);
|
||||||
subghz_history_free(subghz->txrx->history);
|
subghz_history_free(subghz->txrx->history);
|
||||||
|
string_clear(subghz->txrx->preset->name);
|
||||||
|
free(subghz->txrx->preset);
|
||||||
free(subghz->txrx);
|
free(subghz->txrx);
|
||||||
|
|
||||||
//Error string
|
//Error string
|
||||||
|
@ -12,8 +12,7 @@ typedef struct {
|
|||||||
string_t item_str;
|
string_t item_str;
|
||||||
FlipperFormat* flipper_string;
|
FlipperFormat* flipper_string;
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
FuriHalSubGhzPreset preset;
|
SubGhzPesetDefinition* preset;
|
||||||
uint32_t frequency;
|
|
||||||
} SubGhzHistoryItem;
|
} SubGhzHistoryItem;
|
||||||
|
|
||||||
ARRAY_DEF(SubGhzHistoryItemArray, SubGhzHistoryItem, M_POD_OPLIST)
|
ARRAY_DEF(SubGhzHistoryItemArray, SubGhzHistoryItem, M_POD_OPLIST)
|
||||||
@ -46,6 +45,8 @@ void subghz_history_free(SubGhzHistory* instance) {
|
|||||||
for
|
for
|
||||||
M_EACH(item, instance->history->data, SubGhzHistoryItemArray_t) {
|
M_EACH(item, instance->history->data, SubGhzHistoryItemArray_t) {
|
||||||
string_clear(item->item_str);
|
string_clear(item->item_str);
|
||||||
|
string_clear(item->preset->name);
|
||||||
|
free(item->preset);
|
||||||
flipper_format_free(item->flipper_string);
|
flipper_format_free(item->flipper_string);
|
||||||
item->type = 0;
|
item->type = 0;
|
||||||
}
|
}
|
||||||
@ -57,21 +58,29 @@ void subghz_history_free(SubGhzHistory* instance) {
|
|||||||
uint32_t subghz_history_get_frequency(SubGhzHistory* instance, uint16_t idx) {
|
uint32_t subghz_history_get_frequency(SubGhzHistory* instance, uint16_t idx) {
|
||||||
furi_assert(instance);
|
furi_assert(instance);
|
||||||
SubGhzHistoryItem* item = SubGhzHistoryItemArray_get(instance->history->data, idx);
|
SubGhzHistoryItem* item = SubGhzHistoryItemArray_get(instance->history->data, idx);
|
||||||
return item->frequency;
|
return item->preset->frequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
FuriHalSubGhzPreset subghz_history_get_preset(SubGhzHistory* instance, uint16_t idx) {
|
SubGhzPesetDefinition* subghz_history_get_presset(SubGhzHistory* instance, uint16_t idx) {
|
||||||
furi_assert(instance);
|
furi_assert(instance);
|
||||||
SubGhzHistoryItem* item = SubGhzHistoryItemArray_get(instance->history->data, idx);
|
SubGhzHistoryItem* item = SubGhzHistoryItemArray_get(instance->history->data, idx);
|
||||||
return item->preset;
|
return item->preset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* subghz_history_get_preset(SubGhzHistory* instance, uint16_t idx) {
|
||||||
|
furi_assert(instance);
|
||||||
|
SubGhzHistoryItem* item = SubGhzHistoryItemArray_get(instance->history->data, idx);
|
||||||
|
return string_get_cstr(item->preset->name);
|
||||||
|
}
|
||||||
|
|
||||||
void subghz_history_reset(SubGhzHistory* instance) {
|
void subghz_history_reset(SubGhzHistory* instance) {
|
||||||
furi_assert(instance);
|
furi_assert(instance);
|
||||||
string_reset(instance->tmp_string);
|
string_reset(instance->tmp_string);
|
||||||
for
|
for
|
||||||
M_EACH(item, instance->history->data, SubGhzHistoryItemArray_t) {
|
M_EACH(item, instance->history->data, SubGhzHistoryItemArray_t) {
|
||||||
string_clear(item->item_str);
|
string_clear(item->item_str);
|
||||||
|
string_clear(item->preset->name);
|
||||||
|
free(item->preset);
|
||||||
flipper_format_free(item->flipper_string);
|
flipper_format_free(item->flipper_string);
|
||||||
item->type = 0;
|
item->type = 0;
|
||||||
}
|
}
|
||||||
@ -130,8 +139,7 @@ void subghz_history_get_text_item_menu(SubGhzHistory* instance, string_t output,
|
|||||||
bool subghz_history_add_to_history(
|
bool subghz_history_add_to_history(
|
||||||
SubGhzHistory* instance,
|
SubGhzHistory* instance,
|
||||||
void* context,
|
void* context,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(instance);
|
furi_assert(instance);
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
|
|
||||||
@ -151,13 +159,17 @@ bool subghz_history_add_to_history(
|
|||||||
string_t text;
|
string_t text;
|
||||||
string_init(text);
|
string_init(text);
|
||||||
SubGhzHistoryItem* item = SubGhzHistoryItemArray_push_raw(instance->history->data);
|
SubGhzHistoryItem* item = SubGhzHistoryItemArray_push_raw(instance->history->data);
|
||||||
|
item->preset = malloc(sizeof(SubGhzPesetDefinition));
|
||||||
item->type = decoder_base->protocol->type;
|
item->type = decoder_base->protocol->type;
|
||||||
item->frequency = frequency;
|
item->preset->frequency = preset->frequency;
|
||||||
item->preset = preset;
|
string_init(item->preset->name);
|
||||||
|
string_set(item->preset->name, preset->name);
|
||||||
|
item->preset->data = preset->data;
|
||||||
|
item->preset->data_size = preset->data_size;
|
||||||
|
|
||||||
string_init(item->item_str);
|
string_init(item->item_str);
|
||||||
item->flipper_string = flipper_format_string_alloc();
|
item->flipper_string = flipper_format_string_alloc();
|
||||||
subghz_protocol_decoder_base_serialize(decoder_base, item->flipper_string, frequency, preset);
|
subghz_protocol_decoder_base_serialize(decoder_base, item->flipper_string, preset);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if(!flipper_format_rewind(item->flipper_string)) {
|
if(!flipper_format_rewind(item->flipper_string)) {
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <furi.h>
|
#include <furi.h>
|
||||||
#include <furi_hal.h>
|
#include <furi_hal.h>
|
||||||
#include <lib/flipper_format/flipper_format.h>
|
#include <lib/flipper_format/flipper_format.h>
|
||||||
|
#include "helpers/subghz_types.h"
|
||||||
|
|
||||||
typedef struct SubGhzHistory SubGhzHistory;
|
typedef struct SubGhzHistory SubGhzHistory;
|
||||||
|
|
||||||
@ -34,13 +35,15 @@ void subghz_history_reset(SubGhzHistory* instance);
|
|||||||
*/
|
*/
|
||||||
uint32_t subghz_history_get_frequency(SubGhzHistory* instance, uint16_t idx);
|
uint32_t subghz_history_get_frequency(SubGhzHistory* instance, uint16_t idx);
|
||||||
|
|
||||||
|
SubGhzPesetDefinition* subghz_history_get_presset(SubGhzHistory* instance, uint16_t idx);
|
||||||
|
|
||||||
/** Get preset to history[idx]
|
/** Get preset to history[idx]
|
||||||
*
|
*
|
||||||
* @param instance - SubGhzHistory instance
|
* @param instance - SubGhzHistory instance
|
||||||
* @param idx - record index
|
* @param idx - record index
|
||||||
* @return preset - FuriHalSubGhzPreset preset
|
* @return preset - preset name
|
||||||
*/
|
*/
|
||||||
FuriHalSubGhzPreset subghz_history_get_preset(SubGhzHistory* instance, uint16_t idx);
|
const char* subghz_history_get_preset(SubGhzHistory* instance, uint16_t idx);
|
||||||
|
|
||||||
/** Get history index write
|
/** Get history index write
|
||||||
*
|
*
|
||||||
@ -85,15 +88,13 @@ bool subghz_history_get_text_space_left(SubGhzHistory* instance, string_t output
|
|||||||
*
|
*
|
||||||
* @param instance - SubGhzHistory instance
|
* @param instance - SubGhzHistory instance
|
||||||
* @param context - SubGhzProtocolCommon context
|
* @param context - SubGhzProtocolCommon context
|
||||||
* @param frequency - frequency Hz
|
* @param preset - SubGhzPesetDefinition preset
|
||||||
* @param preset - FuriHalSubGhzPreset preset
|
|
||||||
* @return bool;
|
* @return bool;
|
||||||
*/
|
*/
|
||||||
bool subghz_history_add_to_history(
|
bool subghz_history_add_to_history(
|
||||||
SubGhzHistory* instance,
|
SubGhzHistory* instance,
|
||||||
void* context,
|
void* context,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/** Get SubGhzProtocolCommonLoad to load into the protocol decoder bin data
|
/** Get SubGhzProtocolCommonLoad to load into the protocol decoder bin data
|
||||||
*
|
*
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include "subghz_i.h"
|
#include "subghz_i.h"
|
||||||
|
|
||||||
#include "assets_icons.h"
|
#include "assets_icons.h"
|
||||||
#include "m-string.h"
|
|
||||||
#include "subghz/types.h"
|
#include "subghz/types.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <furi.h>
|
#include <furi.h>
|
||||||
@ -19,15 +18,31 @@
|
|||||||
|
|
||||||
#define TAG "SubGhz"
|
#define TAG "SubGhz"
|
||||||
|
|
||||||
|
void subghz_preset_init(
|
||||||
|
void* context,
|
||||||
|
const char* preset_name,
|
||||||
|
uint32_t frequency,
|
||||||
|
uint8_t* preset_data,
|
||||||
|
size_t preset_data_size) {
|
||||||
|
furi_assert(context);
|
||||||
|
SubGhz* subghz = context;
|
||||||
|
string_set(subghz->txrx->preset->name, preset_name);
|
||||||
|
subghz->txrx->preset->frequency = frequency;
|
||||||
|
subghz->txrx->preset->data = preset_data;
|
||||||
|
subghz->txrx->preset->data_size = preset_data_size;
|
||||||
|
}
|
||||||
|
|
||||||
bool subghz_set_preset(SubGhz* subghz, const char* preset) {
|
bool subghz_set_preset(SubGhz* subghz, const char* preset) {
|
||||||
if(!strcmp(preset, "FuriHalSubGhzPresetOok270Async")) {
|
if(!strcmp(preset, "FuriHalSubGhzPresetOok270Async")) {
|
||||||
subghz->txrx->preset = FuriHalSubGhzPresetOok270Async;
|
string_set(subghz->txrx->preset->name, "AM270");
|
||||||
} else if(!strcmp(preset, "FuriHalSubGhzPresetOok650Async")) {
|
} else if(!strcmp(preset, "FuriHalSubGhzPresetOok650Async")) {
|
||||||
subghz->txrx->preset = FuriHalSubGhzPresetOok650Async;
|
string_set(subghz->txrx->preset->name, "AM650");
|
||||||
} else if(!strcmp(preset, "FuriHalSubGhzPreset2FSKDev238Async")) {
|
} else if(!strcmp(preset, "FuriHalSubGhzPreset2FSKDev238Async")) {
|
||||||
subghz->txrx->preset = FuriHalSubGhzPreset2FSKDev238Async;
|
string_set(subghz->txrx->preset->name, "FM238");
|
||||||
} else if(!strcmp(preset, "FuriHalSubGhzPreset2FSKDev476Async")) {
|
} else if(!strcmp(preset, "FuriHalSubGhzPreset2FSKDev476Async")) {
|
||||||
subghz->txrx->preset = FuriHalSubGhzPreset2FSKDev476Async;
|
string_set(subghz->txrx->preset->name, "FM476");
|
||||||
|
} else if(!strcmp(preset, "FuriHalSubGhzPresetCustom")) {
|
||||||
|
string_set(subghz->txrx->preset->name, "CUSTOM");
|
||||||
} else {
|
} else {
|
||||||
FURI_LOG_E(TAG, "Unknown preset");
|
FURI_LOG_E(TAG, "Unknown preset");
|
||||||
return false;
|
return false;
|
||||||
@ -41,29 +56,19 @@ void subghz_get_frequency_modulation(SubGhz* subghz, string_t frequency, string_
|
|||||||
string_printf(
|
string_printf(
|
||||||
frequency,
|
frequency,
|
||||||
"%03ld.%02ld",
|
"%03ld.%02ld",
|
||||||
subghz->txrx->frequency / 1000000 % 1000,
|
subghz->txrx->preset->frequency / 1000000 % 1000,
|
||||||
subghz->txrx->frequency / 10000 % 100);
|
subghz->txrx->preset->frequency / 10000 % 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(modulation != NULL) {
|
if(modulation != NULL) {
|
||||||
if(subghz->txrx->preset == FuriHalSubGhzPresetOok650Async ||
|
string_printf(modulation, "%0.2s", string_get_cstr(subghz->txrx->preset->name));
|
||||||
subghz->txrx->preset == FuriHalSubGhzPresetOok270Async) {
|
|
||||||
string_set_str(modulation, "AM");
|
|
||||||
} else if(
|
|
||||||
subghz->txrx->preset == FuriHalSubGhzPreset2FSKDev238Async ||
|
|
||||||
subghz->txrx->preset == FuriHalSubGhzPreset2FSKDev476Async) {
|
|
||||||
string_set_str(modulation, "FM");
|
|
||||||
} else {
|
|
||||||
furi_crash("SubGhz: Modulation is incorrect.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void subghz_begin(SubGhz* subghz, FuriHalSubGhzPreset preset) {
|
void subghz_begin(SubGhz* subghz, uint8_t* preset_data) {
|
||||||
furi_assert(subghz);
|
furi_assert(subghz);
|
||||||
furi_hal_subghz_reset();
|
furi_hal_subghz_reset();
|
||||||
furi_hal_subghz_idle();
|
furi_hal_subghz_idle();
|
||||||
furi_hal_subghz_load_preset(preset);
|
furi_hal_subghz_load_custom_preset(preset_data);
|
||||||
furi_hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow);
|
furi_hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow);
|
||||||
subghz->txrx->txrx_state = SubGhzTxRxStateIDLE;
|
subghz->txrx->txrx_state = SubGhzTxRxStateIDLE;
|
||||||
}
|
}
|
||||||
@ -155,13 +160,21 @@ bool subghz_tx_start(SubGhz* subghz, FlipperFormat* flipper_format) {
|
|||||||
|
|
||||||
if(subghz->txrx->transmitter) {
|
if(subghz->txrx->transmitter) {
|
||||||
if(subghz_transmitter_deserialize(subghz->txrx->transmitter, flipper_format)) {
|
if(subghz_transmitter_deserialize(subghz->txrx->transmitter, flipper_format)) {
|
||||||
if(subghz->txrx->preset) {
|
if(strcmp(string_get_cstr(subghz->txrx->preset->name), "")) {
|
||||||
subghz_begin(subghz, subghz->txrx->preset);
|
subghz_begin(
|
||||||
|
subghz,
|
||||||
|
subghz_setting_get_preset_data_by_name(
|
||||||
|
subghz->setting, string_get_cstr(subghz->txrx->preset->name)));
|
||||||
} else {
|
} else {
|
||||||
subghz_begin(subghz, FuriHalSubGhzPresetOok270Async);
|
FURI_LOG_E(
|
||||||
|
TAG,
|
||||||
|
"Unknown name preset \" %s \"",
|
||||||
|
string_get_cstr(subghz->txrx->preset->name));
|
||||||
|
subghz_begin(
|
||||||
|
subghz, subghz_setting_get_preset_data_by_name(subghz->setting, "AM650"));
|
||||||
}
|
}
|
||||||
if(subghz->txrx->frequency) {
|
if(subghz->txrx->preset->frequency) {
|
||||||
ret = subghz_tx(subghz, subghz->txrx->frequency);
|
ret = subghz_tx(subghz, subghz->txrx->preset->frequency);
|
||||||
} else {
|
} else {
|
||||||
ret = subghz_tx(subghz, 433920000);
|
ret = subghz_tx(subghz, 433920000);
|
||||||
}
|
}
|
||||||
@ -270,16 +283,38 @@ bool subghz_key_load(SubGhz* subghz, const char* file_path, bool show_dialog) {
|
|||||||
load_key_state = SubGhzLoadKeyStateOnlyRx;
|
load_key_state = SubGhzLoadKeyStateOnlyRx;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
subghz->txrx->frequency = temp_data32;
|
subghz->txrx->preset->frequency = temp_data32;
|
||||||
|
|
||||||
if(!flipper_format_read_string(fff_data_file, "Preset", temp_str)) {
|
if(!flipper_format_read_string(fff_data_file, "Preset", temp_str)) {
|
||||||
FURI_LOG_E(TAG, "Missing Preset");
|
FURI_LOG_E(TAG, "Missing Preset");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!subghz_set_preset(subghz, string_get_cstr(temp_str))) {
|
if(!subghz_set_preset(subghz, string_get_cstr(temp_str))) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!strcmp(string_get_cstr(temp_str), "FuriHalSubGhzPresetCustom")) {
|
||||||
|
//Todo add Custom_preset_module
|
||||||
|
//delete peset if it already exists
|
||||||
|
subghz_setting_delete_custom_preset(
|
||||||
|
subghz->setting, string_get_cstr(subghz->txrx->preset->name));
|
||||||
|
//load custom preset from file
|
||||||
|
if(!subghz_setting_load_custom_preset(
|
||||||
|
subghz->setting, string_get_cstr(subghz->txrx->preset->name), fff_data_file)) {
|
||||||
|
FURI_LOG_E(TAG, "Missing Custom preset");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
size_t preset_index = subghz_setting_get_inx_preset_by_name(
|
||||||
|
subghz->setting, string_get_cstr(subghz->txrx->preset->name));
|
||||||
|
subghz_preset_init(
|
||||||
|
subghz,
|
||||||
|
string_get_cstr(subghz->txrx->preset->name),
|
||||||
|
subghz->txrx->preset->frequency,
|
||||||
|
subghz_setting_get_preset_data(subghz->setting, preset_index),
|
||||||
|
subghz_setting_get_preset_data_size(subghz->setting, preset_index));
|
||||||
|
|
||||||
if(!flipper_format_read_string(fff_data_file, "Protocol", temp_str)) {
|
if(!flipper_format_read_string(fff_data_file, "Protocol", temp_str)) {
|
||||||
FURI_LOG_E(TAG, "Missing Protocol");
|
FURI_LOG_E(TAG, "Missing Protocol");
|
||||||
break;
|
break;
|
||||||
@ -541,8 +576,8 @@ void subghz_hopper_update(SubGhz* subghz) {
|
|||||||
};
|
};
|
||||||
if(subghz->txrx->txrx_state == SubGhzTxRxStateIDLE) {
|
if(subghz->txrx->txrx_state == SubGhzTxRxStateIDLE) {
|
||||||
subghz_receiver_reset(subghz->txrx->receiver);
|
subghz_receiver_reset(subghz->txrx->receiver);
|
||||||
subghz->txrx->frequency = subghz_setting_get_hopper_frequency(
|
subghz->txrx->preset->frequency = subghz_setting_get_hopper_frequency(
|
||||||
subghz->setting, subghz->txrx->hopper_idx_frequency);
|
subghz->setting, subghz->txrx->hopper_idx_frequency);
|
||||||
subghz_rx(subghz, subghz->txrx->frequency);
|
subghz_rx(subghz, subghz->txrx->preset->frequency);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
#include "views/subghz_test_carrier.h"
|
#include "views/subghz_test_carrier.h"
|
||||||
#include "views/subghz_test_packet.h"
|
#include "views/subghz_test_packet.h"
|
||||||
|
|
||||||
#include <furi.h>
|
// #include <furi.h>
|
||||||
#include <furi_hal.h>
|
// #include <furi_hal.h>
|
||||||
#include <gui/gui.h>
|
#include <gui/gui.h>
|
||||||
#include <dialogs/dialogs.h>
|
#include <dialogs/dialogs.h>
|
||||||
#include <gui/scene_manager.h>
|
#include <gui/scene_manager.h>
|
||||||
@ -49,8 +49,7 @@ struct SubGhzTxRx {
|
|||||||
SubGhzProtocolDecoderBase* decoder_result;
|
SubGhzProtocolDecoderBase* decoder_result;
|
||||||
FlipperFormat* fff_data;
|
FlipperFormat* fff_data;
|
||||||
|
|
||||||
uint32_t frequency;
|
SubGhzPesetDefinition* preset;
|
||||||
FuriHalSubGhzPreset preset;
|
|
||||||
SubGhzHistory* history;
|
SubGhzHistory* history;
|
||||||
uint16_t idx_menu_chosen;
|
uint16_t idx_menu_chosen;
|
||||||
SubGhzTxRxState txrx_state;
|
SubGhzTxRxState txrx_state;
|
||||||
@ -97,9 +96,15 @@ struct SubGhz {
|
|||||||
void* rpc_ctx;
|
void* rpc_ctx;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void subghz_preset_init(
|
||||||
|
void* context,
|
||||||
|
const char* preset_name,
|
||||||
|
uint32_t frequency,
|
||||||
|
uint8_t* preset_data,
|
||||||
|
size_t preset_data_size);
|
||||||
bool subghz_set_preset(SubGhz* subghz, const char* preset);
|
bool subghz_set_preset(SubGhz* subghz, const char* preset);
|
||||||
void subghz_get_frequency_modulation(SubGhz* subghz, string_t frequency, string_t modulation);
|
void subghz_get_frequency_modulation(SubGhz* subghz, string_t frequency, string_t modulation);
|
||||||
void subghz_begin(SubGhz* subghz, FuriHalSubGhzPreset preset);
|
void subghz_begin(SubGhz* subghz, uint8_t* preset_data);
|
||||||
uint32_t subghz_rx(SubGhz* subghz, uint32_t frequency);
|
uint32_t subghz_rx(SubGhz* subghz, uint32_t frequency);
|
||||||
void subghz_rx_end(SubGhz* subghz);
|
void subghz_rx_end(SubGhz* subghz);
|
||||||
void subghz_sleep(SubGhz* subghz);
|
void subghz_sleep(SubGhz* subghz);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include <furi.h>
|
#include <furi.h>
|
||||||
#include <m-list.h>
|
#include <m-list.h>
|
||||||
#include <lib/flipper_format/flipper_format.h>
|
#include "furi_hal_subghz_configs.h"
|
||||||
|
|
||||||
#define TAG "SubGhzSetting"
|
#define TAG "SubGhzSetting"
|
||||||
|
|
||||||
@ -157,29 +157,89 @@ static const uint32_t subghz_hopper_frequency_list_region_jp[] = {
|
|||||||
0,
|
0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
string_t custom_preset_name;
|
||||||
|
uint8_t* custom_preset_data;
|
||||||
|
size_t custom_preset_data_size;
|
||||||
|
} SubGhzSettingCustomPresetItem;
|
||||||
|
|
||||||
|
ARRAY_DEF(SubGhzSettingCustomPresetItemArray, SubGhzSettingCustomPresetItem, M_POD_OPLIST)
|
||||||
|
|
||||||
|
#define M_OPL_SubGhzSettingCustomPresetItemArray_t() \
|
||||||
|
ARRAY_OPLIST(SubGhzSettingCustomPresetItemArray, M_POD_OPLIST)
|
||||||
|
|
||||||
LIST_DEF(FrequencyList, uint32_t)
|
LIST_DEF(FrequencyList, uint32_t)
|
||||||
|
|
||||||
#define M_OPL_FrequencyList_t() LIST_OPLIST(FrequencyList)
|
#define M_OPL_FrequencyList_t() LIST_OPLIST(FrequencyList)
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
SubGhzSettingCustomPresetItemArray_t data;
|
||||||
|
} SubGhzSettingCustomPresetStruct;
|
||||||
|
|
||||||
struct SubGhzSetting {
|
struct SubGhzSetting {
|
||||||
FrequencyList_t frequencies;
|
FrequencyList_t frequencies;
|
||||||
FrequencyList_t hopper_frequencies;
|
FrequencyList_t hopper_frequencies;
|
||||||
|
SubGhzSettingCustomPresetStruct* preset;
|
||||||
};
|
};
|
||||||
|
|
||||||
SubGhzSetting* subghz_setting_alloc(void) {
|
SubGhzSetting* subghz_setting_alloc(void) {
|
||||||
SubGhzSetting* instance = malloc(sizeof(SubGhzSetting));
|
SubGhzSetting* instance = malloc(sizeof(SubGhzSetting));
|
||||||
FrequencyList_init(instance->frequencies);
|
FrequencyList_init(instance->frequencies);
|
||||||
FrequencyList_init(instance->hopper_frequencies);
|
FrequencyList_init(instance->hopper_frequencies);
|
||||||
|
instance->preset = malloc(sizeof(SubGhzSettingCustomPresetStruct));
|
||||||
|
SubGhzSettingCustomPresetItemArray_init(instance->preset->data);
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void subghz_setting_preset_reset(SubGhzSetting* instance) {
|
||||||
|
for
|
||||||
|
M_EACH(item, instance->preset->data, SubGhzSettingCustomPresetItemArray_t) {
|
||||||
|
string_clear(item->custom_preset_name);
|
||||||
|
free(item->custom_preset_data);
|
||||||
|
}
|
||||||
|
SubGhzSettingCustomPresetItemArray_reset(instance->preset->data);
|
||||||
|
}
|
||||||
|
|
||||||
void subghz_setting_free(SubGhzSetting* instance) {
|
void subghz_setting_free(SubGhzSetting* instance) {
|
||||||
furi_assert(instance);
|
furi_assert(instance);
|
||||||
FrequencyList_clear(instance->frequencies);
|
FrequencyList_clear(instance->frequencies);
|
||||||
FrequencyList_clear(instance->hopper_frequencies);
|
FrequencyList_clear(instance->hopper_frequencies);
|
||||||
|
for
|
||||||
|
M_EACH(item, instance->preset->data, SubGhzSettingCustomPresetItemArray_t) {
|
||||||
|
string_clear(item->custom_preset_name);
|
||||||
|
free(item->custom_preset_data);
|
||||||
|
}
|
||||||
|
SubGhzSettingCustomPresetItemArray_clear(instance->preset->data);
|
||||||
|
free(instance->preset);
|
||||||
free(instance);
|
free(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void subghz_setting_load_default_preset(
|
||||||
|
SubGhzSetting* instance,
|
||||||
|
const char* preset_name,
|
||||||
|
const uint8_t* preset_data,
|
||||||
|
const uint8_t preset_pa_table[8]) {
|
||||||
|
furi_assert(instance);
|
||||||
|
furi_assert(preset_data);
|
||||||
|
uint32_t preset_data_count = 0;
|
||||||
|
SubGhzSettingCustomPresetItem* item =
|
||||||
|
SubGhzSettingCustomPresetItemArray_push_raw(instance->preset->data);
|
||||||
|
|
||||||
|
string_init(item->custom_preset_name);
|
||||||
|
string_set(item->custom_preset_name, preset_name);
|
||||||
|
|
||||||
|
while(preset_data[preset_data_count]) {
|
||||||
|
preset_data_count += 2;
|
||||||
|
}
|
||||||
|
preset_data_count += 2;
|
||||||
|
item->custom_preset_data_size = sizeof(uint8_t) * preset_data_count + sizeof(uint8_t) * 8;
|
||||||
|
item->custom_preset_data = malloc(item->custom_preset_data_size);
|
||||||
|
//load preset register
|
||||||
|
memcpy(&item->custom_preset_data[0], &preset_data[0], preset_data_count);
|
||||||
|
//load pa table
|
||||||
|
memcpy(&item->custom_preset_data[preset_data_count], &preset_pa_table[0], 8);
|
||||||
|
}
|
||||||
|
|
||||||
static void subghz_setting_load_default_region(
|
static void subghz_setting_load_default_region(
|
||||||
SubGhzSetting* instance,
|
SubGhzSetting* instance,
|
||||||
const uint32_t frequencies[],
|
const uint32_t frequencies[],
|
||||||
@ -188,6 +248,7 @@ static void subghz_setting_load_default_region(
|
|||||||
|
|
||||||
FrequencyList_reset(instance->frequencies);
|
FrequencyList_reset(instance->frequencies);
|
||||||
FrequencyList_reset(instance->hopper_frequencies);
|
FrequencyList_reset(instance->hopper_frequencies);
|
||||||
|
subghz_setting_preset_reset(instance);
|
||||||
|
|
||||||
while(*frequencies) {
|
while(*frequencies) {
|
||||||
FrequencyList_push_back(instance->frequencies, *frequencies);
|
FrequencyList_push_back(instance->frequencies, *frequencies);
|
||||||
@ -198,6 +259,27 @@ static void subghz_setting_load_default_region(
|
|||||||
FrequencyList_push_back(instance->hopper_frequencies, *hopper_frequencies);
|
FrequencyList_push_back(instance->hopper_frequencies, *hopper_frequencies);
|
||||||
hopper_frequencies++;
|
hopper_frequencies++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
subghz_setting_load_default_preset(
|
||||||
|
instance,
|
||||||
|
"AM270",
|
||||||
|
(uint8_t*)furi_hal_subghz_preset_ook_270khz_async_regs,
|
||||||
|
furi_hal_subghz_preset_ook_async_patable);
|
||||||
|
subghz_setting_load_default_preset(
|
||||||
|
instance,
|
||||||
|
"AM650",
|
||||||
|
(uint8_t*)furi_hal_subghz_preset_ook_650khz_async_regs,
|
||||||
|
furi_hal_subghz_preset_ook_async_patable);
|
||||||
|
subghz_setting_load_default_preset(
|
||||||
|
instance,
|
||||||
|
"FM238",
|
||||||
|
(uint8_t*)furi_hal_subghz_preset_2fsk_dev2_38khz_async_regs,
|
||||||
|
furi_hal_subghz_preset_2fsk_async_patable);
|
||||||
|
subghz_setting_load_default_preset(
|
||||||
|
instance,
|
||||||
|
"FM476",
|
||||||
|
(uint8_t*)furi_hal_subghz_preset_2fsk_dev47_6khz_async_regs,
|
||||||
|
furi_hal_subghz_preset_2fsk_async_patable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void subghz_setting_load_default(SubGhzSetting* instance) {
|
void subghz_setting_load_default(SubGhzSetting* instance) {
|
||||||
@ -260,7 +342,7 @@ void subghz_setting_load(SubGhzSetting* instance, const char* file_path) {
|
|||||||
|
|
||||||
// Standard frequencies (optional)
|
// Standard frequencies (optional)
|
||||||
temp_bool = true;
|
temp_bool = true;
|
||||||
flipper_format_read_bool(fff_data_file, "add_standard_frequencies", &temp_bool, 1);
|
flipper_format_read_bool(fff_data_file, "Add_standard_frequencies", &temp_bool, 1);
|
||||||
if(!temp_bool) {
|
if(!temp_bool) {
|
||||||
FURI_LOG_I(TAG, "Removing standard frequencies");
|
FURI_LOG_I(TAG, "Removing standard frequencies");
|
||||||
FrequencyList_reset(instance->frequencies);
|
FrequencyList_reset(instance->frequencies);
|
||||||
@ -275,7 +357,7 @@ void subghz_setting_load(SubGhzSetting* instance, const char* file_path) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
while(flipper_format_read_uint32(
|
while(flipper_format_read_uint32(
|
||||||
fff_data_file, "frequency", (uint32_t*)&temp_data32, 1)) {
|
fff_data_file, "Frequency", (uint32_t*)&temp_data32, 1)) {
|
||||||
if(furi_hal_subghz_is_frequency_valid(temp_data32)) {
|
if(furi_hal_subghz_is_frequency_valid(temp_data32)) {
|
||||||
FURI_LOG_I(TAG, "Frequency loaded %lu", temp_data32);
|
FURI_LOG_I(TAG, "Frequency loaded %lu", temp_data32);
|
||||||
FrequencyList_push_back(instance->frequencies, temp_data32);
|
FrequencyList_push_back(instance->frequencies, temp_data32);
|
||||||
@ -290,7 +372,7 @@ void subghz_setting_load(SubGhzSetting* instance, const char* file_path) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
while(flipper_format_read_uint32(
|
while(flipper_format_read_uint32(
|
||||||
fff_data_file, "hopper_frequency", (uint32_t*)&temp_data32, 1)) {
|
fff_data_file, "Hopper_frequency", (uint32_t*)&temp_data32, 1)) {
|
||||||
if(furi_hal_subghz_is_frequency_valid(temp_data32)) {
|
if(furi_hal_subghz_is_frequency_valid(temp_data32)) {
|
||||||
FURI_LOG_I(TAG, "Hopper frequency loaded %lu", temp_data32);
|
FURI_LOG_I(TAG, "Hopper frequency loaded %lu", temp_data32);
|
||||||
FrequencyList_push_back(instance->hopper_frequencies, temp_data32);
|
FrequencyList_push_back(instance->hopper_frequencies, temp_data32);
|
||||||
@ -304,7 +386,7 @@ void subghz_setting_load(SubGhzSetting* instance, const char* file_path) {
|
|||||||
FURI_LOG_E(TAG, "Rewind error");
|
FURI_LOG_E(TAG, "Rewind error");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(flipper_format_read_uint32(fff_data_file, "default_frequency", &temp_data32, 1)) {
|
if(flipper_format_read_uint32(fff_data_file, "Default_frequency", &temp_data32, 1)) {
|
||||||
for
|
for
|
||||||
M_EACH(frequency, instance->frequencies, FrequencyList_t) {
|
M_EACH(frequency, instance->frequencies, FrequencyList_t) {
|
||||||
*frequency &= FREQUENCY_MASK;
|
*frequency &= FREQUENCY_MASK;
|
||||||
@ -313,6 +395,18 @@ void subghz_setting_load(SubGhzSetting* instance, const char* file_path) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// custom preset (optional)
|
||||||
|
if(!flipper_format_rewind(fff_data_file)) {
|
||||||
|
FURI_LOG_E(TAG, "Rewind error");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
while(flipper_format_read_string(fff_data_file, "Custom_preset_name", temp_str)) {
|
||||||
|
FURI_LOG_I(TAG, "Custom preset loaded %s", string_get_cstr(temp_str));
|
||||||
|
subghz_setting_load_custom_preset(
|
||||||
|
instance, string_get_cstr(temp_str), fff_data_file);
|
||||||
|
}
|
||||||
|
|
||||||
} while(false);
|
} while(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,6 +431,104 @@ size_t subghz_setting_get_hopper_frequency_count(SubGhzSetting* instance) {
|
|||||||
return FrequencyList_size(instance->hopper_frequencies);
|
return FrequencyList_size(instance->hopper_frequencies);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t subghz_setting_get_preset_count(SubGhzSetting* instance) {
|
||||||
|
furi_assert(instance);
|
||||||
|
return SubGhzSettingCustomPresetItemArray_size(instance->preset->data);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* subghz_setting_get_preset_name(SubGhzSetting* instance, size_t idx) {
|
||||||
|
furi_assert(instance);
|
||||||
|
SubGhzSettingCustomPresetItem* item =
|
||||||
|
SubGhzSettingCustomPresetItemArray_get(instance->preset->data, idx);
|
||||||
|
return string_get_cstr(item->custom_preset_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
int subghz_setting_get_inx_preset_by_name(SubGhzSetting* instance, const char* preset_name) {
|
||||||
|
furi_assert(instance);
|
||||||
|
size_t idx = 0;
|
||||||
|
for
|
||||||
|
M_EACH(item, instance->preset->data, SubGhzSettingCustomPresetItemArray_t) {
|
||||||
|
if(strcmp(string_get_cstr(item->custom_preset_name), preset_name) == 0) {
|
||||||
|
return idx;
|
||||||
|
}
|
||||||
|
idx++;
|
||||||
|
}
|
||||||
|
furi_crash("SubGhz: No name preset.");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool subghz_setting_load_custom_preset(
|
||||||
|
SubGhzSetting* instance,
|
||||||
|
const char* preset_name,
|
||||||
|
FlipperFormat* fff_data_file) {
|
||||||
|
furi_assert(instance);
|
||||||
|
furi_assert(preset_name);
|
||||||
|
uint32_t temp_data32;
|
||||||
|
SubGhzSettingCustomPresetItem* item =
|
||||||
|
SubGhzSettingCustomPresetItemArray_push_raw(instance->preset->data);
|
||||||
|
string_init(item->custom_preset_name);
|
||||||
|
string_set(item->custom_preset_name, preset_name);
|
||||||
|
do {
|
||||||
|
if(!flipper_format_get_value_count(fff_data_file, "Custom_preset_data", &temp_data32))
|
||||||
|
break;
|
||||||
|
if(!temp_data32 || (temp_data32 % 2)) {
|
||||||
|
FURI_LOG_E(TAG, "Integrity error Custom_preset_data");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
item->custom_preset_data_size = sizeof(uint8_t) * temp_data32;
|
||||||
|
item->custom_preset_data = malloc(item->custom_preset_data_size);
|
||||||
|
if(!flipper_format_read_hex(
|
||||||
|
fff_data_file,
|
||||||
|
"Custom_preset_data",
|
||||||
|
item->custom_preset_data,
|
||||||
|
item->custom_preset_data_size)) {
|
||||||
|
FURI_LOG_E(TAG, "Missing Custom_preset_data");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} while(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool subghz_setting_delete_custom_preset(SubGhzSetting* instance, const char* preset_name) {
|
||||||
|
furi_assert(instance);
|
||||||
|
furi_assert(preset_name);
|
||||||
|
SubGhzSettingCustomPresetItemArray_it_t it;
|
||||||
|
SubGhzSettingCustomPresetItemArray_it_last(it, instance->preset->data);
|
||||||
|
while(!SubGhzSettingCustomPresetItemArray_end_p(it)) {
|
||||||
|
SubGhzSettingCustomPresetItem* item = SubGhzSettingCustomPresetItemArray_ref(it);
|
||||||
|
if(strcmp(string_get_cstr(item->custom_preset_name), preset_name) == 0) {
|
||||||
|
string_clear(item->custom_preset_name);
|
||||||
|
free(item->custom_preset_data);
|
||||||
|
SubGhzSettingCustomPresetItemArray_remove(instance->preset->data, it);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
SubGhzSettingCustomPresetItemArray_previous(it);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t* subghz_setting_get_preset_data(SubGhzSetting* instance, size_t idx) {
|
||||||
|
furi_assert(instance);
|
||||||
|
SubGhzSettingCustomPresetItem* item =
|
||||||
|
SubGhzSettingCustomPresetItemArray_get(instance->preset->data, idx);
|
||||||
|
return item->custom_preset_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t subghz_setting_get_preset_data_size(SubGhzSetting* instance, size_t idx) {
|
||||||
|
furi_assert(instance);
|
||||||
|
SubGhzSettingCustomPresetItem* item =
|
||||||
|
SubGhzSettingCustomPresetItemArray_get(instance->preset->data, idx);
|
||||||
|
return item->custom_preset_data_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t* subghz_setting_get_preset_data_by_name(SubGhzSetting* instance, const char* preset_name) {
|
||||||
|
furi_assert(instance);
|
||||||
|
SubGhzSettingCustomPresetItem* item = SubGhzSettingCustomPresetItemArray_get(
|
||||||
|
instance->preset->data, subghz_setting_get_inx_preset_by_name(instance, preset_name));
|
||||||
|
return item->custom_preset_data;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t subghz_setting_get_frequency(SubGhzSetting* instance, size_t idx) {
|
uint32_t subghz_setting_get_frequency(SubGhzSetting* instance, size_t idx) {
|
||||||
furi_assert(instance);
|
furi_assert(instance);
|
||||||
uint32_t* ret = FrequencyList_get(instance->frequencies, idx);
|
uint32_t* ret = FrequencyList_get(instance->frequencies, idx);
|
||||||
|
@ -4,6 +4,9 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <furi.h>
|
#include <furi.h>
|
||||||
#include <furi_hal.h>
|
#include <furi_hal.h>
|
||||||
|
#include <lib/flipper_format/flipper_format.h>
|
||||||
|
|
||||||
|
#define SUBGHZ_SETTING_DEFAULT_PRESET_COUNT 4
|
||||||
|
|
||||||
typedef struct SubGhzSetting SubGhzSetting;
|
typedef struct SubGhzSetting SubGhzSetting;
|
||||||
|
|
||||||
@ -17,6 +20,25 @@ size_t subghz_setting_get_frequency_count(SubGhzSetting* instance);
|
|||||||
|
|
||||||
size_t subghz_setting_get_hopper_frequency_count(SubGhzSetting* instance);
|
size_t subghz_setting_get_hopper_frequency_count(SubGhzSetting* instance);
|
||||||
|
|
||||||
|
size_t subghz_setting_get_preset_count(SubGhzSetting* instance);
|
||||||
|
|
||||||
|
const char* subghz_setting_get_preset_name(SubGhzSetting* instance, size_t idx);
|
||||||
|
|
||||||
|
int subghz_setting_get_inx_preset_by_name(SubGhzSetting* instance, const char* preset_name);
|
||||||
|
|
||||||
|
uint8_t* subghz_setting_get_preset_data(SubGhzSetting* instance, size_t idx);
|
||||||
|
|
||||||
|
size_t subghz_setting_get_preset_data_size(SubGhzSetting* instance, size_t idx);
|
||||||
|
|
||||||
|
uint8_t* subghz_setting_get_preset_data_by_name(SubGhzSetting* instance, const char* preset_name);
|
||||||
|
|
||||||
|
bool subghz_setting_load_custom_preset(
|
||||||
|
SubGhzSetting* instance,
|
||||||
|
const char* preset_name,
|
||||||
|
FlipperFormat* fff_data_file);
|
||||||
|
|
||||||
|
bool subghz_setting_delete_custom_preset(SubGhzSetting* instance, const char* preset_name);
|
||||||
|
|
||||||
uint32_t subghz_setting_get_frequency(SubGhzSetting* instance, size_t idx);
|
uint32_t subghz_setting_get_frequency(SubGhzSetting* instance, size_t idx);
|
||||||
|
|
||||||
uint32_t subghz_setting_get_hopper_frequency(SubGhzSetting* instance, size_t idx);
|
uint32_t subghz_setting_get_hopper_frequency(SubGhzSetting* instance, size_t idx);
|
||||||
|
@ -2,17 +2,28 @@ Filetype: Flipper SubGhz Setting File
|
|||||||
Version: 1
|
Version: 1
|
||||||
|
|
||||||
# Add Standard frequencies for your region
|
# Add Standard frequencies for your region
|
||||||
#add_standard_frequencies: true
|
#Add_standard_frequencies: true
|
||||||
|
|
||||||
# Default Frequency: used as default for "Read" and "Read Raw"
|
# Default Frequency: used as default for "Read" and "Read Raw"
|
||||||
#default_frequency: 433920000
|
#Default_frequency: 433920000
|
||||||
|
|
||||||
# Frequencies used for "Read", "Read Raw" and "Frequency Analyzer"
|
# Frequencies used for "Read", "Read Raw" and "Frequency Analyzer"
|
||||||
#frequency: 300000000
|
#Frequency: 300000000
|
||||||
#frequency: 310000000
|
#Frequency: 310000000
|
||||||
#frequency: 320000000
|
#Frequency: 320000000
|
||||||
|
|
||||||
# Frequencies used for hopping mode (keep this list small or flipper will miss signal)
|
# Frequencies used for hopping mode (keep this list small or flipper will miss signal)
|
||||||
#hopper_frequency: 300000000
|
#Hopper_frequency: 300000000
|
||||||
#hopper_frequency: 310000000
|
#Hopper_frequency: 310000000
|
||||||
#hopper_frequency: 310000000
|
#Hopper_frequency: 310000000
|
||||||
|
|
||||||
|
# Custom preset
|
||||||
|
# format for CC1101 "Custom_preset_data:" XX YY XX YY .. 00 00 ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ, where: XX-register, YY - register data, 00 00 - end load register, ZZ - 8 byte Pa table register
|
||||||
|
|
||||||
|
#Custom_preset_name: AM_1
|
||||||
|
#Custom_preset_module: CC1101
|
||||||
|
#Custom_preset_data: 02 0D 03 07 08 32 0B 06 14 00 13 00 12 30 11 32 10 17 18 18 19 18 1D 91 1C 00 1B 07 20 FB 22 11 21 B6 00 00 00 C0 00 00 00 00 00 00
|
||||||
|
|
||||||
|
#Custom_preset_name: AM_2
|
||||||
|
#Custom_preset_module: CC1101
|
||||||
|
#Custom_preset_data: 02 0D 03 07 08 32 0B 06 14 00 13 00 12 30 11 32 10 17 18 18 19 18 1D 91 1C 00 1B 07 20 FB 22 11 21 B6 00 00 00 C0 00 00 00 00 00 00
|
||||||
|
@ -100,22 +100,24 @@ void furi_hal_subghz_dump_state() {
|
|||||||
|
|
||||||
void furi_hal_subghz_load_preset(FuriHalSubGhzPreset preset) {
|
void furi_hal_subghz_load_preset(FuriHalSubGhzPreset preset) {
|
||||||
if(preset == FuriHalSubGhzPresetOok650Async) {
|
if(preset == FuriHalSubGhzPresetOok650Async) {
|
||||||
furi_hal_subghz_load_registers(furi_hal_subghz_preset_ook_650khz_async_regs);
|
furi_hal_subghz_load_registers((uint8_t*)furi_hal_subghz_preset_ook_650khz_async_regs);
|
||||||
furi_hal_subghz_load_patable(furi_hal_subghz_preset_ook_async_patable);
|
furi_hal_subghz_load_patable(furi_hal_subghz_preset_ook_async_patable);
|
||||||
} else if(preset == FuriHalSubGhzPresetOok270Async) {
|
} else if(preset == FuriHalSubGhzPresetOok270Async) {
|
||||||
furi_hal_subghz_load_registers(furi_hal_subghz_preset_ook_270khz_async_regs);
|
furi_hal_subghz_load_registers((uint8_t*)furi_hal_subghz_preset_ook_270khz_async_regs);
|
||||||
furi_hal_subghz_load_patable(furi_hal_subghz_preset_ook_async_patable);
|
furi_hal_subghz_load_patable(furi_hal_subghz_preset_ook_async_patable);
|
||||||
} else if(preset == FuriHalSubGhzPreset2FSKDev238Async) {
|
} else if(preset == FuriHalSubGhzPreset2FSKDev238Async) {
|
||||||
furi_hal_subghz_load_registers(furi_hal_subghz_preset_2fsk_dev2_38khz_async_regs);
|
furi_hal_subghz_load_registers(
|
||||||
|
(uint8_t*)furi_hal_subghz_preset_2fsk_dev2_38khz_async_regs);
|
||||||
furi_hal_subghz_load_patable(furi_hal_subghz_preset_2fsk_async_patable);
|
furi_hal_subghz_load_patable(furi_hal_subghz_preset_2fsk_async_patable);
|
||||||
} else if(preset == FuriHalSubGhzPreset2FSKDev476Async) {
|
} else if(preset == FuriHalSubGhzPreset2FSKDev476Async) {
|
||||||
furi_hal_subghz_load_registers(furi_hal_subghz_preset_2fsk_dev47_6khz_async_regs);
|
furi_hal_subghz_load_registers(
|
||||||
|
(uint8_t*)furi_hal_subghz_preset_2fsk_dev47_6khz_async_regs);
|
||||||
furi_hal_subghz_load_patable(furi_hal_subghz_preset_2fsk_async_patable);
|
furi_hal_subghz_load_patable(furi_hal_subghz_preset_2fsk_async_patable);
|
||||||
} else if(preset == FuriHalSubGhzPresetMSK99_97KbAsync) {
|
} else if(preset == FuriHalSubGhzPresetMSK99_97KbAsync) {
|
||||||
furi_hal_subghz_load_registers(furi_hal_subghz_preset_msk_99_97kb_async_regs);
|
furi_hal_subghz_load_registers((uint8_t*)furi_hal_subghz_preset_msk_99_97kb_async_regs);
|
||||||
furi_hal_subghz_load_patable(furi_hal_subghz_preset_msk_async_patable);
|
furi_hal_subghz_load_patable(furi_hal_subghz_preset_msk_async_patable);
|
||||||
} else if(preset == FuriHalSubGhzPresetGFSK9_99KbAsync) {
|
} else if(preset == FuriHalSubGhzPresetGFSK9_99KbAsync) {
|
||||||
furi_hal_subghz_load_registers(furi_hal_subghz_preset_gfsk_9_99kb_async_regs);
|
furi_hal_subghz_load_registers((uint8_t*)furi_hal_subghz_preset_gfsk_9_99kb_async_regs);
|
||||||
furi_hal_subghz_load_patable(furi_hal_subghz_preset_gfsk_async_patable);
|
furi_hal_subghz_load_patable(furi_hal_subghz_preset_gfsk_async_patable);
|
||||||
} else {
|
} else {
|
||||||
furi_crash("SubGhz: Missing config.");
|
furi_crash("SubGhz: Missing config.");
|
||||||
@ -123,13 +125,44 @@ void furi_hal_subghz_load_preset(FuriHalSubGhzPreset preset) {
|
|||||||
furi_hal_subghz.preset = preset;
|
furi_hal_subghz.preset = preset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void furi_hal_subghz_load_registers(const uint8_t data[][2]) {
|
void furi_hal_subghz_load_custom_preset(uint8_t* preset_data) {
|
||||||
|
//load config
|
||||||
furi_hal_spi_acquire(&furi_hal_spi_bus_handle_subghz);
|
furi_hal_spi_acquire(&furi_hal_spi_bus_handle_subghz);
|
||||||
cc1101_reset(&furi_hal_spi_bus_handle_subghz);
|
cc1101_reset(&furi_hal_spi_bus_handle_subghz);
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
while(data[i][0]) {
|
uint8_t pa[8] = {0};
|
||||||
cc1101_write_reg(&furi_hal_spi_bus_handle_subghz, data[i][0], data[i][1]);
|
while(preset_data[i]) {
|
||||||
i++;
|
cc1101_write_reg(&furi_hal_spi_bus_handle_subghz, preset_data[i], preset_data[i + 1]);
|
||||||
|
i += 2;
|
||||||
|
}
|
||||||
|
furi_hal_spi_release(&furi_hal_spi_bus_handle_subghz);
|
||||||
|
|
||||||
|
//load pa table
|
||||||
|
memcpy(&pa[0], &preset_data[i + 2], 8);
|
||||||
|
furi_hal_subghz_load_patable(pa);
|
||||||
|
furi_hal_subghz.preset = FuriHalSubGhzPresetCustom;
|
||||||
|
|
||||||
|
//show debug
|
||||||
|
if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)) {
|
||||||
|
i = 0;
|
||||||
|
FURI_LOG_D(TAG, "Loading custom preset");
|
||||||
|
while(preset_data[i]) {
|
||||||
|
FURI_LOG_D(TAG, "Reg[%lu]: %02X=%02X", i, preset_data[i], preset_data[i + 1]);
|
||||||
|
i += 2;
|
||||||
|
}
|
||||||
|
for(uint8_t y = i; y < i + 10; y++) {
|
||||||
|
FURI_LOG_D(TAG, "PA[%lu]: %02X", y, preset_data[y]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void furi_hal_subghz_load_registers(uint8_t* data) {
|
||||||
|
furi_hal_spi_acquire(&furi_hal_spi_bus_handle_subghz);
|
||||||
|
cc1101_reset(&furi_hal_spi_bus_handle_subghz);
|
||||||
|
uint32_t i = 0;
|
||||||
|
while(data[i]) {
|
||||||
|
cc1101_write_reg(&furi_hal_spi_bus_handle_subghz, data[i], data[i + 1]);
|
||||||
|
i += 2;
|
||||||
}
|
}
|
||||||
furi_hal_spi_release(&furi_hal_spi_bus_handle_subghz);
|
furi_hal_spi_release(&furi_hal_spi_bus_handle_subghz);
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,8 @@ typedef enum {
|
|||||||
FuriHalSubGhzPreset2FSKDev238Async, /**< FM, deviation 2.380371 kHz, asynchronous */
|
FuriHalSubGhzPreset2FSKDev238Async, /**< FM, deviation 2.380371 kHz, asynchronous */
|
||||||
FuriHalSubGhzPreset2FSKDev476Async, /**< FM, deviation 47.60742 kHz, asynchronous */
|
FuriHalSubGhzPreset2FSKDev476Async, /**< FM, deviation 47.60742 kHz, asynchronous */
|
||||||
FuriHalSubGhzPresetMSK99_97KbAsync, /**< MSK, deviation 47.60742 kHz, 99.97Kb/s, asynchronous */
|
FuriHalSubGhzPresetMSK99_97KbAsync, /**< MSK, deviation 47.60742 kHz, 99.97Kb/s, asynchronous */
|
||||||
FuriHalSubGhzPresetGFSK9_99KbAsync /**< GFSK, deviation 19.042969 kHz, 9.996Kb/s, asynchronous */
|
FuriHalSubGhzPresetGFSK9_99KbAsync, /**< GFSK, deviation 19.042969 kHz, 9.996Kb/s, asynchronous */
|
||||||
|
FuriHalSubGhzPresetCustom, /**Custom Preset*/
|
||||||
} FuriHalSubGhzPreset;
|
} FuriHalSubGhzPreset;
|
||||||
|
|
||||||
/** Switchable Radio Paths */
|
/** Switchable Radio Paths */
|
||||||
@ -74,11 +75,17 @@ void furi_hal_subghz_dump_state();
|
|||||||
*/
|
*/
|
||||||
void furi_hal_subghz_load_preset(FuriHalSubGhzPreset preset);
|
void furi_hal_subghz_load_preset(FuriHalSubGhzPreset preset);
|
||||||
|
|
||||||
|
/** Load custom registers from preset
|
||||||
|
*
|
||||||
|
* @param preset_data registers to load
|
||||||
|
*/
|
||||||
|
void furi_hal_subghz_load_custom_preset(uint8_t* preset_data);
|
||||||
|
|
||||||
/** Load registers
|
/** Load registers
|
||||||
*
|
*
|
||||||
* @param data Registers data
|
* @param data Registers data
|
||||||
*/
|
*/
|
||||||
void furi_hal_subghz_load_registers(const uint8_t data[][2]);
|
void furi_hal_subghz_load_registers(uint8_t* data);
|
||||||
|
|
||||||
/** Load PATABLE
|
/** Load PATABLE
|
||||||
*
|
*
|
||||||
|
@ -1,39 +1,29 @@
|
|||||||
#include "generic.h"
|
#include "generic.h"
|
||||||
#include "../types.h"
|
|
||||||
#include <lib/toolbox/stream/stream.h>
|
#include <lib/toolbox/stream/stream.h>
|
||||||
#include <lib/flipper_format/flipper_format_i.h>
|
#include <lib/flipper_format/flipper_format_i.h>
|
||||||
|
|
||||||
#define TAG "SubGhzBlockGeneric"
|
#define TAG "SubGhzBlockGeneric"
|
||||||
|
|
||||||
bool subghz_block_generic_get_preset_name(FuriHalSubGhzPreset preset, string_t preset_str) {
|
void subghz_block_generic_get_preset_name(const char* preset_name, string_t preset_str) {
|
||||||
const char* preset_name;
|
const char* preset_name_temp;
|
||||||
switch(preset) {
|
if(!strcmp(preset_name, "AM270")) {
|
||||||
case FuriHalSubGhzPresetOok270Async:
|
preset_name_temp = "FuriHalSubGhzPresetOok270Async";
|
||||||
preset_name = "FuriHalSubGhzPresetOok270Async";
|
} else if(!strcmp(preset_name, "AM650")) {
|
||||||
break;
|
preset_name_temp = "FuriHalSubGhzPresetOok650Async";
|
||||||
case FuriHalSubGhzPresetOok650Async:
|
} else if(!strcmp(preset_name, "FM238")) {
|
||||||
preset_name = "FuriHalSubGhzPresetOok650Async";
|
preset_name_temp = "FuriHalSubGhzPreset2FSKDev238Async";
|
||||||
break;
|
} else if(!strcmp(preset_name, "FM476")) {
|
||||||
case FuriHalSubGhzPreset2FSKDev238Async:
|
preset_name_temp = "FuriHalSubGhzPreset2FSKDev476Async";
|
||||||
preset_name = "FuriHalSubGhzPreset2FSKDev238Async";
|
} else {
|
||||||
break;
|
preset_name_temp = "FuriHalSubGhzPresetCustom";
|
||||||
case FuriHalSubGhzPreset2FSKDev476Async:
|
|
||||||
preset_name = "FuriHalSubGhzPreset2FSKDev476Async";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
FURI_LOG_E(TAG, "Unknown preset");
|
|
||||||
return false;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
string_set(preset_str, preset_name);
|
string_set(preset_str, preset_name_temp);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool subghz_block_generic_serialize(
|
bool subghz_block_generic_serialize(
|
||||||
SubGhzBlockGeneric* instance,
|
SubGhzBlockGeneric* instance,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(instance);
|
furi_assert(instance);
|
||||||
bool res = false;
|
bool res = false;
|
||||||
string_t temp_str;
|
string_t temp_str;
|
||||||
@ -46,17 +36,28 @@ bool subghz_block_generic_serialize(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!flipper_format_write_uint32(flipper_format, "Frequency", &frequency, 1)) {
|
if(!flipper_format_write_uint32(flipper_format, "Frequency", &preset->frequency, 1)) {
|
||||||
FURI_LOG_E(TAG, "Unable to add Frequency");
|
FURI_LOG_E(TAG, "Unable to add Frequency");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(!subghz_block_generic_get_preset_name(preset, temp_str)) {
|
|
||||||
break;
|
subghz_block_generic_get_preset_name(string_get_cstr(preset->name), temp_str);
|
||||||
}
|
|
||||||
if(!flipper_format_write_string_cstr(flipper_format, "Preset", string_get_cstr(temp_str))) {
|
if(!flipper_format_write_string_cstr(flipper_format, "Preset", string_get_cstr(temp_str))) {
|
||||||
FURI_LOG_E(TAG, "Unable to add Preset");
|
FURI_LOG_E(TAG, "Unable to add Preset");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if(!strcmp(string_get_cstr(temp_str), "FuriHalSubGhzPresetCustom")) {
|
||||||
|
if(!flipper_format_write_string_cstr(
|
||||||
|
flipper_format, "Custom_preset_module", "CC1101")) {
|
||||||
|
FURI_LOG_E(TAG, "Unable to add Custom_preset_module");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(!flipper_format_write_hex(
|
||||||
|
flipper_format, "Custom_preset_data", preset->data, preset->data_size)) {
|
||||||
|
FURI_LOG_E(TAG, "Unable to add Custom_preset_data");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if(!flipper_format_write_string_cstr(flipper_format, "Protocol", instance->protocol_name)) {
|
if(!flipper_format_write_string_cstr(flipper_format, "Protocol", instance->protocol_name)) {
|
||||||
FURI_LOG_E(TAG, "Unable to add Protocol");
|
FURI_LOG_E(TAG, "Unable to add Protocol");
|
||||||
break;
|
break;
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <lib/flipper_format/flipper_format.h>
|
#include <lib/flipper_format/flipper_format.h>
|
||||||
#include "furi.h"
|
#include "furi.h"
|
||||||
#include "furi_hal.h"
|
#include "furi_hal.h"
|
||||||
|
#include "../types.h"
|
||||||
|
|
||||||
typedef struct SubGhzBlockGeneric SubGhzBlockGeneric;
|
typedef struct SubGhzBlockGeneric SubGhzBlockGeneric;
|
||||||
|
|
||||||
@ -20,26 +21,23 @@ struct SubGhzBlockGeneric {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get modulation name.
|
* Get name preset.
|
||||||
* @param preset modulation,FuriHalSubGhzPreset
|
* @param preset_name name preset
|
||||||
* @param preset_str Output modulation name
|
* @param preset_str Output name preset
|
||||||
* @return true On success
|
|
||||||
*/
|
*/
|
||||||
bool subghz_block_generic_get_preset_name(FuriHalSubGhzPreset preset, string_t preset_str);
|
void subghz_block_generic_get_preset_name(const char* preset_name, string_t preset_str);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serialize data SubGhzBlockGeneric.
|
* Serialize data SubGhzBlockGeneric.
|
||||||
* @param instance Pointer to a SubGhzBlockGeneric instance
|
* @param instance Pointer to a SubGhzBlockGeneric instance
|
||||||
* @param flipper_format Pointer to a FlipperFormat instance
|
* @param flipper_format Pointer to a FlipperFormat instance
|
||||||
* @param frequency The frequency at which the signal was received, Hz
|
* @param preset The modulation on which the signal was received, SubGhzPesetDefinition
|
||||||
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_block_generic_serialize(
|
bool subghz_block_generic_serialize(
|
||||||
SubGhzBlockGeneric* instance,
|
SubGhzBlockGeneric* instance,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize data SubGhzBlockGeneric.
|
* Deserialize data SubGhzBlockGeneric.
|
||||||
|
@ -26,14 +26,12 @@ bool subghz_protocol_decoder_base_get_string(
|
|||||||
bool subghz_protocol_decoder_base_serialize(
|
bool subghz_protocol_decoder_base_serialize(
|
||||||
SubGhzProtocolDecoderBase* decoder_base,
|
SubGhzProtocolDecoderBase* decoder_base,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
bool status = false;
|
bool status = false;
|
||||||
|
|
||||||
if(decoder_base->protocol && decoder_base->protocol->decoder &&
|
if(decoder_base->protocol && decoder_base->protocol->decoder &&
|
||||||
decoder_base->protocol->decoder->serialize) {
|
decoder_base->protocol->decoder->serialize) {
|
||||||
status = decoder_base->protocol->decoder->serialize(
|
status = decoder_base->protocol->decoder->serialize(decoder_base, flipper_format, preset);
|
||||||
decoder_base, flipper_format, frequency, preset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
|
@ -43,15 +43,13 @@ bool subghz_protocol_decoder_base_get_string(
|
|||||||
* Serialize data SubGhzProtocolDecoderBase.
|
* Serialize data SubGhzProtocolDecoderBase.
|
||||||
* @param decoder_base Pointer to a SubGhzProtocolDecoderBase instance
|
* @param decoder_base Pointer to a SubGhzProtocolDecoderBase instance
|
||||||
* @param flipper_format Pointer to a FlipperFormat instance
|
* @param flipper_format Pointer to a FlipperFormat instance
|
||||||
* @param frequency The frequency at which the signal was received, Hz
|
* @param preset The modulation on which the signal was received, SubGhzPesetDefinition
|
||||||
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_decoder_base_serialize(
|
bool subghz_protocol_decoder_base_serialize(
|
||||||
SubGhzProtocolDecoderBase* decoder_base,
|
SubGhzProtocolDecoderBase* decoder_base,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize data SubGhzProtocolDecoderBase.
|
* Deserialize data SubGhzProtocolDecoderBase.
|
||||||
|
@ -284,11 +284,10 @@ uint8_t subghz_protocol_decoder_came_get_hash_data(void* context) {
|
|||||||
bool subghz_protocol_decoder_came_serialize(
|
bool subghz_protocol_decoder_came_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhzProtocolDecoderCame* instance = context;
|
SubGhzProtocolDecoderCame* instance = context;
|
||||||
return subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
return subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool subghz_protocol_decoder_came_deserialize(void* context, FlipperFormat* flipper_format) {
|
bool subghz_protocol_decoder_came_deserialize(void* context, FlipperFormat* flipper_format) {
|
||||||
|
@ -83,15 +83,13 @@ uint8_t subghz_protocol_decoder_came_get_hash_data(void* context);
|
|||||||
* Serialize data SubGhzProtocolDecoderCame.
|
* Serialize data SubGhzProtocolDecoderCame.
|
||||||
* @param context Pointer to a SubGhzProtocolDecoderCame instance
|
* @param context Pointer to a SubGhzProtocolDecoderCame instance
|
||||||
* @param flipper_format Pointer to a FlipperFormat instance
|
* @param flipper_format Pointer to a FlipperFormat instance
|
||||||
* @param frequency The frequency at which the signal was received, Hz
|
* @param preset The modulation on which the signal was received, SubGhzPesetDefinition
|
||||||
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_decoder_came_serialize(
|
bool subghz_protocol_decoder_came_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize data SubGhzProtocolDecoderCame.
|
* Deserialize data SubGhzProtocolDecoderCame.
|
||||||
|
@ -301,11 +301,10 @@ uint8_t subghz_protocol_decoder_came_atomo_get_hash_data(void* context) {
|
|||||||
bool subghz_protocol_decoder_came_atomo_serialize(
|
bool subghz_protocol_decoder_came_atomo_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhzProtocolDecoderCameAtomo* instance = context;
|
SubGhzProtocolDecoderCameAtomo* instance = context;
|
||||||
return subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
return subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool subghz_protocol_decoder_came_atomo_deserialize(void* context, FlipperFormat* flipper_format) {
|
bool subghz_protocol_decoder_came_atomo_deserialize(void* context, FlipperFormat* flipper_format) {
|
||||||
|
@ -48,15 +48,13 @@ uint8_t subghz_protocol_decoder_came_atomo_get_hash_data(void* context);
|
|||||||
* Serialize data SubGhzProtocolDecoderCameAtomo.
|
* Serialize data SubGhzProtocolDecoderCameAtomo.
|
||||||
* @param context Pointer to a SubGhzProtocolDecoderCameAtomo instance
|
* @param context Pointer to a SubGhzProtocolDecoderCameAtomo instance
|
||||||
* @param flipper_format Pointer to a FlipperFormat instance
|
* @param flipper_format Pointer to a FlipperFormat instance
|
||||||
* @param frequency The frequency at which the signal was received, Hz
|
* @param preset The modulation on which the signal was received, SubGhzPesetDefinition
|
||||||
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_decoder_came_atomo_serialize(
|
bool subghz_protocol_decoder_came_atomo_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize data SubGhzProtocolDecoderCameAtomo.
|
* Deserialize data SubGhzProtocolDecoderCameAtomo.
|
||||||
|
@ -418,11 +418,10 @@ uint8_t subghz_protocol_decoder_came_twee_get_hash_data(void* context) {
|
|||||||
bool subghz_protocol_decoder_came_twee_serialize(
|
bool subghz_protocol_decoder_came_twee_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhzProtocolDecoderCameTwee* instance = context;
|
SubGhzProtocolDecoderCameTwee* instance = context;
|
||||||
return subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
return subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool subghz_protocol_decoder_came_twee_deserialize(void* context, FlipperFormat* flipper_format) {
|
bool subghz_protocol_decoder_came_twee_deserialize(void* context, FlipperFormat* flipper_format) {
|
||||||
|
@ -83,15 +83,13 @@ uint8_t subghz_protocol_decoder_came_twee_get_hash_data(void* context);
|
|||||||
* Serialize data SubGhzProtocolDecoderCameTwee.
|
* Serialize data SubGhzProtocolDecoderCameTwee.
|
||||||
* @param context Pointer to a SubGhzProtocolDecoderCameTwee instance
|
* @param context Pointer to a SubGhzProtocolDecoderCameTwee instance
|
||||||
* @param flipper_format Pointer to a FlipperFormat instance
|
* @param flipper_format Pointer to a FlipperFormat instance
|
||||||
* @param frequency The frequency at which the signal was received, Hz
|
* @param preset The modulation on which the signal was received, SubGhzPesetDefinition
|
||||||
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_decoder_came_twee_serialize(
|
bool subghz_protocol_decoder_came_twee_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize data SubGhzProtocolDecoderCameTwee.
|
* Deserialize data SubGhzProtocolDecoderCameTwee.
|
||||||
|
@ -423,11 +423,10 @@ uint8_t subghz_protocol_decoder_chamb_code_get_hash_data(void* context) {
|
|||||||
bool subghz_protocol_decoder_chamb_code_serialize(
|
bool subghz_protocol_decoder_chamb_code_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhzProtocolDecoderChamb_Code* instance = context;
|
SubGhzProtocolDecoderChamb_Code* instance = context;
|
||||||
return subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
return subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool subghz_protocol_decoder_chamb_code_deserialize(void* context, FlipperFormat* flipper_format) {
|
bool subghz_protocol_decoder_chamb_code_deserialize(void* context, FlipperFormat* flipper_format) {
|
||||||
|
@ -83,15 +83,13 @@ uint8_t subghz_protocol_decoder_chamb_code_get_hash_data(void* context);
|
|||||||
* Serialize data SubGhzProtocolDecoderChamb_Code.
|
* Serialize data SubGhzProtocolDecoderChamb_Code.
|
||||||
* @param context Pointer to a SubGhzProtocolDecoderChamb_Code instance
|
* @param context Pointer to a SubGhzProtocolDecoderChamb_Code instance
|
||||||
* @param flipper_format Pointer to a FlipperFormat instance
|
* @param flipper_format Pointer to a FlipperFormat instance
|
||||||
* @param frequency The frequency at which the signal was received, Hz
|
* @param preset The modulation on which the signal was received, SubGhzPesetDefinition
|
||||||
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_decoder_chamb_code_serialize(
|
bool subghz_protocol_decoder_chamb_code_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize data SubGhzProtocolDecoderChamb_Code.
|
* Deserialize data SubGhzProtocolDecoderChamb_Code.
|
||||||
|
@ -183,11 +183,10 @@ uint8_t subghz_protocol_decoder_faac_slh_get_hash_data(void* context) {
|
|||||||
bool subghz_protocol_decoder_faac_slh_serialize(
|
bool subghz_protocol_decoder_faac_slh_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhzProtocolDecoderFaacSLH* instance = context;
|
SubGhzProtocolDecoderFaacSLH* instance = context;
|
||||||
return subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
return subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool subghz_protocol_decoder_faac_slh_deserialize(void* context, FlipperFormat* flipper_format) {
|
bool subghz_protocol_decoder_faac_slh_deserialize(void* context, FlipperFormat* flipper_format) {
|
||||||
|
@ -49,15 +49,13 @@ uint8_t subghz_protocol_decoder_faac_slh_get_hash_data(void* context);
|
|||||||
* Serialize data SubGhzProtocolDecoderFaacSLH.
|
* Serialize data SubGhzProtocolDecoderFaacSLH.
|
||||||
* @param context Pointer to a SubGhzProtocolDecoderFaacSLH instance
|
* @param context Pointer to a SubGhzProtocolDecoderFaacSLH instance
|
||||||
* @param flipper_format Pointer to a FlipperFormat instance
|
* @param flipper_format Pointer to a FlipperFormat instance
|
||||||
* @param frequency The frequency at which the signal was received, Hz
|
* @param preset The modulation on which the signal was received, SubGhzPesetDefinition
|
||||||
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_decoder_faac_slh_serialize(
|
bool subghz_protocol_decoder_faac_slh_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize data SubGhzProtocolDecoderFaacSLH.
|
* Deserialize data SubGhzProtocolDecoderFaacSLH.
|
||||||
|
@ -289,11 +289,10 @@ uint8_t subghz_protocol_decoder_gate_tx_get_hash_data(void* context) {
|
|||||||
bool subghz_protocol_decoder_gate_tx_serialize(
|
bool subghz_protocol_decoder_gate_tx_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhzProtocolDecoderGateTx* instance = context;
|
SubGhzProtocolDecoderGateTx* instance = context;
|
||||||
return subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
return subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool subghz_protocol_decoder_gate_tx_deserialize(void* context, FlipperFormat* flipper_format) {
|
bool subghz_protocol_decoder_gate_tx_deserialize(void* context, FlipperFormat* flipper_format) {
|
||||||
|
@ -83,15 +83,13 @@ uint8_t subghz_protocol_decoder_gate_tx_get_hash_data(void* context);
|
|||||||
* Serialize data SubGhzProtocolDecoderGateTx.
|
* Serialize data SubGhzProtocolDecoderGateTx.
|
||||||
* @param context Pointer to a SubGhzProtocolDecoderGateTx instance
|
* @param context Pointer to a SubGhzProtocolDecoderGateTx instance
|
||||||
* @param flipper_format Pointer to a FlipperFormat instance
|
* @param flipper_format Pointer to a FlipperFormat instance
|
||||||
* @param frequency The frequency at which the signal was received, Hz
|
* @param preset The modulation on which the signal was received, SubGhzPesetDefinition
|
||||||
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_decoder_gate_tx_serialize(
|
bool subghz_protocol_decoder_gate_tx_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize data SubGhzProtocolDecoderGateTx.
|
* Deserialize data SubGhzProtocolDecoderGateTx.
|
||||||
|
@ -322,11 +322,10 @@ uint8_t subghz_protocol_decoder_holtek_get_hash_data(void* context) {
|
|||||||
bool subghz_protocol_decoder_holtek_serialize(
|
bool subghz_protocol_decoder_holtek_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhzProtocolDecoderHoltek* instance = context;
|
SubGhzProtocolDecoderHoltek* instance = context;
|
||||||
return subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
return subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool subghz_protocol_decoder_holtek_deserialize(void* context, FlipperFormat* flipper_format) {
|
bool subghz_protocol_decoder_holtek_deserialize(void* context, FlipperFormat* flipper_format) {
|
||||||
|
@ -83,15 +83,13 @@ uint8_t subghz_protocol_decoder_holtek_get_hash_data(void* context);
|
|||||||
* Serialize data SubGhzProtocolDecoderHoltek.
|
* Serialize data SubGhzProtocolDecoderHoltek.
|
||||||
* @param context Pointer to a SubGhzProtocolDecoderHoltek instance
|
* @param context Pointer to a SubGhzProtocolDecoderHoltek instance
|
||||||
* @param flipper_format Pointer to a FlipperFormat instance
|
* @param flipper_format Pointer to a FlipperFormat instance
|
||||||
* @param frequency The frequency at which the signal was received, Hz
|
* @param preset The modulation on which the signal was received, SubGhzPesetDefinition
|
||||||
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_decoder_holtek_serialize(
|
bool subghz_protocol_decoder_holtek_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize data SubGhzProtocolDecoderHoltek.
|
* Deserialize data SubGhzProtocolDecoderHoltek.
|
||||||
|
@ -310,11 +310,10 @@ uint8_t subghz_protocol_decoder_hormann_get_hash_data(void* context) {
|
|||||||
bool subghz_protocol_decoder_hormann_serialize(
|
bool subghz_protocol_decoder_hormann_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhzProtocolDecoderHormann* instance = context;
|
SubGhzProtocolDecoderHormann* instance = context;
|
||||||
return subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
return subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool subghz_protocol_decoder_hormann_deserialize(void* context, FlipperFormat* flipper_format) {
|
bool subghz_protocol_decoder_hormann_deserialize(void* context, FlipperFormat* flipper_format) {
|
||||||
|
@ -83,15 +83,13 @@ uint8_t subghz_protocol_decoder_hormann_get_hash_data(void* context);
|
|||||||
* Serialize data SubGhzProtocolDecoderHormann.
|
* Serialize data SubGhzProtocolDecoderHormann.
|
||||||
* @param context Pointer to a SubGhzProtocolDecoderHormann instance
|
* @param context Pointer to a SubGhzProtocolDecoderHormann instance
|
||||||
* @param flipper_format Pointer to a FlipperFormat instance
|
* @param flipper_format Pointer to a FlipperFormat instance
|
||||||
* @param frequency The frequency at which the signal was received, Hz
|
* @param preset The modulation on which the signal was received, SubGhzPesetDefinition
|
||||||
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_decoder_hormann_serialize(
|
bool subghz_protocol_decoder_hormann_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize data SubGhzProtocolDecoderHormann.
|
* Deserialize data SubGhzProtocolDecoderHormann.
|
||||||
|
@ -182,11 +182,10 @@ uint8_t subghz_protocol_decoder_ido_get_hash_data(void* context) {
|
|||||||
bool subghz_protocol_decoder_ido_serialize(
|
bool subghz_protocol_decoder_ido_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhzProtocolDecoderIDo* instance = context;
|
SubGhzProtocolDecoderIDo* instance = context;
|
||||||
return subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
return subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool subghz_protocol_decoder_ido_deserialize(void* context, FlipperFormat* flipper_format) {
|
bool subghz_protocol_decoder_ido_deserialize(void* context, FlipperFormat* flipper_format) {
|
||||||
|
@ -49,15 +49,13 @@ uint8_t subghz_protocol_decoder_ido_get_hash_data(void* context);
|
|||||||
* Serialize data SubGhzProtocolDecoderIDo.
|
* Serialize data SubGhzProtocolDecoderIDo.
|
||||||
* @param context Pointer to a SubGhzProtocolDecoderIDo instance
|
* @param context Pointer to a SubGhzProtocolDecoderIDo instance
|
||||||
* @param flipper_format Pointer to a FlipperFormat instance
|
* @param flipper_format Pointer to a FlipperFormat instance
|
||||||
* @param frequency The frequency at which the signal was received, Hz
|
* @param preset The modulation on which the signal was received, SubGhzPesetDefinition
|
||||||
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_decoder_ido_serialize(
|
bool subghz_protocol_decoder_ido_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize data SubGhzProtocolDecoderIDo.
|
* Deserialize data SubGhzProtocolDecoderIDo.
|
||||||
|
@ -174,8 +174,7 @@ bool subghz_protocol_keeloq_create_data(
|
|||||||
uint8_t btn,
|
uint8_t btn,
|
||||||
uint16_t cnt,
|
uint16_t cnt,
|
||||||
const char* manufacture_name,
|
const char* manufacture_name,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhzProtocolEncoderKeeloq* instance = context;
|
SubGhzProtocolEncoderKeeloq* instance = context;
|
||||||
instance->generic.serial = serial;
|
instance->generic.serial = serial;
|
||||||
@ -184,8 +183,7 @@ bool subghz_protocol_keeloq_create_data(
|
|||||||
instance->generic.data_count_bit = 64;
|
instance->generic.data_count_bit = 64;
|
||||||
bool res = subghz_protocol_keeloq_gen_data(instance, btn);
|
bool res = subghz_protocol_keeloq_gen_data(instance, btn);
|
||||||
if(res) {
|
if(res) {
|
||||||
res =
|
res = subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||||
subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -633,15 +631,13 @@ uint8_t subghz_protocol_decoder_keeloq_get_hash_data(void* context) {
|
|||||||
bool subghz_protocol_decoder_keeloq_serialize(
|
bool subghz_protocol_decoder_keeloq_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhzProtocolDecoderKeeloq* instance = context;
|
SubGhzProtocolDecoderKeeloq* instance = context;
|
||||||
subghz_protocol_keeloq_check_remote_controller(
|
subghz_protocol_keeloq_check_remote_controller(
|
||||||
&instance->generic, instance->keystore, &instance->manufacture_name);
|
&instance->generic, instance->keystore, &instance->manufacture_name);
|
||||||
|
|
||||||
bool res =
|
bool res = subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||||
subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
|
||||||
|
|
||||||
if(res && !flipper_format_write_string_cstr(
|
if(res && !flipper_format_write_string_cstr(
|
||||||
flipper_format, "Manufacture", instance->manufacture_name)) {
|
flipper_format, "Manufacture", instance->manufacture_name)) {
|
||||||
|
@ -32,8 +32,7 @@ void subghz_protocol_encoder_keeloq_free(void* context);
|
|||||||
* @param btn Button number, 4 bit
|
* @param btn Button number, 4 bit
|
||||||
* @param cnt Container value, 16 bit
|
* @param cnt Container value, 16 bit
|
||||||
* @param manufacture_name Name of manufacturer's key
|
* @param manufacture_name Name of manufacturer's key
|
||||||
* @param frequency Transmission frequency, Hz
|
* @param preset Modulation, SubGhzPesetDefinition
|
||||||
* @param preset Modulation, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_keeloq_create_data(
|
bool subghz_protocol_keeloq_create_data(
|
||||||
@ -43,8 +42,7 @@ bool subghz_protocol_keeloq_create_data(
|
|||||||
uint8_t btn,
|
uint8_t btn,
|
||||||
uint16_t cnt,
|
uint16_t cnt,
|
||||||
const char* manufacture_name,
|
const char* manufacture_name,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize and generating an upload to send.
|
* Deserialize and generating an upload to send.
|
||||||
@ -105,15 +103,13 @@ uint8_t subghz_protocol_decoder_keeloq_get_hash_data(void* context);
|
|||||||
* Serialize data SubGhzProtocolDecoderKeeloq.
|
* Serialize data SubGhzProtocolDecoderKeeloq.
|
||||||
* @param context Pointer to a SubGhzProtocolDecoderKeeloq instance
|
* @param context Pointer to a SubGhzProtocolDecoderKeeloq instance
|
||||||
* @param flipper_format Pointer to a FlipperFormat instance
|
* @param flipper_format Pointer to a FlipperFormat instance
|
||||||
* @param frequency The frequency at which the signal was received, Hz
|
* @param preset The modulation on which the signal was received, SubGhzPesetDefinition
|
||||||
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_decoder_keeloq_serialize(
|
bool subghz_protocol_decoder_keeloq_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize data SubGhzProtocolDecoderKeeloq.
|
* Deserialize data SubGhzProtocolDecoderKeeloq.
|
||||||
|
@ -233,11 +233,10 @@ uint8_t subghz_protocol_decoder_kia_get_hash_data(void* context) {
|
|||||||
bool subghz_protocol_decoder_kia_serialize(
|
bool subghz_protocol_decoder_kia_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhzProtocolDecoderKIA* instance = context;
|
SubGhzProtocolDecoderKIA* instance = context;
|
||||||
return subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
return subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool subghz_protocol_decoder_kia_deserialize(void* context, FlipperFormat* flipper_format) {
|
bool subghz_protocol_decoder_kia_deserialize(void* context, FlipperFormat* flipper_format) {
|
||||||
|
@ -49,15 +49,13 @@ uint8_t subghz_protocol_decoder_kia_get_hash_data(void* context);
|
|||||||
* Serialize data SubGhzProtocolDecoderKIA.
|
* Serialize data SubGhzProtocolDecoderKIA.
|
||||||
* @param context Pointer to a SubGhzProtocolDecoderKIA instance
|
* @param context Pointer to a SubGhzProtocolDecoderKIA instance
|
||||||
* @param flipper_format Pointer to a FlipperFormat instance
|
* @param flipper_format Pointer to a FlipperFormat instance
|
||||||
* @param frequency The frequency at which the signal was received, Hz
|
* @param preset The modulation on which the signal was received, SubGhzPesetDefinition
|
||||||
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_decoder_kia_serialize(
|
bool subghz_protocol_decoder_kia_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize data SubGhzProtocolDecoderKIA.
|
* Deserialize data SubGhzProtocolDecoderKIA.
|
||||||
|
@ -299,11 +299,10 @@ uint8_t subghz_protocol_decoder_linear_get_hash_data(void* context) {
|
|||||||
bool subghz_protocol_decoder_linear_serialize(
|
bool subghz_protocol_decoder_linear_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhzProtocolDecoderLinear* instance = context;
|
SubGhzProtocolDecoderLinear* instance = context;
|
||||||
return subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
return subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool subghz_protocol_decoder_linear_deserialize(void* context, FlipperFormat* flipper_format) {
|
bool subghz_protocol_decoder_linear_deserialize(void* context, FlipperFormat* flipper_format) {
|
||||||
|
@ -83,15 +83,13 @@ uint8_t subghz_protocol_decoder_linear_get_hash_data(void* context);
|
|||||||
* Serialize data SubGhzProtocolDecoderLinear.
|
* Serialize data SubGhzProtocolDecoderLinear.
|
||||||
* @param context Pointer to a SubGhzProtocolDecoderLinear instance
|
* @param context Pointer to a SubGhzProtocolDecoderLinear instance
|
||||||
* @param flipper_format Pointer to a FlipperFormat instance
|
* @param flipper_format Pointer to a FlipperFormat instance
|
||||||
* @param frequency The frequency at which the signal was received, Hz
|
* @param preset The modulation on which the signal was received, SubGhzPesetDefinition
|
||||||
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_decoder_linear_serialize(
|
bool subghz_protocol_decoder_linear_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize data SubGhzProtocolDecoderLinear.
|
* Deserialize data SubGhzProtocolDecoderLinear.
|
||||||
|
@ -380,11 +380,10 @@ uint8_t subghz_protocol_decoder_megacode_get_hash_data(void* context) {
|
|||||||
bool subghz_protocol_decoder_megacode_serialize(
|
bool subghz_protocol_decoder_megacode_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhzProtocolDecoderMegaCode* instance = context;
|
SubGhzProtocolDecoderMegaCode* instance = context;
|
||||||
return subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
return subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool subghz_protocol_decoder_megacode_deserialize(void* context, FlipperFormat* flipper_format) {
|
bool subghz_protocol_decoder_megacode_deserialize(void* context, FlipperFormat* flipper_format) {
|
||||||
|
@ -83,15 +83,13 @@ uint8_t subghz_protocol_decoder_megacode_get_hash_data(void* context);
|
|||||||
* Serialize data SubGhzProtocolDecoderMegaCode.
|
* Serialize data SubGhzProtocolDecoderMegaCode.
|
||||||
* @param context Pointer to a SubGhzProtocolDecoderMegaCode instance
|
* @param context Pointer to a SubGhzProtocolDecoderMegaCode instance
|
||||||
* @param flipper_format Pointer to a FlipperFormat instance
|
* @param flipper_format Pointer to a FlipperFormat instance
|
||||||
* @param frequency The frequency at which the signal was received, Hz
|
* @param preset The modulation on which the signal was received, SubGhzPesetDefinition
|
||||||
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_decoder_megacode_serialize(
|
bool subghz_protocol_decoder_megacode_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize data SubGhzProtocolDecoderMegaCode.
|
* Deserialize data SubGhzProtocolDecoderMegaCode.
|
||||||
|
@ -342,11 +342,10 @@ uint8_t subghz_protocol_decoder_nero_radio_get_hash_data(void* context) {
|
|||||||
bool subghz_protocol_decoder_nero_radio_serialize(
|
bool subghz_protocol_decoder_nero_radio_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhzProtocolDecoderNeroRadio* instance = context;
|
SubGhzProtocolDecoderNeroRadio* instance = context;
|
||||||
return subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
return subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool subghz_protocol_decoder_nero_radio_deserialize(void* context, FlipperFormat* flipper_format) {
|
bool subghz_protocol_decoder_nero_radio_deserialize(void* context, FlipperFormat* flipper_format) {
|
||||||
|
@ -83,15 +83,13 @@ uint8_t subghz_protocol_decoder_nero_radio_get_hash_data(void* context);
|
|||||||
* Serialize data SubGhzProtocolDecoderNeroRadio.
|
* Serialize data SubGhzProtocolDecoderNeroRadio.
|
||||||
* @param context Pointer to a SubGhzProtocolDecoderNeroRadio instance
|
* @param context Pointer to a SubGhzProtocolDecoderNeroRadio instance
|
||||||
* @param flipper_format Pointer to a FlipperFormat instance
|
* @param flipper_format Pointer to a FlipperFormat instance
|
||||||
* @param frequency The frequency at which the signal was received, Hz
|
* @param preset The modulation on which the signal was received, SubGhzPesetDefinition
|
||||||
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_decoder_nero_radio_serialize(
|
bool subghz_protocol_decoder_nero_radio_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize data SubGhzProtocolDecoderNeroRadio.
|
* Deserialize data SubGhzProtocolDecoderNeroRadio.
|
||||||
|
@ -327,11 +327,10 @@ uint8_t subghz_protocol_decoder_nero_sketch_get_hash_data(void* context) {
|
|||||||
bool subghz_protocol_decoder_nero_sketch_serialize(
|
bool subghz_protocol_decoder_nero_sketch_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhzProtocolDecoderNeroSketch* instance = context;
|
SubGhzProtocolDecoderNeroSketch* instance = context;
|
||||||
return subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
return subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool subghz_protocol_decoder_nero_sketch_deserialize(void* context, FlipperFormat* flipper_format) {
|
bool subghz_protocol_decoder_nero_sketch_deserialize(void* context, FlipperFormat* flipper_format) {
|
||||||
|
@ -83,15 +83,13 @@ uint8_t subghz_protocol_decoder_nero_sketch_get_hash_data(void* context);
|
|||||||
* Serialize data SubGhzProtocolDecoderNeroSketch.
|
* Serialize data SubGhzProtocolDecoderNeroSketch.
|
||||||
* @param context Pointer to a SubGhzProtocolDecoderNeroSketch instance
|
* @param context Pointer to a SubGhzProtocolDecoderNeroSketch instance
|
||||||
* @param flipper_format Pointer to a FlipperFormat instance
|
* @param flipper_format Pointer to a FlipperFormat instance
|
||||||
* @param frequency The frequency at which the signal was received, Hz
|
* @param preset The modulation on which the signal was received, SubGhzPesetDefinition
|
||||||
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_decoder_nero_sketch_serialize(
|
bool subghz_protocol_decoder_nero_sketch_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize data SubGhzProtocolDecoderNeroSketch.
|
* Deserialize data SubGhzProtocolDecoderNeroSketch.
|
||||||
|
@ -277,11 +277,10 @@ uint8_t subghz_protocol_decoder_nice_flo_get_hash_data(void* context) {
|
|||||||
bool subghz_protocol_decoder_nice_flo_serialize(
|
bool subghz_protocol_decoder_nice_flo_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhzProtocolDecoderNiceFlo* instance = context;
|
SubGhzProtocolDecoderNiceFlo* instance = context;
|
||||||
return subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
return subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool subghz_protocol_decoder_nice_flo_deserialize(void* context, FlipperFormat* flipper_format) {
|
bool subghz_protocol_decoder_nice_flo_deserialize(void* context, FlipperFormat* flipper_format) {
|
||||||
|
@ -83,15 +83,13 @@ uint8_t subghz_protocol_decoder_nice_flo_get_hash_data(void* context);
|
|||||||
* Serialize data SubGhzProtocolDecoderNiceFlo.
|
* Serialize data SubGhzProtocolDecoderNiceFlo.
|
||||||
* @param context Pointer to a SubGhzProtocolDecoderNiceFlo instance
|
* @param context Pointer to a SubGhzProtocolDecoderNiceFlo instance
|
||||||
* @param flipper_format Pointer to a FlipperFormat instance
|
* @param flipper_format Pointer to a FlipperFormat instance
|
||||||
* @param frequency The frequency at which the signal was received, Hz
|
* @param preset The modulation on which the signal was received, SubGhzPesetDefinition
|
||||||
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_decoder_nice_flo_serialize(
|
bool subghz_protocol_decoder_nice_flo_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize data SubGhzProtocolDecoderNiceFlo.
|
* Deserialize data SubGhzProtocolDecoderNiceFlo.
|
||||||
|
@ -330,11 +330,10 @@ uint8_t subghz_protocol_decoder_nice_flor_s_get_hash_data(void* context) {
|
|||||||
bool subghz_protocol_decoder_nice_flor_s_serialize(
|
bool subghz_protocol_decoder_nice_flor_s_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhzProtocolDecoderNiceFlorS* instance = context;
|
SubGhzProtocolDecoderNiceFlorS* instance = context;
|
||||||
return subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
return subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool subghz_protocol_decoder_nice_flor_s_deserialize(void* context, FlipperFormat* flipper_format) {
|
bool subghz_protocol_decoder_nice_flor_s_deserialize(void* context, FlipperFormat* flipper_format) {
|
||||||
|
@ -49,15 +49,13 @@ uint8_t subghz_protocol_decoder_nice_flor_s_get_hash_data(void* context);
|
|||||||
* Serialize data SubGhzProtocolDecoderNiceFlorS.
|
* Serialize data SubGhzProtocolDecoderNiceFlorS.
|
||||||
* @param context Pointer to a SubGhzProtocolDecoderNiceFlorS instance
|
* @param context Pointer to a SubGhzProtocolDecoderNiceFlorS instance
|
||||||
* @param flipper_format Pointer to a FlipperFormat instance
|
* @param flipper_format Pointer to a FlipperFormat instance
|
||||||
* @param frequency The frequency at which the signal was received, Hz
|
* @param preset The modulation on which the signal was received, SubGhzPesetDefinition
|
||||||
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_decoder_nice_flor_s_serialize(
|
bool subghz_protocol_decoder_nice_flor_s_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize data SubGhzProtocolDecoderNiceFlorS.
|
* Deserialize data SubGhzProtocolDecoderNiceFlorS.
|
||||||
|
@ -345,11 +345,10 @@ uint8_t subghz_protocol_decoder_power_smart_get_hash_data(void* context) {
|
|||||||
bool subghz_protocol_decoder_power_smart_serialize(
|
bool subghz_protocol_decoder_power_smart_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhzProtocolDecoderPowerSmart* instance = context;
|
SubGhzProtocolDecoderPowerSmart* instance = context;
|
||||||
return subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
return subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool subghz_protocol_decoder_power_smart_deserialize(void* context, FlipperFormat* flipper_format) {
|
bool subghz_protocol_decoder_power_smart_deserialize(void* context, FlipperFormat* flipper_format) {
|
||||||
|
@ -83,15 +83,13 @@ uint8_t subghz_protocol_decoder_power_smart_get_hash_data(void* context);
|
|||||||
* Serialize data SubGhzProtocolDecoderPowerSmart.
|
* Serialize data SubGhzProtocolDecoderPowerSmart.
|
||||||
* @param context Pointer to a SubGhzProtocolDecoderPowerSmart instance
|
* @param context Pointer to a SubGhzProtocolDecoderPowerSmart instance
|
||||||
* @param flipper_format Pointer to a FlipperFormat instance
|
* @param flipper_format Pointer to a FlipperFormat instance
|
||||||
* @param frequency The frequency at which the signal was received, Hz
|
* @param preset The modulation on which the signal was received, SubGhzPesetDefinition
|
||||||
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_decoder_power_smart_serialize(
|
bool subghz_protocol_decoder_power_smart_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize data SubGhzProtocolDecoderPowerSmart.
|
* Deserialize data SubGhzProtocolDecoderPowerSmart.
|
||||||
|
@ -300,12 +300,10 @@ uint8_t subghz_protocol_decoder_princeton_get_hash_data(void* context) {
|
|||||||
bool subghz_protocol_decoder_princeton_serialize(
|
bool subghz_protocol_decoder_princeton_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhzProtocolDecoderPrinceton* instance = context;
|
SubGhzProtocolDecoderPrinceton* instance = context;
|
||||||
bool res =
|
bool res = subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||||
subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
|
||||||
if(res && !flipper_format_write_uint32(flipper_format, "TE", &instance->te, 1)) {
|
if(res && !flipper_format_write_uint32(flipper_format, "TE", &instance->te, 1)) {
|
||||||
FURI_LOG_E(TAG, "Unable to add TE");
|
FURI_LOG_E(TAG, "Unable to add TE");
|
||||||
res = false;
|
res = false;
|
||||||
|
@ -83,15 +83,13 @@ uint8_t subghz_protocol_decoder_princeton_get_hash_data(void* context);
|
|||||||
* Serialize data SubGhzProtocolDecoderPrinceton.
|
* Serialize data SubGhzProtocolDecoderPrinceton.
|
||||||
* @param context Pointer to a SubGhzProtocolDecoderPrinceton instance
|
* @param context Pointer to a SubGhzProtocolDecoderPrinceton instance
|
||||||
* @param flipper_format Pointer to a FlipperFormat instance
|
* @param flipper_format Pointer to a FlipperFormat instance
|
||||||
* @param frequency The frequency at which the signal was received, Hz
|
* @param preset The modulation on which the signal was received, SubGhzPesetDefinition
|
||||||
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_decoder_princeton_serialize(
|
bool subghz_protocol_decoder_princeton_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize data SubGhzProtocolDecoderPrinceton.
|
* Deserialize data SubGhzProtocolDecoderPrinceton.
|
||||||
|
@ -83,8 +83,7 @@ const SubGhzProtocol subghz_protocol_raw = {
|
|||||||
bool subghz_protocol_raw_save_to_file_init(
|
bool subghz_protocol_raw_save_to_file_init(
|
||||||
SubGhzProtocolDecoderRAW* instance,
|
SubGhzProtocolDecoderRAW* instance,
|
||||||
const char* dev_name,
|
const char* dev_name,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(instance);
|
furi_assert(instance);
|
||||||
|
|
||||||
instance->storage = furi_record_open(RECORD_STORAGE);
|
instance->storage = furi_record_open(RECORD_STORAGE);
|
||||||
@ -124,19 +123,30 @@ bool subghz_protocol_raw_save_to_file_init(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!flipper_format_write_uint32(instance->flipper_file, "Frequency", &frequency, 1)) {
|
if(!flipper_format_write_uint32(
|
||||||
|
instance->flipper_file, "Frequency", &preset->frequency, 1)) {
|
||||||
FURI_LOG_E(TAG, "Unable to add Frequency");
|
FURI_LOG_E(TAG, "Unable to add Frequency");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(!subghz_block_generic_get_preset_name(preset, temp_str)) {
|
|
||||||
break;
|
subghz_block_generic_get_preset_name(string_get_cstr(preset->name), temp_str);
|
||||||
}
|
|
||||||
if(!flipper_format_write_string_cstr(
|
if(!flipper_format_write_string_cstr(
|
||||||
instance->flipper_file, "Preset", string_get_cstr(temp_str))) {
|
instance->flipper_file, "Preset", string_get_cstr(temp_str))) {
|
||||||
FURI_LOG_E(TAG, "Unable to add Preset");
|
FURI_LOG_E(TAG, "Unable to add Preset");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if(!strcmp(string_get_cstr(temp_str), "FuriHalSubGhzPresetCustom")) {
|
||||||
|
if(!flipper_format_write_string_cstr(
|
||||||
|
instance->flipper_file, "Custom_preset_module", "CC1101")) {
|
||||||
|
FURI_LOG_E(TAG, "Unable to add Custom_preset_module");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(!flipper_format_write_hex(
|
||||||
|
instance->flipper_file, "Custom_preset_data", preset->data, preset->data_size)) {
|
||||||
|
FURI_LOG_E(TAG, "Unable to add Custom_preset_data");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if(!flipper_format_write_string_cstr(
|
if(!flipper_format_write_string_cstr(
|
||||||
instance->flipper_file, "Protocol", instance->base.protocol->name)) {
|
instance->flipper_file, "Protocol", instance->base.protocol->name)) {
|
||||||
FURI_LOG_E(TAG, "Unable to add Protocol");
|
FURI_LOG_E(TAG, "Unable to add Protocol");
|
||||||
|
@ -17,15 +17,13 @@ extern const SubGhzProtocol subghz_protocol_raw;
|
|||||||
* Open file for writing
|
* Open file for writing
|
||||||
* @param instance Pointer to a SubGhzProtocolDecoderRAW instance
|
* @param instance Pointer to a SubGhzProtocolDecoderRAW instance
|
||||||
* @param dev_name File name
|
* @param dev_name File name
|
||||||
* @param frequency The frequency at which the signal was received, Hz
|
* @param preset The modulation on which the signal was received, SubGhzPesetDefinition
|
||||||
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_raw_save_to_file_init(
|
bool subghz_protocol_raw_save_to_file_init(
|
||||||
SubGhzProtocolDecoderRAW* instance,
|
SubGhzProtocolDecoderRAW* instance,
|
||||||
const char* dev_name,
|
const char* dev_name,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop writing file to flash
|
* Stop writing file to flash
|
||||||
|
@ -251,11 +251,10 @@ uint8_t subghz_protocol_decoder_scher_khan_get_hash_data(void* context) {
|
|||||||
bool subghz_protocol_decoder_scher_khan_serialize(
|
bool subghz_protocol_decoder_scher_khan_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhzProtocolDecoderScherKhan* instance = context;
|
SubGhzProtocolDecoderScherKhan* instance = context;
|
||||||
return subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
return subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool subghz_protocol_decoder_scher_khan_deserialize(void* context, FlipperFormat* flipper_format) {
|
bool subghz_protocol_decoder_scher_khan_deserialize(void* context, FlipperFormat* flipper_format) {
|
||||||
|
@ -49,15 +49,13 @@ uint8_t subghz_protocol_decoder_scher_khan_get_hash_data(void* context);
|
|||||||
* Serialize data SubGhzProtocolDecoderScherKhan.
|
* Serialize data SubGhzProtocolDecoderScherKhan.
|
||||||
* @param context Pointer to a SubGhzProtocolDecoderScherKhan instance
|
* @param context Pointer to a SubGhzProtocolDecoderScherKhan instance
|
||||||
* @param flipper_format Pointer to a FlipperFormat instance
|
* @param flipper_format Pointer to a FlipperFormat instance
|
||||||
* @param frequency The frequency at which the signal was received, Hz
|
* @param preset The modulation on which the signal was received, SubGhzPesetDefinition
|
||||||
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_decoder_scher_khan_serialize(
|
bool subghz_protocol_decoder_scher_khan_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize data SubGhzProtocolDecoderScherKhan.
|
* Deserialize data SubGhzProtocolDecoderScherKhan.
|
||||||
|
@ -515,11 +515,10 @@ uint8_t subghz_protocol_decoder_secplus_v1_get_hash_data(void* context) {
|
|||||||
bool subghz_protocol_decoder_secplus_v1_serialize(
|
bool subghz_protocol_decoder_secplus_v1_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhzProtocolDecoderSecPlus_v1* instance = context;
|
SubGhzProtocolDecoderSecPlus_v1* instance = context;
|
||||||
return subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
return subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool subghz_protocol_decoder_secplus_v1_deserialize(void* context, FlipperFormat* flipper_format) {
|
bool subghz_protocol_decoder_secplus_v1_deserialize(void* context, FlipperFormat* flipper_format) {
|
||||||
|
@ -82,15 +82,13 @@ uint8_t subghz_protocol_decoder_secplus_v1_get_hash_data(void* context);
|
|||||||
* Serialize data SubGhzProtocolDecoderSecPlus_v1.
|
* Serialize data SubGhzProtocolDecoderSecPlus_v1.
|
||||||
* @param context Pointer to a SubGhzProtocolDecoderSecPlus_v1 instance
|
* @param context Pointer to a SubGhzProtocolDecoderSecPlus_v1 instance
|
||||||
* @param flipper_format Pointer to a FlipperFormat instance
|
* @param flipper_format Pointer to a FlipperFormat instance
|
||||||
* @param frequency The frequency at which the signal was received, Hz
|
* @param preset The modulation on which the signal was received, SubGhzPesetDefinition
|
||||||
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_decoder_secplus_v1_serialize(
|
bool subghz_protocol_decoder_secplus_v1_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize data SubGhzProtocolDecoderSecPlus_v1.
|
* Deserialize data SubGhzProtocolDecoderSecPlus_v1.
|
||||||
|
@ -588,8 +588,7 @@ bool subghz_protocol_secplus_v2_create_data(
|
|||||||
uint32_t serial,
|
uint32_t serial,
|
||||||
uint8_t btn,
|
uint8_t btn,
|
||||||
uint32_t cnt,
|
uint32_t cnt,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhzProtocolEncoderSecPlus_v2* instance = context;
|
SubGhzProtocolEncoderSecPlus_v2* instance = context;
|
||||||
instance->generic.serial = serial;
|
instance->generic.serial = serial;
|
||||||
@ -598,8 +597,7 @@ bool subghz_protocol_secplus_v2_create_data(
|
|||||||
instance->generic.data_count_bit =
|
instance->generic.data_count_bit =
|
||||||
(uint8_t)subghz_protocol_secplus_v2_const.min_count_bit_for_found;
|
(uint8_t)subghz_protocol_secplus_v2_const.min_count_bit_for_found;
|
||||||
subghz_protocol_secplus_v2_encode(instance);
|
subghz_protocol_secplus_v2_encode(instance);
|
||||||
bool res =
|
bool res = subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||||
subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
|
||||||
|
|
||||||
uint8_t key_data[sizeof(uint64_t)] = {0};
|
uint8_t key_data[sizeof(uint64_t)] = {0};
|
||||||
for(size_t i = 0; i < sizeof(uint64_t); i++) {
|
for(size_t i = 0; i < sizeof(uint64_t); i++) {
|
||||||
@ -757,12 +755,10 @@ uint8_t subghz_protocol_decoder_secplus_v2_get_hash_data(void* context) {
|
|||||||
bool subghz_protocol_decoder_secplus_v2_serialize(
|
bool subghz_protocol_decoder_secplus_v2_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhzProtocolDecoderSecPlus_v2* instance = context;
|
SubGhzProtocolDecoderSecPlus_v2* instance = context;
|
||||||
bool res =
|
bool res = subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||||
subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
|
||||||
|
|
||||||
uint8_t key_data[sizeof(uint64_t)] = {0};
|
uint8_t key_data[sizeof(uint64_t)] = {0};
|
||||||
for(size_t i = 0; i < sizeof(uint64_t); i++) {
|
for(size_t i = 0; i < sizeof(uint64_t); i++) {
|
||||||
|
@ -52,8 +52,7 @@ LevelDuration subghz_protocol_encoder_secplus_v2_yield(void* context);
|
|||||||
* @param btn Button number, 8 bit
|
* @param btn Button number, 8 bit
|
||||||
* @param cnt Container value, 28 bit
|
* @param cnt Container value, 28 bit
|
||||||
* @param manufacture_name Name of manufacturer's key
|
* @param manufacture_name Name of manufacturer's key
|
||||||
* @param frequency Transmission frequency, Hz
|
* @param preset Modulation, SubGhzPesetDefinition
|
||||||
* @param preset Modulation, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_secplus_v2_create_data(
|
bool subghz_protocol_secplus_v2_create_data(
|
||||||
@ -62,8 +61,7 @@ bool subghz_protocol_secplus_v2_create_data(
|
|||||||
uint32_t serial,
|
uint32_t serial,
|
||||||
uint8_t btn,
|
uint8_t btn,
|
||||||
uint32_t cnt,
|
uint32_t cnt,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate SubGhzProtocolDecoderSecPlus_v2.
|
* Allocate SubGhzProtocolDecoderSecPlus_v2.
|
||||||
@ -103,15 +101,13 @@ uint8_t subghz_protocol_decoder_secplus_v2_get_hash_data(void* context);
|
|||||||
* Serialize data SubGhzProtocolDecoderSecPlus_v2.
|
* Serialize data SubGhzProtocolDecoderSecPlus_v2.
|
||||||
* @param context Pointer to a SubGhzProtocolDecoderSecPlus_v2 instance
|
* @param context Pointer to a SubGhzProtocolDecoderSecPlus_v2 instance
|
||||||
* @param flipper_format Pointer to a FlipperFormat instance
|
* @param flipper_format Pointer to a FlipperFormat instance
|
||||||
* @param frequency The frequency at which the signal was received, Hz
|
* @param preset The modulation on which the signal was received, SubGhzPesetDefinition
|
||||||
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_decoder_secplus_v2_serialize(
|
bool subghz_protocol_decoder_secplus_v2_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize data SubGhzProtocolDecoderSecPlus_v2.
|
* Deserialize data SubGhzProtocolDecoderSecPlus_v2.
|
||||||
|
@ -382,12 +382,10 @@ uint8_t subghz_protocol_decoder_somfy_keytis_get_hash_data(void* context) {
|
|||||||
bool subghz_protocol_decoder_somfy_keytis_serialize(
|
bool subghz_protocol_decoder_somfy_keytis_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhzProtocolDecoderSomfyKeytis* instance = context;
|
SubGhzProtocolDecoderSomfyKeytis* instance = context;
|
||||||
bool res =
|
bool res = subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||||
subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
|
||||||
if(res && !flipper_format_write_uint32(
|
if(res && !flipper_format_write_uint32(
|
||||||
flipper_format, "Duration_Counter", &instance->press_duration_counter, 1)) {
|
flipper_format, "Duration_Counter", &instance->press_duration_counter, 1)) {
|
||||||
FURI_LOG_E(TAG, "Unable to add Duration_Counter");
|
FURI_LOG_E(TAG, "Unable to add Duration_Counter");
|
||||||
|
@ -49,15 +49,13 @@ uint8_t subghz_protocol_decoder_somfy_keytis_get_hash_data(void* context);
|
|||||||
* Serialize data SubGhzProtocolDecoderSomfyKeytis.
|
* Serialize data SubGhzProtocolDecoderSomfyKeytis.
|
||||||
* @param context Pointer to a SubGhzProtocolDecoderSomfyKeytis instance
|
* @param context Pointer to a SubGhzProtocolDecoderSomfyKeytis instance
|
||||||
* @param flipper_format Pointer to a FlipperFormat instance
|
* @param flipper_format Pointer to a FlipperFormat instance
|
||||||
* @param frequency The frequency at which the signal was received, Hz
|
* @param preset The modulation on which the signal was received, SubGhzPesetDefinition
|
||||||
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_decoder_somfy_keytis_serialize(
|
bool subghz_protocol_decoder_somfy_keytis_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize data SubGhzProtocolDecoderSomfyKeytis.
|
* Deserialize data SubGhzProtocolDecoderSomfyKeytis.
|
||||||
|
@ -339,11 +339,10 @@ uint8_t subghz_protocol_decoder_somfy_telis_get_hash_data(void* context) {
|
|||||||
bool subghz_protocol_decoder_somfy_telis_serialize(
|
bool subghz_protocol_decoder_somfy_telis_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhzProtocolDecoderSomfyTelis* instance = context;
|
SubGhzProtocolDecoderSomfyTelis* instance = context;
|
||||||
return subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
return subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool subghz_protocol_decoder_somfy_telis_deserialize(void* context, FlipperFormat* flipper_format) {
|
bool subghz_protocol_decoder_somfy_telis_deserialize(void* context, FlipperFormat* flipper_format) {
|
||||||
|
@ -49,15 +49,13 @@ uint8_t subghz_protocol_decoder_somfy_telis_get_hash_data(void* context);
|
|||||||
* Serialize data SubGhzProtocolDecoderSomfyTelis.
|
* Serialize data SubGhzProtocolDecoderSomfyTelis.
|
||||||
* @param context Pointer to a SubGhzProtocolDecoderSomfyTelis instance
|
* @param context Pointer to a SubGhzProtocolDecoderSomfyTelis instance
|
||||||
* @param flipper_format Pointer to a FlipperFormat instance
|
* @param flipper_format Pointer to a FlipperFormat instance
|
||||||
* @param frequency The frequency at which the signal was received, Hz
|
* @param preset The modulation on which the signal was received, SubGhzPesetDefinition
|
||||||
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_decoder_somfy_telis_serialize(
|
bool subghz_protocol_decoder_somfy_telis_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize data SubGhzProtocolDecoderSomfyTelis.
|
* Deserialize data SubGhzProtocolDecoderSomfyTelis.
|
||||||
|
@ -320,14 +320,12 @@ uint8_t subghz_protocol_decoder_star_line_get_hash_data(void* context) {
|
|||||||
bool subghz_protocol_decoder_star_line_serialize(
|
bool subghz_protocol_decoder_star_line_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset) {
|
||||||
FuriHalSubGhzPreset preset) {
|
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhzProtocolDecoderStarLine* instance = context;
|
SubGhzProtocolDecoderStarLine* instance = context;
|
||||||
subghz_protocol_star_line_check_remote_controller(
|
subghz_protocol_star_line_check_remote_controller(
|
||||||
&instance->generic, instance->keystore, &instance->manufacture_name);
|
&instance->generic, instance->keystore, &instance->manufacture_name);
|
||||||
bool res =
|
bool res = subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||||
subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
|
||||||
|
|
||||||
if(res && !flipper_format_write_string_cstr(
|
if(res && !flipper_format_write_string_cstr(
|
||||||
flipper_format, "Manufacture", instance->manufacture_name)) {
|
flipper_format, "Manufacture", instance->manufacture_name)) {
|
||||||
|
@ -49,15 +49,13 @@ uint8_t subghz_protocol_decoder_star_line_get_hash_data(void* context);
|
|||||||
* Serialize data SubGhzProtocolDecoderStarLine.
|
* Serialize data SubGhzProtocolDecoderStarLine.
|
||||||
* @param context Pointer to a SubGhzProtocolDecoderStarLine instance
|
* @param context Pointer to a SubGhzProtocolDecoderStarLine instance
|
||||||
* @param flipper_format Pointer to a FlipperFormat instance
|
* @param flipper_format Pointer to a FlipperFormat instance
|
||||||
* @param frequency The frequency at which the signal was received, Hz
|
* @param preset The modulation on which the signal was received, SubGhzPesetDefinition
|
||||||
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
|
|
||||||
* @return true On success
|
* @return true On success
|
||||||
*/
|
*/
|
||||||
bool subghz_protocol_decoder_star_line_serialize(
|
bool subghz_protocol_decoder_star_line_serialize(
|
||||||
void* context,
|
void* context,
|
||||||
FlipperFormat* flipper_format,
|
FlipperFormat* flipper_format,
|
||||||
uint32_t frequency,
|
SubGhzPesetDefinition* preset);
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize data SubGhzProtocolDecoderStarLine.
|
* Deserialize data SubGhzProtocolDecoderStarLine.
|
||||||
|
@ -57,7 +57,6 @@ static int32_t subghz_worker_thread_callback(void* context) {
|
|||||||
if(ret == sizeof(LevelDuration)) {
|
if(ret == sizeof(LevelDuration)) {
|
||||||
if(level_duration_is_reset(level_duration)) {
|
if(level_duration_is_reset(level_duration)) {
|
||||||
FURI_LOG_E(TAG, "Overrun buffer");
|
FURI_LOG_E(TAG, "Overrun buffer");
|
||||||
;
|
|
||||||
if(instance->overrun_callback) instance->overrun_callback(instance->context);
|
if(instance->overrun_callback) instance->overrun_callback(instance->context);
|
||||||
} else {
|
} else {
|
||||||
bool level = level_duration_get_level(level_duration);
|
bool level = level_duration_get_level(level_duration);
|
||||||
@ -98,11 +97,11 @@ SubGhzWorker* subghz_worker_alloc() {
|
|||||||
furi_thread_set_context(instance->thread, instance);
|
furi_thread_set_context(instance->thread, instance);
|
||||||
furi_thread_set_callback(instance->thread, subghz_worker_thread_callback);
|
furi_thread_set_callback(instance->thread, subghz_worker_thread_callback);
|
||||||
|
|
||||||
instance->stream = xStreamBufferCreate(sizeof(LevelDuration) * 2048, sizeof(LevelDuration));
|
instance->stream = xStreamBufferCreate(sizeof(LevelDuration) * 4096, sizeof(LevelDuration));
|
||||||
|
|
||||||
//setting filter
|
//setting filter
|
||||||
instance->filter_running = true;
|
instance->filter_running = true;
|
||||||
instance->filter_duration = 20;
|
instance->filter_duration = 30;
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "environment.h"
|
#include "environment.h"
|
||||||
#include <furi.h>
|
#include <furi.h>
|
||||||
#include <furi_hal.h>
|
#include <furi_hal.h>
|
||||||
|
#include <subghz/helpers/subghz_types.h>
|
||||||
|
|
||||||
#define SUBGHZ_APP_FOLDER ANY_PATH("subghz")
|
#define SUBGHZ_APP_FOLDER ANY_PATH("subghz")
|
||||||
#define SUBGHZ_RAW_FOLDER EXT_PATH("subghz")
|
#define SUBGHZ_RAW_FOLDER EXT_PATH("subghz")
|
||||||
@ -30,11 +31,8 @@ typedef void* (*SubGhzAlloc)(SubGhzEnvironment* environment);
|
|||||||
typedef void (*SubGhzFree)(void* context);
|
typedef void (*SubGhzFree)(void* context);
|
||||||
|
|
||||||
// Serialize and Deserialize
|
// Serialize and Deserialize
|
||||||
typedef bool (*SubGhzSerialize)(
|
typedef bool (
|
||||||
void* context,
|
*SubGhzSerialize)(void* context, FlipperFormat* flipper_format, SubGhzPesetDefinition* preset);
|
||||||
FlipperFormat* flipper_format,
|
|
||||||
uint32_t frequency,
|
|
||||||
FuriHalSubGhzPreset preset);
|
|
||||||
typedef bool (*SubGhzDeserialize)(void* context, FlipperFormat* flipper_format);
|
typedef bool (*SubGhzDeserialize)(void* context, FlipperFormat* flipper_format);
|
||||||
|
|
||||||
// Decoder specific
|
// Decoder specific
|
||||||
|
Loading…
Reference in New Issue
Block a user