2 * Periodic write and sleep to cloud.
3 * @author Rahmadi Trimananda <rtrimana@uci.edu>
9 #include "TimingSingleton.h"
10 #include "TransactionStatus.h"
12 #define SLEEP_TIME 300 // in seconds
14 TimingSingleton *timer;
16 MyVector<TransactionStatus *> * transStatusList;
25 // TODO: This test uses the Serial library
26 // Please install "screen" on your machine and run
27 // it on the serial port right after flashing the
28 // firmware onto the Particle board.
29 // e.g. sudo screen /dev/ttyACM0
31 timer = TimingSingleton_getInstance();
33 transStatusList = new MyVector<TransactionStatus *>();
34 IoTString *baseurl = new IoTString("http://dc-6.calit2.uci.edu/test.iotcloud/");
35 IoTString *password = new IoTString("reallysecret");
36 t1 = new Table(baseurl, password, 321, -1);
39 baseurl->releaseRef();
40 password->releaseRef();
46 sprintf(keyBuffer, "sensor0");
47 iKeyA = new IoTString(keyBuffer);
49 // Do Updates for the keys
50 sprintf(dataBuffer, "data92617");
51 iValueA = new IoTString(dataBuffer);
53 t1->startTransaction();
54 t1->put(iKeyA, iValueA);
55 transStatusList->add(t1->commitTransaction());
59 iValueA->releaseRef();
60 System.sleep(SLEEP_MODE_DEEP, SLEEP_TIME);