unleashed-firmware/applications/plugins/weather_station/weather_station_history.h
Skorpionm 9a9abd59e9
[FL-2904, FL-2900, FL-2890] WS: add app WeatherStation (#1833)
* WeatherStation: start
* SubGhz: rename protocol magellen -> magellan
* WeatherStation: err Unresolved symbols: {'subghz_protocol_decoder_base_get_string'}
* WeatherStation: fix Unresolved symbols: {'subghz_protocol_decoder_base_get_string'}
* Subghz: add set protocol_items
* WeatherStation: adding your protocols
* WS: add Infactory protocol
* WS: add history
* WS: add setting
* WS: add lock
* WS: add hopper frequency
* WS: fix history
* WS fix string_t -> FuriString*
* WS: add images
* WS: history record update when receiving data from the sensor again
* WS: add receiver info, delete extra code
* WS: add protocol ThermoPRO_TX4
* [FL-2900] SubGhz: Move icons in Sub-GHz
* WS: add Notification
* [FL-2890] SubGhz: Rename *_user files in resources to _user.example
* WS: add about scene
* WS: removing redundant code
* WS: add  protocol Nexus-TH
* WS: add protocol GT_WT03
* WS: fix notification and rename "Weather Station" -> "Read Weather Station"
* SubGhz: partial unit tests fix
* SubGhz: fix unit_test
* SubGhz: remove dead code
* SubGhz: rename SubGhzPresetDefinition into SubGhzRadioPreset, cleanup subghz types.

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2022-10-20 02:27:26 +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);