Data Structures | |
struct | friend_criteria_t |
Parameters of the Friend node Criteria field. More... | |
struct | mesh_lpn_friend_request_t |
Friend Request parameters. More... | |
Macros | |
#define | MESH_LPN_FRIEND_REQUEST_TIMEOUT_MIN_MS 100 |
Minimum Friend Request timeout (in milliseconds). More... | |
#define | MESH_LPN_FRIEND_REQUEST_TIMEOUT_MAX_MS 1000 |
Maximum Friend Request timeout (in milliseconds). More... | |
#define | MESH_LPN_POLL_TIMEOUT_MIN_MS 1000 |
Minimum supported poll timeout (in milliseconds). More... | |
#define | MESH_LPN_POLL_TIMEOUT_MAX_MS 345599900 |
Maximum supported poll timeout (in milliseconds). More... | |
#define | MESH_LPN_RECEIVE_DELAY_MIN_MS 10 |
Minimum allowed Receive Delay (in milliseconds). More... | |
#define | MESH_LPN_RECEIVE_DELAY_MAX_MS 255 |
Maximum allowed Receive Delay (in milliseconds). More... | |
#define | MESH_LPN_POLL_RETRY_COUNT 5 |
The number of times the LPN will retry polling the Friend before regarding the friendship as terminated. More... | |
#define | MESH_LPN_FRIEND_REQUEST_RETRY_COUNT 5 |
The number of times the LPN will retry the friend request procedure until NRF_MESH_EVT_LPN_FRIEND_REQUEST_TIMEOUT. More... | |
#define | MESH_LPN_POLL_SEPARATION_INTERVAL_MS 50 |
The minimum interval between two individual consecutive polls. More... | |
Functions | |
void | mesh_lpn_init (void) |
Initialize the Low Power node. More... | |
uint32_t | mesh_lpn_friend_request (mesh_lpn_friend_request_t friend_params, uint32_t request_timeout_ms) |
Initiate the friendship establishment procedure. More... | |
uint32_t | mesh_lpn_friend_accept (const nrf_mesh_evt_lpn_friend_offer_t *p_friend_offer) |
Accept a Friend Offer. More... | |
uint32_t | mesh_lpn_friend_poll (uint32_t delay_ms) |
Initiate a Friend Poll. More... | |
uint32_t | mesh_lpn_poll_interval_set (uint32_t poll_interval_ms) |
Set the poll interval. More... | |
uint32_t | mesh_lpn_friendship_terminate (void) |
Terminate the active friendship. More... | |
bool | mesh_lpn_is_in_friendship (void) |
Get the state of the LPN. More... | |
#define MESH_LPN_FRIEND_REQUEST_TIMEOUT_MIN_MS 100 |
Minimum Friend Request timeout (in milliseconds).
Definition at line 58 of file mesh_lpn.h.
#define MESH_LPN_FRIEND_REQUEST_TIMEOUT_MAX_MS 1000 |
Maximum Friend Request timeout (in milliseconds).
Definition at line 60 of file mesh_lpn.h.
#define MESH_LPN_POLL_TIMEOUT_MIN_MS 1000 |
Minimum supported poll timeout (in milliseconds).
Definition at line 63 of file mesh_lpn.h.
#define MESH_LPN_POLL_TIMEOUT_MAX_MS 345599900 |
Maximum supported poll timeout (in milliseconds).
This translates to slightly less than 96 hours (0x34BBFF * 100 ms). The valid range is defined in Table 3.26, Bluetooth Mesh Profile Specification (MshPRFv1.0.1) section 3.6.5.3
Definition at line 66 of file mesh_lpn.h.
#define MESH_LPN_RECEIVE_DELAY_MIN_MS 10 |
Minimum allowed Receive Delay (in milliseconds).
Definition at line 70 of file mesh_lpn.h.
#define MESH_LPN_RECEIVE_DELAY_MAX_MS 255 |
Maximum allowed Receive Delay (in milliseconds).
Definition at line 72 of file mesh_lpn.h.
#define MESH_LPN_POLL_RETRY_COUNT 5 |
The number of times the LPN will retry polling the Friend before regarding the friendship as terminated.
Definition at line 77 of file mesh_lpn.h.
#define MESH_LPN_FRIEND_REQUEST_RETRY_COUNT 5 |
The number of times the LPN will retry the friend request procedure until NRF_MESH_EVT_LPN_FRIEND_REQUEST_TIMEOUT.
Definition at line 82 of file mesh_lpn.h.
#define MESH_LPN_POLL_SEPARATION_INTERVAL_MS 50 |
The minimum interval between two individual consecutive polls.
Definition at line 87 of file mesh_lpn.h.
void mesh_lpn_init | ( | void | ) |
Initialize the Low Power node.
uint32_t mesh_lpn_friend_request | ( | mesh_lpn_friend_request_t | friend_params, |
uint32_t | request_timeout_ms | ||
) |
Initiate the friendship establishment procedure.
Calling this API can generate the following events:
NRF_ERROR_INVALID_STATE
to be returned, and the friendship establishment procedure will not be initiated.[in] | friend_params | Friend request parameters. See mesh_lpn_friend_request_t for documentation of the individual parameters. |
[in] | request_timeout_ms | The duration to scan for incoming Friend Offers. After this duration, the LPN will stop scanning and the event NRF_MESH_EVT_LPN_FRIEND_REQUEST_TIMEOUT will be generated. The timeout must be greater than MESH_LPN_FRIEND_REQUEST_TIMEOUT_MIN_MS and less or equal to MESH_LPN_FRIEND_REQUEST_TIMEOUT_MAX_MS. |
NRF_SUCCESS | Successfully initiated the friendship establishment procedure. |
NRF_ERROR_INVALID_STATE | Already in an active friendship. |
NRF_ERROR_INVALID_PARAM | Friend request parameters outside of valid ranges. |
uint32_t mesh_lpn_friend_accept | ( | const nrf_mesh_evt_lpn_friend_offer_t * | p_friend_offer | ) |
Accept a Friend Offer.
Calling this API can generate the following events:
[in] | p_friend_offer | Friend Offer to be accepted, as provided by NRF_MESH_EVT_LPN_FRIEND_OFFER. |
NRF_SUCCESS | Successfully accepted the Friend Offer. |
NRF_ERROR_NULL | The p_friend_offer parameter was NULL. |
NRF_ERROR_INVALID_STATE | Not in a valid state to accept a Friend Offer. |
NRF_ERROR_INVALID_PARAM | Invalid parameter values in the Friend Offer. |
uint32_t mesh_lpn_friend_poll | ( | uint32_t | delay_ms | ) |
Initiate a Friend Poll.
Calling this API can generate the following events:
[in] | delay_ms | Number of milliseconds until the Friend Poll is to be sent out. |
NRF_SUCCESS | Successfully initiated the Friend Poll procedure. |
NRF_ERROR_INVALID_PARAM | The delay_ms cannot exceed the poll timeout. If it does, the friendship will be terminated. |
NRF_ERROR_INVALID_STATE | Not in an active friendship. |
uint32_t mesh_lpn_poll_interval_set | ( | uint32_t | poll_interval_ms | ) |
Set the poll interval.
The poll interval is the interval between two separate Friend Poll actions. This is the interval between each time the node wakes up to empty the Friend Queue. The interval must be set in a way that the LPN is able to complete as many retry attempts as possible before the poll timeout expires. This means that it must satisfy the following equation:
NRF_SUCCESS | Successfully set the new poll interval. |
NRF_ERROR_INVALID_PARAM | The provided poll_interval_ms is out of range for the current poll timeout, receive delay, and Receive Window. |
NRF_ERROR_INVALID_STATE | Not in an active friendship. |
uint32_t mesh_lpn_friendship_terminate | ( | void | ) |
Terminate the active friendship.
Calling this API can generate the following events:
NRF_SUCCESS | Successfully started the friendship termination. |
NRF_ERROR_INVALID_STATE | Not in an active friendship. |
bool mesh_lpn_is_in_friendship | ( | void | ) |
Get the state of the LPN.
true
if the friendship is active.