dtu_uart2.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (c) 2006-2020, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2020-05-28 Administrator the first version
  9. */
  10. #ifndef APPLICATIONS_INC_DTU_UART2_H_
  11. #define APPLICATIONS_INC_DTU_UART2_H_
  12. #include <cJSON.h>
  13. #define DTU_UART_NAME "uart2" /*串口设备名称*/
  14. #define MAX_DTU_SIZE 512
  15. typedef struct{
  16. char msg_pool[MAX_DTU_SIZE];
  17. }DataTemp;
  18. //enum B_2
  19. //{
  20. // "STATUS_UNACTIVE",
  21. // "STATUS_OFFLINE",
  22. // "STATUS_UNUSUAL",
  23. // |STATUS_ONLINE""
  24. //};
  25. int DTU_uart2_init(void);
  26. void close_uart2(void);
  27. void dtu_send_data_start(void);
  28. //查询数据---{"cmd": "read"}
  29. //重启-------{"cmd": "reboot"}
  30. //升级-------{"cmd": "update"}
  31. //拍照-------{"cmd": "takephoto"}
  32. //{"cmd":"paramconf","ext":{"hst":110,"collt":10,"et":6,"datt":2,"shake_sec":1,"tpl":5,"shake":1,"tph":70,"ts":1,"st":20,"imgres":2,"htim":20,"tt":8}}
  33. //{"cmd":"synchronization","ext":{"year":1,"month":1,"day":0,"hour":25,"min":0,"sec":0,"lat":"113.2056","lng":"21.0596","csq",31,"net",0,"iccid","123135453","imei":"895864646464464"}}
  34. void DTU_Write(char *fmt, ...);
  35. int dtu_data_play(void);
  36. int parseDtu(char *json_string);
  37. char *makeJson(void);
  38. char *makeJson_platform(char *plt);
  39. char *makeJson_Rtutakephoto();
  40. char *makeJson_ReadInfo();
  41. char *makeJson_takephoto();
  42. char *makeJson_Warn(char * s,char *t);
  43. void UpLoad_Data(void);
  44. char *uint8tostring(uint8_t dat);
  45. char *makeJson_Config_Reset(void);
  46. char *makeJson_Config_BDH(char * deviceId);
  47. char *makeJson_selfCheck_(uint8_t sta);
  48. char *makeJson_Cam(char * s,char *t);
  49. char *makeJson_C01_Warn(uint16_t code,double process);
  50. char* makeJsonRpc2_0(const char* method, cJSON* params, int id);
  51. #endif /* APPLICATIONS_INC_DTU_UART2_H_ */