Developing with ZBOSS for Zigbee
ZCL Alarms cluster

Data Structures

struct  zb_zcl_alarms_reset_alarm_req_s
 Structured representation of Reset alarm command payload. More...
 
struct  zb_zcl_alarm_get_alarm_hdr_res_s
 
struct  zb_zcl_alarm_get_alarm_res_s
 Get alarm response command structure. More...
 

Macros

#define ZB_ZCL_ALARMS_CLUSTER_REVISION_DEFAULT   ((zb_uint16_t)0x0001u)
 Default value for Alarms cluster revision global attribute.
 
#define ZB_ZCL_DECLARE_ALARMS_ATTR_LIST(attr_list)
 Declare attribute list for Alarms cluster (only cluster revision attribute) More...
 
#define ZB_ZCL_ALARMS_REPORT_ATTR_COUNT   0
 

Alarms cluster attributes

enum  zb_zcl_alarms_attr_e { ZB_ZCL_ATTR_ALARMS_ALARM_COUNT_ID = 0x0000 }
 Alarms cluster attribute identifiers. More...
 

Alarms cluster commands

enum  zb_zcl_alarms_cmd_e { ZB_ZCL_CMD_ALARMS_RESET_ALARM_ID = 0x00, ZB_ZCL_CMD_ALARMS_RESET_ALL_ALARMS_ID = 0x01, ZB_ZCL_CMD_ALARMS_GET_ALARM_ID = 0x02, ZB_ZCL_CMD_ALARMS_RESET_ALARM_LOG_ID = 0x03 }
 Alarms cluster command identifiers. More...
 
enum  zb_zcl_alarms_cmd_resp_e { ZB_ZCL_CMD_ALARMS_ALARM_ID = 0x00, ZB_ZCL_CMD_ALARMS_GET_ALARM_RES_ID = 0x01 }
 Alarms cluster response command identifiers. More...
 
typedef struct zb_zcl_alarms_reset_alarm_req_s zb_zcl_alarms_reset_alarm_req_t
 Structured representation of Reset alarm command payload.
 
typedef zb_zcl_alarms_reset_alarm_req_t zb_zcl_alarms_alarm_res_t
 Structured representation of Alarm command payload.
 
typedef struct zb_zcl_alarm_get_alarm_hdr_res_s zb_zcl_alarm_get_alarm_hdr_res_t
 
typedef struct zb_zcl_alarm_get_alarm_res_s zb_zcl_alarm_get_alarm_res_t
 Get alarm response command structure.
 
#define ZB_ZCL_ALARMS_RESET_ALARM_REQ_PAYLOAD_LEN   sizeof(zb_zcl_alarms_reset_alarm_req_t)
 Reset alarm payload length macro.
 
#define ZB_ZCL_ALARMS_SEND_RESET_ALARM_REQ( buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, dis_default_resp, cb, alarm_code, cluster_id)
 Send Reset alarm command. More...
 
#define ZB_ZCL_ALARMS_GET_RESET_ALARM_REQ(data_buf, reset_alarm_req, status)
 Parses Reset alarm command and fills in data request structure. If request contains invalid data, status will set to ZB_FALSE. More...
 
#define ZB_ZCL_ALARMS_SEND_RESET_ALL_ALARMS_REQ( buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, dis_default_resp, cb)
 Send Reset all alarms command. More...
 
#define ZB_ZCL_ALARMS_SEND_GET_ALARM_REQ( buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, dis_default_resp, cb)
 Send Get alarm command. More...
 
#define ZB_ZCL_ALARMS_SEND_RESET_ALARM_LOG_REQ( buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, dis_default_resp, cb)
 Send Reset alarm log command. More...
 
#define ZB_ZCL_ALARM_GET_ALARM_RES_SIZE   sizeof(zb_zcl_alarm_get_alarm_res_t)
 
#define ZB_ZCL_ALARM_GET_ALARM_HDR_RES_SIZE   sizeof(zb_zcl_alarm_get_alarm_hdr_res_t)
 
#define ZB_ZCL_ALARMS_SEND_ALARM_RES( buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, cb, alarm_code, cluster_id)
 Send Alarm command (to client) More...
 
#define ZB_ZCL_ALARMS_GET_ALARM_RES(data_ptr, buffer, status)
 Parses Reset alarm command and fills in data request structure. If request contains invalid data, status will set to ZB_FALSE. More...
 
#define ZB_ZCL_ALARMS_GET_GET_ALARM_RES(data_buf, get_alarm_res, status)
 Parses Get alarm response command and returns response data structure or status = ZB_FALSE if request contains invalid data. More...
 

Detailed Description

Macro Definition Documentation

◆ ZB_ZCL_ALARMS_GET_ALARM_RES

#define ZB_ZCL_ALARMS_GET_ALARM_RES (   data_ptr,
  buffer,
  status 
)
Value:
{ \
if (zb_buf_len((buffer)) < sizeof(zb_zcl_alarms_alarm_res_t)) \
{ \
} \
else \
{ \
zb_zcl_alarms_alarm_res_t *src_ptr = \
(data_ptr)->alarm_code = src_ptr->alarm_code; \
ZB_HTOLE16(&((data_ptr)->cluster_id), &(src_ptr->cluster_id)); \
} \
}

Parses Reset alarm command and fills in data request structure. If request contains invalid data, status will set to ZB_FALSE.

Parameters
data_ptr- pointer to a variable of type zb_zcl_alarms_alarm_res_t.
buffercontaining the packet (by pointer).
status- variable to put parse status to (see zb_zcl_parse_status_t).

◆ ZB_ZCL_ALARMS_GET_GET_ALARM_RES

#define ZB_ZCL_ALARMS_GET_GET_ALARM_RES (   data_buf,
  get_alarm_res,
  status 
)
Value:
{ \
zb_zcl_alarm_get_alarm_res_t *get_alarm_res_ptr; \
if (zb_buf_len(data_buf) >= ZB_ZCL_ALARM_GET_ALARM_HDR_RES_SIZE) \
{ \
(get_alarm_res_ptr) = zb_buf_begin(data_buf); \
get_alarm_res.status = get_alarm_res_ptr->status; \
if (zb_buf_len(data_buf) >= ZB_ZCL_ALARM_GET_ALARM_RES_SIZE) \
{ \
get_alarm_res.alarms_code = get_alarm_res_ptr->alarm_code; \
ZB_HTOLE16(&(get_alarm_res).cluster_id, &(get_alarm_res_ptr->cluster_id)); \
ZB_HTOLE32(&(get_alarm_res).timestamp, &(get_alarm_res_ptr->timestamp)); \
} \
status = ZB_TRUE; \
} \
else \
{ \
status = ZB_FALSE; \
} \
}

Parses Get alarm response command and returns response data structure or status = ZB_FALSE if request contains invalid data.

Parameters
data_buf- pointer to zb_buf_t buffer containing command response data
get_alarm_res- command response record
status- variable to put parse status to (see zb_zcl_parse_status_t)
Note
data_buf buffer should contain response command payload without ZCL header

◆ ZB_ZCL_ALARMS_GET_RESET_ALARM_REQ

#define ZB_ZCL_ALARMS_GET_RESET_ALARM_REQ (   data_buf,
  reset_alarm_req,
  status 
)
Value:
{ \
zb_zcl_alarms_reset_alarm_req_t *reset_alarm_req_ptr; \
(reset_alarm_req_ptr) = zb_buf_len(data_buf) >= \
ZB_ZCL_ALARMS_RESET_ALARM_REQ_PAYLOAD_LEN ? \
if (reset_alarm_req_ptr != NULL) \
{ \
reset_alarm_req.alarm_code = reset_alarm_req_ptr->alarm_code; \
ZB_HTOLE16(&(reset_alarm_req).cluster_id, &(reset_alarm_req_ptr->cluster_id)); \
} \
else \
{ \
} \
}

Parses Reset alarm command and fills in data request structure. If request contains invalid data, status will set to ZB_FALSE.

Parameters
data_buf- pointer to zb_buf_t buffer containing command request data
reset_alarm_req- variable to save command request
status- variable to put parse status to (see zb_zcl_parse_status_t).
Note
data_buf buffer should contain command request payload without ZCL header.

◆ ZB_ZCL_ALARMS_SEND_ALARM_RES

#define ZB_ZCL_ALARMS_SEND_ALARM_RES (   buffer,
  addr,
  dst_addr_mode,
  dst_ep,
  ep,
  prof_id,
  cb,
  alarm_code,
  cluster_id 
)
Value:
{ \
zb_uint8_t* ptr = ZB_ZCL_START_PACKET(buffer); \
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_RES_FRAME_CONTROL(ptr); \
ZB_ZCL_CONSTRUCT_COMMAND_HEADER(ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_CMD_ALARMS_ALARM_ID); \
ZB_ZCL_PACKET_PUT_DATA8(ptr, (alarm_code)); \
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, (cluster_id)); \
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_ALARMS, cb); \
}

Send Alarm command (to client)

Parameters
bufferto put data to
addr- address of the device to send command to
dst_addr_mode- addressing mode
dst_epdestination endpoint
ep- current endpoint
prof_id- profile identifier
cb- callback to call to report send status
alarm_code- Alarm Code
cluster_id- Cluster Id

◆ ZB_ZCL_ALARMS_SEND_GET_ALARM_REQ

#define ZB_ZCL_ALARMS_SEND_GET_ALARM_REQ (   buffer,
  addr,
  dst_addr_mode,
  dst_ep,
  ep,
  prof_id,
  dis_default_resp,
  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_ALARMS_GET_ALARM_ID); \
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_ALARMS, cb); \
}

Send Get alarm command.

Parameters
bufferto put data to
addr- address of the device to send command to
dst_addr_mode- addressing mode
dst_epdestination endpoint
ep- current endpoint
prof_id- profile identifier
dis_default_resp- "Disable default response" flag
cb- callback to call to report send status

◆ ZB_ZCL_ALARMS_SEND_RESET_ALARM_LOG_REQ

#define ZB_ZCL_ALARMS_SEND_RESET_ALARM_LOG_REQ (   buffer,
  addr,
  dst_addr_mode,
  dst_ep,
  ep,
  prof_id,
  dis_default_resp,
  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_ALARMS_RESET_ALARM_LOG_ID); \
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_ALARMS, cb); \
}

Send Reset alarm log command.

Parameters
bufferto put data to
addr- address of the device to send command to
dst_addr_mode- addressing mode
dst_epdestination endpoint
ep- current endpoint
prof_id- profile identifier
dis_default_resp- "Disable default response" flag
cb- callback to call to report send status

◆ ZB_ZCL_ALARMS_SEND_RESET_ALARM_REQ

#define ZB_ZCL_ALARMS_SEND_RESET_ALARM_REQ (   buffer,
  addr,
  dst_addr_mode,
  dst_ep,
  ep,
  prof_id,
  dis_default_resp,
  cb,
  alarm_code,
  cluster_id 
)
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_ALARMS_RESET_ALARM_ID); \
ZB_ZCL_PACKET_PUT_DATA8(ptr, (alarm_code)); \
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, (cluster_id)); \
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_ALARMS, cb); \
}

Send Reset alarm command.

Parameters
bufferto put data to
addr- address of the device to send command to
dst_addr_mode- addressing mode
dst_epdestination endpoint
ep- current endpoint
prof_id- profile identifier
dis_default_resp- "Disable default response" flag
cb- callback to call to report send status
alarm_code- Alarm Code field
cluster_id- Cluster ID field

◆ ZB_ZCL_ALARMS_SEND_RESET_ALL_ALARMS_REQ

#define ZB_ZCL_ALARMS_SEND_RESET_ALL_ALARMS_REQ (   buffer,
  addr,
  dst_addr_mode,
  dst_ep,
  ep,
  prof_id,
  dis_default_resp,
  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_ALARMS_RESET_ALL_ALARMS_ID); \
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_ALARMS, cb); \
}

Send Reset all alarms command.

Parameters
bufferto put data to
addr- address of the device to send command to
dst_addr_mode- addressing mode
dst_epdestination endpoint
ep- current endpoint
prof_id- profile identifier
dis_default_resp- "Disable default response" flag
cb- callback to call to report send status

◆ ZB_ZCL_DECLARE_ALARMS_ATTR_LIST

#define ZB_ZCL_DECLARE_ALARMS_ATTR_LIST (   attr_list)
Value:
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST

Declare attribute list for Alarms cluster (only cluster revision attribute)

Parameters
attr_list- attribute list name

Enumeration Type Documentation

◆ zb_zcl_alarms_attr_e

Alarms cluster attribute identifiers.

See also
ZCL spec, subclause 3.11.2.2
Enumerator
ZB_ZCL_ATTR_ALARMS_ALARM_COUNT_ID 

AlarmCount attribute.

◆ zb_zcl_alarms_cmd_e

Alarms cluster command identifiers.

See also
ZCL spec, subclause 3.11.2.4
Enumerator
ZB_ZCL_CMD_ALARMS_RESET_ALARM_ID 

"Reset alarm" command.

ZB_ZCL_CMD_ALARMS_RESET_ALL_ALARMS_ID 

"Reset all alarms" command.

ZB_ZCL_CMD_ALARMS_GET_ALARM_ID 

"Get alarms" command.

ZB_ZCL_CMD_ALARMS_RESET_ALARM_LOG_ID 

"Reset alarm log" command.

◆ zb_zcl_alarms_cmd_resp_e

Alarms cluster response command identifiers.

See also
ZCL spec, subclause 3.6.2.3
Enumerator
ZB_ZCL_CMD_ALARMS_ALARM_ID 

Alarm command identifier.

ZB_ZCL_CMD_ALARMS_GET_ALARM_RES_ID 

Get alarm response command identifier.

ZB_ZCL_START_PACKET
#define ZB_ZCL_START_PACKET(zbbuf)
Initializes zb_buf_t buffer and returns pointer to the beginning of array.
Definition: zb_zcl_common.h:1518
zb_zcl_alarms_reset_alarm_req_s
Structured representation of Reset alarm command payload.
Definition: zb_zcl_alarms.h:82
ZB_ZCL_CLUSTER_ID_ALARMS
#define ZB_ZCL_CLUSTER_ID_ALARMS
Definition: zb_zcl_common.h:214
ZB_ZCL_GET_SEQ_NUM
#define ZB_ZCL_GET_SEQ_NUM()
Return next sequence number for ZCL frame.
Definition: zb_zcl_common.h:1438
ZB_ZCL_CMD_ALARMS_GET_ALARM_ID
@ ZB_ZCL_CMD_ALARMS_GET_ALARM_ID
Definition: zb_zcl_alarms.h:77
ZB_TRUE
#define ZB_TRUE
Definition: zb_types.h:375
ZB_ZCL_CMD_ALARMS_RESET_ALARM_LOG_ID
@ ZB_ZCL_CMD_ALARMS_RESET_ALARM_LOG_ID
Definition: zb_zcl_alarms.h:78
ZB_ZCL_CMD_ALARMS_RESET_ALARM_ID
@ ZB_ZCL_CMD_ALARMS_RESET_ALARM_ID
Definition: zb_zcl_alarms.h:75
zb_buf_begin
#define zb_buf_begin(buf)
Definition: zboss_api_buf.h:343
ZB_ZCL_CMD_ALARMS_RESET_ALL_ALARMS_ID
@ ZB_ZCL_CMD_ALARMS_RESET_ALL_ALARMS_ID
Definition: zb_zcl_alarms.h:76
ZB_ZCL_CMD_ALARMS_ALARM_ID
@ ZB_ZCL_CMD_ALARMS_ALARM_ID
Definition: zb_zcl_alarms.h:214
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION
#define ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attrs_desc_name, cluster_name)
Start declaration of attributes list with cluster revision.
Definition: zb_zcl_common.h:785
ZB_ZCL_PARSE_STATUS_SUCCESS
@ ZB_ZCL_PARSE_STATUS_SUCCESS
Definition: zb_zcl_common.h:328
ZB_ZCL_PARSE_STATUS_FAILURE
@ ZB_ZCL_PARSE_STATUS_FAILURE
Definition: zb_zcl_common.h:329
ZB_FALSE
#define ZB_FALSE
Definition: zb_types.h:374
zb_buf_len
#define zb_buf_len(buf)
Definition: zboss_api_buf.h:361