mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-11-28 11:26:32 +03:00
fix syntax
fix syntax
This commit is contained in:
parent
322472d6eb
commit
71b1748573
@ -34,6 +34,8 @@ struct SubGhzProtocolEncoderNiceFlorS {
|
||||
|
||||
SubGhzProtocolBlockEncoder encoder;
|
||||
SubGhzBlockGeneric generic;
|
||||
|
||||
const char* nice_flor_s_rainbow_table_file_name;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
@ -97,25 +99,6 @@ void subghz_protocol_encoder_nice_flor_s_free(void* context) {
|
||||
free(instance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Key generation from simple data
|
||||
* @param instance Pointer to a SubGhzProtocolEncoderNiceFlorS* instance
|
||||
* @param btn Button number, 4 bit
|
||||
*/
|
||||
static bool subghz_protocol_nice_flor_s_gen_data(SubGhzProtocolEncoderNiceFlorS* instance, uint8_t btn) {
|
||||
instance->generic.cnt++;
|
||||
uint64_t data_to_encrypt = btn << 32 | instance->generic.serial << 16
|
||||
| instance->generic.cnt;
|
||||
uint64_t res = 0;
|
||||
res = subghz_protocol_nice_flor_s_encrypt(data_to_encrypt, file_name);
|
||||
if(res) {
|
||||
instance->generic.data = res;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool subghz_protocol_nice_flor_s_create_data(
|
||||
void* context,
|
||||
FlipperFormat* flipper_format,
|
||||
@ -123,18 +106,19 @@ bool subghz_protocol_nice_flor_s_create_data(
|
||||
uint8_t btn,
|
||||
uint16_t cnt,
|
||||
uint32_t frequency,
|
||||
FuriHalSubGhzPreset preset) {
|
||||
FuriHalSubGhzPreset preset,
|
||||
const char* file_name) {
|
||||
furi_assert(context);
|
||||
SubGhzProtocolEncoderNiceFlorS* instance = context;
|
||||
instance->generic.btn = btn;
|
||||
instance->generic.serial = serial;
|
||||
instance->generic.cnt = cnt;
|
||||
instance->generic.data_count_bit = 52;
|
||||
bool res = subghz_protocol_nice_flor_s_gen_data(instance, btn);
|
||||
if(res) {
|
||||
res =
|
||||
subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
||||
}
|
||||
return res;
|
||||
instance->generic.cnt++;
|
||||
uint64_t data_to_encrypt = ( btn << 31 | instance->generic.serial << 16 | instance->generic.cnt );
|
||||
instance->generic.data = subghz_protocol_nice_flor_s_encrypt(data_to_encrypt, file_name);
|
||||
subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -146,13 +130,6 @@ static bool
|
||||
subghz_protocol_encoder_nice_flor_s_get_upload(SubGhzProtocolEncoderNiceFlorS* instance, uint8_t btn) {
|
||||
furi_assert(instance);
|
||||
|
||||
//gen new key
|
||||
if(subghz_protocol_nice_flor_s_gen_data(instance, btn)) {
|
||||
//ToDo if you need to add a callback to automatically update the data on the display
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t index = 0;
|
||||
size_t size_upload = (instance->generic.data_count_bit * 2) + ((35 + 2 + 2) * 2);
|
||||
if(size_upload > instance->encoder.size_upload) {
|
||||
@ -208,9 +185,6 @@ bool subghz_protocol_encoder_nice_flor_s_deserialize(void* context, FlipperForma
|
||||
break;
|
||||
}
|
||||
|
||||
subghz_protocol_nice_flor_s_remote_controller(
|
||||
&instance->generic, instance->nice_flor_s_rainbow_table_file_name);
|
||||
|
||||
//optional parameter parameter
|
||||
flipper_format_read_uint32(
|
||||
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
|
||||
|
@ -42,7 +42,8 @@ bool subghz_protocol_nice_flor_s_create_data(
|
||||
uint8_t btn,
|
||||
uint16_t cnt,
|
||||
uint32_t frequency,
|
||||
FuriHalSubGhzPreset preset);
|
||||
FuriHalSubGhzPreset preset,
|
||||
const char* file_name);
|
||||
|
||||
/**
|
||||
* Deserialize and generating an upload to send.
|
||||
@ -65,6 +66,8 @@ void subghz_protocol_encoder_nice_flor_s_stop(void* context);
|
||||
*/
|
||||
LevelDuration subghz_protocol_encoder_nice_flor_s_yield(void* context);
|
||||
|
||||
uint64_t subghz_protocol_nice_flor_s_encrypt(uint64_t data, const char* file_name);
|
||||
|
||||
/**
|
||||
* Allocate SubGhzProtocolDecoderNiceFlorS.
|
||||
* @param environment Pointer to a SubGhzEnvironment instance
|
||||
|
Loading…
Reference in New Issue
Block a user