SubGhz: rename SubGhzPresetDefinition into SubGhzRadioPreset, cleanup subghz types.

This commit is contained in:
MX
2022-10-19 18:52:21 +03:00
parent 3807d61034
commit a3c6d8bb4a
94 changed files with 213 additions and 222 deletions

View File

@@ -295,7 +295,7 @@ uint8_t ws_protocol_decoder_gt_wt_03_get_hash_data(void* context) {
bool ws_protocol_decoder_gt_wt_03_serialize(
void* context,
FlipperFormat* flipper_format,
SubGhzPresetDefinition* preset) {
SubGhzRadioPreset* preset) {
furi_assert(context);
WSProtocolDecoderGT_WT03* instance = context;
return ws_block_generic_serialize(&instance->generic, flipper_format, preset);

View File

@@ -55,13 +55,13 @@ uint8_t ws_protocol_decoder_gt_wt_03_get_hash_data(void* context);
* Serialize data WSProtocolDecoderGT_WT03.
* @param context Pointer to a WSProtocolDecoderGT_WT03 instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param preset The modulation on which the signal was received, SubGhzPresetDefinition
* @param preset The modulation on which the signal was received, SubGhzRadioPreset
* @return true On success
*/
bool ws_protocol_decoder_gt_wt_03_serialize(
void* context,
FlipperFormat* flipper_format,
SubGhzPresetDefinition* preset);
SubGhzRadioPreset* preset);
/**
* Deserialize data WSProtocolDecoderGT_WT03.

View File

@@ -250,7 +250,7 @@ uint8_t ws_protocol_decoder_infactory_get_hash_data(void* context) {
bool ws_protocol_decoder_infactory_serialize(
void* context,
FlipperFormat* flipper_format,
SubGhzPresetDefinition* preset) {
SubGhzRadioPreset* preset) {
furi_assert(context);
WSProtocolDecoderInfactory* instance = context;
return ws_block_generic_serialize(&instance->generic, flipper_format, preset);

View File

@@ -55,13 +55,13 @@ uint8_t ws_protocol_decoder_infactory_get_hash_data(void* context);
* Serialize data WSProtocolDecoderInfactory.
* @param context Pointer to a WSProtocolDecoderInfactory instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param preset The modulation on which the signal was received, SubGhzPresetDefinition
* @param preset The modulation on which the signal was received, SubGhzRadioPreset
* @return true On success
*/
bool ws_protocol_decoder_infactory_serialize(
void* context,
FlipperFormat* flipper_format,
SubGhzPresetDefinition* preset);
SubGhzRadioPreset* preset);
/**
* Deserialize data WSProtocolDecoderInfactory.

View File

@@ -215,7 +215,7 @@ uint8_t ws_protocol_decoder_nexus_th_get_hash_data(void* context) {
bool ws_protocol_decoder_nexus_th_serialize(
void* context,
FlipperFormat* flipper_format,
SubGhzPresetDefinition* preset) {
SubGhzRadioPreset* preset) {
furi_assert(context);
WSProtocolDecoderNexus_TH* instance = context;
return ws_block_generic_serialize(&instance->generic, flipper_format, preset);

View File

@@ -55,13 +55,13 @@ uint8_t ws_protocol_decoder_nexus_th_get_hash_data(void* context);
* Serialize data WSProtocolDecoderNexus_TH.
* @param context Pointer to a WSProtocolDecoderNexus_TH instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param preset The modulation on which the signal was received, SubGhzPresetDefinition
* @param preset The modulation on which the signal was received, SubGhzRadioPreset
* @return true On success
*/
bool ws_protocol_decoder_nexus_th_serialize(
void* context,
FlipperFormat* flipper_format,
SubGhzPresetDefinition* preset);
SubGhzRadioPreset* preset);
/**
* Deserialize data WSProtocolDecoderNexus_TH.

View File

@@ -214,7 +214,7 @@ uint8_t ws_protocol_decoder_thermopro_tx4_get_hash_data(void* context) {
bool ws_protocol_decoder_thermopro_tx4_serialize(
void* context,
FlipperFormat* flipper_format,
SubGhzPresetDefinition* preset) {
SubGhzRadioPreset* preset) {
furi_assert(context);
WSProtocolDecoderThermoPRO_TX4* instance = context;
return ws_block_generic_serialize(&instance->generic, flipper_format, preset);

View File

@@ -55,13 +55,13 @@ uint8_t ws_protocol_decoder_thermopro_tx4_get_hash_data(void* context);
* Serialize data WSProtocolDecoderThermoPRO_TX4.
* @param context Pointer to a WSProtocolDecoderThermoPRO_TX4 instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param preset The modulation on which the signal was received, SubGhzPresetDefinition
* @param preset The modulation on which the signal was received, SubGhzRadioPreset
* @return true On success
*/
bool ws_protocol_decoder_thermopro_tx4_serialize(
void* context,
FlipperFormat* flipper_format,
SubGhzPresetDefinition* preset);
SubGhzRadioPreset* preset);
/**
* Deserialize data WSProtocolDecoderThermoPRO_TX4.

View File

@@ -24,7 +24,7 @@ void ws_block_generic_get_preset_name(const char* preset_name, FuriString* prese
bool ws_block_generic_serialize(
WSBlockGeneric* instance,
FlipperFormat* flipper_format,
SubGhzPresetDefinition* preset) {
SubGhzRadioPreset* preset) {
furi_assert(instance);
bool res = false;
FuriString* temp_str;

View File

@@ -38,13 +38,13 @@ void ws_block_generic_get_preset_name(const char* preset_name, FuriString* prese
* Serialize data WSBlockGeneric.
* @param instance Pointer to a WSBlockGeneric instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param preset The modulation on which the signal was received, SubGhzPresetDefinition
* @param preset The modulation on which the signal was received, SubGhzRadioPreset
* @return true On success
*/
bool ws_block_generic_serialize(
WSBlockGeneric* instance,
FlipperFormat* flipper_format,
SubGhzPresetDefinition* preset);
SubGhzRadioPreset* preset);
/**
* Deserialize data WSBlockGeneric.

View File

@@ -86,7 +86,7 @@ WeatherStationApp* weather_station_app_alloc() {
//init Worker & Protocol & History
app->lock = WSLockOff;
app->txrx = malloc(sizeof(WeatherStationTxRx));
app->txrx->preset = malloc(sizeof(SubGhzPresetDefinition));
app->txrx->preset = malloc(sizeof(SubGhzRadioPreset));
app->txrx->preset->name = furi_string_alloc();
ws_preset_init(app, "AM650", subghz_setting_get_default_frequency(app->setting), NULL, 0);

View File

@@ -27,7 +27,7 @@ struct WeatherStationTxRx {
SubGhzEnvironment* environment;
SubGhzReceiver* receiver;
SubGhzPresetDefinition* preset;
SubGhzRadioPreset* preset;
WSHistory* history;
uint16_t idx_menu_chosen;
WSTxRxState txrx_state;

View File

@@ -4,7 +4,6 @@
#include <lib/subghz/receiver.h>
#include <furi.h>
#include <m-string.h>
#define WS_HISTORY_MAX 50
#define TAG "WSHistory"
@@ -14,7 +13,7 @@ typedef struct {
FlipperFormat* flipper_string;
uint8_t type;
uint32_t id;
SubGhzPresetDefinition* preset;
SubGhzRadioPreset* preset;
} WSHistoryItem;
ARRAY_DEF(WSHistoryItemArray, WSHistoryItem, M_POD_OPLIST)
@@ -63,7 +62,7 @@ uint32_t ws_history_get_frequency(WSHistory* instance, uint16_t idx) {
return item->preset->frequency;
}
SubGhzPresetDefinition* ws_history_get_preset_def(WSHistory* instance, uint16_t idx) {
SubGhzRadioPreset* ws_history_get_radio_preset(WSHistory* instance, uint16_t idx) {
furi_assert(instance);
WSHistoryItem* item = WSHistoryItemArray_get(instance->history->data, idx);
return item->preset;
@@ -139,7 +138,7 @@ void ws_history_get_text_item_menu(WSHistory* instance, FuriString* output, uint
}
WSHistoryStateAddKey
ws_history_add_to_history(WSHistory* instance, void* context, SubGhzPresetDefinition* preset) {
ws_history_add_to_history(WSHistory* instance, void* context, SubGhzRadioPreset* preset) {
furi_assert(instance);
furi_assert(context);
@@ -188,7 +187,7 @@ WSHistoryStateAddKey
// or add new record
if(!sensor_found) {
WSHistoryItem* item = WSHistoryItemArray_push_raw(instance->history->data);
item->preset = malloc(sizeof(SubGhzPresetDefinition));
item->preset = malloc(sizeof(SubGhzRadioPreset));
item->type = decoder_base->protocol->type;
item->preset->frequency = preset->frequency;
item->preset->name = furi_string_alloc();

View File

@@ -44,7 +44,7 @@ void ws_history_reset(WSHistory* instance);
*/
uint32_t ws_history_get_frequency(WSHistory* instance, uint16_t idx);
SubGhzPresetDefinition* ws_history_get_preset_def(WSHistory* instance, uint16_t idx);
SubGhzRadioPreset* ws_history_get_radio_preset(WSHistory* instance, uint16_t idx);
/** Get preset to history[idx]
*
@@ -97,11 +97,11 @@ bool ws_history_get_text_space_left(WSHistory* instance, FuriString* output);
*
* @param instance - WSHistory instance
* @param context - SubGhzProtocolCommon context
* @param preset - SubGhzPresetDefinition preset
* @param preset - SubGhzRadioPreset preset
* @return WSHistoryStateAddKey;
*/
WSHistoryStateAddKey
ws_history_add_to_history(WSHistory* instance, void* context, SubGhzPresetDefinition* preset);
ws_history_add_to_history(WSHistory* instance, void* context, SubGhzRadioPreset* preset);
/** Get SubGhzProtocolCommonLoad to load into the protocol decoder bin data
*