flipperzero-firmware/lib/subghz/protocols/base.c
Skorpionm 9a9abd59e9
[FL-2904, FL-2900, FL-2890] WS: add app WeatherStation (#1833)
* WeatherStation: start
* SubGhz: rename protocol magellen -> magellan
* WeatherStation: err Unresolved symbols: {'subghz_protocol_decoder_base_get_string'}
* WeatherStation: fix Unresolved symbols: {'subghz_protocol_decoder_base_get_string'}
* Subghz: add set protocol_items
* WeatherStation: adding your protocols
* WS: add Infactory protocol
* WS: add history
* WS: add setting
* WS: add lock
* WS: add hopper frequency
* WS: fix history
* WS fix string_t -> FuriString*
* WS: add images
* WS: history record update when receiving data from the sensor again
* WS: add receiver info, delete extra code
* WS: add protocol ThermoPRO_TX4
* [FL-2900] SubGhz: Move icons in Sub-GHz
* WS: add Notification
* [FL-2890] SubGhz: Rename *_user files in resources to _user.example
* WS: add about scene
* WS: removing redundant code
* WS: add  protocol Nexus-TH
* WS: add protocol GT_WT03
* WS: fix notification and rename "Weather Station" -> "Read Weather Station"
* SubGhz: partial unit tests fix
* SubGhz: fix unit_test
* SubGhz: remove dead code
* SubGhz: rename SubGhzPresetDefinition into SubGhzRadioPreset, cleanup subghz types.

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2022-10-20 02:27:26 +09:00

63 lines
1.8 KiB
C

#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,
FuriString* output) {
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;
}
bool subghz_protocol_decoder_base_serialize(
SubGhzProtocolDecoderBase* decoder_base,
FlipperFormat* flipper_format,
SubGhzRadioPreset* preset) {
bool status = false;
if(decoder_base->protocol && decoder_base->protocol->decoder &&
decoder_base->protocol->decoder->serialize) {
status = decoder_base->protocol->decoder->serialize(decoder_base, flipper_format, preset);
}
return status;
}
bool subghz_protocol_decoder_base_deserialize(
SubGhzProtocolDecoderBase* decoder_base,
FlipperFormat* flipper_format) {
bool status = false;
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;
}