flipperzero-firmware/applications/external/weather_station/weather_station_history.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

113 lines
3.0 KiB
C

#pragma once
#include <math.h>
#include <furi.h>
#include <furi_hal.h>
#include <lib/flipper_format/flipper_format.h>
#include <lib/subghz/types.h>
typedef struct WSHistory WSHistory;
/** History state add key */
typedef enum {
WSHistoryStateAddKeyUnknown,
WSHistoryStateAddKeyTimeOut,
WSHistoryStateAddKeyNewDada,
WSHistoryStateAddKeyUpdateData,
WSHistoryStateAddKeyOverflow,
} WSHistoryStateAddKey;
/** Allocate WSHistory
*
* @return WSHistory*
*/
WSHistory* ws_history_alloc(void);
/** Free WSHistory
*
* @param instance - WSHistory instance
*/
void ws_history_free(WSHistory* instance);
/** Clear history
*
* @param instance - WSHistory instance
*/
void ws_history_reset(WSHistory* instance);
/** Get frequency to history[idx]
*
* @param instance - WSHistory instance
* @param idx - record index
* @return frequency - frequency Hz
*/
uint32_t ws_history_get_frequency(WSHistory* instance, uint16_t idx);
SubGhzRadioPreset* ws_history_get_radio_preset(WSHistory* instance, uint16_t idx);
/** Get preset to history[idx]
*
* @param instance - WSHistory instance
* @param idx - record index
* @return preset - preset name
*/
const char* ws_history_get_preset(WSHistory* instance, uint16_t idx);
/** Get history index write
*
* @param instance - WSHistory instance
* @return idx - current record index
*/
uint16_t ws_history_get_item(WSHistory* instance);
/** Get type protocol to history[idx]
*
* @param instance - WSHistory instance
* @param idx - record index
* @return type - type protocol
*/
uint8_t ws_history_get_type_protocol(WSHistory* instance, uint16_t idx);
/** Get name protocol to history[idx]
*
* @param instance - WSHistory instance
* @param idx - record index
* @return name - const char* name protocol
*/
const char* ws_history_get_protocol_name(WSHistory* instance, uint16_t idx);
/** Get string item menu to history[idx]
*
* @param instance - WSHistory instance
* @param output - FuriString* output
* @param idx - record index
*/
void ws_history_get_text_item_menu(WSHistory* instance, FuriString* output, uint16_t idx);
/** Get string the remaining number of records to history
*
* @param instance - WSHistory instance
* @param output - FuriString* output
* @return bool - is FUUL
*/
bool ws_history_get_text_space_left(WSHistory* instance, FuriString* output);
/** Add protocol to history
*
* @param instance - WSHistory instance
* @param context - SubGhzProtocolCommon context
* @param preset - SubGhzRadioPreset preset
* @return WSHistoryStateAddKey;
*/
WSHistoryStateAddKey
ws_history_add_to_history(WSHistory* instance, void* context, SubGhzRadioPreset* preset);
/** Get SubGhzProtocolCommonLoad to load into the protocol decoder bin data
*
* @param instance - WSHistory instance
* @param idx - record index
* @return SubGhzProtocolCommonLoad*
*/
FlipperFormat* ws_history_get_raw_data(WSHistory* instance, uint16_t idx);