Search in sources :

Example 1 with ReadReportingConfigurationCommand

use of com.zsmartsystems.zigbee.zcl.clusters.general.ReadReportingConfigurationCommand in project com.zsmartsystems.zigbee by zsmartsystems.

the class ZclClusterTest method getReporting.

@Test
public void getReporting() {
    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.getReporting(attribute);
    assertEquals(1, commandCapture.getAllValues().size());
    ZigBeeCommand command = commandCapture.getValue();
    assertNotNull(command);
    System.out.println(command);
    assertTrue(command instanceof ReadReportingConfigurationCommand);
    ReadReportingConfigurationCommand cfgCommand = (ReadReportingConfigurationCommand) command;
    assertEquals(1, cfgCommand.getRecords().size());
    AttributeRecord 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) AttributeRecord(com.zsmartsystems.zigbee.zcl.field.AttributeRecord) ZigBeeNode(com.zsmartsystems.zigbee.ZigBeeNode) ZigBeeEndpoint(com.zsmartsystems.zigbee.ZigBeeEndpoint) IeeeAddress(com.zsmartsystems.zigbee.IeeeAddress) ReadReportingConfigurationCommand(com.zsmartsystems.zigbee.zcl.clusters.general.ReadReportingConfigurationCommand) Test(org.junit.Test)

Example 2 with ReadReportingConfigurationCommand

use of com.zsmartsystems.zigbee.zcl.clusters.general.ReadReportingConfigurationCommand in project com.zsmartsystems.zigbee by zsmartsystems.

the class ZclGeneralCluster method readReportingConfigurationCommand.

/**
 * The Read Reporting Configuration Command
 * <p>
 * The Read Reporting Configuration command is used to read the configuration
 * details of the reporting mechanism for one or more of the attributes of a cluster.
 *
 * @param records {@link List<AttributeRecord>} Records
 * @return the {@link Future<CommandResult>} command result future
 */
public Future<CommandResult> readReportingConfigurationCommand(List<AttributeRecord> records) {
    ReadReportingConfigurationCommand command = new ReadReportingConfigurationCommand();
    // Set the fields
    command.setRecords(records);
    return send(command);
}
Also used : ReadReportingConfigurationCommand(com.zsmartsystems.zigbee.zcl.clusters.general.ReadReportingConfigurationCommand)

Example 3 with ReadReportingConfigurationCommand

use of com.zsmartsystems.zigbee.zcl.clusters.general.ReadReportingConfigurationCommand in project com.zsmartsystems.zigbee by zsmartsystems.

the class ZclCluster method getReporting.

/**
 * Gets the reporting configuration for an attribute
 *
 * @param attribute the {@link ZclAttribute} on which to enable reporting
 * @return command future {@link CommandResult}
 */
public Future<CommandResult> getReporting(final ZclAttribute attribute) {
    final ReadReportingConfigurationCommand command = new ReadReportingConfigurationCommand();
    command.setClusterId(clusterId);
    AttributeRecord record = new AttributeRecord();
    record.setAttributeIdentifier(attribute.getId());
    record.setDirection(0);
    command.setRecords(Collections.singletonList(record));
    command.setDestinationAddress(zigbeeEndpoint.getEndpointAddress());
    return send(command);
}
Also used : WriteAttributeRecord(com.zsmartsystems.zigbee.zcl.field.WriteAttributeRecord) AttributeRecord(com.zsmartsystems.zigbee.zcl.field.AttributeRecord) ReadReportingConfigurationCommand(com.zsmartsystems.zigbee.zcl.clusters.general.ReadReportingConfigurationCommand)

Aggregations

ReadReportingConfigurationCommand (com.zsmartsystems.zigbee.zcl.clusters.general.ReadReportingConfigurationCommand)3 AttributeRecord (com.zsmartsystems.zigbee.zcl.field.AttributeRecord)2 IeeeAddress (com.zsmartsystems.zigbee.IeeeAddress)1 ZigBeeCommand (com.zsmartsystems.zigbee.ZigBeeCommand)1 ZigBeeEndpoint (com.zsmartsystems.zigbee.ZigBeeEndpoint)1 ZigBeeNode (com.zsmartsystems.zigbee.ZigBeeNode)1 ZclOnOffCluster (com.zsmartsystems.zigbee.zcl.clusters.ZclOnOffCluster)1 WriteAttributeRecord (com.zsmartsystems.zigbee.zcl.field.WriteAttributeRecord)1 Test (org.junit.Test)1