subghz_history.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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 SubGhzHistory SubGhzHistory;
  8. /** Allocate SubGhzHistory
  9. *
  10. * @return SubGhzHistory*
  11. */
  12. SubGhzHistory* subghz_history_alloc(void);
  13. /** Free SubGhzHistory
  14. *
  15. * @param instance - SubGhzHistory instance
  16. */
  17. void subghz_history_free(SubGhzHistory* instance);
  18. /** Clear history
  19. *
  20. * @param instance - SubGhzHistory instance
  21. */
  22. void subghz_history_reset(SubGhzHistory* instance);
  23. /** Get frequency to history[idx]
  24. *
  25. * @param instance - SubGhzHistory instance
  26. * @param idx - record index
  27. * @return frequency - frequency Hz
  28. */
  29. uint32_t subghz_history_get_frequency(SubGhzHistory* instance, uint16_t idx);
  30. SubGhzRadioPreset* subghz_history_get_radio_preset(SubGhzHistory* instance, uint16_t idx);
  31. /** Get preset to history[idx]
  32. *
  33. * @param instance - SubGhzHistory instance
  34. * @param idx - record index
  35. * @return preset - preset name
  36. */
  37. const char* subghz_history_get_preset(SubGhzHistory* instance, uint16_t idx);
  38. /** Get history index write
  39. *
  40. * @param instance - SubGhzHistory instance
  41. * @return idx - current record index
  42. */
  43. uint16_t subghz_history_get_item(SubGhzHistory* instance);
  44. /** Get type protocol to history[idx]
  45. *
  46. * @param instance - SubGhzHistory instance
  47. * @param idx - record index
  48. * @return type - type protocol
  49. */
  50. uint8_t subghz_history_get_type_protocol(SubGhzHistory* instance, uint16_t idx);
  51. /** Get name protocol to history[idx]
  52. *
  53. * @param instance - SubGhzHistory instance
  54. * @param idx - record index
  55. * @return name - const char* name protocol
  56. */
  57. const char* subghz_history_get_protocol_name(SubGhzHistory* instance, uint16_t idx);
  58. /** Get string item menu to history[idx]
  59. *
  60. * @param instance - SubGhzHistory instance
  61. * @param output - FuriString* output
  62. * @param idx - record index
  63. */
  64. void subghz_history_get_text_item_menu(SubGhzHistory* instance, FuriString* output, uint16_t idx);
  65. /** Get string the remaining number of records to history
  66. *
  67. * @param instance - SubGhzHistory instance
  68. * @param output - FuriString* output
  69. * @return bool - is FUUL
  70. */
  71. bool subghz_history_get_text_space_left(SubGhzHistory* instance, FuriString* output);
  72. /** Add protocol to history
  73. *
  74. * @param instance - SubGhzHistory instance
  75. * @param context - SubGhzProtocolCommon context
  76. * @param preset - SubGhzRadioPreset preset
  77. * @return bool;
  78. */
  79. bool subghz_history_add_to_history(
  80. SubGhzHistory* instance,
  81. void* context,
  82. SubGhzRadioPreset* preset);
  83. /** Get SubGhzProtocolCommonLoad to load into the protocol decoder bin data
  84. *
  85. * @param instance - SubGhzHistory instance
  86. * @param idx - record index
  87. * @return SubGhzProtocolCommonLoad*
  88. */
  89. FlipperFormat* subghz_history_get_raw_data(SubGhzHistory* instance, uint16_t idx);