[FL-3106] SubGhz: better and more verbose error handling in protocols, stricter CAME validation (#2443)
* SubGhz: add error protocol * WS: add error protocol * SubGhz: error processing * SubGhz: more stringent CAME protocol restrictions * SubGhz: fix header duration CAME protocol * SubGhz: delete comments * SubGhz: sync SubGhzProtocolStatus with FuriStatus * SubGhz: update documentation and bump api_version Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -192,18 +192,17 @@ static void subghz_protocol_power_smart_remote_controller(SubGhzBlockGeneric* in
|
||||
instance->cnt = ((instance->data >> 49) & 0x3F);
|
||||
}
|
||||
|
||||
bool subghz_protocol_encoder_power_smart_deserialize(void* context, FlipperFormat* flipper_format) {
|
||||
SubGhzProtocolStatus
|
||||
subghz_protocol_encoder_power_smart_deserialize(void* context, FlipperFormat* flipper_format) {
|
||||
furi_assert(context);
|
||||
SubGhzProtocolEncoderPowerSmart* instance = context;
|
||||
bool res = false;
|
||||
SubGhzProtocolStatus ret = SubGhzProtocolStatusError;
|
||||
do {
|
||||
if(!subghz_block_generic_deserialize(&instance->generic, flipper_format)) {
|
||||
FURI_LOG_E(TAG, "Deserialize error");
|
||||
break;
|
||||
}
|
||||
if(instance->generic.data_count_bit !=
|
||||
subghz_protocol_power_smart_const.min_count_bit_for_found) {
|
||||
FURI_LOG_E(TAG, "Wrong number of bits in key");
|
||||
ret = subghz_block_generic_deserialize_check_count_bit(
|
||||
&instance->generic,
|
||||
flipper_format,
|
||||
subghz_protocol_power_smart_const.min_count_bit_for_found);
|
||||
if(ret != SubGhzProtocolStatusOk) {
|
||||
break;
|
||||
}
|
||||
//optional parameter parameter
|
||||
@@ -213,11 +212,9 @@ bool subghz_protocol_encoder_power_smart_deserialize(void* context, FlipperForma
|
||||
subghz_protocol_power_smart_remote_controller(&instance->generic);
|
||||
subghz_protocol_encoder_power_smart_get_upload(instance);
|
||||
instance->encoder.is_running = true;
|
||||
|
||||
res = true;
|
||||
} while(false);
|
||||
|
||||
return res;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void subghz_protocol_encoder_power_smart_stop(void* context) {
|
||||
@@ -345,7 +342,7 @@ uint8_t subghz_protocol_decoder_power_smart_get_hash_data(void* context) {
|
||||
&instance->decoder, (instance->decoder.decode_count_bit / 8) + 1);
|
||||
}
|
||||
|
||||
bool subghz_protocol_decoder_power_smart_serialize(
|
||||
SubGhzProtocolStatus subghz_protocol_decoder_power_smart_serialize(
|
||||
void* context,
|
||||
FlipperFormat* flipper_format,
|
||||
SubGhzRadioPreset* preset) {
|
||||
@@ -354,22 +351,14 @@ bool subghz_protocol_decoder_power_smart_serialize(
|
||||
return subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||
}
|
||||
|
||||
bool subghz_protocol_decoder_power_smart_deserialize(void* context, FlipperFormat* flipper_format) {
|
||||
SubGhzProtocolStatus
|
||||
subghz_protocol_decoder_power_smart_deserialize(void* context, FlipperFormat* flipper_format) {
|
||||
furi_assert(context);
|
||||
SubGhzProtocolDecoderPowerSmart* instance = context;
|
||||
bool ret = false;
|
||||
do {
|
||||
if(!subghz_block_generic_deserialize(&instance->generic, flipper_format)) {
|
||||
break;
|
||||
}
|
||||
if(instance->generic.data_count_bit !=
|
||||
subghz_protocol_power_smart_const.min_count_bit_for_found) {
|
||||
FURI_LOG_E(TAG, "Wrong number of bits in key");
|
||||
break;
|
||||
}
|
||||
ret = true;
|
||||
} while(false);
|
||||
return ret;
|
||||
return subghz_block_generic_deserialize_check_count_bit(
|
||||
&instance->generic,
|
||||
flipper_format,
|
||||
subghz_protocol_power_smart_const.min_count_bit_for_found);
|
||||
}
|
||||
|
||||
void subghz_protocol_decoder_power_smart_get_string(void* context, FuriString* output) {
|
||||
|
||||
Reference in New Issue
Block a user