dtu_uart2.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. #define DTU_UART_NAME "uart2" /*串口设备名称*/
  13. #define MAX_DTU_SIZE 512
  14. typedef struct{
  15. char msg_pool[MAX_DTU_SIZE];
  16. }DataTemp;
  17. //enum B_2
  18. //{
  19. // "STATUS_UNACTIVE",
  20. // "STATUS_OFFLINE",
  21. // "STATUS_UNUSUAL",
  22. // |STATUS_ONLINE""
  23. //};
  24. //5.0测报灯数据上报结构体
  25. typedef struct {
  26. char DEVICE_SERIAL_NUMBER[32];
  27. char SIM[32];
  28. char SIGNAL[16];
  29. char LOCATION[32];
  30. double VOLTAGE;
  31. double CURRENT;
  32. double TEMPERATURE;
  33. double HUMIDITY;
  34. char UPDATE_DATE[64];
  35. char STATUS[32];
  36. char STATUS_DESCRIPTION[64];
  37. char START_TIME[64];
  38. char END_TIME[64];
  39. char VERSION[16];
  40. uint8_t DATT;
  41. uint8_t TPS;
  42. uint8_t LPS;
  43. uint8_t RPS;
  44. uint8_t WS;
  45. uint8_t TT;
  46. }WS_CBDV5;
  47. void dtu_send_data_start(void);
  48. //查询数据---{"cmd": "read"}
  49. //重启-------{"cmd": "reboot"}
  50. //升级-------{"cmd": "update"}
  51. //拍照-------{"cmd": "takephoto"}
  52. //{"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}}
  53. //{"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"}}
  54. void DTU_Write(char *fmt, ...);
  55. int dtu_data_play(void);
  56. int parseDtu(char *json_string);
  57. char *makeJson(void);
  58. char *makeJson_platform(char *plt);
  59. char *makeJson_Rtutakephoto();
  60. char *makeJson_ReadInfo();
  61. char *makeJson_takephoto();
  62. char *makeJson_Warn(char * s,char *t);
  63. void UpLoad_Data(void);
  64. char *uint8tostring(uint8_t dat);
  65. char *makeJson_Config_Reset(void);
  66. char *makeJson_Config_BDH(char * deviceId);
  67. char *makeJson_selfCheck_(uint8_t sta);
  68. char *makeJson_Cam(char * s,char *t);
  69. char *makeJson_C01_Warn(uint16_t code,double process);
  70. char *makeJson_record_read(char *type);
  71. char *makeJson_record_write(char *mqtt_num,char *photo_num);
  72. #endif /* APPLICATIONS_INC_DTU_UART2_H_ */