Interface for the message sending part of the mesh stack. More...
Modules | |
Flash Manager | |
The Flash Manager provides an entry-based persistent storage interface that works with the mesh. | |
Mesh config | |
Common interface for operating on all mesh states. | |
Mesh friendship types | |
A collection of types common to both the Low Power node (LPN) and the Friend role. | |
Mesh Low Power node (LPN) | |
Types | |
Core mesh type definitions. | |
Assert API | |
Allows the framework to propagate errors that can't be recovered from. | |
Defines | |
Core mesh definitions. | |
Mesh events | |
Runtime events in the core mesh. | |
Mesh options | |
Configuration options for the core mesh. | |
Mesh section variables | |
Mesh wrapper for the nRF5 SDK section variables. | |
Utility functions | |
Utility functions for mesh users. | |
Internal event module | |
Module for reporting internal stack events, to help traceability and debugging. | |
Macros | |
#define | NRF_MESH_INITIAL_TOKEN 0x00000000ul |
Initial value of tokens. More... | |
#define | NRF_MESH_SERVICE_BORDER_TOKEN 0xF0000000ul |
The upper border of the token values which are used for general communication. More... | |
#define | NRF_MESH_FRIEND_TOKEN_BEGIN 0xFFFFFE00ul |
Reserved token values. More... | |
#define | NRF_MESH_FRIEND_TOKEN_END 0xFFFFFEFFul |
End of the reserved friendship token range. More... | |
#define | NRF_MESH_FRIEND_POLL_TOKEN 0xFFFFFFF8ul |
#define | NRF_MESH_FRIEND_REQUEST_TOKEN 0xFFFFFFF9ul |
#define | NRF_MESH_FRIEND_CLEAR_TOKEN 0xFFFFFFFAul |
#define | NRF_MESH_SUBMAN_ADD_TOKEN 0xFFFFFFFBul |
#define | NRF_MESH_SUBMAN_REMOVE_TOKEN 0xFFFFFFFCul |
#define | NRF_MESH_HEARTBEAT_TOKEN 0xFFFFFFFDul |
#define | NRF_MESH_SAR_TOKEN 0xFFFFFFFEul |
#define | NRF_MESH_RELAY_TOKEN 0xFFFFFFFFul |
Functions | |
uint32_t | nrf_mesh_init (const nrf_mesh_init_params_t *p_init_params) |
Initializes the Bluetooth Mesh stack. More... | |
uint32_t | nrf_mesh_enable (void) |
Enables the Mesh. More... | |
uint32_t | nrf_mesh_disable (void) |
Starts disabling the Mesh. More... | |
uint32_t | nrf_mesh_packet_send (const nrf_mesh_tx_params_t *p_params, uint32_t *const p_packet_reference) |
Queues a mesh packet for transmission. More... | |
bool | nrf_mesh_process (void) |
Runs the mesh packet processing process. More... | |
uint32_t | nrf_mesh_on_sd_evt (uint32_t sd_evt) |
Pass SoftDevice SoC events to the Mesh. More... | |
void | nrf_mesh_rx_cb_set (nrf_mesh_rx_cb_t rx_cb) |
Set a callback which will be called for every received non-filtered packet. More... | |
void | nrf_mesh_rx_cb_clear (void) |
Unregister the RX callback, if any. | |
void | nrf_mesh_subnet_added (uint16_t net_key_index, const uint8_t *p_network_id) |
Notify the core stack that a subnet was added to the device. More... | |
nrf_mesh_tx_token_t | nrf_mesh_unique_token_get (void) |
Get unique token to be able to recognize tx complete events. More... | |
Interface for the message sending part of the mesh stack.
#define NRF_MESH_INITIAL_TOKEN 0x00000000ul |
Initial value of tokens.
Definition at line 63 of file nrf_mesh.h.
#define NRF_MESH_SERVICE_BORDER_TOKEN 0xF0000000ul |
The upper border of the token values which are used for general communication.
Definition at line 65 of file nrf_mesh.h.
#define NRF_MESH_FRIEND_TOKEN_BEGIN 0xFFFFFE00ul |
Reserved token values.
Beginning of the reserved friendship token range.
Used by the Core TX Friend to resolve the Friend Bearer.
Definition at line 73 of file nrf_mesh.h.
#define NRF_MESH_FRIEND_TOKEN_END 0xFFFFFEFFul |
End of the reserved friendship token range.
Definition at line 75 of file nrf_mesh.h.
uint32_t nrf_mesh_init | ( | const nrf_mesh_init_params_t * | p_init_params | ) |
Initializes the Bluetooth Mesh stack.
[in] | p_init_params | Pointer to initialization parameter structure. |
NRF_SUCCESS | The mesh system was successfully initialized. |
NRF_ERROR_SOFTDEVICE_NOT_ENABLED | The SoftDevice has not been enabled. |
NRF_ERROR_INVALID_STATE | The mesh stack has already been initialized. |
NRF_ERROR_NULL | The p_init_params parameter was NULL . |
uint32_t nrf_mesh_enable | ( | void | ) |
Enables the Mesh.
NRF_SUCCESS | The Mesh was started successfully. |
NRF_ERROR_INVALID_STATE | The mesh was not initialized, see nrf_mesh_init(). |
uint32_t nrf_mesh_disable | ( | void | ) |
Starts disabling the Mesh.
Calling this function will stop the Mesh, i.e, it will stop ordering time slots from the SoftDevice and will not generate events.
The mesh will produce an NRF_MESH_EVT_DISABLED once it has been fully disabled.
NRF_SUCCESS | The Mesh was stopped successfully. |
NRF_ERROR_INVALID_STATE | The mesh was already disabled. |
uint32_t nrf_mesh_packet_send | ( | const nrf_mesh_tx_params_t * | p_params, |
uint32_t *const | p_packet_reference | ||
) |
Queues a mesh packet for transmission.
[in] | p_params | Pointer to a structure containing the parameters for the message to send. |
[out] | p_packet_reference | Pointer to store a reference to the packet queued for transmission. This parameter may be set to NULL for ignoring the reference. |
NRF_SUCCESS | The message was successfully queued for transmission. |
NRF_ERROR_NO_MEM | A packet buffer could not be allocated for the packet. The application should try to send the packet again at a later point. |
NRF_ERROR_INVALID_ADDR | The source address is not a unicast address, or the destination is invalid. |
NRF_ERROR_INVALID_PARAM | TTL was larger than NRF_MESH_TTL_MAX. |
NRF_ERROR_NULL | p_params is a NULL pointer or a required field of the struct (other than p_data ) is NULL . |
NRF_ERROR_FORBIDDEN | Failed to allocate a sequence number from network. |
NRF_ERROR_INVALID_STATE | There's already a segmented packet that is being to sent to this destination. Wait for the transmission to finish before sending new segmented packets. |
bool nrf_mesh_process | ( | void | ) |
Runs the mesh packet processing process.
Calling this function allows the mesh to run. The mesh stack will process buffered incoming packets and send outgoing messages.
nrf_mesh_process()
, all events generated by the Mesh will be directly forwarded to the application if it has registered an event callback using nrf_mesh_evt_handler_add().true | Processing is done, i.e. no more packets are pending. It is safe to go to sleep by calling sd_app_evt_wait(). |
false | Processing is not done, i.e. packets are still pending. |
uint32_t nrf_mesh_on_sd_evt | ( | uint32_t | sd_evt | ) |
Pass SoftDevice SoC events to the Mesh.
Add this function in the SoC event dispatcher function used with the SoftDevice handler module (see softdevice_sys_evt_handler_set() softdevice_handler.h in the SDK).
[in] | sd_evt | SoftDevice SoC event. |
NRF_SUCCESS | Event successfully received. |
void nrf_mesh_rx_cb_set | ( | nrf_mesh_rx_cb_t | rx_cb | ) |
Set a callback which will be called for every received non-filtered packet.
The main BT Mesh packets are not filtered and will be passed to the callback.
See Packet filtering for the details about packet's filtering.
This function must be called after nrf_mesh_init().
[in] | rx_cb | Receive callback function. |
void nrf_mesh_subnet_added | ( | uint16_t | net_key_index, |
const uint8_t * | p_network_id | ||
) |
Notify the core stack that a subnet was added to the device.
[in] | net_key_index | Key index of the added subnet. |
[in] | p_network_id | Network ID of the added subnet. |
nrf_mesh_tx_token_t nrf_mesh_unique_token_get | ( | void | ) |
Get unique token to be able to recognize tx complete events.
The function guarantees that the given token will no be intersected with tokens of services from the mesh stack.
32bits | unique token value. |