nRF5 SDK for Mesh v2.1.1
serial_cmd_rsp.h
1 /* Copyright (c) 2010 - 2018, 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  uint16_t subnet_handle;
71 
73 typedef struct __attribute((packed))
74 {
75  uint16_t subnet_key_index[SERIAL_EVT_CMD_RSP_DATA_MAXLEN / sizeof(uint16_t)];
77 
79 typedef struct __attribute((packed))
80 {
81  uint16_t appkey_handle;
83 
85 typedef struct __attribute((packed))
86 {
87  uint16_t subnet_handle;
88  uint16_t appkey_key_index[(SERIAL_EVT_CMD_RSP_DATA_MAXLEN - sizeof(uint16_t)) / sizeof(uint16_t)];
90 
92 typedef struct __attribute((packed))
93 {
94  uint16_t devkey_handle;
96 
98 typedef struct __attribute((packed))
99 {
100  uint16_t address_handle;
102 
104 typedef struct __attribute((packed))
105 {
106  uint16_t address_start;
107  uint16_t count;
109 
111 typedef struct __attribute((packed))
112 {
113  uint16_t address_handle;
114  uint8_t addr_type;
115  uint8_t subscribed;
116  uint16_t raw_short_addr;
117  uint8_t virtual_uuid[NRF_MESH_UUID_SIZE];
119 
121 typedef struct __attribute((packed))
122 {
123  uint16_t address_handles[SERIAL_EVT_CMD_RSP_DATA_MAXLEN / sizeof(uint16_t)];
125 
127 typedef struct __attribute((packed))
128 {
129  uint16_t list_size;
131 
133 typedef struct __attribute((packed))
134 {
135  uint8_t context;
137 
139 typedef struct __attribute((packed))
140 {
141  uint16_t serial_ver;
143 
145 typedef struct __attribute((packed))
146 {
149 
151 typedef struct __attribute((packed))
152 {
153  uint8_t addr_type;
154  uint8_t addr[BLE_GAP_ADDR_LEN];
156 
160 typedef struct __attribute((packed))
161 {
162  uint8_t device_uuid[NRF_MESH_UUID_SIZE];
164 
165 
167 typedef struct __attribute((packed))
168 {
169  uint8_t tx_power;
171 
173 typedef struct __attribute((packed))
174 {
175  uint8_t beacon_slot;
176  uint8_t tx_power;
177  uint8_t channel_map;
178  uint32_t interval_ms;
180 
182 typedef struct __attribute((packed))
183 {
184  uint8_t dfu_type;
186  uint8_t is_signed;
187  uint32_t start_addr;
188  uint32_t length;
190 
192 typedef struct __attribute((packed))
193 {
194  uint8_t role;
195  uint8_t type;
197  uint8_t state;
198  uint8_t data_progress;
200 
202 typedef struct __attribute((packed))
203 {
206 
208 typedef struct __attribute((packed))
209 {
212 
214 typedef struct __attribute((packed))
215 {
216  uint8_t resolution;
217  uint8_t step_number;
219 
221 typedef struct __attribute((packed))
222 {
223  uint16_t count;
224  dsm_handle_t address_handles[(SERIAL_EVT_CMD_RSP_DATA_MAXLEN-sizeof(uint16_t)) / sizeof(dsm_handle_t)];
226 
228 typedef struct __attribute((packed))
229 {
230  uint16_t count;
231  dsm_handle_t appkey_handles[(SERIAL_EVT_CMD_RSP_DATA_MAXLEN-sizeof(uint16_t)) / sizeof(dsm_handle_t)];
233 
235 typedef struct __attribute((packed))
236 {
237  uint8_t ttl;
239 
241 typedef struct __attribute((packed))
242 {
243  uint16_t location;
245 
247 typedef struct __attribute((packed))
248 {
249  uint8_t model_count;
251 
253 typedef struct __attribute((packed))
254 {
257 
259 typedef struct __attribute((packed))
260 {
263 
265 typedef struct __attribute((packed))
266 {
267  uint16_t count;
268  access_model_handle_t model_handles[(SERIAL_EVT_CMD_RSP_DATA_MAXLEN-sizeof(uint16_t)) / sizeof(access_model_handle_t)];
270 
272 typedef struct __attribute((packed))
273 {
274  uint16_t count;
275  access_model_id_t model_ids[(SERIAL_EVT_CMD_RSP_DATA_MAXLEN-sizeof(uint16_t)) / sizeof(access_model_id_t)];
277 
279 typedef struct __attribute((packed))
280 {
283 
285 typedef struct __attribute((packed))
286 {
287  uint8_t data_len;
288  uint8_t data[SERIAL_EVT_CMD_RSP_DATA_MAXLEN - sizeof(uint8_t)];
290 
292 typedef struct __attribute((packed))
293 {
294  uint8_t opcode;
295  uint8_t status;
296  union __attribute((packed))
297  {
328  } data;
330 
331 /*lint -align_max(pop) */
332 
335 #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
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.
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.
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.
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.
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.
uint16_t subnet_handle
Handle of the Subnetwork associated with the application keys.
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.
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.
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.
Device key access response data.

Documentation feedback | Developer Zone | Subscribe | Updated