nRF5 SDK for Thread and Zigbee v2.0.0
Data Structures
ZCL 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_zcl_on_off_effect_user_app_schedule_e
 

On/Off cluster attributes

enum  zb_zcl_on_off_attr_e {
  ZB_ZCL_ATTR_ON_OFF_ON_OFF_ID = 0, ZB_ZCL_ATTR_ON_OFF_GLOBAL_SCENE_CONTROL = 0x4000, ZB_ZCL_ATTR_ON_OFF_ON_TIME = 0x4001, ZB_ZCL_ATTR_ON_OFF_OFF_WAIT_TIME = 0x4002,
  ZB_ZCL_ATTR_ON_OFF_START_UP_ON_OFF = 0x4003
}
 On/Off cluster attribute identifiers. More...
 
enum  zb_zcl_on_off_on_off_e { ZB_ZCL_ON_OFF_IS_OFF = 0, ZB_ZCL_ON_OFF_IS_ON = 1 }
 Permissible values for OnOff attribute. More...
 
#define ZB_ZCL_ON_OFF_ON_OFF_DEFAULT_VALUE   (ZB_ZCL_ON_OFF_IS_OFF)
 Default value for OnOff attribute.
 
#define ZB_ZCL_ON_OFF_GLOBAL_SCENE_CONTROL_DEFAULT_VALUE   ((zb_bool_t)0x01)
 Default value for GlobalSceneControl attribute.
 
#define ZB_ZCL_ON_OFF_ON_TIME_DEFAULT_VALUE   ((zb_uint16_t)0x0000)
 Default value for OnTime attribute.
 
#define ZB_ZCL_ON_OFF_OFF_WAIT_TIME_DEFAULT_VALUE   ((zb_uint16_t)0x0000)
 Default value for OffWaitTime attribute.
 

On/Off cluster commands

enum  zb_zcl_on_off_cmd_e {
  ZB_ZCL_CMD_ON_OFF_OFF_ID = 0x00, ZB_ZCL_CMD_ON_OFF_ON_ID = 0x01, ZB_ZCL_CMD_ON_OFF_TOGGLE_ID = 0x02, ZB_ZCL_CMD_ON_OFF_OFF_WITH_EFFECT_ID = 0x40,
  ZB_ZCL_CMD_ON_OFF_ON_WITH_RECALL_GLOBAL_SCENE_ID = 0x41, ZB_ZCL_CMD_ON_OFF_ON_WITH_TIMED_OFF_ID = 0x42
}
 On/Off cluster 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 }
 
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.
 
#define ZB_ZCL_CLUSTER_ID_ON_OFF_SERVER_ROLE_GENERATED_CMD_LIST
 
#define ZB_ZCL_CLUSTER_ID_ON_OFF_CLIENT_ROLE_RECEIVED_CMD_LIST   ZB_ZCL_CLUSTER_ID_ON_OFF_SERVER_ROLE_GENERATED_CMD_LIST
 
#define ZB_ZCL_CLUSTER_ID_ON_OFF_CLIENT_ROLE_GENERATED_CMD_LIST
 
#define ZB_ZCL_CLUSTER_ID_ON_OFF_TL_CLIENT_ROLE_GENERATED_CMD_LIST
 
#define ZB_ZCL_CLUSTER_ID_ON_OFF_SERVER_ROLE_RECEIVED_CMD_LIST   ZB_ZCL_CLUSTER_ID_ON_OFF_CLIENT_ROLE_GENERATED_CMD_LIST
 
#define ZB_ZCL_ON_OFF_SEND_OFF_REQ(buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, dis_default_resp, cb)
 
#define ZB_ZCL_ON_OFF_SEND_ON_REQ(buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, dis_default_resp, cb)
 
#define ZB_ZCL_ON_OFF_SEND_TOGGLE_REQ(buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, dis_default_resp, cb)
 
#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_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 Off with Effect command. More...
 
#define ZB_ZCL_ON_OFF_GET_ON_WITH_TIMED_OFF_REQ(data_ptr, buffer, status)
 Parses On with timed off command. More...
 

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

Internal structures and define-procedure for inform User App about 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_zcl_on_off_effect_user_app_schedule_e 
zb_zcl_on_off_effect_user_app_schedule_t
 
#define ZB_ZCL_ON_OFF_EFFECT_SCHEDULE_USER_APP(buffer, pcmd_info, effectId, effectVar)
 

Detailed Description

All commands in the cluster have only request form, and carry no payload.

Example
On command sending:
#define DST_ADDR 0
#define DST_ENDPOINT 5
#define DST_ADDR_MODE ZB_APS_ADDR_MODE_16_ENDP_PRESENT
buf,
DST_ADDR,
DST_ADDR_MODE,
DST_ENDPOINT,
HA_SWITCH_ENDPOINT,
ZB_FALSE, NULL);

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

For more information see 5.7.3_onoff_server sample

Macro Definition Documentation

#define ZB_ZCL_CLUSTER_ID_ON_OFF_CLIENT_ROLE_GENERATED_CMD_LIST
Value:
#define ZB_ZCL_CLUSTER_ID_ON_OFF_TL_CLIENT_ROLE_GENERATED_CMD_LIST
#define ZB_ZCL_ON_OFF_ACCEPT_ONLY_WHEN_ON   1

Accept only when on

See also
ZCL spec 3.8.2.3.6.1
#define ZB_ZCL_ON_OFF_EFFECT_SCHEDULE_USER_APP (   buffer,
  pcmd_info,
  effectId,
  effectVar 
)
Value:
{ \
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))); \
}
#define ZB_SCHEDULE_CALLBACK(func, param)
Definition: zboss_api_core.h:349
Definition: zb_zcl_common.h:867
Definition: zb_zcl_on_off.h:361
#define ZB_GET_BUF_PARAM(zbbuf, type)
Definition: zboss_api_core.h:956
struct zb_zcl_on_off_effect_user_app_schedule_e zb_zcl_on_off_effect_user_app_schedule_t
#define ZB_REF_FROM_BUF(buf)
get buffer reference which can be passed to scheduler callback
Definition: zboss_api_core.h:745
#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)); \
} \
}
Definition: zb_zcl_common.h:252
#define ZB_BUF_BEGIN(zbbuf)
Definition: zboss_api_core.h:758
#define ZB_BUF_LEN(zbbuf)
Definition: zboss_api_core.h:767
Structured representsation of Off with effect command payload.
Definition: zb_zcl_on_off.h:284
Definition: zb_zcl_common.h:251
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.

Parses Off 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:
{ \
{ \
} \
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)); \
} \
}
Structured representsation of On with timed off command payload.
Definition: zb_zcl_on_off.h:291
Definition: zb_zcl_common.h:252
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.
#define ZB_BUF_BEGIN(zbbuf)
Definition: zboss_api_core.h:758
#define ZB_BUF_LEN(zbbuf)
Definition: zboss_api_core.h:767
Definition: zb_zcl_common.h:251
#define ZB_LETOH16
Definition: zb_types.h:673

Parses 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_REQ (   buffer,
  addr,
  dst_addr_mode,
  dst_ep,
  ep,
  prfl_id,
  dis_default_resp,
  cb 
)
Value:
ZB_ZCL_ON_OFF_SEND_REQ( \
buffer, \
addr, \
dst_addr_mode, \
dst_ep, \
ep, \
prfl_id, \
dis_default_resp, \
cb)
Definition: zb_zcl_on_off.h:122

Specific macro for sending Off command

#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_REQ(buffer) \
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, dis_default_resp) \
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_CMD_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); \
}
#define ZB_ZCL_PACKET_PUT_DATA8(ptr, val)
Put 8 bit value to packet.
Definition: zb_zcl_common.h:1271
#define ZB_ZCL_GET_SEQ_NUM()
Return next sequence number for ZCL frame.
Definition: zb_zcl_common.h:1168
#define ZB_ZCL_FINISH_PACKET(zbbuf, ptr)
Definition: zb_zcl_common.h:1572
Definition: zb_zcl_on_off.h:125
unsigned char zb_uint8_t
Project-local 1-byte unsigned int type.
Definition: zb_types.h:116
Definition: zb_zcl_common.h:141

Specific macro for sending Off with effect command

#define ZB_ZCL_ON_OFF_SEND_ON_REQ (   buffer,
  addr,
  dst_addr_mode,
  dst_ep,
  ep,
  prfl_id,
  dis_default_resp,
  cb 
)
Value:
ZB_ZCL_ON_OFF_SEND_REQ( \
buffer, \
addr, \
dst_addr_mode, \
dst_ep, \
ep, \
prfl_id, \
dis_default_resp, \
cb)
Definition: zb_zcl_on_off.h:123

Specific macro for sending On command

#define ZB_ZCL_ON_OFF_SEND_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_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_REQ(buffer) \
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, dis_default_resp) \
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_CMD_ON_OFF_ON_WITH_TIMED_OFF_ID); \
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); \
}
#define ZB_ZCL_PACKET_PUT_DATA8(ptr, val)
Put 8 bit value to packet.
Definition: zb_zcl_common.h:1271
#define ZB_ZCL_GET_SEQ_NUM()
Return next sequence number for ZCL frame.
Definition: zb_zcl_common.h:1168
#define ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, val)
Definition: zb_zcl_common.h:1289
Definition: zb_zcl_on_off.h:127
#define ZB_ZCL_FINISH_PACKET(zbbuf, ptr)
Definition: zb_zcl_common.h:1572
unsigned char zb_uint8_t
Project-local 1-byte unsigned int type.
Definition: zb_types.h:116
Definition: zb_zcl_common.h:141

Specific macro for sending On with timed off command

#define ZB_ZCL_ON_OFF_SEND_TOGGLE_REQ (   buffer,
  addr,
  dst_addr_mode,
  dst_ep,
  ep,
  prfl_id,
  dis_default_resp,
  cb 
)
Value:
ZB_ZCL_ON_OFF_SEND_REQ( \
buffer, \
addr, \
dst_addr_mode, \
dst_ep, \
ep, \
prfl_id, \
dis_default_resp, \
cb)
Definition: zb_zcl_on_off.h:124

Specific macro for sending Toggle command

Typedef Documentation

Struct for invoke User App & continue after

Enumeration Type Documentation

On/Off cluster attribute identifiers.

See also
ZCL spec, subclause 3.8.2.2
Enumerator
ZB_ZCL_ATTR_ON_OFF_ON_OFF_ID 

OnOff attribute.

ZB_ZCL_ATTR_ON_OFF_GLOBAL_SCENE_CONTROL 

Global Scene Control attribute identifier.

ZB_ZCL_ATTR_ON_OFF_ON_TIME 

On Time attribute identifier.

ZB_ZCL_ATTR_ON_OFF_OFF_WAIT_TIME 

Off Wait Time attribute identifier.

ZB_ZCL_ATTR_ON_OFF_START_UP_ON_OFF 

The StartUpOnOff attribute SHALL define the desired startup behavior of a lamp device when it is supplied with power and this state SHALL be reflected in the OnOff attribute.

On/Off cluster command identifiers.

See also
ZCL spec, subclause 3.8.2.3
Enumerator
ZB_ZCL_CMD_ON_OFF_OFF_ID 

"Turn off" command.

ZB_ZCL_CMD_ON_OFF_ON_ID 

"Turn on" command.

ZB_ZCL_CMD_ON_OFF_TOGGLE_ID 

"Toggle state" command.

ZB_ZCL_CMD_ON_OFF_OFF_WITH_EFFECT_ID 

"Off with effect" command.

ZB_ZCL_CMD_ON_OFF_ON_WITH_RECALL_GLOBAL_SCENE_ID 

"On with recall global scene" command.

ZB_ZCL_CMD_ON_OFF_ON_WITH_TIMED_OFF_ID 

"On with timed off" command.

Effect identifier enum

See also
ZCL spec 3.8.2.3.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
ZCL spec 3.8.2.3.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
ZCL spec 3.8.2.3.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

Permissible values for OnOff attribute.

Enumerator
ZB_ZCL_ON_OFF_IS_OFF 

"Off" value

ZB_ZCL_ON_OFF_IS_ON 

"On" value


Documentation feedback | Developer Zone | Subscribe | Updated