private static final int MOTION_TIME_THRESHOLD = 60; // in seconds
private static final int CAMERA_FPS = 15;
private static final int CHECK_TIME_WAIT = 1; // in seconds
- private static final int SECOND_TO_TURN_ON = 60; // in seconds
+ private static final int SECOND_TO_TURN_ON = -1; // in seconds
private static final int SECOND_TO_TURN_OFF = 1; // in seconds
private static final int LOCK_DOOR = 0;
private static final int UNLOCK_DOOR = 1;
// Get and init the alarm (this single alarm set can serve multiple zones / rooms)
Iterator alarmIt = alarmSet.iterator();
AlarmSmart alm = (AlarmSmart) alarmIt.next();
- alm.setZone(zoneId, true, SECOND_TO_TURN_OFF);
+ alm.setZone(zoneId, true, SECOND_TO_TURN_ON);
updateIoTCloud("alarm", ACTIVE);
}
Iterator alarmIt = alarmSet.iterator();
AlarmSmart alm = (AlarmSmart) alarmIt.next();
// Turn this alarm off indefinitely
- alm.setZone(zoneId, false, SECOND_TO_TURN_ON);
+ alm.setZone(zoneId, false, SECOND_TO_TURN_OFF);
updateIoTCloud("alarm", NOT_ACTIVE);
}
// Return time since January 1, 1970 00:00:00 UTC in seconds
return System.currentTimeMillis()/1000;
}
-
- /*public static void main(String[] args) throws Exception {
-
- String ipAddress = "192.168.1.183";
- String devicePin = "215530";
- IoTDeviceAddress iotAddress = new IoTDeviceAddress(ipAddress, 12345, 80, false, false);
- Set<IoTDeviceAddress> setAddress = new HashSet<IoTDeviceAddress>();
- setAddress.add(iotAddress);
- IoTSet<IoTDeviceAddress> iotSetAddress = new IoTSet<IoTDeviceAddress>(setAddress);
-
- DlinkAlarm alarm = new DlinkAlarm(iotSetAddress, devicePin);
- alarm.init();
- // Set alarm
- alarm.setZone(0, true, -1);
- // Set alarm
- alarm.setZone(0, false, 0);
- // Set alarm
- alarm.setZone(0, true, -1);
- // Set alarm
- alarm.setZone(0, false, 0);
- }*/
}
routerConfig.configureHostHTTPPolicies(strIoTSlaveObjectHostAdd, strIoTSlaveObjectHostAdd, strDeviceAddress);
// Configure MAC policies
if (STR_ACTIVATE_SANDBOXING.equals("Yes"))
- processJailConfig.configureProcessJailGWDevicePolicies(strIoTSlaveObjectHostAdd, STR_ROUTER_ADD, INT_DNS_PORT);
+ processJailConfig.configureProcessJailGWDevicePolicies(strIoTSlaveObjectHostAdd, STR_ROUTER_ADD, strDeviceAddress, INT_DNS_PORT);
} else {
// Other port numbers...
commHan.addDevicePort(iDestDeviceDriverPort);
private static final String STR_DEV_IP_ADDRESS = "<dev-ip-address>";
private static final String STR_DEV_COM_PORT = "<dev-com-port>";
private static final String STR_DEV_PORT = "<dev-port>";
+
+ private static final int INT_HTTP_PORT = 80;
+ private static final int INT_DNS_PORT = 53;
/**
* @param iPort Integer port
* @return void
*/
- public void configureProcessJailGWDevicePolicies(String strConfigHost, String strRouterAddress, int iPort) {
+ public void configureProcessJailGWDevicePolicies(String strConfigHost, String strRouterAddress, String strDeviceIPAddress, int iPort) {
PrintWriter pwConfig = getPrintWriter(strConfigHost);
pwConfig.println("file read /home/iotuser/iot2/iotjava/iotruntime/\\*.jks");
pwConfig.println("file read /etc/resolv.conf");
pwConfig.println("file read /etc/hosts");
+ pwConfig.println("network inet stream connect ::ffff:" + strDeviceIPAddress + " " + String.valueOf(INT_HTTP_PORT)); // HTTP access for this address
pwConfig.println("network inet dgram send " + strRouterAddress + " " + String.valueOf(iPort));
}
pwConfig.println("file read /etc/resolv.conf");
pwConfig.println("file read /etc/hosts");
pwConfig.println("file read /etc/host.conf");
- pwConfig.println("network inet dgram send " + strRouterAddress + " " + String.valueOf(53)); // TCP/UDP access through router
- pwConfig.println("network inet stream connect ::ffff:" + strAddress + " " + String.valueOf(80)); // HTTP access for this address
+ pwConfig.println("network inet dgram send " + strRouterAddress + " " + String.valueOf(INT_DNS_PORT)); // TCP/UDP access through router
+ pwConfig.println("network inet stream connect ::ffff:" + strAddress + " " + String.valueOf(INT_HTTP_PORT)); // HTTP access for this address
}
SELECT * FROM
AlarmSmart
+WHERE
+ID='AL2'
;
SELECT * FROM
IoTDeviceAddress
WHERE
-TYPE='EspAlarmAdd'
+TYPE='DlinkAlarmAdd'
;
SELECT * FROM
CameraSmart
+WHERE
+ID='CM4'
;
SELECT * FROM\r
CameraSmart\r
WHERE\r
-ID='CM1'\r
+ID='CM3'\r
;\r