dtu_uart2.h 2.5 KB

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