2023-05-09 12:07:36 +03:00
|
|
|
#pragma once
|
2023-05-09 19:10:56 +03:00
|
|
|
#include "subghz_types.h"
|
2023-05-09 21:20:35 +03:00
|
|
|
#include "subghz_txrx_callbacks.h"
|
2023-05-09 12:07:36 +03:00
|
|
|
#include <lib/subghz/subghz_worker.h>
|
|
|
|
#include <lib/subghz/subghz_setting.h>
|
|
|
|
#include <lib/subghz/receiver.h>
|
|
|
|
#include <lib/subghz/transmitter.h>
|
2023-05-09 18:24:25 +03:00
|
|
|
#include <lib/subghz/protocols/raw.h>
|
2023-05-09 12:07:36 +03:00
|
|
|
|
|
|
|
typedef void (*SubGhzTxRxNeedSaveCallback)(void* context);
|
|
|
|
|
|
|
|
typedef struct SubGhzTxRx SubGhzTxRx;
|
|
|
|
|
2023-05-09 19:50:01 +03:00
|
|
|
typedef enum {
|
|
|
|
SubGhzTxRxStartTxStateOk,
|
|
|
|
SubGhzTxRxStartTxStateErrorOnlyRx,
|
|
|
|
SubGhzTxRxStartTxStateErrorParserOthers,
|
|
|
|
} SubGhzTxRxStartTxState;
|
|
|
|
|
2023-05-09 17:30:01 +03:00
|
|
|
SubGhzTxRx* subghz_txrx_alloc();
|
2023-05-09 19:10:56 +03:00
|
|
|
void subghz_txrx_free(SubGhzTxRx* instance);
|
|
|
|
bool subghz_txrx_is_load_database(SubGhzTxRx* instance);
|
2023-05-09 17:30:01 +03:00
|
|
|
|
2023-05-09 19:10:56 +03:00
|
|
|
void subghz_txrx_set_preset(
|
|
|
|
SubGhzTxRx* instance,
|
2023-05-09 12:07:36 +03:00
|
|
|
const char* preset_name,
|
|
|
|
uint32_t frequency,
|
|
|
|
uint8_t* preset_data,
|
|
|
|
size_t preset_data_size);
|
|
|
|
|
2023-05-09 19:10:56 +03:00
|
|
|
const char* subghz_txrx_get_name_preset(SubGhzTxRx* instance, const char* preset);
|
|
|
|
SubGhzRadioPreset subghz_txrx_get_preset(SubGhzTxRx* instance);
|
2023-05-09 15:11:54 +03:00
|
|
|
|
2023-05-09 19:10:56 +03:00
|
|
|
void subghz_txrx_get_frequency_modulation(
|
|
|
|
SubGhzTxRx* instance,
|
2023-05-09 13:34:54 +03:00
|
|
|
FuriString* frequency,
|
|
|
|
FuriString* modulation,
|
|
|
|
bool long_name);
|
2023-05-09 19:50:01 +03:00
|
|
|
SubGhzTxRxStartTxState subghz_txrx_tx_start(SubGhzTxRx* instance, FlipperFormat* flipper_format);
|
2023-05-09 19:10:56 +03:00
|
|
|
void subghz_txrx_rx_start(SubGhzTxRx* instance);
|
|
|
|
void subghz_txrx_stop(SubGhzTxRx* instance);
|
|
|
|
void subghz_txrx_sleep(SubGhzTxRx* instance);
|
|
|
|
|
|
|
|
void subghz_txrx_hopper_update(SubGhzTxRx* instance);
|
|
|
|
SubGhzHopperState subghz_txrx_hopper_get_state(SubGhzTxRx* instance);
|
|
|
|
void subghz_txrx_hopper_set_state(SubGhzTxRx* instance, SubGhzHopperState state);
|
|
|
|
void subghz_txrx_hopper_remove_pause(SubGhzTxRx* instance);
|
2023-05-09 19:33:45 +03:00
|
|
|
void subghz_txrx_hopper_pause(SubGhzTxRx* instance);
|
2023-05-09 19:10:56 +03:00
|
|
|
|
|
|
|
void subghz_txrx_speaker_on(SubGhzTxRx* instance);
|
|
|
|
void subghz_txrx_speaker_off(SubGhzTxRx* instance);
|
|
|
|
void subghz_txrx_speaker_mute(SubGhzTxRx* instance);
|
|
|
|
void subghz_txrx_speaker_unmute(SubGhzTxRx* instance);
|
|
|
|
void subghz_txrx_speaker_set_state(SubGhzTxRx* instance, SubGhzSpeakerState state);
|
|
|
|
SubGhzSpeakerState subghz_txrx_speaker_get_state(SubGhzTxRx* instance);
|
|
|
|
bool subghz_txrx_load_decoder_by_name_protocol(SubGhzTxRx* instance, const char* name_protocol);
|
|
|
|
SubGhzProtocolDecoderBase* subghz_txrx_get_decoder(SubGhzTxRx* instance);
|
2023-05-09 12:07:36 +03:00
|
|
|
|
|
|
|
void subghz_txrx_need_save_callback_set(
|
2023-05-09 19:10:56 +03:00
|
|
|
SubGhzTxRx* instance,
|
2023-05-09 12:07:36 +03:00
|
|
|
SubGhzTxRxNeedSaveCallback callback,
|
|
|
|
void* context);
|
2023-05-09 19:10:56 +03:00
|
|
|
FlipperFormat* subghz_txtx_get_fff_data(SubGhzTxRx* instance);
|
|
|
|
SubGhzSetting* subghz_txrx_get_setting(SubGhzTxRx* instance);
|
2023-05-09 12:07:36 +03:00
|
|
|
|
2023-05-09 19:10:56 +03:00
|
|
|
bool subghz_txrx_protocol_is_preserved(SubGhzTxRx* instance);
|
|
|
|
bool subghz_txrx_protocol_is_send(SubGhzTxRx* instance, bool check_type);
|
2023-05-09 15:22:08 +03:00
|
|
|
|
2023-05-09 19:10:56 +03:00
|
|
|
void subghz_txrx_receiver_set_filter(SubGhzTxRx* instance, SubGhzProtocolFlag filter);
|
2023-05-09 15:58:56 +03:00
|
|
|
|
2023-05-09 19:10:56 +03:00
|
|
|
void subghz_txrx_set_rx_calback(
|
|
|
|
SubGhzTxRx* instance,
|
|
|
|
SubGhzReceiverCallback callback,
|
|
|
|
void* context);
|
2023-05-09 18:24:25 +03:00
|
|
|
void subghz_txrx_set_raw_file_encoder_worker_set_callback_end(
|
2023-05-09 19:10:56 +03:00
|
|
|
SubGhzTxRx* instance,
|
2023-05-09 18:24:25 +03:00
|
|
|
SubGhzProtocolEncoderRAWCallbackEnd callback,
|
|
|
|
void* context);
|
|
|
|
|
2023-05-09 19:10:56 +03:00
|
|
|
void subghz_txrx_set_debug_pin_state(SubGhzTxRx* instance, bool state);
|
|
|
|
bool subghz_txrx_get_debug_pin_state(SubGhzTxRx* instance);
|
2023-05-09 18:24:38 +03:00
|
|
|
|
2023-05-09 19:10:56 +03:00
|
|
|
SubGhzReceiver* subghz_txrx_get_receiver(SubGhzTxRx* instance); // TODO use only in DecodeRaw
|