bin_raw.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #pragma once
  2. #include "base.h"
  3. #define SUBGHZ_PROTOCOL_BIN_RAW_NAME "BinRAW"
  4. typedef struct SubGhzProtocolDecoderBinRAW SubGhzProtocolDecoderBinRAW;
  5. typedef struct SubGhzProtocolEncoderBinRAW SubGhzProtocolEncoderBinRAW;
  6. extern const SubGhzProtocolDecoder subghz_protocol_bin_raw_decoder;
  7. extern const SubGhzProtocolEncoder subghz_protocol_bin_raw_encoder;
  8. extern const SubGhzProtocol subghz_protocol_bin_raw;
  9. /**
  10. * Allocate SubGhzProtocolEncoderBinRAW.
  11. * @param environment Pointer to a SubGhzEnvironment instance
  12. * @return SubGhzProtocolEncoderBinRAW* pointer to a SubGhzProtocolEncoderBinRAW instance
  13. */
  14. void* subghz_protocol_encoder_bin_raw_alloc(SubGhzEnvironment* environment);
  15. /**
  16. * Free SubGhzProtocolEncoderBinRAW.
  17. * @param context Pointer to a SubGhzProtocolEncoderBinRAW instance
  18. */
  19. void subghz_protocol_encoder_bin_raw_free(void* context);
  20. /**
  21. * Deserialize and generating an upload to send.
  22. * @param context Pointer to a SubGhzProtocolEncoderBinRAW instance
  23. * @param flipper_format Pointer to a FlipperFormat instance
  24. * @return status
  25. */
  26. SubGhzProtocolStatus
  27. subghz_protocol_encoder_bin_raw_deserialize(void* context, FlipperFormat* flipper_format);
  28. /**
  29. * Forced transmission stop.
  30. * @param context Pointer to a SubGhzProtocolEncoderBinRAW instance
  31. */
  32. void subghz_protocol_encoder_bin_raw_stop(void* context);
  33. /**
  34. * Getting the level and duration of the upload to be loaded into DMA.
  35. * @param context Pointer to a SubGhzProtocolEncoderBinRAW instance
  36. * @return LevelDuration
  37. */
  38. LevelDuration subghz_protocol_encoder_bin_raw_yield(void* context);
  39. /**
  40. * Allocate SubGhzProtocolDecoderBinRAW.
  41. * @param environment Pointer to a SubGhzEnvironment instance
  42. * @return SubGhzProtocolDecoderBinRAW* pointer to a SubGhzProtocolDecoderBinRAW instance
  43. */
  44. void* subghz_protocol_decoder_bin_raw_alloc(SubGhzEnvironment* environment);
  45. /**
  46. * Free SubGhzProtocolDecoderBinRAW.
  47. * @param context Pointer to a SubGhzProtocolDecoderBinRAW instance
  48. */
  49. void subghz_protocol_decoder_bin_raw_free(void* context);
  50. /**
  51. * Reset decoder SubGhzProtocolDecoderBinRAW.
  52. * @param context Pointer to a SubGhzProtocolDecoderBinRAW instance
  53. */
  54. void subghz_protocol_decoder_bin_raw_reset(void* context);
  55. /**
  56. * Parse a raw sequence of levels and durations received from the air.
  57. * @param context Pointer to a SubGhzProtocolDecoderBinRAW instance
  58. * @param level Signal level true-high false-low
  59. * @param duration Duration of this level in, us
  60. */
  61. void subghz_protocol_decoder_bin_raw_feed(void* context, bool level, uint32_t duration);
  62. /**
  63. * Getting the hash sum of the last randomly received parcel.
  64. * @param context Pointer to a SubGhzProtocolDecoderBinRAW instance
  65. * @return hash Hash sum
  66. */
  67. uint8_t subghz_protocol_decoder_bin_raw_get_hash_data(void* context);
  68. void subghz_protocol_decoder_bin_raw_data_input_rssi(
  69. SubGhzProtocolDecoderBinRAW* instance,
  70. float rssi);
  71. /**
  72. * Serialize data SubGhzProtocolDecoderBinRAW.
  73. * @param context Pointer to a SubGhzProtocolDecoderBinRAW instance
  74. * @param flipper_format Pointer to a FlipperFormat instance
  75. * @param preset The modulation on which the signal was received, SubGhzRadioPreset
  76. * @return status
  77. */
  78. SubGhzProtocolStatus subghz_protocol_decoder_bin_raw_serialize(
  79. void* context,
  80. FlipperFormat* flipper_format,
  81. SubGhzRadioPreset* preset);
  82. /**
  83. * Deserialize data SubGhzProtocolDecoderBinRAW.
  84. * @param context Pointer to a SubGhzProtocolDecoderBinRAW instance
  85. * @param flipper_format Pointer to a FlipperFormat instance
  86. * @return status
  87. */
  88. SubGhzProtocolStatus
  89. subghz_protocol_decoder_bin_raw_deserialize(void* context, FlipperFormat* flipper_format);
  90. /**
  91. * Getting a textual representation of the received data.
  92. * @param context Pointer to a SubGhzProtocolDecoderBinRAW instance
  93. * @param output Resulting text
  94. */
  95. void subghz_protocol_decoder_bin_raw_get_string(void* context, FuriString* output);