Bluetooth Mesh Low Power Node API#
Bluetooth Mesh Low Power Node API.
These commands and events are for low-power operation, available in nodes which have the LPN feature.
Modules#
sl_btmesh_evt_lpn_friendship_established
sl_btmesh_evt_lpn_friendship_failed
sl_btmesh_evt_lpn_friendship_terminated
Enumerations#
Key values to identify LPN configurations.
Functions#
Macros#
Enumeration Documentation#
sl_btmesh_lpn_settings_t#
sl_btmesh_lpn_settings_t
Key values to identify LPN configurations.
| Enumerator | |
|---|---|
| sl_btmesh_lpn_queue_length | (0x0) Minimum queue length that the friend must support. Choose an appropriate length based on the expected message frequency and LPN sleep period because messages that do not fit into the friend queue are dropped. Note that the given value is rounded up to the nearest power of
|
| sl_btmesh_lpn_poll_timeout | (0x1) Poll timeout in milliseconds, which is the longest time that LPN sleeps in between querying its friend for queued messages. Long poll timeout allows the LPN to sleep for longer periods, at the expense of increased latency for receiving messages. Note that the given value is rounded up to the nearest 100 ms Range: 1 s to 95 h 59 min 59 s 900 ms |
| sl_btmesh_lpn_receive_delay | (0x2) Receive delay in milliseconds. Receive delay is the time between the LPN sending a request and listening for a response. Receive delay allows the friend node time to prepare the message and LPN to sleep. Range: 10 ms to 255 ms The default receive delay in 10 ms. |
| sl_btmesh_lpn_request_retries | (0x3) Request retry is the number of retry attempts to repeat e.g., the friend poll message if the friend update was not received by the LPN. Range is from 0 to 239, default is 5 |
| sl_btmesh_lpn_retry_interval | (0x4) Time interval between retry attempts in milliseconds. Range is 0 to 60000 ms (1 minute), default is 100 ms. |
| sl_btmesh_lpn_clock_accuracy | (0x5) Clock accuracy in ppm, which will be taken into account when opening and closing the receive window, and determining the poll timeout. Should be used with care, because inaccurate clock can increase the receive window lenght to up to 2,5 times in some cases. Default value is 0. |
| sl_btmesh_lpn_max_receive_window | (0x6) Maximum acceptable friend receive window in milliseconds. Friend offers with a larger receive window will be rejected. This configuration also limits how long the LPN waits for friend offers, because friends with large receive windows will delay their friend offer messages longer. Range: 1 ms to 255 ms. Default is 255 ms. |
| sl_btmesh_lpn_min_subscription_list_size | (0x7) Minimum subscription list size that the friend must support. Friend offers with a smaller subscription list size will be rejected. Range: 0..255 Default is 0. |
| sl_btmesh_lpn_min_friend_offer_rssi | (0x8) Minimum acceptable RSSI value in dBm reported by friend offer messages. This configuration also limits how long the LPN waits for friend offers, because friends with low RSSI values will delay their friend offer messages longer. Note that in practice the RSSI value is a negative number, and values larger than -20 dBm are not frequently observed in real life scenarios. The friend may also report that it does not support RSSI reporting, in which case an empty RSSI value is also accepted. The value is interpreted as a two's complement 8-bit signed integer, even though the type of the parameter is uint32. The most significant 24 bits of the uint32 value are ignored, so it does not matter whether the value -55 is given as 0x000000c9 or 0xffffffc9, as an example. Range: -128..127. Default is -128. |
| sl_btmesh_lpn_receive_window_factor | (0x9) Value for ReceiveWindowFactor. This informs the friend how much it should delay sending its friend offer message based on its receive window capability. The factor value is 1
|
| sl_btmesh_lpn_rssi_factor | (0xa) Value for RSSIFactor. This informs the friend how much it should delay sending its friend offer message based on its measured RSSI of the friend request. The factor value is 1
|
| sl_btmesh_lpn_friend_offer_listen_timeout_slack | (0xb) Amount of time in milliseconds to listen for friend offers after their expected arrival time based on the maximum receive window and minimum RSSI and their respective factors. Since the advertisement message timings are generally not exact, some slack should be allowed to avoid missing valid friend offers. If the calculated time plus slack exceeds 1000 ms, then the time is clamped to 1000 ms. Range: 1..1000 ms. Default is 20 ms. |
Function Documentation#
sl_btmesh_lpn_init#
sl_status_t sl_btmesh_lpn_init (void )
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| void | N/A |
Initialize the Low Power node (LPN) mode. The node needs to be provisioned before calling this command. After the LPN mode is initialized, the node can't operate in the network without a Friend node. To establish a friendship with a nearby Friend node, use the sl_btmesh_lpn_establish_friendship command. Make this call before calling the other commands in this class.
Returns
SL_STATUS_OK if successful. Error code otherwise.
sl_btmesh_lpn_deinit#
sl_status_t sl_btmesh_lpn_deinit (void )
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| void | N/A |
Deinitialize the LPN functionality. After calling this command, a possible friendship with a Friend node is terminated and the node can operate in the network independently. After calling this command, do not call any other command in this class before the Low Power mode is sl_btmesh_lpn_init again.
Returns
SL_STATUS_OK if successful. Error code otherwise.
sl_btmesh_lpn_establish_friendship#
sl_status_t sl_btmesh_lpn_establish_friendship (uint16_t netkey_index)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| uint16_t | [in] | netkey_index | Network key index used in friendship request |
Establish a friendship. After a friendship has been established, the node can start saving power.
Returns
SL_STATUS_OK if successful. Error code otherwise.
Events
sl_btmesh_lpn_poll#
sl_status_t sl_btmesh_lpn_poll (uint16_t netkey_index)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| uint16_t | [in] | netkey_index | Network key index used in poll |
Poll the Friend node for stored messages and security updates. This command may be used if the application is expecting to receive messages at a specific time. However, it is not required for correct operation, because the procedure will be performed autonomously before the poll timeout expires.
Returns
SL_STATUS_OK if successful. Error code otherwise.
sl_btmesh_lpn_terminate_friendship#
sl_status_t sl_btmesh_lpn_terminate_friendship (uint16_t netkey_index)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| uint16_t | [in] | netkey_index | Network key index used in friendship request |
Terminate an already established friendship. sl_btmesh_evt_lpn_friendship_terminated event will be emitted when the friendship termination has been completed.
Returns
SL_STATUS_OK if successful. Error code otherwise.
Events
sl_btmesh_lpn_config#
sl_status_t sl_btmesh_lpn_config (uint8_t setting_id, uint32_t value)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| uint8_t | [in] | setting_id | Enum sl_btmesh_lpn_settings_t. Identifies the LPN setting to be updated. |
| uint32_t | [in] | value | New value for the given setting |
Configure the parameters for friendship establishment and LPN behavior.
Returns
SL_STATUS_OK if successful. Error code otherwise.