pocsag_pager_history.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #pragma once
  2. #include <math.h>
  3. #include <furi.h>
  4. #include <furi_hal.h>
  5. #include <lib/flipper_format/flipper_format.h>
  6. #include <lib/subghz/types.h>
  7. typedef struct PCSGHistory PCSGHistory;
  8. /** History state add key */
  9. typedef enum {
  10. PCSGHistoryStateAddKeyUnknown,
  11. PCSGHistoryStateAddKeyTimeOut,
  12. PCSGHistoryStateAddKeyNewDada,
  13. PCSGHistoryStateAddKeyUpdateData,
  14. PCSGHistoryStateAddKeyOverflow,
  15. } PCSGHistoryStateAddKey;
  16. /** Allocate PCSGHistory
  17. *
  18. * @return PCSGHistory*
  19. */
  20. PCSGHistory* pcsg_history_alloc(void);
  21. /** Free PCSGHistory
  22. *
  23. * @param instance - PCSGHistory instance
  24. */
  25. void pcsg_history_free(PCSGHistory* instance);
  26. /** Clear history
  27. *
  28. * @param instance - PCSGHistory instance
  29. */
  30. void pcsg_history_reset(PCSGHistory* instance);
  31. /** Get frequency to history[idx]
  32. *
  33. * @param instance - PCSGHistory instance
  34. * @param idx - record index
  35. * @return frequency - frequency Hz
  36. */
  37. uint32_t pcsg_history_get_frequency(PCSGHistory* instance, uint16_t idx);
  38. SubGhzRadioPreset* pcsg_history_get_radio_preset(PCSGHistory* instance, uint16_t idx);
  39. /** Get preset to history[idx]
  40. *
  41. * @param instance - PCSGHistory instance
  42. * @param idx - record index
  43. * @return preset - preset name
  44. */
  45. const char* pcsg_history_get_preset(PCSGHistory* instance, uint16_t idx);
  46. /** Get history index write
  47. *
  48. * @param instance - PCSGHistory instance
  49. * @return idx - current record index
  50. */
  51. uint16_t pcsg_history_get_item(PCSGHistory* instance);
  52. /** Get type protocol to history[idx]
  53. *
  54. * @param instance - PCSGHistory instance
  55. * @param idx - record index
  56. * @return type - type protocol
  57. */
  58. uint8_t pcsg_history_get_type_protocol(PCSGHistory* instance, uint16_t idx);
  59. /** Get name protocol to history[idx]
  60. *
  61. * @param instance - PCSGHistory instance
  62. * @param idx - record index
  63. * @return name - const char* name protocol
  64. */
  65. const char* pcsg_history_get_protocol_name(PCSGHistory* instance, uint16_t idx);
  66. /** Get string item menu to history[idx]
  67. *
  68. * @param instance - PCSGHistory instance
  69. * @param output - FuriString* output
  70. * @param idx - record index
  71. */
  72. void pcsg_history_get_text_item_menu(PCSGHistory* instance, FuriString* output, uint16_t idx);
  73. /** Get string the remaining number of records to history
  74. *
  75. * @param instance - PCSGHistory instance
  76. * @param output - FuriString* output
  77. * @return bool - is FUUL
  78. */
  79. bool pcsg_history_get_text_space_left(PCSGHistory* instance, FuriString* output);
  80. /** Add protocol to history
  81. *
  82. * @param instance - PCSGHistory instance
  83. * @param context - SubGhzProtocolCommon context
  84. * @param preset - SubGhzRadioPreset preset
  85. * @return PCSGHistoryStateAddKey;
  86. */
  87. PCSGHistoryStateAddKey
  88. pcsg_history_add_to_history(PCSGHistory* instance, void* context, SubGhzRadioPreset* preset);
  89. /** Get SubGhzProtocolCommonLoad to load into the protocol decoder bin data
  90. *
  91. * @param instance - PCSGHistory instance
  92. * @param idx - record index
  93. * @return SubGhzProtocolCommonLoad*
  94. */
  95. FlipperFormat* pcsg_history_get_raw_data(PCSGHistory* instance, uint16_t idx);