decoder.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. * Add data to_128 bit when decoding.
  23. * @param decoder Pointer to a SubGhzBlockDecoder instance
  24. * @param head_64_bit Pointer to a head_64_bit
  25. * @param bit data, 1bit
  26. */
  27. void subghz_protocol_blocks_add_to_128_bit(
  28. SubGhzBlockDecoder* decoder,
  29. uint8_t bit,
  30. uint64_t* head_64_bit);
  31. /**
  32. * Getting the hash sum of the last randomly received parcel.
  33. * @param decoder Pointer to a SubGhzBlockDecoder instance
  34. * @return hash Hash sum
  35. */
  36. uint8_t subghz_protocol_blocks_get_hash_data(SubGhzBlockDecoder* decoder, size_t len);
  37. #ifdef __cplusplus
  38. }
  39. #endif