projects
/
iot2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5ef9055
)
Completing the addition of iotcloud into the 4th benchmark - alarm control over the...
author
rtrimana
<rtrimana@uci.edu>
Mon, 2 Oct 2017 18:10:31 +0000
(11:10 -0700)
committer
rtrimana
<rtrimana@uci.edu>
Mon, 2 Oct 2017 18:10:31 +0000
(11:10 -0700)
benchmarks/Java/HomeSecurityController/HomeSecurityController.java
patch
|
blob
|
history
benchmarks/other/PhoneInterface/Control/.idea/misc.xml
patch
|
blob
|
history
benchmarks/other/PhoneInterface/Control/app/src/main/java/com/example/ali/control/MainActivity.java
patch
|
blob
|
history
diff --git
a/benchmarks/Java/HomeSecurityController/HomeSecurityController.java
b/benchmarks/Java/HomeSecurityController/HomeSecurityController.java
index c146c6f61e4190cae0ea02309672f256f19972ef..6615f8313e2208816f11a4a26c58d078818aeb06 100644
(file)
--- a/
benchmarks/Java/HomeSecurityController/HomeSecurityController.java
+++ b/
benchmarks/Java/HomeSecurityController/HomeSecurityController.java
@@
-147,7
+147,7
@@
public class HomeSecurityController implements SmartthingsSensorCallback, Smartt
createKeyIoTCloud("alarm", NOT_ACTIVE);
System.out.println("DEBUG: Setting alarm to NOT-ACTIVE!");
}
createKeyIoTCloud("alarm", NOT_ACTIVE);
System.out.println("DEBUG: Setting alarm to NOT-ACTIVE!");
}
- // TODO:
Just use alarm for now as a status to cloud
+ // TODO:
We can extend the usage of other keys to have a complete monitoring system for every device
/*for(SmartthingsSensorSmart smartSensor : smartSensorsSet.values()) {
createKeyIoTCloud("sensor" + Integer.toString(id++), NOT_ACTIVE);
/*for(SmartthingsSensorSmart smartSensor : smartSensorsSet.values()) {
createKeyIoTCloud("sensor" + Integer.toString(id++), NOT_ACTIVE);
@@
-201,7
+201,7
@@
public class HomeSecurityController implements SmartthingsSensorCallback, Smartt
* @return [void] None.
*/
private void updateIoTCloud(String key, IoTString val) {
* @return [void] None.
*/
private void updateIoTCloud(String key, IoTString val) {
-
+ // No key creation here!
try {
IoTString iotKey = new IoTString(key);
t1.update();
try {
IoTString iotKey = new IoTString(key);
t1.update();
@@
-253,8
+253,6
@@
public class HomeSecurityController implements SmartthingsSensorCallback, Smartt
senDetectStatus.put(sensorId, false);
System.out.println("DEBUG: Initialized sensor detection to false!");
// Initialize IoTCloud
senDetectStatus.put(sensorId, false);
System.out.println("DEBUG: Initialized sensor detection to false!");
// Initialize IoTCloud
-// createKeyIoTCloud("sensor" + Integer.toString(sensorId), NOT_ACTIVE);
-// System.out.println("DEBUG: Setting sensor" + sensorId + " to NOT-ACTIVE!");
sen.setId(sensorId++);
sen.registerCallback(this);
System.out.println("DEBUG: Registered sensor callback!");
sen.setId(sensorId++);
sen.registerCallback(this);
System.out.println("DEBUG: Registered sensor callback!");
@@
-296,10
+294,6
@@
public class HomeSecurityController implements SmartthingsSensorCallback, Smartt
// Initialize detection to false
camDetectStatus.put(cam, false);
// Initialize detection to false
camDetectStatus.put(cam, false);
-
- // Initialize IoTCloud
-// createKeyIoTCloud("camera", NOT_ACTIVE);
-// System.out.println("DEBUG: Setting camera to NOT-ACTIVE!");
}
}
}
}
@@
-313,18
+307,10
@@
public class HomeSecurityController implements SmartthingsSensorCallback, Smartt
// Get and init the alarm (this single alarm set can serve multiple zones / rooms)
Iterator alarmIt = alarmSet.iterator();
AlarmSmart alm = (AlarmSmart) alarmIt.next();
// Get and init the alarm (this single alarm set can serve multiple zones / rooms)
Iterator alarmIt = alarmSet.iterator();
AlarmSmart alm = (AlarmSmart) alarmIt.next();
- // Initialize IoTCloud - only 1 alarm
-// createKeyIoTCloud("alarm", NOT_ACTIVE);
-// System.out.println("DEBUG: Setting alarm to NOT-ACTIVE!");
// Initialize the alarm controller, do it here since it only needs to be done once per controller
try {
alm.init();
System.out.println("DEBUG: Initialized alarm!");
// Initialize the alarm controller, do it here since it only needs to be done once per controller
try {
alm.init();
System.out.println("DEBUG: Initialized alarm!");
- // TODO: Check that this initialization works for multiple times - might be that setZone() only works once!
- //for (RoomSmart room : roomSet.values()) {
- // turnOffAlarms(room.getRoomID());
- // System.out.println("DEBUG: Initialized alarm for room (turn off): " + room.getRoomID());
- //}
} catch (Exception e) {
e.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
@@
-347,9
+333,6
@@
public class HomeSecurityController implements SmartthingsSensorCallback, Smartt
System.out.println("DEBUG: Initialized doorlock! ID: " + doorlockId);
doorlockStatus.put(doorlockId, false);
System.out.println("DEBUG: Initialized doorlock status to false!");
System.out.println("DEBUG: Initialized doorlock! ID: " + doorlockId);
doorlockStatus.put(doorlockId, false);
System.out.println("DEBUG: Initialized doorlock status to false!");
- // Initialize IoTCloud
-// createKeyIoTCloud("doorlock" + Integer.toString(doorlockId), NOT_ACTIVE);
-// System.out.println("DEBUG: Setting doorlock to NOT-ACTIVE!");
doorlock.setId(doorlockId++);
doorlock.registerCallback(this);
System.out.println("DEBUG: Registered doorlock callback!");
doorlock.setId(doorlockId++);
doorlock.registerCallback(this);
System.out.println("DEBUG: Registered doorlock callback!");
@@
-647,12
+630,6
@@
public class HomeSecurityController implements SmartthingsSensorCallback, Smartt
// Init all Smartthings sensors
initSmartthingsSensors(rm);
// Init all Smartthings sensors
initSmartthingsSensors(rm);
- //try {
- // Thread.sleep(5000);
- //} catch (Exception e) {
- // e.printStackTrace();
- //}
-
}
// Init all doorlocks
initDoorLocks();
}
// Init all doorlocks
initDoorLocks();
diff --git
a/benchmarks/other/PhoneInterface/Control/.idea/misc.xml
b/benchmarks/other/PhoneInterface/Control/.idea/misc.xml
index 5d19981032aa01b060f5a568641d7a8840cc90dc..fbb68289f4352bf149aa31a2c9940faa99174224 100644
(file)
--- a/
benchmarks/other/PhoneInterface/Control/.idea/misc.xml
+++ b/
benchmarks/other/PhoneInterface/Control/.idea/misc.xml
@@
-37,7
+37,7
@@
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
- <component name="ProjectRootManager" version="2" languageLevel="JDK_1_
7
" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_
8
" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
diff --git
a/benchmarks/other/PhoneInterface/Control/app/src/main/java/com/example/ali/control/MainActivity.java
b/benchmarks/other/PhoneInterface/Control/app/src/main/java/com/example/ali/control/MainActivity.java
index 1133cc4f4d9eee8619635dd381797741b9341d47..c1fb2086406ff45bc092dd5a36ee10ba86f419f8 100644
(file)
--- a/
benchmarks/other/PhoneInterface/Control/app/src/main/java/com/example/ali/control/MainActivity.java
+++ b/
benchmarks/other/PhoneInterface/Control/app/src/main/java/com/example/ali/control/MainActivity.java
@@
-61,6
+61,7
@@
public class MainActivity extends AppCompatActivity implements View.OnClickListe
if (intStatus == 0) {
alarmStatus.setText("OFF");
if (intStatus == 0) {
alarmStatus.setText("OFF");
+ alarmButton.setText("ON");
alarmStatus.setTextColor(Color.BLUE);
//alarmSwitch.setChecked(false);
alarmOn = false;
alarmStatus.setTextColor(Color.BLUE);
//alarmSwitch.setChecked(false);
alarmOn = false;
@@
-68,6
+69,7
@@
public class MainActivity extends AppCompatActivity implements View.OnClickListe
}
else {// value 1
alarmStatus.setText("ON");
}
else {// value 1
alarmStatus.setText("ON");
+ alarmButton.setText("OFF");
alarmStatus.setTextColor(Color.RED);
//alarmSwitch.setChecked(true);
alarmOn = true;
alarmStatus.setTextColor(Color.RED);
//alarmSwitch.setChecked(true);
alarmOn = true;