Z-Wave Protocol Controller Reference
Z-Wave Application Command Class Handler

Application Command Class handler framework, dispatching incoming Z-Wave Commands to the corresponding handler. More...

Collaboration diagram for Z-Wave Application Command Class Handler:

Modules

 Callbacks for the Z-Wave Command Handler
 List of callback functions that are registered to the Z-Wave Controller.
 
 Internal definitions for the Z-Wave Command Handler
 Shared internal functions and variables for the Z-Wave Command Handler. *.
 

Classes

struct  zwave_command_handler_t
 Z-Wave Command Class handler object. More...
 

Typedefs

typedef sl_status_t(* zwave_command_class_handler_t) (const zwave_controller_connection_info_t *connection, const uint8_t *frame_data, uint16_t frame_length)
 This is the function which will be executed when the frame of a given Command Class is received. More...
 

Functions

sl_status_t zwave_command_handler_init (void)
 Initialize the command handlers. More...
 
int zwave_command_handler_teardown (void)
 Teardown of the Z-Wave command handler. More...
 
sl_status_t zwave_command_handler_register_handler (zwave_command_handler_t new_command_class_handler)
 Register a command class handler. More...
 
zwave_cc_version_t zwave_command_handler_get_version (zwave_command_class_t command_class)
 Get the version of Command Class that the handler handles. More...
 
sl_status_t zwave_command_handler_dispatch (const zwave_controller_connection_info_t *connection_info, const uint8_t *frame_data, uint16_t frame_length)
 Dispatches a frame to its respective Command Class handler. More...
 
bool zwave_command_handler_controls (zwave_command_class_t command_class)
 Check if we control a given command class. More...
 
void zwave_command_handler_print_info (int fd)
 Print Command Class Version info. More...
 

Detailed Description

Application Command Class handler framework, dispatching incoming Z-Wave Commands to the corresponding handler.

This component takes care of keeping track of the list of supported and controlled Command Classes.

When a frame is received, it is in charge of verifying the security at which the frame has been received and forward the Z-Wave Command accordingly.

Typedef Documentation

◆ zwave_command_class_handler_t

typedef sl_status_t(* zwave_command_class_handler_t) (const zwave_controller_connection_info_t *connection, const uint8_t *frame_data, uint16_t frame_length)

This is the function which will be executed when the frame of a given Command Class is received.

The handler MUST return a sl_status_t status code.

Parameters
connectionInfo about the connection properties of this frame.
frame_dataThe data payload of this frame.
frame_lengthThe length of this frame.
Returns
SL_STATUS_OK The command was handled by the command handler. Supervision will return SUCCESS in this case
SL_STATUS_FAIL The command handler was unable to parse the command or was busy carring another operation. Supervision Command Class returns FAIL.
SL_STATUS_IN_PROGRESS The command handler is processing the command Supervision Command Class returns WORKING.
SL_STATUS_NOT_SUPPORTED The command handler does not support this Command or Command Class. Supervision Command Class returns NO_SUPPORT.
Any other status: Supervision Command Class returns FAIL.

Function Documentation

◆ zwave_command_handler_controls()

bool zwave_command_handler_controls ( zwave_command_class_t  command_class)

Check if we control a given command class.

Parameters
command_class
Returns
true if we control this command classs
Here is the caller graph for this function:

◆ zwave_command_handler_dispatch()

sl_status_t zwave_command_handler_dispatch ( const zwave_controller_connection_info_t connection_info,
const uint8_t *  frame_data,
uint16_t  frame_length 
)

Dispatches a frame to its respective Command Class handler.

Parameters
connection_infoThe connection information for the received Z-Wave Frame
frame_dataThe payload of the Z-Wave Frame
frame_lengthThe length of the payload (in bytes) contained in the frame_data pointer.
Returns
The handler return code
Here is the caller graph for this function:

◆ zwave_command_handler_get_version()

zwave_cc_version_t zwave_command_handler_get_version ( zwave_command_class_t  command_class)

Get the version of Command Class that the handler handles.

Parameters
command_classCommand class to query with.
Returns
The version number of the indicated Command Class. If the Command Class is neither supported not controlled, it will be 0. 0 if no Command Class handler is registered for the Command Class identifier.
Here is the caller graph for this function:

◆ zwave_command_handler_init()

sl_status_t zwave_command_handler_init ( void  )

Initialize the command handlers.

Returns
SL_STATUS_OK, it will always be considered as successful.

◆ zwave_command_handler_print_info()

void zwave_command_handler_print_info ( int  fd)

Print Command Class Version info.

Parameters
fdFile descriptor to print to, if fd < 0 it will use sl_log_info
Here is the caller graph for this function:

◆ zwave_command_handler_register_handler()

sl_status_t zwave_command_handler_register_handler ( zwave_command_handler_t  new_command_class_handler)

Register a command class handler.

This API replaces the legacy REGISTER_HANDLER() macro. Command handlers should perform their own initialization and register themselves to the command handler framework.

There is no sequence/order requirement, meaning that this function can be invoked before the Command Class handler framework is initialized.

Parameters
new_command_class_handlerA struct that contains the zwave_command_handler_t info that will be used for registering a Command Class handler.

Command class handlers can be fully disabled by setting both support and control to false.

Returns
SL_STATUS_OK If the Command Class handler was successfully registered
SL_STATUS_FAIL Otherwise
Here is the caller graph for this function:

◆ zwave_command_handler_teardown()

int zwave_command_handler_teardown ( void  )

Teardown of the Z-Wave command handler.

Returns
0 in case of success.