Structures
tsSM_CallBackMessage
For a Simple Metering event, the eEventType field of the tsZCL_CallBackEvent structure is set to E_ZCL_CBET_CLUSTER_CUSTOM. This event structure also contains an element sClusterCustomMessage, which is itself a structure containing a field pvCustomData. This field is a pointer to the following tsSM_CallBackMessage structure which contains the Simple Metering parameters:
typedef struct
{
teSM_CallBackEventType eEventType;
uint8 u8CommandId;
union
{
tsSM_GetProfileResponseCommand sGetProfileResponseCommand;
tsSM_RequestFastPollResponseCommand sRequestFastPollResponseCommand;
tsSM_GetProfileRequestCommand sGetProfileCommand;
tsSM_RequestMirrorResponseCommand sRequestMirrorResponseCommand;
tsSM_MirrorRemovedResponseCommand sMirrorRemovedResponseCommand;
tsSM_RequestFastPollCommand sRequestFastPollCommand;
tsSM_Error sError;
}uMessage;
}tsSM_CallBackMessage;
where:
eEventTypeis the Simple Metering event type from those listed in Section42.10.7u8CommandIdis the identifier of the type of Simple Metering command received. This field is only valid for the following Simple Metering event types:E_CLD_SM_CLIENT_RECEIVED_COMMAND - enumerated commands are provided, as described in Section 42.10.8
E_CLD_SM_SERVER_RECEIVED_COMMAND - enumerated commands are provided, as described in Section 42.10.9
uMessageis a union containing the command payload in one of the following forms (depending on the command specified in the fieldu8CommandId):s``GetProfileResponseCommandis a structure containing the payload of a ‘Get Profile’ response - see Section 42.11.9sRequestFastPollResponseCommandis a structure containing the payload of a ‘Fast Polling’ response (for future use)sGetProfileCommandis a structure containing the payload of a ‘Get Profile’ request - see Section 42.11.8sRequestMirrorResponseCommandis a structure containing the payload of an ‘Add Mirror’ response - see Section 42.11.6sMirrorRemovedResponseCommandis a structure containing the payload of an ‘Remove Mirror’ response - see Section 42.11.7sRequestFastPollCommandis a structure containing the payload of an ‘Fast Polling’ request (for future use)sErroris a structure containing the details of an error condition - see Section 42.11.10
Parent topic:Structures
tsSE_Mirror
Details of the mirror endpoints on the ESP are kept in an array of structures of the type tsSE_Mirror (one structure per endpoint) within the tsSE_EspMeterDevice structure. The tsSE_Mirror structure is shown and described below.
Note: This structure is only for use by the ZCL and should not be modified by the application.
typedef struct
{
/*Mirrored EndPoint*/
tsZCL_EndPointDefinition sEndPoint;
/*Mirror Requester address*/
uint64 u64SourceAddress;
/*Mirror cluster instances*/
tsSE_MirrorClusterInstances sSEMirrorClusterInstances;
/*Event Address, Custom callback event, Custom callback message*/
tsSM_CustomStruct sSMMirrorCustomDataStruct;
}tsSE_Mirror;
where:
sEndPointis atsZCL_EndPointDefinitionstructure which contains details of the endpoint corresponding to the mirror (for details of this structure, refer to Section 6.1.1)u64SourceAddressis the 64-bit IEEE address of the Metering Device to which the mirror endpoint is assigned - a zero value indicates that the mirror endpoint is not currently assigned to a devicesSEMirrorClusterInstancesis atsSE_MirrorClusterInstancesstructure (see Section 42.11.3) which contains information on the Basic and Simple Metering cluster instances that are associated with the mirror endpointsSMMirrorCustomDataStructis atsSM_CustomStructstructure (see Section 42.11.4) which contains data relating to a received command/message for the mirror endpoint
Parent topic:Structures
tsSE_MirrorClusterInstances
This structure contains information on the Basic and Simple Metering cluster instances that are associated with a mirror endpoint.
Note: This structure is only for use by the ZCL and should not be modified by the application.
typedef struct
{
/*Basic Cluster Instance*/
tsZCL_ClusterInstance sBasicCluster;
/* SM Cluster Instance */
tsZCL_ClusterInstance sSM_Cluster;
}tsSE_MirrorClusterInstances;
where:
sBasicClusteris atsZCL_ClusterInstancestructure which contains information on the Basic cluster instance associated with a mirror endpoint (for details of this structure, refer to Section 6.1.16)sSM_Clusteris atsZCL_ClusterInstancestructure which contains information on the Simple Metering cluster instance associated with a mirror endpoint (for details of this structure, refer to Section 6.1.16)
Parent topic:Structures
tsSM_CustomStruct
This structure contains data relating to a command/message for a mirror endpoint.
Note: This structure is only for use by the ZCL software and should not be modified by the application.
typedef struct
{
tsZCL_ReceiveEventAddress sReceiveEventAddress;
tsZCL_CallBackEvent sSMCustomCallBackEvent;
tsSM_CallBackMessage sSMCallBackMessage;
} tsSM_CustomStruct;
where:
sReceiveEventAddressis atsZCL_ReceiveEventAddressstructure which contains addressing information relating to a received mirroring command/messagesSMCustomCallBackEventis atsZCL_CallBackEventstructure (see Section 3.1) which contains the event that has been generated as a result of the received command/messagesSMCallBackMessageis atsSM_CallBackMessagestructure (see Section42.11.1) which contains details of the event and the command/message that caused the event
Parent topic:Structures
tsSEGetProfile
This structure is used to store historical consumption data when the ‘Get Profile’ feature is enabled. The data within the structure corresponds to a single consumption interval.
typedef struct
{
uint32 u32UtcTime;
zuint24 u24ConsumptionReceived;
zuint24 u24ConsumptionDelivered;
}tsSEGetProfile;
where:
u32UtcTimeis the end-time of the consumption interval (as a UTC time)u24ConsumptionReceivedis the number of units received from the customer during the interval (for customers who generate and sell their own units)u24ConsumptionDeliveredis the number of units delivered to the customer during the interval
Parent topic:Structures
tsSM_RequestMirrorResponseCommand
This structure contains the details of an ‘Add Mirror’ response (from a cluster client). It is included in the structure tsSM_CallBackMessage when an E_CLD_SM_SERVER_RECEIVED_COMMAND event containing the command E_CLD_SM_REQUEST_MIRROR_RESPONSE is generated on the cluster server.
typedef struct
{
uint16 u16Endpoint;
}tsSM_RequestMirrorResponseCommand;
where u16Endpoint is the number of the endpoint on which the mirror was successfully added or takes the value 0xFFFF if the request failed because no free endpoint was available for the mirror.
Parent topic:Structures
tsSM_MirrorRemovedResponseCommand
This structure contains the details of a ‘Remove Mirror’ response (from a cluster client). It is included in the structure tsSM_CallBackMessage when an E_CLD_SM_SERVER_RECEIVED_COMMAND event containing the command E_CLD_SM_MIRROR_REMOVED is generated on the cluster server.
typedef struct
{
uint16 u16Endpoint;
}tsSM_MirrorRemovedResponseCommand;
where u16Endpoint is the number of the endpoint from which the mirror was successfully removed, or takes the value 0xFFFF if the remove request failed.
Parent topic:Structures
tsSM_GetProfileRequestCommand
This stucture contains the details of a ‘Get Profile’ request (from a cluster client). It is included in the structure tsSM_CallBackMessage when an E_CLD_SM_SERVER_RECEIVED_COMMAND event containing the command E_CLD_SM_GET_PROFILE is generated on the cluster server.
typedef struct
{
teSM_IntervalChannel eIntervalChannel;
uint8 u8NumberOfPeriods;
uint8 u8SourceEndPoint;
uint8 u8DestinationEndPoint;
uint32 u32EndTime;
tsZCL_Address sSourceAddress;
}tsSM_GetProfileRequestCommand;
where:
eIntervalChannelis a value indicating the required consumption data:E_CLD_SM_CONSUMPTION_RECEIVED - units from customer
E_CLD_SM_CONSUMPTION_DELIVERED - units to customer
u8NumberOfPeriodsis the number of consumption intervals for which data is being requestedu8SourceEndPointis the number of the source endpoint of the request on the clientu8DestinationEndPointis the number of the destination endpoint of the request on the serveru32EndTimeis the end-time for which consumption data is being requested - the most recent consumption data will be reported which has an end-time equal to or earlier than this end-time (a zero value will result in the most recent consumption data)sSourceAddressis a structure containing the source address of the request - that is, the address of the requesting client (the structure is described in Section 6.1.4)
Parent topic:Structures
tsSM_GetProfileResponseCommand
This stucture contains the details of a ‘Get Profile’ response (from the cluster server). It is included in the structure tsSM_CallBackMessage when an E_CLD_SM_CLIENT_RECEIVED_COMMAND event containing the command E_CLD_SM_GET_PROFILE_RESPONSE is generated on the cluster server.
typedef struct
{
uint32 u32Endtime;
teSM_Status eStatus;
teSM_TimeFrame u8ProfileIntervalPeriod;
uint8 u8NumberOfPeriodsDelivered;
zuint24 *pau24Intervals;
}tsSM_GetProfileResponseCommand;
where:
u32Endtimeis the end-time of the consumption data that is being reported, as a UTC timeeStatusis the status of the response, represented by one of the enumerated values listed in Section 42.10.11u8ProfileIntervalPeriodis the time-interval (consumption interval) over which each set of consumption data is collected - one of the standard enumerated values listed in Section 42.10.10u8NumberOfPeriodsDeliveredis the number of consumption intervals being reportedpau24Intervalsis a pointer to the consumption data being reported
Parent topic:Structures
tsSM_Error
This stucture contains the details of an error response (from cluster server or client). It is included in the structure tsSM_CallBackMessage when an E_CLD_SM_SERVER_RECEIVED_COMMAND event is generated containing the command E_CLD_SM_SERVER_ERROR on a client or E_CLD_SM_CLIENT_ERROR on the server.
typedef struct
{
uint8 u8Endpoint;
uint8 u8Status;
}tsSM_Error;
where
u8Endpointis the number of the endpoint from which the error is reportedu8Statusis a value representing the nature of the error
Parent topic:Structures
Parent topic:Simple Metering Cluster