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:

  • eEventType is the Simple Metering event type from those listed in Section42.10.7

  • u8CommandId is 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

  • uMessage is a union containing the command payload in one of the following forms (depending on the command specified in the field u8CommandId):

    • s``GetProfileResponseCommand is a structure containing the payload of a ‘Get Profile’ response - see Section 42.11.9

    • sRequestFastPollResponseCommand is a structure containing the payload of a ‘Fast Polling’ response (for future use)

    • sGetProfileCommand is a structure containing the payload of a ‘Get Profile’ request - see Section 42.11.8

    • sRequestMirrorResponseCommand is a structure containing the payload of an ‘Add Mirror’ response - see Section 42.11.6

    • sMirrorRemovedResponseCommand is a structure containing the payload of an ‘Remove Mirror’ response - see Section 42.11.7

    • sRequestFastPollCommand is a structure containing the payload of an ‘Fast Polling’ request (for future use)

    • sError is 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:

  • sEndPoint is a tsZCL_EndPointDefinition structure which contains details of the endpoint corresponding to the mirror (for details of this structure, refer to Section 6.1.1)

  • u64SourceAddress is 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 device

  • sSEMirrorClusterInstances is a tsSE_MirrorClusterInstances structure (see Section 42.11.3) which contains information on the Basic and Simple Metering cluster instances that are associated with the mirror endpoint

  • sSMMirrorCustomDataStruct is a tsSM_CustomStruct structure (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:

  • sBasicCluster is a tsZCL_ClusterInstance structure 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_Cluster is a tsZCL_ClusterInstance structure 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:

  • sReceiveEventAddress is a tsZCL_ReceiveEventAddress structure which contains addressing information relating to a received mirroring command/message

  • sSMCustomCallBackEvent is a tsZCL_CallBackEvent structure (see Section 3.1) which contains the event that has been generated as a result of the received command/message

  • sSMCallBackMessage is a tsSM_CallBackMessage structure (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:

  • u32UtcTime is the end-time of the consumption interval (as a UTC time)

  • u24ConsumptionReceived is the number of units received from the customer during the interval (for customers who generate and sell their own units)

  • u24ConsumptionDelivered is 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:

  • eIntervalChannel is a value indicating the required consumption data:

    • E_CLD_SM_CONSUMPTION_RECEIVED - units from customer

    • E_CLD_SM_CONSUMPTION_DELIVERED - units to customer

  • u8NumberOfPeriods is the number of consumption intervals for which data is being requested

  • u8SourceEndPoint is the number of the source endpoint of the request on the client

  • u8DestinationEndPoint is the number of the destination endpoint of the request on the server

  • u32EndTime is 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)

  • sSourceAddress is 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:

  • u32Endtime is the end-time of the consumption data that is being reported, as a UTC time

  • eStatus is the status of the response, represented by one of the enumerated values listed in Section 42.10.11

  • u8ProfileIntervalPeriod is 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.10

  • u8NumberOfPeriodsDelivered is the number of consumption intervals being reported

  • pau24Intervals is 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

  • u8Endpoint is the number of the endpoint from which the error is reported

  • u8Status is a value representing the nature of the error

Parent topic:Structures

Parent topic:Simple Metering Cluster