[FL-1931, FL-2005] SubGhz: migration in flipper file format (#807)
* SubGhz: add save key in flipper file format * [FL-2005] SubGhz: fix stored signals cannot be deleted * SubGhz: add load key in flipper file format * SubGhz: fix syntax * SubGhz: fix bad file upload * Storage: add function to get the next free filename * SubGhz: add save RAW in flipper file format * SubGhz: add load RAW in flipper file format * SubGhz: refactoring protocol * SubGhz: refactoring scene * SubGhz: fix SubGhzNotificationState define * Makefile: proper comapre for FORCE Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
#include <m-string.h>
|
||||
#include <furi-hal.h>
|
||||
#include <stdint.h>
|
||||
#include "file-worker.h"
|
||||
#include <lib/flipper_file/flipper_file.h>
|
||||
|
||||
#define bit_read(value, bit) (((value) >> (bit)) & 0x01)
|
||||
#define bit_set(value, bit) ((value) |= (1UL << (bit)))
|
||||
@@ -21,6 +21,15 @@
|
||||
#define SUBGHZ_APP_EXTENSION ".sub"
|
||||
#define SUBGHZ_ENCODER_UPLOAD_MAX_SIZE 2048
|
||||
|
||||
#define SUBGHZ_KEY_TAG "SubGhzParser"
|
||||
#define SUBGHZ_KEY_FILE_VERSION 1
|
||||
#define SUBGHZ_KEY_FILE_TYPE "Flipper SubGhz Key File"
|
||||
|
||||
#define SUBGHZ_RAW_TAG "SubGhzRAW"
|
||||
#define SUBGHZ_RAW_FILE_VERSION 1
|
||||
#define SUBGHZ_RAW_FILE_TYPE "Flipper SubGhz RAW File"
|
||||
|
||||
|
||||
typedef enum {
|
||||
SubGhzProtocolCommonTypeUnknown,
|
||||
SubGhzProtocolCommonTypeStatic,
|
||||
@@ -37,11 +46,14 @@ typedef void (*SubGhzProtocolCommonCallback)(SubGhzProtocolCommon* parser, void*
|
||||
typedef void (*SubGhzProtocolCommonToStr)(SubGhzProtocolCommon* instance, string_t output);
|
||||
|
||||
//Get string to save
|
||||
typedef void (*SubGhzProtocolCommonGetStrSave)(SubGhzProtocolCommon* instance, string_t output);
|
||||
typedef bool (
|
||||
*SubGhzProtocolCommonSaveFile)(SubGhzProtocolCommon* instance, FlipperFile* flipper_file);
|
||||
|
||||
//Load protocol from file
|
||||
typedef bool (
|
||||
*SubGhzProtocolCommonLoadFromFile)(FileWorker* file_worker, SubGhzProtocolCommon* instance, const char* file_path);
|
||||
typedef bool (*SubGhzProtocolCommonLoadFromFile)(
|
||||
FlipperFile* flipper_file,
|
||||
SubGhzProtocolCommon* instance,
|
||||
const char* file_path);
|
||||
//Load protocol
|
||||
typedef void (*SubGhzProtocolCommonLoadFromRAW)(SubGhzProtocolCommon* instance, void* context);
|
||||
//Get upload encoder protocol
|
||||
@@ -77,7 +89,7 @@ struct SubGhzProtocolCommon {
|
||||
/* Dump To String */
|
||||
SubGhzProtocolCommonToStr to_string;
|
||||
/* Get string to save */
|
||||
SubGhzProtocolCommonGetStrSave to_save_string;
|
||||
SubGhzProtocolCommonSaveFile to_save_file;
|
||||
/* Load protocol from file */
|
||||
SubGhzProtocolCommonLoadFromFile to_load_protocol_from_file;
|
||||
/* Load protocol from RAW data */
|
||||
@@ -196,3 +208,21 @@ void subghz_protocol_common_to_str(SubGhzProtocolCommon* instance, string_t outp
|
||||
* @return bool
|
||||
*/
|
||||
bool subghz_protocol_common_read_hex(string_t str, uint8_t* buff, uint16_t len);
|
||||
|
||||
/** Adding data to a file
|
||||
*
|
||||
* @param instance - SubGhzProtocolCommon instance
|
||||
* @param flipper_file - FlipperFile
|
||||
* @return bool
|
||||
*/
|
||||
bool subghz_protocol_common_to_save_file(SubGhzProtocolCommon* instance, FlipperFile* flipper_file);
|
||||
|
||||
/** Loading data to a file
|
||||
*
|
||||
* @param instance - SubGhzProtocolCommon instance
|
||||
* @param flipper_file - FlipperFile
|
||||
* @return bool
|
||||
*/
|
||||
bool subghz_protocol_common_to_load_protocol_from_file(
|
||||
SubGhzProtocolCommon* instance,
|
||||
FlipperFile* flipper_file);
|
||||
|
Reference in New Issue
Block a user