SubGhz: refactoring add descriptions (#1012)

* SubGhz: add descriptions
* SubGhz: fix syntax

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Skorpionm 2022-03-16 13:18:48 +04:00 committed by GitHub
parent 28888b0a22
commit 94ba7d104c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
54 changed files with 1732 additions and 185 deletions

View File

@ -177,7 +177,7 @@ SubGhz* subghz_alloc() {
subghz->txrx->environment, "/ext/subghz/assets/came_atomo");
subghz_environment_set_nice_flor_s_rainbow_table_file_name(
subghz->txrx->environment, "/ext/subghz/assets/nice_flor_s");
subghz->txrx->receiver = subghz_receiver_alloc(subghz->txrx->environment);
subghz->txrx->receiver = subghz_receiver_alloc_init(subghz->txrx->environment);
subghz_receiver_set_filter(subghz->txrx->receiver, SubGhzProtocolFlag_Decodable);
subghz_worker_set_overrun_callback(

View File

@ -246,7 +246,7 @@ void subghz_cli_command_rx(Cli* cli, string_t args, void* context) {
subghz_environment_set_nice_flor_s_rainbow_table_file_name(
environment, "/ext/subghz/assets/nice_flor_s");
SubGhzReceiver* receiver = subghz_receiver_alloc(environment);
SubGhzReceiver* receiver = subghz_receiver_alloc_init(environment);
subghz_receiver_set_filter(receiver, SubGhzProtocolFlag_Decodable);
subghz_receiver_set_rx_callback(receiver, subghz_cli_command_rx_callback, instance);

View File

@ -13,5 +13,16 @@ struct SubGhzBlockDecoder {
uint8_t decode_count_bit;
};
/**
* Add data bit when decoding.
* @param decoder Pointer to a SubGhzBlockDecoder instance
* @param bit data, 1bit
*/
void subghz_protocol_blocks_add_bit(SubGhzBlockDecoder* decoder, uint8_t bit);
/**
* Getting the hash sum of the last randomly received parcel.
* @param decoder Pointer to a SubGhzBlockDecoder instance
* @return hash Hash sum
*/
uint8_t subghz_protocol_blocks_get_hash_data(SubGhzBlockDecoder* decoder, size_t len);

View File

@ -19,12 +19,32 @@ struct SubGhzBlockGeneric {
uint16_t cnt;
};
/**
* Get modulation name.
* @param preset modulation,FuriHalSubGhzPreset
* @param preset_str Output modulation name
* @return true On success
*/
bool subghz_block_generic_get_preset_name(FuriHalSubGhzPreset preset, string_t preset_str);
/**
* Serialize data SubGhzBlockGeneric.
* @param instance Pointer to a SubGhzBlockGeneric instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param frequency The frequency at which the signal was received, Hz
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
* @return true On success
*/
bool subghz_block_generic_serialize(
SubGhzBlockGeneric* instance,
FlipperFormat* flipper_format,
uint32_t frequency,
FuriHalSubGhzPreset preset);
/**
* Deserialize data SubGhzBlockGeneric.
* @param instance Pointer to a SubGhzBlockGeneric instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_block_generic_deserialize(SubGhzBlockGeneric* instance, FlipperFormat* flipper_format);

View File

@ -10,4 +10,10 @@
#define bit_write(value, bit, bitvalue) (bitvalue ? bit_set(value, bit) : bit_clear(value, bit))
#define DURATION_DIFF(x, y) ((x < y) ? (y - x) : (x - y))
/**
* Flip the data bitwise.
* @param key In data
* @param count_bit number of data bits
* @return Reverse data
*/
uint64_t subghz_protocol_blocks_reverse_key(uint64_t key, uint8_t count_bit);

View File

@ -6,23 +6,61 @@
typedef struct SubGhzEnvironment SubGhzEnvironment;
/**
* Allocate SubGhzEnvironment.
* @return SubGhzEnvironment* pointer to a SubGhzEnvironment instance
*/
SubGhzEnvironment* subghz_environment_alloc();
/**
* Free SubGhzEnvironment.
* @param instance Pointer to a SubGhzEnvironment instance
*/
void subghz_environment_free(SubGhzEnvironment* instance);
/**
* Downloading the manufacture key file.
* @param instance Pointer to a SubGhzEnvironment instance
* @param filename Full path to the file
* @return true On succes
*/
bool subghz_environment_load_keystore(SubGhzEnvironment* instance, const char* filename);
/**
* Get pointer to a SubGhzKeystore* instance.
* @return SubGhzEnvironment* pointer to a SubGhzEnvironment instance
*/
SubGhzKeystore* subghz_environment_get_keystore(SubGhzEnvironment* instance);
/**
* Set filename to work with Came Atomo.
* @param instance Pointer to a SubGhzEnvironment instance
* @param filename Full path to the file
*/
void subghz_environment_set_came_atomo_rainbow_table_file_name(
SubGhzEnvironment* instance,
const char* filename);
/**
* Get filename to work with Came Atomo.
* @param instance Pointer to a SubGhzEnvironment instance
* @return Full path to the file
*/
const char* subghz_environment_get_came_atomo_rainbow_table_file_name(SubGhzEnvironment* instance);
/**
* Set filename to work with Nice Flor-S.
* @param instance Pointer to a SubGhzEnvironment instance
* @param filename Full path to the file
*/
void subghz_environment_set_nice_flor_s_rainbow_table_file_name(
SubGhzEnvironment* instance,
const char* filename);
/**
* Get filename to work with Nice Flor-S.
* @param instance Pointer to a SubGhzEnvironment instance
* @return Full path to the file
*/
const char*
subghz_environment_get_nice_flor_s_rainbow_table_file_name(SubGhzEnvironment* instance);

View File

@ -19,25 +19,55 @@ struct SubGhzProtocolDecoderBase {
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,
string_t output);
/**
* Serialize data SubGhzProtocolDecoderBase.
* @param decoder_base Pointer to a SubGhzProtocolDecoderBase instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param frequency The frequency at which the signal was received, Hz
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
* @return true On success
*/
bool subghz_protocol_decoder_base_serialize(
SubGhzProtocolDecoderBase* decoder_base,
FlipperFormat* flipper_format,
uint32_t frequency,
FuriHalSubGhzPreset 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

View File

@ -95,6 +95,11 @@ void subghz_protocol_encoder_came_free(void* context) {
free(instance);
}
/**
* Generating an upload from data.
* @param instance Pointer to a SubGhzProtocolEncoderCame instance
* @return true On success
*/
static bool subghz_protocol_encoder_came_get_upload(SubGhzProtocolEncoderCame* instance) {
furi_assert(instance);
size_t index = 0;

View File

@ -11,46 +11,81 @@ extern const SubGhzProtocolDecoder subghz_protocol_came_decoder;
extern const SubGhzProtocolEncoder subghz_protocol_came_encoder;
extern const SubGhzProtocol subghz_protocol_came;
/**
* Allocate SubGhzProtocolEncoderCame.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolEncoderCame* pointer to a SubGhzProtocolEncoderCame instance
*/
void* subghz_protocol_encoder_came_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolEncoderCame.
* @param context Pointer to a SubGhzProtocolEncoderCame instance
*/
void subghz_protocol_encoder_came_free(void* context);
/**
* Deserialize and generating an upload to send.
* @param context Pointer to a SubGhzProtocolEncoderCame instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_protocol_encoder_came_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Forced transmission stop.
* @param context Pointer to a SubGhzProtocolEncoderCame instance
*/
void subghz_protocol_encoder_came_stop(void* context);
/**
* Getting the level and duration of the upload to be loaded into DMA.
* @param context Pointer to a SubGhzProtocolEncoderCame instance
* @return LevelDuration
*/
LevelDuration subghz_protocol_encoder_came_yield(void* context);
/** Allocate SubGhzProtocolCame
*
* @return SubGhzProtocolCame*
/**
* Allocate SubGhzProtocolDecoderCame.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolDecoderCame* pointer to a SubGhzProtocolDecoderCame instance
*/
void* subghz_protocol_decoder_came_alloc(SubGhzEnvironment* environment);
/** Free SubGhzProtocolCame
*
* @param instance
/**
* Free SubGhzProtocolDecoderCame.
* @param context Pointer to a SubGhzProtocolDecoderCame instance
*/
void subghz_protocol_decoder_came_free(void* context);
/** Reset internal state
* @param instance - SubGhzProtocolCame instance
/**
* Reset decoder SubGhzProtocolDecoderCame.
* @param context Pointer to a SubGhzProtocolDecoderCame instance
*/
void subghz_protocol_decoder_came_reset(void* context);
/** Parse accepted duration
*
* @param instance - SubGhzProtocolCame instance
* @param data - LevelDuration level_duration
/**
* Parse a raw sequence of levels and durations received from the air.
* @param context Pointer to a SubGhzProtocolDecoderCame instance
* @param level Signal level true-high false-low
* @param duration Duration of this level in, us
*/
void subghz_protocol_decoder_came_feed(void* context, bool level, uint32_t duration);
/**
* Getting the hash sum of the last randomly received parcel.
* @param context Pointer to a SubGhzProtocolDecoderCame instance
* @return hash Hash sum
*/
uint8_t subghz_protocol_decoder_came_get_hash_data(void* context);
/** Outputting information from the parser
*
* @param instance - SubGhzProtocolCame* instance
* @param output - output string
/**
* Serialize data SubGhzProtocolDecoderCame.
* @param context Pointer to a SubGhzProtocolDecoderCame instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param frequency The frequency at which the signal was received, Hz
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
* @return true On success
*/
bool subghz_protocol_decoder_came_serialize(
void* context,
@ -58,6 +93,17 @@ bool subghz_protocol_decoder_came_serialize(
uint32_t frequency,
FuriHalSubGhzPreset preset);
/**
* Deserialize data SubGhzProtocolDecoderCame.
* @param context Pointer to a SubGhzProtocolDecoderCame instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_protocol_decoder_came_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Getting a textual representation of the received data.
* @param context Pointer to a SubGhzProtocolDecoderCame instance
* @param output Resulting text
*/
void subghz_protocol_decoder_came_get_string(void* context, string_t output);

View File

@ -186,10 +186,10 @@ void subghz_protocol_decoder_came_atomo_feed(void* context, bool level, uint32_t
}
}
/** Read bytes from rainbow table
*
* @param file_name - file name rainbow table
* @param number_atomo_magic_xor
/**
* Read bytes from rainbow table
* @param file_name Full path to rainbow table the file
* @param number_atomo_magic_xor Сell number in the array
* @return atomo_magic_xor
*/
static uint64_t subghz_protocol_came_atomo_get_magic_xor_in_file(
@ -211,9 +211,10 @@ static uint64_t subghz_protocol_came_atomo_get_magic_xor_in_file(
return atomo_magic_xor;
}
/** Analysis of received data
*
* @param instance SubGhzBlockGeneric instance
/**
* Analysis of received data
* @param instance Pointer to a SubGhzBlockGeneric* instance
* @param file_name Full path to rainbow table the file
*/
static void subghz_protocol_came_atomo_remote_controller(
SubGhzBlockGeneric* instance,

View File

@ -10,15 +10,65 @@ extern const SubGhzProtocolDecoder subghz_protocol_came_atomo_decoder;
extern const SubGhzProtocolEncoder subghz_protocol_came_atomo_encoder;
extern const SubGhzProtocol subghz_protocol_came_atomo;
/**
* Allocate SubGhzProtocolDecoderCameAtomo.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolDecoderCameAtomo* pointer to a SubGhzProtocolDecoderCameAtomo instance
*/
void* subghz_protocol_decoder_came_atomo_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolDecoderCameAtomo.
* @param context Pointer to a SubGhzProtocolDecoderCameAtomo instance
*/
void subghz_protocol_decoder_came_atomo_free(void* context);
/**
* Reset decoder SubGhzProtocolDecoderCameAtomo.
* @param context Pointer to a SubGhzProtocolDecoderCameAtomo instance
*/
void subghz_protocol_decoder_came_atomo_reset(void* context);
/**
* Parse a raw sequence of levels and durations received from the air.
* @param context Pointer to a SubGhzProtocolDecoderCameAtomo instance
* @param level Signal level true-high false-low
* @param duration Duration of this level in, us
*/
void subghz_protocol_decoder_came_atomo_feed(void* context, bool level, uint32_t duration);
/**
* Getting the hash sum of the last randomly received parcel.
* @param context Pointer to a SubGhzProtocolDecoderCameAtomo instance
* @return hash Hash sum
*/
uint8_t subghz_protocol_decoder_came_atomo_get_hash_data(void* context);
/**
* Serialize data SubGhzProtocolDecoderCameAtomo.
* @param context Pointer to a SubGhzProtocolDecoderCameAtomo instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param frequency The frequency at which the signal was received, Hz
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
* @return true On success
*/
bool subghz_protocol_decoder_came_atomo_serialize(
void* context,
FlipperFormat* flipper_format,
uint32_t frequency,
FuriHalSubGhzPreset preset);
/**
* Deserialize data SubGhzProtocolDecoderCameAtomo.
* @param context Pointer to a SubGhzProtocolDecoderCameAtomo instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_protocol_decoder_came_atomo_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Getting a textual representation of the received data.
* @param context Pointer to a SubGhzProtocolDecoderCameAtomo instance
* @param output Resulting text
*/
void subghz_protocol_decoder_came_atomo_get_string(void* context, string_t output);

View File

@ -22,6 +22,9 @@
(dip & 0x0008 ? '1' : '0'), (dip & 0x0004 ? '1' : '0'), (dip & 0x0002 ? '1' : '0'), \
(dip & 0x0001 ? '1' : '0')
/**
* Rainbow table Came Twee.
*/
static const uint32_t came_twee_magic_numbers_xor[15] = {
0x0E0E0E00,
0x1D1D1D11,
@ -148,6 +151,10 @@ static LevelDuration
return level_duration_make(data.level, data.duration);
}
/**
* Generating an upload from data.
* @param instance Pointer to a SubGhzProtocolEncoderCameTwee instance
*/
static void subghz_protocol_encoder_came_twee_get_upload(SubGhzProtocolEncoderCameTwee* instance) {
furi_assert(instance);
size_t index = 0;
@ -182,9 +189,9 @@ static void subghz_protocol_encoder_came_twee_get_upload(SubGhzProtocolEncoderCa
instance->encoder.size_upload = index;
}
/** Analysis of received data
*
* @param instance SubGhzProtocolCameTwee instance
/**
* Analysis of received data
* @param instance Pointer to a SubGhzBlockGeneric* instance
*/
static void subghz_protocol_came_twee_remote_controller(SubGhzBlockGeneric* instance) {
/* Came Twee 54 bit, rolling code 15 parcels with

View File

@ -11,20 +11,99 @@ extern const SubGhzProtocolDecoder subghz_protocol_came_twee_decoder;
extern const SubGhzProtocolEncoder subghz_protocol_came_twee_encoder;
extern const SubGhzProtocol subghz_protocol_came_twee;
/**
* Allocate SubGhzProtocolEncoderCameTwee.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolEncoderCameTwee* pointer to a SubGhzProtocolEncoderCameTwee instance
*/
void* subghz_protocol_encoder_came_twee_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolEncoderCameTwee.
* @param context Pointer to a SubGhzProtocolEncoderCameTwee instance
*/
void subghz_protocol_encoder_came_twee_free(void* context);
/**
* Deserialize and generating an upload to send.
* @param context Pointer to a SubGhzProtocolEncoderCameTwee instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_protocol_encoder_came_twee_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Forced transmission stop.
* @param context Pointer to a SubGhzProtocolEncoderCameTwee instance
*/
void subghz_protocol_encoder_came_twee_stop(void* context);
/**
* Getting the level and duration of the upload to be loaded into DMA.
* @param context Pointer to a SubGhzProtocolEncoderCameTwee instance
* @return LevelDuration
*/
LevelDuration subghz_protocol_encoder_came_twee_yield(void* context);
/**
* Allocate SubGhzProtocolDecoderCameTwee.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolDecoderCameTwee* pointer to a SubGhzProtocolDecoderCameTwee instance
*/
void* subghz_protocol_decoder_came_twee_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolDecoderCameTwee.
* @param context Pointer to a SubGhzProtocolDecoderCameTwee instance
*/
void subghz_protocol_decoder_came_twee_free(void* context);
/**
* Reset decoder SubGhzProtocolDecoderCameTwee.
* @param context Pointer to a SubGhzProtocolDecoderCameTwee instance
*/
void subghz_protocol_decoder_came_twee_reset(void* context);
/**
* Parse a raw sequence of levels and durations received from the air.
* @param context Pointer to a SubGhzProtocolDecoderCameTwee instance
* @param level Signal level true-high false-low
* @param duration Duration of this level in, us
*/
void subghz_protocol_decoder_came_twee_feed(void* context, bool level, uint32_t duration);
/**
* Getting the hash sum of the last randomly received parcel.
* @param context Pointer to a SubGhzProtocolDecoderCameTwee instance
* @return hash Hash sum
*/
uint8_t subghz_protocol_decoder_came_twee_get_hash_data(void* context);
/**
* Serialize data SubGhzProtocolDecoderCameTwee.
* @param context Pointer to a SubGhzProtocolDecoderCameTwee instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param frequency The frequency at which the signal was received, Hz
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
* @return true On success
*/
bool subghz_protocol_decoder_came_twee_serialize(
void* context,
FlipperFormat* flipper_format,
uint32_t frequency,
FuriHalSubGhzPreset preset);
/**
* Deserialize data SubGhzProtocolDecoderCameTwee.
* @param context Pointer to a SubGhzProtocolDecoderCameTwee instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_protocol_decoder_came_twee_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Getting a textual representation of the received data.
* @param context Pointer to a SubGhzProtocolDecoderCameTwee instance
* @param output Resulting text
*/
void subghz_protocol_decoder_came_twee_get_string(void* context, string_t output);

View File

@ -159,6 +159,10 @@ void subghz_protocol_decoder_faac_slh_feed(void* context, bool level, uint32_t d
}
}
/**
* Analysis of received data
* @param instance Pointer to a SubGhzBlockGeneric* instance
*/
static void subghz_protocol_faac_slh_check_remote_controller(SubGhzBlockGeneric* instance) {
uint64_t code_found_reverse =
subghz_protocol_blocks_reverse_key(instance->data, instance->data_count_bit);

View File

@ -11,15 +11,65 @@ extern const SubGhzProtocolDecoder subghz_protocol_faac_slh_decoder;
extern const SubGhzProtocolEncoder subghz_protocol_faac_slh_encoder;
extern const SubGhzProtocol subghz_protocol_faac_slh;
/**
* Allocate SubGhzProtocolDecoderFaacSLH.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolDecoderFaacSLH* pointer to a SubGhzProtocolDecoderFaacSLH instance
*/
void* subghz_protocol_decoder_faac_slh_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolDecoderFaacSLH.
* @param context Pointer to a SubGhzProtocolDecoderFaacSLH instance
*/
void subghz_protocol_decoder_faac_slh_free(void* context);
/**
* Reset decoder SubGhzProtocolDecoderFaacSLH.
* @param context Pointer to a SubGhzProtocolDecoderFaacSLH instance
*/
void subghz_protocol_decoder_faac_slh_reset(void* context);
/**
* Parse a raw sequence of levels and durations received from the air.
* @param context Pointer to a SubGhzProtocolDecoderFaacSLH instance
* @param level Signal level true-high false-low
* @param duration Duration of this level in, us
*/
void subghz_protocol_decoder_faac_slh_feed(void* context, bool level, uint32_t duration);
/**
* Getting the hash sum of the last randomly received parcel.
* @param context Pointer to a SubGhzProtocolDecoderFaacSLH instance
* @return hash Hash sum
*/
uint8_t subghz_protocol_decoder_faac_slh_get_hash_data(void* context);
/**
* Serialize data SubGhzProtocolDecoderFaacSLH.
* @param context Pointer to a SubGhzProtocolDecoderFaacSLH instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param frequency The frequency at which the signal was received, Hz
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
* @return true On success
*/
bool subghz_protocol_decoder_faac_slh_serialize(
void* context,
FlipperFormat* flipper_format,
uint32_t frequency,
FuriHalSubGhzPreset preset);
/**
* Deserialize data SubGhzProtocolDecoderFaacSLH.
* @param context Pointer to a SubGhzProtocolDecoderFaacSLH instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_protocol_decoder_faac_slh_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Getting a textual representation of the received data.
* @param context Pointer to a SubGhzProtocolDecoderFaacSLH instance
* @param output Resulting text
*/
void subghz_protocol_decoder_faac_slh_get_string(void* context, string_t output);

View File

@ -88,6 +88,11 @@ void subghz_protocol_encoder_gate_tx_free(void* context) {
free(instance);
}
/**
* Generating an upload from data.
* @param instance Pointer to a SubGhzProtocolEncoderGateTx instance
* @return true On success
*/
static bool subghz_protocol_encoder_gate_tx_get_upload(SubGhzProtocolEncoderGateTx* instance) {
furi_assert(instance);
size_t index = 0;
@ -258,6 +263,10 @@ void subghz_protocol_decoder_gate_tx_feed(void* context, bool level, uint32_t du
}
}
/**
* Analysis of received data
* @param instance Pointer to a SubGhzBlockGeneric* instance
*/
static void subghz_protocol_gate_tx_check_remote_controller(SubGhzBlockGeneric* instance) {
uint32_t code_found_reverse =
subghz_protocol_blocks_reverse_key(instance->data, instance->data_count_bit);

View File

@ -11,20 +11,99 @@ extern const SubGhzProtocolDecoder subghz_protocol_gate_tx_decoder;
extern const SubGhzProtocolEncoder subghz_protocol_gate_tx_encoder;
extern const SubGhzProtocol subghz_protocol_gate_tx;
/**
* Allocate SubGhzProtocolEncoderGateTx.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolEncoderGateTx* pointer to a SubGhzProtocolEncoderGateTx instance
*/
void* subghz_protocol_encoder_gate_tx_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolEncoderGateTx.
* @param context Pointer to a SubGhzProtocolEncoderGateTx instance
*/
void subghz_protocol_encoder_gate_tx_free(void* context);
/**
* Deserialize and generating an upload to send.
* @param context Pointer to a SubGhzProtocolEncoderGateTx instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_protocol_encoder_gate_tx_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Forced transmission stop.
* @param context Pointer to a SubGhzProtocolEncoderGateTx instance
*/
void subghz_protocol_encoder_gate_tx_stop(void* context);
/**
* Getting the level and duration of the upload to be loaded into DMA.
* @param context Pointer to a SubGhzProtocolEncoderGateTx instance
* @return LevelDuration
*/
LevelDuration subghz_protocol_encoder_gate_tx_yield(void* context);
/**
* Allocate SubGhzProtocolDecoderGateTx.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolDecoderGateTx* pointer to a SubGhzProtocolDecoderGateTx instance
*/
void* subghz_protocol_decoder_gate_tx_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolDecoderGateTx.
* @param context Pointer to a SubGhzProtocolDecoderGateTx instance
*/
void subghz_protocol_decoder_gate_tx_free(void* context);
/**
* Reset decoder SubGhzProtocolDecoderGateTx.
* @param context Pointer to a SubGhzProtocolDecoderGateTx instance
*/
void subghz_protocol_decoder_gate_tx_reset(void* context);
/**
* Parse a raw sequence of levels and durations received from the air.
* @param context Pointer to a SubGhzProtocolDecoderGateTx instance
* @param level Signal level true-high false-low
* @param duration Duration of this level in, us
*/
void subghz_protocol_decoder_gate_tx_feed(void* context, bool level, uint32_t duration);
/**
* Getting the hash sum of the last randomly received parcel.
* @param context Pointer to a SubGhzProtocolDecoderGateTx instance
* @return hash Hash sum
*/
uint8_t subghz_protocol_decoder_gate_tx_get_hash_data(void* context);
/**
* Serialize data SubGhzProtocolDecoderGateTx.
* @param context Pointer to a SubGhzProtocolDecoderGateTx instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param frequency The frequency at which the signal was received, Hz
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
* @return true On success
*/
bool subghz_protocol_decoder_gate_tx_serialize(
void* context,
FlipperFormat* flipper_format,
uint32_t frequency,
FuriHalSubGhzPreset preset);
/**
* Deserialize data SubGhzProtocolDecoderGateTx.
* @param context Pointer to a SubGhzProtocolDecoderGateTx instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_protocol_decoder_gate_tx_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Getting a textual representation of the received data.
* @param context Pointer to a SubGhzProtocolDecoderGateTx instance
* @param output Resulting text
*/
void subghz_protocol_decoder_gate_tx_get_string(void* context, string_t output);

View File

@ -91,6 +91,11 @@ void subghz_protocol_encoder_hormann_free(void* context) {
free(instance);
}
/**
* Generating an upload from data.
* @param instance Pointer to a SubGhzProtocolEncoderHormann instance
* @return true On success
*/
static bool subghz_protocol_encoder_hormann_get_upload(SubGhzProtocolEncoderHormann* instance) {
furi_assert(instance);
@ -285,6 +290,10 @@ void subghz_protocol_decoder_hormann_feed(void* context, bool level, uint32_t du
}
}
/**
* Analysis of received data
* @param instance Pointer to a SubGhzBlockGeneric* instance
*/
static void subghz_protocol_hormann_check_remote_controller(SubGhzBlockGeneric* instance) {
instance->btn = (instance->data >> 4) & 0xF;
}

View File

@ -11,20 +11,99 @@ extern const SubGhzProtocolDecoder subghz_protocol_hormann_decoder;
extern const SubGhzProtocolEncoder subghz_protocol_hormann_encoder;
extern const SubGhzProtocol subghz_protocol_hormann;
/**
* Allocate SubGhzProtocolEncoderHormann.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolEncoderHormann* pointer to a SubGhzProtocolEncoderHormann instance
*/
void* subghz_protocol_encoder_hormann_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolEncoderHormann.
* @param context Pointer to a SubGhzProtocolEncoderHormann instance
*/
void subghz_protocol_encoder_hormann_free(void* context);
/**
* Deserialize and generating an upload to send.
* @param context Pointer to a SubGhzProtocolEncoderHormann instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_protocol_encoder_hormann_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Forced transmission stop.
* @param context Pointer to a SubGhzProtocolEncoderHormann instance
*/
void subghz_protocol_encoder_hormann_stop(void* context);
/**
* Getting the level and duration of the upload to be loaded into DMA.
* @param context Pointer to a SubGhzProtocolEncoderHormann instance
* @return LevelDuration
*/
LevelDuration subghz_protocol_encoder_hormann_yield(void* context);
/**
* Allocate SubGhzProtocolDecoderHormann.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolDecoderHormann* pointer to a SubGhzProtocolDecoderHormann instance
*/
void* subghz_protocol_decoder_hormann_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolDecoderHormann.
* @param context Pointer to a SubGhzProtocolDecoderHormann instance
*/
void subghz_protocol_decoder_hormann_free(void* context);
/**
* Reset decoder SubGhzProtocolDecoderHormann.
* @param context Pointer to a SubGhzProtocolDecoderHormann instance
*/
void subghz_protocol_decoder_hormann_reset(void* context);
/**
* Parse a raw sequence of levels and durations received from the air.
* @param context Pointer to a SubGhzProtocolDecoderHormann instance
* @param level Signal level true-high false-low
* @param duration Duration of this level in, us
*/
void subghz_protocol_decoder_hormann_feed(void* context, bool level, uint32_t duration);
/**
* Getting the hash sum of the last randomly received parcel.
* @param context Pointer to a SubGhzProtocolDecoderHormann instance
* @return hash Hash sum
*/
uint8_t subghz_protocol_decoder_hormann_get_hash_data(void* context);
/**
* Serialize data SubGhzProtocolDecoderHormann.
* @param context Pointer to a SubGhzProtocolDecoderHormann instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param frequency The frequency at which the signal was received, Hz
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
* @return true On success
*/
bool subghz_protocol_decoder_hormann_serialize(
void* context,
FlipperFormat* flipper_format,
uint32_t frequency,
FuriHalSubGhzPreset preset);
/**
* Deserialize data SubGhzProtocolDecoderHormann.
* @param context Pointer to a SubGhzProtocolDecoderHormann instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_protocol_decoder_hormann_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Getting a textual representation of the received data.
* @param context Pointer to a SubGhzProtocolDecoderHormann instance
* @param output Resulting text
*/
void subghz_protocol_decoder_hormann_get_string(void* context, string_t output);

View File

@ -158,6 +158,10 @@ void subghz_protocol_decoder_ido_feed(void* context, bool level, uint32_t durati
}
}
/**
* Analysis of received data
* @param instance Pointer to a SubGhzBlockGeneric* instance
*/
static void subghz_protocol_ido_check_remote_controller(SubGhzBlockGeneric* instance) {
uint64_t code_found_reverse =
subghz_protocol_blocks_reverse_key(instance->data, instance->data_count_bit);

View File

@ -11,15 +11,65 @@ extern const SubGhzProtocolDecoder subghz_protocol_ido_decoder;
extern const SubGhzProtocolEncoder subghz_protocol_ido_encoder;
extern const SubGhzProtocol subghz_protocol_ido;
/**
* Allocate SubGhzProtocolDecoderIDo.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolDecoderIDo* pointer to a SubGhzProtocolDecoderIDo instance
*/
void* subghz_protocol_decoder_ido_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolDecoderIDo.
* @param context Pointer to a SubGhzProtocolDecoderIDo instance
*/
void subghz_protocol_decoder_ido_free(void* context);
/**
* Reset decoder SubGhzProtocolDecoderIDo.
* @param context Pointer to a SubGhzProtocolDecoderIDo instance
*/
void subghz_protocol_decoder_ido_reset(void* context);
/**
* Parse a raw sequence of levels and durations received from the air.
* @param context Pointer to a SubGhzProtocolDecoderIDo instance
* @param level Signal level true-high false-low
* @param duration Duration of this level in, us
*/
void subghz_protocol_decoder_ido_feed(void* context, bool level, uint32_t duration);
/**
* Getting the hash sum of the last randomly received parcel.
* @param context Pointer to a SubGhzProtocolDecoderIDo instance
* @return hash Hash sum
*/
uint8_t subghz_protocol_decoder_ido_get_hash_data(void* context);
/**
* Serialize data SubGhzProtocolDecoderIDo.
* @param context Pointer to a SubGhzProtocolDecoderIDo instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param frequency The frequency at which the signal was received, Hz
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
* @return true On success
*/
bool subghz_protocol_decoder_ido_serialize(
void* context,
FlipperFormat* flipper_format,
uint32_t frequency,
FuriHalSubGhzPreset preset);
/**
* Deserialize data SubGhzProtocolDecoderIDo.
* @param context Pointer to a SubGhzProtocolDecoderIDo instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_protocol_decoder_ido_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Getting a textual representation of the received data.
* @param context Pointer to a SubGhzProtocolDecoderIDo instance
* @param output Resulting text
*/
void subghz_protocol_decoder_ido_get_string(void* context, string_t output);

View File

@ -81,6 +81,12 @@ const SubGhzProtocol subghz_protocol_keeloq = {
.encoder = &subghz_protocol_keeloq_encoder,
};
/**
* Analysis of received data
* @param instance Pointer to a SubGhzBlockGeneric* instance
* @param keystore Pointer to a SubGhzKeystore* instance
* @param manufacture_name
*/
static void subghz_protocol_keeloq_check_remote_controller(
SubGhzBlockGeneric* instance,
SubGhzKeystore* keystore,
@ -107,6 +113,11 @@ void subghz_protocol_encoder_keeloq_free(void* context) {
free(instance);
}
/**
* Key generation from simple data
* @param instance Pointer to a SubGhzProtocolEncoderKeeloq* instance
* @param btn Button number, 4 bit
*/
static bool subghz_protocol_keeloq_gen_data(SubGhzProtocolEncoderKeeloq* instance, uint8_t btn) {
instance->generic.cnt++;
uint32_t fix = btn << 28 | instance->generic.serial;
@ -179,15 +190,18 @@ bool subghz_protocol_keeloq_create_data(
return res;
}
/**
* Generating an upload from data.
* @param instance Pointer to a SubGhzProtocolEncoderKeeloq instance
* @return true On success
*/
static bool
subghz_protocol_encoder_keeloq_get_upload(SubGhzProtocolEncoderKeeloq* instance, uint8_t btn) {
furi_assert(instance);
//gen new key
if(subghz_protocol_keeloq_gen_data(instance, btn)) {
//ToDo Update display data
// if(instance->common.callback)
// instance->common.callback((SubGhzProtocolCommon*)instance, instance->common.context);
//ToDo if you need to add a callback to automatically update the data on the display
} else {
return false;
}
@ -419,6 +433,14 @@ void subghz_protocol_decoder_keeloq_feed(void* context, bool level, uint32_t dur
}
}
/**
* Validation of decrypt data.
* @param instance Pointer to a SubGhzBlockGeneric instance
* @param decrypt Decrypd data
* @param btn Button number, 4 bit
* @param end_serial decrement the last 10 bits of the serial number
* @return true On success
*/
static inline bool subghz_protocol_keeloq_check_decrypt(
SubGhzBlockGeneric* instance,
uint32_t decrypt,
@ -433,11 +455,13 @@ static inline bool subghz_protocol_keeloq_check_decrypt(
return false;
}
/** Checking the accepted code against the database manafacture key
*
* @param instance SubGhzProtocolKeeloq instance
* @param fix fix part of the parcel
* @param hop hop encrypted part of the parcel
/**
* Checking the accepted code against the database manafacture key
* @param instance Pointer to a SubGhzBlockGeneric* instance
* @param fix Fix part of the parcel
* @param hop Hop encrypted part of the parcel
* @param keystore Pointer to a SubGhzKeystore* instance
* @param manufacture_name
* @return true on successful search
*/
static uint8_t subghz_protocol_keeloq_check_remote_controller_selector(
@ -575,10 +599,6 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector(
return 0;
}
/** Analysis of received data
*
* @param instance SubGhzProtocolKeeloq instance
*/
static void subghz_protocol_keeloq_check_remote_controller(
SubGhzBlockGeneric* instance,
SubGhzKeystore* keystore,

View File

@ -11,8 +11,31 @@ extern const SubGhzProtocolDecoder subghz_protocol_keeloq_decoder;
extern const SubGhzProtocolEncoder subghz_protocol_keeloq_encoder;
extern const SubGhzProtocol subghz_protocol_keeloq;
/**
* Allocate SubGhzProtocolEncoderKeeloq.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolEncoderKeeloq* pointer to a SubGhzProtocolEncoderKeeloq instance
*/
void* subghz_protocol_encoder_keeloq_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolEncoderKeeloq.
* @param context Pointer to a SubGhzProtocolEncoderKeeloq instance
*/
void subghz_protocol_encoder_keeloq_free(void* context);
/**
* Key generation from simple data.
* @param context Pointer to a SubGhzProtocolEncoderKeeloq instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param serial Serial number, 28 bit
* @param btn Button number, 4 bit
* @param cnt Container value, 16 bit
* @param manufacture_name Name of manufacturer's key
* @param frequency Transmission frequency, Hz
* @param preset Modulation, FuriHalSubGhzPreset
* @return true On success
*/
bool subghz_protocol_keeloq_create_data(
void* context,
FlipperFormat* flipper_format,
@ -22,18 +45,87 @@ bool subghz_protocol_keeloq_create_data(
const char* manufacture_name,
uint32_t frequency,
FuriHalSubGhzPreset preset);
/**
* Deserialize and generating an upload to send.
* @param context Pointer to a SubGhzProtocolEncoderKeeloq instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_protocol_encoder_keeloq_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Forced transmission stop.
* @param context Pointer to a SubGhzProtocolEncoderKeeloq instance
*/
void subghz_protocol_encoder_keeloq_stop(void* context);
/**
* Getting the level and duration of the upload to be loaded into DMA.
* @param context Pointer to a SubGhzProtocolEncoderKeeloq instance
* @return LevelDuration
*/
LevelDuration subghz_protocol_encoder_keeloq_yield(void* context);
/**
* Allocate SubGhzProtocolDecoderKeeloq.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolDecoderKeeloq* pointer to a SubGhzProtocolDecoderKeeloq instance
*/
void* subghz_protocol_decoder_keeloq_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolDecoderKeeloq.
* @param context Pointer to a SubGhzProtocolDecoderKeeloq instance
*/
void subghz_protocol_decoder_keeloq_free(void* context);
/**
* Reset decoder SubGhzProtocolDecoderKeeloq.
* @param context Pointer to a SubGhzProtocolDecoderKeeloq instance
*/
void subghz_protocol_decoder_keeloq_reset(void* context);
/**
* Parse a raw sequence of levels and durations received from the air.
* @param context Pointer to a SubGhzProtocolDecoderKeeloq instance
* @param level Signal level true-high false-low
* @param duration Duration of this level in, us
*/
void subghz_protocol_decoder_keeloq_feed(void* context, bool level, uint32_t duration);
/**
* Getting the hash sum of the last randomly received parcel.
* @param context Pointer to a SubGhzProtocolDecoderKeeloq instance
* @return hash Hash sum
*/
uint8_t subghz_protocol_decoder_keeloq_get_hash_data(void* context);
/**
* Serialize data SubGhzProtocolDecoderKeeloq.
* @param context Pointer to a SubGhzProtocolDecoderKeeloq instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param frequency The frequency at which the signal was received, Hz
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
* @return true On success
*/
bool subghz_protocol_decoder_keeloq_serialize(
void* context,
FlipperFormat* flipper_format,
uint32_t frequency,
FuriHalSubGhzPreset preset);
/**
* Deserialize data SubGhzProtocolDecoderKeeloq.
* @param context Pointer to a SubGhzProtocolDecoderKeeloq instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_protocol_decoder_keeloq_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Getting a textual representation of the received data.
* @param context Pointer to a SubGhzProtocolDecoderKeeloq instance
* @param output Resulting text
*/
void subghz_protocol_decoder_keeloq_get_string(void* context, string_t output);

View File

@ -10,7 +10,6 @@
* https://phreakerclub.com/forum/showthread.php?t=1094
*
*/
#define KEELOQ_NLF 0x3A5C742E
#define bit(x, n) (((x) >> (n)) & 1)
#define g5(x, a, b, c, d, e) \
@ -26,41 +25,44 @@
#define KEELOQ_LEARNING_SECURE 3u
#define KEELOQ_LEARNING_MAGIC_XOR_TYPE_1 4u
/** Simple Learning Encrypt
/**
* Simple Learning Encrypt
* @param data - 0xBSSSCCCC, B(4bit) key, S(10bit) serial&0x3FF, C(16bit) counter
* @param key - manufacture (64bit)
* @return keeloq encrypt data
*/
uint32_t subghz_protocol_keeloq_common_encrypt(const uint32_t data, const uint64_t key);
/** Simple Learning Decrypt
/**
* Simple Learning Decrypt
* @param data - keeloq encrypt data
* @param key - manufacture (64bit)
* @return 0xBSSSCCCC, B(4bit) key, S(10bit) serial&0x3FF, C(16bit) counter
*/
uint32_t subghz_protocol_keeloq_common_decrypt(const uint32_t data, const uint64_t key);
/** Normal Learning
/**
* Normal Learning
* @param data - serial number (28bit)
* @param key - manufacture (64bit)
* @return manufacture for this serial number (64bit)
*/
uint64_t subghz_protocol_keeloq_common_normal_learning(uint32_t data, const uint64_t key);
/** Secure Learning
/**
* Secure Learning
* @param data - serial number (28bit)
* @param seed - seed number (32bit)
* @param key - manufacture (64bit)
* @return manufacture for this serial number (64bit)
*/
uint64_t
subghz_protocol_keeloq_common_secure_learning(uint32_t data, uint32_t seed, const uint64_t key);
/** Magic_xor_type1 Learning
/**
* Magic_xor_type1 Learning
* @param data - serial number (28bit)
* @param xor - magic xor (64bit)
* @return manufacture for this serial number (64bit)
*/
uint64_t subghz_protocol_keeloq_common_magic_xor_type1_learning(uint32_t data, uint64_t xor);

View File

@ -203,9 +203,9 @@ uint8_t subghz_protocol_kia_crc8(uint8_t* data, size_t len) {
return crc;
}
/** Analysis of received data
*
* @param instance SubGhzProtocolKIA instance
/**
* Analysis of received data
* @param instance Pointer to a SubGhzBlockGeneric* instance
*/
static void subghz_protocol_kia_check_remote_controller(SubGhzBlockGeneric* instance) {
/*

View File

@ -11,15 +11,65 @@ extern const SubGhzProtocolDecoder subghz_protocol_kia_decoder;
extern const SubGhzProtocolEncoder subghz_protocol_kia_encoder;
extern const SubGhzProtocol subghz_protocol_kia;
/**
* Allocate SubGhzProtocolDecoderKIA.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolDecoderKIA* pointer to a SubGhzProtocolDecoderKIA instance
*/
void* subghz_protocol_decoder_kia_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolDecoderKIA.
* @param context Pointer to a SubGhzProtocolDecoderKIA instance
*/
void subghz_protocol_decoder_kia_free(void* context);
/**
* Reset decoder SubGhzProtocolDecoderKIA.
* @param context Pointer to a SubGhzProtocolDecoderKIA instance
*/
void subghz_protocol_decoder_kia_reset(void* context);
/**
* Parse a raw sequence of levels and durations received from the air.
* @param context Pointer to a SubGhzProtocolDecoderKIA instance
* @param level Signal level true-high false-low
* @param duration Duration of this level in, us
*/
void subghz_protocol_decoder_kia_feed(void* context, bool level, uint32_t duration);
/**
* Getting the hash sum of the last randomly received parcel.
* @param context Pointer to a SubGhzProtocolDecoderKIA instance
* @return hash Hash sum
*/
uint8_t subghz_protocol_decoder_kia_get_hash_data(void* context);
/**
* Serialize data SubGhzProtocolDecoderKIA.
* @param context Pointer to a SubGhzProtocolDecoderKIA instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param frequency The frequency at which the signal was received, Hz
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
* @return true On success
*/
bool subghz_protocol_decoder_kia_serialize(
void* context,
FlipperFormat* flipper_format,
uint32_t frequency,
FuriHalSubGhzPreset preset);
/**
* Deserialize data SubGhzProtocolDecoderKIA.
* @param context Pointer to a SubGhzProtocolDecoderKIA instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_protocol_decoder_kia_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Getting a textual representation of the received data.
* @param context Pointer to a SubGhzProtocolDecoderKIA instance
* @param output Resulting text
*/
void subghz_protocol_decoder_kia_get_string(void* context, string_t output);

View File

@ -90,6 +90,11 @@ void subghz_protocol_encoder_nero_radio_free(void* context) {
free(instance);
}
/**
* Generating an upload from data.
* @param instance Pointer to a SubGhzProtocolEncoderNeroRadio instance
* @return true On success
*/
static bool
subghz_protocol_encoder_nero_radio_get_upload(SubGhzProtocolEncoderNeroRadio* instance) {
furi_assert(instance);

View File

@ -11,20 +11,99 @@ extern const SubGhzProtocolDecoder subghz_protocol_nero_radio_decoder;
extern const SubGhzProtocolEncoder subghz_protocol_nero_radio_encoder;
extern const SubGhzProtocol subghz_protocol_nero_radio;
/**
* Allocate SubGhzProtocolEncoderNeroRadio.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolEncoderNeroRadio* pointer to a SubGhzProtocolEncoderNeroRadio instance
*/
void* subghz_protocol_encoder_nero_radio_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolEncoderNeroRadio.
* @param context Pointer to a SubGhzProtocolEncoderNeroRadio instance
*/
void subghz_protocol_encoder_nero_radio_free(void* context);
/**
* Deserialize and generating an upload to send.
* @param context Pointer to a SubGhzProtocolEncoderNeroRadio instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_protocol_encoder_nero_radio_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Forced transmission stop.
* @param context Pointer to a SubGhzProtocolEncoderNeroRadio instance
*/
void subghz_protocol_encoder_nero_radio_stop(void* context);
/**
* Getting the level and duration of the upload to be loaded into DMA.
* @param context Pointer to a SubGhzProtocolEncoderNeroRadio instance
* @return LevelDuration
*/
LevelDuration subghz_protocol_encoder_nero_radio_yield(void* context);
/**
* Allocate SubGhzProtocolDecoderNeroRadio.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolDecoderNeroRadio* pointer to a SubGhzProtocolDecoderNeroRadio instance
*/
void* subghz_protocol_decoder_nero_radio_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolDecoderNeroRadio.
* @param context Pointer to a SubGhzProtocolDecoderNeroRadio instance
*/
void subghz_protocol_decoder_nero_radio_free(void* context);
/**
* Reset decoder SubGhzProtocolDecoderNeroRadio.
* @param context Pointer to a SubGhzProtocolDecoderNeroRadio instance
*/
void subghz_protocol_decoder_nero_radio_reset(void* context);
/**
* Parse a raw sequence of levels and durations received from the air.
* @param context Pointer to a SubGhzProtocolDecoderNeroRadio instance
* @param level Signal level true-high false-low
* @param duration Duration of this level in, us
*/
void subghz_protocol_decoder_nero_radio_feed(void* context, bool level, uint32_t duration);
/**
* Getting the hash sum of the last randomly received parcel.
* @param context Pointer to a SubGhzProtocolDecoderNeroRadio instance
* @return hash Hash sum
*/
uint8_t subghz_protocol_decoder_nero_radio_get_hash_data(void* context);
/**
* Serialize data SubGhzProtocolDecoderNeroRadio.
* @param context Pointer to a SubGhzProtocolDecoderNeroRadio instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param frequency The frequency at which the signal was received, Hz
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
* @return true On success
*/
bool subghz_protocol_decoder_nero_radio_serialize(
void* context,
FlipperFormat* flipper_format,
uint32_t frequency,
FuriHalSubGhzPreset preset);
/**
* Deserialize data SubGhzProtocolDecoderNeroRadio.
* @param context Pointer to a SubGhzProtocolDecoderNeroRadio instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_protocol_decoder_nero_radio_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Getting a textual representation of the received data.
* @param context Pointer to a SubGhzProtocolDecoderNeroRadio instance
* @param output Resulting text
*/
void subghz_protocol_decoder_nero_radio_get_string(void* context, string_t output);

View File

@ -95,6 +95,11 @@ void subghz_protocol_encoder_nero_sketch_free(void* context) {
free(instance);
}
/**
* Generating an upload from data.
* @param instance Pointer to a SubGhzProtocolEncoderNeroSketch instance
* @return true On success
*/
static bool
subghz_protocol_encoder_nero_sketch_get_upload(SubGhzProtocolEncoderNeroSketch* instance) {
furi_assert(instance);

View File

@ -11,20 +11,99 @@ extern const SubGhzProtocolDecoder subghz_protocol_nero_sketch_decoder;
extern const SubGhzProtocolEncoder subghz_protocol_nero_sketch_encoder;
extern const SubGhzProtocol subghz_protocol_nero_sketch;
/**
* Allocate SubGhzProtocolEncoderNeroSketch.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolEncoderNeroSketch* pointer to a SubGhzProtocolEncoderNeroSketch instance
*/
void* subghz_protocol_encoder_nero_sketch_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolEncoderNeroSketch.
* @param context Pointer to a SubGhzProtocolEncoderNeroSketch instance
*/
void subghz_protocol_encoder_nero_sketch_free(void* context);
/**
* Deserialize and generating an upload to send.
* @param context Pointer to a SubGhzProtocolEncoderNeroSketch instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_protocol_encoder_nero_sketch_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Forced transmission stop.
* @param context Pointer to a SubGhzProtocolEncoderNeroSketch instance
*/
void subghz_protocol_encoder_nero_sketch_stop(void* context);
/**
* Getting the level and duration of the upload to be loaded into DMA.
* @param context Pointer to a SubGhzProtocolEncoderNeroSketch instance
* @return LevelDuration
*/
LevelDuration subghz_protocol_encoder_nero_sketch_yield(void* context);
/**
* Allocate SubGhzProtocolDecoderNeroSketch.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolDecoderNeroSketch* pointer to a SubGhzProtocolDecoderNeroSketch instance
*/
void* subghz_protocol_decoder_nero_sketch_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolDecoderNeroSketch.
* @param context Pointer to a SubGhzProtocolDecoderNeroSketch instance
*/
void subghz_protocol_decoder_nero_sketch_free(void* context);
/**
* Reset decoder SubGhzProtocolDecoderNeroSketch.
* @param context Pointer to a SubGhzProtocolDecoderNeroSketch instance
*/
void subghz_protocol_decoder_nero_sketch_reset(void* context);
/**
* Parse a raw sequence of levels and durations received from the air.
* @param context Pointer to a SubGhzProtocolDecoderNeroSketch instance
* @param level Signal level true-high false-low
* @param duration Duration of this level in, us
*/
void subghz_protocol_decoder_nero_sketch_feed(void* context, bool level, uint32_t duration);
/**
* Getting the hash sum of the last randomly received parcel.
* @param context Pointer to a SubGhzProtocolDecoderNeroSketch instance
* @return hash Hash sum
*/
uint8_t subghz_protocol_decoder_nero_sketch_get_hash_data(void* context);
/**
* Serialize data SubGhzProtocolDecoderNeroSketch.
* @param context Pointer to a SubGhzProtocolDecoderNeroSketch instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param frequency The frequency at which the signal was received, Hz
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
* @return true On success
*/
bool subghz_protocol_decoder_nero_sketch_serialize(
void* context,
FlipperFormat* flipper_format,
uint32_t frequency,
FuriHalSubGhzPreset preset);
/**
* Deserialize data SubGhzProtocolDecoderNeroSketch.
* @param context Pointer to a SubGhzProtocolDecoderNeroSketch instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_protocol_decoder_nero_sketch_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Getting a textual representation of the received data.
* @param context Pointer to a SubGhzProtocolDecoderNeroSketch instance
* @param output Resulting text
*/
void subghz_protocol_decoder_nero_sketch_get_string(void* context, string_t output);

View File

@ -94,6 +94,11 @@ void subghz_protocol_encoder_nice_flo_free(void* context) {
free(instance);
}
/**
* Generating an upload from data.
* @param instance Pointer to a SubGhzProtocolEncoderNiceFlo instance
* @return true On success
*/
static bool subghz_protocol_encoder_nice_flo_get_upload(SubGhzProtocolEncoderNiceFlo* instance) {
furi_assert(instance);
size_t index = 0;

View File

@ -11,20 +11,99 @@ extern const SubGhzProtocolDecoder subghz_protocol_nice_flo_decoder;
extern const SubGhzProtocolEncoder subghz_protocol_nice_flo_encoder;
extern const SubGhzProtocol subghz_protocol_nice_flo;
/**
* Allocate SubGhzProtocolEncoderNiceFlo.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolEncoderNiceFlo* pointer to a SubGhzProtocolEncoderNiceFlo instance
*/
void* subghz_protocol_encoder_nice_flo_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolEncoderNiceFlo.
* @param context Pointer to a SubGhzProtocolEncoderNiceFlo instance
*/
void subghz_protocol_encoder_nice_flo_free(void* context);
/**
* Deserialize and generating an upload to send.
* @param context Pointer to a SubGhzProtocolEncoderNiceFlo instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_protocol_encoder_nice_flo_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Forced transmission stop.
* @param context Pointer to a SubGhzProtocolEncoderNiceFlo instance
*/
void subghz_protocol_encoder_nice_flo_stop(void* context);
/**
* Getting the level and duration of the upload to be loaded into DMA.
* @param context Pointer to a SubGhzProtocolEncoderNiceFlo instance
* @return LevelDuration
*/
LevelDuration subghz_protocol_encoder_nice_flo_yield(void* context);
/**
* Allocate SubGhzProtocolDecoderNiceFlo.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolDecoderNiceFlo* pointer to a SubGhzProtocolDecoderNiceFlo instance
*/
void* subghz_protocol_decoder_nice_flo_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolDecoderNiceFlo.
* @param context Pointer to a SubGhzProtocolDecoderNiceFlo instance
*/
void subghz_protocol_decoder_nice_flo_free(void* context);
/**
* Reset decoder SubGhzProtocolDecoderNiceFlo.
* @param context Pointer to a SubGhzProtocolDecoderNiceFlo instance
*/
void subghz_protocol_decoder_nice_flo_reset(void* context);
/**
* Parse a raw sequence of levels and durations received from the air.
* @param context Pointer to a SubGhzProtocolDecoderNiceFlo instance
* @param level Signal level true-high false-low
* @param duration Duration of this level in, us
*/
void subghz_protocol_decoder_nice_flo_feed(void* context, bool level, uint32_t duration);
/**
* Getting the hash sum of the last randomly received parcel.
* @param context Pointer to a SubGhzProtocolDecoderNiceFlo instance
* @return hash Hash sum
*/
uint8_t subghz_protocol_decoder_nice_flo_get_hash_data(void* context);
void subghz_protocol_decoder_nice_flo_get_string(void* context, string_t output);
/**
* Serialize data SubGhzProtocolDecoderNiceFlo.
* @param context Pointer to a SubGhzProtocolDecoderNiceFlo instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param frequency The frequency at which the signal was received, Hz
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
* @return true On success
*/
bool subghz_protocol_decoder_nice_flo_serialize(
void* context,
FlipperFormat* flipper_format,
uint32_t frequency,
FuriHalSubGhzPreset preset);
/**
* Deserialize data SubGhzProtocolDecoderNiceFlo.
* @param context Pointer to a SubGhzProtocolDecoderNiceFlo instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_protocol_decoder_nice_flo_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Getting a textual representation of the received data.
* @param context Pointer to a SubGhzProtocolDecoderNiceFlo instance
* @param output Resulting text
*/
void subghz_protocol_decoder_nice_flo_get_string(void* context, string_t output);

View File

@ -76,11 +76,11 @@ const SubGhzProtocol subghz_protocol_nice_flor_s = {
.encoder = &subghz_protocol_nice_flor_s_encoder,
};
/** Read bytes from rainbow table
*
* @param instance - SubGhzProtocolNiceFlorS* instance
* @param address - address byte
* @return byte data
/**
* Read bytes from rainbow table
* @param file_name Full path to rainbow table the file
* @param address Byte address in file
* @return data
*/
static uint8_t
subghz_protocol_nice_flor_s_get_byte_in_file(const char* file_name, uint32_t address) {
@ -277,9 +277,10 @@ void subghz_protocol_decoder_nice_flor_s_feed(void* context, bool level, uint32_
}
}
/** Decrypt protocol Nice Flor S
*
* @param instance - SubGhzProtocolNiceFlorS* instance
/**
* Analysis of received data
* @param instance Pointer to a SubGhzBlockGeneric* instance
* @param file_name Full path to rainbow table the file
*/
static void subghz_protocol_nice_flor_s_remote_controller(
SubGhzBlockGeneric* instance,

View File

@ -11,15 +11,65 @@ extern const SubGhzProtocolDecoder subghz_protocol_nice_flor_s_decoder;
extern const SubGhzProtocolEncoder subghz_protocol_nice_flor_s_encoder;
extern const SubGhzProtocol subghz_protocol_nice_flor_s;
/**
* Allocate SubGhzProtocolDecoderNiceFlorS.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolDecoderNiceFlorS* pointer to a SubGhzProtocolDecoderNiceFlorS instance
*/
void* subghz_protocol_decoder_nice_flor_s_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolDecoderNiceFlorS.
* @param context Pointer to a SubGhzProtocolDecoderNiceFlorS instance
*/
void subghz_protocol_decoder_nice_flor_s_free(void* context);
/**
* Reset decoder SubGhzProtocolDecoderNiceFlorS.
* @param context Pointer to a SubGhzProtocolDecoderNiceFlorS instance
*/
void subghz_protocol_decoder_nice_flor_s_reset(void* context);
/**
* Parse a raw sequence of levels and durations received from the air.
* @param context Pointer to a SubGhzProtocolDecoderNiceFlorS instance
* @param level Signal level true-high false-low
* @param duration Duration of this level in, us
*/
void subghz_protocol_decoder_nice_flor_s_feed(void* context, bool level, uint32_t duration);
/**
* Getting the hash sum of the last randomly received parcel.
* @param context Pointer to a SubGhzProtocolDecoderNiceFlorS instance
* @return hash Hash sum
*/
uint8_t subghz_protocol_decoder_nice_flor_s_get_hash_data(void* context);
/**
* Serialize data SubGhzProtocolDecoderNiceFlorS.
* @param context Pointer to a SubGhzProtocolDecoderNiceFlorS instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param frequency The frequency at which the signal was received, Hz
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
* @return true On success
*/
bool subghz_protocol_decoder_nice_flor_s_serialize(
void* context,
FlipperFormat* flipper_format,
uint32_t frequency,
FuriHalSubGhzPreset preset);
/**
* Deserialize data SubGhzProtocolDecoderNiceFlorS.
* @param context Pointer to a SubGhzProtocolDecoderNiceFlorS instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_protocol_decoder_nice_flor_s_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Getting a textual representation of the received data.
* @param context Pointer to a SubGhzProtocolDecoderNiceFlorS instance
* @param output Resulting text
*/
void subghz_protocol_decoder_nice_flor_s_get_string(void* context, string_t output);

View File

@ -98,6 +98,11 @@ void subghz_protocol_encoder_princeton_free(void* context) {
free(instance);
}
/**
* Generating an upload from data.
* @param instance Pointer to a SubGhzProtocolEncoderPrinceton instance
* @return true On success
*/
static bool
subghz_protocol_encoder_princeton_get_upload(SubGhzProtocolEncoderPrinceton* instance) {
furi_assert(instance);

View File

@ -11,20 +11,99 @@ extern const SubGhzProtocolDecoder subghz_protocol_princeton_decoder;
extern const SubGhzProtocolEncoder subghz_protocol_princeton_encoder;
extern const SubGhzProtocol subghz_protocol_princeton;
/**
* Allocate SubGhzProtocolEncoderPrinceton.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolEncoderPrinceton* pointer to a SubGhzProtocolEncoderPrinceton instance
*/
void* subghz_protocol_encoder_princeton_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolEncoderPrinceton.
* @param context Pointer to a SubGhzProtocolEncoderPrinceton instance
*/
void subghz_protocol_encoder_princeton_free(void* context);
/**
* Deserialize and generating an upload to send.
* @param context Pointer to a SubGhzProtocolEncoderPrinceton instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_protocol_encoder_princeton_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Forced transmission stop.
* @param context Pointer to a SubGhzProtocolEncoderPrinceton instance
*/
void subghz_protocol_encoder_princeton_stop(void* context);
/**
* Getting the level and duration of the upload to be loaded into DMA.
* @param context Pointer to a SubGhzProtocolEncoderPrinceton instance
* @return LevelDuration
*/
LevelDuration subghz_protocol_encoder_princeton_yield(void* context);
/**
* Allocate SubGhzProtocolDecoderPrinceton.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolDecoderPrinceton* pointer to a SubGhzProtocolDecoderPrinceton instance
*/
void* subghz_protocol_decoder_princeton_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolDecoderPrinceton.
* @param context Pointer to a SubGhzProtocolDecoderPrinceton instance
*/
void subghz_protocol_decoder_princeton_free(void* context);
/**
* Reset decoder SubGhzProtocolDecoderPrinceton.
* @param context Pointer to a SubGhzProtocolDecoderPrinceton instance
*/
void subghz_protocol_decoder_princeton_reset(void* context);
/**
* Parse a raw sequence of levels and durations received from the air.
* @param context Pointer to a SubGhzProtocolDecoderPrinceton instance
* @param level Signal level true-high false-low
* @param duration Duration of this level in, us
*/
void subghz_protocol_decoder_princeton_feed(void* context, bool level, uint32_t duration);
/**
* Getting the hash sum of the last randomly received parcel.
* @param context Pointer to a SubGhzProtocolDecoderPrinceton instance
* @return hash Hash sum
*/
uint8_t subghz_protocol_decoder_princeton_get_hash_data(void* context);
/**
* Serialize data SubGhzProtocolDecoderPrinceton.
* @param context Pointer to a SubGhzProtocolDecoderPrinceton instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param frequency The frequency at which the signal was received, Hz
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
* @return true On success
*/
bool subghz_protocol_decoder_princeton_serialize(
void* context,
FlipperFormat* flipper_format,
uint32_t frequency,
FuriHalSubGhzPreset preset);
/**
* Deserialize data SubGhzProtocolDecoderPrinceton.
* @param context Pointer to a SubGhzProtocolDecoderPrinceton instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_protocol_decoder_princeton_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Getting a textual representation of the received data.
* @param context Pointer to a SubGhzProtocolDecoderPrinceton instance
* @param output Resulting text
*/
void subghz_protocol_decoder_princeton_get_string(void* context, string_t output);

View File

@ -9,21 +9,29 @@ typedef struct SubGhzEncoderPrinceton SubGhzEncoderPrinceton;
typedef void (*SubGhzDecoderPrincetonCallback)(SubGhzDecoderPrinceton* parser, void* context);
/** Allocate SubGhzEncoderPrinceton
/**
* Allocate SubGhzEncoderPrinceton
* @return pointer to SubGhzEncoderPrinceton instance
*/
SubGhzEncoderPrinceton* subghz_encoder_princeton_for_testing_alloc();
/** Free SubGhzEncoderPrinceton instance
/**
* Free SubGhzEncoderPrinceton instance
* @param instance - SubGhzEncoderPrinceton instance
*/
void subghz_encoder_princeton_for_testing_free(SubGhzEncoderPrinceton* instance);
/**
* Forced transmission stop.
* @param instance Pointer to a SubGhzEncoderPrinceton instance
* @param time_stop Transmission stop time, ms
*/
void subghz_encoder_princeton_for_testing_stop(
SubGhzEncoderPrinceton* instance,
uint32_t time_stop);
/** Set new encoder params
/**
* Set new encoder params
* @param instance - SubGhzEncoderPrinceton instance
* @param key - 24bit key
* @param repeat - how many times to repeat
@ -35,31 +43,34 @@ void subghz_encoder_princeton_for_testing_set(
size_t repeat,
uint32_t frequency);
/** Get repeat count left
/**
* Get repeat count left
* @param instance - SubGhzEncoderPrinceton instance
* @return repeat count left
*/
size_t subghz_encoder_princeton_for_testing_get_repeat_left(SubGhzEncoderPrinceton* instance);
/** Print encoder log
/**
* Print encoder log
* @param instance - SubGhzEncoderPrinceton instance
*/
void subghz_encoder_princeton_for_testing_print_log(void* context);
/** Get level duration
/**
* Get level duration
* @param instance - SubGhzEncoderPrinceton instance
* @return level duration
*/
LevelDuration subghz_encoder_princeton_for_testing_yield(void* context);
/** Allocate SubGhzDecoderPrinceton
*
/**
* Allocate SubGhzDecoderPrinceton
* @return SubGhzDecoderPrinceton*
*/
SubGhzDecoderPrinceton* subghz_decoder_princeton_for_testing_alloc();
/** Free SubGhzDecoderPrinceton
*
/**
* Free SubGhzDecoderPrinceton
* @param instance
*/
void subghz_decoder_princeton_for_testing_free(SubGhzDecoderPrinceton* instance);
@ -69,13 +80,14 @@ void subghz_decoder_princeton_for_testing_set_callback(
SubGhzDecoderPrincetonCallback callback,
void* context);
/** Reset internal state
/**
* Reset internal state
* @param instance - SubGhzDecoderPrinceton instance
*/
void subghz_decoder_princeton_for_testing_reset(SubGhzDecoderPrinceton* instance);
/** Parse accepted duration
*
/**
* Parse accepted duration
* @param instance - SubGhzDecoderPrinceton instance
* @param data - LevelDuration level_duration
*/

View File

@ -13,28 +13,121 @@ extern const SubGhzProtocolDecoder subghz_protocol_raw_decoder;
extern const SubGhzProtocolEncoder subghz_protocol_raw_encoder;
extern const SubGhzProtocol subghz_protocol_raw;
/**
* Open file for writing
* @param instance Pointer to a SubGhzProtocolDecoderRAW instance
* @param dev_name File name
* @param frequency The frequency at which the signal was received, Hz
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
* @return true On success
*/
bool subghz_protocol_raw_save_to_file_init(
SubGhzProtocolDecoderRAW* instance,
const char* dev_name,
uint32_t frequency,
FuriHalSubGhzPreset preset);
/**
* Stop writing file to flash
* @param instance Pointer to a SubGhzProtocolDecoderRAW instance
*/
void subghz_protocol_raw_save_to_file_stop(SubGhzProtocolDecoderRAW* instance);
/**
* Get the number of samples received SubGhzProtocolDecoderRAW.
* @param instance Pointer to a SubGhzProtocolDecoderRAW instance
* @return count of samples
*/
size_t subghz_protocol_raw_get_sample_write(SubGhzProtocolDecoderRAW* instance);
/**
* Allocate SubGhzProtocolDecoderRAW.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolDecoderRAW* pointer to a SubGhzProtocolDecoderRAW instance
*/
void* subghz_protocol_decoder_raw_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolDecoderRAW.
* @param context Pointer to a SubGhzProtocolDecoderRAW instance
*/
void subghz_protocol_decoder_raw_free(void* context);
/**
* Reset decoder SubGhzProtocolDecoderRAW.
* @param context Pointer to a SubGhzProtocolDecoderRAW instance
*/
void subghz_protocol_decoder_raw_reset(void* context);
/**
* Parse a raw sequence of levels and durations received from the air.
* @param context Pointer to a SubGhzProtocolDecoderRAW instance
* @param level Signal level true-high false-low
* @param duration Duration of this level in, us
*/
void subghz_protocol_decoder_raw_feed(void* context, bool level, uint32_t duration);
/**
* Getting a textual representation of the received data.
* @param context Pointer to a SubGhzProtocolDecoderRAW instance
* @param output Resulting text
*/
void subghz_protocol_decoder_raw_get_string(void* context, string_t output);
/**
* Allocate SubGhzProtocolEncoderRAW.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolEncoderRAW* pointer to a SubGhzProtocolEncoderRAW instance
*/
void* subghz_protocol_encoder_raw_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolEncoderRAW.
* @param context Pointer to a SubGhzProtocolEncoderRAW instance
*/
void subghz_protocol_encoder_raw_free(void* context);
/**
* Forced transmission stop.
* @param context Pointer to a SubGhzProtocolEncoderRAW instance
*/
void subghz_protocol_encoder_raw_stop(void* context);
/**
* Сallback on completion of file transfer.
* @param context Pointer to a SubGhzProtocolEncoderRAW instance
*/
void subghz_protocol_raw_file_encoder_worker_callback_end(void* context);
/**
* Set callback on completion of file transfer.
* @param instance Pointer to a SubGhzProtocolEncoderRAW instance
* @param callback_end Callback, SubGhzProtocolEncoderRAWCallbackEnd
* @param context_end Context
*/
void subghz_protocol_raw_file_encoder_worker_set_callback_end(
SubGhzProtocolEncoderRAW* instance,
SubGhzProtocolEncoderRAWCallbackEnd callback_end,
void* context_end);
/**
* File generation for RAW work.
* @param flipper_format Pointer to a FlipperFormat instance
* @param file_name File name
*/
void subghz_protocol_raw_gen_fff_data(FlipperFormat* flipper_format, const char* file_name);
/**
* Deserialize and generating an upload to send.
* @param context Pointer to a SubGhzProtocolEncoderRAW instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_protocol_encoder_raw_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Getting the level and duration of the upload to be loaded into DMA.
* @param context Pointer to a SubGhzProtocolEncoderRAW instance
* @return LevelDuration
*/
LevelDuration subghz_protocol_encoder_raw_yield(void* context);

View File

@ -2,8 +2,22 @@
#include "../types.h"
/**
* Registration by name SubGhzProtocol.
* @param name Protocol name
* @return SubGhzProtocol* pointer to a SubGhzProtocol instance
*/
const SubGhzProtocol* subghz_protocol_registry_get_by_name(const char* name);
/**
* Registration protocol by index in array SubGhzProtocol.
* @param index Protocol by index in array
* @return SubGhzProtocol* pointer to a SubGhzProtocol instance
*/
const SubGhzProtocol* subghz_protocol_registry_get_by_index(size_t index);
/**
* Getting the number of registered protocols.
* @return Number of protocols
*/
size_t subghz_protocol_registry_count();

View File

@ -200,9 +200,10 @@ void subghz_protocol_decoder_scher_khan_feed(void* context, bool level, uint32_t
}
}
/** Analysis of received data
*
* @param instance SubGhzProtocolScherKhan instance
/**
* Analysis of received data
* @param instance Pointer to a SubGhzBlockGeneric* instance
* @param protocol_name
*/
static void subghz_protocol_scher_khan_check_remote_controller(
SubGhzBlockGeneric* instance,

View File

@ -11,15 +11,65 @@ extern const SubGhzProtocolDecoder subghz_protocol_scher_khan_decoder;
extern const SubGhzProtocolEncoder subghz_protocol_scher_khan_encoder;
extern const SubGhzProtocol subghz_protocol_scher_khan;
/**
* Allocate SubGhzProtocolDecoderScherKhan.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolDecoderScherKhan* pointer to a SubGhzProtocolDecoderScherKhan instance
*/
void* subghz_protocol_decoder_scher_khan_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolDecoderScherKhan.
* @param context Pointer to a SubGhzProtocolDecoderScherKhan instance
*/
void subghz_protocol_decoder_scher_khan_free(void* context);
/**
* Reset decoder SubGhzProtocolDecoderScherKhan.
* @param context Pointer to a SubGhzProtocolDecoderScherKhan instance
*/
void subghz_protocol_decoder_scher_khan_reset(void* context);
/**
* Parse a raw sequence of levels and durations received from the air.
* @param context Pointer to a SubGhzProtocolDecoderScherKhan instance
* @param level Signal level true-high false-low
* @param duration Duration of this level in, us
*/
void subghz_protocol_decoder_scher_khan_feed(void* context, bool level, uint32_t duration);
/**
* Getting the hash sum of the last randomly received parcel.
* @param context Pointer to a SubGhzProtocolDecoderScherKhan instance
* @return hash Hash sum
*/
uint8_t subghz_protocol_decoder_scher_khan_get_hash_data(void* context);
/**
* Serialize data SubGhzProtocolDecoderScherKhan.
* @param context Pointer to a SubGhzProtocolDecoderScherKhan instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param frequency The frequency at which the signal was received, Hz
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
* @return true On success
*/
bool subghz_protocol_decoder_scher_khan_serialize(
void* context,
FlipperFormat* flipper_format,
uint32_t frequency,
FuriHalSubGhzPreset preset);
/**
* Deserialize data SubGhzProtocolDecoderScherKhan.
* @param context Pointer to a SubGhzProtocolDecoderScherKhan instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_protocol_decoder_scher_khan_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Getting a textual representation of the received data.
* @param context Pointer to a SubGhzProtocolDecoderScherKhan instance
* @param output Resulting text
*/
void subghz_protocol_decoder_scher_khan_get_string(void* context, string_t output);

View File

@ -99,6 +99,11 @@ void subghz_protocol_decoder_somfy_keytis_reset(void* context) {
NULL);
}
/**
* Сhecksum calculation.
* @param data Вata for checksum calculation
* @return CRC
*/
static uint8_t subghz_protocol_somfy_keytis_crc(uint64_t data) {
uint8_t crc = 0;
data &= 0xFFF0FFFFFFFFFF;
@ -231,9 +236,9 @@ void subghz_protocol_decoder_somfy_keytis_feed(void* context, bool level, uint32
}
}
/** Analysis of received data
*
* @param instance SubGhzProtocolSomfyKeytis instance
/**
* Analysis of received data
* @param instance Pointer to a SubGhzBlockGeneric* instance
*/
static void subghz_protocol_somfy_keytis_check_remote_controller(SubGhzBlockGeneric* instance) {
//https://pushstack.wordpress.com/somfy-rts-protocol/
@ -341,6 +346,10 @@ static void subghz_protocol_somfy_keytis_check_remote_controller(SubGhzBlockGene
instance->serial = data & 0xFFFFFF;
}
/**
* Get button name.
* @param btn Button number, 4 bit
*/
static const char* subghz_protocol_somfy_keytis_get_name_button(uint8_t btn) {
const char* name_btn[0x10] = {
"Unknown",

View File

@ -11,15 +11,65 @@ extern const SubGhzProtocolDecoder subghz_protocol_somfy_keytis_decoder;
extern const SubGhzProtocolEncoder subghz_protocol_somfy_keytis_encoder;
extern const SubGhzProtocol subghz_protocol_somfy_keytis;
/**
* Allocate SubGhzProtocolDecoderSomfyKeytis.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolDecoderSomfyKeytis* pointer to a SubGhzProtocolDecoderSomfyKeytis instance
*/
void* subghz_protocol_decoder_somfy_keytis_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolDecoderSomfyKeytis.
* @param context Pointer to a SubGhzProtocolDecoderSomfyKeytis instance
*/
void subghz_protocol_decoder_somfy_keytis_free(void* context);
/**
* Reset decoder SubGhzProtocolDecoderSomfyKeytis.
* @param context Pointer to a SubGhzProtocolDecoderSomfyKeytis instance
*/
void subghz_protocol_decoder_somfy_keytis_reset(void* context);
/**
* Parse a raw sequence of levels and durations received from the air.
* @param context Pointer to a SubGhzProtocolDecoderSomfyKeytis instance
* @param level Signal level true-high false-low
* @param duration Duration of this level in, us
*/
void subghz_protocol_decoder_somfy_keytis_feed(void* context, bool level, uint32_t duration);
/**
* Getting the hash sum of the last randomly received parcel.
* @param context Pointer to a SubGhzProtocolDecoderSomfyKeytis instance
* @return hash Hash sum
*/
uint8_t subghz_protocol_decoder_somfy_keytis_get_hash_data(void* context);
/**
* Serialize data SubGhzProtocolDecoderSomfyKeytis.
* @param context Pointer to a SubGhzProtocolDecoderSomfyKeytis instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param frequency The frequency at which the signal was received, Hz
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
* @return true On success
*/
bool subghz_protocol_decoder_somfy_keytis_serialize(
void* context,
FlipperFormat* flipper_format,
uint32_t frequency,
FuriHalSubGhzPreset preset);
/**
* Deserialize data SubGhzProtocolDecoderSomfyKeytis.
* @param context Pointer to a SubGhzProtocolDecoderSomfyKeytis instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_protocol_decoder_somfy_keytis_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Getting a textual representation of the received data.
* @param context Pointer to a SubGhzProtocolDecoderSomfyKeytis instance
* @param output Resulting text
*/
void subghz_protocol_decoder_somfy_keytis_get_string(void* context, string_t output);

View File

@ -98,6 +98,11 @@ void subghz_protocol_decoder_somfy_telis_reset(void* context) {
NULL);
}
/**
* Сhecksum calculation.
* @param data Вata for checksum calculation
* @return CRC
*/
static uint8_t subghz_protocol_somfy_telis_crc(uint64_t data) {
uint8_t crc = 0;
data &= 0xFFF0FFFFFFFFFF;
@ -225,9 +230,9 @@ void subghz_protocol_decoder_somfy_telis_feed(void* context, bool level, uint32_
}
}
/** Analysis of received data
*
* @param instance SubGhzProtocolSomfyTelis instance
/**
* Analysis of received data
* @param instance Pointer to a SubGhzBlockGeneric* instance
*/
static void subghz_protocol_somfy_telis_check_remote_controller(SubGhzBlockGeneric* instance) {
//https://pushstack.wordpress.com/somfy-rts-protocol/
@ -298,6 +303,10 @@ static void subghz_protocol_somfy_telis_check_remote_controller(SubGhzBlockGener
instance->serial = data & 0xFFFFFF;
}
/**
* Get button name.
* @param btn Button number, 4 bit
*/
static const char* subghz_protocol_somfy_telis_get_name_button(uint8_t btn) {
const char* name_btn[0x10] = {
"Unknown",

View File

@ -11,15 +11,65 @@ extern const SubGhzProtocolDecoder subghz_protocol_somfy_telis_decoder;
extern const SubGhzProtocolEncoder subghz_protocol_somfy_telis_encoder;
extern const SubGhzProtocol subghz_protocol_somfy_telis;
/**
* Allocate SubGhzProtocolDecoderSomfyTelis.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolDecoderSomfyTelis* pointer to a SubGhzProtocolDecoderSomfyTelis instance
*/
void* subghz_protocol_decoder_somfy_telis_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolDecoderSomfyTelis.
* @param context Pointer to a SubGhzProtocolDecoderSomfyTelis instance
*/
void subghz_protocol_decoder_somfy_telis_free(void* context);
/**
* Reset decoder SubGhzProtocolDecoderSomfyTelis.
* @param context Pointer to a SubGhzProtocolDecoderSomfyTelis instance
*/
void subghz_protocol_decoder_somfy_telis_reset(void* context);
/**
* Parse a raw sequence of levels and durations received from the air.
* @param context Pointer to a SubGhzProtocolDecoderSomfyTelis instance
* @param level Signal level true-high false-low
* @param duration Duration of this level in, us
*/
void subghz_protocol_decoder_somfy_telis_feed(void* context, bool level, uint32_t duration);
/**
* Getting the hash sum of the last randomly received parcel.
* @param context Pointer to a SubGhzProtocolDecoderSomfyTelis instance
* @return hash Hash sum
*/
uint8_t subghz_protocol_decoder_somfy_telis_get_hash_data(void* context);
/**
* Serialize data SubGhzProtocolDecoderSomfyTelis.
* @param context Pointer to a SubGhzProtocolDecoderSomfyTelis instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param frequency The frequency at which the signal was received, Hz
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
* @return true On success
*/
bool subghz_protocol_decoder_somfy_telis_serialize(
void* context,
FlipperFormat* flipper_format,
uint32_t frequency,
FuriHalSubGhzPreset preset);
/**
* Deserialize data SubGhzProtocolDecoderSomfyTelis.
* @param context Pointer to a SubGhzProtocolDecoderSomfyTelis instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_protocol_decoder_somfy_telis_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Getting a textual representation of the received data.
* @param context Pointer to a SubGhzProtocolDecoderSomfyTelis instance
* @param output Resulting text
*/
void subghz_protocol_decoder_somfy_telis_get_string(void* context, string_t output);

View File

@ -181,6 +181,14 @@ void subghz_protocol_decoder_star_line_feed(void* context, bool level, uint32_t
}
}
/**
* Validation of decrypt data.
* @param instance Pointer to a SubGhzBlockGeneric instance
* @param decrypt Decrypd data
* @param btn Button number, 4 bit
* @param end_serial decrement the last 10 bits of the serial number
* @return true On success
*/
static inline bool subghz_protocol_star_line_check_decrypt(
SubGhzBlockGeneric* instance,
uint32_t decrypt,
@ -194,11 +202,13 @@ static inline bool subghz_protocol_star_line_check_decrypt(
return false;
}
/** Checking the accepted code against the database manafacture key
*
* @param instance SubGhzProtocolStarLine instance
* @param fix fix part of the parcel
* @param hop hop encrypted part of the parcel
/**
* Checking the accepted code against the database manafacture key
* @param instance Pointer to a SubGhzBlockGeneric* instance
* @param fix Fix part of the parcel
* @param hop Hop encrypted part of the parcel
* @param keystore Pointer to a SubGhzKeystore* instance
* @param manufacture_name
* @return true on successful search
*/
static uint8_t subghz_protocol_star_line_check_remote_controller_selector(
@ -279,9 +289,11 @@ static uint8_t subghz_protocol_star_line_check_remote_controller_selector(
return 0;
}
/** Analysis of received data
*
* @param instance SubGhzProtocolStarLine instance
/**
* Analysis of received data
* @param instance Pointer to a SubGhzBlockGeneric* instance
* @param keystore Pointer to a SubGhzKeystore* instance
* @param manufacture_name
*/
static void subghz_protocol_star_line_check_remote_controller(
SubGhzBlockGeneric* instance,

View File

@ -11,15 +11,65 @@ extern const SubGhzProtocolDecoder subghz_protocol_star_line_decoder;
extern const SubGhzProtocolEncoder subghz_protocol_star_line_encoder;
extern const SubGhzProtocol subghz_protocol_star_line;
/**
* Allocate SubGhzProtocolDecoderStarLine.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolDecoderStarLine* pointer to a SubGhzProtocolDecoderStarLine instance
*/
void* subghz_protocol_decoder_star_line_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolDecoderStarLine.
* @param context Pointer to a SubGhzProtocolDecoderStarLine instance
*/
void subghz_protocol_decoder_star_line_free(void* context);
/**
* Reset decoder SubGhzProtocolDecoderStarLine.
* @param context Pointer to a SubGhzProtocolDecoderStarLine instance
*/
void subghz_protocol_decoder_star_line_reset(void* context);
/**
* Parse a raw sequence of levels and durations received from the air.
* @param context Pointer to a SubGhzProtocolDecoderStarLine instance
* @param level Signal level true-high false-low
* @param duration Duration of this level in, us
*/
void subghz_protocol_decoder_star_line_feed(void* context, bool level, uint32_t duration);
/**
* Getting the hash sum of the last randomly received parcel.
* @param context Pointer to a SubGhzProtocolDecoderStarLine instance
* @return hash Hash sum
*/
uint8_t subghz_protocol_decoder_star_line_get_hash_data(void* context);
/**
* Serialize data SubGhzProtocolDecoderStarLine.
* @param context Pointer to a SubGhzProtocolDecoderStarLine instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param frequency The frequency at which the signal was received, Hz
* @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
* @return true On success
*/
bool subghz_protocol_decoder_star_line_serialize(
void* context,
FlipperFormat* flipper_format,
uint32_t frequency,
FuriHalSubGhzPreset preset);
/**
* Deserialize data SubGhzProtocolDecoderStarLine.
* @param context Pointer to a SubGhzProtocolDecoderStarLine instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_protocol_decoder_star_line_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Getting a textual representation of the received data.
* @param context Pointer to a SubGhzProtocolDecoderStarLine instance
* @param output Resulting text
*/
void subghz_protocol_decoder_star_line_get_string(void* context, string_t output);

View File

@ -19,7 +19,7 @@ struct SubGhzReceiver {
void* context;
};
SubGhzReceiver* subghz_receiver_alloc(SubGhzEnvironment* environment) {
SubGhzReceiver* subghz_receiver_alloc_init(SubGhzEnvironment* environment) {
SubGhzReceiver* instance = malloc(sizeof(SubGhzReceiver));
SubGhzReceiverSlotArray_init(instance->slots);

View File

@ -10,19 +10,56 @@ typedef void (*SubGhzReceiverCallback)(
SubGhzProtocolDecoderBase* decoder_base,
void* context);
SubGhzReceiver* subghz_receiver_alloc(SubGhzEnvironment* environment);
/**
* 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);

View File

@ -6,8 +6,8 @@ typedef void (*SubGhzFileEncoderWorkerCallbackEnd)(void* context);
typedef struct SubGhzFileEncoderWorker SubGhzFileEncoderWorker;
/** End callback SubGhzWorker
*
/**
* End callback SubGhzWorker.
* @param instance SubGhzFileEncoderWorker instance
* @param callback SubGhzFileEncoderWorkerCallbackEnd callback
*/
@ -16,36 +16,41 @@ void subghz_file_encoder_worker_callback_end(
SubGhzFileEncoderWorkerCallbackEnd callback_end,
void* context_end);
/** Allocate SubGhzFileEncoderWorker
*
* @return SubGhzFileEncoderWorker*
/**
* Allocate SubGhzFileEncoderWorker.
* @return SubGhzFileEncoderWorker* pointer to a SubGhzFileEncoderWorker instance
*/
SubGhzFileEncoderWorker* subghz_file_encoder_worker_alloc();
/** Free SubGhzFileEncoderWorker
*
* @param instance SubGhzFileEncoderWorker instance
/**
* Free SubGhzFileEncoderWorker.
* @param instance Pointer to a SubGhzFileEncoderWorker instance
*/
void subghz_file_encoder_worker_free(SubGhzFileEncoderWorker* instance);
/**
* Getting the level and duration of the upload to be loaded into DMA.
* @param context Pointer to a SubGhzFileEncoderWorker instance
* @return LevelDuration
*/
LevelDuration subghz_file_encoder_worker_get_level_duration(void* context);
/** Start SubGhzFileEncoderWorker
*
* @param instance SubGhzFileEncoderWorker instance
/**
* Start SubGhzFileEncoderWorker.
* @param instance Pointer to a SubGhzFileEncoderWorker instance
* @return bool - true if ok
*/
bool subghz_file_encoder_worker_start(SubGhzFileEncoderWorker* instance, const char* file_path);
/** Stop SubGhzFileEncoderWorker
*
* @param instance SubGhzFileEncoderWorker instance
/**
* Stop SubGhzFileEncoderWorker
* @param instance Pointer to a SubGhzFileEncoderWorker instance
*/
void subghz_file_encoder_worker_stop(SubGhzFileEncoderWorker* instance);
/** Check if worker is running
*
* @param instance SubGhzFileEncoderWorker instance
/**
* Check if worker is running
* @param instance Pointer to a SubGhzFileEncoderWorker instance
* @return bool - true if running
*/
bool subghz_file_encoder_worker_is_running(SubGhzFileEncoderWorker* instance);

View File

@ -16,54 +16,57 @@ ARRAY_DEF(SubGhzKeyArray, SubGhzKey, M_POD_OPLIST)
typedef struct SubGhzKeystore SubGhzKeystore;
/** Allocate SubGhzKeystore
*
* @return SubGhzKeystore*
/**
* Allocate SubGhzKeystore.
* @return SubGhzKeystore* pointer to a SubGhzKeystore instance
*/
SubGhzKeystore* subghz_keystore_alloc();
/** Free SubGhzKeystore
*
* @param instance
/**
* Free SubGhzKeystore.
* @param instance Pointer to a SubGhzKeystore instance
*/
void subghz_keystore_free(SubGhzKeystore* instance);
/** Loading manufacture key from file
*
* @param instance - SubGhzKeystore instance
* @param filename - const char* full path to the file
/**
* Loading manufacture key from file
* @param instance Pointer to a SubGhzKeystore instance
* @param filename Full path to the file
*/
bool subghz_keystore_load(SubGhzKeystore* instance, const char* filename);
/** Save manufacture key to file
*
* @param instance - SubGhzKeystore instance
* @param filename - const char* full path to the file
/**
* Save manufacture key to file
* @param instance Pointer to a SubGhzKeystore instance
* @param filename Full path to the file
* @return true On success
*/
bool subghz_keystore_save(SubGhzKeystore* instance, const char* filename, uint8_t* iv);
/** Get array of keys and names manufacture
*
* @param instance - SubGhzKeystore instance
/**
* Get array of keys and names manufacture
* @param instance Pointer to a SubGhzKeystore instance
* @return SubGhzKeyArray_t*
*/
SubGhzKeyArray_t* subghz_keystore_get_data(SubGhzKeystore* instance);
/** Save RAW encrypted to file
*
* @param input_file_name - const char* full path to the input file
* @param output_file_name - const char* full path to the output file
/**
* Save RAW encrypted to file
* @param input_file_name Full path to the input file
* @param output_file_name Full path to the output file
* @param iv IV, 16 bytes in hex
*/
bool subghz_keystore_raw_encrypted_save(
const char* input_file_name,
const char* output_file_name,
uint8_t* iv);
/** Get decrypt RAW data to file
*
* @param file_name - const char* full path to the input file
* @param offset - offset from the start of the RAW data
* @param data - returned array
* @param len - required data length
/**
* Get decrypt RAW data to file
* @param file_name Full path to the input file
* @param offset Offset from the start of the RAW data
* @param data Returned array
* @param len Required data length
* @return true On success
*/
bool subghz_keystore_raw_get_data(const char* file_name, size_t offset, uint8_t* data, size_t len);

View File

@ -12,34 +12,34 @@ typedef enum {
SubGhzTxRxWorkerStatusRx,
} SubGhzTxRxWorkerStatus;
/** SubGhzTxRxWorker, add data to transfer
*
* @param instance SubGhzTxRxWorker instance
/**
* SubGhzTxRxWorker, add data to transfer
* @param instance Pointer to a SubGhzTxRxWorker instance
* @param data *data
* @param size data size
* @return bool true if ok
*/
bool subghz_tx_rx_worker_write(SubGhzTxRxWorker* instance, uint8_t* data, size_t size);
/** SubGhzTxRxWorker, get available data
*
* @param instance SubGhzTxRxWorker instance
/**
* SubGhzTxRxWorker, get available data
* @param instance Pointer to a SubGhzTxRxWorker instance
* @return size_t data size
*/
size_t subghz_tx_rx_worker_available(SubGhzTxRxWorker* instance);
/** SubGhzTxRxWorker, read data
*
* @param instance SubGhzTxRxWorker instance
/**
* SubGhzTxRxWorker, read data
* @param instance Pointer to a SubGhzTxRxWorker instance
* @param data *data
* @param size max data size, which can be read
* @return size_t data size, how much is actually read
*/
size_t subghz_tx_rx_worker_read(SubGhzTxRxWorker* instance, uint8_t* data, size_t size);
/** Сallback SubGhzTxRxWorker when there is data to read in an empty buffer
*
* @param instance SubGhzTxRxWorker instance
/**
* Сallback SubGhzTxRxWorker when there is data to read in an empty buffer
* @param instance Pointer to a SubGhzTxRxWorker instance
* @param callback SubGhzTxRxWorkerCallbackHaveRead callback
* @param context
*/
@ -48,34 +48,34 @@ void subghz_tx_rx_worker_set_callback_have_read(
SubGhzTxRxWorkerCallbackHaveRead callback,
void* context);
/** Allocate SubGhzTxRxWorker
*
* @return SubGhzTxRxWorker*
/**
* Allocate SubGhzTxRxWorker
* @return SubGhzTxRxWorker* Pointer to a SubGhzTxRxWorker instance
*/
SubGhzTxRxWorker* subghz_tx_rx_worker_alloc();
/** Free SubGhzTxRxWorker
*
* @param instance SubGhzTxRxWorker instance
/**
* Free SubGhzTxRxWorker
* @param instance Pointer to a SubGhzTxRxWorker instance
*/
void subghz_tx_rx_worker_free(SubGhzTxRxWorker* instance);
/** Start SubGhzTxRxWorker
*
* @param instance SubGhzTxRxWorker instance
/**
* Start SubGhzTxRxWorker
* @param instance Pointer to a SubGhzTxRxWorker instance
* @return bool - true if ok
*/
bool subghz_tx_rx_worker_start(SubGhzTxRxWorker* instance, uint32_t frequency);
/** Stop SubGhzTxRxWorker
*
* @param instance SubGhzTxRxWorker instance
/**
* Stop SubGhzTxRxWorker
* @param instance Pointer to a SubGhzTxRxWorker instance
*/
void subghz_tx_rx_worker_stop(SubGhzTxRxWorker* instance);
/** Check if worker is running
*
* @param instance SubGhzTxRxWorker instance
/**
* Check if worker is running
* @param instance Pointer to a SubGhzTxRxWorker instance
* @return bool - true if running
*/
bool subghz_tx_rx_worker_is_running(SubGhzTxRxWorker* instance);

View File

@ -10,55 +10,55 @@ typedef void (*SubGhzWorkerPairCallback)(void* context, bool level, uint32_t dur
void subghz_worker_rx_callback(bool level, uint32_t duration, void* context);
/** Allocate SubGhzWorker
*
* @return SubGhzWorker*
/**
* Allocate SubGhzWorker.
* @return SubGhzWorker* Pointer to a SubGhzWorker instance
*/
SubGhzWorker* subghz_worker_alloc();
/** Free SubGhzWorker
*
* @param instance SubGhzWorker instance
/**
* Free SubGhzWorker.
* @param instance Pointer to a SubGhzWorker instance
*/
void subghz_worker_free(SubGhzWorker* instance);
/** Overrun callback SubGhzWorker
*
* @param instance SubGhzWorker instance
/**
* Overrun callback SubGhzWorker.
* @param instance Pointer to a SubGhzWorker instance
* @param callback SubGhzWorkerOverrunCallback callback
*/
void subghz_worker_set_overrun_callback(
SubGhzWorker* instance,
SubGhzWorkerOverrunCallback callback);
/** Pair callback SubGhzWorker
*
* @param instance SubGhzWorker instance
/**
* Pair callback SubGhzWorker.
* @param instance Pointer to a SubGhzWorker instance
* @param callback SubGhzWorkerOverrunCallback callback
*/
void subghz_worker_set_pair_callback(SubGhzWorker* instance, SubGhzWorkerPairCallback callback);
/** Context callback SubGhzWorker
*
* @param instance SubGhzWorker instance
/**
* Context callback SubGhzWorker.
* @param instance Pointer to a SubGhzWorker instance
* @param context
*/
void subghz_worker_set_context(SubGhzWorker* instance, void* context);
/** Start SubGhzWorker
*
* @param instance SubGhzWorker instance
/**
* Start SubGhzWorker.
* @param instance Pointer to a SubGhzWorker instance
*/
void subghz_worker_start(SubGhzWorker* instance);
/** Stop SubGhzWorker
*
* @param instance SubGhzWorker instance
* @param instance Pointer to a SubGhzWorker instance
*/
void subghz_worker_stop(SubGhzWorker* instance);
/** Check if worker is running
* @param instance SubGhzWorker instance
/**
* Check if worker is running.
* @param instance Pointer to a SubGhzWorker instance
* @return bool - true if running
*/
bool subghz_worker_is_running(SubGhzWorker* instance);

View File

@ -11,13 +11,37 @@ struct SubGhzTransmitter {
SubGhzProtocolEncoderBase* protocol_instance;
};
/**
* Allocate and init SubGhzTransmitter.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzTransmitter* pointer to a SubGhzTransmitter instance
*/
SubGhzTransmitter*
subghz_transmitter_alloc_init(SubGhzEnvironment* environment, const char* protocol_name);
/**
* Free SubGhzTransmitter.
* @param instance Pointer to a SubGhzTransmitter instance
*/
void subghz_transmitter_free(SubGhzTransmitter* instance);
/**
* Forced transmission stop.
* @param instance Pointer to a SubGhzTransmitter instance
*/
bool subghz_transmitter_stop(SubGhzTransmitter* instance);
/**
* Deserialize and generating an upload to send.
* @param instance Pointer to a SubGhzTransmitter instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return true On success
*/
bool subghz_transmitter_deserialize(SubGhzTransmitter* instance, FlipperFormat* flipper_format);
/**
* Getting the level and duration of the upload to be loaded into DMA.
* @param context Pointer to a SubGhzTransmitter instance
* @return LevelDuration
*/
LevelDuration subghz_transmitter_yield(void* context);