7 public static void main(String[] args) throws Exception {
10 long pstart = System.currentTimeMillis();
13 Table t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 361, -1);
17 } catch (Exception e) {
21 long start = System.currentTimeMillis();
25 System.out.println("Sleeping......");
29 } catch (Exception e) {
33 System.out.println("Pulling......");
34 long stop1 = System.currentTimeMillis();
40 System.out.println(stop1 - pstart);
46 Runtime runTime = Runtime.getRuntime();
47 // Process proc = runTime.exec("/opt/vc/bin/vcgencmd measure_temp | tr -d 'temp=' | tr -d \"'C\"");
48 Process proc = runTime.exec("/opt/vc/bin/vcgencmd measure_temp");
49 BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream()));
52 while ((line = reader.readLine()) != null) {
53 System.out.println(line);
60 // String pingTimer = Long.toString(System.currentTimeMillis());
61 // IoTString ipingTimer = new IoTString(pingTimer);
66 IoTString ia1 = new IoTString(a1);
70 IoTString senDat = new IoTString(dat);
73 t1.startTransaction();
74 t1.addKV(ia1, senDat);
75 t1.commitTransaction();
90 long stop2 = System.currentTimeMillis();
92 System.out.println("Done......");
93 System.out.println(stop1 - start);
94 System.out.println(stop2 - stop1);
96 // t1.startTransaction();
97 // t1.addKV(ipingTimerKey, ipingTimer);
98 // t1.addKV(ia1, senDat);
99 // t1.commitTransaction();
105 // String pingTimerKey = "sensorController";
106 // IoTString ipingTimerKey = new IoTString(pingTimerKey);
108 // String a1 = "sensor";
109 // IoTString ia1 = new IoTString(a1);
112 // System.out.println("Starting System");
122 // // Runtime runTime = Runtime.getRuntime();
123 // // // Process proc = runTime.exec("/opt/vc/bin/vcgencmd measure_temp | tr -d 'temp=' | tr -d \"'C\"");
124 // // Process proc = runTime.exec("/opt/vc/bin/vcgencmd measure_temp");
125 // // BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream()));
126 // // String line = null;
127 // // String dat = "";
128 // // while ((line = reader.readLine()) != null) {
129 // // System.out.println(line);
132 // // reader.close();
136 // // String pingTimer = Long.toString(System.currentTimeMillis());
137 // // IoTString ipingTimer = new IoTString(pingTimer);
140 // IoTString senDat = new IoTString(dat);
143 // t1.startTransaction();
144 // t1.addKV(ipingTimerKey, ipingTimer);
145 // t1.addKV(ia1, senDat);
146 // t1.commitTransaction();
154 // Thread.sleep(5000);
156 // } catch (Error e) {
157 // e.printStackTrace();
159 // Runtime runTime = Runtime.getRuntime();
160 // runTime.exec("gpio mode 4 out");
164 // runTime.exec("gpio write 4 1");
165 // Thread.sleep(500);
166 // runTime.exec("gpio write 4 0");
167 // Thread.sleep(500);