Digi XBee(R) ANSI C Host Library
Files | Macros | Functions

Files

file  zcl_onoff.h
 On/Off Cluster: Attributes and commands for switching devices between 'On' and 'Off' states.
 
file  zcl_onoff.c
 

Macros

#define ZCL_ONOFF_ATTR_ONOFF   0x0000
 OnOff attribute, Boolean, Read only, Mandatory; Shall be reported.
 
#define ZCL_ONOFF_ON   1
 
#define ZCL_ONOFF_OFF   0
 
#define ZCL_ONOFF_CMD_OFF   0x00
 Off command, Mandatory.
 
#define ZCL_ONOFF_CMD_ON   0x01
 On command, Mandatory.
 
#define ZCL_ONOFF_CMD_TOGGLE   0x02
 Toggle command, Mandatory.
 
#define ZCL_SWITCH_ATTR_SWITCH_TYPE   0x0000
 SwitchType, 8-bit Enumeration, Read only, Mandatory.
 
#define ZCL_SWITCH_TYPE_TOGGLE   0x00
 
#define ZCL_SWITCH_TYPE_MOMENTARY   0x01
 
#define ZCL_SWITCH_ATTR_SWITCH_ACTIONS   0x0010
 SwitchActions, 8-bit Enumeration, Read/Write, Mandatory.
 
#define ZCL_SWITCH_ACTION_ONOFF   0x00
 
#define ZCL_SWITCH_ACTION_OFFON   0x01
 
#define ZCL_SWITCH_ACTION_TOGGLE   0x02
 

Functions

int _zcl_onoff_handler (const wpan_envelope_t FAR *envelope, void FAR *context)
 This is an incomplete implementation of the OnOff Cluster Command handler. More...
 

Detailed Description

Function Documentation

int _zcl_onoff_handler ( const wpan_envelope_t FAR envelope,
void FAR context 
)

This is an incomplete implementation of the OnOff Cluster Command handler.

It needs to look at the OnOff attribute (found by walking zcl.attributes), and call the attribute's .write_fn() to set the new value.

On TOGGLE, take the current value (calling the attributes' .read_fn() if necessary) and write the opposite value.

See the documentation of wpan_aps_handler_fn for parameters and return values.

Todo:
set the OnOff attribute to off and break
Todo:
set the OnOff attribute to on and break
Todo:
toggle the OnOff attribute and break

References zcl_command_t::command, zcl_command_t::frame_control, ZCL_CMD_MATCH, zcl_command_build(), zcl_default_response(), zcl_general_command(), ZCL_ONOFF_CMD_OFF, ZCL_ONOFF_CMD_ON, and ZCL_ONOFF_CMD_TOGGLE.