Z-Wave Protocol Controller Reference
zwapi_protocol_transport.h
Go to the documentation of this file.
1/******************************************************************************
2 * # License
3 * <b>Copyright 2021 Silicon Laboratories Inc. www.silabs.com</b>
4 ******************************************************************************
5 * The licensor of this software is Silicon Laboratories Inc. Your use of this
6 * software is governed by the terms of Silicon Labs Master Software License
7 * Agreement (MSLA) available at
8 * www.silabs.com/about-us/legal/master-software-license-agreement. This
9 * software is distributed to you in Source Code format and is governed by the
10 * sections of the MSLA applicable to Source Code.
11 *
12 *****************************************************************************/
13
19#ifndef ZWAPI_PROTOCOL_TRANSPORT_H
20#define ZWAPI_PROTOCOL_TRANSPORT_H
21
22#include <stdint.h>
23#include <stdbool.h>
24#include "sl_status.h"
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
52#define NODEPARM_MAX 35
53
57#define TRANSMIT_OPTION_ACK 0x01
59#define TRANSMIT_OPTION_LOW_POWER 0x02
61#define TRANSMIT_OPTION_MULTICAST_AS_BROADCAST 0x02
63#define TRANSMIT_OPTION_AUTO_ROUTE 0x04
65#define TRANSMIT_OPTION_NO_ROUTE 0x10
67#define TRANSMIT_OPTION_EXPLORE 0x20
69#define TRANSMIT_OPTION_MULTICAST 0x40
71
74#define TRANSMIT_EXPLORE_OPTION_ACK TRANSMIT_OPTION_ACK
75#define TRANSMIT_EXPLORE_OPTION_LOW_POWER TRANSMIT_OPTION_LOW_POWER
77
80#define TRANSMIT_OPTION_2_TRANSPORT_SERVICE 0x01
81#define TRANSMIT_OPTION_2_FOLLOWUP 0x08
83
87#define RECEIVE_STATUS_ROUTED_BUSY 0x01
90#define RECEIVE_STATUS_LOW_POWER 0x02
92#define RECEIVE_STATUS_TYPE_MASK 0x0C
94#define RECEIVE_STATUS_TYPE_SINGLE 0x00
96#define RECEIVE_STATUS_TYPE_BROAD 0x04
98#define RECEIVE_STATUS_TYPE_MULTI 0x08
101#define RECEIVE_STATUS_TYPE_EXPLORE 0x10
104#define RECEIVE_STATUS_FOREIGN_FRAME 0x40
107#define RECEIVE_STATUS_FOREIGN_HOMEID 0x80
109
112#define TRANSMIT_COMPLETE_OK 0x00
113#define TRANSMIT_COMPLETE_NO_ACK \
114 0x01
115#define TRANSMIT_COMPLETE_FAIL 0x02
116#define TRANSMIT_ROUTING_NOT_IDLE 0x03
118#define TRANSMIT_COMPLETE_NOROUTE 0x04
119#define TRANSMIT_COMPLETE_VERIFIED 0x05
121
125#define ZW_ROUTE_LOST_FAILED 0x04
126#define ZW_ROUTE_LOST_ACCEPT 0x05
128
129#ifdef ZW_ROUTING_DEMO
131#define TRANSMIT_ROUTED_ATTEMPT 0x08
132#endif /*ZW_ROUTING_DEMO*/
133
134#define ZW_MAX_CACHED_RETURN_ROUTE_DESTINATIONS 5
135
136#define ZW_RF_TEST_SIGNAL_CARRIER 0x00
137#define ZW_RF_TEST_SIGNAL_CARRIER_MODULATED 0x01
138
140#define MAX_REPEATERS 4
141
144#define LAST_USED_ROUTE_CONF_SIZE 1
145#define LAST_USED_ROUTE_SIZE (MAX_REPEATERS + LAST_USED_ROUTE_CONF_SIZE)
147
150#define LAST_USED_ROUTE_REPEATER_0_INDEX 0
151#define LAST_USED_ROUTE_REPEATER_1_INDEX 1
152#define LAST_USED_ROUTE_REPEATER_2_INDEX 2
153#define LAST_USED_ROUTE_REPEATER_3_INDEX 3
155
162#define RSSI_NOT_AVAILABLE 127
164#define RSSI_MAX_POWER_SATURATED 126
166#define RSSI_BELOW_SENSITIVITY 125
169#define RSSI_RESERVED_START 11
171
174struct rssi_val {
176};
177
178typedef struct _S_ROUTE_LINK_ {
179 uint8_t from;
180 uint8_t to;
182
183#define PROTOCOL_METADATA_LENGTH \
184 (sizeof(uint8_t) + sizeof(uint8_t) + sizeof(uint32_t) \
185 + sizeof(uint8_t))
186
187typedef struct _protocol_metadata_ {
191 uint8_t data_length;
193 uint8_t session_id;
197
199typedef enum _E_ROUTING_SCHEME_ {
205 = 4,
210
212typedef enum last_route_speed {
219
225typedef struct zwapi_tx_report {
232 // This field is used to indicate ythe RSSI value of the acknowledgement frame
233 int8_t ack_rssi;
235 // This field is used to indicate the channel number where the ACK received from.
237 // This field is used to indicate the channel number that is used to transmit the data.
241 // This field indicates if a 250ms beam was used to wake up the destination.
243 // This field indicates if a 1000ms beam was used to wake up the destination.
248 // This field is used to indicate the transmit power used for the transmission
249 // The value 127 MUST indicate that the value is not available
250 int8_t tx_power;
251 // This field is used to indicate the measured noise floor during the outgoing transmission.
253 // This field is used to advertise the Tx Power used by the destination in its Ack MPDU frame.
255 // This field is used to advertise the Tx Power used by the destination in its Ack MPDU frame.
257 // This field is used to indicate the measured RSSI of the acknowledgement frame received from the destination.
260
270
296 zwave_node_id_t source_node_id,
297 zwave_node_id_t destination_node_id,
298 const uint8_t *data,
299 uint8_t data_length,
300 uint8_t tx_options,
301 void (*callback_function)(uint8_t, zwapi_tx_report_t *));
302
330 const uint8_t *data,
331 uint8_t data_length,
332 uint8_t tx_options,
333 void (*callback_function)(uint8_t,
335
353 zwave_node_id_t destination_node_id,
354 const uint8_t *data,
355 uint8_t data_length,
356 void *metadata,
357 void (*callback_function)(uint8_t, zwapi_tx_report_t *));
358
370
389 const uint8_t *data,
390 uint8_t data_length,
391 uint8_t tx_options,
392 void (*callback_function)(uint8_t tx_status));
393
415 zwave_nodemask_t destination_node_mask,
416 const uint8_t *data,
417 uint8_t data_length,
418 uint8_t tx_options,
419 void (*callback_function)(uint8_t tx_status));
420
430 uint8_t tx_options,
431 void (*callback_function)(uint8_t,
433
435
436#ifdef __cplusplus
437}
438#endif
439
440#endif // ZWAPI_PROTOCOL_TRANSPORT_H
#define PROTOCOL_METADATA_LENGTH
rf_speed | tx_power | tx_options | callback_id
Definition: zwapi_protocol_transport.h:183
sl_status_t zwapi_send_data_multi(zwave_nodemask_t destination_node_mask, const uint8_t *data, uint8_t data_length, uint8_t tx_options, void(*callback_function)(uint8_t tx_status))
Send data to a list of Z-Wave Nodes (multicast frame).
Definition: zwapi_protocol_transport.c:141
sl_status_t zwapi_send_nop(zwave_node_id_t destination, uint8_t tx_options, void(*callback_function)(uint8_t, zwapi_tx_report_t *))
Sends a NOP to a NodeID destination.
Definition: zwapi_protocol_transport.c:306
#define MAX_REPEATERS
Max hops in route.
Definition: zwapi_protocol_transport.h:140
sl_status_t zwapi_send_data_bridge(zwave_node_id_t source_node_id, zwave_node_id_t destination_node_id, const uint8_t *data, uint8_t data_length, uint8_t tx_options, void(*callback_function)(uint8_t, zwapi_tx_report_t *))
Transmit data buffer to a single ZW-node or all ZW-nodes (broadcast) in bridge mode.
Definition: zwapi_protocol_transport.c:93
_E_ROUTING_SCHEME_
Transport routing scheme state define definitions.
Definition: zwapi_protocol_transport.h:199
enum _E_ROUTING_SCHEME_ e_routing_scheme_t
Transport routing scheme state define definitions.
sl_status_t zwapi_send_data(zwave_node_id_t destination_node_id, const uint8_t *data, uint8_t data_length, uint8_t tx_options, void(*callback_function)(uint8_t, zwapi_tx_report_t *))
Send data to a Z-Wave node or to the broadcast destination.
Definition: zwapi_protocol_transport.c:202
last_route_speed
List of possible link speeds / protocols.
Definition: zwapi_protocol_transport.h:212
struct zwapi_tx_report zwapi_tx_report_t
Detailed report and data about Z-Wave transmissions.
struct _protocol_metadata_ protocol_metadata_t
sl_status_t zwapi_lock_route(bool lock)
Lock and unlock a response route for a specific node.
Definition: zwapi_protocol_transport.c:85
sl_status_t zwapi_send_data_multi_bridge(zwave_node_id_t source_node_id, zwave_nodemask_t destination_node_mask, const uint8_t *data, uint8_t data_length, uint8_t tx_options, void(*callback_function)(uint8_t tx_status))
Send data to a list of Z-Wave Nodes (multicast frame) in bridge mode.
Definition: zwapi_protocol_transport.c:31
enum last_route_speed last_route_speed_t
List of possible link speeds / protocols.
sl_status_t zwapi_abort_send_data(void)
Abort the ongoing transmit started with zwapi_send_data() or zwapi_send_data_bridge()
Definition: zwapi_protocol_transport.c:301
#define LAST_USED_ROUTE_SIZE
Definition: zwapi_protocol_transport.h:145
struct _S_ROUTE_LINK_ S_ROUTE_LINK
sl_status_t zwapi_send_protocol_data(zwave_node_id_t destination_node_id, const uint8_t *data, uint8_t data_length, void *metadata, void(*callback_function)(uint8_t, zwapi_tx_report_t *))
Send protocol data to a Z-Wave node.
Definition: zwapi_protocol_transport.c:255
@ ROUTINGSCHEME_ROUTE
ReturnRoute/controllerAutoRoute.
Definition: zwapi_protocol_transport.h:206
@ ROUTINGSCHEME_CACHED_ROUTE_NLWR
Next to LastWorkingRoute(controller)
Definition: zwapi_protocol_transport.h:204
@ ROUTINGSCHEME_RESORT_EXPLORE
Explore.
Definition: zwapi_protocol_transport.h:208
@ ROUTINGSCHEME_CACHED_ROUTE_SR
ApplicationStaticRoute.
Definition: zwapi_protocol_transport.h:202
@ ROUTINGSCHEME_RESORT_DIRECT
directResort
Definition: zwapi_protocol_transport.h:207
@ ROUTINGSCHEME_DIRECT
Direct.
Definition: zwapi_protocol_transport.h:201
@ ROUTINGSCHEME_IDLE
Definition: zwapi_protocol_transport.h:200
@ ROUTINGSCHEME_CACHED_ROUTE
ResponseRoute/lastworkingRoute.
Definition: zwapi_protocol_transport.h:203
@ ZWAVE_100_KBITS_S
Z-Wave 100 kbits/s.
Definition: zwapi_protocol_transport.h:216
@ ZWAVE_40_KBITS_S
Z-Wave 40 kbits/s.
Definition: zwapi_protocol_transport.h:215
@ UNKNOWN_SPEED
Definition: zwapi_protocol_transport.h:213
@ ZWAVE_9_6_KBITS_S
Z-Wave 9.6 kbits/s.
Definition: zwapi_protocol_transport.h:214
@ ZWAVE_LONG_RANGE_100_KBITS_S
Z-Wave Long Range 100 kbits/s.
Definition: zwapi_protocol_transport.h:217
uint32_t sl_status_t
Definition: sl_status.h:139
uint8_t zwave_nodemask_t[ZW_LR_MAX_NODEMASK_LENGTH]
Node mask.
Definition: zwave_node_id_definitions.h:81
uint16_t zwave_node_id_t
Z-Wave NodeID type.
Definition: zwave_node_id_definitions.h:84
SL Status Codes.
Definition: zwapi_protocol_transport.h:187
void * tx_session_id
Basically to save TX session ID further on because user context was mistakenly used to transport this...
Definition: zwapi_protocol_transport.h:195
uint8_t data[PROTOCOL_METADATA_LENGTH]
Data buffer.
Definition: zwapi_protocol_transport.h:189
uint8_t data_length
Length of the data in the data buffer.
Definition: zwapi_protocol_transport.h:191
uint8_t session_id
Should not be part of protocol metadata but it is actually until properly implemented for FUNC_ID_ZW_...
Definition: zwapi_protocol_transport.h:193
Definition: zwapi_protocol_transport.h:174
int8_t incoming[MAX_REPEATERS+1]
Definition: zwapi_protocol_transport.h:175
Detailed report and data about Z-Wave transmissions.
Definition: zwapi_protocol_transport.h:225
int8_t measured_noise_floor
Definition: zwapi_protocol_transport.h:252
uint8_t tx_channel_number
Definition: zwapi_protocol_transport.h:238
uint8_t ack_channel_number
Definition: zwapi_protocol_transport.h:236
int8_t destination_ack_mpdu_tx_power
Definition: zwapi_protocol_transport.h:254
e_routing_scheme_t route_scheme_state
Definition: zwapi_protocol_transport.h:239
struct rssi_val rssi_values
Definition: zwapi_protocol_transport.h:234
int8_t destination_ack_mpdu_measured_noise_floor
Definition: zwapi_protocol_transport.h:258
uint16_t transmit_ticks
< Passed 10 ms ticks
Definition: zwapi_protocol_transport.h:227
int8_t ack_rssi
Definition: zwapi_protocol_transport.h:233
S_ROUTE_LINK last_failed_link
Definition: zwapi_protocol_transport.h:247
bool beam_250ms
Definition: zwapi_protocol_transport.h:242
int8_t tx_power
Definition: zwapi_protocol_transport.h:250
bool beam_1000ms
Definition: zwapi_protocol_transport.h:244
uint8_t routing_attempts
Definition: zwapi_protocol_transport.h:246
uint8_t last_route_repeaters[LAST_USED_ROUTE_SIZE]
Definition: zwapi_protocol_transport.h:240
uint8_t number_of_repeaters
Definition: zwapi_protocol_transport.h:231
last_route_speed_t last_route_speed
Definition: zwapi_protocol_transport.h:245
int8_t destination_ack_mpdu_measured_rssi
Definition: zwapi_protocol_transport.h:256
protocol_metadata_t metadata
Definition: zwave_command_class_protocol.c:42