use of com.zsmartsystems.zigbee.zcl.clusters.general.ConfigureReportingCommand in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZclCluster method setReporting.
/**
* Configures the reporting for the specified attribute ID for analog attributes.
* <p>
* <b>minInterval</b>:
* The minimum reporting interval field is 16 bits in length and shall contain the
* minimum interval, in seconds, between issuing reports of the specified attribute.
* If minInterval is set to 0x0000, then there is no minimum limit, unless one is
* imposed by the specification of the cluster using this reporting mechanism or by
* the applicable profile.
* <p>
* <b>maxInterval</b>:
* The maximum reporting interval field is 16 bits in length and shall contain the
* maximum interval, in seconds, between issuing reports of the specified attribute.
* If maxInterval is set to 0xffff, then the device shall not issue reports for the specified
* attribute, and the configuration information for that attribute need not be
* maintained.
* <p>
* <b>reportableChange</b>:
* The reportable change field shall contain the minimum change to the attribute that
* will result in a report being issued. This field is of variable length. For attributes
* with 'analog' data type the field has the same data type as the attribute. The sign (if any) of the reportable
* change field is ignored.
*
* @param attribute the {@link ZclAttribute} to configure reporting
* @param minInterval the minimum reporting interval
* @param maxInterval the maximum reporting interval
* @param reportableChange the minimum change required to report an update
* @return command future {@link CommandResult}
*/
public Future<CommandResult> setReporting(final ZclAttribute attribute, final int minInterval, final int maxInterval, final Object reportableChange) {
final ConfigureReportingCommand command = new ConfigureReportingCommand();
command.setClusterId(clusterId);
final AttributeReportingConfigurationRecord record = new AttributeReportingConfigurationRecord();
record.setDirection(0);
record.setAttributeIdentifier(attribute.getId());
record.setAttributeDataType(attribute.getDataType());
record.setMinimumReportingInterval(minInterval);
record.setMaximumReportingInterval(maxInterval);
record.setReportableChange(reportableChange);
record.setTimeoutPeriod(0);
command.setRecords(Collections.singletonList(record));
command.setDestinationAddress(zigbeeEndpoint.getEndpointAddress());
return send(command);
}
use of com.zsmartsystems.zigbee.zcl.clusters.general.ConfigureReportingCommand in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZclGeneralCluster method configureReportingCommand.
/**
* The Configure Reporting Command
* <p>
* The Configure Reporting command is used to configure the reporting mechanism
* for one or more of the attributes of a cluster.
* <br>
* The individual cluster definitions specify which attributes shall be available to this
* reporting mechanism, however specific implementations of a cluster may make
* additional attributes available.
*
* @param records {@link List<AttributeReportingConfigurationRecord>} Records
* @return the {@link Future<CommandResult>} command result future
*/
public Future<CommandResult> configureReportingCommand(List<AttributeReportingConfigurationRecord> records) {
ConfigureReportingCommand command = new ConfigureReportingCommand();
// Set the fields
command.setRecords(records);
return send(command);
}
use of com.zsmartsystems.zigbee.zcl.clusters.general.ConfigureReportingCommand 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());
}
Aggregations