Fixing initialization to just create a table on the cloud side.
[iotcloud.git] / version2 / src / C / Update.C
index 805cc8b..a3613e2 100644 (file)
@@ -4,7 +4,7 @@
 #include "TransactionStatus.h"
 
 #define NUMBER_OF_SENSORS 1
-#define MACHINE_ID 260
+#define MACHINE_ID 15512
 
 int main(int numargs, char ** args) {
        TimingSingleton * timer = TimingSingleton_getInstance();
@@ -22,20 +22,32 @@ int main(int numargs, char ** args) {
        baseurl->releaseRef();
        password->releaseRef();
 
-       /*char keyBuffer[80];
+       char keyBuffer[80];
        char dataBuffer[80];
 
-       sprintf(keyBuffer, "sensor0");
+       sprintf(keyBuffer, "tempF0");
        IoTString * iKeyA = new IoTString(keyBuffer);
-       sprintf(dataBuffer, "data1");
+       sprintf(dataBuffer, "data4");
        IoTString * iValueA = new IoTString(dataBuffer);
+       t1->createNewKey(iKeyA, MACHINE_ID);
        t1->startTransaction();
        t1->put(iKeyA, iValueA);
-       transStatusList->add(t1->commitTransaction());*/
+       transStatusList->add(t1->commitTransaction());
+       
+       sprintf(keyBuffer, "humid0");
+       IoTString * iKeyB = new IoTString(keyBuffer);
+       sprintf(dataBuffer, "data6");
+       IoTString * iValueB = new IoTString(dataBuffer);
+       t1->createNewKey(iKeyB, MACHINE_ID);
+       t1->startTransaction();
+       t1->put(iKeyB, iValueB);
+       transStatusList->add(t1->commitTransaction());
        t1->update();
        
-       //iKeyA->releaseRef();
-       //iValueA->releaseRef();
+       iKeyB->releaseRef();
+       iValueB->releaseRef();
+       iKeyA->releaseRef();
+       iValueA->releaseRef();
 
        for (uint i = 0; i < transStatusList->size(); i++) {
                TransactionStatus * status = transStatusList->get(i);