Search in sources :

Example 16 with ZigBeeNode

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());
}
Also used : ZigBeeNode(com.zsmartsystems.zigbee.ZigBeeNode) ZclLevelControlCluster(com.zsmartsystems.zigbee.zcl.clusters.ZclLevelControlCluster) ZigBeeEndpoint(com.zsmartsystems.zigbee.ZigBeeEndpoint) IeeeAddress(com.zsmartsystems.zigbee.IeeeAddress) Test(org.junit.Test)

Example 17 with ZigBeeNode

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());
}
Also used : ZclOnOffCluster(com.zsmartsystems.zigbee.zcl.clusters.ZclOnOffCluster) ZigBeeNode(com.zsmartsystems.zigbee.ZigBeeNode) ZigBeeEndpoint(com.zsmartsystems.zigbee.ZigBeeEndpoint) IeeeAddress(com.zsmartsystems.zigbee.IeeeAddress) Test(org.junit.Test)

Example 18 with ZigBeeNode

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());
}
Also used : ZclOnOffCluster(com.zsmartsystems.zigbee.zcl.clusters.ZclOnOffCluster) ZigBeeCommand(com.zsmartsystems.zigbee.ZigBeeCommand) AttributeReportingConfigurationRecord(com.zsmartsystems.zigbee.zcl.field.AttributeReportingConfigurationRecord) ZigBeeNode(com.zsmartsystems.zigbee.ZigBeeNode) ConfigureReportingCommand(com.zsmartsystems.zigbee.zcl.clusters.general.ConfigureReportingCommand) ZigBeeEndpoint(com.zsmartsystems.zigbee.ZigBeeEndpoint) IeeeAddress(com.zsmartsystems.zigbee.IeeeAddress) Test(org.junit.Test)

Example 19 with ZigBeeNode

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);
}
Also used : ZigBeeNode(com.zsmartsystems.zigbee.ZigBeeNode)

Aggregations

ZigBeeNode (com.zsmartsystems.zigbee.ZigBeeNode)19 IeeeAddress (com.zsmartsystems.zigbee.IeeeAddress)12 ZigBeeEndpoint (com.zsmartsystems.zigbee.ZigBeeEndpoint)12 Test (org.junit.Test)11 ZclOnOffCluster (com.zsmartsystems.zigbee.zcl.clusters.ZclOnOffCluster)7 ArrayList (java.util.ArrayList)6 ZigBeeCommand (com.zsmartsystems.zigbee.ZigBeeCommand)5 ZigBeeEndpointAddress (com.zsmartsystems.zigbee.ZigBeeEndpointAddress)4 XStream (com.thoughtworks.xstream.XStream)2 ZigBeeNetworkManager (com.zsmartsystems.zigbee.ZigBeeNetworkManager)2 ZigBeeNodeDao (com.zsmartsystems.zigbee.dao.ZigBeeNodeDao)2 NodeDescriptor (com.zsmartsystems.zigbee.zdo.field.NodeDescriptor)2 File (java.io.File)2 IOException (java.io.IOException)2 HashSet (java.util.HashSet)2 PrettyPrintWriter (com.thoughtworks.xstream.io.xml.PrettyPrintWriter)1 ZigBeeOtaFile (com.zsmartsystems.zigbee.app.otaserver.ZigBeeOtaFile)1 ZigBeeOtaServer (com.zsmartsystems.zigbee.app.otaserver.ZigBeeOtaServer)1 ZigBeeOtaServerStatus (com.zsmartsystems.zigbee.app.otaserver.ZigBeeOtaServerStatus)1 ZigBeeOtaStatusCallback (com.zsmartsystems.zigbee.app.otaserver.ZigBeeOtaStatusCallback)1