// pumps
List pumps = fireApplication.getPumps();
JSONArray pumpsArray = new JSONArray();
for (Iterator it = pumps.iterator(); it.hasNext();) {
EndPointService es = (EndPointService) it.next();
String name = es.getName();
String friendlyName = getDeviceFriendlyNameId(es);
name = name + " " + friendlyName;
// remove first # from friendlyname
friendlyName = friendlyName.replaceAll("#", "");
String id = PUMP_PREFIX_ID + friendlyName;
Map properties = new HashMap();
properties.put(ID_PROP, id);
properties.put(NAME_PROP, name);
properties.put(TECHNO_PROP, ZIGBEE_TECHNO);
properties.put(IMG_PROP, PUMP_IMG);
JSONObject pumpJs = new JSONObject(properties);
pumpsArray.add(pumpJs);
}
// GreenNet switches is also viewed as a pump (i.e. actuator)
List greenNetSwitches = fireApplication.getGreenNetSwitches();
for(Iterator it = greenNetSwitches.iterator(); it.hasNext();) {
Device greenNetSwitch = (Device) it.next();
String id = ((Actuator)greenNetSwitch).getNode().getIdentifier();
String name = "Air extractor";
Map properties = new HashMap();
properties.put(ID_PROP, id);
properties.put(NAME_PROP, name);
properties.put(TECHNO_PROP, GREENNET_TECHNO);
properties.put(IMG_PROP, GREENNET_AIR_EJECTOR_IMG);
JSONObject pumpJs = new JSONObject(properties);
pumpsArray.add(pumpJs);
}
devices.put(PUMPS_PROP, pumpsArray);
// ias zones
List zones = fireApplication.getZoneDevices();
JSONArray zonesArray = new JSONArray();
for (Iterator it = zones.iterator(); it.hasNext();) {
EndPointService es = (EndPointService) it.next();
String name = es.getName();
String friendlyName = getDeviceFriendlyNameId(es);
name = name + " " + friendlyName;
// remove first # from friendlyname
friendlyName = friendlyName.replaceAll("#", "");
String id = IAS_ZONES_PREFIX_ID + friendlyName;
Map properties = new HashMap();
properties.put(ID_PROP, id);
properties.put(NAME_PROP, name);
properties.put(TECHNO_PROP, ZIGBEE_TECHNO);
properties.put(IMG_PROP, SMOKE_DETECTOR_IMG);
JSONObject zoneJs = new JSONObject(properties);
zonesArray.add(zoneJs);
}
devices.put(IAS_ZONES_PROP, zonesArray);
// warning devices
List warnings = fireApplication.getWarningDevices();
JSONArray warningArray = new JSONArray();
for (Iterator it = warnings.iterator(); it.hasNext();) {
EndPointService es = (EndPointService) it.next();
String name = es.getName();
String friendlyName = getDeviceFriendlyNameId(es);
name = name + " " + friendlyName;
// remove first # from friendlyname
friendlyName = friendlyName.replaceAll("#", "");