flipperzero-firmware/lib/subghz/receiver.h
SG b9a766d909 [FL-2627] Flipper applications: SDK, build and debug system (#1387)
* Added support for running applications from SD card (FAPs - Flipper Application Packages)
* Added plugin_dist target for fbt to build FAPs
* All apps of type FlipperAppType.EXTERNAL and FlipperAppType.PLUGIN are built as FAPs by default
* Updated VSCode configuration for new fbt features - re-deploy stock configuration to use them
* Added debugging support for FAPs with fbt debug & VSCode
* Added public firmware API with automated versioning

Co-authored-by: hedger <hedger@users.noreply.github.com>
Co-authored-by: SG <who.just.the.doctor@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
2022-09-15 02:21:03 +09:00

74 lines
2.1 KiB
C

#pragma once
#include "types.h"
#include "protocols/base.h"
#ifdef __cplusplus
extern "C" {
#endif
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);
#ifdef __cplusplus
}
#endif