flipperzero-firmware/lib/subghz/protocols/base.h
Skorpionm 3164184bbc
[FL-2230] SubGhz: protocol API refactoring (#969)
* SubGhz: protocols library refactoring
* SubGhz: new architecture and refactoring
* SubGhz: simplify protocol structure, remove unused types
* SubGhz: rename Subghz to SubGhz
* SubGhz: add environment concept

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2022-03-03 12:48:56 +03:00

52 lines
1.4 KiB
C

#pragma once
#include "../types.h"
typedef struct SubGhzProtocolDecoderBase SubGhzProtocolDecoderBase;
typedef void (
*SubGhzProtocolDecoderBaseRxCallback)(SubGhzProtocolDecoderBase* instance, void* context);
typedef void (
*SubGhzProtocolDecoderBaseSerialize)(SubGhzProtocolDecoderBase* decoder_base, string_t output);
struct SubGhzProtocolDecoderBase {
// Decoder general section
const SubGhzProtocol* protocol;
// Callback section
SubGhzProtocolDecoderBaseRxCallback callback;
void* context;
};
void subghz_protocol_decoder_base_set_decoder_callback(
SubGhzProtocolDecoderBase* decoder_base,
SubGhzProtocolDecoderBaseRxCallback callback,
void* context);
bool subghz_protocol_decoder_base_get_string(
SubGhzProtocolDecoderBase* decoder_base,
string_t output);
bool subghz_protocol_decoder_base_serialize(
SubGhzProtocolDecoderBase* decoder_base,
FlipperFormat* flipper_format,
uint32_t frequency,
FuriHalSubGhzPreset preset);
bool subghz_protocol_decoder_base_deserialize(
SubGhzProtocolDecoderBase* decoder_base,
FlipperFormat* flipper_format);
uint8_t subghz_protocol_decoder_base_get_hash_data(SubGhzProtocolDecoderBase* decoder_base);
// Encoder Base
typedef struct SubGhzProtocolEncoderBase SubGhzProtocolEncoderBase;
struct SubGhzProtocolEncoderBase {
// Decoder general section
const SubGhzProtocol* protocol;
// Callback section
};