nRF5 SDK for Mesh v5.0.0
nrf_mesh_events.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 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 #include "list.h"
45 #include "mesh_config.h"
46 #include "heartbeat.h"
47 #include "mesh_friendship_types.h"
48 
59 typedef enum
60 {
129 
133 typedef struct
134 {
136  const uint8_t * p_buffer;
138  uint16_t length;
146  uint8_t ttl;
150 
154 typedef struct
155 {
159  const uint8_t * p_network_id;
161  uint32_t iv_index;
163 
167 typedef struct
168 {
169  uint16_t subnet_index;
170  const uint8_t * p_network_id;
173 
177 typedef struct
178 {
182  const uint8_t * p_auth_value;
183  uint32_t iv_index;
184  struct
185  {
187  bool key_refresh;
188  } flags;
190 
196 typedef struct
197 {
199  uint8_t init_ttl;
201  uint8_t hops;
203  uint16_t features;
206  uint16_t src;
208 
210 typedef struct
211 {
213  const heartbeat_subscription_state_t * p_old;
215  const heartbeat_subscription_state_t * p_new;
217 
221 typedef struct
222 {
226  timestamp_t timestamp;
228 
230 typedef union
231 {
233  struct
234  {
237  } fw_outdated;
239  struct
240  {
241  nrf_mesh_dfu_transfer_t transfer;
242  uint8_t authority;
243  } req_relay;
245  struct
246  {
248  } req_source;
250  struct
251  {
253  nrf_mesh_dfu_transfer_t transfer;
254  } start;
256  struct
257  {
258  nrf_mesh_dfu_role_t role;
259  nrf_mesh_dfu_transfer_t transfer;
261  } end;
263  struct
264  {
265  nrf_mesh_dfu_transfer_t transfer;
266  const uint32_t * p_start_addr;
267  uint32_t length;
268  bool is_signed;
269  } bank;
271 
275 typedef enum
276 {
280 
284 typedef struct
285 {
287  uint16_t src;
289  uint8_t ivi : 1;
293 
297 typedef enum
298 {
318 
322 typedef struct
323 {
329 
333 typedef enum
334 {
342 
343 typedef struct
344 {
348  const void * p_flash_entry;
350  void * p_flash_page;
352  const void * p_area;
354  uint32_t page_count;
356 
357 typedef struct
358 {
361 
362 typedef struct
363 {
366  const void * p_data;
367  uint32_t data_len;
369 
370 typedef struct
371 {
373  uint16_t src;
375  struct
376  {
378  uint16_t friend_counter;
387  } offer;
393 
394 typedef struct
395 {
405  uint32_t iv_index;
407 
411 typedef enum
412 {
418 
419 typedef struct
420 {
424  uint16_t lpn_src;
426  uint16_t friend_src;
428 
429 typedef enum
430 {
446 
447 typedef struct
448 {
452  uint16_t lpn_src;
454  uint16_t friend_src;
458 
459 typedef struct
460 {
468 
472 typedef struct
473 {
476 
478  union {
493 
516  } params;
518 
529 typedef void (*nrf_mesh_evt_handler_cb_t)(const nrf_mesh_evt_t * p_evt);
530 
536 typedef struct
537 {
541  list_node_t node;
545 
553 void nrf_mesh_evt_handler_add(nrf_mesh_evt_handler_t * p_handler_params);
554 
560 void nrf_mesh_evt_handler_remove(nrf_mesh_evt_handler_t * p_handler_params);
561 
564 #endif /* MESH_EVT_H__ */
565 
nrf_mesh_evt_sar_failed_t sar_failed
SAR failed event.
DFU transfer ended.
bool key_refresh_in_phase2
The Key Refresh Flag indicates whether the Key Refresh procedure is in progress (see Section 3...
DFU transfer information structure.
int8_t measured_rssi
The RSSI of the Friend Request as measured by the Friend.
nrf_mesh_evt_dfu_t dfu
DFU event.
The friendship was terminated and the ongoing RX could not continue.
bool key_refresh
Key refresh flag in the beacon.
RX packet metadata.
Definition: nrf_mesh.h:161
uint32_t iv_index
The IV Index field contains the current IV Index.
IV update event structure.
const nrf_mesh_network_secmat_t * p_net
Network layer security material used in the decryption of the payload.
const heartbeat_subscription_state_t * p_new
New subscription state, or NULL if heartbeat subscriptions are disabled.
const nrf_mesh_beacon_secmat_t * p_beacon_secmat
The security material within the p_beacon_info that authenticated the incoming beacon.
nrf_mesh_dfu_role_t role
The role of the device in the transfer.
The friendship is successfully terminated.
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.
The LPN successfully polled all data from the Friend node.
nrf_mesh_evt_key_refresh_notification_t key_refresh
Key refresh notification event.
uint16_t friend_counter
Number of Friend Offer messages the Friend node has sent in its lifetime.
void nrf_mesh_evt_handler_add(nrf_mesh_evt_handler_t *p_handler_params)
Register an event handler to get events from the core stack.
const mesh_friendship_t * p_friendship
Pointer to the friendship parameter structure.
The device firmware is outdated, according to a trusted source.
Network security material structure.
Definition: nrf_mesh.h:261
The replay protection cache is full.
nrf_mesh_tx_token_t token
Packet ID of the SAR session.
nrf_mesh_evt_net_beacon_received_t net_beacon
A network beacon was received.
Flash operations queue is empty, and flash is stable.
mesh_config_entry_id_t id
ID being loaded when the load failure occured.
Transmission completed.
Mesh config entry identifier.
A heartbeat message is received.
The node received a Friend Offer.
Mesh event structure.
nrf_mesh_evt_lpn_friend_update_t friend_update
Friend Update event.
Flash malfunctioned.
bool iv_update_active
The IV Update Flag indicates whether the IV Update procedure is in progress (see Section 3...
const nrf_mesh_network_secmat_t * p_secmat_net
Network layer security material used in the decryption of the payload.
mesh_config_entry_id_t id
ID being stored when the storage failure occured.
nrf_mesh_evt_hb_subscription_change_t hb_subscription_change
HB subscription state changed.
Information structure for the Bluetooth Mesh network beacons.
Definition: nrf_mesh.h:311
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.
nrf_mesh_evt_lpn_friend_offer_t friend_offer
Friend Offer event.
Mesh core flash user.
const nrf_mesh_network_secmat_t * p_net
Network layer security material used in the decryption of the payload.
nrf_mesh_tx_token_t token
Packet identifier.
RX failed event structure.
The Low Power node was not able to send transport command due to internal fault.
uint16_t features
Features&#39; state bitmap.
void * p_flash_page
The address of the flash page the attempted operation failed.
The heartbeat subscription parameters changed.
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_friendship_terminated_reason_t
const heartbeat_subscription_state_t * p_old
Old subscription state, or NULL if heartbeat subscriptions were disabled before the change...
nrf_mesh_evt_hb_message_t hb_message
HB message received/sent event.
uint16_t lpn_src
Source (element) address of the Low Power node.
nrf_mesh_friendship_role_t role
Source device role for the event.
nrf_mesh_evt_friendship_established_t friendship_established
Friendship established event.
uint8_t authority
Authority level of the transfer.
list_node_t node
Node for the keeping in linked list.
nrf_mesh_sar_session_cancel_reason_t
SAR session cancelled reason codes.
There was no response from the LPN within the Poll Timeout.
mesh_config_load_failure_t reason
Reason for the load failure.
bool is_removed
Boolean to ensure list integrity.
The node received a Friend Update.
A new Friend Request was received from an LPN.
DFU event parameters.
nrf_mesh_evt_config_load_failure_t config_load_failure
Configuration load failure event.
uint32_t iv_index
IV index in the beacon.
Heartbeat received event structure.
void(* nrf_mesh_evt_handler_cb_t)(const nrf_mesh_evt_t *p_evt)
Mesh event handler callback type.
The Friend Request timed out.
The LPN established a friendship with a different Friend.
nrf_mesh_evt_friend_request_t friend_request
Friend Request event.
DFU request for this node to be the relay of a transfer.
SAR session failed.
Low Power node role.
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.
const uint32_t * p_start_addr
Start address of the bank.
Network beacon received structure.
The friendship was established and the ongoing RX could not continue.
The mesh stack completed and stopped all activities and ready to power off.
The friendship is successfully established.
nrf_mesh_evt_handler_cb_t evt_cb
Callback function pointer.
The friendship was terminated through the API.
Bluetooth Mesh security material structure.
Definition: nrf_mesh.h:332
nrf_mesh_flash_user_module_t
User tokens for the flash manager.
The Low Power node actively terminated the friendship.
mesh_config_load_failure_t
Definition: mesh_config.h:53
uint8_t subscription_list_size
Number of subscriptions the Friend can store for the LPN.
uint32_t length
Length of the firmware in the bank.
bool is_friend_queue_empty
The field is set to indicate whether the Friend Queue is empty or not.
uint8_t receive_window_ms
Receive window supported by the Friend node.
A message is received.
nrf_mesh_evt_config_storage_failure_t config_storage_failure
Configuration storage failure event.
const nrf_mesh_rx_metadata_t * p_rx_metadata
RX metadata for the packet that produced the beacon.
An IV update event occurred.
Mesh configuration persistent storage is stable.
const nrf_mesh_rx_metadata_t * p_metadata
Metadata for the received packet.
Key refresh notification structure.
Mesh configuration persistent storage failed while storing.
uint8_t ttl
Time-to-live for the message.
nrf_mesh_friendship_role_t role
Source role of the event.
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
nrf_mesh_address_t src
Source address of the message.
uint32_t page_count
The number of pages provided 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)
Remove 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:225
const void * p_flash_entry
The flash entry that failed.
nrf_mesh_address_t dst
Destination address of the message.
const nrf_mesh_rx_metadata_t * p_metadata
Metadata for the received packet.
Mesh event handler context structure.
uint16_t friend_src
Source (element) address of the Friend node.
const void * p_area
The start of the area owned by the flash manager of the module reporting the event.
uint8_t hops
Calculated hop value.
uint8_t friend_queue_size
Size of the message queue the Friend has reserved for messages to the LPN.
Transmission complete event structure.
The transport SAR session timed out.
The mesh has been enabled.
timestamp_t timestamp
Timestamp of the TX complete event.
const uint8_t * p_network_id
Network ID of the beacon that triggered the notification.
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.
const uint8_t * p_auth_value
Authentication value in the beacon.
An authenticated network beacon is received.
The node has received a Friend Request from an LPN.
DFU transfer starts.
Bluetooth Mesh address.
Definition: nrf_mesh.h:374
nrf_mesh_evt_message_t message
Incoming message.
uint8_t init_ttl
Initial TTL value used for sending the 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_friendship_terminated_reason_t reason
Reason for friendship termination.
nrf_mesh_evt_flash_failed_t flash_failed
Flash failed event.
net_state_iv_update_t iv_update
IV update flag in the beacon.
nrf_mesh_evt_tx_complete_t tx_complete
Transmission complete.
The peer cancelled the SAR session.
Parameters for changes to the heartbeat subscription state.
Message received event structure.
const nrf_mesh_rx_metadata_t * p_metadata
Metadata for the received packet.
uint16_t length
Message length.
const void * p_data
Failing data.
nrf_mesh_friendship_role_t
Device role in the friendship.
ID of a standalone firmware segment.
The LPN did not receive all segments before NRF_MESH_EVT_LPN_FRIEND_POLL_COMPLETE.
uint32_t data_len
Length of the failing data.
Security material for the Bluetooth Mesh network beacons.
Definition: nrf_mesh.h:278
const nrf_mesh_beacon_info_t * p_beacon_info
Pointer to the associated beacon info used to authenticate the incoming beacon.
The transport SAR session TX retry limit is exceeded.
Access layer flash user.
nrf_mesh_evt_friendship_terminated_t friendship_terminated
Friendship terminated event.
nrf_mesh_sar_session_cancel_reason_t reason
Reason for closing the session.
uint16_t src
Source (element) address of the Friend node.
const uint8_t * p_buffer
Buffer containing the message data.
uint16_t lpn_src
Source (element) address of the Low Power node.
The mesh proxy server is stopped.
The mesh has been disabled.
The peer started another SAR session.
The Friend node did not reply to the (repeated) Friend Poll.
net_state_iv_update_t
State of IV update procedure.
Definition: nrf_mesh.h:341
There were not enough resources to process the transport SAR session.
uint8_t ivi
IV index bit of the RX packet.
Mesh configuration persistent storage failed while loading an entry.
nrf_mesh_dfu_type_t
DFU transfer types.
uint16_t friend_src
Source (element) address of the Friend node.
nrf_mesh_flash_user_module_t user
The module the event is reported from.

Documentation feedback | Developer Zone | Subscribe | Updated