|
Z-Wave Protocol Controller Reference
|
#include <assert.h>#include <string.h>#include "zwapi_connection.h"#include "zwapi_serial.h"#include "zwapi_timestamp.h"#include "sl_log.h"Macros | |
| #define | SOF 0x01 /* Start Of Frame */ |
| #define | ACK 0x06 /* Acknowledge successfull frame reception */ |
| #define | NAK 0x15 /* Not Acknowledge successfull frame reception - please retransmit... */ |
| #define | CAN 0x18 /* Frame received (from host) was dropped - waiting for ACK */ |
| #define | STATE_SOF_HUNT 0 |
| #define | STATE_PARSE_FRAME 1 |
| #define | LOG_TAG "zwapi_connection" |
Functions | |
| static const char * | zwapi_frame_to_string (const uint8_t *buffer, uint16_t buffer_length) |
| int | zwapi_connection_init (const char *serial_port) |
| Initialize the zwapi_connection to the Z-Wave module. More... | |
| void | zwapi_connection_shutdown () |
| Close the zwapi_connection to the Z-Wave module. More... | |
| int | zwapi_connection_restart () |
| Closes and re-initializes the zwapi_connection to the Z-Wave module. More... | |
| void | zwapi_connection_tx (uint8_t cmd, uint8_t type, const uint8_t *Buf, uint8_t len, bool ack_needed) |
| Transmit a frame via serial port by adding SOF, Len, Type, cmd and Checksum. More... | |
| zwapi_connection_status_t | zwapi_connection_refresh () |
| Parses serial data sent from the Z-Wave module to the serial port. Should be frequently called by main loop. More... | |
| int | zwapi_connection_get_last_rx_frame (uint8_t *user_buffer, int user_buffer_length) |
| Provides the data of the serial buffer for the last received frame. More... | |
| const char * | zwapi_connection_status_to_string (zwapi_connection_status_t t) |
| make the zwapi_connection_status types human readable. More... | |
Variables | |
| static uint8_t | rx_buffer [FRAME_LENGTH_MAX] |
| static uint8_t | rx_buffer_length |
| static uint8_t | zwapi_connection_state |
| static zwapi_timestamp_t | timeOutACK |
| static zwapi_timestamp_t | timeOutRX |
| static bool | ack_nak_needed = false |
| #define ACK 0x06 /* Acknowledge successfull frame reception */ |
| #define CAN 0x18 /* Frame received (from host) was dropped - waiting for ACK */ |
| #define LOG_TAG "zwapi_connection" |
| #define NAK 0x15 /* Not Acknowledge successfull frame reception - please retransmit... */ |
| #define SOF 0x01 /* Start Of Frame */ |
| #define STATE_PARSE_FRAME 1 |
| #define STATE_SOF_HUNT 0 |
| int zwapi_connection_get_last_rx_frame | ( | uint8_t * | user_buffer, |
| int | user_buffer_length | ||
| ) |
Provides the data of the serial buffer for the last received frame.
| user_buffer | a pointer to the user buffer in which the frame is to be copied |
| user_buffer_length | The length of the user buffer |
| int zwapi_connection_init | ( | const char * | serial_port | ) |
Initialize the zwapi_connection to the Z-Wave module.
| serial_port | String representing the serial device path |
aka ConInit
| zwapi_connection_status_t zwapi_connection_refresh | ( | ) |
Parses serial data sent from the Z-Wave module to the serial port. Should be frequently called by main loop.
aka ConUpdate
| int zwapi_connection_restart | ( | ) |
Closes and re-initializes the zwapi_connection to the Z-Wave module.
| void zwapi_connection_shutdown | ( | ) |
Close the zwapi_connection to the Z-Wave module.
aka ConDestroy
| const char * zwapi_connection_status_to_string | ( | zwapi_connection_status_t | t | ) |
make the zwapi_connection_status types human readable.
aka ConTypeToStr
| void zwapi_connection_tx | ( | uint8_t | cmd, |
| uint8_t | type, | ||
| const uint8_t * | Buf, | ||
| uint8_t | len, | ||
| bool | ack_needed | ||
| ) |
Transmit a frame via serial port by adding SOF, Len, Type, cmd and Checksum.
| cmd | The command to be executed by the Z-Wave module, using FUNC_ID defines |
| type | The type of frame, either Request 0x00 or Response 0x01 |
| Buf | A pointer to the command payload buffer |
| len | The length of the data contained in the payload buffer |
| ack_needed | true if we expect an Ack back for this frame. |
A frame on the serial line consist of: SOF-Len-Type-Cmd-DATA-Chksum, where:
aka ConTxFrame
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |