spp_test_backend.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (c) 2019 Actions Semiconductor Co., Ltd
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. /**
  7. * @file
  8. * @brief SPP test backend interface
  9. */
  10. #ifndef __SPP_TEST_BACKEND_H__
  11. #define __SPP_TEST_BACKEND_H__
  12. #include "ota_backend_bt.h"
  13. #include <thread_timer.h>
  14. #include <sys/ring_buffer.h>
  15. /** type of backend*/
  16. #define SPP_TEST_BACKEND_TYPE_UNKNOWN (0)
  17. #define SPP_TEST_BACKEND_TYPE_BLUETOOTH (1)
  18. #define SPP_TEST_BACKEND_START_STATE (1)
  19. #define SPP_TEST_BACKEND_UPGRADE_PROGRESS (2)
  20. #define SPP_TX_RING_BUF_SIZE (1024)
  21. #define SPP_TRANSFER_TIMER_MS (10)
  22. typedef void (*spp_test_notify_cb_t)(int cmd, int state);
  23. struct spp_test_backend_t
  24. {
  25. /** backend type */
  26. int type;
  27. int sppble_stream_opened;
  28. spp_test_notify_cb_t cb;
  29. io_stream_t sppble_stream;
  30. // struct thread_timer ttimer;
  31. // struct ring_buf tx_ringbuf;
  32. // uint8_t *tx_buff;
  33. // uint8_t *temp_buff;
  34. };
  35. void spp_test_backend_init(void *init_param);
  36. void spp_test_backend_exit(void);
  37. int spp_test_backend_open(void);
  38. int spp_test_backend_close(void);
  39. int spp_test_backend_read(uint8_t *data, uint32_t length, uint32_t timeout_ms);
  40. int spp_test_backend_write(uint8_t *data, uint32_t length, uint32_t timeout_ms);
  41. int spp_test_backend_ioctl(int cmd, void *param0, void *param1);
  42. #endif /* __SPP_TEST_BACKEND_H__ */