uhf_buffer.h 618 B

123456789101112131415161718192021222324
  1. #pragma once
  2. #include <stdint.h>
  3. #include <stdbool.h>
  4. #include <stddef.h>
  5. #define MAX_BUFFER_SIZE 200
  6. typedef struct Buffer {
  7. uint8_t* data;
  8. size_t size;
  9. size_t capacity;
  10. bool closed;
  11. } Buffer;
  12. Buffer* uhf_buffer_alloc(size_t inital_capacity);
  13. bool uhf_buffer_append_single(Buffer* buf, uint8_t value);
  14. bool uhf_buffer_append(Buffer* buf, uint8_t* data, size_t size);
  15. uint8_t* uhf_buffer_get_data(Buffer* buf);
  16. size_t uhf_buffer_get_size(Buffer* buf);
  17. bool uhf_is_buffer_closed(Buffer* buf);
  18. void uhf_buffer_close(Buffer* buf);
  19. void uhf_buffer_reset(Buffer* buf);
  20. void uhf_buffer_free(Buffer* buf);