uhf_data.h 946 B

12345678910111213141516171819202122232425262728293031323334
  1. #pragma once
  2. #include <stdint.h>
  3. #include <stdlib.h>
  4. #define MAX_DATA_SIZE 64
  5. typedef struct UHFData {
  6. uint8_t data[MAX_DATA_SIZE];
  7. size_t length;
  8. bool start;
  9. bool end;
  10. struct UHFData* next;
  11. } UHFData;
  12. typedef struct UHFResponseData {
  13. UHFData* head;
  14. UHFData* tail;
  15. size_t size;
  16. } UHFResponseData;
  17. UHFData* uhf_data_alloc();
  18. int uhf_data_append(UHFData* uhf_data, uint8_t data);
  19. void uhf_data_reset(UHFData* uhf_data);
  20. uint8_t uhf_data_calculate_checksum(UHFData* uhf_data);
  21. bool uhf_data_verfiy_checksum(UHFData* uhf_data);
  22. void uhf_data_free(UHFData* uhf_data);
  23. UHFResponseData* uhf_response_data_alloc();
  24. UHFData* uhf_response_data_add_new_uhf_data(UHFResponseData* uhf_response_data);
  25. UHFData* uhf_response_data_get_uhf_data(UHFResponseData* uhf_response_data, uint index);
  26. void uhf_response_data_reset(UHFResponseData* uhf_response_data);
  27. void uhf_response_data_free(UHFResponseData* uhf_response_data);