Skip to content

Commit

Permalink
drv/bluetooth: hard code char_handle for Mario hub
Browse files Browse the repository at this point in the history
characteristics handle of LEGO Mario are not properly found by GATT_DiscCharsByUUID() remote_lwp3_char_handle for mario is hard coded for now
  • Loading branch information
NStrijbosch authored and dlech committed Aug 9, 2021
1 parent 450ab15 commit 1235b35
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
18 changes: 12 additions & 6 deletions lib/pbio/drv/bluetooth/bluetooth_stm32_bluenrg.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,12 +470,18 @@ static PT_THREAD(scan_and_connect_task(struct pt *pt, pbio_task_t *task)) {
PT_WAIT_UNTIL(pt, hci_command_status);
context->status = aci_gatt_disc_charac_by_uuid_end();

PT_WAIT_UNTIL(pt, {
if (task->cancel) {
goto cancel_disconnect;
}
remote_lwp3_char_handle;
});
// HACK: Characteristics of LEGO Mario are not properly found by aci_gatt_disc_charac_by_uuid_begin().
// remote_lwp3_char_handle for mario is hard coded for now
if (context->hub_kind == LWP3_HUB_KIND_MARIO) {
remote_lwp3_char_handle = 0x0011;
} else {
PT_WAIT_UNTIL(pt, {
if (task->cancel) {
goto cancel_disconnect;
}
remote_lwp3_char_handle;
});
}

// enable notifications

Expand Down
22 changes: 14 additions & 8 deletions lib/pbio/drv/bluetooth/bluetooth_stm32_cc2640.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,14 +494,20 @@ static PT_THREAD(scan_and_connect_task(struct pt *pt, pbio_task_t *task)) {

context->status = read_buf[8]; // debug

// Assuming that we only ever get successful ATT_ReadByTypeRsp and failed
// ATT_ReadByTypeRsp or ATT_ErrorRsp.
PT_WAIT_UNTIL(pt, {
if (task->cancel) {
goto cancel_disconnect;
}
remote_lwp3_char_handle != NO_CONNECTION;
});
// HACK: Characteristics of LEGO Mario are not properly found by GATT_DiscCharsByUUID().
// remote_lwp3_char_handle for mario is hard coded for now
if (context->hub_kind == LWP3_HUB_KIND_MARIO) {
remote_lwp3_char_handle = 0x0011;
} else {
// Assuming that we only ever get successful ATT_ReadByTypeRsp and failed
// ATT_ReadByTypeRsp or ATT_ErrorRsp.
PT_WAIT_UNTIL(pt, {
if (task->cancel) {
goto cancel_disconnect;
}
remote_lwp3_char_handle != NO_CONNECTION;
});
}

// enable notifications

Expand Down

0 comments on commit 1235b35

Please sign in to comment.