Search in sources :

Example 6 with ZigBeeCommand

use of com.zsmartsystems.zigbee.ZigBeeCommand 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)

Aggregations

ZigBeeCommand (com.zsmartsystems.zigbee.ZigBeeCommand)6 ZigBeeNode (com.zsmartsystems.zigbee.ZigBeeNode)6 IeeeAddress (com.zsmartsystems.zigbee.IeeeAddress)5 ZigBeeEndpoint (com.zsmartsystems.zigbee.ZigBeeEndpoint)5 Test (org.junit.Test)5 ZclOnOffCluster (com.zsmartsystems.zigbee.zcl.clusters.ZclOnOffCluster)4 ZigBeeEndpointAddress (com.zsmartsystems.zigbee.ZigBeeEndpointAddress)3 ZigBeeNetworkManager (com.zsmartsystems.zigbee.ZigBeeNetworkManager)2 Future (java.util.concurrent.Future)2 InvocationOnMock (org.mockito.invocation.InvocationOnMock)2 CommandResult (com.zsmartsystems.zigbee.CommandResult)1 CommandResultFuture (com.zsmartsystems.zigbee.CommandResultFuture)1 ZigBeeTransactionMatcher (com.zsmartsystems.zigbee.ZigBeeTransactionMatcher)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 ZclOtaUpgradeCluster (com.zsmartsystems.zigbee.zcl.clusters.ZclOtaUpgradeCluster)1 ConfigureReportingCommand (com.zsmartsystems.zigbee.zcl.clusters.general.ConfigureReportingCommand)1 ReadReportingConfigurationCommand (com.zsmartsystems.zigbee.zcl.clusters.general.ReadReportingConfigurationCommand)1