FIAP (IEEE1888) library

Dependents:   Fetch_IEEE1888_Storage IEEE1888_MULTI_SENSOR_GW

Fork of FiapV2 by Yasushi TAUCHI

Revision:
17:e6298cbdefdc
Parent:
16:3a54e2b235ec
Child:
18:274f2cbdc18c
--- a/fiap.cpp	Fri Mar 01 11:56:22 2013 +0000
+++ b/fiap.cpp	Fri Mar 01 12:40:18 2013 +0000
@@ -1,9 +1,11 @@
 #include "fiap.h"
 #include "mbed.h"
 #include "stdio.h"
+#if USE_FETCH
 #include "spdomparser.hpp"
 #include "spxmlnode.hpp"
 #include "spxmlhandle.hpp"
+#endif
 
 void FIAP::setMode(bool _use_fetch)
 {
@@ -121,6 +123,7 @@
     char rstr[800];
     int yy,mo,dd,hh,mm,ss;//date, time
     char str[50];
+    char p_val[50];
     char uuid[37];
 
     strcpy( _soap_text, _soap_header);
@@ -208,15 +211,16 @@
                 //data_value_cnode=data_handle.getChild("value").getChild(0).toCData();
                 data_value_node=data_handle.getChild(0).toElement();
                 data_value_cnode=data_handle.getChild(0).getChild(0).toCData();
+
+                sprintf(p_val,"%s",data_value_cnode->getText());
+
                 if(debug_mode){
                     printf("PointID=%s \r\n",data_point_node->getAttrValue("id"));
                     printf("date=%s \r\n",data_value_node->getAttrValue("time"));
-                    printf("data=%s \r\n",data_value_cnode->getText());
+                    printf("data=%s \r\n",p_val);
                 }
                 for (ii=0; ii<esize; ii++) {
                     if (strcmp(v[ii].cid,data_point_node->getAttrValue("id"))==0) {
-                        char p_val[50];
-                        sprintf(p_val,"%s",data_value_cnode->getText());
                         //TODO timezone
                         sprintf(str,"%s",data_value_node->getAttrValue("time"));
                         ll=sscanf(str,"%d-%d-%dT%d:%d:%d.",
@@ -224,8 +228,10 @@
                         if(debug_mode)printf("date convert no %d (%d/%d/%d %d:%d:%d) \r\n",
                                              ll,yy,mo,dd,hh,mm,ss);
                         //TODO timezone
-                        struct fiap_element my_element =
-                            {v[ii].cid, p_val, yy, mo, dd, hh, mm, ss, v[ii].timezone};
+                        struct fiap_element my_element = {
+                            v[ii].cid, p_val, yy, mo, dd,
+                            hh, mm, ss, v[ii].timezone};
+
                         v[ii] = my_element;
                     }
                 }