FIAP (IEEE1888) library
Dependents: Fetch_IEEE1888_Storage IEEE1888_MULTI_SENSOR_GW
Fork of FiapV2 by
Diff: fiap.cpp
- Revision:
- 18:274f2cbdc18c
- Parent:
- 17:e6298cbdefdc
- Child:
- 19:101d8775b33d
--- a/fiap.cpp Fri Mar 01 12:40:18 2013 +0000 +++ b/fiap.cpp Fri Mar 01 17:35:02 2013 +0000 @@ -122,8 +122,10 @@ int i,ii,j,ll,k1,k2; char rstr[800]; int yy,mo,dd,hh,mm,ss;//date, time - char str[50]; + char zone[10]; + char p_id[100]; char p_val[50]; + char p_time[50]; char uuid[37]; strcpy( _soap_text, _soap_header); @@ -212,25 +214,26 @@ data_value_node=data_handle.getChild(0).toElement(); data_value_cnode=data_handle.getChild(0).getChild(0).toCData(); + sprintf(p_id ,"%s",data_point_node->getAttrValue("id")); sprintf(p_val,"%s",data_value_cnode->getText()); + sprintf(p_time,"%s",data_value_node->getAttrValue("time")); if(debug_mode){ - printf("PointID=%s \r\n",data_point_node->getAttrValue("id")); - printf("date=%s \r\n",data_value_node->getAttrValue("time")); + printf("PointID=%s \r\n",p_id); + printf("date=%s \r\n",p_time); printf("data=%s \r\n",p_val); } for (ii=0; ii<esize; ii++) { - if (strcmp(v[ii].cid,data_point_node->getAttrValue("id"))==0) { - //TODO timezone - sprintf(str,"%s",data_value_node->getAttrValue("time")); - ll=sscanf(str,"%d-%d-%dT%d:%d:%d.", - &yy,&mo,&dd,&hh,&mm,&ss); - if(debug_mode)printf("date convert no %d (%d/%d/%d %d:%d:%d) \r\n", - ll,yy,mo,dd,hh,mm,ss); + if (strcmp(v[ii].cid, p_id)==0) { + ll=sscanf(p_time,"%d-%d-%dT%d:%d:%d.000%s", + &yy,&mo,&dd,&hh,&mm,&ss,zone); + if(debug_mode)printf("date convert no %d (%d/%d/%d %d:%d:%d %s) \r\n", + ll,yy,mo,dd,hh,mm,ss,zone); + //TODO timezone struct fiap_element my_element = { v[ii].cid, p_val, yy, mo, dd, - hh, mm, ss, v[ii].timezone}; + hh, mm, ss, NULL}; v[ii] = my_element; }