Skip to content

Extended Advertising Events are missed when the message length is longer than 57 bytes #330

Description

@turbinenreiter

Describe the bug

I think I found an issue with Extended Advertising messages.
We are developing a BLE device that sends data via manufacturer data in advertising messages.
We confirmed that the messages are sent correctly from our BLE device using an app on a Mac.

But on the client I wrote, running on my Linux machine, I stop receiving advertising events once the message lengths exceed 57 bytes (not 57 bytes of manufacturer data, but 57 bytes of advertising).

This is going to be annoying to reproduce since none of you has our BLE device, but there is the client code anyway:

    #[ignore = "requires a BLE adapter"]
    #[tokio::test]
    async fn reproduce_error() -> Result<()> {
        let manager = Manager::new().await?;
        let adapters = manager.adapters().await?;
        let central = adapters
            .into_iter()
            .next()
            .ok_or(anyhow!("no adapters found"))?;
        central.start_scan(ScanFilter::default()).await?;
        let mut events = central.events().await?;

        while let Some(event) = events.next().await {
            match event {
                CentralEvent::ManufacturerDataAdvertisement {
                    id,
                    manufacturer_data,
                } => {
                    // 42069 is my device
                    //Once the message length exceeds 57 bytes (?), the advertising events stop happening
                    // same code on the microcontroller with less than 57 bytes does produce the events as expected
                    if manufacturer_data.contains_key(&42069) {
                        println!("42069: {:?}", manufacturer_data.get(&42069));
                    } else {
                        println!("{:?}", manufacturer_data.keys().collect::<Vec<&u16>>());
                    }
                }
                _ => {}
            }
        }

        Ok(())
    }

Expected behavior

I expect a CentralEvent::ManufacturerDataAdvertisement event with manufacturer data if a BLE device sends an "Extended Advertising".

Actual behavior

There is no event produced at all.

Additional context

Fedora 38 on Intel with Intel Bluetooth chip. The BLE device is an ESP32-C3 with our firmware.
The Bluetooth chip on my PC is an Intel AX210.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions