use of com.zsmartsystems.zigbee.zcl.field.AttributeRecord 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());
}
use of com.zsmartsystems.zigbee.zcl.field.AttributeRecord 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);
}
Aggregations