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>
|
|
|
|
#include "furi.h"
|
|
|
|
#include "furi_hal.h"
|
|
|
|
|
|
|
|
typedef struct SubGhzBlockGeneric SubGhzBlockGeneric;
|
|
|
|
|
|
|
|
struct SubGhzBlockGeneric {
|
|
|
|
const char* protocol_name;
|
|
|
|
uint64_t data;
|
2022-06-05 17:02:32 +03:00
|
|
|
uint64_t data_2;
|
2022-03-03 12:48:56 +03:00
|
|
|
uint32_t serial;
|
|
|
|
uint8_t data_count_bit;
|
|
|
|
uint8_t btn;
|
2022-05-05 01:44:15 +03:00
|
|
|
uint32_t cnt;
|
2022-06-04 03:32:21 +03:00
|
|
|
uint8_t cnt_2;
|
2022-04-11 02:35:11 +03:00
|
|
|
uint32_t seed;
|
2022-03-03 12:48:56 +03:00
|
|
|
};
|
|
|
|
|
2022-03-16 12:18:48 +03:00
|
|
|
/**
|
|
|
|
* Get modulation name.
|
|
|
|
* @param preset modulation,FuriHalSubGhzPreset
|
|
|
|
* @param preset_str Output modulation name
|
|
|
|
* @return true On success
|
|
|
|
*/
|
2022-03-03 12:48:56 +03:00
|
|
|
bool subghz_block_generic_get_preset_name(FuriHalSubGhzPreset preset, string_t preset_str);
|
|
|
|
|
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
|
|
|
|
* @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
|
|
|
|
*/
|
2022-03-03 12:48:56 +03:00
|
|
|
bool subghz_block_generic_serialize(
|
|
|
|
SubGhzBlockGeneric* instance,
|
|
|
|
FlipperFormat* flipper_format,
|
|
|
|
uint32_t frequency,
|
|
|
|
FuriHalSubGhzPreset preset);
|
|
|
|
|
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
|
|
|
|
* @return true On success
|
|
|
|
*/
|
2022-03-03 12:48:56 +03:00
|
|
|
bool subghz_block_generic_deserialize(SubGhzBlockGeneric* instance, FlipperFormat* flipper_format);
|