|
@@ -32,6 +32,7 @@ char string[512];
|
|
*/
|
|
*/
|
|
void data_task(void *pdata)
|
|
void data_task(void *pdata)
|
|
{
|
|
{
|
|
|
|
+<<<<<<< HEAD
|
|
OS_CPU_SR cpu_sr;
|
|
OS_CPU_SR cpu_sr;
|
|
pdata = pdata;
|
|
pdata = pdata;
|
|
dlt645_init(100);
|
|
dlt645_init(100);
|
|
@@ -79,6 +80,95 @@ void mqtt_to_device(){
|
|
myfree(SRAMEX ,message->p);//�ͷ��ڲ�����
|
|
myfree(SRAMEX ,message->p);//�ͷ��ڲ�����
|
|
//OSTimeDly(1000);
|
|
//OSTimeDly(1000);
|
|
}
|
|
}
|
|
|
|
+=======
|
|
|
|
+ OS_CPU_SR cpu_sr;
|
|
|
|
+ pdata = pdata;
|
|
|
|
+ mmodbus_init(1);
|
|
|
|
+ char buf[1000]; // ����modbus��ȡ������
|
|
|
|
+
|
|
|
|
+ char *device_config_json = mymalloc(SRAMEX, 9 * 1024);
|
|
|
|
+ read_file("device.txt", device_config_json);
|
|
|
|
+ addGatewayParams(device_config_json);
|
|
|
|
+ myfree(SRAMEX, device_config_json);
|
|
|
|
+
|
|
|
|
+ GATEWAY_PARAMS *get;
|
|
|
|
+ get= get_gateway_config_params();
|
|
|
|
+ int deviceIndex=0;
|
|
|
|
+ DEVICE_PARAMS *current_device=get->device_params;
|
|
|
|
+// Config_485_Port(get->baudrate, get->dataBits, get->stopBit, get->parity, get->flowControl);
|
|
|
|
+ while (current_device!=NULL)
|
|
|
|
+ {
|
|
|
|
+ uint8_t err;
|
|
|
|
+ StringInfo *message=NULL;
|
|
|
|
+ message=OSQPend(JsonQ,1000,&err);
|
|
|
|
+ if(message==NULL)//没有消息
|
|
|
|
+ {
|
|
|
|
+ OSTimeDly(1000);
|
|
|
|
+ }
|
|
|
|
+ else //包含消息
|
|
|
|
+ {
|
|
|
|
+ myfree(SRAMIN ,message->p);//释放内部数据
|
|
|
|
+ myfree(SRAMIN,message);
|
|
|
|
+ OSTimeDly(1000);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+// uint8_t err;
|
|
|
|
+// StringInfo *message=NULL; //���ն�����Ϣ�ṹ��
|
|
|
|
+// message=OSQPend(JsonQ,1000,&err);
|
|
|
|
+// if(message==NULL)
|
|
|
|
+// {
|
|
|
|
+// READ_DATA(current_device, buf);
|
|
|
|
+// if(current_device->nextDevice!=NULL)
|
|
|
|
+// {
|
|
|
|
+// current_device=current_device->nextDevice;
|
|
|
|
+// }
|
|
|
|
+// else
|
|
|
|
+// {
|
|
|
|
+// sprintf(buf + strlen(buf) - 1, "}");
|
|
|
|
+// time1 = OSTimeGet();
|
|
|
|
+// if( jsoncunt || time2 <= time1 - 20000)
|
|
|
|
+// {
|
|
|
|
+// memset(pubJsonStringCopy,0, strlen(pubJsonStringCopy));
|
|
|
|
+// memcpy(pubJsonStringCopy + strlen(pubJsonStringCopy), buf, strlen(buf));//������һ�ε�����
|
|
|
|
+// sprintf(pubJsonString,"{\"DEVICEID\":\"%s\",\"data\":[%s]",get->deviceId, buf);
|
|
|
|
+// int msg = MBOX_USER_PUBLISHQOS2;
|
|
|
|
+// if(mqtt_connectFlag==1) OSMboxPost(mqtt_sendMseeageMbox, &msg);
|
|
|
|
+// current_device=get->device_params;
|
|
|
|
+// jsoncunt = 0;
|
|
|
|
+// time2 = OSTimeGet();
|
|
|
|
+// }//20s����һ��
|
|
|
|
+//
|
|
|
|
+// else
|
|
|
|
+// {
|
|
|
|
+// if(strcmp(buf,pubJsonStringCopy))
|
|
|
|
+// {
|
|
|
|
+// memset(string, 0 , strlen(string));
|
|
|
|
+// findDifference(buf, pubJsonStringCopy, string);
|
|
|
|
+// memset(pubJsonString,0, strlen(pubJsonString));
|
|
|
|
+// sprintf(pubJsonString,"{\"deviceId\":\"%s\",\"data\":[{%s}]}",get->deviceId, string);
|
|
|
|
+// memset(pubJsonStringCopy,0, strlen(pubJsonStringCopy));
|
|
|
|
+// sprintf(pubJsonStringCopy, buf, strlen(buf));
|
|
|
|
+//
|
|
|
|
+// int msg = MBOX_USER_PUBLISHQOS2;
|
|
|
|
+// if(mqtt_connectFlag==1) OSMboxPost(mqtt_sendMseeageMbox, &msg);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// memset(buf,0,strlen(buf));
|
|
|
|
+// current_device=get->device_params;
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// else
|
|
|
|
+// {
|
|
|
|
+// WRITE_MODBUS_DATA(message->p);
|
|
|
|
+// printf("sx1278_task_recv : %s",message->p);
|
|
|
|
+// myfree(SRAMIN ,message->p);
|
|
|
|
+// myfree(SRAMIN,message);
|
|
|
|
+//
|
|
|
|
+// commd = 1;
|
|
|
|
+// }
|
|
|
|
+// OSTimeDly(1000);
|
|
|
|
+ }
|
|
|
|
+>>>>>>> 841e7987800910a57cf5275c331a8acbfec24198
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|