@@ -537,23 +537,23 @@ static void test_lpn_msg_mesh(void)
537
537
bt_mesh_test_friendship_init (CONFIG_BT_MESH_FRIEND_LPN_COUNT );
538
538
bt_mesh_lpn_set (true);
539
539
540
- ASSERT_OK_MSG (bt_mesh_test_friendship_evt_wait (BT_MESH_TEST_LPN_ESTABLISHED ,
541
- K_SECONDS ( 2 )), "LPN not established " );
540
+ ASSERT_OK_MSG (bt_mesh_test_friendship_evt_wait (BT_MESH_TEST_LPN_ESTABLISHED , K_SECONDS ( 2 )),
541
+ "LPN did not establish friendship " );
542
542
/* LPN polls on establishment. Clear the poll state */
543
543
bt_mesh_test_friendship_evt_clear (BT_MESH_TEST_LPN_POLLED );
544
544
545
545
/* Send an unsegmented message to a third mesh node.
546
546
* Should not be affected by the LPN mode at all.
547
547
*/
548
548
ASSERT_OK_MSG (bt_mesh_test_send (other_cfg .addr , NULL , 5 , 0 , K_NO_WAIT ),
549
- "Send to mesh failed" );
549
+ "Send to the third mesh node failed" );
550
550
551
551
/* Receive an unsegmented message back */
552
552
ASSERT_OK (bt_mesh_test_recv (5 , cfg -> addr , NULL , K_FOREVER ));
553
553
554
554
/* Send a segmented message to the mesh node. */
555
555
ASSERT_OK_MSG (bt_mesh_test_send (other_cfg .addr , NULL , 15 , 0 , K_FOREVER ),
556
- "Send to other failed" );
556
+ "Send to the third mesh node failed" );
557
557
558
558
/* Receive a segmented message back */
559
559
ASSERT_OK (bt_mesh_test_recv (15 , cfg -> addr , NULL , K_FOREVER ));
@@ -569,6 +569,25 @@ static void test_lpn_msg_mesh(void)
569
569
bt_mesh_model_msg_init (test_model -> pub -> msg , TEST_MSG_OP_1 );
570
570
ASSERT_OK (bt_mesh_model_publish (test_model ));
571
571
572
+ /* Give time to complete publication */
573
+ k_sleep (K_SECONDS (2 ));
574
+
575
+ /* Terminate friendship by disabling the LPN functionality */
576
+ bt_mesh_lpn_set (false);
577
+ ASSERT_OK_MSG (bt_mesh_test_friendship_evt_wait (BT_MESH_TEST_LPN_TERMINATED , K_SECONDS (5 )),
578
+ "LPN did not terminate friendship correctly" );
579
+
580
+ /* With this enabled feature, LPN leaves scanner disabled after termination. */
581
+ if (IS_ENABLED (CONFIG_BT_MESH_LPN_ESTABLISHMENT )) {
582
+ bt_mesh_scan_enable ();
583
+ }
584
+
585
+ /* Send an unsegmented message to a third mesh node. */
586
+ ASSERT_OK_MSG (bt_mesh_test_send (other_cfg .addr , NULL , 5 , 0 , K_NO_WAIT ),
587
+ "Send to the third mesh node failed" );
588
+ /* Receive an unsegmented message back */
589
+ ASSERT_OK (bt_mesh_test_recv (5 , cfg -> addr , NULL , K_FOREVER ));
590
+
572
591
PASS ();
573
592
}
574
593
@@ -587,9 +606,9 @@ static void test_lpn_re_est(void)
587
606
"LPN not established" );
588
607
589
608
bt_mesh_lpn_set (false);
590
- ASSERT_OK_MSG (bt_mesh_test_friendship_evt_wait ( BT_MESH_TEST_LPN_TERMINATED ,
591
- K_SECONDS (5 )),
592
- "LPN never terminated friendship" );
609
+ ASSERT_OK_MSG (
610
+ bt_mesh_test_friendship_evt_wait ( BT_MESH_TEST_LPN_TERMINATED , K_SECONDS (5 )),
611
+ "LPN did not terminate friendship correctly " );
593
612
594
613
k_sleep (K_SECONDS (2 ));
595
614
}
@@ -966,6 +985,13 @@ static void test_other_msg(void)
966
985
ASSERT_OK_MSG (bt_mesh_test_recv (1 , cfg -> addr , NULL , K_FOREVER ),
967
986
"Failed to receive from LPN" );
968
987
988
+ /* Receive an unsegmented message from the LPN outside of friendship. */
989
+ ASSERT_OK_MSG (bt_mesh_test_recv (5 , cfg -> addr , NULL , K_FOREVER ),
990
+ "Failed to receive from LPN after friendship termination" );
991
+ /* Send an unsegmented message to the LPN */
992
+ ASSERT_OK_MSG (bt_mesh_test_send (LPN_ADDR_START , NULL , 5 , 0 , K_NO_WAIT ),
993
+ "Failed to send to LPN after friendship termination" );
994
+
969
995
PASS ();
970
996
}
971
997
0 commit comments