Skip to content

Commit

Permalink
Bluetooth: btp: Add event indicating expiration of incomp timer
Browse files Browse the repository at this point in the history
This event indicates that segmented message incomplete timer
expired.

Signed-off-by: Mariusz Skamra <[email protected]>
  • Loading branch information
MariuszSkamra authored and jhedberg committed Jan 3, 2018
1 parent 9977cae commit 813ec50
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/bluetooth/testing.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ struct bt_test_cb {
void (*mesh_model_unbound)(u16_t addr, struct bt_mesh_model *model,
u16_t key_idx);
void (*mesh_prov_invalid_bearer)(u8_t opcode);
void (*mesh_trans_incomp_timer_exp)(void);

sys_snode_t node;
};
Expand Down
5 changes: 5 additions & 0 deletions subsys/bluetooth/host/mesh/transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,11 @@ static void seg_ack(struct k_work *work)
send_ack(rx->sub, rx->dst, rx->src, rx->ttl,
&rx->seq_auth, 0, rx->obo);
seg_rx_reset(rx);

if (IS_ENABLED(CONFIG_BT_TESTING)) {
bt_test_mesh_trans_incomp_timer_exp();
}

return;
}

Expand Down
11 changes: 11 additions & 0 deletions subsys/bluetooth/host/testing.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,17 @@ void bt_test_mesh_prov_invalid_bearer(u8_t opcode)
}
}

void bt_test_mesh_trans_incomp_timer_exp(void)
{
struct bt_test_cb *cb;

SYS_SLIST_FOR_EACH_CONTAINER(&cb_slist, cb, node) {
if (cb->mesh_trans_incomp_timer_exp) {
cb->mesh_trans_incomp_timer_exp();
}
}
}

int bt_test_mesh_lpn_group_add(u16_t group)
{
bt_mesh_lpn_group_add(group);
Expand Down
1 change: 1 addition & 0 deletions subsys/bluetooth/host/testing.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ void bt_test_mesh_model_bound(u16_t addr, struct bt_mesh_model *model,
void bt_test_mesh_model_unbound(u16_t addr, struct bt_mesh_model *model,
u16_t key_idx);
void bt_test_mesh_prov_invalid_bearer(u8_t opcode);
void bt_test_mesh_trans_incomp_timer_exp(void);
8 changes: 8 additions & 0 deletions tests/bluetooth/tester/btp_spec.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1613,3 +1613,11 @@ Events:

This event indicates reception of provisioning message with
invalid RFU BearerOpcode.

Opcode 0x88 - Transport Incomplete Timer Expired Event

Controller Index: <controller id>
Event parameters: <none>

This event indicates that segmented message incomplete timer
expired.
2 changes: 2 additions & 0 deletions tests/bluetooth/tester/src/bttester.h
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,8 @@ struct mesh_invalid_bearer_ev {
u8_t opcode;
} __packed;

#define MESH_EV_INCOMP_TIMER_EXP 0x88

void tester_init(void);
void tester_rsp(u8_t service, u8_t opcode, u8_t index, u8_t status);
void tester_send(u8_t service, u8_t opcode, u8_t index, u8_t *data,
Expand Down
7 changes: 7 additions & 0 deletions tests/bluetooth/tester/src/mesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -857,11 +857,18 @@ static void invalid_bearer_cb(u8_t opcode)
CONTROLLER_INDEX, (u8_t *) &ev, sizeof(ev));
}

static void incomp_timer_exp_cb(void)
{
tester_send(BTP_SERVICE_ID_MESH, MESH_EV_INCOMP_TIMER_EXP,
CONTROLLER_INDEX, NULL, 0);
}

static struct bt_test_cb bt_test_cb = {
.mesh_net_recv = net_recv_ev,
.mesh_model_bound = model_bound_cb,
.mesh_model_unbound = model_unbound_cb,
.mesh_prov_invalid_bearer = invalid_bearer_cb,
.mesh_trans_incomp_timer_exp = incomp_timer_exp_cb,
};

u8_t tester_init_mesh(void)
Expand Down

0 comments on commit 813ec50

Please sign in to comment.