ws_generic.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #pragma once
  2. #include <stdbool.h>
  3. #include <stdint.h>
  4. #include <stddef.h>
  5. #include <lib/flipper_format/flipper_format.h>
  6. #include "furi.h"
  7. #include "furi_hal.h"
  8. #include <lib/subghz/types.h>
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. typedef struct WSBlockGeneric WSBlockGeneric;
  13. struct WSBlockGeneric {
  14. const char* protocol_name;
  15. uint64_t data;
  16. uint32_t id;
  17. uint8_t data_count_bit;
  18. uint8_t battery_low;
  19. uint8_t humidity;
  20. uint8_t channel;
  21. uint8_t btn;
  22. float temp;
  23. };
  24. /**
  25. * Get name preset.
  26. * @param preset_name name preset
  27. * @param preset_str Output name preset
  28. */
  29. void ws_block_generic_get_preset_name(const char* preset_name, FuriString* preset_str);
  30. /**
  31. * Serialize data WSBlockGeneric.
  32. * @param instance Pointer to a WSBlockGeneric instance
  33. * @param flipper_format Pointer to a FlipperFormat instance
  34. * @param preset The modulation on which the signal was received, SubGhzRadioPreset
  35. * @return true On success
  36. */
  37. bool ws_block_generic_serialize(
  38. WSBlockGeneric* instance,
  39. FlipperFormat* flipper_format,
  40. SubGhzRadioPreset* preset);
  41. /**
  42. * Deserialize data WSBlockGeneric.
  43. * @param instance Pointer to a WSBlockGeneric instance
  44. * @param flipper_format Pointer to a FlipperFormat instance
  45. * @return true On success
  46. */
  47. bool ws_block_generic_deserialize(WSBlockGeneric* instance, FlipperFormat* flipper_format);
  48. float ws_block_generic_fahrenheit_to_celsius(float fahrenheit);
  49. #ifdef __cplusplus
  50. }
  51. #endif