decoder.h 779 B

123456789101112131415161718192021222324252627282930313233343536
  1. #pragma once
  2. #include <stdbool.h>
  3. #include <stdint.h>
  4. #include <stddef.h>
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. typedef struct SubGhzBlockDecoder SubGhzBlockDecoder;
  9. struct SubGhzBlockDecoder {
  10. uint32_t parser_step;
  11. uint32_t te_last;
  12. uint64_t decode_data;
  13. uint8_t decode_count_bit;
  14. };
  15. /**
  16. * Add data bit when decoding.
  17. * @param decoder Pointer to a SubGhzBlockDecoder instance
  18. * @param bit data, 1bit
  19. */
  20. void subghz_protocol_blocks_add_bit(SubGhzBlockDecoder* decoder, uint8_t bit);
  21. /**
  22. * Getting the hash sum of the last randomly received parcel.
  23. * @param decoder Pointer to a SubGhzBlockDecoder instance
  24. * @return hash Hash sum
  25. */
  26. uint8_t subghz_protocol_blocks_get_hash_data(SubGhzBlockDecoder* decoder, size_t len);
  27. #ifdef __cplusplus
  28. }
  29. #endif