for (ZWaveCommandClass zwaveCommandClass : this.node.getCommandClasses()) {
logger.trace("NODE {}: Inspecting command class {}", this.node.getNodeId(), zwaveCommandClass.getCommandClass().getLabel());
if (zwaveCommandClass instanceof ZWaveCommandClassDynamicState) {
logger.debug("NODE {}: Found dynamic state command class {}", this.node.getNodeId(), zwaveCommandClass.getCommandClass()
.getLabel());
ZWaveCommandClassDynamicState zdds = (ZWaveCommandClassDynamicState) zwaveCommandClass;
int instances = zwaveCommandClass.getInstances();
if (instances == 0) {
Collection<SerialMessage> dynamicQueries = zdds.getDynamicValues();
for (SerialMessage serialMessage : dynamicQueries) {
this.controller.sendData(serialMessage);
queriesPending++;
}
} else {
for (int i = 1; i <= instances; i++) {
Collection<SerialMessage> dynamicQueries = zdds.getDynamicValues();
for (SerialMessage serialMessage : dynamicQueries) {
this.controller
.sendData(this.node.encapsulate(serialMessage, zwaveCommandClass, i));
queriesPending++;
}
}
}
} else if (zwaveCommandClass instanceof ZWaveMultiInstanceCommandClass) {
ZWaveMultiInstanceCommandClass multiInstanceCommandClass = (ZWaveMultiInstanceCommandClass) zwaveCommandClass;
for (ZWaveEndpoint endpoint : multiInstanceCommandClass.getEndpoints()) {
for (ZWaveCommandClass endpointCommandClass : endpoint.getCommandClasses()) {
logger.trace(String.format("NODE %d: Inspecting command class %s for endpoint %d", this.node.getNodeId(), endpointCommandClass
.getCommandClass().getLabel(), endpoint.getEndpointId()));
if (endpointCommandClass instanceof ZWaveCommandClassDynamicState) {
logger.debug("NODE {}: Found dynamic state command class {}", this.node.getNodeId(), endpointCommandClass
.getCommandClass().getLabel());
ZWaveCommandClassDynamicState zdds2 = (ZWaveCommandClassDynamicState) endpointCommandClass;
Collection<SerialMessage> dynamicQueries = zdds2.getDynamicValues();
for (SerialMessage serialMessage : dynamicQueries) {
this.controller.sendData(this.node.encapsulate(serialMessage,
endpointCommandClass, endpoint.getEndpointId()));
queriesPending++;
}