subghz_history.h 2.8 KB

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