nRF5 SDK for Mesh v5.0.0
serial_cmd_rsp.h
1 /* Copyright (c) 2010 - 2020, Nordic Semiconductor ASA
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without modification,
5  * are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright notice, this
8  * list of conditions and the following disclaimer.
9  *
10  * 2. Redistributions in binary form, except as embedded into a Nordic
11  * Semiconductor ASA integrated circuit in a product or a software update for
12  * such product, must reproduce the above copyright notice, this list of
13  * conditions and the following disclaimer in the documentation and/or other
14  * materials provided with the distribution.
15  *
16  * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
17  * contributors may be used to endorse or promote products derived from this
18  * software without specific prior written permission.
19  *
20  * 4. This software, with or without modification, must only be used with a
21  * Nordic Semiconductor ASA integrated circuit.
22  *
23  * 5. Any software provided in binary form under this license must not be reverse
24  * engineered, decompiled, modified and/or disassembled.
25  *
26  * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
27  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
28  * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
29  * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
30  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
32  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
35  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 #ifndef SERIAL_CMD_RSP_H__
39 #define SERIAL_CMD_RSP_H__
40 
41 #include <stdint.h>
42 
43 #include "nrf_mesh_defines.h"
44 #include "nrf_mesh_dfu_types.h"
45 #include "nrf_mesh_serial.h"
46 #include "nrf_mesh_prov.h"
47 #include "access.h"
48 #include "device_state_manager.h"
49 
50 
58 #define SERIAL_EVT_CMD_RSP_OVERHEAD (2)
59 
60 #define SERIAL_EVT_CMD_RSP_LEN_OVERHEAD (NRF_MESH_SERIAL_PACKET_OVERHEAD + SERIAL_EVT_CMD_RSP_OVERHEAD)
61 
62 #define SERIAL_EVT_CMD_RSP_DATA_MAXLEN (NRF_MESH_SERIAL_PAYLOAD_MAXLEN - SERIAL_EVT_CMD_RSP_OVERHEAD)
63 
64 /*lint -align_max(push) -align_max(1) */
65 
67 typedef struct __attribute((packed))
68 {
69  uint32_t alloc_fail_count;
71 
73 typedef struct __attribute((packed))
74 {
75  uint16_t subnet_handle;
77 
79 typedef struct __attribute((packed))
80 {
81  uint16_t subnet_key_index[SERIAL_EVT_CMD_RSP_DATA_MAXLEN / sizeof(uint16_t)];
83 
85 typedef struct __attribute((packed))
86 {
87  uint16_t appkey_handle;
89 
91 typedef struct __attribute((packed))
92 {
93  uint16_t subnet_handle;
94  uint16_t appkey_key_index[(SERIAL_EVT_CMD_RSP_DATA_MAXLEN - sizeof(uint16_t)) / sizeof(uint16_t)];
96 
98 typedef struct __attribute((packed))
99 {
100  uint16_t devkey_handle;
102 
104 typedef struct __attribute((packed))
105 {
106  uint16_t address_handle;
108 
110 typedef struct __attribute((packed))
111 {
112  uint16_t address_start;
113  uint16_t count;
115 
117 typedef struct __attribute((packed))
118 {
119  uint16_t address_handle;
120  uint8_t addr_type;
121  uint8_t subscribed;
122  uint16_t raw_short_addr;
123  uint8_t virtual_uuid[NRF_MESH_UUID_SIZE];
125 
127 typedef struct __attribute((packed))
128 {
129  uint16_t address_handles[SERIAL_EVT_CMD_RSP_DATA_MAXLEN / sizeof(uint16_t)];
131 
133 typedef struct __attribute((packed))
134 {
135  uint16_t list_size;
137 
139 typedef struct __attribute((packed))
140 {
141  uint8_t context;
143 
145 typedef struct __attribute((packed))
146 {
147  uint16_t serial_ver;
149 
151 typedef struct __attribute((packed))
152 {
155 
157 typedef struct __attribute((packed))
158 {
159  uint8_t addr_type;
160  uint8_t addr[BLE_GAP_ADDR_LEN];
162 
166 typedef struct __attribute((packed))
167 {
168  uint8_t device_uuid[NRF_MESH_UUID_SIZE];
170 
171 
173 typedef struct __attribute((packed))
174 {
175  uint8_t tx_power;
177 
179 typedef struct __attribute((packed))
180 {
181  uint8_t beacon_slot;
182  uint8_t tx_power;
183  uint8_t channel_map;
184  uint32_t interval_ms;
186 
188 typedef struct __attribute((packed))
189 {
190  uint8_t dfu_type;
192  uint8_t is_signed;
193  uint32_t start_addr;
194  uint32_t length;
196 
198 typedef struct __attribute((packed))
199 {
200  uint8_t role;
201  uint8_t type;
203  uint8_t state;
204  uint8_t data_progress;
206 
208 typedef struct __attribute((packed))
209 {
212 
214 typedef struct __attribute((packed))
215 {
218 
220 typedef struct __attribute((packed))
221 {
222  uint8_t resolution;
223  uint8_t step_number;
225 
227 typedef struct __attribute((packed))
228 {
229  uint16_t count;
230  dsm_handle_t address_handles[(SERIAL_EVT_CMD_RSP_DATA_MAXLEN-sizeof(uint16_t)) / sizeof(dsm_handle_t)];
232 
234 typedef struct __attribute((packed))
235 {
236  uint16_t count;
237  dsm_handle_t appkey_handles[(SERIAL_EVT_CMD_RSP_DATA_MAXLEN-sizeof(uint16_t)) / sizeof(dsm_handle_t)];
239 
241 typedef struct __attribute((packed))
242 {
243  uint8_t ttl;
245 
247 typedef struct __attribute((packed))
248 {
249  uint16_t location;
251 
253 typedef struct __attribute((packed))
254 {
255  uint8_t model_count;
257 
259 typedef struct __attribute((packed))
260 {
263 
265 typedef struct __attribute((packed))
266 {
269 
271 typedef struct __attribute((packed))
272 {
273  uint16_t count;
274  access_model_handle_t model_handles[(SERIAL_EVT_CMD_RSP_DATA_MAXLEN-sizeof(uint16_t)) / sizeof(access_model_handle_t)];
276 
278 typedef struct __attribute((packed))
279 {
280  uint16_t count;
281  access_model_id_t model_ids[(SERIAL_EVT_CMD_RSP_DATA_MAXLEN-sizeof(uint16_t)) / sizeof(access_model_id_t)];
283 
285 typedef struct __attribute((packed))
286 {
289 
291 typedef struct __attribute((packed))
292 {
293  uint8_t data_len;
294  uint8_t data[SERIAL_EVT_CMD_RSP_DATA_MAXLEN - sizeof(uint8_t)];
296 
298 typedef struct __attribute((packed))
299 {
302 
304 typedef struct __attribute((packed))
305 {
306  uint32_t iv_index;
309  uint32_t next_seqnum_block;
311 
313 typedef struct __attribute((packed))
314 {
315  uint8_t opcode;
316  uint8_t status;
317  union __attribute((packed))
318  {
352  } data;
354 
355 /*lint -align_max(pop) */
356 
359 #endif /* SERIAL_CMD_RSP_H__ */
uint8_t status
Return status of the serial command.
Address access response data.
serial_evt_cmd_rsp_data_model_pub_app_get_t pub_app
Model publish application key.
Command response data with firmware info.
uint16_t address_handle
Address handle operated on.
uint16_t access_model_handle_t
Access layer handle type.
Definition: access.h:162
serial_evt_cmd_rsp_data_housekeeping_t hk_data
Housekeeping data response.
uint8_t role
This device&#39;s intended role in the transfer, see nrf_mesh_dfu_role_t for accepted values...
serial_evt_cmd_rsp_data_dfu_bank_info_t dfu_bank_info
Bank information.
uint8_t opcode
Opcode of original command.
Beacon parameter command response.
Application key access response data.
uint16_t count
Number of available handles in model_ids.
uint16_t iv_update_timeout_counter
Current value of timeout counter for IV update.
Raw address access response data.
Command response to SERIAL_OPCODE_CMD_ACCESS_MODEL_APP_GET with application key handles.
Command response data with the model count.
serial_evt_cmd_rsp_data_model_id_get_t model_id
Company and model IDs.
uint8_t beacon_slot
Slot number of the beacon to start.
Subnetwork list response data.
uint8_t dfu_type
DFU type of the bank.
uint8_t tx_power
TX Power value, must be a value from serial_cmd_tx_power_value_t.
#define NRF_MESH_UUID_SIZE
Size (in octets) of a UUID.
uint16_t raw_short_addr
Raw representation of the address.
serial_evt_cmd_rsp_data_model_init_t model_init
Reserved handle for the initialized model instance.
uint32_t alloc_fail_count
Number of failed serial packet allocations.
serial_evt_cmd_rsp_data_models_get_t model_ids
All the available models.
uint16_t address_start
First address in the range of unicast addresses.
Command response data with a list size.
uint16_t appkey_handle
Application key handle operated on.
serial_evt_cmd_rsp_data_model_pub_period_get_t pub_period
Model publish period.
Command response to SERIAL_OPCODE_CMD_MESH_PACKET_SEND with information about the sent packet...
nrf_mesh_tx_token_t token
TX Token assigned to the packet.
serial_evt_cmd_rsp_data_elem_model_count_get_t model_count
Number of models in the element.
uint16_t location
Element location info.
uint32_t start_addr
Start address of the bank.
Command response to SERIAL_OPCODE_CMD_MODEL_SPECIFIC_INIT with the reserved model handle...
uint32_t interval_ms
TX interval in milliseconds.
serial_evt_cmd_rsp_data_subnet_list_t subnet_list
List of all subnet key indexes.
serial_evt_cmd_rsp_data_beacon_params_t beacon_params
Beacon parameters.
Command response data with dfu state.
uint16_t dsm_handle_t
DSM handle type, used for the handles returned for the each set of data added.
serial_evt_cmd_rsp_data_model_handle_get_t model_handle
Handle for the model.
uint16_t list_size
Size of the list requested by the command.
serial_evt_cmd_rsp_data_devkey_t devkey
Devkey response.
uint8_t context
Provisioning context ID.
Subnetwork access response data.
uint16_t devkey_handle
Device key handle operated on.
Command response data with TX power.
Command response data with dfu bank information.
uint8_t is_signed
Flag indicating whether the bank is signed with an encryption key.
uint16_t count
Number of available handles in appkey_handles.
Command response packet.
Command response to SERIAL_OPCODE_CMD_MODEL_SPECIFIC_COMMAND from the model addressed.
nrf_mesh_fwid_t fwid
Firmware ID data.
uint8_t resolution
Resolution of each step.
dsm_handle_t addr_handle
Address handle for the publish address.
Command response data with version information.
serial_evt_cmd_rsp_data_device_uuid_t device_uuid
Device UUID.
uint16_t count
Number of addresses in the range of unicast addresses.
uint16_t count
Number of available handles in address_handles.
serial_evt_cmd_rsp_data_appkey_list_t appkey_list
List of all appkey key indexes for a given subnetwork.
Command response to SERIAL_OPCODE_CMD_MODEL_SPECIFIC_MODELS_GET with available model IDs...
Command response data with the element location info.
uint8_t ttl
TTL for published messages.
#define SERIAL_EVT_CMD_RSP_DATA_MAXLEN
Max length of the command response data field.
uint8_t addr_type
Address type of the given address.
Command response data with the publish ttl value.
uint8_t step_number
Number of steps in each period.
serial_evt_cmd_rsp_data_model_subs_get_t model_subs
Model subscription list.
serial_evt_cmd_rsp_data_elem_loc_get_t elem_loc
Element location.
uint32_t length
Length of the firmware in the bank.
uint16_t address_handle
Address handle requested.
Device UUID command response.
Application key list response data.
serial_evt_cmd_rsp_data_adv_addr_t adv_addr
Advertisement address.
uint16_t count
Number of available handles in model_handles.
access_model_id_t model_id
Company and model IDs.
serial_evt_cmd_rsp_data_net_state_get_t net_state_get
Net state.
access_model_handle_t model_handle
Handle of the requested model.
uint16_t serial_ver
Serial interface version.
Command response data with the model id.
Command response data with publish period information.
serial_evt_cmd_rsp_data_addr_t addr
Address response.
Command response to SERIAL_OPCODE_CMD_MESH_NET_STATE_GET with the current net state.
uint32_t nrf_mesh_tx_token_t
TX Token type, used as a context parameter to notify the application of ended transmissions.
Definition: nrf_mesh.h:105
uint16_t subnet_handle
Handle of the Subnetwork associated with the application keys.
uint8_t iv_update_in_progress
Value indicating the phase of the IV update process.
serial_evt_cmd_rsp_data_model_pub_addr_get_t pub_addr
Model publish address.
uint8_t data_len
Length of data array.
Unicast address access response data.
uint8_t model_count
Number of existing models.
Command response data with address handle for the publish address.
uint16_t subnet_handle
Subnetwork handle operated on.
Serial interface housekeeping data.
dsm_handle_t appkey_handle
Handle of the application key used for publishing.
nrf_mesh_fwid_t fwid
Firmware ID of the bank.
access_model_handle_t model_handle
Handle of the initialized model.
Address handle list response data.
serial_evt_cmd_rsp_data_appkey_t appkey
Appkey response.
Command response data with context information.
Advertisement address command response.
serial_evt_cmd_rsp_data_subnet_t subnet
Subnet response.
uint8_t channel_map
Channel map bitfield for beacon, starting at channel 37.
Access layer model ID.
Definition: access.h:151
serial_evt_cmd_rsp_data_elem_models_get_t model_handles
Element&#39;s list of model handles.
uint8_t type
The DFU type of the transfer, see nrf_mesh_dfu_type_t for accepted values.
uint8_t addr_type
Advertisement address type.
uint8_t data_progress
The progress of the transfer in percent (0-100).
serial_evt_cmd_rsp_data_dfu_state_t dfu_state
DFU state.
Command response to SERIAL_OPCODE_CMD_ACCESS_MODEL_SUBS_GET command with subscription address handles...
serial_evt_cmd_rsp_data_firmware_info_t firmware_info
Firmware information.
uint32_t next_seqnum_block
The start of the next unused sequence number block.
ID of a standalone firmware segment.
uint8_t subscribed
Flag indicating whether the given address is subscribed to or not.
serial_evt_cmd_rsp_data_prov_ctx_t prov_ctx
Provisioning context.
nrf_mesh_fwid_t fwid
The FWID of the new data in the transfer.
serial_evt_cmd_rsp_data_addr_local_unicast_t local_unicast
Local unicast addresses.
serial_evt_cmd_rsp_data_serial_version_t serial_version
Serial version.
uint8_t tx_power
TX Power value, must be a value from serial_cmd_tx_power_value_t.
Command response data with appkey handle of the application key used for publishing.
Command response to SERIAL_OPCODE_CMD_ACCESS_MODEL_APP_GET with application key handles.
Command response data with the model handle.
serial_evt_cmd_rsp_data_list_size_t list_size
List size.
serial_evt_cmd_rsp_data_model_pub_ttl_get_t pub_ttl
Model publish ttl value.
uint8_t state
The current global state of the transfer, see nrf_mesh_dfu_state_t for accepted values.
serial_evt_cmd_rsp_data_model_apps_get_t model_pub
Model application keys list.
serial_evt_cmd_rsp_data_packet_send_t packet_send
Information about the sent packet.
Device key access response data.
uint32_t iv_index
The current IV index.

Documentation feedback | Developer Zone | Subscribe | Updated