unleashed-firmware/lib/subghz/receiver.h
Skorpionm 94ba7d104c
SubGhz: refactoring add descriptions (#1012)
* SubGhz: add descriptions
* SubGhz: fix syntax

Co-authored-by: あく <alleteam@gmail.com>
2022-03-16 16:18:48 +07:00

66 lines
2.0 KiB
C

#pragma once
#include "types.h"
#include "protocols/base.h"
typedef struct SubGhzReceiver SubGhzReceiver;
typedef void (*SubGhzReceiverCallback)(
SubGhzReceiver* decoder,
SubGhzProtocolDecoderBase* decoder_base,
void* context);
/**
* Allocate and init SubGhzReceiver.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzReceiver* pointer to a SubGhzReceiver instance
*/
SubGhzReceiver* subghz_receiver_alloc_init(SubGhzEnvironment* environment);
/**
* Free SubGhzReceiver.
* @param instance Pointer to a SubGhzReceiver instance
*/
void subghz_receiver_free(SubGhzReceiver* instance);
/**
* Parse a raw sequence of levels and durations received from the air.
* @param instance Pointer to a SubGhzReceiver instance
* @param level Signal level true-high false-low
* @param duration Duration of this level in, us
*/
void subghz_receiver_decode(SubGhzReceiver* instance, bool level, uint32_t duration);
/**
* Reset decoder SubGhzReceiver.
* @param instance Pointer to a SubGhzReceiver instance
*/
void subghz_receiver_reset(SubGhzReceiver* instance);
/**
* Set a callback upon completion of successful decoding of one of the protocols.
* @param instance Pointer to a SubGhzReceiver instance
* @param callback Callback, SubGhzReceiverCallback
* @param context Context
*/
void subghz_receiver_set_rx_callback(
SubGhzReceiver* instance,
SubGhzReceiverCallback callback,
void* context);
/**
* Set the filter of receivers that will work at the moment.
* @param instance Pointer to a SubGhzReceiver instance
* @param filter Filter, SubGhzProtocolFlag
*/
void subghz_receiver_set_filter(SubGhzReceiver* instance, SubGhzProtocolFlag filter);
/**
* Search for a cattery by his name.
* @param instance Pointer to a SubGhzReceiver instance
* @param decoder_name Receiver name
* @return SubGhzProtocolDecoderBase* pointer to a SubGhzProtocolDecoderBase instance
*/
SubGhzProtocolDecoderBase*
subghz_receiver_search_decoder_base_by_name(SubGhzReceiver* instance, const char* decoder_name);