DRLC Events
The DRLC cluster has its own events that are handled through the callback mechanism described in Chapter 3. If a device uses the DRLC cluster then DRLC event handling must be included in the callback function for the associated endpoint - for example:
For an ESP (cluster server), this callback function is registered through eSE_RegisterEspMeterEndPoint() or eSE_RegisterEspEndPoint()
For an IPD (cluster client), this callback function is registered through eSE_RegisterIPDEndPoint()
The relevant callback function is then invoked when a DRLC event occurs.
For a DRLC 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 a tsSE_DRLCCallBackMessage structure which contains the DRLC parameters:
typedef struct
{
teSE_DRLCCallBackEventType eEventType;
uint8 u8CommandId;
teSE_DRLCStatus eDRLCStatus;
uint32 u32CurrentTime;
union {
tsSE_DRLCLoadControlEvent sLoadControlEvent;
tsSE_DRLCCancelLoadControlEvent sCancelLoadControlEvent;
tsSE_DRLCCancelLoadControlAllEvent sCancelLoadControlAllEvent;
tsSE_DRLCReportEvent sReportEvent;
tsSE_DRLCGetScheduledEvents sGetScheduledEvents;
} uMessage;
} tsSE_DRLCCallBackMessage;
Information on the elements of the above structure is provided in the sub-sections below.
Event and Command Types
The eEventType field of the tsSE_DRLCCallBackMessage structure above specifies the type of DRLC event that has been generated - these event types are enumerated in the teSE_DRLCCallBackEventType structure, described below.
Note: The u8CommandId field of the tsSE_DRLCCallBackMessage structure is only required for a DRLC event of type E_SE_DRLC_EVENT_COMMAND (see below).
typedef enum PACK
{
E_SE_DRLC_EVENT_API =0x00,
E_SE_DRLC_EVENT_COMMAND,
E_SE_DRLC_EVENT_ACTIVE,
E_SE_DRLC_EVENT_EXPIRED,
E_SE_DRLC_EVENT_CANCELLED,
E_SE_DRLC_EVENT_ENUM_END,
} teSE_DRLCCallBackEventType;
E_SE_DRLC_EVENT_API
The E_SE_DRLC_EVENT_API event is reserved for internal use.
E_SE_DRLC_EVENT_COMMAND
The E_SE_DRLC_EVENT_COMMAND event is generated when a command has been received on either the server or client. In the tsSE_DRLCCallBackMessage structure, the u8CommandId field is used to indicate the corresponding command - one of:
Command |
Description |
|---|---|
SE_DRLC_LOAD_CONTROL_EVENT |
Generated on a client when a new LCE has been received from the server and added to the ‘Scheduled’ (or ‘Active’) list - the LCE is included in the |
uMessage.LoadControlEvent field of the tsSE_DRLCCallBackMessage structure
| |SE_DRLC_LOAD_CONTROL_EVENT_CANCEL *|Generated on a client when a command has been received to cancel an LCE and the LCE has been moved to the ‘Cancelled’ or ‘ Deallocated’ list - which list depends on whether an immediate or randomized end-time is specified in the
uMessage.sCancelLoadControlEvent field of the tsSE_DRLCCallBackMessage structure
| |SE_DRLC_LOAD_CONTROL_EVENT_CANCEL_ALL *|Generated on a client when a command has been received to cancel all LCEs and the LCEs have been moved to the ‘Cancelled’ or ‘ Deallocated’ list - which list depends on whether an immediate or randomized end-time is specified in the
uMessage.sCancelLoadControlAllEvent field of the tsSE_DRLCCallBackMessage structure
|
|SE_DRLC_REPORT_EVENT_STATUS **|Generated on the server when a Report Event Status message is received from a client - the contents of the report are included in the uMessage.sReportEvent field of the tsSE_DRLCCallBackMessage structure|
|SE_DRLC_GET_SCHEDULED_EVENTS **|Generated on the server when a Get Scheduled Events message is received from a client - the contents of the request are included in the
uMessage.sGetScheduledEvents field of the tsSE_DRLCCallBackMessage structure
|
* If an LCE cancellation with a randomized end-time is required, the LCE is first moved to the ‘Cancelled’ list and the event is generated with randomized end-time specified. When the randomized end-time has been reached, the LCE is moved to the ‘Deallocated’ list and the event is generated again but with an immediate end-time specified. The application must then stop the corresponding load control.
** The server can identify which client has sent a Report Event Status or Get Scheduled Events message by examining the pZPSevent field of the tsZCL_CallBackEvent structure that contains the message.
E_SE_DRLC_EVENT_ACTIVE
The E_SE_DRLC_EVENT_ACTIVE event is generated when an LCE has been moved from the ‘Scheduled’ list to the ‘Active’ list (see Section 41.4.2). The activated LCE is included in the uMessage.LoadControlEvent field of the tsSE_DRLCCallBackMessage structure.
E_SE_DRLC_EVENT_EXPIRED
The E_SE_DRLC_EVENT_EXPIRED event is generated when an LCE has been moved from the ‘Active’ list (see Section 41.4.2). The expired LCE is included in the uMessage.LoadControlEvent field of the tsSE_DRLCCallBackMessage structure.
E_SE_DRLC_EVENT_CANCELLED
The E_SE_DRLC_EVENT_CANCELLED event is generated when an LCE has been put in the ‘Cancelled’ list (see Section 41.4.2) as the result of an LCE ‘cancel’ or ‘cancel all’ command. Information on the cancelled LCE(s) is included in the uMessage.sCancelLoadControlEvent or uMessage.sCancelLoadControlAllEvent field of the tsSE_DRLCCallBackMessage structure, as appropriate.
Parent topic:DRLC Events
Other Elements of tsSE_DRLCCallBackMessage
In addition to the fields eEventType and u8CommandId described in Section 41.7.1, the tsSE_DRLCCallBackMessage structure contains the following elements.
eDRLCStatus
The eDRLCStatus field indicates the status returned from the command that has been executed (the command identified in u8CommandId). The status codes are enumerated in the teSE_DRLCStatus structure, shown below and described in Section 41.9.
typedef enum PACK
{
E_SE_DRLC_DUPLICATE_EXISTS = 0x80,
E_SE_DRLC_EVENT_LATE,
E_SE_DRLC_EVENT_NOT_YET_ACTIVE,
E_SE_DRLC_EVENT_OLD,
E_SE_DRLC_NOT_FOUND,
E_SE_DRLC_EVENT_NOT_FOUND,
E_SE_DRLC_EVENT_IGNORED,
E_SE_DRLC_CANCEL_DEFERRED,
E_SE_DRLC_BAD_DEVICE_CLASS,
E_SE_DRLC_BAD_CRITICALITY_LEVEL,
E_SE_DRLC_DURATION_TOO_LONG,
E_SE_DRLC_ENUM_END
} teSE_DRLCStatus;
u32CurrentTime
The u32CurrentTime field contains the time (UTC) at which the event was generated.
uMessage
This field is a union of structures, containing a structure for each of the DRLC command payloads. The valid structure in the event is defined by the value of u8CommandId (refer to the description of the E_SE_DRLC_EVENT_COMMAND event in Section 41.7.1).
Parent topic:DRLC Events
Parent topic:Demand-Response and Load Control Cluster