Functions

The following Appliance Statistics cluster functions are provided:

  1. eCLD_ApplianceStatisticsCreateApplianceStatistics

  2. eCLD_ASCAddLog

  3. eCLD_ASCRemoveLog

  4. eCLD_ASCGetLogsAvailable

  5. eCLD_ASCGetLogEntry

  6. eCLD_ASCLogQueueRequestSend

  7. eCLD_ASCLogRequestSend

  8. eCLD_ASCLogQueueResponseORStatisticsAvailableSend

  9. eCLD_ASCStatisticsAvailableSend

  10. eCLD_ASCLogNotificationORLogResponseSend

  11. eCLD_ASCLogNotificationSend

eCLD_ApplianceStatisticsCreateApplianceStatistics

teZCL_Status eCLD_ApplianceStatisticsCreateApplianceStatistics(
        tsZCL_ClusterInstance *psClusterInstance,
        bool_t bIsServer,
        tsZCL_ClusterDefinition *psClusterDefinition,
        void *pvEndPointSharedStructPtr,
        uint8 *pu8AttributeControlBits,
        tsCLD_ApplianceStatisticsCustomDataStructure
*psCustomDataStructure);

Description

This function creates an instance of the Appliance Statistics cluster on an endpoint. The cluster instance is created on the endpoint which is associated with the supplied tsZCL_ClusterInstance structure and can act as a server or a client, as specified.

The function should only be called when setting up a custom endpoint containing one or more selected clusters (rather than the whole set of clusters supported by a standard ZigBee device). This function will create an Appliance Statistics cluster instance on the endpoint, but instances of other clusters may also be created on the same endpoint by calling their corresponding creation functions. For more details of creating cluster instances on custom endpoints, refer to Appendix D.

Note: This function must not be called for an endpoint on which a standard ZigBee device is used. In this case, the device and its supported clusters must be registered on the endpoint using the relevant device registration function from those described in the ZigBee Devices User Guide (JNUG3131).

Note:

When used, this function must be the first Appliance Statistics cluster function called in the application, and must be called after the stack has been started and after the ZCL has been initialized.

The function requires an array to be declared for internal use, which contains one element (of type uint8) for each attribute of the cluster. The array length is automatically adjusted by the compiler using the following declaration:

uint8 au8ApplianceStatisticsAttributeControlBits
[(sizeof(asCLD_ApplianceStatisticsClusterAttributeDefinitions) / sizeof(tsZCL_AttributeDefinition))];

Parameters

  • psClusterInstance Pointer to structure containing information about the cluster instance to be created (see Section 6.1.16). This structure is updated by the function by initialising individual structure fields.

  • bIsServer Type of cluster instance (server or client) to be created:

  • TRUE - server

  • FALSE - client

  • psClusterDefinition Pointer to structure indicating the type of cluster to be created (see see Section 6.1.2). In this case, this structure must contain the details of the Appliance Statistics cluster. This parameter can refer to a pre-filled structure called sCLD_ApplianceStatistics which is provided in the ApplianceStatistics.h file.

  • pvEndPointSharedStructPtr Pointer to the shared structure used for attribute storage. This parameter should be the address of the structure of type tsCLD_ApplianceStatistics which defines the attributes of Appliance Statistics cluster. The function initializes the attributes with default values.

  • pu8AttributeControlBits Pointer to an array of uint8 values, with one element for each attribute in the cluster (see above). For a cluster client, set this pointer to NULL.

  • psCustomDataStructure Pointer to a structure containing the storage for internal functions of the cluster (see Section 48.9.6).

Returns

  • E_ZCL_SUCCESS

  • E_ZCL_FAIL

  • E_ZCL_ERR_PARAMETER_NULL

  • E_ZCL_ERR_INVALID_VALUE

Parent topic:Functions

eCLD_ASCAddLog

teZCL_CommandStatus eCLD_ASCAddLog(
        uint8 u8SourceEndPointId,
        uint32 u32LogId,
        uint8 u8LogLength,
        uint32 u32Time,
        uint8 *pu8LogData);

Description

This function can be used on an Appliance Statistics cluster server to add a data log to the log queue. The function also sends out a ‘Log Notification’ message to all bound Appliance Statistics cluster clients.

The length of the data log, in bytes, must be less than the defined value of CLD_APPLIANCE_STATISTICS_ATTR_LOG_MAX_SIZE (which must be less than or equal to 70).

Parameter

  • u8SourceEndPointId Number of the local endpoint on which the Appliance Statistics cluster server resides

  • u32LogId Identifier of log

  • u8LogLength Length of log, in bytes

  • u32Time UTC time at which log was produced

  • pu8LogData Pointer to log data

Returns

  • E_ZCL_CMDS_SUCCESS

  • E_ZCL_CMDS_FAIL

  • E_ZCL_CMDS_INVALID_VALUE (log too long)

  • E_ZCL_CMDS_INVALID_FIELD (NULL pointer to log data)

  • E_ZCL_CMDS_INSUFFICIENT_SPACE

Parent topic:Functions

eCLD_ASCRemoveLog

teZCL_CommandStatus eCLD_ASCRemoveLog(
    uint8 u8SourceEndPointId,
    uint32 u32LogId);

Description

This function can be used on an Appliance Statistics cluster server to remove the specified data log from the log queue.

Parameter

  • u8SourceEndPointId Number of the local endpoint on which the Appliance Statistics cluster server resides

  • u32LogId Identifier of log

Returns

  • E_ZCL_CMDS_SUCCESS

  • E_ZCL_CMDS_FAIL

Parent topic:Functions

eCLD_ASCGetLogsAvailable

teZCL_CommandStatus eCLD_ASCGetLogsAvailable(
        uint8 u8SourceEndPointId,
        uint32 *pu32LogId,
        uint8 *pu8LogIdCount);

Description

This function can be used on an Appliance Statistics cluster server to obtain a list of the data logs in the log queue. The number of available logs and a list of their log IDs will be obtained.

Parameter

  • u8SourceEndPointId Number of the local endpoint on which the Appliance Statistics cluster server resides

  • pu32LogId Pointer to an area of memory to receive the list of 32-bit log IDs

  • pu8LogIdCount Pointer to an area of memory to receive the number of logs in the queue

Returns

  • E_ZCL_CMDS_SUCCESS

  • E_ZCL_CMDS_FAIL

Parent topic:Functions

eCLD_ASCGetLogEntry

teZCL_CommandStatus eCLD_ASCGetLogEntry(
        uint8 u8SourceEndPointId,
        uint32 u32LogId,
        tsCLD_LogTable **ppsLogTable);

Description

This function can be used on an Appliance Statistics cluster server to obtain the data log with the specified log ID.

Parameter

  • u8SourceEndPointId Number of the local endpoint on which the Appliance Statistics cluster server resides

  • u32LogId Log ID of the required data log

  • ppsLogTable Pointer to a memory location to receive a pointer to the required data log

Returns

  • E_ZCL_CMDS_SUCCESS

  • E_ZCL_CMDS_FAIL

  • E_ZCL_CMDS_NOT_FOUND (specified log not present)

Parent topic:Functions

eCLD_ASCLogQueueRequestSend

teZCL_Status eCLD_ASCLogQueueRequestSend(
uint8 u8SourceEndPointId,
uint8 u8DestinationEndPointId,
tsZCL_Address *psDestinationAddress,
uint8 *pu8TransactionSequenceNumber);

Description

This function can be used on an Appliance Statistics cluster client to send a ‘Log Queue Request’ message to a cluster server (appliance), in order enquire about the availability of logs on the server.

You are required to provide a pointer to a location to receive a Transaction Sequence Number (TSN) for the message. The TSN in the response is set to match the TSN in the request, allowing an incoming response to be paired with a request. This is useful when sending more than one request to the same destination endpoint.

Parameters

  • u8SourceEndPointId Number of the local endpoint through which to send the message. This parameter is used both to send the message and to identify the instance of the shared structure holding the required attribute values

  • u8DestinationEndPointId Number of the endpoint on the remote node to which the message is sent. This parameter is ignored when sending to address types eZCL_AMBOUND and eZCL_AMGROUP

  • psDestinationAddress Pointer to a structure holding the address of the node to which the message is sent

  • pu8TransactionSequenceNumber Pointer to a location to receive the Transaction Sequence Number (TSN) of the message

Returns

  • E_ZCL_SUCCESS

  • E_ZCL_FAIL

  • E_ZCL_ERR_PARAMETER_NULL

  • E_ZCL_ERR_INVALID_VALUE

Parent topic:Functions

eCLD_ASCLogRequestSend

teZCL_Status eCLD_ASCLogRequestSend(
        uint8 u8SourceEndPointId,
        uint8 u8DestinationEndPointId,
        tsZCL_Address *psDestinationAddress,
        uint8 *pu8TransactionSequenceNumber,
        tsCLD_ASC_LogRequestPayload *psPayload);

Description

This function can be used on an Appliance Statistics cluster client to send a ‘Log Request’ message to a cluster server (appliance), in order request the data log with a specified log ID.

The function should normally be called after enquiring about log availability using the function eCLD_ASCLogQueueRequestSend() or after receiving an unsolicited ‘Statistics Available’ notification from the server.

You are required to provide a pointer to a location to receive a Transaction Sequence Number (TSN) for the message. The TSN in the response is set to match the TSN in the request, allowing an incoming response to be paired with a request. This is useful when sending more than one request to the same destination endpoint.

Parameters

  • u8SourceEndPointId Number of the local endpoint through which to send the message. This parameter is used both to send the message and to identify the instance of the shared structure holding the required attribute values

  • u8DestinationEndPointId Number of the endpoint on the remote node to which the message is sent. This parameter is ignored when sending to address types eZCL_AMBOUND and eZCL_AMGROUP

  • psDestinationAddress Pointer to a structure holding the address of the node to which the message is sent

  • pu8TransactionSequenceNumber Pointer to a location to receive the Transaction Sequence Number (TSN) of the message

  • psPayload Pointer toastructure containing the payload for the ‘Log Request’, including the relevant log ID (see Section 48.9.2)

Returns

  • E_ZCL_SUCCESS

  • E_ZCL_FAIL

  • E_ZCL_ERR_PARAMETER_NULL

  • E_ZCL_ERR_INVALID_VALUE

Parent topic:Functions

eCLD_ASCLogQueueResponseORStatisticsAvailableSend

teZCL_Status eCLD_ASCLogQueueResponseORStatisticsAvailableSend(
        uint8 u8SourceEndPointId,
        uint8 u8DestinationEndPointId,
        tsZCL_Address *psDestinationAddress,
        uint8 *pu8TransactionSequenceNumber,
        teCLD_ApplianceStatistics_ServerCommandId 
eCommandId);

Description

This function can be used on an Appliance Statistics cluster server to send a ‘Log Queue Response’ message (in reply to a ‘Log Queue Request’ message) or an unsolicited ‘Statistics Available’ message to a cluster client.

The command to be sent must be specified as one of:

  • E_CLD_APPLIANCE_STATISTICS_CMD_LOG_QUEUE_RESPONSE

  • E_CLD_APPLIANCE_STATISTICS_CMD_STATISTICS_AVAILABLE

You are required to provide a pointer to a location to receive a Transaction Sequence Number (TSN) for the message. The TSN in the response is set to match the TSN in the request, allowing an incoming response to be paired with a request. This is useful when sending more than one request to the same destination endpoint.

Parameters

  • u8SourceEndPointId Number of the local endpoint through which to send the message. This parameter is used both to send the message and to identify the instance of the shared structure holding the required attribute values

  • u8DestinationEndPointId Number of the endpoint on the remote node to which the message is sent. This parameter is ignored when sending to address types eZCL_AMBOUND and eZCL_AMGROUP

  • psDestinationAddress Pointer to a structure holding the address of the node to which the message is sent

  • pu8TransactionSequenceNumber Pointer to a location to receive the Transaction Sequence Number (TSN) of the message

  • eCommandId Enumeration indicating the command to be sent (see above and Section 48.8.3)

Returns

  • E_ZCL_SUCCESS

  • E_ZCL_FAIL

  • E_ZCL_ERR_PARAMETER_NULL

  • E_ZCL_ERR_INVALID_VALUE

Parent topic:Functions

eCLD_ASCStatisticsAvailableSend

teZCL_Status eCLD_ASCStatisticsAvailableSend(
        uint8 u8SourceEndPointId,
        uint8 u8DestinationEndPointId,
        tsZCL_Address *psDestinationAddress,
        uint8 *pu8TransactionSequenceNumber);

Description

This function can be used on an Appliance Statistics cluster server to send an unsolicited ‘Statistics Available’ message to a cluster client. The function is an alternative to eCLD_ASCLogQueueResponseORStatisticsAvailableSend().

You are required to provide a pointer to a location to receive a Transaction Sequence Number (TSN) for the message. The TSN in the response is set to match the TSN in the request, allowing an incoming response to be paired with a request. This is useful when sending more than one request to the same destination endpoint.

Parameters

  • u8SourceEndPointId Number of the local endpoint through which to send the message. This parameter is used both to send the message and to identify the instance of the shared structure holding the required attribute values

  • u8DestinationEndPointId Number of the endpoint on the remote node to which the message is sent. This parameter is ignored when sending to address types eZCL_AMBOUND and eZCL_AMGROUP

  • psDestinationAddress Pointer to a structure holding the address of the node to which the message is sent

  • pu8TransactionSequenceNumber Pointer to a location to receive the Transaction Sequence Number (TSN) of the message

Returns

  • E_ZCL_SUCCESS

  • E_ZCL_FAIL

  • E_ZCL_ERR_PARAMETER_NULL

  • E_ZCL_ERR_INVALID_VALUE

Parent topic:Functions

eCLD_ASCLogNotificationORLogResponseSend

teZCL_Status eCLD_ASCLogNotificationORLogResponseSend(
        uint8 u8SourceEndPointId,
        uint8 u8DestinationEndPointId,
        tsZCL_Address *psDestinationAddress,
        uint8 *pu8TransactionSequenceNumber,
        teCLD_ApplianceStatistics_ServerCommandId
eCommandId,
        tsCLD_ASC_LogNotificationORLogResponsePayload
*psPayload);

Description

This function can be used on an Appliance Statistics cluster server to send a ‘Log Response’ message (in reply to a ‘Log Request’ message) or an unsolicited ‘Log Notification’ message to a cluster client.

The command to be sent must be specified as one of:

  • E_CLD_APPLIANCE_STATISTICS_CMD_LOG_NOTIFICATION

  • E_CLD_APPLIANCE_STATISTICS_CMD_LOG_RESPONSE

You are required to provide a pointer to a location to receive a Transaction Sequence Number (TSN) for the message. The TSN in the response is set to match the TSN in the request, allowing an incoming response to be paired with a request. This is useful when sending more than one request to the same destination endpoint.

Parameters

  • u8SourceEndPointId Number of the local endpoint through which to send the message. This parameter is used both to send the message and to identify the instance of the shared structure holding the required attribute values

  • u8DestinationEndPointId Number of the endpoint on the remote node to which the message is sent. This parameter is ignored when sending to address types eZCL_AMBOUND and eZCL_AMGROUP

  • psDestinationAddress Pointer to a structure holding the address of the node to which the message is sent

  • pu8TransactionSequenceNumber Pointer to a location to receive the Transaction Sequence Number (TSN) of the message

  • eCommandId Enumeration indicating the command to be sent (see above and Section 48.8.3)

  • psPayload Pointer to structure containing payload for message (see Section 48.9.3)

Returns

  • E_ZCL_SUCCESS

  • E_ZCL_FAIL

  • E_ZCL_ERR_PARAMETER_NULL

  • E_ZCL_ERR_INVALID_VALUE

Parent topic:Functions

eCLD_ASCLogNotificationSend

teZCL_Status eCLD_ASCLogNotificationSend(
        uint8 u8SourceEndPointId,
        uint8 u8DestinationEndPointId,
        tsZCL_Address *psDestinationAddress,
        uint8 *pu8TransactionSequenceNumber,
        tsCLD_ASC_LogNotificationORLogResponsePayload
*psPayload);

Description

This function can be used on an Appliance Statistics cluster server to send an unsolicited ‘Log Notification’ message to a cluster client. The function is an alternative to eCLD_ASCLogNotificationORLogResponseSend().

You are required to provide a pointer to a location to receive a Transaction Sequence Number (TSN) for the message. The TSN in the response is set to match the TSN in the request, allowing an incoming response to be paired with a request. This is useful when sending more than one request to the same destination endpoint.

Parameters

  • u8SourceEndPointId Number of the local endpoint through which to send the message. This parameter is used both to send the message and to identify the instance of the shared structure holding the required attribute values

  • u8DestinationEndPointId Number of the endpoint on the remote node to which the message is sent. This parameter is ignored when sending to address types eZCL_AMBOUND and eZCL_AMGROUP

  • psDestinationAddress Pointer to a structure holding the address of the node to which the message is sent

  • pu8TransactionSequenceNumber Pointer to a location to receive the Transaction Sequence Number (TSN) of the message

  • psPayload Pointer to structure containing payload for message (see Section 48.9.3)

Returns

  • E_ZCL_SUCCESS

  • E_ZCL_FAIL

  • E_ZCL_ERR_PARAMETER_NULL

  • E_ZCL_ERR_INVALID_VALUE

Parent topic:Functions

Parent topic:Appliance Statistics Cluster