Skip to content

Commit a0755e1

Browse files
committed
Bluetooth: Mesh: Report configured LPNTimeout in cfg_srv
Changes lpn_timeout_get behavior in the config server to report the configured LPN timeout, instead of the currently remaining timeout time. According to the Bluetooth Mesh Profile specification, section 4.2.21, the PollTimeout list is a list of the PollTimeout timer values, and according to table 4.32 in this section, values 1-9 are prohibited. Although this is not explicitly stated, this indicates that the PollTimeout value is the configured poll timeout time - not the time remaining until the timeout value expires. This patch changes the implementation to reflect this. Split out from zephyrproject-rtos#33782. Signed-off-by: Trond Einar Snekvik <[email protected]>
1 parent e4a349f commit a0755e1

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

subsys/bluetooth/mesh/cfg_srv.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2045,8 +2045,8 @@ static void lpn_timeout_get(struct bt_mesh_model *model,
20452045
{
20462046
BT_MESH_MODEL_BUF_DEFINE(msg, OP_LPN_TIMEOUT_STATUS, 5);
20472047
struct bt_mesh_friend *frnd;
2048+
int32_t timeout_steps;
20482049
uint16_t lpn_addr;
2049-
int32_t timeout_ms;
20502050

20512051
lpn_addr = net_buf_simple_pull_le16(buf);
20522052

@@ -2062,20 +2062,21 @@ static void lpn_timeout_get(struct bt_mesh_model *model,
20622062
net_buf_simple_add_le16(&msg, lpn_addr);
20632063

20642064
if (!IS_ENABLED(CONFIG_BT_MESH_FRIEND)) {
2065-
timeout_ms = 0;
2065+
timeout_steps = 0;
20662066
goto send_rsp;
20672067
}
20682068

20692069
frnd = bt_mesh_friend_find(BT_MESH_KEY_ANY, lpn_addr, true, true);
20702070
if (!frnd) {
2071-
timeout_ms = 0;
2071+
timeout_steps = 0;
20722072
goto send_rsp;
20732073
}
20742074

2075-
timeout_ms = k_delayed_work_remaining_get(&frnd->timer) / 100;
2075+
/* PollTimeout should be reported in steps of 100ms. */
2076+
timeout_steps = frnd->poll_to / 100;
20762077

20772078
send_rsp:
2078-
net_buf_simple_add_le24(&msg, timeout_ms);
2079+
net_buf_simple_add_le24(&msg, timeout_steps);
20792080

20802081
if (bt_mesh_model_send(model, ctx, &msg, NULL, NULL)) {
20812082
BT_ERR("Unable to send LPN PollTimeout Status");

0 commit comments

Comments
 (0)