You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.3 KiB

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include "cJSON.h"
  5. #include "cJSON_Utils.h"
  6. #include "driver/timer.h"
  7. #include "esp_log.h"
  8. #define profile_b_buffer_size 128
  9. #define set_position "setPosition"
  10. #define get_status "getStatus"
  11. typedef struct bluetooth_processer {
  12. char *bluetooth_processer_rx_buf;
  13. uint8_t bluetooth_processer_rx_buf_size; //
  14. int bluetooth_baundrate_one_packet_delay_ms;
  15. void (*port_delay_ms)(uint64_t us);
  16. bool bluetooth_rx_buffer_start_receving;
  17. bool bluetooth_rx_buffer_processing;
  18. char *order; //指令名称
  19. int index; //
  20. int speedLevel; //
  21. double position; //角度
  22. int direction; //旋转方向
  23. int code; //错误码
  24. char *info; //错误码信息
  25. char *deviceState; //设备状态
  26. int deviceException; //设备异常编号
  27. char *deviceExceptionInfo; //设备异常信息
  28. bool cmd_flag;
  29. bool actively_report_flag;
  30. } bluetooth_processer_t;
  31. void constructor_bluetooth_processer(bluetooth_processer_t *bluetooth_processer);
  32. void bluetooth_gatts_try_process_data();
  33. void start_receive_data_to_buffer(uint16_t length, uint8_t *value);
  34. void buffer_all_init();
  35. bool parse_rxbuffer_and_validation_data(cJSON **json_tmp);
  36. bool parse_json_to_struct(cJSON *ch);