SubGhz: refactoring

This commit is contained in:
gid9798 2023-05-09 21:20:35 +03:00
parent 42a415e449
commit def4ae395e
12 changed files with 573 additions and 558 deletions

View File

@ -1,34 +1,9 @@
#include "subghz_txrx_i.h"
#include "subghz_txrx.h"
#include <lib/subghz/protocols/protocol_items.h>
#define TAG "SubGhz"
struct SubGhzTxRx {
SubGhzWorker* worker;
SubGhzEnvironment* environment;
SubGhzReceiver* receiver;
SubGhzTransmitter* transmitter;
SubGhzProtocolDecoderBase* decoder_result;
FlipperFormat* fff_data;
SubGhzRadioPreset* preset;
SubGhzSetting* setting;
uint8_t hopper_timeout;
uint8_t hopper_idx_frequency;
bool load_database;
SubGhzHopperState hopper_state;
SubGhzTxRxState txrx_state;
SubGhzSpeakerState speaker_state;
SubGhzTxRxNeedSaveCallback need_save_callback;
void* need_save_context;
bool debug_pin_state;
};
SubGhzTxRx* subghz_txrx_alloc() {
SubGhzTxRx* instance = malloc(sizeof(SubGhzTxRx));
instance->setting = subghz_setting_alloc();
@ -98,9 +73,10 @@ void subghz_txrx_set_preset(
size_t preset_data_size) {
furi_assert(instance);
furi_string_set(instance->preset->name, preset_name);
instance->preset->frequency = frequency;
instance->preset->data = preset_data;
instance->preset->data_size = preset_data_size;
SubGhzRadioPreset* preset = instance->preset;
preset->frequency = frequency;
preset->data = preset_data;
preset->data_size = preset_data_size;
}
const char* subghz_txrx_get_name_preset(SubGhzTxRx* instance, const char* preset) {
@ -133,18 +109,19 @@ void subghz_txrx_get_frequency_modulation(
FuriString* modulation,
bool long_name) {
furi_assert(instance);
SubGhzRadioPreset* preset = instance->preset;
if(frequency != NULL) {
furi_string_printf(
frequency,
"%03ld.%02ld",
instance->preset->frequency / 1000000 % 1000,
instance->preset->frequency / 10000 % 100);
preset->frequency / 1000000 % 1000,
preset->frequency / 10000 % 100);
}
if(modulation != NULL) {
if(long_name) {
furi_string_printf(modulation, "%s", furi_string_get_cstr(instance->preset->name));
furi_string_printf(modulation, "%s", furi_string_get_cstr(preset->name));
} else {
furi_string_printf(modulation, "%.2s", furi_string_get_cstr(instance->preset->name));
furi_string_printf(modulation, "%.2s", furi_string_get_cstr(preset->name));
}
}
}
@ -247,20 +224,22 @@ SubGhzTxRxStartTxState subghz_txrx_tx_start(SubGhzTxRx* instance, FlipperFormat*
FURI_LOG_E(TAG, "Unable Repeat");
break;
}
ret = SubGhzTxRxStartTxStateOk;
SubGhzRadioPreset* preset = instance->preset;
instance->transmitter =
subghz_transmitter_alloc_init(instance->environment, furi_string_get_cstr(temp_str));
if(instance->transmitter) {
if(subghz_transmitter_deserialize(instance->transmitter, flipper_format) ==
SubGhzProtocolStatusOk) {
if(strcmp(furi_string_get_cstr(instance->preset->name), "") != 0) {
if(strcmp(furi_string_get_cstr(preset->name), "") != 0) {
subghz_txrx_begin(
instance,
subghz_setting_get_preset_data_by_name(
instance->setting, furi_string_get_cstr(instance->preset->name)));
if(instance->preset->frequency) {
if(!subghz_txrx_tx(instance, instance->preset->frequency)) {
instance->setting, furi_string_get_cstr(preset->name)));
if(preset->frequency) {
if(!subghz_txrx_tx(instance, preset->frequency)) {
FURI_LOG_E(TAG, "Only Rx");
ret = SubGhzTxRxStartTxStateErrorOnlyRx;
}
@ -269,9 +248,7 @@ SubGhzTxRxStartTxState subghz_txrx_tx_start(SubGhzTxRx* instance, FlipperFormat*
}
} else {
FURI_LOG_E(
TAG,
"Unknown name preset \" %s \"",
furi_string_get_cstr(instance->preset->name));
TAG, "Unknown name preset \" %s \"", furi_string_get_cstr(preset->name));
ret = SubGhzTxRxStartTxStateErrorParserOthers;
}
if(ret == SubGhzTxRxStartTxStateOk) {
@ -533,17 +510,15 @@ bool subghz_txrx_protocol_is_preserved(SubGhzTxRx* instance) {
bool subghz_txrx_protocol_is_send(SubGhzTxRx* instance, bool check_type) {
furi_assert(instance);
const SubGhzProtocol* protocol = instance->decoder_result->protocol;
if(check_type) {
return (
((instance->decoder_result->protocol->flag & SubGhzProtocolFlag_Send) ==
SubGhzProtocolFlag_Send) &&
instance->decoder_result->protocol->encoder->deserialize &&
instance->decoder_result->protocol->type == SubGhzProtocolTypeStatic);
((protocol->flag & SubGhzProtocolFlag_Send) == SubGhzProtocolFlag_Send) &&
protocol->encoder->deserialize && protocol->type == SubGhzProtocolTypeStatic);
}
return (
((instance->decoder_result->protocol->flag & SubGhzProtocolFlag_Send) ==
SubGhzProtocolFlag_Send) &&
instance->decoder_result->protocol->encoder->deserialize);
((protocol->flag & SubGhzProtocolFlag_Send) == SubGhzProtocolFlag_Send) &&
protocol->encoder->deserialize);
}
void subghz_txrx_receiver_set_filter(SubGhzTxRx* instance, SubGhzProtocolFlag filter) {
@ -581,345 +556,4 @@ bool subghz_txrx_get_debug_pin_state(SubGhzTxRx* instance) {
SubGhzReceiver* subghz_txrx_get_receiver(SubGhzTxRx* instance) {
furi_assert(instance);
return instance->receiver;
}
//#############Create new Key##############
#include <lib/subghz/protocols/protocol_items.h>
#include <lib/subghz/protocols/keeloq.h>
#include <lib/subghz/protocols/secplus_v1.h>
#include <lib/subghz/protocols/secplus_v2.h>
#include <lib/subghz/protocols/nice_flor_s.h>
#include <flipper_format/flipper_format_i.h>
#include <lib/toolbox/stream/stream.h>
#include <lib/subghz/protocols/raw.h>
bool subghz_txrx_gen_data_protocol(
void* context,
const char* preset_name,
uint32_t frequency,
const char* protocol_name,
uint64_t key,
uint32_t bit) {
furi_assert(context);
SubGhzTxRx* instance = context;
bool res = false;
subghz_txrx_set_preset(instance, preset_name, frequency, NULL, 0);
instance->decoder_result =
subghz_receiver_search_decoder_base_by_name(instance->receiver, protocol_name);
if(instance->decoder_result == NULL) {
//TODO: Error
// furi_string_set(error_str, "Protocol not\nfound!");
// scene_manager_next_scene(scene_manager, SubGhzSceneShowErrorSub);
return false;
}
do {
Stream* fff_data_stream = flipper_format_get_raw_stream(instance->fff_data);
stream_clean(fff_data_stream);
if(subghz_protocol_decoder_base_serialize(
instance->decoder_result, instance->fff_data, instance->preset) !=
SubGhzProtocolStatusOk) {
FURI_LOG_E(TAG, "Unable to serialize");
break;
}
if(!flipper_format_update_uint32(instance->fff_data, "Bit", &bit, 1)) {
FURI_LOG_E(TAG, "Unable to update Bit");
break;
}
uint8_t key_data[sizeof(uint64_t)] = {0};
for(size_t i = 0; i < sizeof(uint64_t); i++) {
key_data[sizeof(uint64_t) - i - 1] = (key >> (i * 8)) & 0xFF;
}
if(!flipper_format_update_hex(instance->fff_data, "Key", key_data, sizeof(uint64_t))) {
FURI_LOG_E(TAG, "Unable to update Key");
break;
}
res = true;
} while(false);
return res;
}
bool subghz_txrx_gen_data_protocol_and_te(
SubGhzTxRx* instance,
const char* preset_name,
uint32_t frequency,
const char* protocol_name,
uint64_t key,
uint32_t bit,
uint32_t te) {
furi_assert(instance);
bool ret = false;
if(subghz_txrx_gen_data_protocol(instance, preset_name, frequency, protocol_name, key, bit)) {
if(!flipper_format_update_uint32(instance->fff_data, "TE", (uint32_t*)&te, 1)) {
FURI_LOG_E(TAG, "Unable to update Te");
} else {
ret = true;
}
}
return ret;
}
bool subghz_scene_set_type_submenu_gen_data_keeloq( //TODO rename
SubGhzTxRx* txrx,
const char* preset_name,
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint16_t cnt,
const char* manufacture_name) {
furi_assert(txrx);
bool res = false;
txrx->transmitter =
subghz_transmitter_alloc_init(txrx->environment, SUBGHZ_PROTOCOL_KEELOQ_NAME);
subghz_txrx_set_preset(txrx, preset_name, frequency, NULL, 0);
if(txrx->transmitter && subghz_protocol_keeloq_create_data(
subghz_transmitter_get_protocol_instance(txrx->transmitter),
txrx->fff_data,
serial,
btn,
cnt,
manufacture_name,
txrx->preset)) {
flipper_format_write_string_cstr(txrx->fff_data, "Manufacture", manufacture_name);
res = true;
}
subghz_transmitter_free(txrx->transmitter);
return res;
}
bool subghz_scene_set_type_submenu_gen_data_keeloq_bft( //TODO rename
void* context,
const char* preset_name,
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint16_t cnt,
uint32_t seed,
const char* manufacture_name) {
SubGhzTxRx* txrx = context;
bool res = false;
txrx->transmitter =
subghz_transmitter_alloc_init(txrx->environment, SUBGHZ_PROTOCOL_KEELOQ_NAME);
subghz_txrx_set_preset(txrx, preset_name, frequency, NULL, 0);
if(txrx->transmitter && subghz_protocol_keeloq_bft_create_data(
subghz_transmitter_get_protocol_instance(txrx->transmitter),
txrx->fff_data,
serial,
btn,
cnt,
seed,
manufacture_name,
txrx->preset)) {
res = true;
}
if(res) {
uint8_t seed_data[sizeof(uint32_t)] = {0};
for(size_t i = 0; i < sizeof(uint32_t); i++) {
seed_data[sizeof(uint32_t) - i - 1] = (seed >> i * 8) & 0xFF;
}
flipper_format_write_hex(txrx->fff_data, "Seed", seed_data, sizeof(uint32_t));
flipper_format_write_string_cstr(txrx->fff_data, "Manufacture", "BFT");
}
subghz_transmitter_free(txrx->transmitter);
return res;
}
bool subghz_scene_set_type_submenu_gen_data_nice_flor( //TODO rename
void* context,
const char* preset_name,
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint16_t cnt,
bool nice_one) {
SubGhzTxRx* txrx = context;
bool res = false;
txrx->transmitter =
subghz_transmitter_alloc_init(txrx->environment, SUBGHZ_PROTOCOL_NICE_FLOR_S_NAME);
subghz_txrx_set_preset(txrx, preset_name, frequency, NULL, 0);
if(txrx->transmitter && subghz_protocol_nice_flor_s_create_data(
subghz_transmitter_get_protocol_instance(txrx->transmitter),
txrx->fff_data,
serial,
btn,
cnt,
txrx->preset,
nice_one)) {
res = true;
}
subghz_transmitter_free(txrx->transmitter);
return res;
}
bool subghz_scene_set_type_submenu_gen_data_faac_slh( //TODO rename
void* context,
const char* preset_name,
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint16_t cnt,
uint32_t seed,
const char* manufacture_name) {
SubGhzTxRx* txrx = context;
bool res = false;
txrx->transmitter =
subghz_transmitter_alloc_init(txrx->environment, SUBGHZ_PROTOCOL_FAAC_SLH_NAME);
subghz_txrx_set_preset(txrx, preset_name, frequency, NULL, 0);
if(txrx->transmitter && subghz_protocol_faac_slh_create_data(
subghz_transmitter_get_protocol_instance(txrx->transmitter),
txrx->fff_data,
serial,
btn,
cnt,
seed,
manufacture_name,
txrx->preset)) {
res = true;
}
if(res) {
uint8_t seed_data[sizeof(uint32_t)] = {0};
for(size_t i = 0; i < sizeof(uint32_t); i++) {
seed_data[sizeof(uint32_t) - i - 1] = (seed >> i * 8) & 0xFF;
}
flipper_format_write_hex(txrx->fff_data, "Seed", seed_data, sizeof(uint32_t));
}
subghz_transmitter_free(txrx->transmitter);
return res;
}
bool subghz_scene_set_type_submenu_gen_data_alutech_at_4n( //TODO rename
void* context,
const char* preset_name,
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint16_t cnt) {
SubGhzTxRx* txrx = context;
bool res = false;
txrx->transmitter =
subghz_transmitter_alloc_init(txrx->environment, SUBGHZ_PROTOCOL_ALUTECH_AT_4N_NAME);
subghz_txrx_set_preset(txrx, preset_name, frequency, NULL, 0);
if(txrx->transmitter && subghz_protocol_alutech_at_4n_create_data(
subghz_transmitter_get_protocol_instance(txrx->transmitter),
txrx->fff_data,
serial,
btn,
cnt,
txrx->preset)) {
res = true;
}
subghz_transmitter_free(txrx->transmitter);
return res;
}
bool subghz_scene_set_type_submenu_gen_data_somfy_telis( //TODO rename
void* context,
const char* preset_name,
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint16_t cnt) {
SubGhzTxRx* txrx = context;
bool res = false;
txrx->transmitter =
subghz_transmitter_alloc_init(txrx->environment, SUBGHZ_PROTOCOL_SOMFY_TELIS_NAME);
subghz_txrx_set_preset(txrx, preset_name, frequency, NULL, 0);
if(txrx->transmitter && subghz_protocol_somfy_telis_create_data(
subghz_transmitter_get_protocol_instance(txrx->transmitter),
txrx->fff_data,
serial,
btn,
cnt,
txrx->preset)) {
res = true;
}
subghz_transmitter_free(txrx->transmitter);
return res;
}
bool subghz_txrx_gen_secplus_v2_protocol(
SubGhzTxRx* txrx,
const char* name_preset,
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint32_t cnt) {
furi_assert(txrx);
bool ret = false;
txrx->transmitter =
subghz_transmitter_alloc_init(txrx->environment, SUBGHZ_PROTOCOL_SECPLUS_V2_NAME);
subghz_txrx_set_preset(txrx, name_preset, frequency, NULL, 0);
if(txrx->transmitter) {
subghz_protocol_secplus_v2_create_data(
subghz_transmitter_get_protocol_instance(txrx->transmitter),
txrx->fff_data,
serial,
btn,
cnt,
txrx->preset);
ret = true;
}
return ret;
}
bool subghz_txrx_gen_secplus_v1_protocol(
SubGhzTxRx* txrx,
const char* name_preset,
uint32_t frequency) {
furi_assert(txrx);
bool ret = false;
uint32_t serial = (uint32_t)rand();
while(!subghz_protocol_secplus_v1_check_fixed(serial)) {
serial = (uint32_t)rand();
}
if(subghz_txrx_gen_data_protocol(
txrx,
name_preset,
frequency,
SUBGHZ_PROTOCOL_SECPLUS_V1_NAME,
(uint64_t)serial << 32 | 0xE6000000,
42)) {
ret = true;
}
return ret;
}

View File

@ -1,5 +1,6 @@
#pragma once
#include "subghz_types.h"
#include "subghz_txrx_callbacks.h"
#include <lib/subghz/subghz_worker.h>
#include <lib/subghz/subghz_setting.h>
#include <lib/subghz/receiver.h>
@ -80,88 +81,3 @@ void subghz_txrx_set_debug_pin_state(SubGhzTxRx* instance, bool state);
bool subghz_txrx_get_debug_pin_state(SubGhzTxRx* instance);
SubGhzReceiver* subghz_txrx_get_receiver(SubGhzTxRx* instance); // TODO use only in DecodeRaw
//#############Create new Key##############
bool subghz_txrx_gen_data_protocol(
void* context,
const char* preset_name,
uint32_t frequency,
const char* protocol_name,
uint64_t key,
uint32_t bit);
bool subghz_txrx_gen_data_protocol_and_te(
SubGhzTxRx* instance,
const char* preset_name,
uint32_t frequency,
const char* protocol_name,
uint64_t key,
uint32_t bit,
uint32_t te);
bool subghz_scene_set_type_submenu_gen_data_keeloq(
SubGhzTxRx* txrx,
const char* preset_name,
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint16_t cnt,
const char* manufacture_name);
bool subghz_scene_set_type_submenu_gen_data_keeloq_bft( //TODO rename
void* context,
const char* preset_name,
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint16_t cnt,
uint32_t seed,
const char* manufacture_name);
bool subghz_scene_set_type_submenu_gen_data_nice_flor( //TODO rename
void* context,
const char* preset_name,
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint16_t cnt,
bool nice_one);
bool subghz_scene_set_type_submenu_gen_data_faac_slh( //TODO rename
void* context,
const char* preset_name,
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint16_t cnt,
uint32_t seed,
const char* manufacture_name);
bool subghz_scene_set_type_submenu_gen_data_alutech_at_4n( //TODO rename
void* context,
const char* preset_name,
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint16_t cnt);
bool subghz_scene_set_type_submenu_gen_data_somfy_telis( //TODO rename
void* context,
const char* preset_name,
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint16_t cnt);
bool subghz_txrx_gen_secplus_v2_protocol(
SubGhzTxRx* txrx,
const char* name_preset,
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint32_t cnt);
bool subghz_txrx_gen_secplus_v1_protocol(
SubGhzTxRx* txrx,
const char* name_preset,
uint32_t frequency);

View File

@ -0,0 +1,2 @@
#pragma once
typedef void (*SubGhzTxRxNeedSaveCallback)(void* context);

View File

@ -0,0 +1,346 @@
#include "subghz_txrx_i.h"
#include "subghz_txrx_create_potocol_key.h"
#include <lib/subghz/transmitter.h>
#include <lib/subghz/protocols/protocol_items.h>
#include <lib/subghz/protocols/keeloq.h>
#include <lib/subghz/protocols/secplus_v1.h>
#include <lib/subghz/protocols/secplus_v2.h>
#include <lib/subghz/protocols/nice_flor_s.h>
#include <flipper_format/flipper_format_i.h>
#include <lib/toolbox/stream/stream.h>
#include <lib/subghz/protocols/raw.h>
#define TAG "SubGhzCreateProtocolKey"
bool subghz_txrx_gen_data_protocol(
void* context,
const char* preset_name,
uint32_t frequency,
const char* protocol_name,
uint64_t key,
uint32_t bit) {
furi_assert(context);
SubGhzTxRx* instance = context;
bool res = false;
subghz_txrx_set_preset(instance, preset_name, frequency, NULL, 0);
instance->decoder_result =
subghz_receiver_search_decoder_base_by_name(instance->receiver, protocol_name);
if(instance->decoder_result == NULL) {
//TODO: Error
// furi_string_set(error_str, "Protocol not\nfound!");
// scene_manager_next_scene(scene_manager, SubGhzSceneShowErrorSub);
FURI_LOG_E(TAG, "Protocol not found!");
return false;
}
do {
Stream* fff_data_stream = flipper_format_get_raw_stream(instance->fff_data);
stream_clean(fff_data_stream);
if(subghz_protocol_decoder_base_serialize(
instance->decoder_result, instance->fff_data, instance->preset) !=
SubGhzProtocolStatusOk) {
FURI_LOG_E(TAG, "Unable to serialize");
break;
}
if(!flipper_format_update_uint32(instance->fff_data, "Bit", &bit, 1)) {
FURI_LOG_E(TAG, "Unable to update Bit");
break;
}
uint8_t key_data[sizeof(uint64_t)] = {0};
for(size_t i = 0; i < sizeof(uint64_t); i++) {
key_data[sizeof(uint64_t) - i - 1] = (key >> (i * 8)) & 0xFF;
}
if(!flipper_format_update_hex(instance->fff_data, "Key", key_data, sizeof(uint64_t))) {
FURI_LOG_E(TAG, "Unable to update Key");
break;
}
res = true;
} while(false);
return res;
}
bool subghz_txrx_gen_data_protocol_and_te(
SubGhzTxRx* instance,
const char* preset_name,
uint32_t frequency,
const char* protocol_name,
uint64_t key,
uint32_t bit,
uint32_t te) {
furi_assert(instance);
bool ret = false;
if(subghz_txrx_gen_data_protocol(instance, preset_name, frequency, protocol_name, key, bit)) {
if(!flipper_format_update_uint32(instance->fff_data, "TE", (uint32_t*)&te, 1)) {
FURI_LOG_E(TAG, "Unable to update Te");
} else {
ret = true;
}
}
return ret;
}
bool subghz_txrx_gen_keelog_protocol( //TODO lead to a general appearance
SubGhzTxRx* instance,
const char* preset_name,
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint16_t cnt,
const char* manufacture_name) {
furi_assert(instance);
bool res = false;
instance->transmitter =
subghz_transmitter_alloc_init(instance->environment, SUBGHZ_PROTOCOL_KEELOQ_NAME);
subghz_txrx_set_preset(instance, preset_name, frequency, NULL, 0);
if(instance->transmitter &&
subghz_protocol_keeloq_create_data(
subghz_transmitter_get_protocol_instance(instance->transmitter),
instance->fff_data,
serial,
btn,
cnt,
manufacture_name,
instance->preset)) {
flipper_format_write_string_cstr(instance->fff_data, "Manufacture", manufacture_name);
res = true;
}
subghz_transmitter_free(instance->transmitter);
return res;
}
bool subghz_scene_set_type_submenu_gen_data_keeloq_bft( //TODO rename & lead to a general appearance
void* context,
const char* preset_name,
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint16_t cnt,
uint32_t seed,
const char* manufacture_name) {
SubGhzTxRx* txrx = context;
bool res = false;
txrx->transmitter =
subghz_transmitter_alloc_init(txrx->environment, SUBGHZ_PROTOCOL_KEELOQ_NAME);
subghz_txrx_set_preset(txrx, preset_name, frequency, NULL, 0);
if(txrx->transmitter && subghz_protocol_keeloq_bft_create_data(
subghz_transmitter_get_protocol_instance(txrx->transmitter),
txrx->fff_data,
serial,
btn,
cnt,
seed,
manufacture_name,
txrx->preset)) {
res = true;
}
if(res) {
uint8_t seed_data[sizeof(uint32_t)] = {0};
for(size_t i = 0; i < sizeof(uint32_t); i++) {
seed_data[sizeof(uint32_t) - i - 1] = (seed >> i * 8) & 0xFF;
}
flipper_format_write_hex(txrx->fff_data, "Seed", seed_data, sizeof(uint32_t));
flipper_format_write_string_cstr(txrx->fff_data, "Manufacture", "BFT");
}
subghz_transmitter_free(txrx->transmitter);
return res;
}
bool subghz_scene_set_type_submenu_gen_data_nice_flor( //TODO rename & lead to a general appearance
void* context,
const char* preset_name,
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint16_t cnt,
bool nice_one) {
SubGhzTxRx* txrx = context;
bool res = false;
txrx->transmitter =
subghz_transmitter_alloc_init(txrx->environment, SUBGHZ_PROTOCOL_NICE_FLOR_S_NAME);
subghz_txrx_set_preset(txrx, preset_name, frequency, NULL, 0);
if(txrx->transmitter && subghz_protocol_nice_flor_s_create_data(
subghz_transmitter_get_protocol_instance(txrx->transmitter),
txrx->fff_data,
serial,
btn,
cnt,
txrx->preset,
nice_one)) {
res = true;
}
subghz_transmitter_free(txrx->transmitter);
return res;
}
bool subghz_scene_set_type_submenu_gen_data_faac_slh( //TODO rename & lead to a general appearance
void* context,
const char* preset_name,
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint16_t cnt,
uint32_t seed,
const char* manufacture_name) {
SubGhzTxRx* txrx = context;
bool res = false;
txrx->transmitter =
subghz_transmitter_alloc_init(txrx->environment, SUBGHZ_PROTOCOL_FAAC_SLH_NAME);
subghz_txrx_set_preset(txrx, preset_name, frequency, NULL, 0);
if(txrx->transmitter && subghz_protocol_faac_slh_create_data(
subghz_transmitter_get_protocol_instance(txrx->transmitter),
txrx->fff_data,
serial,
btn,
cnt,
seed,
manufacture_name,
txrx->preset)) {
res = true;
}
if(res) {
uint8_t seed_data[sizeof(uint32_t)] = {0};
for(size_t i = 0; i < sizeof(uint32_t); i++) {
seed_data[sizeof(uint32_t) - i - 1] = (seed >> i * 8) & 0xFF;
}
flipper_format_write_hex(txrx->fff_data, "Seed", seed_data, sizeof(uint32_t));
}
subghz_transmitter_free(txrx->transmitter);
return res;
}
bool subghz_scene_set_type_submenu_gen_data_alutech_at_4n( //TODO rename & lead to a general appearance
void* context,
const char* preset_name,
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint16_t cnt) {
SubGhzTxRx* txrx = context;
bool res = false;
txrx->transmitter =
subghz_transmitter_alloc_init(txrx->environment, SUBGHZ_PROTOCOL_ALUTECH_AT_4N_NAME);
subghz_txrx_set_preset(txrx, preset_name, frequency, NULL, 0);
if(txrx->transmitter && subghz_protocol_alutech_at_4n_create_data(
subghz_transmitter_get_protocol_instance(txrx->transmitter),
txrx->fff_data,
serial,
btn,
cnt,
txrx->preset)) {
res = true;
}
subghz_transmitter_free(txrx->transmitter);
return res;
}
bool subghz_scene_set_type_submenu_gen_data_somfy_telis( //TODO rename & lead to a general appearance
void* context,
const char* preset_name,
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint16_t cnt) {
SubGhzTxRx* txrx = context;
bool res = false;
txrx->transmitter =
subghz_transmitter_alloc_init(txrx->environment, SUBGHZ_PROTOCOL_SOMFY_TELIS_NAME);
subghz_txrx_set_preset(txrx, preset_name, frequency, NULL, 0);
if(txrx->transmitter && subghz_protocol_somfy_telis_create_data(
subghz_transmitter_get_protocol_instance(txrx->transmitter),
txrx->fff_data,
serial,
btn,
cnt,
txrx->preset)) {
res = true;
}
subghz_transmitter_free(txrx->transmitter);
return res;
}
bool subghz_txrx_gen_secplus_v2_protocol(
SubGhzTxRx* instance,
const char* name_preset,
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint32_t cnt) {
furi_assert(instance);
bool ret = false;
instance->transmitter =
subghz_transmitter_alloc_init(instance->environment, SUBGHZ_PROTOCOL_SECPLUS_V2_NAME);
subghz_txrx_set_preset(instance, name_preset, frequency, NULL, 0);
if(instance->transmitter) {
subghz_protocol_secplus_v2_create_data(
subghz_transmitter_get_protocol_instance(instance->transmitter),
instance->fff_data,
serial,
btn,
cnt,
instance->preset);
ret = true;
}
return ret;
}
bool subghz_txrx_gen_secplus_v1_protocol(
SubGhzTxRx* instance,
const char* name_preset,
uint32_t frequency) {
furi_assert(instance);
bool ret = false;
uint32_t serial = (uint32_t)rand();
while(!subghz_protocol_secplus_v1_check_fixed(serial)) {
serial = (uint32_t)rand();
}
if(subghz_txrx_gen_data_protocol(
instance,
name_preset,
frequency,
SUBGHZ_PROTOCOL_SECPLUS_V1_NAME,
(uint64_t)serial << 32 | 0xE6000000,
42)) {
ret = true;
}
return ret;
}

View File

@ -0,0 +1,87 @@
#pragma once
#include "subghz_types.h"
#include "subghz_txrx.h"
bool subghz_txrx_gen_data_protocol(
void* context,
const char* preset_name,
uint32_t frequency,
const char* protocol_name,
uint64_t key,
uint32_t bit);
bool subghz_txrx_gen_data_protocol_and_te(
SubGhzTxRx* instance,
const char* preset_name,
uint32_t frequency,
const char* protocol_name,
uint64_t key,
uint32_t bit,
uint32_t te);
bool subghz_txrx_gen_keelog_protocol(
SubGhzTxRx* instance,
const char* preset_name,
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint16_t cnt,
const char* manufacture_name);
bool subghz_scene_set_type_submenu_gen_data_keeloq_bft( //TODO rename
void* context,
const char* preset_name,
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint16_t cnt,
uint32_t seed,
const char* manufacture_name);
bool subghz_scene_set_type_submenu_gen_data_nice_flor( //TODO rename
void* context,
const char* preset_name,
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint16_t cnt,
bool nice_one);
bool subghz_scene_set_type_submenu_gen_data_faac_slh( //TODO rename
void* context,
const char* preset_name,
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint16_t cnt,
uint32_t seed,
const char* manufacture_name);
bool subghz_scene_set_type_submenu_gen_data_alutech_at_4n( //TODO rename
void* context,
const char* preset_name,
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint16_t cnt);
bool subghz_scene_set_type_submenu_gen_data_somfy_telis( //TODO rename
void* context,
const char* preset_name,
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint16_t cnt);
bool subghz_txrx_gen_secplus_v2_protocol(
SubGhzTxRx* instance,
const char* name_preset,
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint32_t cnt);
bool subghz_txrx_gen_secplus_v1_protocol(
SubGhzTxRx* instance,
const char* name_preset,
uint32_t frequency);

View File

@ -0,0 +1,34 @@
#pragma once
#include "subghz_types.h"
#include "subghz_txrx_callbacks.h"
#include <lib/subghz/subghz_worker.h>
#include <lib/subghz/subghz_setting.h>
#include <lib/subghz/receiver.h>
#include <lib/subghz/transmitter.h>
struct SubGhzTxRx {
SubGhzWorker* worker;
SubGhzEnvironment* environment;
SubGhzReceiver* receiver;
SubGhzTransmitter* transmitter;
SubGhzProtocolDecoderBase* decoder_result;
FlipperFormat* fff_data;
SubGhzRadioPreset* preset;
SubGhzSetting* setting;
uint8_t hopper_timeout;
uint8_t hopper_idx_frequency;
bool load_database;
SubGhzHopperState hopper_state;
SubGhzTxRxState txrx_state;
SubGhzSpeakerState speaker_state;
SubGhzTxRxNeedSaveCallback need_save_callback;
void* need_save_context;
bool debug_pin_state;
};

View File

@ -46,14 +46,15 @@ bool subghz_scene_need_saving_on_event(void* context, SceneManagerEvent event) {
scene_manager_previous_scene(subghz->scene_manager);
return true;
} else if(event.event == SubGhzCustomEventSceneExit) {
if(subghz_rx_key_state_get(subghz) == SubGhzRxKeyStateExit) {
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateIDLE);
SubGhzRxKeyState state = subghz_rx_key_state_get(subghz);
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateIDLE);
if(state) {
subghz_txrx_set_preset(
subghz->txrx, "AM650", subghz->last_settings->frequency, NULL, 0);
scene_manager_search_and_switch_to_previous_scene(
subghz->scene_manager, SubGhzSceneStart);
} else {
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateIDLE);
scene_manager_previous_scene(subghz->scene_manager);
}

View File

@ -13,13 +13,13 @@ bool subghz_scene_read_raw_update_filename(SubGhz* subghz) {
//set the path to read the file
FuriString* temp_str = furi_string_alloc();
do {
if(!flipper_format_rewind(subghz_txtx_get_fff_data(subghz->txrx))) {
FlipperFormat* fff_data = subghz_txtx_get_fff_data(subghz->txrx);
if(!flipper_format_rewind(fff_data)) {
FURI_LOG_E(TAG, "Rewind error");
break;
}
if(!flipper_format_read_string(
subghz_txtx_get_fff_data(subghz->txrx), "File_name", temp_str)) {
if(!flipper_format_read_string(fff_data, "File_name", temp_str)) {
FURI_LOG_E(TAG, "Missing File_name");
break;
}
@ -73,13 +73,11 @@ void subghz_scene_read_raw_on_enter(void* context) {
SubGhz* subghz = context;
FuriString* file_name = furi_string_alloc();
float threshold_rssi = subghz_threshold_rssi_get(subghz->threshold_rssi);
switch(subghz_rx_key_state_get(subghz)) {
case SubGhzRxKeyStateBack:
subghz_read_raw_set_status(
subghz->subghz_read_raw,
SubGhzReadRAWStatusIDLE,
"",
subghz_threshold_rssi_get(subghz->threshold_rssi));
subghz->subghz_read_raw, SubGhzReadRAWStatusIDLE, "", threshold_rssi);
break;
case SubGhzRxKeyStateRAWLoad:
path_extract_filename(subghz->file_path, file_name, true);
@ -87,8 +85,7 @@ void subghz_scene_read_raw_on_enter(void* context) {
subghz->subghz_read_raw,
SubGhzReadRAWStatusLoadKeyTX,
furi_string_get_cstr(file_name),
subghz_threshold_rssi_get(subghz->threshold_rssi));
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateIDLE);
threshold_rssi);
break;
case SubGhzRxKeyStateRAWSave:
path_extract_filename(subghz->file_path, file_name, true);
@ -96,18 +93,17 @@ void subghz_scene_read_raw_on_enter(void* context) {
subghz->subghz_read_raw,
SubGhzReadRAWStatusSaveKey,
furi_string_get_cstr(file_name),
subghz_threshold_rssi_get(subghz->threshold_rssi));
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateIDLE);
threshold_rssi);
break;
default:
subghz_read_raw_set_status(
subghz->subghz_read_raw,
SubGhzReadRAWStatusStart,
"",
subghz_threshold_rssi_get(subghz->threshold_rssi));
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateIDLE);
subghz->subghz_read_raw, SubGhzReadRAWStatusStart, "", threshold_rssi);
break;
}
if(subghz_rx_key_state_get(subghz) != SubGhzRxKeyStateBack) {
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateIDLE);
}
furi_string_free(file_name);
subghz_scene_read_raw_update_statusbar(subghz);
@ -124,13 +120,14 @@ void subghz_scene_read_raw_on_enter(void* context) {
bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
SubGhz* subghz = context;
bool consumed = false;
SubGhzProtocolDecoderRAW* decoder_raw =
(SubGhzProtocolDecoderRAW*)subghz_txrx_get_decoder(subghz->txrx);
if(event.type == SceneManagerEventTypeCustom) {
switch(event.event) {
case SubGhzCustomEventViewReadRAWBack:
subghz_txrx_stop(subghz->txrx);
//Stop save file
subghz_protocol_raw_save_to_file_stop(
(SubGhzProtocolDecoderRAW*)subghz_txrx_get_decoder(subghz->txrx));
subghz_protocol_raw_save_to_file_stop(decoder_raw);
subghz->state_notifications = SubGhzNotificationStateIDLE;
//needed save?
if((subghz_rx_key_state_get(subghz) == SubGhzRxKeyStateAddKey) ||
@ -245,11 +242,9 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
case SubGhzCustomEventViewReadRAWIDLE:
subghz_txrx_stop(subghz->txrx);
size_t spl_count = subghz_protocol_raw_get_sample_write(
(SubGhzProtocolDecoderRAW*)subghz_txrx_get_decoder(subghz->txrx));
size_t spl_count = subghz_protocol_raw_get_sample_write(decoder_raw);
subghz_protocol_raw_save_to_file_stop(
(SubGhzProtocolDecoderRAW*)subghz_txrx_get_decoder(subghz->txrx));
subghz_protocol_raw_save_to_file_stop(decoder_raw);
FuriString* temp_str = furi_string_alloc();
furi_string_printf(
@ -275,10 +270,7 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneNeedSaving);
} else {
SubGhzRadioPreset preset = subghz_txrx_get_preset(subghz->txrx);
if(subghz_protocol_raw_save_to_file_init(
(SubGhzProtocolDecoderRAW*)subghz_txrx_get_decoder(subghz->txrx),
RAW_FILE_NAME,
&preset)) {
if(subghz_protocol_raw_save_to_file_init(decoder_raw, RAW_FILE_NAME, &preset)) {
DOLPHIN_DEED(DolphinDeedSubGhzRawRec);
subghz_txrx_rx_start(subghz->txrx);
@ -317,17 +309,13 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
notification_message(subghz->notifications, &sequence_blink_cyan_10);
subghz_read_raw_update_sample_write(
subghz->subghz_read_raw,
subghz_protocol_raw_get_sample_write(
(SubGhzProtocolDecoderRAW*)subghz_txrx_get_decoder(subghz->txrx)));
subghz->subghz_read_raw, subghz_protocol_raw_get_sample_write(decoder_raw));
SubGhzThresholdRssiData ret_rssi =
subghz_threshold_get_rssi_data(subghz->threshold_rssi);
subghz_read_raw_add_data_rssi(
subghz->subghz_read_raw, ret_rssi.rssi, ret_rssi.is_above);
subghz_protocol_raw_save_to_file_pause(
(SubGhzProtocolDecoderRAW*)subghz_txrx_get_decoder(subghz->txrx),
!ret_rssi.is_above);
subghz_protocol_raw_save_to_file_pause(decoder_raw, !ret_rssi.is_above);
break;
case SubGhzNotificationStateTx:

View File

@ -90,27 +90,26 @@ static void subghz_scene_add_to_history_callback(
SubGhzProtocolDecoderBase* decoder_base,
void* context) {
furi_assert(context);
SubGhz* subghz = context;
SubGhzHistory* history = subghz->history;
FuriString* item_name = furi_string_alloc();
FuriString* item_time = furi_string_alloc();
uint16_t idx = subghz_history_get_item(subghz->history);
uint16_t idx = subghz_history_get_item(history);
SubGhzRadioPreset preset = subghz_txrx_get_preset(subghz->txrx);
if(subghz_history_add_to_history(subghz->history, decoder_base, &preset)) {
if(subghz_history_add_to_history(history, decoder_base, &preset)) {
furi_string_reset(item_name);
furi_string_reset(item_time);
subghz->state_notifications = SubGhzNotificationStateRxDone;
subghz_history_get_text_item_menu(subghz->history, item_name, idx);
subghz_history_get_time_item_menu(subghz->history, item_time, idx);
subghz_history_get_text_item_menu(history, item_name, idx);
subghz_history_get_time_item_menu(history, item_time, idx);
subghz_view_receiver_add_item_to_menu(
subghz->subghz_receiver,
furi_string_get_cstr(item_name),
furi_string_get_cstr(item_time),
subghz_history_get_type_protocol(subghz->history, idx));
subghz_history_get_type_protocol(history, idx));
subghz_scene_receiver_update_statusbar(subghz);
}
@ -122,13 +121,14 @@ static void subghz_scene_add_to_history_callback(
void subghz_scene_receiver_on_enter(void* context) {
SubGhz* subghz = context;
SubGhzHistory* history = subghz->history;
FuriString* item_name = furi_string_alloc();
FuriString* item_time = furi_string_alloc();
if(subghz_rx_key_state_get(subghz) == SubGhzRxKeyStateIDLE) {
subghz_txrx_set_preset(subghz->txrx, "AM650", subghz->last_settings->frequency, NULL, 0);
subghz_history_reset(subghz->history);
subghz_history_reset(history);
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateStart);
}
@ -137,16 +137,16 @@ void subghz_scene_receiver_on_enter(void* context) {
//Load history to receiver
subghz_view_receiver_exit(subghz->subghz_receiver);
for(uint8_t i = 0; i < subghz_history_get_item(subghz->history); i++) {
for(uint8_t i = 0; i < subghz_history_get_item(history); i++) {
furi_string_reset(item_name);
furi_string_reset(item_time);
subghz_history_get_text_item_menu(subghz->history, item_name, i);
subghz_history_get_time_item_menu(subghz->history, item_time, i);
subghz_history_get_text_item_menu(history, item_name, i);
subghz_history_get_time_item_menu(history, item_time, i);
subghz_view_receiver_add_item_to_menu(
subghz->subghz_receiver,
furi_string_get_cstr(item_name),
furi_string_get_cstr(item_time),
subghz_history_get_type_protocol(subghz->history, i));
subghz_history_get_type_protocol(history, i));
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateAddKey);
}
furi_string_free(item_name);

View File

@ -150,20 +150,20 @@ static void subghz_scene_receiver_config_set_frequency(VariableItem* item) {
if(subghz_txrx_hopper_get_state(subghz->txrx) == SubGhzHopperStateOFF) {
char text_buf[10] = {0};
uint32_t frequency = subghz_setting_get_frequency(setting, index);
SubGhzRadioPreset preset = subghz_txrx_get_preset(subghz->txrx);
snprintf(
text_buf,
sizeof(text_buf),
"%lu.%02lu",
subghz_setting_get_frequency(setting, index) / 1000000,
(subghz_setting_get_frequency(setting, index) % 1000000) / 10000);
frequency / 1000000,
(frequency % 1000000) / 10000);
variable_item_set_current_value_text(item, text_buf);
SubGhzRadioPreset preset = subghz_txrx_get_preset(subghz->txrx);
subghz_txrx_set_preset(
subghz->txrx,
furi_string_get_cstr(preset.name),
subghz_setting_get_frequency(setting, index),
frequency,
preset.data,
preset.data_size);
@ -180,8 +180,9 @@ static void subghz_scene_receiver_config_set_frequency(VariableItem* item) {
static void subghz_scene_receiver_config_set_preset(VariableItem* item) {
SubGhz* subghz = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item);
const char* preset_name =
subghz_setting_get_preset_name(subghz_txrx_get_setting(subghz->txrx), index);
SubGhzSetting* setting = subghz_txrx_get_setting(subghz->txrx);
const char* preset_name = subghz_setting_get_preset_name(setting, index);
variable_item_set_current_value_text(item, preset_name);
//subghz->last_settings->preset = index;
SubGhzRadioPreset preset = subghz_txrx_get_preset(subghz->txrx);
@ -190,8 +191,8 @@ static void subghz_scene_receiver_config_set_preset(VariableItem* item) {
subghz->txrx,
preset_name,
preset.frequency,
subghz_setting_get_preset_data(subghz_txrx_get_setting(subghz->txrx), index),
subghz_setting_get_preset_data_size(subghz_txrx_get_setting(subghz->txrx), index));
subghz_setting_get_preset_data(setting, index),
subghz_setting_get_preset_data_size(setting, index));
}
static void subghz_scene_receiver_config_set_hopping_running(VariableItem* item) {
@ -205,6 +206,8 @@ static void subghz_scene_receiver_config_set_hopping_running(VariableItem* item)
if(hopping_value[index] == SubGhzHopperStateOFF) {
char text_buf[10] = {0};
uint32_t frequency = subghz_setting_get_default_frequency(setting);
SubGhzRadioPreset preset = subghz_txrx_get_preset(subghz->txrx);
snprintf(
text_buf,
sizeof(text_buf),
@ -212,7 +215,7 @@ static void subghz_scene_receiver_config_set_hopping_running(VariableItem* item)
frequency / 1000000,
(frequency % 1000000) / 10000);
variable_item_set_current_value_text(frequency_item, text_buf);
SubGhzRadioPreset preset = subghz_txrx_get_preset(subghz->txrx);
subghz_txrx_set_preset(
subghz->txrx,
furi_string_get_cstr(preset.name),
@ -292,12 +295,13 @@ void subghz_scene_receiver_config_on_enter(void* context) {
SubGhz* subghz = context;
VariableItem* item;
uint8_t value_index;
SubGhzSetting* setting = subghz_txrx_get_setting(subghz->txrx);
SubGhzRadioPreset preset = subghz_txrx_get_preset(subghz->txrx);
item = variable_item_list_add(
subghz->variable_item_list,
"Frequency:",
subghz_setting_get_frequency_count(subghz_txrx_get_setting(subghz->txrx)),
subghz_setting_get_frequency_count(setting),
subghz_scene_receiver_config_set_frequency,
subghz);
value_index = subghz_scene_receiver_config_next_frequency(preset.frequency, subghz);
@ -309,23 +313,21 @@ void subghz_scene_receiver_config_on_enter(void* context) {
text_buf,
sizeof(text_buf),
"%lu.%02lu",
subghz_setting_get_frequency(subghz_txrx_get_setting(subghz->txrx), value_index) / 1000000,
(subghz_setting_get_frequency(subghz_txrx_get_setting(subghz->txrx), value_index) %
1000000) /
10000);
subghz_setting_get_frequency(setting, value_index) / 1000000,
(subghz_setting_get_frequency(setting, value_index) % 1000000) / 10000);
variable_item_set_current_value_text(item, text_buf);
item = variable_item_list_add(
subghz->variable_item_list,
"Modulation:",
subghz_setting_get_preset_count(subghz_txrx_get_setting(subghz->txrx)),
subghz_setting_get_preset_count(setting),
subghz_scene_receiver_config_set_preset,
subghz);
value_index =
subghz_scene_receiver_config_next_preset(furi_string_get_cstr(preset.name), subghz);
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(
item, subghz_setting_get_preset_name(subghz_txrx_get_setting(subghz->txrx), value_index));
item, subghz_setting_get_preset_name(setting, value_index));
if(scene_manager_get_scene_state(subghz->scene_manager, SubGhzSceneReadRAW) !=
SubGhzCustomEventManagerSet) {

View File

@ -1,4 +1,5 @@
#include "../subghz_i.h"
#include "../helpers/subghz_txrx_create_potocol_key.h"
#define TAG "SubGhzSetSeed"

View File

@ -1,4 +1,5 @@
#include "../subghz_i.h"
#include "../helpers/subghz_txrx_create_potocol_key.h"
#include <lib/subghz/blocks/math.h>
#include <lib/subghz/protocols/protocol_items.h>
@ -366,7 +367,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
subghz->txrx, "AM650", 433920000, SUBGHZ_PROTOCOL_GATE_TX_NAME, rev_key, 24);
break;
case SubmenuIndexBeninca433:
generated_protocol = subghz_scene_set_type_submenu_gen_data_keeloq(
generated_protocol = subghz_txrx_gen_keelog_protocol(
subghz->txrx,
"AM650",
433920000,
@ -381,7 +382,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
}
break;
case SubmenuIndexBeninca868:
generated_protocol = subghz_scene_set_type_submenu_gen_data_keeloq(
generated_protocol = subghz_txrx_gen_keelog_protocol(
subghz->txrx,
"AM650",
868350000,
@ -396,7 +397,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
}
break;
case SubmenuIndexAllmatic433:
generated_protocol = subghz_scene_set_type_submenu_gen_data_keeloq(
generated_protocol = subghz_txrx_gen_keelog_protocol(
subghz->txrx,
"AM650",
433920000,
@ -411,7 +412,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
}
break;
case SubmenuIndexAllmatic868:
generated_protocol = subghz_scene_set_type_submenu_gen_data_keeloq(
generated_protocol = subghz_txrx_gen_keelog_protocol(
subghz->txrx,
"AM650",
868350000,
@ -426,7 +427,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
}
break;
case SubmenuIndexElmesElectronic:
generated_protocol = subghz_scene_set_type_submenu_gen_data_keeloq(
generated_protocol = subghz_txrx_gen_keelog_protocol(
subghz->txrx,
"AM650",
433920000,
@ -441,7 +442,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
}
break;
case SubmenuIndexANMotorsAT4:
generated_protocol = subghz_scene_set_type_submenu_gen_data_keeloq(
generated_protocol = subghz_txrx_gen_keelog_protocol(
subghz->txrx,
"AM650",
433920000,
@ -456,7 +457,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
}
break;
case SubmenuIndexAprimatic:
generated_protocol = subghz_scene_set_type_submenu_gen_data_keeloq(
generated_protocol = subghz_txrx_gen_keelog_protocol(
subghz->txrx,
"AM650",
433920000,
@ -471,7 +472,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
}
break;
case SubmenuIndexGibidi433:
generated_protocol = subghz_scene_set_type_submenu_gen_data_keeloq(
generated_protocol = subghz_txrx_gen_keelog_protocol(
subghz->txrx, "AM650", 433920000, key & 0x00FFFFFF, 0x2, 0x0003, "Gibidi");
if(!generated_protocol) {
furi_string_set(
@ -480,7 +481,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
}
break;
case SubmenuIndexGSN:
generated_protocol = subghz_scene_set_type_submenu_gen_data_keeloq(
generated_protocol = subghz_txrx_gen_keelog_protocol(
subghz->txrx, "AM650", 433920000, key & 0x0FFFFFFF, 0x2, 0x0003, "GSN");
if(!generated_protocol) {
furi_string_set(
@ -489,7 +490,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
}
break;
case SubmenuIndexIronLogic:
generated_protocol = subghz_scene_set_type_submenu_gen_data_keeloq(
generated_protocol = subghz_txrx_gen_keelog_protocol(
subghz->txrx, "AM650", 433920000, key & 0x00FFFFF0, 0x4, 0x0005, "IronLogic");
if(!generated_protocol) {
furi_string_set(
@ -498,7 +499,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
}
break;
case SubmenuIndexSommer_FM_434:
generated_protocol = subghz_scene_set_type_submenu_gen_data_keeloq(
generated_protocol = subghz_txrx_gen_keelog_protocol(
subghz->txrx, "FM476", 434420000, key & 0x0FFFFFFF, 0x4, 0x0003, "Sommer(fsk476)");
if(!generated_protocol) {
furi_string_set(
@ -507,7 +508,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
}
break;
case SubmenuIndexSommer_FM_868:
generated_protocol = subghz_scene_set_type_submenu_gen_data_keeloq(
generated_protocol = subghz_txrx_gen_keelog_protocol(
subghz->txrx, "FM476", 868800000, key & 0x0FFFFFFF, 0x4, 0x0003, "Sommer(fsk476)");
if(!generated_protocol) {
furi_string_set(
@ -516,7 +517,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
}
break;
case SubmenuIndexDTMNeo433:
generated_protocol = subghz_scene_set_type_submenu_gen_data_keeloq(
generated_protocol = subghz_txrx_gen_keelog_protocol(
subghz->txrx, "AM650", 433920000, key & 0x000FFFFF, 0x2, 0x0005, "DTM_Neo");
if(!generated_protocol) {
furi_string_set(
@ -525,7 +526,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
}
break;
case SubmenuIndexCAMESpace:
generated_protocol = subghz_scene_set_type_submenu_gen_data_keeloq(
generated_protocol = subghz_txrx_gen_keelog_protocol(
subghz->txrx, "AM650", 433920000, key & 0x00FFFFFF, 0x2, 0x0003, "Came_Space");
if(!generated_protocol) {
furi_string_set(
@ -568,7 +569,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
}
break;
case SubmenuIndexDoorHan_433_92:
generated_protocol = subghz_scene_set_type_submenu_gen_data_keeloq(
generated_protocol = subghz_txrx_gen_keelog_protocol(
subghz->txrx, "AM650", 433920000, key & 0x0FFFFFFF, 0x2, 0x0003, "DoorHan");
if(!generated_protocol) {
furi_string_set(
@ -577,7 +578,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
}
break;
case SubmenuIndexDoorHan_315_00:
generated_protocol = subghz_scene_set_type_submenu_gen_data_keeloq(
generated_protocol = subghz_txrx_gen_keelog_protocol(
subghz->txrx, "AM650", 315000000, key & 0x0FFFFFFF, 0x2, 0x0003, "DoorHan");
if(!generated_protocol) {
furi_string_set(
@ -604,7 +605,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
}
break;
case SubmenuIndexNiceSmilo_433_92:
generated_protocol = subghz_scene_set_type_submenu_gen_data_keeloq(
generated_protocol = subghz_txrx_gen_keelog_protocol(
subghz->txrx, "AM650", 433920000, key & 0x00FFFFFF, 0x2, 0x0003, "NICE_Smilo");
if(!generated_protocol) {
furi_string_set(
@ -613,13 +614,16 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
}
break;
case SubmenuIndexLiftMaster_315_00:
generated_protocol = subghz_txrx_gen_secplus_v1_protocol(subghz->txrx, "AM650", 315000000);
generated_protocol =
subghz_txrx_gen_secplus_v1_protocol(subghz->txrx, "AM650", 315000000);
break;
case SubmenuIndexLiftMaster_390_00:
generated_protocol = subghz_txrx_gen_secplus_v1_protocol(subghz->txrx, "AM650", 390000000);
generated_protocol =
subghz_txrx_gen_secplus_v1_protocol(subghz->txrx, "AM650", 390000000);
break;
case SubmenuIndexLiftMaster_433_00:
generated_protocol = subghz_txrx_gen_secplus_v1_protocol(subghz->txrx, "AM650", 433920000);
generated_protocol =
subghz_txrx_gen_secplus_v1_protocol(subghz->txrx, "AM650", 433920000);
break;
case SubmenuIndexSecPlus_v2_310_00:
generated_protocol = subghz_txrx_gen_secplus_v2_protocol(