|
推荐
楼主 |
发表于 2011-2-16 09:38:29
|
只看该作者
发送自定义参数的方法实例:
1、在ACTION中定义变量
TDeviceInfo tdev_info;
TMessage tmsg_head;
.......................
2、给变量赋值
strcpy(tdev_info.cDevID,"001");
strcpy(tdev_info.cDevIP,"192.168.50.240");
tdev_info.nCorpID=1;
.................................
3、进行数据处理、数据发送:其中重点为socket发送数据的处理方法,如不特别处理会经常报错
memcpy(msg_head_buffer,&tmsg_head,sizeof(tmsg_head)-4);
lrs_save_param_ex("socket0","user",msg_head_buffer,0,sizeof(tmsg_head)-4,NULL,"msg_head");
lrs_send("socket0","msg_head_s",LrsLastArg);
memcpy(cdata_buffer,&tdev_info,sizeof(tdev_info));
cdata_buffer[ sizeof(tdev_info) ]=CaclCheckSum(cdata_buffer,sizeof(tdev_info));
lrs_save_param_ex("socket0","user",cdata_buffer,0,sizeof(tdev_info)+1,NULL,"dev_info");
lrs_send("socket0","dev_info_s",LrsLastArg);
。。。。。。。。。。。。。。。。。。。。。。。。
4、在data.ws中关联变量与参数
;WSRData 2 1
send msg_head_s
"<msg_head>"
send dev_info_s
"<dev_info>"
send cz_data_s
"<cz_data>"
send updata_ack_s
"<update_ack>"
................................ |
|