data_task.h 930 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef __TASK_H
  2. #define __TASK_H
  3. #include "gd32f30x.h"
  4. #include "gateway_message.h"
  5. #include "mqttclient.h"
  6. #include "FreeRTOS.h"
  7. #include "task.h"
  8. #include "include.h"
  9. //主要的数据处理线程
  10. #define DATA_TASK_PRIO 3
  11. #define DATA_STK_SIZE 2*1024
  12. #define GetCurrentTime() xTaskGetTickCount()
  13. extern void data_task(void *pdata);
  14. void data_task_creat(void);
  15. /* 写入modbus寄存器 */
  16. void write_modbus_data(char* cJSONstring);
  17. /* 发送至mqtt */
  18. void send_mqtt(char*buf);
  19. /* 读取设备数据 */
  20. int read_device_data(DEVICE_PARAMS *current_device,char* buf, char* string);
  21. ///* 读取设备数据 */
  22. //int read_device_data1(DEVICE_PARAMS *current_device,char* buf);
  23. //int read_device_data2(DEVICE_PARAMS *current_device,char* buf);
  24. typedef struct __JSON_CMD{
  25. char deviceId[25];
  26. short power;
  27. short temp;
  28. short mode;
  29. short fan;
  30. uint16_t slaveAddress;
  31. uint16_t registerAddress;
  32. uint8_t function;
  33. uint8_t cmd;
  34. }JSON_CMD;
  35. #endif