[FL-3106] SubGhz: better and more verbose error handling in protocols, stricter CAME validation (#2443)
* SubGhz: add error protocol * WS: add error protocol * SubGhz: error processing * SubGhz: more stringent CAME protocol restrictions * SubGhz: fix header duration CAME protocol * SubGhz: delete comments * SubGhz: sync SubGhzProtocolStatus with FuriStatus * SubGhz: update documentation and bump api_version Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -29,14 +29,36 @@ typedef struct {
|
||||
size_t data_size;
|
||||
} SubGhzRadioPreset;
|
||||
|
||||
typedef enum {
|
||||
SubGhzProtocolStatusOk = 0,
|
||||
// Errors
|
||||
SubGhzProtocolStatusError = (-1), ///< General unclassified error
|
||||
// Serialize/De-serialize
|
||||
SubGhzProtocolStatusErrorParserHeader = (-2), ///< Missing or invalid file header
|
||||
SubGhzProtocolStatusErrorParserFrequency = (-3), ///< Missing `Frequency`
|
||||
SubGhzProtocolStatusErrorParserPreset = (-4), ///< Missing `Preset`
|
||||
SubGhzProtocolStatusErrorParserCustomPreset = (-5), ///< Missing `Custom_preset_module`
|
||||
SubGhzProtocolStatusErrorParserProtocolName = (-6), ///< Missing `Protocol` name
|
||||
SubGhzProtocolStatusErrorParserBitCount = (-7), ///< Missing `Bit`
|
||||
SubGhzProtocolStatusErrorParserKey = (-8), ///< Missing `Key`
|
||||
SubGhzProtocolStatusErrorParserTe = (-9), ///< Missing `Te`
|
||||
SubGhzProtocolStatusErrorParserOthers = (-10), ///< Missing some other mandatory keys
|
||||
// Invalid data
|
||||
SubGhzProtocolStatusErrorValueBitCount = (-11), ///< Invalid bit count value
|
||||
// Encoder issue
|
||||
SubGhzProtocolStatusErrorEncoderGetUpload = (-12), ///< Payload encoder failure
|
||||
// Special Values
|
||||
SubGhzProtocolStatusReserved = 0x7FFFFFFF, ///< Prevents enum down-size compiler optimization.
|
||||
} SubGhzProtocolStatus;
|
||||
|
||||
// Allocator and Deallocator
|
||||
typedef void* (*SubGhzAlloc)(SubGhzEnvironment* environment);
|
||||
typedef void (*SubGhzFree)(void* context);
|
||||
|
||||
// Serialize and Deserialize
|
||||
typedef bool (
|
||||
typedef SubGhzProtocolStatus (
|
||||
*SubGhzSerialize)(void* context, FlipperFormat* flipper_format, SubGhzRadioPreset* preset);
|
||||
typedef bool (*SubGhzDeserialize)(void* context, FlipperFormat* flipper_format);
|
||||
typedef SubGhzProtocolStatus (*SubGhzDeserialize)(void* context, FlipperFormat* flipper_format);
|
||||
|
||||
// Decoder specific
|
||||
typedef void (*SubGhzDecoderFeed)(void* decoder, bool level, uint32_t duration);
|
||||
|
Reference in New Issue
Block a user