nRF5 SDK for Mesh v1.0.1
nrf_mesh_events.h
1 /* Copyright (c) 2010 - 2017, 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 MESH_EVT_H__
39 #define MESH_EVT_H__
40 
41 #include <stdbool.h>
42 #include "nrf_mesh.h"
43 #include "nrf_mesh_dfu_types.h"
44 
55 typedef enum
56 {
88 
92 typedef struct
93 {
95  const uint8_t * p_buffer;
97  uint16_t length;
105  uint8_t ttl;
109 
113 typedef struct
114 {
118  uint32_t iv_index;
120 
124 typedef struct
125 {
126  uint16_t subnet_index;
129 
136 typedef struct
137 {
139  uint8_t init_ttl;
141  uint8_t hops;
143  uint16_t features;
146  uint16_t src;
148 
152 typedef struct
153 {
157 
159 typedef union
160 {
162  struct
163  {
166  } fw_outdated;
168  struct
169  {
170  nrf_mesh_dfu_transfer_t transfer;
171  uint8_t authority;
172  } req_relay;
174  struct
175  {
177  } req_source;
179  struct
180  {
182  nrf_mesh_dfu_transfer_t transfer;
183  } start;
185  struct
186  {
187  nrf_mesh_dfu_role_t role;
188  nrf_mesh_dfu_transfer_t transfer;
190  } end;
192  struct
193  {
194  nrf_mesh_dfu_transfer_t transfer;
195  uint32_t* p_start_addr;
196  uint32_t length;
197  bool is_signed;
198  } bank;
200 
204 typedef enum
205 {
209 
213 typedef struct
214 {
216  uint16_t src;
218  uint8_t ivi : 1;
222 
226 typedef enum
227 {
239 
243 typedef struct
244 {
250 
254 typedef enum
255 {
263 
264 typedef struct
265 {
269  const void * p_flash_entry;
271  void * p_flash_page;
273  const void * p_area;
275  uint32_t page_count;
277 
281 typedef struct
282 {
285 
287  union {
298 
307  } params;
309 
320 typedef void (*nrf_mesh_evt_handler_cb_t)(const nrf_mesh_evt_t * p_evt);
321 
327 typedef struct
328 {
332  void * p_next;
334 
342 void nrf_mesh_evt_handler_add(nrf_mesh_evt_handler_t * p_handler_params);
343 
349 void nrf_mesh_evt_handler_remove(nrf_mesh_evt_handler_t * p_handler_params);
350 
353 #endif /* MESH_EVT_H__ */
354 
nrf_mesh_evt_sar_failed_t sar_failed
SAR failed event.
DFU transfer ended.
DFU transfer information structure.
nrf_mesh_evt_dfu_t dfu
DFU event.
RX packet metadata.
Definition: nrf_mesh.h:123
IV update event structure.
nrf_mesh_dfu_role_t role
The device&#39;s role in the transfer.
net_state_iv_update_t state
Current IV update state.
nrf_mesh_fwid_t current
FWID union containing the current firmware ID of the given type.
nrf_mesh_evt_type_t
Mesh event types.
nrf_mesh_evt_key_refresh_notification_t key_refresh
Key refresh notification event.
void nrf_mesh_evt_handler_add(nrf_mesh_evt_handler_t *p_handler_params)
Registers an event handler to get events from the core stack.
The device firmware is outdated, according to a trusted source.
The replay protection cache is full.
nrf_mesh_tx_token_t token
Packet ID of the SAR session.
Transmission completed.
A heartbeat message has been received.
Mesh event structure.
Flash has malfunctioned.
void * p_next
Pointer to next handler in linked list.
nrf_mesh_rx_failed_reason_t
RX failure reason codes.
nrf_mesh_dfu_role_t
The various roles a device can play in a dfu transfer.
nrf_mesh_dfu_end_t
Reasons for a DFU operation to end.
Mesh core flash user.
nrf_mesh_tx_token_t token
Packet identifier.
RX failed event structure.
uint16_t features
Feature&#39;s state bitmap.
void * p_flash_page
The address of the flash page the attempted operation failed.
nrf_mesh_dfu_end_t end_reason
Reason for the end event.
The device firmware is outdated, according to an un-authenticated source.
nrf_mesh_evt_hb_message_t hb_message
HB message received/sent event.
uint8_t authority
Authority level of the transfer.
nrf_mesh_sar_session_cancel_reason_t
SAR session cancelled reason codes.
DFU event parameters.
Heartbeat received event structure.
void(* nrf_mesh_evt_handler_cb_t)(const nrf_mesh_evt_t *p_evt)
Mesh event handler callback type.
DFU request for this node to be the relay of a transfer.
SAR session failed.
SAR failed event structure.
nrf_mesh_evt_iv_update_notification_t iv_update
IV update notification event.
nrf_mesh_dfu_type_t dfu_type
DFU type and firmware ID of the transfer.
nrf_mesh_evt_handler_cb_t evt_cb
Callback function pointer.
Bluetooth Mesh security material structure.
Definition: nrf_mesh.h:328
nrf_mesh_flash_user_module_t
User tokens for the flash manager.
uint32_t length
Length of the firmware in the bank.
A message has been received.
An IV update event occurred.
Key refresh notification structure.
uint8_t ttl
Time-to-live for the message, this is a 7-bit value.
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:79
nrf_mesh_address_t src
Source address of the message.
uint32_t page_count
The number of pages given to the flash manager of the module reporting the event. ...
nrf_mesh_dfu_transfer_t transfer
DFU type and firmware ID of the transfer.
uint16_t src
Unicast address of the sender.
void nrf_mesh_evt_handler_remove(nrf_mesh_evt_handler_t *p_handler_params)
Removes an event handler.
nrf_mesh_evt_type_t type
Type of event.
nrf_mesh_key_refresh_phase_t
Key refresh phase.
Definition: nrf_mesh.h:183
The transport SAR session TX retry limit was exceeded.
const void * p_flash_entry
The flash entry that has failed.
nrf_mesh_address_t dst
Destination address of the message.
Mesh event handler context structure.
const void * p_area
The start of area owned by the flash manager of the module reporting the event.
uint8_t hops
Calculated hop value.
Transmission complete event structure.
The transport SAR session timed out.
A key refresh event occurred.
bool is_signed
Flag indicating whether the bank is signed with an encryption key.
nrf_mesh_rx_failed_reason_t reason
Reason for the rx failure.
nrf_mesh_secmat_t secmat
Security material used in the decryption of the payload.
DFU transfer starting.
Bluetooth Mesh address.
Definition: nrf_mesh.h:370
nrf_mesh_evt_message_t message
Incoming message.
uint8_t init_ttl
Initial TTL value used for sending this heartbeat message.
uint32_t iv_index
IV index currently used for sending messages.
Device state manager flash user.
nrf_mesh_evt_rx_failed_t rx_failed
RX failed.
uint16_t src
Metadata for the received packet.
DFU request for this node to be the source of a transfer.
nrf_mesh_evt_flash_failed_t flash_failed
Flash failed event.
nrf_mesh_evt_tx_complete_t tx_complete
Transmission complete.
The peer has cancelled the SAR session.
Message received event structure.
const nrf_mesh_rx_metadata_t * p_metadata
Metadata for the received packet.
uint16_t length
Message length.
ID of a standalone firmware segment.
Access layer flash user.
nrf_mesh_sar_session_cancel_reason_t reason
Reason for closing the session.
const uint8_t * p_buffer
Buffer containing the message data.
net_state_iv_update_t
State of IV update procedure.
Definition: nrf_mesh.h:337
There were not enough resources to process the transport SAR session.
uint8_t ivi
IV index bit of the rx packet.
nrf_mesh_dfu_type_t
DFU transfer types.
uint32_t * p_start_addr
Start address of the bank.
nrf_mesh_flash_user_module_t user
The module the event is reported from.

Documentation feedback | Developer Zone | Subscribe | Updated