[FL-1913, FL-1963] SubGhz: save raw signal, add came atomo decoder (#783)
* File_Worker: getting the name of a new file with an index * SubGhz: add decoder RAW protocol * SubGhz: add view Save RAW * SubGhz: refactoring subghz custom event * SubGhz: fix syntax * SubGhz: fix error build * SubGhz: test build * SubGhz: refactoring subghz, add rename, delete, start and emulate RAW signal * SubGhz: fix triangle glitch in save raw view * SubGhz: fix receiver config scene * SubGhz: fix transfer after returning from save scene * Canvas: add font rotation * SubGhz: raw protocol encoder * SubGhz: fix error completion of transfer raw encoder * SubGhz: increased the speed of reading RAW data from a flash drive, displaying the name of the saved file in the Save RAW scene * Canvas: fix font rotation * SubGhz: fix navigation save RAW scene * SubGhz: add decode came atomo * Git: renormalize * Cleanup sources and enums * Gui: add font direction to canvas reset, canvas init sequence cleanup. * SubGhz: reorder menu. * Gui: correct canvas_set_font_direction signature Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
@@ -182,7 +182,8 @@ void subghz_protocol_came_to_save_str(SubGhzProtocolCame* instance, string_t out
|
||||
|
||||
bool subghz_protocol_came_to_load_protocol_from_file(
|
||||
FileWorker* file_worker,
|
||||
SubGhzProtocolCame* instance) {
|
||||
SubGhzProtocolCame* instance,
|
||||
const char* file_path) {
|
||||
bool loaded = false;
|
||||
string_t temp_str;
|
||||
string_init(temp_str);
|
||||
|
@@ -56,15 +56,17 @@ void subghz_protocol_came_to_save_str(SubGhzProtocolCame* instance, string_t out
|
||||
*
|
||||
* @param file_worker - FileWorker file_worker
|
||||
* @param instance - SubGhzProtocolCame instance
|
||||
* @param file_path - file path
|
||||
* @return bool
|
||||
*/
|
||||
bool subghz_protocol_came_to_load_protocol_from_file(
|
||||
FileWorker* file_worker,
|
||||
SubGhzProtocolCame* instance);
|
||||
SubGhzProtocolCame* instance,
|
||||
const char* file_path);
|
||||
|
||||
/** Loading protocol from bin data
|
||||
*
|
||||
* @param instance - SubGhzProtocolCame instance
|
||||
* @param context - SubGhzProtocolCommonLoad context
|
||||
*/
|
||||
void subghz_decoder_came_to_load_protocol(SubGhzProtocolCame* instance, void* context);
|
||||
void subghz_decoder_came_to_load_protocol(SubGhzProtocolCame* instance, void* context);
|
||||
|
@@ -2,9 +2,12 @@
|
||||
#include "subghz_protocol_common.h"
|
||||
#include <lib/toolbox/manchester-decoder.h>
|
||||
|
||||
#define SUBGHZ_NO_CAME_ATOMO_RAINBOW_TABLE 0xFFFFFFFFFFFFFFFF
|
||||
|
||||
struct SubGhzProtocolCameAtomo {
|
||||
SubGhzProtocolCommon common;
|
||||
ManchesterState manchester_saved_state;
|
||||
const char* rainbow_table_file_name;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
@@ -39,11 +42,118 @@ void subghz_protocol_came_atomo_free(SubGhzProtocolCameAtomo* instance) {
|
||||
free(instance);
|
||||
}
|
||||
|
||||
void subghz_protocol_came_atomo_name_file(SubGhzProtocolCameAtomo* instance, const char* name) {
|
||||
instance->rainbow_table_file_name = name;
|
||||
printf("Loading CAME Atomo rainbow table %s\r\n", name);
|
||||
}
|
||||
|
||||
/** Read bytes from rainbow table
|
||||
*
|
||||
* @param instance - SubGhzProtocolCameAtomo* instance
|
||||
* @param number_atomo_magic_xor
|
||||
* @return atomo_magic_xor
|
||||
*/
|
||||
uint64_t subghz_came_atomo_get_atomo_magic_xor_in_file(
|
||||
SubGhzProtocolCameAtomo* instance,
|
||||
uint8_t number_atomo_magic_xor) {
|
||||
if(!strcmp(instance->rainbow_table_file_name, "")) return SUBGHZ_NO_CAME_ATOMO_RAINBOW_TABLE;
|
||||
|
||||
uint8_t buffer[sizeof(uint64_t)] = {0};
|
||||
uint32_t address = number_atomo_magic_xor * sizeof(uint64_t);
|
||||
uint64_t atomo_magic_xor = 0;
|
||||
|
||||
FileWorker* file_worker = file_worker_alloc(true);
|
||||
if(file_worker_open(
|
||||
file_worker, instance->rainbow_table_file_name, FSAM_READ, FSOM_OPEN_EXISTING)) {
|
||||
file_worker_seek(file_worker, address, true);
|
||||
file_worker_read(file_worker, &buffer, sizeof(uint64_t));
|
||||
for(size_t i = 0; i < sizeof(uint64_t); i++) {
|
||||
atomo_magic_xor = (atomo_magic_xor << 8) | buffer[i];
|
||||
}
|
||||
} else {
|
||||
atomo_magic_xor = SUBGHZ_NO_CAME_ATOMO_RAINBOW_TABLE;
|
||||
}
|
||||
file_worker_close(file_worker);
|
||||
file_worker_free(file_worker);
|
||||
|
||||
return atomo_magic_xor;
|
||||
}
|
||||
|
||||
/** Analysis of received data
|
||||
*
|
||||
* @param instance SubGhzProtocolCameAtomo instance
|
||||
*/
|
||||
void subghz_protocol_came_atomo_remote_controller(SubGhzProtocolCameAtomo* instance) {
|
||||
/*
|
||||
* 0x1fafef3ed0f7d9ef
|
||||
* 0x185fcc1531ee86e7
|
||||
* 0x184fa96912c567ff
|
||||
* 0x187f8a42f3dc38f7
|
||||
* 0x186f63915492a5cd
|
||||
* 0x181f40bab58bfac5
|
||||
* 0x180f25c696a01bdd
|
||||
* 0x183f06ed77b944d5
|
||||
* 0x182ef661d83d21a9
|
||||
* 0x18ded54a39247ea1
|
||||
* 0x18ceb0361a0f9fb9
|
||||
* 0x18fe931dfb16c0b1
|
||||
* 0x18ee7ace5c585d8b
|
||||
* ........
|
||||
* transmission consists of 99 parcels with increasing counter while holding down the button
|
||||
* with each new press, the counter in the encrypted part increases
|
||||
*
|
||||
* 0x1FAFF13ED0F7D9EF
|
||||
* 0x1FAFF11ED0F7D9EF
|
||||
* 0x1FAFF10ED0F7D9EF
|
||||
* 0x1FAFF0FED0F7D9EF
|
||||
* 0x1FAFF0EED0F7D9EF
|
||||
* 0x1FAFF0DED0F7D9EF
|
||||
* 0x1FAFF0CED0F7D9EF
|
||||
* 0x1FAFF0BED0F7D9EF
|
||||
* 0x1FAFF0AED0F7D9EF
|
||||
*
|
||||
* where 0x1FAF - parcel counter, 0хF0A - button press counter,
|
||||
* 0xED0F7D9E - serial number, 0хF - key
|
||||
* 0x1FAF parcel counter - 1 in the parcel queue ^ 0x185F = 0x07F0
|
||||
* 0x185f ^ 0x185F = 0x0000
|
||||
* 0x184f ^ 0x185F = 0x0010
|
||||
* 0x187f ^ 0x185F = 0x0020
|
||||
* .....
|
||||
* 0x182e ^ 0x185F = 0x0071
|
||||
* 0x18de ^ 0x185F = 0x0081
|
||||
* .....
|
||||
* 0x1e43 ^ 0x185F = 0x061C
|
||||
* where the last nibble is incremented every 8 samples
|
||||
*
|
||||
* Decode
|
||||
*
|
||||
* 0x1cf6931dfb16c0b1 => 0x1cf6
|
||||
* 0x1cf6 ^ 0x185F = 0x04A9
|
||||
* 0x04A9 => 0x04A = 74 (dec)
|
||||
* 74+1 % 32(atomo_magic_xor) = 11
|
||||
* GET atomo_magic_xor[11] = 0xXXXXXXXXXXXXXXXX
|
||||
* 0x931dfb16c0b1 ^ 0xXXXXXXXXXXXXXXXX = 0xEF3ED0F7D9EF
|
||||
* 0xEF3 ED0F7D9E F => 0xEF3 - CNT, 0xED0F7D9E - SN, 0xF - key
|
||||
*
|
||||
* */
|
||||
|
||||
uint16_t parcel_counter = instance->common.code_last_found >> 48;
|
||||
parcel_counter = parcel_counter ^ 0x185F;
|
||||
parcel_counter >>= 4;
|
||||
uint8_t ind = (parcel_counter + 1) % 32;
|
||||
uint64_t temp_data = instance->common.code_last_found & 0x0000FFFFFFFFFFFF;
|
||||
uint64_t atomo_magic_xor = subghz_came_atomo_get_atomo_magic_xor_in_file(instance, ind);
|
||||
|
||||
if(atomo_magic_xor != SUBGHZ_NO_CAME_ATOMO_RAINBOW_TABLE) {
|
||||
temp_data = temp_data ^ atomo_magic_xor;
|
||||
instance->common.cnt = temp_data >> 36;
|
||||
instance->common.serial = (temp_data >> 4) & 0x000FFFFFFFF;
|
||||
instance->common.btn = temp_data & 0xF;
|
||||
} else {
|
||||
instance->common.cnt = 0;
|
||||
instance->common.serial = 0;
|
||||
instance->common.btn = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void subghz_protocol_came_atomo_reset(SubGhzProtocolCameAtomo* instance) {
|
||||
@@ -89,26 +199,10 @@ void subghz_protocol_came_atomo_parse(
|
||||
} else if(DURATION_DIFF(duration, instance->common.te_long) < instance->common.te_delta) {
|
||||
event = ManchesterEventLongLow;
|
||||
} else if(duration >= (instance->common.te_long * 2 + instance->common.te_delta)) {
|
||||
if(instance->common.code_count_bit >=
|
||||
if(instance->common.code_count_bit ==
|
||||
instance->common.code_min_count_bit_for_found) {
|
||||
instance->common.code_last_found = instance->common.code_found;
|
||||
instance->common.code_last_count_bit = instance->common.code_count_bit;
|
||||
// uint32_t code_found_hi = instance->common.code_last_found >> 32;
|
||||
// uint32_t code_found_lo = instance->common.code_last_found & 0x00000000ffffffff;
|
||||
|
||||
// uint64_t code_found_reverse = subghz_protocol_common_reverse_key(
|
||||
// instance->common.code_last_found, instance->common.code_last_count_bit);
|
||||
|
||||
// uint32_t code_found_reverse_hi = code_found_reverse >> 32;
|
||||
// uint32_t code_found_reverse_lo = code_found_reverse & 0x00000000ffffffff;
|
||||
// FURI_LOG_I(
|
||||
// "ATOMO",
|
||||
// "%08lX%08lX %08lX%08lX %d",
|
||||
// code_found_hi,
|
||||
// code_found_lo,
|
||||
// code_found_reverse_hi,
|
||||
// code_found_reverse_lo,
|
||||
// instance->common.code_last_count_bit);
|
||||
if(instance->common.callback)
|
||||
instance->common.callback(
|
||||
(SubGhzProtocolCommon*)instance, instance->common.context);
|
||||
@@ -151,17 +245,24 @@ void subghz_protocol_came_atomo_parse(
|
||||
}
|
||||
}
|
||||
void subghz_protocol_came_atomo_to_str(SubGhzProtocolCameAtomo* instance, string_t output) {
|
||||
subghz_protocol_came_atomo_remote_controller(instance);
|
||||
uint32_t code_found_hi = instance->common.code_last_found >> 32;
|
||||
uint32_t code_found_lo = instance->common.code_last_found & 0x00000000ffffffff;
|
||||
|
||||
string_cat_printf(
|
||||
output,
|
||||
"%s %dbit\r\n"
|
||||
"Key:0x%lX%08lX\r\n",
|
||||
"%s %db\r\n"
|
||||
"Key:0x%lX%08lX\r\n"
|
||||
"Sn:0x%08lX Btn:0x%01X\r\n"
|
||||
"Cnt:0x%03X\r\n",
|
||||
|
||||
instance->common.name,
|
||||
instance->common.code_last_count_bit,
|
||||
code_found_hi,
|
||||
code_found_lo);
|
||||
code_found_lo,
|
||||
instance->common.serial,
|
||||
instance->common.btn,
|
||||
instance->common.cnt);
|
||||
}
|
||||
|
||||
// void subghz_protocol_came_atomo_to_save_str(SubGhzProtocolCameAtomo* instance, string_t output) {
|
||||
@@ -178,7 +279,8 @@ void subghz_protocol_came_atomo_to_str(SubGhzProtocolCameAtomo* instance, string
|
||||
|
||||
// bool subghz_protocol_came_atomo_to_load_protocol_from_file(
|
||||
// FileWorker* file_worker,
|
||||
// SubGhzProtocolCameAtomo* instance) {
|
||||
// SubGhzProtocolCameAtomo* instance,
|
||||
// const char* file_path) {
|
||||
// bool loaded = false;
|
||||
// string_t temp_str;
|
||||
// string_init(temp_str);
|
||||
|
@@ -16,6 +16,13 @@ SubGhzProtocolCameAtomo* subghz_protocol_came_atomo_alloc();
|
||||
*/
|
||||
void subghz_protocol_came_atomo_free(SubGhzProtocolCameAtomo* instance);
|
||||
|
||||
/** File name rainbow table CAME Atomo
|
||||
*
|
||||
* @param instance - SubGhzProtocolCameAtomo instance
|
||||
* @param file_name - "path/file_name"
|
||||
*/
|
||||
void subghz_protocol_came_atomo_name_file(SubGhzProtocolCameAtomo* instance, const char* name);
|
||||
|
||||
// /** Get upload protocol
|
||||
// *
|
||||
// * @param instance - SubGhzProtocolCameAtomo instance
|
||||
@@ -59,11 +66,13 @@ void subghz_protocol_came_atomo_to_str(SubGhzProtocolCameAtomo* instance, string
|
||||
// *
|
||||
// * @param file_worker - FileWorker file_worker
|
||||
// * @param instance - SubGhzProtocolCameAtomo instance
|
||||
// * @param file_path - file path
|
||||
// * @return bool
|
||||
// */
|
||||
// bool subghz_protocol_came_atomo_to_load_protocol_from_file(
|
||||
// FileWorker* file_worker,
|
||||
// SubGhzProtocolCameAtomo* instance);
|
||||
// SubGhzProtocolCameAtomo* instance,
|
||||
// const char* file_path);
|
||||
|
||||
/** Loading protocol from bin data
|
||||
*
|
||||
|
@@ -341,7 +341,8 @@ void subghz_protocol_came_twee_to_save_str(SubGhzProtocolCameTwee* instance, str
|
||||
|
||||
bool subghz_protocol_came_twee_to_load_protocol_from_file(
|
||||
FileWorker* file_worker,
|
||||
SubGhzProtocolCameTwee* instance) {
|
||||
SubGhzProtocolCameTwee* instance,
|
||||
const char* file_path) {
|
||||
bool loaded = false;
|
||||
string_t temp_str;
|
||||
string_init(temp_str);
|
||||
|
@@ -59,11 +59,13 @@ void subghz_protocol_came_twee_to_save_str(SubGhzProtocolCameTwee* instance, str
|
||||
*
|
||||
* @param file_worker - FileWorker file_worker
|
||||
* @param instance - SubGhzProtocolCameTwee instance
|
||||
* @param file_path - file path
|
||||
* @return bool
|
||||
*/
|
||||
bool subghz_protocol_came_twee_to_load_protocol_from_file(
|
||||
FileWorker* file_worker,
|
||||
SubGhzProtocolCameTwee* instance);
|
||||
SubGhzProtocolCameTwee* instance,
|
||||
const char* file_path);
|
||||
|
||||
/** Loading protocol from bin data
|
||||
*
|
||||
|
@@ -2,7 +2,6 @@
|
||||
#include <stdio.h>
|
||||
#include <lib/toolbox/hex.h>
|
||||
|
||||
|
||||
SubGhzProtocolCommonEncoder* subghz_protocol_encoder_common_alloc() {
|
||||
SubGhzProtocolCommonEncoder* instance = furi_alloc(sizeof(SubGhzProtocolCommonEncoder));
|
||||
instance->upload = furi_alloc(SUBGHZ_ENCODER_UPLOAD_MAX_SIZE * sizeof(LevelDuration));
|
||||
@@ -13,6 +12,9 @@ SubGhzProtocolCommonEncoder* subghz_protocol_encoder_common_alloc() {
|
||||
|
||||
void subghz_protocol_encoder_common_free(SubGhzProtocolCommonEncoder* instance) {
|
||||
furi_assert(instance);
|
||||
if(instance->callback_end) {
|
||||
instance->callback_end((SubGhzProtocolCommon*)instance->context_end);
|
||||
}
|
||||
free(instance->upload);
|
||||
free(instance);
|
||||
}
|
||||
@@ -22,10 +24,34 @@ size_t subghz_encoder_common_get_repeat_left(SubGhzProtocolCommonEncoder* instan
|
||||
return instance->repeat;
|
||||
}
|
||||
|
||||
void subghz_protocol_encoder_common_set_callback(
|
||||
SubGhzProtocolCommonEncoder* instance,
|
||||
SubGhzProtocolCommonEncoderCallback callback,
|
||||
void* context) {
|
||||
furi_assert(instance);
|
||||
furi_assert(callback);
|
||||
instance->callback = callback;
|
||||
instance->context = context;
|
||||
}
|
||||
|
||||
void subghz_protocol_encoder_common_set_callback_end(
|
||||
SubGhzProtocolCommonEncoder* instance,
|
||||
SubGhzProtocolCommonEncoderCallbackEnd callback_end,
|
||||
void* context_end) {
|
||||
furi_assert(instance);
|
||||
furi_assert(callback_end);
|
||||
instance->callback_end = callback_end;
|
||||
instance->context_end = context_end;
|
||||
}
|
||||
|
||||
LevelDuration subghz_protocol_encoder_common_yield(void* context) {
|
||||
SubGhzProtocolCommonEncoder* instance = context;
|
||||
|
||||
if(instance->repeat == 0){
|
||||
if(instance->callback) {
|
||||
return instance->callback((SubGhzProtocolCommon*)instance->context);
|
||||
}
|
||||
|
||||
if(instance->repeat == 0) {
|
||||
return level_duration_reset();
|
||||
}
|
||||
|
||||
@@ -39,46 +65,53 @@ LevelDuration subghz_protocol_encoder_common_yield(void* context) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
void subghz_protocol_common_add_bit(SubGhzProtocolCommon *common, uint8_t bit){
|
||||
void subghz_protocol_common_add_bit(SubGhzProtocolCommon* common, uint8_t bit) {
|
||||
common->code_found = common->code_found << 1 | bit;
|
||||
common->code_count_bit++;
|
||||
}
|
||||
|
||||
bool subghz_protocol_common_check_interval(SubGhzProtocolCommon *common, uint32_t duration, uint16_t duration_check) {
|
||||
if ((duration_check >= (duration - common->te_delta))&&(duration_check <= (duration + common->te_delta))){
|
||||
bool subghz_protocol_common_check_interval(
|
||||
SubGhzProtocolCommon* common,
|
||||
uint32_t duration,
|
||||
uint16_t duration_check) {
|
||||
if((duration_check >= (duration - common->te_delta)) &&
|
||||
(duration_check <= (duration + common->te_delta))) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t subghz_protocol_common_reverse_key(uint64_t key, uint8_t count_bit){
|
||||
uint64_t key_reverse=0;
|
||||
for(uint8_t i=0; i<count_bit; i++) {
|
||||
key_reverse=key_reverse<<1|bit_read(key,i);
|
||||
uint64_t subghz_protocol_common_reverse_key(uint64_t key, uint8_t count_bit) {
|
||||
uint64_t key_reverse = 0;
|
||||
for(uint8_t i = 0; i < count_bit; i++) {
|
||||
key_reverse = key_reverse << 1 | bit_read(key, i);
|
||||
}
|
||||
return key_reverse;
|
||||
}
|
||||
|
||||
void subghz_protocol_common_set_callback(SubGhzProtocolCommon* common, SubGhzProtocolCommonCallback callback, void* context) {
|
||||
void subghz_protocol_common_set_callback(
|
||||
SubGhzProtocolCommon* common,
|
||||
SubGhzProtocolCommonCallback callback,
|
||||
void* context) {
|
||||
common->callback = callback;
|
||||
common->context = context;
|
||||
}
|
||||
|
||||
|
||||
void subghz_protocol_common_to_str(SubGhzProtocolCommon* instance, string_t output) {
|
||||
if (instance->to_string) {
|
||||
if(instance->to_string) {
|
||||
instance->to_string(instance, output);
|
||||
} else {
|
||||
uint32_t code_found_hi = instance->code_found >> 32;
|
||||
uint32_t code_found_lo = instance->code_found & 0x00000000ffffffff;
|
||||
|
||||
uint64_t code_found_reverse = subghz_protocol_common_reverse_key(instance->code_found, instance->code_count_bit);
|
||||
uint64_t code_found_reverse =
|
||||
subghz_protocol_common_reverse_key(instance->code_found, instance->code_count_bit);
|
||||
|
||||
uint32_t code_found_reverse_hi = code_found_reverse>>32;
|
||||
uint32_t code_found_reverse_lo = code_found_reverse&0x00000000ffffffff;
|
||||
uint32_t code_found_reverse_hi = code_found_reverse >> 32;
|
||||
uint32_t code_found_reverse_lo = code_found_reverse & 0x00000000ffffffff;
|
||||
|
||||
if (code_found_hi>0) {
|
||||
if(code_found_hi > 0) {
|
||||
string_cat_printf(
|
||||
output,
|
||||
"Protocol %s, %d Bit\r\n"
|
||||
@@ -92,8 +125,7 @@ void subghz_protocol_common_to_str(SubGhzProtocolCommon* instance, string_t outp
|
||||
code_found_reverse_hi,
|
||||
code_found_reverse_lo,
|
||||
instance->serial,
|
||||
instance->btn
|
||||
);
|
||||
instance->btn);
|
||||
} else {
|
||||
string_cat_printf(
|
||||
output,
|
||||
@@ -108,8 +140,7 @@ void subghz_protocol_common_to_str(SubGhzProtocolCommon* instance, string_t outp
|
||||
code_found_reverse_hi,
|
||||
code_found_reverse_lo,
|
||||
instance->serial,
|
||||
instance->btn
|
||||
);
|
||||
instance->btn);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,9 +155,9 @@ bool subghz_protocol_common_read_hex(string_t str, uint8_t* buff, uint16_t len)
|
||||
if(hex_char_to_hex_nibble(string_get_char(str, 0), &nibble_high) &&
|
||||
hex_char_to_hex_nibble(string_get_char(str, 1), &nibble_low)) {
|
||||
buff[i] = (nibble_high << 4) | nibble_low;
|
||||
if(string_size(str)>2){
|
||||
if(string_size(str) > 2) {
|
||||
string_right(str, 2);
|
||||
}else if(i<len-1){
|
||||
} else if(i < len - 1) {
|
||||
parsed = false;
|
||||
break;
|
||||
};
|
||||
|
@@ -16,6 +16,8 @@
|
||||
|
||||
#define SUBGHZ_APP_FOLDER "/any/subghz"
|
||||
#define SUBGHZ_APP_PATH_FOLDER "/any/subghz/saved"
|
||||
#define SUBGHZ_RAW_FOLDER "/ext/subghz"
|
||||
#define SUBGHZ_RAW_PATH_FOLDER "/ext/subghz/saved"
|
||||
#define SUBGHZ_APP_EXTENSION ".sub"
|
||||
#define SUBGHZ_ENCODER_UPLOAD_MAX_SIZE 2048
|
||||
|
||||
@@ -23,6 +25,7 @@ typedef enum {
|
||||
SubGhzProtocolCommonTypeUnknown,
|
||||
SubGhzProtocolCommonTypeStatic,
|
||||
SubGhzProtocolCommonTypeDynamic,
|
||||
SubGhzProtocolCommonTypeRAW,
|
||||
} SubGhzProtocolCommonType;
|
||||
|
||||
typedef struct SubGhzProtocolCommon SubGhzProtocolCommon;
|
||||
@@ -38,7 +41,7 @@ typedef void (*SubGhzProtocolCommonGetStrSave)(SubGhzProtocolCommon* instance, s
|
||||
|
||||
//Load protocol from file
|
||||
typedef bool (
|
||||
*SubGhzProtocolCommonLoadFromFile)(FileWorker* file_worker, SubGhzProtocolCommon* instance);
|
||||
*SubGhzProtocolCommonLoadFromFile)(FileWorker* file_worker, SubGhzProtocolCommon* instance, const char* file_path);
|
||||
//Load protocol
|
||||
typedef void (*SubGhzProtocolCommonLoadFromRAW)(SubGhzProtocolCommon* instance, void* context);
|
||||
//Get upload encoder protocol
|
||||
@@ -46,6 +49,9 @@ typedef bool (*SubGhzProtocolCommonEncoderGetUpLoad)(
|
||||
SubGhzProtocolCommon* instance,
|
||||
SubGhzProtocolCommonEncoder* encoder);
|
||||
|
||||
typedef LevelDuration (*SubGhzProtocolCommonEncoderCallback)(void* context);
|
||||
typedef void (*SubGhzProtocolCommonEncoderCallbackEnd)(void* context);
|
||||
|
||||
struct SubGhzProtocolCommon {
|
||||
const char* name;
|
||||
uint16_t te_long;
|
||||
@@ -86,6 +92,11 @@ struct SubGhzProtocolCommonEncoder {
|
||||
size_t front;
|
||||
size_t size_upload;
|
||||
LevelDuration* upload;
|
||||
|
||||
SubGhzProtocolCommonEncoderCallback callback;
|
||||
SubGhzProtocolCommonEncoderCallbackEnd callback_end;
|
||||
void* context;
|
||||
void* context_end;
|
||||
};
|
||||
|
||||
struct SubGhzProtocolCommonLoad {
|
||||
@@ -108,6 +119,16 @@ SubGhzProtocolCommonEncoder* subghz_protocol_encoder_common_alloc();
|
||||
*/
|
||||
void subghz_protocol_encoder_common_free(SubGhzProtocolCommonEncoder* instance);
|
||||
|
||||
void subghz_protocol_encoder_common_set_callback(
|
||||
SubGhzProtocolCommonEncoder* instance,
|
||||
SubGhzProtocolCommonEncoderCallback callback,
|
||||
void* context);
|
||||
|
||||
void subghz_protocol_encoder_common_set_callback_end(
|
||||
SubGhzProtocolCommonEncoder* instance,
|
||||
SubGhzProtocolCommonEncoderCallbackEnd callback_end,
|
||||
void* context_end);
|
||||
|
||||
/** Get count repeat left
|
||||
*
|
||||
* @param instance - SubGhzProtocolCommonEncoder instance
|
||||
|
@@ -182,7 +182,8 @@ void subghz_protocol_gate_tx_to_save_str(SubGhzProtocolGateTX* instance, string_
|
||||
|
||||
bool subghz_protocol_gate_tx_to_load_protocol_from_file(
|
||||
FileWorker* file_worker,
|
||||
SubGhzProtocolGateTX* instance) {
|
||||
SubGhzProtocolGateTX* instance,
|
||||
const char* file_path) {
|
||||
bool loaded = false;
|
||||
string_t temp_str;
|
||||
string_init(temp_str);
|
||||
@@ -227,4 +228,4 @@ void subghz_decoder_gate_tx_to_load_protocol(SubGhzProtocolGateTX* instance, voi
|
||||
instance->common.code_last_found = data->code_found;
|
||||
instance->common.code_last_count_bit = data->code_count_bit;
|
||||
subghz_protocol_gate_tx_check_remote_controller(instance);
|
||||
}
|
||||
}
|
||||
|
@@ -22,7 +22,9 @@ void subghz_protocol_gate_tx_free(SubGhzProtocolGateTX* instance);
|
||||
* @param encoder - SubGhzProtocolCommonEncoder encoder
|
||||
* @return bool
|
||||
*/
|
||||
bool subghz_protocol_gate_tx_send_key(SubGhzProtocolGateTX* instance, SubGhzProtocolCommonEncoder* encoder);
|
||||
bool subghz_protocol_gate_tx_send_key(
|
||||
SubGhzProtocolGateTX* instance,
|
||||
SubGhzProtocolCommonEncoder* encoder);
|
||||
|
||||
/** Reset internal state
|
||||
* @param instance - SubGhzProtocolGateTX instance
|
||||
@@ -54,9 +56,13 @@ void subghz_protocol_gate_tx_to_save_str(SubGhzProtocolGateTX* instance, string_
|
||||
*
|
||||
* @param file_worker - FileWorker file_worker
|
||||
* @param instance - SubGhzProtocolGateTX instance
|
||||
* @param file_path - file path
|
||||
* @return bool
|
||||
*/
|
||||
bool subghz_protocol_gate_tx_to_load_protocol_from_file(FileWorker* file_worker, SubGhzProtocolGateTX* instance);
|
||||
bool subghz_protocol_gate_tx_to_load_protocol_from_file(
|
||||
FileWorker* file_worker,
|
||||
SubGhzProtocolGateTX* instance,
|
||||
const char* file_path);
|
||||
|
||||
/** Loading protocol from bin data
|
||||
*
|
||||
|
@@ -436,7 +436,8 @@ void subghz_protocol_keeloq_to_save_str(SubGhzProtocolKeeloq* instance, string_t
|
||||
|
||||
bool subghz_protocol_keeloq_to_load_protocol_from_file(
|
||||
FileWorker* file_worker,
|
||||
SubGhzProtocolKeeloq* instance) {
|
||||
SubGhzProtocolKeeloq* instance,
|
||||
const char* file_path) {
|
||||
bool loaded = false;
|
||||
string_t temp_str;
|
||||
string_init(temp_str);
|
||||
|
@@ -53,7 +53,9 @@ uint64_t subghz_protocol_keeloq_gen_key(void* context);
|
||||
* @param encoder - SubGhzProtocolCommonEncoder encoder
|
||||
* @return bool
|
||||
*/
|
||||
bool subghz_protocol_keeloq_send_key(SubGhzProtocolKeeloq* instance, SubGhzProtocolCommonEncoder* encoder);
|
||||
bool subghz_protocol_keeloq_send_key(
|
||||
SubGhzProtocolKeeloq* instance,
|
||||
SubGhzProtocolCommonEncoder* encoder);
|
||||
|
||||
/** Reset internal state
|
||||
* @param instance - SubGhzProtocolKeeloq instance
|
||||
@@ -85,9 +87,13 @@ void subghz_protocol_keeloq_to_save_str(SubGhzProtocolKeeloq* instance, string_t
|
||||
*
|
||||
* @param file_worker - FileWorker file_worker
|
||||
* @param instance - SubGhzProtocolKeeloq instance
|
||||
* @param file_path - file path
|
||||
* @return bool
|
||||
*/
|
||||
bool subghz_protocol_keeloq_to_load_protocol_from_file(FileWorker* file_worker, SubGhzProtocolKeeloq* instance);
|
||||
bool subghz_protocol_keeloq_to_load_protocol_from_file(
|
||||
FileWorker* file_worker,
|
||||
SubGhzProtocolKeeloq* instance,
|
||||
const char* file_path);
|
||||
|
||||
/** Loading protocol from bin data
|
||||
*
|
||||
|
@@ -245,7 +245,8 @@ void subghz_protocol_nero_radio_to_save_str(SubGhzProtocolNeroRadio* instance, s
|
||||
|
||||
bool subghz_protocol_nero_radio_to_load_protocol_from_file(
|
||||
FileWorker* file_worker,
|
||||
SubGhzProtocolNeroRadio* instance) {
|
||||
SubGhzProtocolNeroRadio* instance,
|
||||
const char* file_path) {
|
||||
bool loaded = false;
|
||||
string_t temp_str;
|
||||
string_init(temp_str);
|
||||
|
@@ -22,7 +22,9 @@ void subghz_protocol_nero_radio_free(SubGhzProtocolNeroRadio* instance);
|
||||
* @param encoder - SubGhzProtocolCommonEncoder encoder
|
||||
* @return bool
|
||||
*/
|
||||
bool subghz_protocol_nero_radio_send_key(SubGhzProtocolNeroRadio* instance, SubGhzProtocolCommonEncoder* encoder);
|
||||
bool subghz_protocol_nero_radio_send_key(
|
||||
SubGhzProtocolNeroRadio* instance,
|
||||
SubGhzProtocolCommonEncoder* encoder);
|
||||
|
||||
/** Reset internal state
|
||||
* @param instance - SubGhzProtocolNeroRadio instance
|
||||
@@ -40,7 +42,10 @@ void subghz_protocol_nero_radio_check_remote_controller(SubGhzProtocolNeroRadio*
|
||||
* @param instance - SubGhzProtocolNeroRadio instance
|
||||
* @param data - LevelDuration level_duration
|
||||
*/
|
||||
void subghz_protocol_nero_radio_parse(SubGhzProtocolNeroRadio* instance, bool level, uint32_t duration);
|
||||
void subghz_protocol_nero_radio_parse(
|
||||
SubGhzProtocolNeroRadio* instance,
|
||||
bool level,
|
||||
uint32_t duration);
|
||||
|
||||
/** Outputting information from the parser
|
||||
*
|
||||
@@ -60,9 +65,13 @@ void subghz_protocol_nero_radio_to_save_str(SubGhzProtocolNeroRadio* instance, s
|
||||
*
|
||||
* @param file_worker - FileWorker file_worker
|
||||
* @param instance - SubGhzProtocolNeroRadio instance
|
||||
* @param file_path - file path
|
||||
* @return bool
|
||||
*/
|
||||
bool subghz_protocol_nero_radio_to_load_protocol_from_file(FileWorker* file_worker, SubGhzProtocolNeroRadio* instance);
|
||||
bool subghz_protocol_nero_radio_to_load_protocol_from_file(
|
||||
FileWorker* file_worker,
|
||||
SubGhzProtocolNeroRadio* instance,
|
||||
const char* file_path);
|
||||
|
||||
/** Loading protocol from bin data
|
||||
*
|
||||
|
@@ -238,7 +238,8 @@ void subghz_protocol_nero_sketch_to_save_str(SubGhzProtocolNeroSketch* instance,
|
||||
|
||||
bool subghz_protocol_nero_sketch_to_load_protocol_from_file(
|
||||
FileWorker* file_worker,
|
||||
SubGhzProtocolNeroSketch* instance) {
|
||||
SubGhzProtocolNeroSketch* instance,
|
||||
const char* file_path) {
|
||||
bool loaded = false;
|
||||
string_t temp_str;
|
||||
string_init(temp_str);
|
||||
@@ -282,4 +283,4 @@ void subghz_decoder_nero_sketch_to_load_protocol(SubGhzProtocolNeroSketch* insta
|
||||
SubGhzProtocolCommonLoad* data = context;
|
||||
instance->common.code_last_found = data->code_found;
|
||||
instance->common.code_last_count_bit = data->code_count_bit;
|
||||
}
|
||||
}
|
||||
|
@@ -22,7 +22,9 @@ void subghz_protocol_nero_sketch_free(SubGhzProtocolNeroSketch* instance);
|
||||
* @param encoder - SubGhzProtocolCommonEncoder encoder
|
||||
* @return bool
|
||||
*/
|
||||
bool subghz_protocol_nero_sketch_send_key(SubGhzProtocolNeroSketch* instance, SubGhzProtocolCommonEncoder* encoder);
|
||||
bool subghz_protocol_nero_sketch_send_key(
|
||||
SubGhzProtocolNeroSketch* instance,
|
||||
SubGhzProtocolCommonEncoder* encoder);
|
||||
|
||||
/** Reset internal state
|
||||
* @param instance - SubGhzProtocolNeroSketch instance
|
||||
@@ -40,7 +42,10 @@ void subghz_protocol_nero_sketch_check_remote_controller(SubGhzProtocolNeroSketc
|
||||
* @param instance - SubGhzProtocolNeroSketch instance
|
||||
* @param data - LevelDuration level_duration
|
||||
*/
|
||||
void subghz_protocol_nero_sketch_parse(SubGhzProtocolNeroSketch* instance, bool level, uint32_t duration);
|
||||
void subghz_protocol_nero_sketch_parse(
|
||||
SubGhzProtocolNeroSketch* instance,
|
||||
bool level,
|
||||
uint32_t duration);
|
||||
|
||||
/** Outputting information from the parser
|
||||
*
|
||||
@@ -60,13 +65,17 @@ void subghz_protocol_nero_sketch_to_save_str(SubGhzProtocolNeroSketch* instance,
|
||||
*
|
||||
* @param file_worker - FileWorker file_worker
|
||||
* @param instance - SubGhzProtocolNeroSketch instance
|
||||
* @param file_path - file path
|
||||
* @return bool
|
||||
*/
|
||||
bool subghz_protocol_nero_sketch_to_load_protocol_from_file(FileWorker* file_worker, SubGhzProtocolNeroSketch* instance);
|
||||
bool subghz_protocol_nero_sketch_to_load_protocol_from_file(
|
||||
FileWorker* file_worker,
|
||||
SubGhzProtocolNeroSketch* instance,
|
||||
const char* file_path);
|
||||
|
||||
/** Loading protocol from bin data
|
||||
*
|
||||
* @param instance - SubGhzProtocolNeroSketch instance
|
||||
* @param context - SubGhzProtocolCommonLoad context
|
||||
*/
|
||||
void subghz_decoder_nero_sketch_to_load_protocol(SubGhzProtocolNeroSketch* instance, void* context);
|
||||
void subghz_decoder_nero_sketch_to_load_protocol(SubGhzProtocolNeroSketch* instance, void* context);
|
||||
|
@@ -179,7 +179,8 @@ void subghz_protocol_nice_flo_to_save_str(SubGhzProtocolNiceFlo* instance, strin
|
||||
|
||||
bool subghz_protocol_nice_flo_to_load_protocol_from_file(
|
||||
FileWorker* file_worker,
|
||||
SubGhzProtocolNiceFlo* instance) {
|
||||
SubGhzProtocolNiceFlo* instance,
|
||||
const char* file_path) {
|
||||
bool loaded = false;
|
||||
string_t temp_str;
|
||||
string_init(temp_str);
|
||||
@@ -224,4 +225,4 @@ void subghz_decoder_nice_flo_to_load_protocol(SubGhzProtocolNiceFlo* instance, v
|
||||
instance->common.code_last_count_bit = data->code_count_bit;
|
||||
instance->common.serial = 0x0;
|
||||
instance->common.btn = 0x0;
|
||||
}
|
||||
}
|
||||
|
@@ -22,7 +22,9 @@ void subghz_protocol_nice_flo_free(SubGhzProtocolNiceFlo* instance);
|
||||
* @param encoder - SubGhzProtocolCommonEncoder encoder
|
||||
* @return bool
|
||||
*/
|
||||
bool subghz_protocol_nice_flo_send_key(SubGhzProtocolNiceFlo* instance, SubGhzProtocolCommonEncoder* encoder);
|
||||
bool subghz_protocol_nice_flo_send_key(
|
||||
SubGhzProtocolNiceFlo* instance,
|
||||
SubGhzProtocolCommonEncoder* encoder);
|
||||
|
||||
/** Reset internal state
|
||||
* @param instance - SubGhzProtocolNiceFlo instance
|
||||
@@ -54,9 +56,13 @@ void subghz_protocol_nice_flo_to_save_str(SubGhzProtocolNiceFlo* instance, strin
|
||||
*
|
||||
* @param file_worker - FileWorker file_worker
|
||||
* @param instance - SubGhzProtocolNiceFlo instance
|
||||
* @param file_path - file path
|
||||
* @return bool
|
||||
*/
|
||||
bool subghz_protocol_nice_flo_to_load_protocol_from_file(FileWorker* file_worker, SubGhzProtocolNiceFlo* instance);
|
||||
bool subghz_protocol_nice_flo_to_load_protocol_from_file(
|
||||
FileWorker* file_worker,
|
||||
SubGhzProtocolNiceFlo* instance,
|
||||
const char* file_path);
|
||||
|
||||
/** Loading protocol from bin data
|
||||
*
|
||||
|
@@ -308,7 +308,8 @@ void subghz_decoder_princeton_to_save_str(SubGhzDecoderPrinceton* instance, stri
|
||||
|
||||
bool subghz_decoder_princeton_to_load_protocol_from_file(
|
||||
FileWorker* file_worker,
|
||||
SubGhzDecoderPrinceton* instance) {
|
||||
SubGhzDecoderPrinceton* instance,
|
||||
const char* file_path) {
|
||||
bool loaded = false;
|
||||
string_t temp_str;
|
||||
string_init(temp_str);
|
||||
|
@@ -111,15 +111,17 @@ void subghz_decoder_princeton_to_save_str(SubGhzDecoderPrinceton* instance, stri
|
||||
*
|
||||
* @param file_worker - FileWorker file_worker
|
||||
* @param instance - SubGhzDecoderPrinceton instance
|
||||
* @param file_path - file path
|
||||
* @return bool
|
||||
*/
|
||||
bool subghz_decoder_princeton_to_load_protocol_from_file(FileWorker* file_worker, SubGhzDecoderPrinceton* instance);
|
||||
bool subghz_decoder_princeton_to_load_protocol_from_file(
|
||||
FileWorker* file_worker,
|
||||
SubGhzDecoderPrinceton* instance,
|
||||
const char* file_path);
|
||||
|
||||
/** Loading protocol from bin data
|
||||
*
|
||||
* @param instance - SubGhzDecoderPrinceton instance
|
||||
* @param context - SubGhzProtocolCommonLoad context
|
||||
*/
|
||||
void subghz_decoder_princeton_to_load_protocol(
|
||||
SubGhzDecoderPrinceton* instance,
|
||||
void* context) ;
|
||||
void subghz_decoder_princeton_to_load_protocol(SubGhzDecoderPrinceton* instance, void* context);
|
||||
|
265
lib/subghz/protocols/subghz_protocol_raw.c
Normal file
265
lib/subghz/protocols/subghz_protocol_raw.c
Normal file
@@ -0,0 +1,265 @@
|
||||
#include "subghz_protocol_raw.h"
|
||||
#include "file-worker.h"
|
||||
#include "../subghz_file_encoder_worker.h"
|
||||
|
||||
#define SUBGHZ_DOWNLOAD_MAX_SIZE 512
|
||||
|
||||
struct SubGhzProtocolRAW {
|
||||
SubGhzProtocolCommon common;
|
||||
|
||||
int16_t* upload_raw;
|
||||
uint16_t ind_write;
|
||||
FileWorker* file_worker;
|
||||
SubGhzFileEncoderWorker* file_worker_encoder;
|
||||
uint32_t file_is_open;
|
||||
string_t file_name;
|
||||
size_t sample_write;
|
||||
bool last_level;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
RAWFileIsOpenClose = 0,
|
||||
RAWFileIsOpenWrite,
|
||||
RAWFileIsOpenRead,
|
||||
} RAWFilIsOpen;
|
||||
|
||||
SubGhzProtocolRAW* subghz_protocol_raw_alloc(void) {
|
||||
SubGhzProtocolRAW* instance = furi_alloc(sizeof(SubGhzProtocolRAW));
|
||||
|
||||
instance->upload_raw = NULL;
|
||||
instance->ind_write = 0;
|
||||
|
||||
instance->last_level = false;
|
||||
|
||||
instance->file_worker = file_worker_alloc(false);
|
||||
instance->file_is_open = RAWFileIsOpenClose;
|
||||
string_init(instance->file_name);
|
||||
|
||||
instance->common.name = "RAW";
|
||||
instance->common.code_min_count_bit_for_found = 0;
|
||||
instance->common.te_short = 80;
|
||||
instance->common.te_long = 32700;
|
||||
instance->common.te_delta = 0;
|
||||
instance->common.type_protocol = SubGhzProtocolCommonTypeRAW;
|
||||
instance->common.to_load_protocol_from_file =
|
||||
(SubGhzProtocolCommonLoadFromFile)subghz_protocol_raw_to_load_protocol_from_file;
|
||||
instance->common.to_string = (SubGhzProtocolCommonToStr)subghz_protocol_raw_to_str;
|
||||
//instance->common.to_load_protocol =
|
||||
// (SubGhzProtocolCommonLoadFromRAW)subghz_decoder_raw_to_load_protocol;
|
||||
instance->common.get_upload_protocol =
|
||||
(SubGhzProtocolCommonEncoderGetUpLoad)subghz_protocol_raw_send_key;
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
void subghz_protocol_raw_free(SubGhzProtocolRAW* instance) {
|
||||
furi_assert(instance);
|
||||
string_clear(instance->file_name);
|
||||
file_worker_free(instance->file_worker);
|
||||
free(instance);
|
||||
}
|
||||
|
||||
void subghz_protocol_raw_file_encoder_worker_stop(void* context) {
|
||||
furi_assert(context);
|
||||
SubGhzProtocolRAW* instance = context;
|
||||
if(subghz_file_encoder_worker_is_running(instance->file_worker_encoder)) {
|
||||
subghz_file_encoder_worker_stop(instance->file_worker_encoder);
|
||||
subghz_file_encoder_worker_free(instance->file_worker_encoder);
|
||||
instance->file_is_open = RAWFileIsOpenClose;
|
||||
}
|
||||
}
|
||||
|
||||
bool subghz_protocol_raw_send_key(
|
||||
SubGhzProtocolRAW* instance,
|
||||
SubGhzProtocolCommonEncoder* encoder) {
|
||||
furi_assert(instance);
|
||||
furi_assert(encoder);
|
||||
|
||||
bool loaded = false;
|
||||
|
||||
instance->file_worker_encoder = subghz_file_encoder_worker_alloc();
|
||||
|
||||
if(subghz_file_encoder_worker_start(
|
||||
instance->file_worker_encoder, string_get_cstr(instance->file_name))) {
|
||||
//the worker needs a file in order to open and read part of the file
|
||||
osDelay(100);
|
||||
instance->file_is_open = RAWFileIsOpenRead;
|
||||
subghz_protocol_encoder_common_set_callback(
|
||||
encoder, subghz_file_encoder_worker_get_level_duration, instance->file_worker_encoder);
|
||||
subghz_protocol_encoder_common_set_callback_end(
|
||||
encoder, subghz_protocol_raw_file_encoder_worker_stop, instance);
|
||||
|
||||
loaded = true;
|
||||
} else {
|
||||
subghz_protocol_raw_file_encoder_worker_stop(instance);
|
||||
}
|
||||
return loaded;
|
||||
}
|
||||
|
||||
void subghz_protocol_raw_reset(SubGhzProtocolRAW* instance) {
|
||||
instance->ind_write = 0;
|
||||
}
|
||||
|
||||
void subghz_protocol_raw_parse(SubGhzProtocolRAW* instance, bool level, uint32_t duration) {
|
||||
if(instance->upload_raw != NULL) {
|
||||
if(duration > instance->common.te_short) {
|
||||
if(duration > instance->common.te_long) duration = instance->common.te_long;
|
||||
if(instance->last_level != level) {
|
||||
instance->last_level = (level ? true : false);
|
||||
instance->upload_raw[instance->ind_write++] = (level ? duration : -duration);
|
||||
}
|
||||
}
|
||||
|
||||
if(instance->ind_write == SUBGHZ_DOWNLOAD_MAX_SIZE) {
|
||||
subghz_protocol_save_raw_to_file_write(instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void subghz_protocol_raw_to_str(SubGhzProtocolRAW* instance, string_t output) {
|
||||
string_cat_printf(output, "RAW Date");
|
||||
}
|
||||
|
||||
const char* subghz_protocol_get_last_file_name(SubGhzProtocolRAW* instance) {
|
||||
return string_get_cstr(instance->file_name);
|
||||
}
|
||||
|
||||
void subghz_protocol_set_last_file_name(SubGhzProtocolRAW* instance, const char* name) {
|
||||
string_printf(instance->file_name, "%s", name);
|
||||
}
|
||||
|
||||
bool subghz_protocol_save_raw_to_file_init(
|
||||
SubGhzProtocolRAW* instance,
|
||||
const char* dev_name,
|
||||
uint32_t frequency,
|
||||
FuriHalSubGhzPreset preset) {
|
||||
furi_assert(instance);
|
||||
|
||||
string_t dev_file_name;
|
||||
string_init(dev_file_name);
|
||||
string_t temp_str;
|
||||
string_init(temp_str);
|
||||
bool init = false;
|
||||
|
||||
do {
|
||||
// Create subghz folder directory if necessary
|
||||
if(!file_worker_mkdir(instance->file_worker, SUBGHZ_RAW_FOLDER)) {
|
||||
break;
|
||||
}
|
||||
// Create saved directory if necessary
|
||||
if(!file_worker_mkdir(instance->file_worker, SUBGHZ_RAW_PATH_FOLDER)) {
|
||||
break;
|
||||
}
|
||||
//get the name of the next free file
|
||||
file_worker_get_next_filename(
|
||||
instance->file_worker,
|
||||
SUBGHZ_RAW_PATH_FOLDER,
|
||||
dev_name,
|
||||
SUBGHZ_APP_EXTENSION,
|
||||
temp_str);
|
||||
|
||||
string_set(instance->file_name, temp_str);
|
||||
|
||||
string_printf(
|
||||
dev_file_name,
|
||||
"%s/%s%s",
|
||||
SUBGHZ_RAW_PATH_FOLDER,
|
||||
string_get_cstr(temp_str),
|
||||
SUBGHZ_APP_EXTENSION);
|
||||
// Open file
|
||||
if(!file_worker_open(
|
||||
instance->file_worker,
|
||||
string_get_cstr(dev_file_name),
|
||||
FSAM_WRITE,
|
||||
FSOM_CREATE_ALWAYS)) {
|
||||
break;
|
||||
}
|
||||
//Get string frequency preset protocol
|
||||
string_printf(
|
||||
temp_str,
|
||||
"Frequency: %d\n"
|
||||
"Preset: %d\n"
|
||||
"Protocol: RAW\n",
|
||||
(int)frequency,
|
||||
(int)preset);
|
||||
|
||||
if(!file_worker_write(
|
||||
instance->file_worker, string_get_cstr(temp_str), string_size(temp_str))) {
|
||||
break;
|
||||
}
|
||||
|
||||
instance->upload_raw = furi_alloc(SUBGHZ_DOWNLOAD_MAX_SIZE * sizeof(uint16_t));
|
||||
instance->file_is_open = RAWFileIsOpenWrite;
|
||||
instance->sample_write = 0;
|
||||
init = true;
|
||||
} while(0);
|
||||
|
||||
string_clear(temp_str);
|
||||
string_clear(dev_file_name);
|
||||
|
||||
return init;
|
||||
}
|
||||
|
||||
void subghz_protocol_save_raw_to_file_stop(SubGhzProtocolRAW* instance) {
|
||||
furi_assert(instance);
|
||||
|
||||
if(instance->file_is_open == RAWFileIsOpenWrite && instance->ind_write)
|
||||
subghz_protocol_save_raw_to_file_write(instance);
|
||||
if(instance->file_is_open != RAWFileIsOpenClose) {
|
||||
free(instance->upload_raw);
|
||||
instance->upload_raw = NULL;
|
||||
}
|
||||
|
||||
file_worker_close(instance->file_worker);
|
||||
instance->file_is_open = RAWFileIsOpenClose;
|
||||
}
|
||||
|
||||
bool subghz_protocol_save_raw_to_file_write(SubGhzProtocolRAW* instance) {
|
||||
furi_assert(instance);
|
||||
|
||||
string_t temp_str;
|
||||
string_init(temp_str);
|
||||
bool is_write = false;
|
||||
if(instance->file_is_open == RAWFileIsOpenWrite) {
|
||||
do {
|
||||
string_printf(temp_str, "RAW_Data: ");
|
||||
|
||||
if(!file_worker_write(
|
||||
instance->file_worker, string_get_cstr(temp_str), string_size(temp_str))) {
|
||||
break;
|
||||
}
|
||||
|
||||
for(size_t i = 0; i < instance->ind_write - 1; i++) {
|
||||
string_printf(temp_str, "%d, ", instance->upload_raw[i]);
|
||||
if(!file_worker_write(
|
||||
instance->file_worker, string_get_cstr(temp_str), string_size(temp_str))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
string_printf(temp_str, "%d\n", instance->upload_raw[instance->ind_write - 1]);
|
||||
if(!file_worker_write(
|
||||
instance->file_worker, string_get_cstr(temp_str), string_size(temp_str))) {
|
||||
break;
|
||||
}
|
||||
|
||||
instance->sample_write += instance->ind_write;
|
||||
instance->ind_write = 0;
|
||||
is_write = true;
|
||||
} while(0);
|
||||
string_clear(temp_str);
|
||||
}
|
||||
return is_write;
|
||||
}
|
||||
|
||||
size_t subghz_save_protocol_raw_get_sample_write(SubGhzProtocolRAW* instance) {
|
||||
return instance->sample_write + instance->ind_write;
|
||||
}
|
||||
|
||||
bool subghz_protocol_raw_to_load_protocol_from_file(
|
||||
FileWorker* file_worker,
|
||||
SubGhzProtocolRAW* instance,
|
||||
const char* file_path) {
|
||||
subghz_protocol_set_last_file_name(instance, file_path);
|
||||
return true;
|
||||
}
|
64
lib/subghz/protocols/subghz_protocol_raw.h
Normal file
64
lib/subghz/protocols/subghz_protocol_raw.h
Normal file
@@ -0,0 +1,64 @@
|
||||
#pragma once
|
||||
|
||||
#include "subghz_protocol_common.h"
|
||||
|
||||
typedef struct SubGhzProtocolRAW SubGhzProtocolRAW;
|
||||
|
||||
/** Allocate SubGhzProtocolRAW
|
||||
*
|
||||
* @return SubGhzProtocolRAW*
|
||||
*/
|
||||
SubGhzProtocolRAW* subghz_protocol_raw_alloc();
|
||||
|
||||
/** Free SubGhzProtocolRAW
|
||||
*
|
||||
* @param instance
|
||||
*/
|
||||
void subghz_protocol_raw_free(SubGhzProtocolRAW* instance);
|
||||
|
||||
/** Reset internal state
|
||||
* @param instance - SubGhzProtocolRAW instance
|
||||
*/
|
||||
void subghz_protocol_raw_reset(SubGhzProtocolRAW* instance);
|
||||
|
||||
/** Get upload protocol
|
||||
*
|
||||
* @param instance - SubGhzProtocolRAW instance
|
||||
* @param encoder - SubGhzProtocolCommonEncoder encoder
|
||||
* @return bool
|
||||
*/
|
||||
bool subghz_protocol_raw_send_key(
|
||||
SubGhzProtocolRAW* instance,
|
||||
SubGhzProtocolCommonEncoder* encoder);
|
||||
|
||||
/** Parse accepted duration
|
||||
*
|
||||
* @param instance - SubGhzProtocolRAW instance
|
||||
* @param data - LevelDuration level_duration
|
||||
*/
|
||||
void subghz_protocol_raw_parse(SubGhzProtocolRAW* instance, bool level, uint32_t duration);
|
||||
|
||||
/** Outputting information from the parser
|
||||
*
|
||||
* @param instance - SubGhzProtocolRAW* instance
|
||||
* @param output - output string
|
||||
*/
|
||||
void subghz_protocol_raw_to_str(SubGhzProtocolRAW* instance, string_t output);
|
||||
|
||||
const char* subghz_protocol_get_last_file_name(SubGhzProtocolRAW* instance);
|
||||
|
||||
void subghz_protocol_set_last_file_name(SubGhzProtocolRAW* instance, const char* name);
|
||||
|
||||
bool subghz_protocol_save_raw_to_file_init(
|
||||
SubGhzProtocolRAW* instance,
|
||||
const char* dev_name,
|
||||
uint32_t frequency,
|
||||
FuriHalSubGhzPreset preset);
|
||||
void subghz_protocol_save_raw_to_file_stop(SubGhzProtocolRAW* instance);
|
||||
bool subghz_protocol_save_raw_to_file_write(SubGhzProtocolRAW* instance);
|
||||
size_t subghz_save_protocol_raw_get_sample_write(SubGhzProtocolRAW* instance);
|
||||
|
||||
bool subghz_protocol_raw_to_load_protocol_from_file(
|
||||
FileWorker* file_worker,
|
||||
SubGhzProtocolRAW* instance,
|
||||
const char* file_path);
|
210
lib/subghz/subghz_file_encoder_worker.c
Normal file
210
lib/subghz/subghz_file_encoder_worker.c
Normal file
@@ -0,0 +1,210 @@
|
||||
#include "subghz_file_encoder_worker.h"
|
||||
#include <stream_buffer.h>
|
||||
|
||||
#include "file-worker.h"
|
||||
|
||||
#define SUBGHZ_FILE_ENCODER_LOAD 512
|
||||
|
||||
struct SubGhzFileEncoderWorker {
|
||||
FuriThread* thread;
|
||||
StreamBufferHandle_t stream;
|
||||
FileWorker* file_worker;
|
||||
|
||||
volatile bool worker_running;
|
||||
bool level;
|
||||
int16_t duration;
|
||||
string_t str_data;
|
||||
string_t file_path;
|
||||
};
|
||||
|
||||
void subghz_file_encoder_worker_add_livel_duration(
|
||||
SubGhzFileEncoderWorker* instance,
|
||||
int16_t duration) {
|
||||
bool res = true;
|
||||
if(duration < 0 && !instance->level) {
|
||||
instance->duration += duration;
|
||||
res = false;
|
||||
} else if(duration > 0 && instance->level) {
|
||||
instance->duration += duration;
|
||||
res = false;
|
||||
} else if(duration == 0) {
|
||||
instance->duration = 0;
|
||||
}
|
||||
|
||||
if(res) {
|
||||
instance->level = !instance->level;
|
||||
instance->duration += duration;
|
||||
xStreamBufferSend(instance->stream, &instance->duration, sizeof(int16_t), 10);
|
||||
instance->duration = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool subghz_file_encoder_worker_data_parse(
|
||||
SubGhzFileEncoderWorker* instance,
|
||||
const char* strStart,
|
||||
size_t len) {
|
||||
char* str1;
|
||||
size_t ind_start = (size_t)strStart; //store the start address of the beginning of the line
|
||||
bool res = false;
|
||||
|
||||
str1 = strstr(
|
||||
strStart, "RAW_Data: "); //looking for the beginning of the desired title in the line
|
||||
if(str1 != NULL) {
|
||||
str1 = strchr(
|
||||
str1,
|
||||
' '); //if found, shift the pointer by 1 element per line "RAW_Data: -1, 2, -2..."
|
||||
subghz_file_encoder_worker_add_livel_duration(instance, atoi(str1));
|
||||
while(
|
||||
strchr(str1, ',') != NULL &&
|
||||
((size_t)str1 <
|
||||
(len +
|
||||
ind_start))) { //check that there is still an element in the line and that it has not gone beyond the line
|
||||
str1 = strchr(str1, ',');
|
||||
str1 += 2; //if found, shift the pointer by next element per line
|
||||
subghz_file_encoder_worker_add_livel_duration(instance, atoi(str1));
|
||||
}
|
||||
res = true;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
LevelDuration subghz_file_encoder_worker_get_level_duration(void* context) {
|
||||
furi_assert(context);
|
||||
SubGhzFileEncoderWorker* instance = context;
|
||||
int16_t duration;
|
||||
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||
int ret = xStreamBufferReceiveFromISR(
|
||||
instance->stream, &duration, sizeof(int16_t), &xHigherPriorityTaskWoken);
|
||||
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
|
||||
if(ret == sizeof(int16_t)) {
|
||||
LevelDuration level_duration = {.level = LEVEL_DURATION_RESET};
|
||||
if(duration < 0) {
|
||||
level_duration = level_duration_make(false, duration * -1);
|
||||
} else if(duration > 0) {
|
||||
level_duration = level_duration_make(true, duration);
|
||||
} else if(duration == 0) {
|
||||
level_duration = level_duration_reset();
|
||||
FURI_LOG_I("SubGhzFileEncoderWorker", "Stop transmission");
|
||||
}
|
||||
return level_duration;
|
||||
} else {
|
||||
FURI_LOG_E("SubGhzFileEncoderWorker", "Slow flash read");
|
||||
return level_duration_wait();
|
||||
}
|
||||
}
|
||||
|
||||
/** Worker thread
|
||||
*
|
||||
* @param context
|
||||
* @return exit code
|
||||
*/
|
||||
static int32_t subghz_file_encoder_worker_thread(void* context) {
|
||||
SubGhzFileEncoderWorker* instance = context;
|
||||
FURI_LOG_I("SubGhzFileEncoderWorker", "Worker start");
|
||||
bool res = false;
|
||||
do {
|
||||
if(!file_worker_open(
|
||||
instance->file_worker,
|
||||
string_get_cstr(instance->file_path),
|
||||
FSAM_READ,
|
||||
FSOM_OPEN_EXISTING)) {
|
||||
break;
|
||||
}
|
||||
//todo skips 3 lines file header
|
||||
if(!file_worker_read_until(instance->file_worker, instance->str_data, '\n')) {
|
||||
break;
|
||||
}
|
||||
if(!file_worker_read_until(instance->file_worker, instance->str_data, '\n')) {
|
||||
break;
|
||||
}
|
||||
if(!file_worker_read_until(instance->file_worker, instance->str_data, '\n')) {
|
||||
break;
|
||||
}
|
||||
res = true;
|
||||
FURI_LOG_I("SubGhzFileEncoderWorker", "Start transmission");
|
||||
} while(0);
|
||||
|
||||
while(res && instance->worker_running) {
|
||||
size_t stream_free_byte = xStreamBufferSpacesAvailable(instance->stream);
|
||||
if((stream_free_byte / sizeof(int16_t)) >= SUBGHZ_FILE_ENCODER_LOAD) {
|
||||
if(file_worker_read_until(instance->file_worker, instance->str_data, '\n')) {
|
||||
if(!subghz_file_encoder_worker_data_parse(
|
||||
instance,
|
||||
string_get_cstr(instance->str_data),
|
||||
strlen(string_get_cstr(instance->str_data)))) {
|
||||
//to stop DMA correctly
|
||||
subghz_file_encoder_worker_add_livel_duration(instance, LEVEL_DURATION_RESET);
|
||||
subghz_file_encoder_worker_add_livel_duration(instance, LEVEL_DURATION_RESET);
|
||||
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
subghz_file_encoder_worker_add_livel_duration(instance, LEVEL_DURATION_RESET);
|
||||
subghz_file_encoder_worker_add_livel_duration(instance, LEVEL_DURATION_RESET);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//waiting for the end of the transfer
|
||||
while(instance->worker_running) {
|
||||
osDelay(50);
|
||||
}
|
||||
file_worker_close(instance->file_worker);
|
||||
FURI_LOG_I("SubGhzFileEncoderWorker", "Worker stop");
|
||||
return 0;
|
||||
}
|
||||
|
||||
SubGhzFileEncoderWorker* subghz_file_encoder_worker_alloc() {
|
||||
SubGhzFileEncoderWorker* instance = furi_alloc(sizeof(SubGhzFileEncoderWorker));
|
||||
|
||||
instance->thread = furi_thread_alloc();
|
||||
furi_thread_set_name(instance->thread, "subghz_file_encoder_worker");
|
||||
furi_thread_set_stack_size(instance->thread, 2048);
|
||||
furi_thread_set_context(instance->thread, instance);
|
||||
furi_thread_set_callback(instance->thread, subghz_file_encoder_worker_thread);
|
||||
instance->stream = xStreamBufferCreate(sizeof(int16_t) * 4096, sizeof(int16_t));
|
||||
|
||||
instance->file_worker = file_worker_alloc(false);
|
||||
string_init(instance->str_data);
|
||||
string_init(instance->file_path);
|
||||
instance->level = false;
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
void subghz_file_encoder_worker_free(SubGhzFileEncoderWorker* instance) {
|
||||
furi_assert(instance);
|
||||
|
||||
vStreamBufferDelete(instance->stream);
|
||||
furi_thread_free(instance->thread);
|
||||
|
||||
string_clear(instance->str_data);
|
||||
string_clear(instance->file_path);
|
||||
file_worker_free(instance->file_worker);
|
||||
|
||||
free(instance);
|
||||
}
|
||||
|
||||
bool subghz_file_encoder_worker_start(SubGhzFileEncoderWorker* instance, const char* file_path) {
|
||||
furi_assert(instance);
|
||||
furi_assert(!instance->worker_running);
|
||||
|
||||
xStreamBufferReset(instance->stream);
|
||||
string_set(instance->file_path, file_path);
|
||||
instance->worker_running = true;
|
||||
furi_thread_start(instance->thread);
|
||||
return true;
|
||||
}
|
||||
|
||||
void subghz_file_encoder_worker_stop(SubGhzFileEncoderWorker* instance) {
|
||||
furi_assert(instance);
|
||||
furi_assert(instance->worker_running);
|
||||
|
||||
instance->worker_running = false;
|
||||
furi_thread_join(instance->thread);
|
||||
}
|
||||
|
||||
bool subghz_file_encoder_worker_is_running(SubGhzFileEncoderWorker* instance) {
|
||||
furi_assert(instance);
|
||||
return instance->worker_running;
|
||||
}
|
39
lib/subghz/subghz_file_encoder_worker.h
Normal file
39
lib/subghz/subghz_file_encoder_worker.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include <furi-hal.h>
|
||||
|
||||
typedef struct SubGhzFileEncoderWorker SubGhzFileEncoderWorker;
|
||||
|
||||
/** Allocate SubGhzFileEncoderWorker
|
||||
*
|
||||
* @return SubGhzFileEncoderWorker*
|
||||
*/
|
||||
SubGhzFileEncoderWorker* subghz_file_encoder_worker_alloc();
|
||||
|
||||
/** Free SubGhzFileEncoderWorker
|
||||
*
|
||||
* @param instance SubGhzFileEncoderWorker instance
|
||||
*/
|
||||
void subghz_file_encoder_worker_free(SubGhzFileEncoderWorker* instance);
|
||||
|
||||
LevelDuration subghz_file_encoder_worker_get_level_duration(void* context);
|
||||
|
||||
/** Start SubGhzFileEncoderWorker
|
||||
*
|
||||
* @param instance 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
|
||||
*/
|
||||
void subghz_file_encoder_worker_stop(SubGhzFileEncoderWorker* instance);
|
||||
|
||||
/** Check if worker is running
|
||||
*
|
||||
* @param instance SubGhzFileEncoderWorker instance
|
||||
* @return bool - true if running
|
||||
*/
|
||||
bool subghz_file_encoder_worker_is_running(SubGhzFileEncoderWorker* instance);
|
@@ -16,6 +16,7 @@
|
||||
#include "protocols/subghz_protocol_nero_radio.h"
|
||||
#include "protocols/subghz_protocol_scher_khan.h"
|
||||
#include "protocols/subghz_protocol_kia.h"
|
||||
#include "protocols/subghz_protocol_raw.h"
|
||||
|
||||
#include "subghz_keystore.h"
|
||||
|
||||
@@ -38,6 +39,7 @@ typedef enum {
|
||||
SubGhzProtocolTypeNeroRadio,
|
||||
SubGhzProtocolTypeScherKhan,
|
||||
SubGhzProtocolTypeKIA,
|
||||
SubGhzProtocolTypeRAW,
|
||||
|
||||
SubGhzProtocolTypeMax,
|
||||
} SubGhzProtocolType;
|
||||
@@ -109,6 +111,8 @@ SubGhzParser* subghz_parser_alloc() {
|
||||
(SubGhzProtocolCommon*)subghz_protocol_scher_khan_alloc();
|
||||
instance->protocols[SubGhzProtocolTypeKIA] =
|
||||
(SubGhzProtocolCommon*)subghz_protocol_kia_alloc();
|
||||
instance->protocols[SubGhzProtocolTypeRAW] =
|
||||
(SubGhzProtocolCommon*)subghz_protocol_raw_alloc();
|
||||
|
||||
return instance;
|
||||
}
|
||||
@@ -143,6 +147,7 @@ void subghz_parser_free(SubGhzParser* instance) {
|
||||
subghz_protocol_scher_khan_free(
|
||||
(SubGhzProtocolScherKhan*)instance->protocols[SubGhzProtocolTypeScherKhan]);
|
||||
subghz_protocol_kia_free((SubGhzProtocolKIA*)instance->protocols[SubGhzProtocolTypeKIA]);
|
||||
subghz_protocol_raw_free((SubGhzProtocolRAW*)instance->protocols[SubGhzProtocolTypeRAW]);
|
||||
|
||||
subghz_keystore_free(instance->keystore);
|
||||
|
||||
@@ -197,6 +202,11 @@ void subghz_parser_load_nice_flor_s_file(SubGhzParser* instance, const char* fil
|
||||
(SubGhzProtocolNiceFlorS*)instance->protocols[SubGhzProtocolTypeNiceFlorS], file_name);
|
||||
}
|
||||
|
||||
void subghz_parser_load_came_atomo_file(SubGhzParser* instance, const char* file_name) {
|
||||
subghz_protocol_came_atomo_name_file(
|
||||
(SubGhzProtocolCameAtomo*)instance->protocols[SubGhzProtocolTypeCameAtomo], file_name);
|
||||
}
|
||||
|
||||
void subghz_parser_load_keeloq_file(SubGhzParser* instance, const char* file_name) {
|
||||
subghz_keystore_load(instance->keystore, file_name);
|
||||
}
|
||||
@@ -229,6 +239,12 @@ void subghz_parser_reset(SubGhzParser* instance) {
|
||||
subghz_protocol_scher_khan_reset(
|
||||
(SubGhzProtocolScherKhan*)instance->protocols[SubGhzProtocolTypeScherKhan]);
|
||||
subghz_protocol_kia_reset((SubGhzProtocolKIA*)instance->protocols[SubGhzProtocolTypeKIA]);
|
||||
subghz_protocol_raw_reset((SubGhzProtocolRAW*)instance->protocols[SubGhzProtocolTypeRAW]);
|
||||
}
|
||||
|
||||
void subghz_parser_raw_parse(SubGhzParser* instance, bool level, uint32_t duration) {
|
||||
subghz_protocol_raw_parse(
|
||||
(SubGhzProtocolRAW*)instance->protocols[SubGhzProtocolTypeRAW], level, duration);
|
||||
}
|
||||
|
||||
void subghz_parser_parse(SubGhzParser* instance, bool level, uint32_t duration) {
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include "protocols/subghz_protocol_common.h"
|
||||
|
||||
typedef void (*SubGhzProtocolTextCallback)(string_t text, void* context);
|
||||
typedef void (*SubGhzProtocolCommonCallbackDump)(SubGhzProtocolCommon *parser, void* context);
|
||||
typedef void (*SubGhzProtocolCommonCallbackDump)(SubGhzProtocolCommon* parser, void* context);
|
||||
|
||||
typedef struct SubGhzParser SubGhzParser;
|
||||
|
||||
@@ -33,7 +33,10 @@ SubGhzProtocolCommon* subghz_parser_get_by_name(SubGhzParser* instance, const ch
|
||||
* @param callback - SubGhzProtocolTextCallback callback
|
||||
* @param context
|
||||
*/
|
||||
void subghz_parser_enable_dump_text(SubGhzParser* instance, SubGhzProtocolTextCallback callback, void* context);
|
||||
void subghz_parser_enable_dump_text(
|
||||
SubGhzParser* instance,
|
||||
SubGhzProtocolTextCallback callback,
|
||||
void* context);
|
||||
|
||||
/** Outputting data SubGhzParser from all parsers
|
||||
*
|
||||
@@ -41,7 +44,10 @@ void subghz_parser_enable_dump_text(SubGhzParser* instance, SubGhzProtocolTextCa
|
||||
* @param callback - SubGhzProtocolTextCallback callback
|
||||
* @param context
|
||||
*/
|
||||
void subghz_parser_enable_dump(SubGhzParser* instance, SubGhzProtocolCommonCallbackDump callback, void* context);
|
||||
void subghz_parser_enable_dump(
|
||||
SubGhzParser* instance,
|
||||
SubGhzProtocolCommonCallbackDump callback,
|
||||
void* context);
|
||||
|
||||
/** File name rainbow table Nice Flor-S
|
||||
*
|
||||
@@ -50,6 +56,13 @@ void subghz_parser_enable_dump(SubGhzParser* instance, SubGhzProtocolCommonCallb
|
||||
*/
|
||||
void subghz_parser_load_nice_flor_s_file(SubGhzParser* instance, const char* file_name);
|
||||
|
||||
/** File name rainbow table Came Atomo
|
||||
*
|
||||
* @param instance - SubGhzParser instance
|
||||
* @param file_name - "path/file_name"
|
||||
*/
|
||||
void subghz_parser_load_came_atomo_file(SubGhzParser* instance, const char* file_name);
|
||||
|
||||
/** File upload manufacture keys
|
||||
*
|
||||
* @param instance - SubGhzParser instance
|
||||
@@ -63,6 +76,8 @@ void subghz_parser_load_keeloq_file(SubGhzParser* instance, const char* file_nam
|
||||
*/
|
||||
void subghz_parser_reset(SubGhzParser* instance);
|
||||
|
||||
void subghz_parser_raw_parse(SubGhzParser* instance, bool level, uint32_t duration);
|
||||
|
||||
/** Loading data into all parsers
|
||||
*
|
||||
* @param instance - SubGhzParser instance
|
||||
|
Reference in New Issue
Block a user