Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bluetooth: can't send advertising data bigger than 32 bytes #175

Closed
MatMaul opened this issue May 13, 2023 · 4 comments
Closed

bluetooth: can't send advertising data bigger than 32 bytes #175

MatMaul opened this issue May 13, 2023 · 4 comments

Comments

@MatMaul
Copy link

MatMaul commented May 13, 2023

Currently bleps pads advertising data with 0 up to 32 bytes, and have no logic for bigger packet (triggers an out of bounds error).

If I try to remove the padding for bigger packets, remove the padding altogether, or use 64/128 padding, the HCI command can't be sent to libbtdm blob (Error 18).
Only padded 32 bytes exactly seems to work (36 with the 4 bytes HCI header).

I failed to find such a padding in esp-idf or the HCI spec, and theorical max size of a PDU seems to be quite bigger.

I am probably failing to understand something here but I don't know what and I am a bit stuck so any help appreciated :)

@MatMaul
Copy link
Author

MatMaul commented May 13, 2023

bjoernQ/bleps#2 mentions 32 bytes as a limit, but it seems to work with esp-idf so I am unsure where is the limit exactly, and if I can cut the packets somehow.

@MatMaul
Copy link
Author

MatMaul commented May 14, 2023

I found this in esp-nimble that also seems to point at a limit, but I am having no trouble when doing that with esp32-nimble in Rust:

let device = esp32_nimble::BLEDevice::take();
let ble_advertising = device.get_advertising().name("I have a big big big name");
ble_advertising.service_data(
  esp32_nimble::utilities::BleUuid::Uuid16(SERVICE_UUID),
  bytes.as_slice(),
);
_ = ble_advertising.start();

With the size of the name and the data quite bigger than 32 bytes.
I can see the packet in Android app nRF Connect.

I am clearly missing something but I still don't know what.

@MatMaul
Copy link
Author

MatMaul commented May 14, 2023

RIGHT so I think I found my answer: if the size is too big esp32-nimble puts the name in scan_rsp_data instead of adv_data, cf here.

@MatMaul
Copy link
Author

MatMaul commented May 14, 2023

Anddd I also found what I need in the spec. I just added support for scan_rsp in bleps, it works, closing this and I will soon open a PR to bleps, sorry for the noise.

@MatMaul MatMaul closed this as completed May 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant