Lines Matching refs:link

36 	int link;  member
52 struct bt_mesh_rpr_link *link) in link_report() argument
56 if (link->state == BT_MESH_RPR_LINK_ACTIVE && in link_report()
57 bearer.link == BEARER_LINK_OPENING) { in link_report()
58 bearer.link = BEARER_LINK_OPENED; in link_report()
65 cli->link.time = PROTOCOL_TIMEOUT_SEC; in link_report()
69 if (link->state == BT_MESH_RPR_LINK_IDLE && in link_report()
70 bearer.link != BEARER_LINK_IDLE) { in link_report()
71 bearer.link = BEARER_LINK_IDLE; in link_report()
73 LOG_DBG("Closed (%u)", link->status); in link_report()
75 ((link->status == BT_MESH_RPR_SUCCESS) ? in link_report()
85 cli->link.tx_pdu++; in tx_complete()
131 struct bt_mesh_rpr_link link; in handle_link_report() local
134 link.status = net_buf_simple_pull_u8(buf); in handle_link_report()
135 link.state = net_buf_simple_pull_u8(buf); in handle_link_report()
143 if (cli->link.srv.addr != srv.addr) { in handle_link_report()
148 k_work_reschedule(&cli->link.timeout, K_SECONDS(cli->link.time)); in handle_link_report()
150 cli->link.state = link.state; in handle_link_report()
152 LOG_DBG("0x%04x: status: %u state: %u reason: %u", srv.addr, link.status, link.state, in handle_link_report()
155 if (link.state == BT_MESH_RPR_LINK_IDLE) { in handle_link_report()
159 link_report(cli, &cli->link.srv, &link); in handle_link_report()
170 struct bt_mesh_rpr_link link; in handle_link_status() local
172 link.status = net_buf_simple_pull_u8(buf); in handle_link_status()
173 link.state = net_buf_simple_pull_u8(buf); in handle_link_status()
175 LOG_DBG("0x%04x: status: %u state: %u", srv.addr, link.status, in handle_link_status()
176 link.state); in handle_link_status()
180 *rsp = link; in handle_link_status()
184 if (cli->link.srv.addr == srv.addr) { in handle_link_status()
185 k_work_reschedule(&cli->link.timeout, K_SECONDS(cli->link.time)); in handle_link_status()
187 cli->link.state = link.state; in handle_link_status()
188 if (link.state == BT_MESH_RPR_LINK_IDLE) { in handle_link_status()
189 cli->link.srv.addr = BT_MESH_ADDR_UNASSIGNED; in handle_link_status()
192 link_report(cli, &cli->link.srv, &link); in handle_link_status()
206 if (srv.addr != cli->link.srv.addr) { in handle_pdu_outbound_report()
215 k_work_reschedule(&cli->link.timeout, K_SECONDS(cli->link.time)); in handle_pdu_outbound_report()
219 num != cli->link.tx_pdu) { in handle_pdu_outbound_report()
236 &cli->link.srv, in handle_pdu_report()
240 if (cli->link.srv.addr != srv.addr) { in handle_pdu_report()
245 k_work_reschedule(&cli->link.timeout, K_SECONDS(cli->link.time)); in handle_pdu_report()
248 if (pdu <= cli->link.rx_pdu) { in handle_pdu_report()
356 struct bt_mesh_rpr_cli, link.timeout); in link_timeout()
358 if (bearer.link != BEARER_LINK_IDLE) { in link_timeout()
375 cli->link.time = LINK_TIMEOUT_SECONDS_DEFAULT; in rpr_cli_init()
379 k_work_init_delayable(&cli->link.timeout, link_timeout); in rpr_cli_init()
414 k_work_reschedule(&cli->link.timeout, K_SECONDS(cli->link.time)); in pdu_send_end()
450 cli->link.srv = *srv; in link_init()
451 cli->link.state = BT_MESH_RPR_LINK_IDLE; in link_init()
452 cli->link.rx_pdu = 0; in link_init()
453 cli->link.tx_pdu = 1; in link_init()
454 k_work_reschedule(&cli->link.timeout, K_SECONDS(cli->link.time)); in link_init()
459 k_work_cancel_delayable(&cli->link.timeout); in link_reset()
460 cli->link.srv.addr = BT_MESH_ADDR_UNASSIGNED; in link_reset()
461 cli->link.state = BT_MESH_RPR_LINK_IDLE; in link_reset()
468 struct bt_mesh_rpr_node srv = cli->link.srv; in link_closed()
469 struct bt_mesh_rpr_link link = { in link_closed() local
474 LOG_DBG("0x%04x: status: %u state: %u rx: %u tx: %u", srv.addr, link.status, in link_closed()
475 cli->link.state, cli->link.rx_pdu, cli->link.tx_pdu); in link_closed()
479 link_report(cli, &srv, &link); in link_closed()
594 if (cli->link.time != LINK_TIMEOUT_SECONDS_DEFAULT) { in link_open_prov()
595 net_buf_simple_add_u8(&buf, cli->link.time); in link_open_prov()
618 struct bt_mesh_msg_ctx ctx = LINK_CTX(&cli->link.srv, false); in link_close()
621 if (cli->link.srv.addr == BT_MESH_ADDR_UNASSIGNED) { in link_close()
635 k_work_reschedule(&cli->link.timeout, K_SECONDS(cli->link.time)); in link_close()
642 struct bt_mesh_msg_ctx ctx = LINK_CTX(&cli->link.srv, true); in send()
645 if (cli->link.srv.addr == BT_MESH_ADDR_UNASSIGNED) { in send()
657 cli->link.srv.addr, cb_data); in send()
665 net_buf_simple_push_u8(buf, cli->link.tx_pdu); in send()
713 if (cli->link.srv.addr != BT_MESH_ADDR_UNASSIGNED) { in pb_link_open()
720 cli->link.time = timeout ? timeout : LINK_TIMEOUT_SECONDS_DEFAULT; in pb_link_open()
722 LOG_DBG("timeout: %d", cli->link.time); in pb_link_open()
737 bearer.link = BEARER_LINK_OPENING; in pb_link_open()