Functions
The following Thermostat cluster functions are provided:
Function Page
eCLD_ThermostatCreateThermostat
teZCL_Status eCLD_ThermostatCreateThermostat(
tsZCL_ClusterInstance *psClusterInstance,
bool_t bIsServer,
sZCL_ClusterDefinition *psClusterDefinition,
void *pvEndPointSharedStructPtr,
uint8 *pu8AttributeControlBits,
tsCLD_ThermostatCustomDataStructure
psCustomDataStructure);
Description
This function creates an instance of the Thermostat 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 a Thermostat cluster instance on the endpoint, but instances of other clusters may also be created on the same endpoint by calling their corresponding creation functions.
Note: This function must not be called for an endpoint on which a standard ZigBee device (e.g. the Thermostat device) will be used. In this case, the device and its supported clusters must be registered on the endpoint using the relevant device registration function.
When used, this function must be the first Thermostat 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 should therefore equate to the total number of attributes supported by the Thermostat cluster.
The function initializes the array elements to zero.
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 Section 6.1.2). In this case, this structure must contain the details of the Thermostat cluster. This parameter can refer to a pre-filled structure called
sCLD_``Thermostat
which is provided in the Thermostat.h file.pvEndPointSharedStructPtr Pointer to the shared structure used for attribute storage. This parameter should be the address of the structure of type
tsCLD_``Thermostat
which defines the attributes of Thermostat 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).
Returns
E_ZCL_SUCCESS
E_ZCL_FAIL
E_ZCL_ERR_PARAMETER_NULL
E_ZCL_ERR_INVALID_VALUE
Parent topic:Functions
eCLD_ThermostatSetAttribute
teZCL_Status eCLD_ThermostatSetAttribute(
uint8 u8SourceEndPointId,
uint8 u8AttributeId,
int16 i16AttributeValue);
Description
This function can be used on a Thermostat cluster server to update the Thermostat attributes - specifically to write a value to one of the following attributes:
i16LocalTemperature
i16OccupiedCoolingSetpoint
i16OccupiedHeatingSetpoint
The function first checks whether the value to be written falls within the valid range for the relevant attribute. If not, it returns with status E_ZCL_ERR_INVALID_VALUE. If the server attempts to write to an attribute other than those specified above, the function returns with status E_ZCL_DENY_ATTRIBUTE_ACCESS. If the cluster does not exist, it returns with status E_ZCL_ERR_CLUSTER_NOT_FOUND.
Parameters
u8SourceEndPointId Number of the endpoint on which the Thermostat cluster resides
u8AttributeId Identifier of attribute to be updated, one of:
E_CLD_THERMOSTAT_ATTR_ID_LOCAL_TEMPERATURE
E_CLD_THERMOSTAT_ATTR_ID_OCCUPIED_COOLING_SETPOINT
E_CLD_THERMOSTAT_ATTR_ID_OCCUPIED_HEATING_SETPOINT
i16AttributeValue Value to be written to attribute
Returns
E_ZCL_SUCCESS
E_ZCL_ERR_INVALID_VALUE
E_ZCL_DENY_ATTRIBUTE_ACCESS
E_ZCL_ERR_CLUSTER_NOT_FOUND
Parent topic:Functions
eCLD_ThermostatStartReportingLocalTemperature
teZCL_Status eCLD_ThermostatStartReportingLocalTemperature(
uint8 u8SourceEndPointId,
uint8 u8DstEndPointId,
uint64 u64DstAddr,
uint16 u16MinReportInterval,
uint16 u16MaxReportInterval,
int16 i16ReportableChange);
Description
This function can be used on a Thermostat cluster server to start automatic reporting of the measured local temperature to a cluster client. The change to be reported can be configured through this function. Reports is sent regularly (but not periodically), within the specified maximum and minimum time-intervals between consecutive reports.
Parameters
u8SourceEndPointId Number of the local endpoint on which the Thermostat cluster server resides
u8DstEndPointId Number of the endpoint to which reports are to be sent on the destination node
u64DstAddr IEEE/MAC address of destination node
u16MinReportInterval Minimum time-interval, in seconds, between reports
u16MaxReportInterval Maximum time-interval, in seconds, between reports
i16ReportableChange Specifies the change to be reported
Returns
E_ZCL_SUCCESS
E_ZCL_FAIL
E_ZCL_ERR_CLUSTER_NOT_FOUND
Parent topic:Functions
eCLD_ThermostatCommandSetpointRaiseOrLowerSend
teZCL_Status eCLD_ThermostatCommandSetpointRaiseOrLowerSend(
uint8 u8SourceEndPointId,
uint8 u8DestinationEndPointId,
tsZCL_Address *psDestinationAddress,
uint8 *pu8TransactionSequenceNumber,
tsCLD_Thermostat_SetpointRaiseOrLowerPayload
*psPayload);
Description
This function can be used on a Thermostat cluster client to send a ‘Setpoint Raise Or Lower’ command to the cluster server. This command is used to increase or decrease the heating setpoint and/or cooling setpoint by requesting a change to the values of the attribute i16OccupiedHeatingSetpoint
and/or the attribute i16OccupiedCoolingSetpoint
. The relevant setpoint(s) and the required temperature change are specified in the command payload structure tsCLD_Thermostat_SetpointRaiseOrLowerPayload
(see Section 33.9.3).
A pointer must be specified to a location to receive a Transaction Sequence Number (TSN) for the request. The TSN in the response is set to match the TSN in the request, allowing an incoming response to be paired with a request.
Parameters
u8SourceEndPointId Number of the local endpoint through which the request is sent
u8DestinationEndPointId Number of the remote endpoint to which the request is sent
psDestinationAddress Pointer to a structure containing the address of the remote node to which the request is sent
pu8TransactionSequenceNumber Pointer to a location to store the Transaction Sequence Number (TSN) of the request
psPayload Pointer to the command payload (see Section33.9.3)
Returns
E_ZCL_SUCCESS
E_ZCL_ERR_PARAMETER_NULL
E_ZCL_ERR_EP_RANGE
E_ZCL_ERR_EP_UNKNOWN
E_ZCL_ERR_CLUSTER_NOT_FOUND
E_ZCL_ERR_ZBUFFER_FAIL
E_ZCL_ERR_ZTRANSMIT_FAIL
Parent topic:Functions
Parent topic:Thermostat Cluster