Open LarryMerino opened 1 year ago
I will answer as I understand it. Sorry if I am wrong.
The maximum size of an advertised packet is 31 bytes. (This is defined in BLE_HS_ADV_MAX_SZ
).
UUID128 is 16 bytes, so if you put two values in the packet, it will exceed 31 bytes, resulting in an error.
If multiple UUIDs are used, UUID16 or UUID32 must be used.
Thanks @taks. It make sense for me. Do you know how can I override this variable at compile time or is mandatory to follow this restriction? Thank you very much again and sorry for my ignorance. regards
This restriction is determined by the BLE specification. Therefore, even if you rewrite this variable, it seems that it will not work properly.
I did some additional research. It appears that Advertising Extensions can be used to increase the amount of data. reference: https://github.com/apache/mynewt-core/issues/1027 (The current implementation does not implement this feature.)
Got it, thank you very much.
It would be nice to have an example with advertising extensions
Is there any support for extended advertising yet?
Seems it's supported with CONFIG_BT_NIMBLE_EXT_ADV=y
, but the sample no longer compiles and some function signatures seem to be changed, so a sample would indeed be nice.
error[E0061]: this method takes 1 argument but 0 arguments were supplied
--> src/main.rs:59:38
|
59 | ble_device.get_advertising().start().unwrap();
| ^^^^^-- an argument of type `u8` is missing
|
note: method defined here
--> /home/leon/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp32-nimble-0.5.1/src/server/ble_ext_advertising.rs:298:10
|
298 | pub fn start(&mut self, inst_id: u8) -> Result<(), BLEReturnCode> {
| ^^^^^
help: provide the argument
|
59 | ble_device.get_advertising().start(/* u8 */).unwrap();
| ~~~~~~~~~~
error[E0599]: no method named `name` found for mutable reference `&mut BLEExtAdvertising` in the current scope
--> src/main.rs:89:10
|
88 | / ble_advertising
89 | | .name(&device_name.as_str())
| | -^^^^ method not found in `&mut BLEExtAdvertising`
| |_________|
|
error[E0061]: this method takes 1 argument but 0 arguments were supplied
--> src/main.rs:94:21
|
94 | ble_advertising.start().unwrap();
| ^^^^^-- an argument of type `u8` is missing
|
note: method defined here
--> /home/leon/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp32-nimble-0.5.1/src/server/ble_ext_advertising.rs:298:10
|
298 | pub fn start(&mut self, inst_id: u8) -> Result<(), BLEReturnCode> {
| ^^^^^
help: provide the argument
|
94 | ble_advertising.start(/* u8 */).unwrap();
| ~~~~~~~~~~
Some errors have detailed explanations: E0061, E0599.
For more information about an error, try `rustc --explain E0061`.
error: could not compile `offline-unlock` (bin "offline-unlock") due to 3 previous errors
Please refer to examples/ble5_multi_advertiser.rs.
※ I'm sorry, but extended advertising has not been tested much.
Please refer to examples/ble5_multi_advertiser.rs.
※ I'm sorry, but extended advertising has not been tested much.
Thanks, must have missed this sample somehow. Will give it a try.
When I add more than one service id to a BLEAdvertising using the add_service_uuid() method, the program panics with the following error message: thread 'main' panicked at 'called
Result::unwrap()
on anErr
value: The provided buffer is too small. This is the code I have: ` let ble_advertising = ble_device_unlocked.get_advertising(); ble_advertising .name("Torrot Kids");`
The panic occurs in the "ble_advertising.start().unwrap();"
If I add just one service id to a BLEAdvertising it works but when I try to add more than one, the program start to panic.
I'm using a ESP32C3 chip.
Is there any solution for this?
Thanks and I'm sorry for not be able to find the problem.