Developing with ZBOSS SDK for Zigbee

Data Structures

struct  zb_zcl_frame_ctrl_s
 ZCL frame control field. More...
 
struct  zb_zcl_frame_hdr_full_s
 ZCL frame header with manufacturer code. More...
 
struct  zb_zcl_frame_hdr_short_s
 ZCL frame header without manufacturer code. More...
 
struct  zb_zcl_addr_s
 Type to represent source address of ZCL message. More...
 
struct  zb_zcl_parsed_hdr_s
 
struct  zb_zcl_attr_addr_info_s
 

Macros

#define ZB_ZCL_MANUFACTURER_WILDCARD_ID   0xffff
 
#define ZB_ZCL_REVERT_DIRECTION(_d)   (((zb_zcl_frame_direction_t)(_d) == ZB_ZCL_FRAME_DIRECTION_TO_SRV) ? ZB_ZCL_FRAME_DIRECTION_TO_CLI : ZB_ZCL_FRAME_DIRECTION_TO_SRV)
 Reverts ZCL direction value.
 
#define ZB_ZCL_PARSED_HDR_SHORT_DATA(header)   ((header)->addr_data.common_data)
 Extract common addressing data from parsed ZCL structure. More...
 
#define ZB_ZCL_GET_FRAME_TYPE(v)
 Get ZCL frame type zb_zcl_frame_type_e.
 
#define ZB_ZCL_GET_MANUF_SPECIFIC(v)
 Check is ZCL frame manufacturer specific zb_zcl_manufacturer_specific_e.
 
#define ZB_ZCL_GET_DIRECTION(v)
 Get ZCL frame direction zb_zcl_frame_direction_e.
 
#define ZB_ZCL_GET_DISABLE_DEFAULT_RESPONSE(v)
 Get ZCL disable default response field zb_zcl_disable_default_response_e.
 
#define ZB_ZCL_SET_FRAME_TYPE(v, val)
 Set ZCL frame type zb_zcl_frame_type_e.
 
#define ZB_ZCL_SET_MANUF_SPECIFIC(v, val)
 Set ZCL frame manufacturer specific zb_zcl_manufacturer_specific_e.
 
#define ZB_ZCL_SET_DIRECTION(v, val)
 Set ZCL frame direction zb_zcl_frame_direction_e.
 
#define ZB_ZCL_SET_DISABLE_DEFAULT_RESPONSE(v, val)
 Set ZCL disable default response field zb_zcl_disable_default_response_e.
 
#define ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_RES_FRAME_CONTROL(buf_ptr)
 Construct ZCL header frame control value for cluster-specific command response. More...
 
#define ZB_ZCL_CONSTRUCT_COMMAND_HEADER(data_ptr, tsn, cmd_id)
 Construct ZCL header. More...
 
#define ZB_ZCL_CONSTRUCT_COMMAND_HEADER_EXT(_data_ptr, _tsn, _is_manuf_spec, _manuf_specific, _cmd_id)
 Construct ZCL header, Manufacturer specific value is conditionally supported. More...
 
#define ZB_ZCL_GET_SEQ_NUM()
 Return next sequence number for ZCL frame.
 
#define ZB_ZCL_COPY_PARSED_HEADER(buf, dst)
 Copy parsed ZCL header from buffer. More...
 
#define ZB_ZCL_SEND_CMD( buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, dis_default_resp, cluster_id, command_id, cb)
 General macro for sending a command with empty payload. More...
 

Typedefs

typedef enum zb_zcl_frame_type_e zb_zcl_frame_type_t
 ZCL frame type. More...
 
typedef enum zb_zcl_manufacturer_specific_e zb_zcl_manufacturer_specific_t
 Values for Manufacturer-specific subfield of FCF in ZCL frame. More...
 
typedef enum zb_zcl_disable_default_response_e zb_zcl_disable_default_response_t
 Values for Disable default response subfield of FCF in ZCL frame. More...
 
typedef enum zb_zcl_frame_direction_e zb_zcl_frame_direction_t
 ZCL frame direction. More...
 
typedef struct zb_zcl_frame_ctrl_s zb_zcl_frame_ctrl_t
 ZCL frame control field. More...
 
typedef struct zb_zcl_frame_hdr_full_s zb_zcl_frame_hdr_full_t
 ZCL frame header with manufacturer code. More...
 
typedef struct zb_zcl_frame_hdr_short_s zb_zcl_frame_hdr_short_t
 ZCL frame header without manufacturer code. More...
 
typedef struct zb_zcl_addr_s zb_zcl_addr_t
 Type to represent source address of ZCL message. More...
 
typedef struct zb_zcl_parsed_hdr_s zb_zcl_parsed_hdr_t
 
typedef struct zb_zcl_attr_addr_info_s zb_zcl_attr_addr_info_t
 

Enumerations

enum  zb_zcl_frame_type_e { ZB_ZCL_FRAME_TYPE_COMMON = 0x00, ZB_ZCL_FRAME_TYPE_CLUSTER_SPECIFIC = 0x01 }
 ZCL frame type. More...
 
enum  zb_zcl_manufacturer_specific_e { ZB_ZCL_NOT_MANUFACTURER_SPECIFIC = 0x00, ZB_ZCL_MANUFACTURER_SPECIFIC = 0x01 }
 Values for Manufacturer-specific subfield of FCF in ZCL frame. More...
 
enum  zb_zcl_disable_default_response_e { ZB_ZCL_ENABLE_DEFAULT_RESPONSE = 0x00, ZB_ZCL_DISABLE_DEFAULT_RESPONSE = 0x01 }
 Values for Disable default response subfield of FCF in ZCL frame. More...
 
enum  zb_zcl_frame_direction_e { ZB_ZCL_FRAME_DIRECTION_TO_SRV = 0x00, ZB_ZCL_FRAME_DIRECTION_TO_CLI = 0x01 }
 ZCL frame direction. More...
 
enum  zb_zcl_addr_type_e { ZB_ZCL_ADDR_TYPE_SHORT, ZB_ZCL_ADDR_TYPE_IEEE_GPD, ZB_ZCL_ADDR_TYPE_SRC_ID_GPD, ZB_ZCL_ADDR_TYPE_IEEE }
 Possible address types of devices from which ZCL message is received.
 

Functions

void * zb_zcl_start_command_header (zb_bufid_t zbbuf, zb_uint8_t frame_ctl, zb_uint16_t manuf_code, zb_uint8_t cmd_id, zb_uint8_t *tsn)
 Construct ZCL command header in the buffer. More...
 

Detailed Description

Types and macros required for ZCL frame manipulations

Macro Definition Documentation

◆ ZB_ZCL_CONSTRUCT_COMMAND_HEADER

#define ZB_ZCL_CONSTRUCT_COMMAND_HEADER (   data_ptr,
  tsn,
  cmd_id 
)

Construct ZCL header.

Note
To add Manufacturer specific field, use ZB_ZCL_CONSTRUCT_COMMAND_HEADER_EXT(), macro.

◆ ZB_ZCL_CONSTRUCT_COMMAND_HEADER_EXT

#define ZB_ZCL_CONSTRUCT_COMMAND_HEADER_EXT (   _data_ptr,
  _tsn,
  _is_manuf_spec,
  _manuf_specific,
  _cmd_id 
)
Value:
{ \
if ((_is_manuf_spec) != 0) \
{ \
ZB_ZCL_PACKET_PUT_DATA16_VAL((_data_ptr), (_manuf_specific)); \
} \
ZB_ZCL_PACKET_PUT_DATA8((_data_ptr), (_tsn)); \
ZB_ZCL_PACKET_PUT_DATA8((_data_ptr), (_cmd_id)); \
}

Construct ZCL header, Manufacturer specific value is conditionally supported.

◆ ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_RES_FRAME_CONTROL

#define ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_RES_FRAME_CONTROL (   buf_ptr)
Value:
( ZB_ZCL_CONSTRUCT_SET_FRAME_CONTROL(*buf_ptr, \
buf_ptr++)
Definition: zb_zcl_common.h:916
Standard profile command.
Definition: zb_zcl_common.h:886
Disable default response.
Definition: zb_zcl_common.h:904
Definition: zb_zcl_common.h:874

Construct ZCL header frame control value for cluster-specific command response.

◆ ZB_ZCL_COPY_PARSED_HEADER

#define ZB_ZCL_COPY_PARSED_HEADER (   buf,
  dst 
)
Value:
(ZB_MEMCPY( \
(dst), \
Definition: zb_zcl_common.h:991
#define ZB_BUF_GET_PARAM(buf, type)
Definition: zboss_api_buf.h:487

Copy parsed ZCL header from buffer.

Parameters
buf- ID zb_bufid_t of buffer containing parsed ZCL header as parameter
dst- pointer to the memory area to copy header to

◆ ZB_ZCL_PARSED_HDR_SHORT_DATA

#define ZB_ZCL_PARSED_HDR_SHORT_DATA (   header)    ((header)->addr_data.common_data)

Extract common addressing data from parsed ZCL structure.

Parameters
header- pointer to the parsed ZCL header structure (see zb_zcl_parsed_hdr_s).

◆ ZB_ZCL_SEND_CMD

#define ZB_ZCL_SEND_CMD (   buffer,
  addr,
  dst_addr_mode,
  dst_ep,
  ep,
  prof_id,
  dis_default_resp,
  cluster_id,
  command_id,
  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(), command_id); \
ZB_ZCL_FINISH_PACKET(buffer, ptr) \
ZB_ZCL_SEND_COMMAND_SHORT(buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, cluster_id, cb); \
}
#define ZB_ZCL_GET_SEQ_NUM()
Return next sequence number for ZCL frame.
Definition: zb_zcl_common.h:1281

General macro for sending a command with empty payload.

Parameters
bufferto put command payload and headers to
addraddress to send to
dst_addr_modedestination address mode
dst_epdestination endpoint
epsource endpoint
prof_idprofile the command belongs to
dis_default_resp"Disable default response" flag
cluster_idcluster identifier
command_idcommand identifier
cbcommand send status callback
#define ZB_ZCL_DOOR_LOCK_SEND_LOCK_DOOR_REQ(buffer, \
dst_addr, \
dst_addr_mode, \
dst_ep, \
ep, \
dis_default_resp, \
cb) \
ZB_ZCL_SEND_CMD( buffer, \
dst_addr, \
dst_addr_mode, \
dst_ep, \
ep, \
ZB_AF_HA_PROFILE_ID, \
dis_default_resp, \
ZB_ZCL_CLUSTER_ID_DOOR_LOCK, \
ZB_ZCL_CMD_DOOR_LOCK_LOCK_DOOR, \
cb)

Typedef Documentation

◆ zb_zcl_addr_t

typedef struct zb_zcl_addr_s zb_zcl_addr_t

Type to represent source address of ZCL message.

It is needed if ZGP sink is enabled and therefore messages can be received from ZGPD devices which are identified by 32-bit source Id.

◆ zb_zcl_attr_addr_info_t

Attribute address info structure

◆ zb_zcl_disable_default_response_t

Values for Disable default response subfield of FCF in ZCL frame.

See also
ZCL spec, subclause 2.3.1.1.3.

◆ zb_zcl_frame_ctrl_t

ZCL frame control field.

See also
ZCL spec, subclause 2.3.1.1

◆ zb_zcl_frame_direction_t

ZCL frame direction.

See also
ZCL spec, subclause 2.3.1.1.3.

◆ zb_zcl_frame_hdr_full_t

ZCL frame header with manufacturer code.

See also
ZCL spec, subclause 2.3.1

◆ zb_zcl_frame_hdr_short_t

ZCL frame header without manufacturer code.

See also
ZCL spec, subclause 2.3.1

◆ zb_zcl_frame_type_t

ZCL frame type.

Defines Permitted values for Frame Type subfield of Frame Control field in ZCL frame.

See also
ZCL spec, subclause 2.3.1.1.1.

◆ zb_zcl_manufacturer_specific_t

Values for Manufacturer-specific subfield of FCF in ZCL frame.

See also
ZCL spec, subclause 2.3.1.1.2.

◆ zb_zcl_parsed_hdr_t

Parsed ZCL header

Enumeration Type Documentation

◆ zb_zcl_disable_default_response_e

Values for Disable default response subfield of FCF in ZCL frame.

See also
ZCL spec, subclause 2.3.1.1.3.
Enumerator
ZB_ZCL_ENABLE_DEFAULT_RESPONSE 

Enable default response.

ZB_ZCL_DISABLE_DEFAULT_RESPONSE 

Disable default response.

◆ zb_zcl_frame_direction_e

ZCL frame direction.

See also
ZCL spec, subclause 2.3.1.1.3.
Enumerator
ZB_ZCL_FRAME_DIRECTION_TO_SRV 

Command sent from client to a server

ZB_ZCL_FRAME_DIRECTION_TO_CLI 

Command sent from server to a client

◆ zb_zcl_frame_type_e

ZCL frame type.

Defines Permitted values for Frame Type subfield of Frame Control field in ZCL frame.

See also
ZCL spec, subclause 2.3.1.1.1.
Enumerator
ZB_ZCL_FRAME_TYPE_COMMON 

Command acts across the entire profile

ZB_ZCL_FRAME_TYPE_CLUSTER_SPECIFIC 

Command is specific to a cluster

◆ zb_zcl_manufacturer_specific_e

Values for Manufacturer-specific subfield of FCF in ZCL frame.

See also
ZCL spec, subclause 2.3.1.1.2.
Enumerator
ZB_ZCL_NOT_MANUFACTURER_SPECIFIC 

Standard profile command.

Manufacturer code field shall not be included into ZCL frame header.

ZB_ZCL_MANUFACTURER_SPECIFIC 

Command refers to manufacturer-specific profile extension.

Manufacturer code field shall be included into ZCL frame header.

Function Documentation

◆ zb_zcl_start_command_header()

void* zb_zcl_start_command_header ( zb_bufid_t  zbbuf,
zb_uint8_t  frame_ctl,
zb_uint16_t  manuf_code,
zb_uint8_t  cmd_id,
zb_uint8_t tsn 
)

Construct ZCL command header in the buffer.

Parameters
zbbufbuffer ID
frame_ctlFrame Control field for ZCL packet
manuf_codemanufacturer code, not used manufacturer-specific flag is not set
cmd_idZCL command id
tsnpointer to variable (may be NULL) for TSN value of ZCL packet (generated by the function)

Returns pointer to the buffer data begin after ZCL header (where command payload can be placed if needed).