#ifndef __TASK_H
#define	__TASK_H
#include "gd32f30x.h"
#include "gateway_message.h"
#include "mqttclient.h"
#include "FreeRTOS.h"
#include "task.h"

#include "include.h"


//主要的数据处理线程
#define DATA_TASK_PRIO    3 
#define DATA_STK_SIZE  2*1024

#define GetCurrentTime()  xTaskGetTickCount()

extern void data_task(void *pdata);
void  data_task_creat(void);


/* 写入modbus寄存器 */
void write_modbus_data(char* cJSONstring);
/* 发送至mqtt */
void send_mqtt(char*buf);
/* 读取设备数据 */
int read_device_data(DEVICE_PARAMS *current_device,char* buf, char* string);
///* 读取设备数据 */
//int read_device_data1(DEVICE_PARAMS *current_device,char* buf);
//int read_device_data2(DEVICE_PARAMS *current_device,char* buf);

typedef struct __JSON_CMD{
	char deviceId[25];
	short power;
	short temp;
	short mode;
	short fan;
	uint16_t slaveAddress;
	uint16_t registerAddress;
	uint8_t function;
	uint8_t cmd;
}JSON_CMD;


#endif
