use of com.zsmartsystems.zigbee.ZigBeeNode in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZclClusterTest method getClusterName.
@Test
public void getClusterName() {
createNetworkManager();
ZigBeeNode node = new ZigBeeNode(networkManager, new IeeeAddress());
node.setNetworkAddress(1234);
ZigBeeEndpoint device = new ZigBeeEndpoint(networkManager, node, 5);
ZclCluster cluster = new ZclLevelControlCluster(networkManager, device);
assertEquals("Level Control", cluster.getClusterName());
}
use of com.zsmartsystems.zigbee.ZigBeeNode in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZclClusterTest method getClusterId.
@Test
public void getClusterId() {
createNetworkManager();
ZigBeeNode node = new ZigBeeNode(networkManager, new IeeeAddress());
node.setNetworkAddress(1234);
ZigBeeEndpoint device = new ZigBeeEndpoint(networkManager, node, 5);
ZclCluster cluster = new ZclOnOffCluster(networkManager, device);
assertEquals(Integer.valueOf(6), cluster.getClusterId());
}
use of com.zsmartsystems.zigbee.ZigBeeNode in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZclClusterTest method setReporting.
@Test
public void setReporting() {
createNetworkManager();
ZigBeeNode node = new ZigBeeNode(networkManager, new IeeeAddress());
node.setNetworkAddress(1234);
ZigBeeEndpoint device = new ZigBeeEndpoint(networkManager, node, 5);
ZclCluster cluster = new ZclOnOffCluster(networkManager, device);
ZclAttribute attribute = cluster.getAttribute(0);
cluster.setReporting(attribute, 22, 33);
assertEquals(1, commandCapture.getAllValues().size());
ZigBeeCommand command = commandCapture.getValue();
assertNotNull(command);
System.out.println(command);
assertTrue(command instanceof ConfigureReportingCommand);
ConfigureReportingCommand cfgCommand = (ConfigureReportingCommand) command;
assertEquals(1, cfgCommand.getRecords().size());
AttributeReportingConfigurationRecord record = cfgCommand.getRecords().get(0);
assertEquals(0, record.getAttributeIdentifier());
assertEquals(0, record.getDirection());
}
use of com.zsmartsystems.zigbee.ZigBeeNode in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZigBeeNetworkDiscoverer method addNode.
/**
* Updates {@link ZigBeeNode} and completes discovery if all devices are discovered in
* this node.
*
* @param node the {@link ZigBeeNode} to add
*/
private void addNode(final IeeeAddress ieeeAddress, int networkAddress) {
ZigBeeNode node = networkManager.getNode(ieeeAddress);
if (node != null) {
node.setNetworkAddress(networkAddress);
return;
}
node = new ZigBeeNode(networkManager, ieeeAddress);
node.setNetworkAddress(networkAddress);
// Add the node to the network...
networkManager.addNode(node);
}
Aggregations