Z-Wave Protocol Controller Reference
Z-Wave Controller Callbacks

zwave_controller callbacks registration system. More...

Collaboration diagram for Z-Wave Controller Callbacks:

Classes

struct  zwave_controller_callbacks_t
 The following structure holds all the callbacks this module will emit. More...
 

Macros

#define ZWAVE_CONTROLLER_MAXIMUM_CALLBACK_SUBSCRIBERS   20
 Maximum number of callbacks structures which may be registered. More...
 
#define ZWAVE_CONTROLLER_RESET_STEP_MIN_PRIORITY   0
 Minimum Priority for a reset step. More...
 
#define ZWAVE_CONTROLLER_CLEAN_UP_ASSOCIATIONS_STEP_PRIORITY   1
 Clean-up Associations to ourselves in the network. More...
 
#define ZWAVE_CONTROLLER_DEVICE_RESET_LOCALLY_STEP_PRIORITY   2
 Notify the lifeline destinations that we are resetting. More...
 
#define ZWAVE_CONTROLLER_SMART_START_LIST_UPDATE_STEP_PRIORITY   3
 Clean up the SmartStart as we exit the network. More...
 
#define ZWAVE_CONTROLLER_TX_FLUSH_RESET_STEP_PRIORITY   4
 Empty and flush the Tx Queue. More...
 
#define ZWAVE_CONTROLLER_ZWAVE_NETWORK_MANAGEMENT_RESET_STEP_PRIORITY   5
 reset the network for the Z-Wave API. This should be last. More...
 

Typedefs

typedef sl_status_t(* zwave_controller_reset_step_t) (void)
 

Functions

sl_status_t zwave_controller_register_callbacks (const zwave_controller_callbacks_t *callbacks)
 Let another component register its callbacks for Z-Wave Controller events. More...
 
sl_status_t zwave_controller_deregister_callbacks (const zwave_controller_callbacks_t *callbacks)
 Let another component deregister its callbacks for Z-Wave Controller events. More...
 
sl_status_t zwave_controller_register_reset_step (const zwave_controller_reset_step_t step_function, int32_t priority)
 Let another component register a step to perform when being reset. More...
 
void zwave_controller_on_reset_step_complete (int32_t priority)
 Informs the Z-Wave Controller that a Reset Step is completed. More...
 
void zwave_controller_callbacks_init ()
 Reset all callback structures. More...
 

Detailed Description

zwave_controller callbacks registration system.

This modules routes events from the Z-Wave Controller sub-blocks (such as Z-Wave RX or network management) and dispatches them to other components that have registered a callback for this particular event. Refer to zwave_controller_register_callbacks

Example usage:

zwave_controller_callbacks_t my_callbacks = {NULL};
my_callbacks.on_new_suc = my_on_new_suc_function;
zwave_controller_register_callbacks(my_callbacks);

After this, my function will now be called when the SUC NodeID changes. Changing the list of functions to invoke can be done runtime:

my_callbacks.on_node_information = my_on_node_information_function;
my_callbacks.on_new_suc = NULL;

The user component must de-register callbacks if the variable is to be destroyed

zwave_controller_deregister_callbacks(my_callbacks);
// Now my_callbacks can be destroyed

Macro Definition Documentation

◆ ZWAVE_CONTROLLER_CLEAN_UP_ASSOCIATIONS_STEP_PRIORITY

#define ZWAVE_CONTROLLER_CLEAN_UP_ASSOCIATIONS_STEP_PRIORITY   1

Clean-up Associations to ourselves in the network.

◆ ZWAVE_CONTROLLER_DEVICE_RESET_LOCALLY_STEP_PRIORITY

#define ZWAVE_CONTROLLER_DEVICE_RESET_LOCALLY_STEP_PRIORITY   2

Notify the lifeline destinations that we are resetting.

◆ ZWAVE_CONTROLLER_MAXIMUM_CALLBACK_SUBSCRIBERS

#define ZWAVE_CONTROLLER_MAXIMUM_CALLBACK_SUBSCRIBERS   20

Maximum number of callbacks structures which may be registered.

◆ ZWAVE_CONTROLLER_RESET_STEP_MIN_PRIORITY

#define ZWAVE_CONTROLLER_RESET_STEP_MIN_PRIORITY   0

Minimum Priority for a reset step.

◆ ZWAVE_CONTROLLER_SMART_START_LIST_UPDATE_STEP_PRIORITY

#define ZWAVE_CONTROLLER_SMART_START_LIST_UPDATE_STEP_PRIORITY   3

Clean up the SmartStart as we exit the network.

◆ ZWAVE_CONTROLLER_TX_FLUSH_RESET_STEP_PRIORITY

#define ZWAVE_CONTROLLER_TX_FLUSH_RESET_STEP_PRIORITY   4

Empty and flush the Tx Queue.

◆ ZWAVE_CONTROLLER_ZWAVE_NETWORK_MANAGEMENT_RESET_STEP_PRIORITY

#define ZWAVE_CONTROLLER_ZWAVE_NETWORK_MANAGEMENT_RESET_STEP_PRIORITY   5

reset the network for the Z-Wave API. This should be last.

Typedef Documentation

◆ zwave_controller_reset_step_t

typedef sl_status_t(* zwave_controller_reset_step_t) (void)

Function type for a Z-Wave Controller reset step The function MUST return SL_STATUS_OK if it will invoke the zwave_controller_on_reset_step_complete later. Any other status if it will not invoke the zwave_controller_on_reset_step_complete

Function Documentation

◆ zwave_controller_callbacks_init()

void zwave_controller_callbacks_init ( )

Reset all callback structures.

◆ zwave_controller_deregister_callbacks()

sl_status_t zwave_controller_deregister_callbacks ( const zwave_controller_callbacks_t callbacks)

Let another component deregister its callbacks for Z-Wave Controller events.

This function will deregister a pointer to a zwave_controller_callbacks_t array.

Parameters
callbackszwave_controller_callbacks_t callbacks pointer.
Returns
SL_STATUS_OK if the callback pointer has been deregistered or was already unregistered.
SL_STATUS_FAIL if an error happened e.g. invalid value.

◆ zwave_controller_on_reset_step_complete()

void zwave_controller_on_reset_step_complete ( int32_t  priority)

Informs the Z-Wave Controller that a Reset Step is completed.

Parameters
priorityPriority of the step that was just completed.
Here is the caller graph for this function:

◆ zwave_controller_register_callbacks()

sl_status_t zwave_controller_register_callbacks ( const zwave_controller_callbacks_t callbacks)

Let another component register its callbacks for Z-Wave Controller events.

This function will register the pointer of a ' zwave_controller_callbacks_t variable passed by another component.

Another component registering callbacks must provide a valid/allocated pointer. zwave_controller_callbacks_t members left to NULL will not be called.

Callbacks must not take a long time. If they need further processing or to trigger a long procedure, they must copy the data to their respective component and/or trigger an asynchronous contiki event.

Parameters
callbackscallbacks pointer for the zwave_controller component. All callbacks are executed in the context of the zwave_controller process.

The caller may provide a callback struct pointer containing a set of NULL and valid functions. The Z-Wave Controller Component keeps the pointer value, so a component can subsequently deregister a function by changing it to NULL or a new value in its zwave_controller_callbacks_t variable.

If all functions are NULL in a zwave_controller_callbacks_t variable, the component should deregister its callback variable by calling zwave_controller_deregister_callbacks.

Components must deregister their callbacks before shutting down and destroying the zwave_controller_callbacks_t variables passed to this function.

Returns
SL_STATUS_OK if the callback pointer has been registered.
SL_STATUS_FAIL if the callback pointer is invalid
SL_STATUS_NO_MORE_RESOURCE if the maximum number of subscribers registered callbacks.
Here is the caller graph for this function:

◆ zwave_controller_register_reset_step()

sl_status_t zwave_controller_register_reset_step ( const zwave_controller_reset_step_t  step_function,
int32_t  priority 
)

Let another component register a step to perform when being reset.

This function will register a pointer to a zwave_controller_reset_step_t array.

Parameters
step_functionzwave_controller_reset_step_t function to invoke when being reset.
priorityPriority of the step. Step 0 is executed first, step 1 second, etc. This value MUST be between 0 and ZWAVE_CONTROLLER_MAXIMUM_CALLBACK_SUBSCRIBERS - 1
Returns
SL_STATUS_OK if the callback pointer has been registered with the requested priority SL_STATUS_FAIL if an error happened, e.g. 2 steps with the same priority are registered.
Here is the caller graph for this function: