20#ifndef ZWAPI_CONNECTION_H
21#define ZWAPI_CONNECTION_H
30#define RX_ACK_TIMEOUT_DEFAULT 1500
31#define RX_BYTE_TIMEOUT_DEFAULT 1500
92 uint8_t cmd, uint8_t type,
const uint8_t *Buf, uint8_t len,
bool ack_needed);
110 int user_buffer_length);
int zwapi_connection_restart()
Closes and re-initializes the zwapi_connection to the Z-Wave module.
Definition: zwapi_connection.c:114
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 mai...
Definition: zwapi_connection.c:184
zwapi_connection_status_t
State of the connection to the Z-Wave module.
Definition: zwapi_connection.h:34
@ ZWAPI_CONNECTION_STATUS_TX_TIMEOUT
Tx timeout (waiting for ACK) has happened.
Definition: zwapi_connection.h:40
@ ZWAPI_CONNECTION_STATUS_FRAME_SENT
A frame was sent successfully and ACKed by the other end.
Definition: zwapi_connection.h:37
@ ZWAPI_CONNECTION_STATUS_IDLE
Nothing has happened (no tx, no rx)
Definition: zwapi_connection.h:35
@ ZWAPI_CONNECTION_STATUS_CHECKSUM_ERROR
A frame has an incorrect Checksum.
Definition: zwapi_connection.h:38
@ ZWAPI_CONNECTION_STATUS_TX_NAK
A frame was sent and the other end issued a NAK.
Definition: zwapi_connection.h:41
@ ZWAPI_CONNECTION_STATUS_RX_TIMEOUT
Rx timeout has happened.
Definition: zwapi_connection.h:39
@ ZWAPI_CONNECTION_STATUS_TX_CAN
A frame was sent and the other end issued a CAN, i.e. a collision occurred.
Definition: zwapi_connection.h:42
@ ZWAPI_CONNECTION_STATUS_FRAME_RECEIVED
A valid frame has been received.
Definition: zwapi_connection.h:36
const char * zwapi_connection_status_to_string(zwapi_connection_status_t t)
make the zwapi_connection_status types human readable.
Definition: zwapi_connection.c:314
int zwapi_connection_init(const char *serial_port)
Initialize the zwapi_connection to the Z-Wave module.
Definition: zwapi_connection.c:91
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.
Definition: zwapi_connection.c:301
void zwapi_connection_shutdown()
Close the zwapi_connection to the Z-Wave module.
Definition: zwapi_connection.c:109
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.
Definition: zwapi_connection.c:134
Private definitions for the Z-Wave API.