deviceplug / btleplug

Rust Cross-Platform Host-Side Bluetooth LE Access Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Strange and undescribed error thrown once discovering services is called

xrnss opened this issue · comments

commented

Describe the bug
After connecting and running the following lines, the error thrown is Error: Other("Error { code: HRESULT(0x8000FFFF), message: \"Catastrophic failure\" }")

let is_connected = peripheral.is_connected().await?;
println!("Now connected ({:?}) to peripheral {:?}...", is_connected, &local_name);
peripheral.discover_services().await?;
println!("Discover peripheral {:?} services...", &local_name);

Actual behavior

Connecting to peripheral "DMRRBA-004"...
Now connected (true) to peripheral "DMRRBA-004"...
Error: Other("Error { code: HRESULT(0x8000FFFF), message: \"Catastrophic failure\" }")
commented

After restarting my computer, the device does not change to connected true but instead sits and waits before throwing this simple message..? I assumed that .connect() was to connect the device??

Error connecting to peripheral, skipping: Not connected

if !is_connected {
                    println!("Connecting to peripheral {:?}...", &local_name);
                    if let Err(err) = peripheral.connect().await {
                        eprintln!("Error connecting to peripheral, skipping: {}", err);
                        continue;
                    }
                }

I've encountered this as well, but only on Windows. Both in a Windows 10 VM with a USB bluetooth dongle attached to the VM and on a laptop running Windows natively, it throws the above error whenever I invoke discover_services(). This is after having connected to the peripheral, just like xrnss's example. On Linux (Ubuntu 23.10), no such error is thrown and it correctly discovers the services and characteristics.

I've confirmed this issue does not exist in v0.10.5, but does in v0.11.0