Bluetooth: Mesh: Remove incorrect opcode check in RPR Client
RPR Client doesn't send RPR_OP_LINK_REPORT and therefore it can't wait for it using ack ctx. It should have been RPR_OP_PDU_OUTBOUND_REPORT to cover a case where Outbound PDU transmission failed. But in this case the link status will be non equal to BT_MESH_RPR_SUCCESS (see pb_error in rpr_srv.c) and the link state will be set to idle. And the client will reset the link together with ack ctx. When bearer user (provisioner.c) sends an Outbound PDU, it uses the callback (see bt_mesh_prov_send in provisioner.c) to send a next PDU, but it doesn't check the error code even though it is provided through the callback. Therefore calling the callback with error code would require error handling in provisioner.c. With ordinary provisioning PB-ADV doesn't call the callback in case of error, but closes the link by timeout if doesn't receive ACK (see prov_send_adv in pb_adv.c). PB-GATT always calls the callback with error code 0 once the PDU is transmitted (see buf_send in pb_gatt.c). Thus this change aligns RPR Client implementation with other bearers. Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This commit is contained in:
parent
3406d40ee0
commit
0d7c7eb4c9
|
@ -130,8 +130,7 @@ static int handle_link_report(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx
|
|||
struct bt_mesh_rpr_node srv = RPR_NODE(ctx);
|
||||
struct bt_mesh_rpr_cli *cli = mod->user_data;
|
||||
struct bt_mesh_rpr_link link;
|
||||
uint8_t reason = PROV_ERR_NONE;
|
||||
void *cb_data;
|
||||
uint8_t reason = PROV_BEARER_LINK_STATUS_SUCCESS;
|
||||
|
||||
link.status = net_buf_simple_pull_u8(buf);
|
||||
link.state = net_buf_simple_pull_u8(buf);
|
||||
|
@ -142,13 +141,6 @@ static int handle_link_report(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* The server uses the link report to notify about failed tx */
|
||||
if (bt_mesh_msg_ack_ctx_match(&cli->prov_ack_ctx, RPR_OP_LINK_REPORT,
|
||||
srv.addr, &cb_data) &&
|
||||
link.status != BT_MESH_RPR_SUCCESS) {
|
||||
tx_complete(cli, -ECANCELED, cb_data);
|
||||
}
|
||||
|
||||
if (cli->link.srv.addr != srv.addr) {
|
||||
LOG_DBG("Link report from unknown server 0x%04x", srv.addr);
|
||||
return 0;
|
||||
|
@ -158,8 +150,8 @@ static int handle_link_report(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx
|
|||
|
||||
cli->link.state = link.state;
|
||||
|
||||
LOG_DBG("0x%04x: status: %u state: %u", srv.addr, link.status,
|
||||
link.state);
|
||||
LOG_DBG("0x%04x: status: %u state: %u reason: %u", srv.addr, link.status, link.state,
|
||||
reason);
|
||||
|
||||
if (link.state == BT_MESH_RPR_LINK_IDLE) {
|
||||
link_reset(cli);
|
||||
|
|
Loading…
Reference in a new issue