gate_tx.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #pragma once
  2. #include "base.h"
  3. #define SUBGHZ_PROTOCOL_GATE_TX_NAME "GateTX"
  4. typedef struct SubGhzProtocolDecoderGateTx SubGhzProtocolDecoderGateTx;
  5. typedef struct SubGhzProtocolEncoderGateTx SubGhzProtocolEncoderGateTx;
  6. extern const SubGhzProtocolDecoder subghz_protocol_gate_tx_decoder;
  7. extern const SubGhzProtocolEncoder subghz_protocol_gate_tx_encoder;
  8. extern const SubGhzProtocol subghz_protocol_gate_tx;
  9. /**
  10. * Allocate SubGhzProtocolEncoderGateTx.
  11. * @param environment Pointer to a SubGhzEnvironment instance
  12. * @return SubGhzProtocolEncoderGateTx* pointer to a SubGhzProtocolEncoderGateTx instance
  13. */
  14. void* subghz_protocol_encoder_gate_tx_alloc(SubGhzEnvironment* environment);
  15. /**
  16. * Free SubGhzProtocolEncoderGateTx.
  17. * @param context Pointer to a SubGhzProtocolEncoderGateTx instance
  18. */
  19. void subghz_protocol_encoder_gate_tx_free(void* context);
  20. /**
  21. * Deserialize and generating an upload to send.
  22. * @param context Pointer to a SubGhzProtocolEncoderGateTx instance
  23. * @param flipper_format Pointer to a FlipperFormat instance
  24. * @return true On success
  25. */
  26. bool subghz_protocol_encoder_gate_tx_deserialize(void* context, FlipperFormat* flipper_format);
  27. /**
  28. * Forced transmission stop.
  29. * @param context Pointer to a SubGhzProtocolEncoderGateTx instance
  30. */
  31. void subghz_protocol_encoder_gate_tx_stop(void* context);
  32. /**
  33. * Getting the level and duration of the upload to be loaded into DMA.
  34. * @param context Pointer to a SubGhzProtocolEncoderGateTx instance
  35. * @return LevelDuration
  36. */
  37. LevelDuration subghz_protocol_encoder_gate_tx_yield(void* context);
  38. /**
  39. * Allocate SubGhzProtocolDecoderGateTx.
  40. * @param environment Pointer to a SubGhzEnvironment instance
  41. * @return SubGhzProtocolDecoderGateTx* pointer to a SubGhzProtocolDecoderGateTx instance
  42. */
  43. void* subghz_protocol_decoder_gate_tx_alloc(SubGhzEnvironment* environment);
  44. /**
  45. * Free SubGhzProtocolDecoderGateTx.
  46. * @param context Pointer to a SubGhzProtocolDecoderGateTx instance
  47. */
  48. void subghz_protocol_decoder_gate_tx_free(void* context);
  49. /**
  50. * Reset decoder SubGhzProtocolDecoderGateTx.
  51. * @param context Pointer to a SubGhzProtocolDecoderGateTx instance
  52. */
  53. void subghz_protocol_decoder_gate_tx_reset(void* context);
  54. /**
  55. * Parse a raw sequence of levels and durations received from the air.
  56. * @param context Pointer to a SubGhzProtocolDecoderGateTx 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_gate_tx_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 SubGhzProtocolDecoderGateTx instance
  64. * @return hash Hash sum
  65. */
  66. uint8_t subghz_protocol_decoder_gate_tx_get_hash_data(void* context);
  67. /**
  68. * Serialize data SubGhzProtocolDecoderGateTx.
  69. * @param context Pointer to a SubGhzProtocolDecoderGateTx instance
  70. * @param flipper_format Pointer to a FlipperFormat instance
  71. * @param preset The modulation on which the signal was received, SubGhzPresetDefinition
  72. * @return true On success
  73. */
  74. bool subghz_protocol_decoder_gate_tx_serialize(
  75. void* context,
  76. FlipperFormat* flipper_format,
  77. SubGhzPresetDefinition* preset);
  78. /**
  79. * Deserialize data SubGhzProtocolDecoderGateTx.
  80. * @param context Pointer to a SubGhzProtocolDecoderGateTx instance
  81. * @param flipper_format Pointer to a FlipperFormat instance
  82. * @return true On success
  83. */
  84. bool subghz_protocol_decoder_gate_tx_deserialize(void* context, FlipperFormat* flipper_format);
  85. /**
  86. * Getting a textual representation of the received data.
  87. * @param context Pointer to a SubGhzProtocolDecoderGateTx instance
  88. * @param output Resulting text
  89. */
  90. void subghz_protocol_decoder_gate_tx_get_string(void* context, FuriString* output);