subghz_history.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #pragma once
  2. #include <lib/subghz/protocols/subghz_protocol_common.h>
  3. typedef struct SubGhzHistory SubGhzHistory;
  4. /** Allocate SubGhzHistory
  5. *
  6. * @return SubGhzHistory*
  7. */
  8. SubGhzHistory* subghz_history_alloc(void);
  9. /** Free SubGhzHistory
  10. *
  11. * @param instance - SubGhzHistory instance
  12. */
  13. void subghz_history_free(SubGhzHistory* instance);
  14. /** Clear history
  15. *
  16. * @param instance - SubGhzHistory instance
  17. */
  18. void subghz_history_clean(SubGhzHistory* instance);
  19. /** Set frequency and preset to history[idx]
  20. *
  21. * @param instance - SubGhzHistory instance
  22. * @param idx - record index
  23. * @param frequency - frequency Hz
  24. * @param preset - FuriHalSubGhzPreset preset
  25. */
  26. void subghz_history_set_frequency_preset(
  27. SubGhzHistory* instance,
  28. uint16_t idx,
  29. uint32_t frequency,
  30. FuriHalSubGhzPreset preset);
  31. /** Get frequency to history[idx]
  32. *
  33. * @param instance - SubGhzHistory instance
  34. * @param idx - record index
  35. * @return frequency - frequency Hz
  36. */
  37. uint32_t subghz_history_get_frequency(SubGhzHistory* instance, uint16_t idx);
  38. /** Get preset to history[idx]
  39. *
  40. * @param instance - SubGhzHistory instance
  41. * @param idx - record index
  42. * @return preset - FuriHalSubGhzPreset preset
  43. */
  44. FuriHalSubGhzPreset subghz_history_get_preset(SubGhzHistory* instance, uint16_t idx);
  45. /** Get history index write
  46. *
  47. * @param instance - SubGhzHistory instance
  48. * @return idx - current record index
  49. */
  50. uint16_t subghz_history_get_item(SubGhzHistory* instance);
  51. /** Get type protocol to history[idx]
  52. *
  53. * @param instance - SubGhzHistory instance
  54. * @param idx - record index
  55. * @return type - type protocol
  56. */
  57. uint8_t subghz_history_get_type_protocol(SubGhzHistory* instance, uint16_t idx);
  58. /** Get name protocol to history[idx]
  59. *
  60. * @param instance - SubGhzHistory instance
  61. * @param idx - record index
  62. * @return name - const char* name protocol
  63. */
  64. const char* subghz_history_get_name(SubGhzHistory* instance, uint16_t idx);
  65. /** Get string item menu to history[idx]
  66. *
  67. * @param instance - SubGhzHistory instance
  68. * @param output - string_t output
  69. * @param idx - record index
  70. */
  71. void subghz_history_get_text_item_menu(SubGhzHistory* instance, string_t output, uint16_t idx);
  72. /** Get string the remaining number of records to history
  73. *
  74. * @param instance - SubGhzHistory instance
  75. * @param output - string_t output
  76. * @return bool - is FUUL
  77. */
  78. bool subghz_history_get_text_space_left(SubGhzHistory* instance, string_t output);
  79. /** Add protocol to history
  80. *
  81. * @param instance - SubGhzHistory instance
  82. * @param context - SubGhzProtocolCommon context
  83. * @param frequency - frequency Hz
  84. * @param preset - FuriHalSubGhzPreset preset
  85. * @return bool;
  86. */
  87. bool subghz_history_add_to_history(
  88. SubGhzHistory* instance,
  89. void* context,
  90. uint32_t frequency,
  91. FuriHalSubGhzPreset preset);
  92. /** Get SubGhzProtocolCommonLoad to load into the protocol decoder bin data
  93. *
  94. * @param instance - SubGhzHistory instance
  95. * @param idx - record index
  96. * @return SubGhzProtocolCommonLoad*
  97. */
  98. SubGhzProtocolCommonLoad* subghz_history_get_raw_data(SubGhzHistory* instance, uint16_t idx);