data_task.h 974 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. uint32_t my_pow(int x,int y);
  10. //主要的数据处理线程
  11. #define DATA_TASK_PRIO 3
  12. #define DATA_STK_SIZE 2*1024
  13. #define GetCurrentTime() xTaskGetTickCount()
  14. extern int ID;
  15. extern void data_task(void *pdata);
  16. void data_task_creat(void);
  17. /* 写入modbus寄存器 */
  18. void write_modbus_data(char* cJSONstring);
  19. /* 发送至mqtt */
  20. void send_mqtt(char*buf);
  21. /* 读取设备数据 */
  22. int read_device_data(DEVICE_PARAMS *current_device,char* buf, char* string);
  23. ///* 读取设备数据 */
  24. //int read_device_data1(DEVICE_PARAMS *current_device,char* buf);
  25. //int read_device_data2(DEVICE_PARAMS *current_device,char* buf);
  26. typedef struct __JSON_CMD{
  27. char deviceId[25];
  28. short power;
  29. short temp;
  30. short mode;
  31. short fan;
  32. uint16_t slaveAddress;
  33. uint16_t registerAddress;
  34. uint8_t function;
  35. uint8_t cmd;
  36. }JSON_CMD;
  37. #endif