if (splitDomain[0].equals("nodes")) {
int nodeId = Integer.parseInt(splitDomain[1].substring(4));
// Get the node - if it exists
ZWaveNode node = zController.getNode(nodeId);
if (node == null) {
logger.error("NODE {}: Error finding node in doAction", nodeId);
return;
}
if (splitDomain.length == 2) {
if (action.equals("Heal")) {
logger.debug("NODE {}: Heal node", nodeId);
if (networkMonitor != null)
networkMonitor.healNode(nodeId);
}
if (action.equals("Save")) {
logger.debug("NODE {}: Saving node", nodeId);
// Write the node to disk
ZWaveNodeSerializer nodeSerializer = new ZWaveNodeSerializer();
nodeSerializer.SerializeNode(node);
}
if (action.equals("Delete")) {
logger.debug("NODE {}: Delete node", nodeId);
this.zController.requestRemoveFailedNode(nodeId);
}
// This is temporary
// It should be in the startup code, but that needs refactoring
if (action.equals("Version")) {
logger.debug("NODE {}: Get node version", nodeId);
ZWaveVersionCommandClass versionCommandClass = (ZWaveVersionCommandClass) node
.getCommandClass(CommandClass.VERSION);
if (versionCommandClass == null) {
logger.error("NODE {}: Error getting versionCommandClass in doAction", nodeId);
return;
}
// Request the version report for this node
this.zController.sendData(versionCommandClass.getVersionMessage());
}
// Return here as afterwards we assume there are more elements
// in the domain array
return;
}
if (splitDomain[2].equals("parameters")) {
ZWaveConfigurationCommandClass configurationCommandClass = (ZWaveConfigurationCommandClass) node
.getCommandClass(CommandClass.CONFIGURATION);
if (configurationCommandClass == null) {
logger.error("NODE {}: Error getting configurationCommandClass in doAction", nodeId);
return;
}
if (action.equals("Refresh")) {
logger.debug("NODE {}: Refresh parameters", nodeId);
ZWaveProductDatabase database = new ZWaveProductDatabase();
if (database.FindProduct(node.getManufacturer(), node.getDeviceType(), node.getDeviceId()) == false) {
logger.error("NODE {}: Error getting parameters - no database found", nodeId);
return;
}
List<ZWaveDbConfigurationParameter> configList = database.getProductConfigParameters();
// Request all parameters for this node
for (ZWaveDbConfigurationParameter parameter : configList)
this.zController.sendData(configurationCommandClass.getConfigMessage(parameter.Index));
}
}
if (splitDomain[2].equals("wakeup")) {
if (action.equals("Refresh")) {
logger.debug("NODE {}: Refresh wakeup capabilities", nodeId);
ZWaveWakeUpCommandClass wakeupCommandClass = (ZWaveWakeUpCommandClass) node
.getCommandClass(CommandClass.WAKE_UP);
if (wakeupCommandClass == null) {
logger.error("NODE {}: Error getting wakeupCommandClass in doAction", nodeId);
return;
}
// Request the wakeup interval for this node
this.zController.sendData(wakeupCommandClass.getIntervalMessage());
// Request the wakeup parameters for this node
this.zController.sendData(wakeupCommandClass.getIntervalCapabilitiesMessage());
}
}
if (splitDomain[2].equals("neighbors")) {
if (action.equals("Refresh")) {
// this.zController.requestNodeNeighborUpdate(nodeId);
this.zController.requestNodeRoutingInfo(nodeId);// .requestNodeNeighborUpdate(nodeId);
}
}
if (splitDomain[2].equals("associations")) {
if (action.equals("Refresh")) {
logger.debug("NODE {}: Refresh associations", nodeId);
ZWaveProductDatabase database = new ZWaveProductDatabase();
if (database.FindProduct(node.getManufacturer(), node.getDeviceType(), node.getDeviceId()) == false) {
logger.error("NODE {}: Error in doAction - no database found", nodeId);
return;
}
ZWaveAssociationCommandClass associationCommandClass = (ZWaveAssociationCommandClass) node
.getCommandClass(CommandClass.ASSOCIATION);
if (associationCommandClass == null) {
logger.error("NODE {}: Error getting associationCommandClass in doAction", nodeId);
return;
}