Example #1
0
        /// <summary>
        /// The Configure Reporting Command
        ///
        /// 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 Task<CommandResult> command result Task
        /// </summary>
        public Task <CommandResult> ConfigureReportingCommand(List <AttributeReportingConfigurationRecord> records)
        {
            ConfigureReportingCommand command = new ConfigureReportingCommand();

            // Set the fields
            command.Records = records;

            return(Send(command));
        }
Example #2
0
        /// <summary>
        /// Configures the reporting for the specified attribute ID for analog attributes.
        ///
        /// minInterval:
        /// 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.
        ///
        /// maxInterval:
        /// 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.
        ///
        /// reportableChange:
        /// 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 name="attribute">the ZclAttribute to configure reporting</param>
        /// <param name="minInterval">the minimum reporting interval</param>
        /// <param name="maxInterval">the maximum reporting interval</param>
        /// <param name="reportableChange">the minimum change required to report an update</param>
        /// <returns>command Task CommandResult</returns>
        /// </summary>
        public Task <CommandResult> SetReporting(ZclAttribute attribute, ushort minInterval, ushort maxInterval, object reportableChange)
        {
            ConfigureReportingCommand command = new ConfigureReportingCommand();

            command.ClusterId = _clusterId;

            AttributeReportingConfigurationRecord record = new AttributeReportingConfigurationRecord();

            record.Direction                = 0;
            record.AttributeIdentifier      = attribute.Id;
            record.AttributeDataType        = attribute.ZclDataType;
            record.MinimumReportingInterval = minInterval;
            record.MaximumReportingInterval = maxInterval;
            record.ReportableChange         = reportableChange;
            record.TimeoutPeriod            = 0;
            command.Records            = new List <AttributeReportingConfigurationRecord>(new[] { record });
            command.DestinationAddress = _zigbeeEndpoint.GetEndpointAddress();

            return(Send(command));
        }