nRF5 SDK for Thread and Zigbee v1.0.0
Data Structures | Macros | Typedefs | Enumerations
ZLL additions to On/Off cluster.

Data Structures

struct  zb_zcl_on_off_off_with_effect_req_s
 Structured representsation of Off with effect command payload. More...
 
struct  zb_zcl_on_off_on_with_timed_off_req_s
 Structured representsation of On with timed off command payload. More...
 
struct  zb_zcl_on_off_set_effect_value_param_s
 Declare run Set Effect command for User Application. More...
 
struct  zb_zll_on_off_effect_user_app_schedule_e
 

Macros

#define ZB_ZCL_ON_OFF_SEND_OFF_WITH_EFFECT_REQ(buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, dis_default_resp, effect_id, effect_var, cb)
 
#define ZB_ZCL_ON_OFF_SEND_ZB_ZCL_ON_OFF_ON_WITH_RECALL_GLOBAL_SCENE_REQ(buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, dis_default_resp, cb)
 
#define ZB_ZCL_ON_OFF_SEND_ON_WITH_TIMED_OFF_REQ(buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, dis_default_resp, on_off, on_time, off_wait_time, cb)
 
#define ZB_ZCL_ON_OFF_ACCEPT_ONLY_WHEN_ON   1
 
#define ZB_ZCL_ON_OFF_GET_OFF_WITH_EFFECT_REQ(data_ptr, buffer, status)
 Parses ZLL OnOff with Effect command. More...
 
#define ZB_ZCL_ON_OFF_GET_ON_WITH_TIMED_OFF_REQ(data_ptr, buffer, status)
 Parses ZLL On with timed off command. More...
 

Typedefs

typedef struct
zb_zcl_on_off_off_with_effect_req_s 
zb_zcl_on_off_off_with_effect_req_t
 Structured representsation of Off with effect command payload.
 
typedef struct
zb_zcl_on_off_on_with_timed_off_req_s 
zb_zcl_on_off_on_with_timed_off_req_t
 Structured representsation of On with timed off command payload.
 

Enumerations

enum  zb_zcl_on_off_cmd_zll_e { ZB_ZCL_ON_OFF_OFF_WITH_EFFECT_ID = 0x40, ZB_ZCL_ON_OFF_ON_WITH_RECALL_GLOBAL_SCENE_ID = 0x41, ZB_ZCL_ON_OFF_ON_WITH_TIMED_OFF_ID = 0x42 }
 On/Off cluster extended command identifiers. More...
 
enum  zb_zcl_on_off_effect_e { ZB_ZCL_ON_OFF_EFFECT_ID_DELAYED_ALL_OFF = 0x00, ZB_ZCL_ON_OFF_EFFECT_ID_DYING_LIGHT = 0x01 }
 
enum  zb_zcl_on_off_effect_variant_delayed_e { ZB_ZCL_ON_OFF_EFFECT_VARIANT_FADE = 0x00, ZB_ZCL_ON_OFF_EFFECT_VARIANT_NO_FADE = 0x01, ZB_ZCL_ON_OFF_EFFECT_VARIANT_50PART_FADE = 0x02 }
 
enum  zb_zcl_on_off_effect_variant_dying_e { ZB_ZCL_ON_OFF_EFFECT_VARIANT_20PART_FADE = 0x00 }
 

Attributes added to On/Off cluster.

enum  zb_zcl_on_off_attr_zll_e { ZB_ZCL_ATTR_ON_OFF_GLOBAL_SCENE_CONTROL_ZLL_ID = 0x4000, ZB_ZCL_ATTR_ON_OFF_ON_TIME_ZLL_ID = 0x4001, ZB_ZCL_ATTR_ON_OFF_OFF_WAIT_TIME_ZLL_ID = 0x4002 }
 On/Off cluster extended attributes identifiers. More...
 

ZLL On/Off cluster additions internals.

Internal structures for attribute representation in cluster additions.

#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ON_OFF_GLOBAL_SCENE_CONTROL_ZLL_ID(data_ptr)
 
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ON_OFF_ON_TIME_ZLL_ID(data_ptr)
 
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ON_OFF_OFF_WAIT_TIME_ZLL_ID(data_ptr)
 
#define ZB_ZCL_DECLARE_ON_OFF_ATTRIB_LIST_ZLL(attr_list, on_off, global_scene_ctrl, on_time, off_wait_time)
 Declare attribute list for On/Off cluster with ZLL additions. Each attribute type corresponds to attribute description in ZLL specification (Zigbee Light Link Profile Specification Version 1.0, chapter 6.6 On/off cluster). More...
 

Inform User App about ZLL On/Off cluster command and change attributes.

Internal structures and define-procedure for inform User App about ZLL On/Off cluster command and change attributes.

typedef struct
zb_zcl_on_off_set_effect_value_param_s 
zb_zcl_on_off_set_effect_value_param_t
 Declare run Set Effect command for User Application.
 
typedef struct
zb_zll_on_off_effect_user_app_schedule_e 
zb_zll_on_off_effect_user_app_schedule_t
 
#define ZB_ZLL_ON_OFF_EFFECT_SCHEDULE_USER_APP(buffer, pcmd_info, effectId, effectVar)
 

Detailed Description

ZLL additions to On/Off cluster.

Extended On/Off cluster for Light Link (see spec 6.6.1).

Example
Declare cluster:
//* On/Off cluster attributes data */
zb_uint8_t g_attr_on_off = ZB_ZCL_ON_OFF_ON_OFF_DEFAULT_VALUE;
/* On/Off cluster attributes additions data */
zb_bool_t g_attr_global_scene_ctrl = ZB_TRUE;
zb_uint16_t g_attr_on_time = 0;
zb_uint16_t g_attr_off_wait_time = 0;
ZB_ZCL_DECLARE_ON_OFF_ATTRIB_LIST_ZLL(on_off_attr_list, &g_attr_on_off,
&g_attr_global_scene_ctrl, &g_attr_on_time, &g_attr_off_wait_time);
Toggle command sending:
ZB_ZCL_ON_OFF_SEND_TOGGLE_REQ(buffer, DST_ADDR, DST_ADDR_MODE, DST_ENDPOINT,
ENDPOINT, ZB_AF_ZLL_PROFILE_ID, ZB_FALSE, NULL);
On with recall global scene command sending:
ZB_ZCL_ON_OFF_SEND_ZB_ZCL_ON_OFF_ON_WITH_RECALL_GLOBAL_SCENE_REQ(buffer, DST_ADDR, DST_ADDR_MODE, DST_ENDPOINT,
ENDPOINT, ZB_AF_ZLL_PROFILE_ID, ZB_FALSE, NULL);

Other commands can be sent in the same way using appropriate macros.

For more information tp_cst_02, tp_cst_03 tests

Macro Definition Documentation

#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ON_OFF_GLOBAL_SCENE_CONTROL_ZLL_ID (   data_ptr)
Value:
{ \
ZB_ZCL_ATTR_ON_OFF_GLOBAL_SCENE_CONTROL_ZLL_ID, \
ZB_ZCL_ATTR_TYPE_BOOL, \
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
(zb_voidp_t) data_ptr \
}
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ON_OFF_OFF_WAIT_TIME_ZLL_ID (   data_ptr)
Value:
{ \
ZB_ZCL_ATTR_ON_OFF_OFF_WAIT_TIME_ZLL_ID, \
ZB_ZCL_ATTR_TYPE_U16, \
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
(zb_voidp_t) data_ptr \
}
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ON_OFF_ON_TIME_ZLL_ID (   data_ptr)
Value:
{ \
ZB_ZCL_ATTR_ON_OFF_ON_TIME_ZLL_ID, \
ZB_ZCL_ATTR_TYPE_U16, \
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
(zb_voidp_t) data_ptr \
}
#define ZB_ZCL_DECLARE_ON_OFF_ATTRIB_LIST_ZLL (   attr_list,
  on_off,
  global_scene_ctrl,
  on_time,
  off_wait_time 
)
Value:
ZB_ZCL_START_DECLARE_ATTRIB_LIST(attr_list) \
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ON_OFF_ON_OFF_ID, (on_off)) \
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ON_OFF_GLOBAL_SCENE_CONTROL_ZLL_ID, (global_scene_ctrl)) \
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ON_OFF_ON_TIME_ZLL_ID, (on_time)) \
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ON_OFF_OFF_WAIT_TIME_ZLL_ID, (off_wait_time)) \
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST

Declare attribute list for On/Off cluster with ZLL additions. Each attribute type corresponds to attribute description in ZLL specification (Zigbee Light Link Profile Specification Version 1.0, chapter 6.6 On/off cluster).

Parameters
attr_list[IN] - attribute list name being declared by this macro.
on_off[IN] - pointer to a boolean variable storing on/off attribute value.
global_scene_ctrl[IN] - pointer to a boolean variable storing global scene control attribute value.
on_time[IN] - pointer to a unsigned 16-bit integer variable storing on time attribute value.
off_wait_time[IN] - pointer to a unsigned 16-bit integer variable storing off wait time attribute value.
#define ZB_ZCL_ON_OFF_ACCEPT_ONLY_WHEN_ON   1

Accept only when on

See Also
ZLL spec 6.6.1.4.6.1
#define ZB_ZCL_ON_OFF_GET_OFF_WITH_EFFECT_REQ (   data_ptr,
  buffer,
  status 
)
Value:
{ \
if (ZB_BUF_LEN((buffer)) != sizeof(zb_zcl_on_off_off_with_effect_req_t)) \
{ \
} \
else \
{ \
ZB_MEMCPY((data_ptr), src_ptr, sizeof(zb_zcl_on_off_off_with_effect_req_t)); \
} \
}

Parses ZLL OnOff with Effect command.

Attention
Assumes that ZCL header already cut.
Parameters
data_ptr- pointer to a variable of type zb_zcl_on_off_off_with_effect_req_s.
buffercontaining the packet (by pointer).
status- variable to put parse status to (see zb_zcl_parse_status_t).
#define ZB_ZCL_ON_OFF_GET_ON_WITH_TIMED_OFF_REQ (   data_ptr,
  buffer,
  status 
)
Value:
{ \
if (ZB_BUF_LEN((buffer)) != sizeof(zb_zcl_on_off_off_with_effect_req_t)) \
{ \
} \
else \
{ \
(data_ptr)->on_off = src_ptr->on_off; \
ZB_LETOH16(&((data_ptr)->on_time), &(src_ptr->on_time)); \
ZB_LETOH16(&((data_ptr)->off_wait_time), &(src_ptr->off_wait_time)); \
} \
}

Parses ZLL On with timed off command.

Attention
Assumes that ZCL header already cut.
Parameters
data_ptr- pointer to a variable of type zb_zcl_on_off_on_with_timed_off_req_s.
buffercontaining the packet (by pointer).
status- variable to put parse status to (see zb_zcl_parse_status_t).
#define ZB_ZCL_ON_OFF_SEND_OFF_WITH_EFFECT_REQ (   buffer,
  addr,
  dst_addr_mode,
  dst_ep,
  ep,
  prof_id,
  dis_default_resp,
  effect_id,
  effect_var,
  cb 
)
Value:
{ \
zb_uint8_t* ptr = ZB_ZCL_START_PACKET(buffer); \
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, dis_default_resp); \
ZB_ZCL_CONSTRUCT_COMMAND_HEADER(ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_ON_OFF_OFF_WITH_EFFECT_ID); \
ZB_ZCL_PACKET_PUT_DATA8(ptr, effect_id); \
ZB_ZCL_PACKET_PUT_DATA8(ptr, effect_var); \
ZB_ZCL_FINISH_PACKET(buffer, ptr); \
ZB_ZCL_SEND_COMMAND_SHORT(buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, ZB_ZCL_CLUSTER_ID_ON_OFF, cb); \
}

Specific macro for sending Off with effect command

#define ZB_ZCL_ON_OFF_SEND_ON_WITH_TIMED_OFF_REQ (   buffer,
  addr,
  dst_addr_mode,
  dst_ep,
  ep,
  prof_id,
  dis_default_resp,
  on_off,
  on_time,
  off_wait_time,
  cb 
)
Value:
{ \
zb_uint8_t* ptr = ZB_ZCL_START_PACKET(buffer); \
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, dis_default_resp); \
ZB_ZCL_CONSTRUCT_COMMAND_HEADER(ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_ON_OFF_OFF_WITH_EFFECT_ID); \
ZB_ZCL_PACKET_PUT_DATA8(ptr, on_off); \
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, on_time); \
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, off_wait_time); \
ZB_ZCL_FINISH_PACKET(buffer, ptr); \
ZB_ZCL_SEND_COMMAND_SHORT(buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, ZB_ZCL_CLUSTER_ID_ON_OFF, cb); \
}

Specific macro for sending On with timed off command

#define ZB_ZCL_ON_OFF_SEND_ZB_ZCL_ON_OFF_ON_WITH_RECALL_GLOBAL_SCENE_REQ (   buffer,
  addr,
  dst_addr_mode,
  dst_ep,
  ep,
  prof_id,
  dis_default_resp,
  cb 
)
Value:
ZB_ZCL_ON_OFF_SEND_REQ(buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, dis_default_resp, \

Specific macro for sending On with recall global scene command

#define ZB_ZLL_ON_OFF_EFFECT_SCHEDULE_USER_APP (   buffer,
  pcmd_info,
  effectId,
  effectVar 
)
Value:
{ \
ZB_GET_BUF_PARAM((buffer), zb_zll_on_off_effect_user_app_schedule_t); \
ZB_MEMMOVE(&(user_data->cmd_info), (pcmd_info), sizeof(zb_zcl_parsed_hdr_t)); \
user_data->param.effect_id = (effectId); \
user_data->param.effect_variant = (effectVar); \
ZB_SCHEDULE_CALLBACK(zb_zcl_on_off_effect_invoke_user_app, ZB_REF_FROM_BUF((buffer))); \
}

Typedef Documentation

Struct for invoke User App & continue after

Enumeration Type Documentation

On/Off cluster extended attributes identifiers.

See Also
ZLL specification, subclause 6.6.1.2
Enumerator
ZB_ZCL_ATTR_ON_OFF_GLOBAL_SCENE_CONTROL_ZLL_ID 

"Global Scene Control" attribute identifier.

ZB_ZCL_ATTR_ON_OFF_ON_TIME_ZLL_ID 

"On Time" attribute identifier.

ZB_ZCL_ATTR_ON_OFF_OFF_WAIT_TIME_ZLL_ID 

"Off Wait Time" attribute identifier.

On/Off cluster extended command identifiers.

See Also
ZLL specification, subclause 6.6.1.4
Enumerator
ZB_ZCL_ON_OFF_OFF_WITH_EFFECT_ID 

"Off with effect Mandatory" command identifier.

ZB_ZCL_ON_OFF_ON_WITH_RECALL_GLOBAL_SCENE_ID 

"On with recall global scene" command identifier.

ZB_ZCL_ON_OFF_ON_WITH_TIMED_OFF_ID 

"On with timed off" command identifier.

Effect identifier enum

See Also
ZLL spec 6.6.1.4.4.1
Enumerator
ZB_ZCL_ON_OFF_EFFECT_ID_DELAYED_ALL_OFF 

Effect identifier field value: Delayed all off Effect identifier field value: Dying light

Effect variant field for delayed enum

See Also
ZLL spec 6.6.1.4.4.2
Enumerator
ZB_ZCL_ON_OFF_EFFECT_VARIANT_FADE 

Effect variant field value: Fade to off in 0.8 seconds Effect variant field value: No fade

ZB_ZCL_ON_OFF_EFFECT_VARIANT_NO_FADE 

Effect variant field value: 50% dim down in 0.8 seconds then fade to off in 12 seconds

Effect variant field for delayed enum

See Also
ZLL spec 6.6.1.4.4.2
Enumerator
ZB_ZCL_ON_OFF_EFFECT_VARIANT_20PART_FADE 

Effect variant field value: 20% dim up in 0.5s then fade to off in 1 second


Documentation feedback | Developer Zone | Subscribe | Updated