generic.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 "../types.h"
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. typedef struct SubGhzBlockGeneric SubGhzBlockGeneric;
  13. struct SubGhzBlockGeneric {
  14. const char* protocol_name;
  15. uint64_t data;
  16. uint32_t serial;
  17. uint8_t data_count_bit;
  18. uint8_t btn;
  19. uint32_t cnt;
  20. };
  21. /**
  22. * Get name preset.
  23. * @param preset_name name preset
  24. * @param preset_str Output name preset
  25. */
  26. void subghz_block_generic_get_preset_name(const char* preset_name, FuriString* preset_str);
  27. /**
  28. * Serialize data SubGhzBlockGeneric.
  29. * @param instance Pointer to a SubGhzBlockGeneric instance
  30. * @param flipper_format Pointer to a FlipperFormat instance
  31. * @param preset The modulation on which the signal was received, SubGhzRadioPreset
  32. * @return true On success
  33. */
  34. bool subghz_block_generic_serialize(
  35. SubGhzBlockGeneric* instance,
  36. FlipperFormat* flipper_format,
  37. SubGhzRadioPreset* preset);
  38. /**
  39. * Deserialize data SubGhzBlockGeneric.
  40. * @param instance Pointer to a SubGhzBlockGeneric instance
  41. * @param flipper_format Pointer to a FlipperFormat instance
  42. * @return true On success
  43. */
  44. bool subghz_block_generic_deserialize(SubGhzBlockGeneric* instance, FlipperFormat* flipper_format);
  45. #ifdef __cplusplus
  46. }
  47. #endif