Z-Wave Protocol Controller Reference
zwapi_internal.h File Reference

Private definitions for the Z-Wave API. More...

Include dependency graph for zwapi_internal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define REQUEST_BUFFER_SIZE   180
 
#define SERIAL_BUFFER_SIZE   0xFF
 
#define FRAME_LENGTH_MIN   3
 
#define FRAME_LENGTH_MAX   SERIAL_BUFFER_SIZE
 
#define ZW_COMMAND_RETURN_VALUE_FALSE    0
 Command was not executed without errors. More...
 
#define ZW_COMMAND_RETURN_VALUE_TRUE   1
 Command was executed successfully. More...
 

Functions

void zwave_api_protocol_rx_dispatch (uint8_t *pData, uint16_t len)
 Execute a callback based on a received frame from the Z-Wave module. More...
 
void zwave_api_protocol_init_callbacks (void)
 Initialize functions pointers for Z-Wave module callbacks. More...
 
sl_status_t zwapi_send_command (uint8_t command, const uint8_t *payload_buffer, uint8_t payload_buffer_length)
 Verifies that the command is supported by the Z-Wave module. More...
 
sl_status_t zwapi_send_command_with_response (uint8_t command, const uint8_t *payload_buffer, uint8_t payload_buffer_length, uint8_t *response_buffer, uint8_t *response_length)
 Send a command to the Z-Wave module and waits for an ACK. More...
 
sl_status_t zwapi_send_command_no_ack (uint8_t command, const uint8_t *payload_buffer, uint8_t payload_buffer_length)
 Send a command to the Z-Wave module without waiting for any ACK. More...
 

Variables

void(* zwapi_send_data_callback )(uint8_t, zwapi_tx_report_t *)
 
void(* zwapi_send_nop_callback )(uint8_t, zwapi_tx_report_t *)
 
void(* zwapi_send_data_multi_callback )(uint8_t)
 
void(* zwapi_send_test_frame_callback )(uint8_t)
 
void(* zwapi_send_data_bridge_callback )(uint8_t, zwapi_tx_report_t *)
 
void(* zwapi_send_data_multi_bridge_callback )(uint8_t)
 
void(* zwapi_send_node_information_callback )(uint8_t txStatus)
 
void(* zwapi_memory_put_buffer_callback )(void)
 
void(* zwapi_set_default_callback )(void)
 
void(* zwapi_create_new_primarly_ctrl_callback )(struct LEARN_INFO *)
 
void(* zwapi_remove_node_from_network_callback )(struct LEARN_INFO *)
 
void(* zwapi_add_node_to_network_callback )(struct LEARN_INFO *)
 
void(* zwapi_transfer_primary_ctrl_role_callback )(struct LEARN_INFO *)
 
void(* zwapi_send_controller_replication_callback )(uint8_t txStatus)
 
void(* zwapi_assign_return_route_callback )(uint8_t bStatus)
 
void(* zwapi_assign_suc_return_route_callback )(uint8_t bStatus)
 
void(* zwapi_delete_suc_return_route_callback )(uint8_t bStatus)
 
void(* zwapi_delete_return_route_callback )(uint8_t bStatus)
 
void(* zwapi_set_learn_mode_callback )(struct LEARN_INFO *)
 
void(* zwapi_set_virtual_node_to_learn_mode_callback )(uint8_t bStatus, zwave_node_id_t orgID, zwave_node_id_t newID)
 
void(* zwapi_request_neighbor_update_callback )(uint8_t bStatus)
 
void(* zwapi_set_suc_node_id_callback )(uint8_t bStatus)
 
void(* zwapi_request_network_update_callback )(uint8_t txStatus)
 
void(* zwapi_remove_failed_node_callback )(uint8_t txStatus)
 
void(* zwapi_replace_failed_node_callback )(uint8_t txStatus)
 

Detailed Description

Private definitions for the Z-Wave API.

Macro Definition Documentation

◆ FRAME_LENGTH_MAX

#define FRAME_LENGTH_MAX   SERIAL_BUFFER_SIZE

◆ FRAME_LENGTH_MIN

#define FRAME_LENGTH_MIN   3

◆ REQUEST_BUFFER_SIZE

#define REQUEST_BUFFER_SIZE   180

Size of rx and tx buffers used with the serial API

Note: Value is taken from SERIAL_BUFFER_SIZE in zwapi_connection.h The ZGW has a modified version of zwapi_connection.h where SERIAL_BUFFER_SIZE is defined differently.

◆ SERIAL_BUFFER_SIZE

#define SERIAL_BUFFER_SIZE   0xFF

◆ ZW_COMMAND_RETURN_VALUE_FALSE

#define ZW_COMMAND_RETURN_VALUE_FALSE    0

Command was not executed without errors.

◆ ZW_COMMAND_RETURN_VALUE_TRUE

#define ZW_COMMAND_RETURN_VALUE_TRUE   1

Command was executed successfully.

Function Documentation

◆ zwapi_send_command()

sl_status_t zwapi_send_command ( uint8_t  command,
const uint8_t *  payload_buffer,
uint8_t  payload_buffer_length 
)

Verifies that the command is supported by the Z-Wave module.

Parameters
commandZ-Wave Serial API Command (zwapi_func_ids.h)
payload_bufferByte array with serial API command parameters
payload_buffer_lengthLength in bytes of parameter array
Returns
SL_STATUS_OK if the frame is supported by the Z-Wave module, sent and Ack'ed by the module. SL_STATUS_NOT_SUPPORTED if the particular command is not supported by the Z-Wave API. SL_STATUS_FAIL in all other error cases.

Sends the command data frame to the Z-Wave module and waits for ACK.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ zwapi_send_command_no_ack()

sl_status_t zwapi_send_command_no_ack ( uint8_t  command,
const uint8_t *  payload_buffer,
uint8_t  payload_buffer_length 
)

Send a command to the Z-Wave module without waiting for any ACK.

Parameters
commandZ-Wave Serial API Command (zwapi_func_ids.h)
payload_bufferByte array with serial API command parameters
payload_buffer_lengthLength in bytes of parameter array
Returns
SL_STATUS_OK if the frame is supported by the Z-Wave module. SL_STATUS_FAIL otherwise

Verifies that the command is supported by the Z-Wave module, sends the command data frame to the Z-Wave module but does not wait for any ACK

Here is the call graph for this function:
Here is the caller graph for this function:

◆ zwapi_send_command_with_response()

sl_status_t zwapi_send_command_with_response ( uint8_t  command,
const uint8_t *  payload_buffer,
uint8_t  payload_buffer_length,
uint8_t *  response_buffer,
uint8_t *  response_length 
)

Send a command to the Z-Wave module and waits for an ACK.

Parameters
commandZ-Wave Serial API Command (zwapi_func_ids.h)
payload_bufferByte array with serial API command parameters
payload_buffer_lengthLength in bytes of parameter array
response_bufferOutput Buffer to hold response (buffer MUST be large enough to hold SERIAL_BUFFER_SIZE bytes).
response_lengthOuput Length of response copied to response_buf.
Returns
SL_STATUS_OK if the frame is supported by the Z-Wave module, sent, Ack'ed by the module and the corresponding Response frame has been received. SL_STATUS_NOT_SUPPORTED if the particular command is not supported by the Z-Wave API. SL_STATUS_FAIL if an error occurred.

Verifies that the command is supported by the Z-Wave module, sends the command data frame to the Z-Wave module, wait for ACK and a Response frame returning a status of the requested operation/command.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ zwave_api_protocol_init_callbacks()

void zwave_api_protocol_init_callbacks ( void  )

Initialize functions pointers for Z-Wave module callbacks.

These callbacks are handlers for incoming REQ frames from the Z-Wave module

Here is the caller graph for this function:

◆ zwave_api_protocol_rx_dispatch()

void zwave_api_protocol_rx_dispatch ( uint8_t *  pData,
uint16_t  len 
)

Execute a callback based on a received frame from the Z-Wave module.

Parameters
pDataPointer to data frame (without SOF)
lenLength of data frame
Note
Must only be called locally in the Z-Wave API module.

FIXME: We should really not treat those functions as a bulk and assume they return the same payload.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ zwapi_add_node_to_network_callback

void(* zwapi_add_node_to_network_callback) (struct LEARN_INFO *) ( struct LEARN_INFO )
extern

◆ zwapi_assign_return_route_callback

void(* zwapi_assign_return_route_callback) (uint8_t bStatus) ( uint8_t  bStatus)
extern

◆ zwapi_assign_suc_return_route_callback

void(* zwapi_assign_suc_return_route_callback) (uint8_t bStatus) ( uint8_t  bStatus)
extern

◆ zwapi_create_new_primarly_ctrl_callback

void(* zwapi_create_new_primarly_ctrl_callback) (struct LEARN_INFO *) ( struct LEARN_INFO )
extern

◆ zwapi_delete_return_route_callback

void(* zwapi_delete_return_route_callback) (uint8_t bStatus) ( uint8_t  bStatus)
extern

◆ zwapi_delete_suc_return_route_callback

void(* zwapi_delete_suc_return_route_callback) (uint8_t bStatus) ( uint8_t  bStatus)
extern

◆ zwapi_memory_put_buffer_callback

void(* zwapi_memory_put_buffer_callback) (void) ( void  )
extern

◆ zwapi_remove_failed_node_callback

void(* zwapi_remove_failed_node_callback) (uint8_t txStatus) ( uint8_t  txStatus)
extern

◆ zwapi_remove_node_from_network_callback

void(* zwapi_remove_node_from_network_callback) (struct LEARN_INFO *) ( struct LEARN_INFO )
extern

◆ zwapi_replace_failed_node_callback

void(* zwapi_replace_failed_node_callback) (uint8_t txStatus) ( uint8_t  txStatus)
extern

◆ zwapi_request_neighbor_update_callback

void(* zwapi_request_neighbor_update_callback) (uint8_t bStatus) ( uint8_t  bStatus)
extern

◆ zwapi_request_network_update_callback

void(* zwapi_request_network_update_callback) (uint8_t txStatus) ( uint8_t  txStatus)
extern

◆ zwapi_send_controller_replication_callback

void(* zwapi_send_controller_replication_callback) (uint8_t txStatus) ( uint8_t  txStatus)
extern

◆ zwapi_send_data_bridge_callback

void(* zwapi_send_data_bridge_callback) (uint8_t, zwapi_tx_report_t *) ( uint8_t  ,
zwapi_tx_report_t  
)
extern

◆ zwapi_send_data_callback

void(* zwapi_send_data_callback) (uint8_t, zwapi_tx_report_t *) ( uint8_t  ,
zwapi_tx_report_t  
)
extern

Serial API response frame callbacks

◆ zwapi_send_data_multi_bridge_callback

void(* zwapi_send_data_multi_bridge_callback) (uint8_t) ( uint8_t  )
extern

◆ zwapi_send_data_multi_callback

void(* zwapi_send_data_multi_callback) (uint8_t) ( uint8_t  )
extern

◆ zwapi_send_node_information_callback

void(* zwapi_send_node_information_callback) (uint8_t txStatus) ( uint8_t  txStatus)
extern

◆ zwapi_send_nop_callback

void(* zwapi_send_nop_callback) (uint8_t, zwapi_tx_report_t *) ( uint8_t  ,
zwapi_tx_report_t  
)
extern

◆ zwapi_send_test_frame_callback

void(* zwapi_send_test_frame_callback) (uint8_t) ( uint8_t  )
extern

◆ zwapi_set_default_callback

void(* zwapi_set_default_callback) (void) ( void  )
extern

◆ zwapi_set_learn_mode_callback

void(* zwapi_set_learn_mode_callback) (struct LEARN_INFO *) ( struct LEARN_INFO )
extern

◆ zwapi_set_suc_node_id_callback

void(* zwapi_set_suc_node_id_callback) (uint8_t bStatus) ( uint8_t  bStatus)
extern

◆ zwapi_set_virtual_node_to_learn_mode_callback

void(* zwapi_set_virtual_node_to_learn_mode_callback) (uint8_t bStatus, zwave_node_id_t orgID, zwave_node_id_t newID) ( uint8_t  bStatus,
zwave_node_id_t  orgID,
zwave_node_id_t  newID 
)
extern

◆ zwapi_transfer_primary_ctrl_role_callback

void(* zwapi_transfer_primary_ctrl_role_callback) (struct LEARN_INFO *) ( struct LEARN_INFO )
extern