unleashed-firmware/applications/external/weather_station/protocols/ws_generic.h
hedger 53435579b3
[FL-3097] fbt, faploader: minimal app module implementation (#2420)
* fbt, faploader: minimal app module implementation
* faploader, libs: moved API hashtable core to flipper_application
* example: compound api
* lib: flipper_application: naming fixes, doxygen comments
* fbt: changed `requires` manifest field behavior for app extensions
* examples: refactored plugin apps; faploader: changed new API naming; fbt: changed PLUGIN app type meaning
* loader: dropped support for debug apps & plugin menus
* moved applications/plugins -> applications/external
* Restored x bit on chiplist_convert.py
* git: fixed free-dap submodule path
* pvs: updated submodule paths
* examples: example_advanced_plugins.c: removed potential memory leak on errors
* examples: example_plugins: refined requires
* fbt: not deploying app modules for debug/sample apps; extra validation for .PLUGIN-type apps
* apps: removed cdefines for external apps
* fbt: moved ext app path definition
* fbt: reworked fap_dist handling; f18: synced api_symbols.csv
* fbt: removed resources_paths for extapps
* scripts: reworked storage
* scripts: reworked runfap.py & selfupdate.py to use new api
* wip: fal runner
* fbt: moved file packaging into separate module
* scripts: storage: fixes
* scripts: storage: minor fixes for new api
* fbt: changed internal artifact storage details for external apps
* scripts: storage: additional fixes and better error reporting; examples: using APP_DATA_PATH()
* fbt, scripts: reworked launch_app to deploy plugins; moved old runfap.py to distfap.py
* fbt: extra check for plugins descriptors
* fbt: additional checks in emitter
* fbt: better info message on SDK rebuild
* scripts: removed requirements.txt
* loader: removed remnants of plugins & debug menus
* post-review fixes
2023-03-14 23:29:28 +09:00

81 lines
No EOL
2 KiB
C

#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>
#include <lib/subghz/types.h>
#include <locale/locale.h>
#ifdef __cplusplus
extern "C" {
#endif
#define WS_NO_ID 0xFFFFFFFF
#define WS_NO_BATT 0xFF
#define WS_NO_HUMIDITY 0xFF
#define WS_NO_CHANNEL 0xFF
#define WS_NO_BTN 0xFF
#define WS_NO_TEMPERATURE -273.0f
typedef struct WSBlockGeneric WSBlockGeneric;
struct WSBlockGeneric {
const char* protocol_name;
uint64_t data;
uint32_t id;
uint8_t data_count_bit;
uint8_t battery_low;
uint8_t humidity;
uint32_t timestamp;
uint8_t channel;
uint8_t btn;
float temp;
};
/**
* Get name preset.
* @param preset_name name preset
* @param preset_str Output name preset
*/
void ws_block_generic_get_preset_name(const char* preset_name, FuriString* preset_str);
/**
* Serialize data WSBlockGeneric.
* @param instance Pointer to a WSBlockGeneric instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param preset The modulation on which the signal was received, SubGhzRadioPreset
* @return status
*/
SubGhzProtocolStatus ws_block_generic_serialize(
WSBlockGeneric* instance,
FlipperFormat* flipper_format,
SubGhzRadioPreset* preset);
/**
* Deserialize data WSBlockGeneric.
* @param instance Pointer to a WSBlockGeneric instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return status
*/
SubGhzProtocolStatus
ws_block_generic_deserialize(WSBlockGeneric* instance, FlipperFormat* flipper_format);
/**
* Deserialize data WSBlockGeneric.
* @param instance Pointer to a WSBlockGeneric instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param count_bit Count bit protocol
* @return status
*/
SubGhzProtocolStatus ws_block_generic_deserialize_check_count_bit(
WSBlockGeneric* instance,
FlipperFormat* flipper_format,
uint16_t count_bit);
#ifdef __cplusplus
}
#endif