mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-25 20:23:07 +00:00
4bf29827f8
* Quicksave 1 * Header stage complete * Source stage complete * Lint & merge fixes * Includes * Documentation step 1 * FBT: output free size considering BT STACK * Documentation step 2 * py lint * Fix music player plugin * unit test stage 1: string allocator, mem, getters, setters, appends, compare, search. * unit test: string equality * unit test: string replace * unit test: string start_with, end_with * unit test: string trim * unit test: utf-8 * Rename * Revert fw_size changes * Simplify CLI backspace handling * Simplify CLI character insert * Merge fixes * Furi: correct filenaming and spelling * Bt: remove furi string include Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
88 lines
2.5 KiB
C
88 lines
2.5 KiB
C
#pragma once
|
|
|
|
#include "../types.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef struct SubGhzProtocolDecoderBase SubGhzProtocolDecoderBase;
|
|
|
|
typedef void (
|
|
*SubGhzProtocolDecoderBaseRxCallback)(SubGhzProtocolDecoderBase* instance, void* context);
|
|
|
|
typedef void (*SubGhzProtocolDecoderBaseSerialize)(
|
|
SubGhzProtocolDecoderBase* decoder_base,
|
|
FuriString* output);
|
|
|
|
struct SubGhzProtocolDecoderBase {
|
|
// Decoder general section
|
|
const SubGhzProtocol* protocol;
|
|
|
|
// Callback section
|
|
SubGhzProtocolDecoderBaseRxCallback callback;
|
|
void* context;
|
|
};
|
|
|
|
/**
|
|
* Set a callback upon completion of successful decoding of one of the protocols.
|
|
* @param decoder_base Pointer to a SubGhzProtocolDecoderBase instance
|
|
* @param callback Callback, SubGhzProtocolDecoderBaseRxCallback
|
|
* @param context Context
|
|
*/
|
|
void subghz_protocol_decoder_base_set_decoder_callback(
|
|
SubGhzProtocolDecoderBase* decoder_base,
|
|
SubGhzProtocolDecoderBaseRxCallback callback,
|
|
void* context);
|
|
|
|
/**
|
|
* Getting a textual representation of the received data.
|
|
* @param decoder_base Pointer to a SubGhzProtocolDecoderBase instance
|
|
* @param output Resulting text
|
|
*/
|
|
bool subghz_protocol_decoder_base_get_string(
|
|
SubGhzProtocolDecoderBase* decoder_base,
|
|
FuriString* output);
|
|
|
|
/**
|
|
* Serialize data SubGhzProtocolDecoderBase.
|
|
* @param decoder_base Pointer to a SubGhzProtocolDecoderBase instance
|
|
* @param flipper_format Pointer to a FlipperFormat instance
|
|
* @param preset The modulation on which the signal was received, SubGhzPresetDefinition
|
|
* @return true On success
|
|
*/
|
|
bool subghz_protocol_decoder_base_serialize(
|
|
SubGhzProtocolDecoderBase* decoder_base,
|
|
FlipperFormat* flipper_format,
|
|
SubGhzPresetDefinition* preset);
|
|
|
|
/**
|
|
* Deserialize data SubGhzProtocolDecoderBase.
|
|
* @param decoder_base Pointer to a SubGhzProtocolDecoderBase instance
|
|
* @param flipper_format Pointer to a FlipperFormat instance
|
|
* @return true On success
|
|
*/
|
|
bool subghz_protocol_decoder_base_deserialize(
|
|
SubGhzProtocolDecoderBase* decoder_base,
|
|
FlipperFormat* flipper_format);
|
|
|
|
/**
|
|
* Getting the hash sum of the last randomly received parcel.
|
|
* @param decoder_base Pointer to a SubGhzProtocolDecoderBase instance
|
|
* @return hash Hash sum
|
|
*/
|
|
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
|
|
};
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|