2022-03-03 12:48:56 +03:00
|
|
|
#include "base.h"
|
|
|
|
#include "registry.h"
|
|
|
|
|
|
|
|
void subghz_protocol_decoder_base_set_decoder_callback(
|
|
|
|
SubGhzProtocolDecoderBase* decoder_base,
|
|
|
|
SubGhzProtocolDecoderBaseRxCallback callback,
|
|
|
|
void* context) {
|
|
|
|
decoder_base->callback = callback;
|
|
|
|
decoder_base->context = context;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool subghz_protocol_decoder_base_get_string(
|
|
|
|
SubGhzProtocolDecoderBase* decoder_base,
|
2022-10-05 18:15:23 +03:00
|
|
|
FuriString* output) {
|
2022-03-03 12:48:56 +03:00
|
|
|
bool status = false;
|
|
|
|
|
|
|
|
if(decoder_base->protocol && decoder_base->protocol->decoder &&
|
|
|
|
decoder_base->protocol->decoder->get_string) {
|
|
|
|
decoder_base->protocol->decoder->get_string(decoder_base, output);
|
|
|
|
status = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2023-03-03 18:09:13 +03:00
|
|
|
SubGhzProtocolStatus subghz_protocol_decoder_base_serialize(
|
2022-03-03 12:48:56 +03:00
|
|
|
SubGhzProtocolDecoderBase* decoder_base,
|
|
|
|
FlipperFormat* flipper_format,
|
2022-10-19 20:27:26 +03:00
|
|
|
SubGhzRadioPreset* preset) {
|
2023-03-03 18:09:13 +03:00
|
|
|
SubGhzProtocolStatus status = SubGhzProtocolStatusError;
|
2022-03-03 12:48:56 +03:00
|
|
|
|
|
|
|
if(decoder_base->protocol && decoder_base->protocol->decoder &&
|
|
|
|
decoder_base->protocol->decoder->serialize) {
|
2022-07-26 17:16:59 +03:00
|
|
|
status = decoder_base->protocol->decoder->serialize(decoder_base, flipper_format, preset);
|
2022-03-03 12:48:56 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2023-03-03 18:09:13 +03:00
|
|
|
SubGhzProtocolStatus subghz_protocol_decoder_base_deserialize(
|
2022-03-03 12:48:56 +03:00
|
|
|
SubGhzProtocolDecoderBase* decoder_base,
|
|
|
|
FlipperFormat* flipper_format) {
|
2023-03-03 18:09:13 +03:00
|
|
|
SubGhzProtocolStatus status = SubGhzProtocolStatusError;
|
2022-03-03 12:48:56 +03:00
|
|
|
|
|
|
|
if(decoder_base->protocol && decoder_base->protocol->decoder &&
|
|
|
|
decoder_base->protocol->decoder->deserialize) {
|
|
|
|
status = decoder_base->protocol->decoder->deserialize(decoder_base, flipper_format);
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t subghz_protocol_decoder_base_get_hash_data(SubGhzProtocolDecoderBase* decoder_base) {
|
|
|
|
uint8_t hash = 0;
|
|
|
|
|
|
|
|
if(decoder_base->protocol && decoder_base->protocol->decoder &&
|
|
|
|
decoder_base->protocol->decoder->get_hash_data) {
|
|
|
|
hash = decoder_base->protocol->decoder->get_hash_data(decoder_base);
|
|
|
|
}
|
|
|
|
|
|
|
|
return hash;
|
|
|
|
}
|