holtek.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #pragma once
  2. #include "base.h"
  3. #define SUBGHZ_PROTOCOL_HOLTEK_NAME "Holtek"
  4. typedef struct SubGhzProtocolDecoderHoltek SubGhzProtocolDecoderHoltek;
  5. typedef struct SubGhzProtocolEncoderHoltek SubGhzProtocolEncoderHoltek;
  6. extern const SubGhzProtocolDecoder subghz_protocol_holtek_decoder;
  7. extern const SubGhzProtocolEncoder subghz_protocol_holtek_encoder;
  8. extern const SubGhzProtocol subghz_protocol_holtek;
  9. /**
  10. * Allocate SubGhzProtocolEncoderHoltek.
  11. * @param environment Pointer to a SubGhzEnvironment instance
  12. * @return SubGhzProtocolEncoderHoltek* pointer to a SubGhzProtocolEncoderHoltek instance
  13. */
  14. void* subghz_protocol_encoder_holtek_alloc(SubGhzEnvironment* environment);
  15. /**
  16. * Free SubGhzProtocolEncoderHoltek.
  17. * @param context Pointer to a SubGhzProtocolEncoderHoltek instance
  18. */
  19. void subghz_protocol_encoder_holtek_free(void* context);
  20. /**
  21. * Deserialize and generating an upload to send.
  22. * @param context Pointer to a SubGhzProtocolEncoderHoltek instance
  23. * @param flipper_format Pointer to a FlipperFormat instance
  24. * @return true On success
  25. */
  26. bool subghz_protocol_encoder_holtek_deserialize(void* context, FlipperFormat* flipper_format);
  27. /**
  28. * Forced transmission stop.
  29. * @param context Pointer to a SubGhzProtocolEncoderHoltek instance
  30. */
  31. void subghz_protocol_encoder_holtek_stop(void* context);
  32. /**
  33. * Getting the level and duration of the upload to be loaded into DMA.
  34. * @param context Pointer to a SubGhzProtocolEncoderHoltek instance
  35. * @return LevelDuration
  36. */
  37. LevelDuration subghz_protocol_encoder_holtek_yield(void* context);
  38. /**
  39. * Allocate SubGhzProtocolDecoderHoltek.
  40. * @param environment Pointer to a SubGhzEnvironment instance
  41. * @return SubGhzProtocolDecoderHoltek* pointer to a SubGhzProtocolDecoderHoltek instance
  42. */
  43. void* subghz_protocol_decoder_holtek_alloc(SubGhzEnvironment* environment);
  44. /**
  45. * Free SubGhzProtocolDecoderHoltek.
  46. * @param context Pointer to a SubGhzProtocolDecoderHoltek instance
  47. */
  48. void subghz_protocol_decoder_holtek_free(void* context);
  49. /**
  50. * Reset decoder SubGhzProtocolDecoderHoltek.
  51. * @param context Pointer to a SubGhzProtocolDecoderHoltek instance
  52. */
  53. void subghz_protocol_decoder_holtek_reset(void* context);
  54. /**
  55. * Parse a raw sequence of levels and durations received from the air.
  56. * @param context Pointer to a SubGhzProtocolDecoderHoltek instance
  57. * @param level Signal level true-high false-low
  58. * @param duration Duration of this level in, us
  59. */
  60. void subghz_protocol_decoder_holtek_feed(void* context, bool level, uint32_t duration);
  61. /**
  62. * Getting the hash sum of the last randomly received parcel.
  63. * @param context Pointer to a SubGhzProtocolDecoderHoltek instance
  64. * @return hash Hash sum
  65. */
  66. uint8_t subghz_protocol_decoder_holtek_get_hash_data(void* context);
  67. /**
  68. * Serialize data SubGhzProtocolDecoderHoltek.
  69. * @param context Pointer to a SubGhzProtocolDecoderHoltek instance
  70. * @param flipper_format Pointer to a FlipperFormat instance
  71. * @param frequency The frequency at which the signal was received, Hz
  72. * @param preset The modulation on which the signal was received, FuriHalSubGhzPreset
  73. * @return true On success
  74. */
  75. bool subghz_protocol_decoder_holtek_serialize(
  76. void* context,
  77. FlipperFormat* flipper_format,
  78. uint32_t frequency,
  79. FuriHalSubGhzPreset preset);
  80. /**
  81. * Deserialize data SubGhzProtocolDecoderHoltek.
  82. * @param context Pointer to a SubGhzProtocolDecoderHoltek instance
  83. * @param flipper_format Pointer to a FlipperFormat instance
  84. * @return true On success
  85. */
  86. bool subghz_protocol_decoder_holtek_deserialize(void* context, FlipperFormat* flipper_format);
  87. /**
  88. * Getting a textual representation of the received data.
  89. * @param context Pointer to a SubGhzProtocolDecoderHoltek instance
  90. * @param output Resulting text
  91. */
  92. void subghz_protocol_decoder_holtek_get_string(void* context, string_t output);