Lines Matching full:link
79 } link; member
140 srv.link.cli.addr = BT_MESH_ADDR_UNASSIGNED; in cli_link_clear()
141 srv.link.cli.net_idx = BT_MESH_KEY_UNUSED; in cli_link_clear()
171 net_buf_simple_add_u8(&buf, srv.link.state); in link_status_send()
178 struct bt_mesh_msg_ctx ctx = LINK_CTX(&srv.link.cli, true); in link_report_send()
182 net_buf_simple_add_u8(&buf, srv.link.status); in link_report_send()
183 net_buf_simple_add_u8(&buf, srv.link.state); in link_report_send()
184 if (srv.link.status == BT_MESH_RPR_ERR_LINK_CLOSED_BY_SERVER || in link_report_send()
185 srv.link.status == BT_MESH_RPR_ERR_LINK_CLOSED_BY_DEVICE) { in link_report_send()
186 net_buf_simple_add_u8(&buf, srv.link.close_reason); in link_report_send()
189 LOG_DBG("%u %u", srv.link.status, srv.link.state); in link_report_send()
355 srv.link.status = status; in link_close()
356 srv.link.close_reason = reason; in link_close()
357 srv.link.state = BT_MESH_RPR_LINK_CLOSING; in link_close()
362 /* Link closing is an atomic operation: */ in link_close()
363 srv.link.state = BT_MESH_RPR_LINK_IDLE; in link_close()
366 srv.link.close_reason); in link_close()
376 struct bt_mesh_msg_ctx ctx = LINK_CTX(&srv.link.cli, true); in outbound_pdu_report_send()
380 net_buf_simple_add_u8(&buf, srv.link.tx_pdu); in outbound_pdu_report_send()
382 LOG_DBG("%u", srv.link.tx_pdu); in outbound_pdu_report_send()
392 } else if (srv.link.state == BT_MESH_RPR_LINK_SENDING) { in pdu_send_complete()
393 srv.link.state = BT_MESH_RPR_LINK_ACTIVE; in pdu_send_complete()
394 srv.link.tx_pdu++; in pdu_send_complete()
402 struct bt_mesh_msg_ctx ctx = LINK_CTX(&srv.link.cli, true); in inbound_pdu_send()
406 net_buf_simple_add_u8(&msg, srv.link.rx_pdu); in inbound_pdu_send()
421 if (srv.link.state != BT_MESH_RPR_LINK_IDLE && in subnet_evt_handler()
422 subnet->net_idx == srv.link.cli.net_idx) { in subnet_evt_handler()
425 /* Skip the link closing stage, as specified in the Bluetooth in subnet_evt_handler()
428 srv.link.state = BT_MESH_RPR_LINK_IDLE; in subnet_evt_handler()
446 srv.link.state = BT_MESH_RPR_LINK_ACTIVE; in pb_link_opened()
447 srv.link.status = BT_MESH_RPR_SUCCESS; in pb_link_opened()
460 if (srv.link.state == BT_MESH_RPR_LINK_IDLE) { in pb_link_closed()
466 if (srv.link.state == BT_MESH_RPR_LINK_OPENING) { in pb_link_closed()
467 srv.link.status = BT_MESH_RPR_ERR_LINK_OPEN_FAILED; in pb_link_closed()
469 if (srv.link.state == BT_MESH_RPR_LINK_SENDING) { in pb_link_closed()
470 srv.link.status = in pb_link_closed()
473 srv.link.status = BT_MESH_RPR_ERR_LINK_CLOSED_BY_SERVER; in pb_link_closed()
476 srv.link.status != BT_MESH_RPR_ERR_LINK_CLOSED_BY_CLIENT && in pb_link_closed()
477 srv.link.status != BT_MESH_RPR_ERR_LINK_CLOSED_BY_SERVER) { in pb_link_closed()
478 srv.link.status = BT_MESH_RPR_ERR_LINK_CLOSED_BY_DEVICE; in pb_link_closed()
482 srv.link.close_reason = PROV_BEARER_LINK_STATUS_SUCCESS; in pb_link_closed()
484 srv.link.close_reason = PROV_BEARER_LINK_STATUS_FAIL; in pb_link_closed()
487 srv.link.state = BT_MESH_RPR_LINK_IDLE; in pb_link_closed()
488 k_work_submit(&srv.link.report); in pb_link_closed()
494 if (srv.link.state == BT_MESH_RPR_LINK_IDLE) { in pb_error()
499 srv.link.close_reason = err; in pb_error()
500 srv.link.state = BT_MESH_RPR_LINK_IDLE; in pb_error()
501 srv.link.status = BT_MESH_RPR_ERR_LINK_CLOSED_AS_CANNOT_RECEIVE_PDU; in pb_error()
511 if (srv.link.state != BT_MESH_RPR_LINK_ACTIVE && in pb_rx()
512 srv.link.state != BT_MESH_RPR_LINK_SENDING) { in pb_rx()
516 srv.link.rx_pdu++; in pb_rx()
721 if (srv.link.state != BT_MESH_RPR_LINK_IDLE) { in handle_extended_scan_start()
825 if (srv.link.state == BT_MESH_RPR_LINK_CLOSING || in handle_link_open()
826 srv.link.state == BT_MESH_RPR_LINK_SENDING) { in handle_link_open()
828 LOG_ERR("Invalid state: %u", srv.link.state); in handle_link_open()
832 if (srv.link.state == BT_MESH_RPR_LINK_OPENING || in handle_link_open()
833 srv.link.state == BT_MESH_RPR_LINK_ACTIVE) { in handle_link_open()
835 if (!rpr_node_equal(&cli, &srv.link.cli)) { in handle_link_open()
859 if (memcmp(uuid, srv.link.dev->uuid, 16)) { in handle_link_open()
868 /* Link state is IDLE */ in handle_link_open()
888 srv.link.cli = cli; in handle_link_open()
889 srv.link.rx_pdu = 0; in handle_link_open()
890 srv.link.tx_pdu = 0; in handle_link_open()
891 srv.link.state = BT_MESH_RPR_LINK_ACTIVE; in handle_link_open()
892 srv.link.status = BT_MESH_RPR_SUCCESS; in handle_link_open()
914 srv.link.dev = unprov_get(uuid); in handle_link_open()
915 if (!srv.link.dev) { in handle_link_open()
916 srv.link.dev = &srv.scan.devs[0]; in handle_link_open()
917 memcpy(srv.link.dev->uuid, uuid, 16); in handle_link_open()
918 srv.link.dev->flags = 0; in handle_link_open()
927 srv.link.cli = cli; in handle_link_open()
928 srv.link.rx_pdu = 0; in handle_link_open()
929 srv.link.tx_pdu = 0; in handle_link_open()
930 srv.link.state = BT_MESH_RPR_LINK_OPENING; in handle_link_open()
931 srv.link.status = BT_MESH_RPR_SUCCESS; in handle_link_open()
932 srv.link.dev->flags |= BT_MESH_RPR_UNPROV_HAS_LINK; in handle_link_open()
955 if (srv.link.state == BT_MESH_RPR_LINK_IDLE || in handle_link_close()
956 srv.link.state == BT_MESH_RPR_LINK_CLOSING) { in handle_link_close()
961 if (!rpr_node_equal(&cli, &srv.link.cli)) { in handle_link_close()
966 srv.link.state = BT_MESH_RPR_LINK_CLOSING; in handle_link_close()
968 /* Note: The response status isn't the same as the link status state, in handle_link_close()
969 * which will be used in the link report when the link is fully closed. in handle_link_close()
972 /* Disable randomization for the Remote Provisioning Link Status message to avoid reordering in handle_link_close()
973 * of it with the Remote Provisioning Link Report message that shall be sent in a sequence in handle_link_close()
974 * when closing an active link (see section 4.4.5.5.3.3 of MshPRTv1.1). in handle_link_close()
993 if (srv.link.state != BT_MESH_RPR_LINK_ACTIVE) { in handle_pdu_send()
994 LOG_WRN("Sending PDU while busy (state %u)", srv.link.state); in handle_pdu_send()
998 if (!rpr_node_equal(&cli, &srv.link.cli)) { in handle_pdu_send()
1003 if (pdu_num != srv.link.tx_pdu + 1) { in handle_pdu_send()
1005 srv.link.tx_pdu + 1); in handle_pdu_send()
1013 srv.link.tx_pdu++; in handle_pdu_send()
1017 srv.link.state = BT_MESH_RPR_LINK_SENDING; in handle_pdu_send()
1326 k_work_init(&srv.link.report, link_report_send_and_clear); in rpr_srv_init()
1339 srv.link.state = BT_MESH_RPR_LINK_IDLE; in rpr_srv_reset()
1344 srv.link.dev = NULL; in rpr_srv_reset()
1389 srv.link.rx_pdu++; in node_refresh_buf_send()
1391 LOG_DBG("%u", srv.link.rx_pdu); in node_refresh_buf_send()