2022-03-03 12:48:56 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
#include <lib/flipper_format/flipper_format.h>
|
2023-02-07 19:33:05 +03:00
|
|
|
#include <furi.h>
|
|
|
|
#include <furi_hal.h>
|
2022-07-26 17:16:59 +03:00
|
|
|
#include "../types.h"
|
2022-03-03 12:48:56 +03:00
|
|
|
|
2022-10-19 20:27:26 +03:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2022-03-03 12:48:56 +03:00
|
|
|
typedef struct SubGhzBlockGeneric SubGhzBlockGeneric;
|
|
|
|
|
|
|
|
struct SubGhzBlockGeneric {
|
|
|
|
const char* protocol_name;
|
|
|
|
uint64_t data;
|
|
|
|
uint32_t serial;
|
2023-02-09 07:48:06 +03:00
|
|
|
uint16_t data_count_bit;
|
2022-03-03 12:48:56 +03:00
|
|
|
uint8_t btn;
|
2022-05-05 01:44:15 +03:00
|
|
|
uint32_t cnt;
|
2022-03-03 12:48:56 +03:00
|
|
|
};
|
|
|
|
|
2022-03-16 12:18:48 +03:00
|
|
|
/**
|
2022-07-26 17:16:59 +03:00
|
|
|
* Get name preset.
|
|
|
|
* @param preset_name name preset
|
|
|
|
* @param preset_str Output name preset
|
2022-03-16 12:18:48 +03:00
|
|
|
*/
|
2022-10-05 18:15:23 +03:00
|
|
|
void subghz_block_generic_get_preset_name(const char* preset_name, FuriString* preset_str);
|
2022-03-03 12:48:56 +03:00
|
|
|
|
2022-03-16 12:18:48 +03:00
|
|
|
/**
|
|
|
|
* Serialize data SubGhzBlockGeneric.
|
|
|
|
* @param instance Pointer to a SubGhzBlockGeneric instance
|
|
|
|
* @param flipper_format Pointer to a FlipperFormat instance
|
2022-10-19 20:27:26 +03:00
|
|
|
* @param preset The modulation on which the signal was received, SubGhzRadioPreset
|
2023-03-03 18:09:13 +03:00
|
|
|
* @return Status Error
|
2022-03-16 12:18:48 +03:00
|
|
|
*/
|
2023-03-03 18:09:13 +03:00
|
|
|
SubGhzProtocolStatus subghz_block_generic_serialize(
|
2022-03-03 12:48:56 +03:00
|
|
|
SubGhzBlockGeneric* instance,
|
|
|
|
FlipperFormat* flipper_format,
|
2022-10-19 20:27:26 +03:00
|
|
|
SubGhzRadioPreset* preset);
|
2022-03-03 12:48:56 +03:00
|
|
|
|
2022-03-16 12:18:48 +03:00
|
|
|
/**
|
|
|
|
* Deserialize data SubGhzBlockGeneric.
|
|
|
|
* @param instance Pointer to a SubGhzBlockGeneric instance
|
|
|
|
* @param flipper_format Pointer to a FlipperFormat instance
|
2023-03-03 18:09:13 +03:00
|
|
|
* @return Status Error
|
2022-03-16 12:18:48 +03:00
|
|
|
*/
|
2023-03-03 18:09:13 +03:00
|
|
|
SubGhzProtocolStatus
|
|
|
|
subghz_block_generic_deserialize(SubGhzBlockGeneric* instance, FlipperFormat* flipper_format);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Deserialize data SubGhzBlockGeneric.
|
|
|
|
* @param instance Pointer to a SubGhzBlockGeneric instance
|
|
|
|
* @param flipper_format Pointer to a FlipperFormat instance
|
|
|
|
* @param count_bit Count bit protocol
|
|
|
|
* @return Status Error
|
|
|
|
*/
|
|
|
|
SubGhzProtocolStatus subghz_block_generic_deserialize_check_count_bit(
|
|
|
|
SubGhzBlockGeneric* instance,
|
|
|
|
FlipperFormat* flipper_format,
|
|
|
|
uint16_t count_bit);
|
2022-10-19 20:27:26 +03:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|