We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug The function at file winrtble\ble\characteristic.rs
winrtble\ble\characteristic.rs
pub async fn write_value(&self, data: &[u8], write_type: WriteType) -> Result<()> { .... let result = operation.await?; .... }
return an error: { code: HRESULT(0x80000013), message: "该对象已关闭。" }
Expected behavior
Actual behavior
Additional context Windows info: OS 名称: Microsoft Windows 10 企业版 LTSC OS 版本: 10.0.17763 Build 17763
code:
let manager = Manager::new().await?; let adapter_list = manager.adapters().await?; if adapter_list.is_empty() { eprintln!("No Bluetooth adapters found"); } let adapter = adapter_list.into_iter().next().unwrap(); println!("Starting scan on {}...", adapter.adapter_info().await?); adapter .start_scan(ScanFilter::default()) .await .expect("Can't scan BLE adapter for connected devices..."); time::sleep(Duration::from_secs(10)).await; let peripherals = adapter.peripherals().await?; if peripherals.is_empty() { eprintln!("->>> BLE peripheral devices were not found, sorry. Exiting..."); } else { // All peripheral devices in range for peripheral in peripherals.iter() { let properties = peripheral.properties().await?; // let is_connected = peripheral.is_connected().await?; let local_name = properties .unwrap() .local_name .unwrap_or(String::from("(peripheral name unknown)")); if local_name != "73429519" { continue; } println!("Connecting to peripheral {:?}...", &local_name); if let Err(err) = peripheral.connect().await { eprintln!("Error connecting to peripheral, skipping: {}", err); continue; } let is_connected = peripheral.is_connected().await?; println!( "Now connected ({:?}) to peripheral {:?}...", is_connected, &local_name ); println!("Discover peripheral {:?} services...", &local_name); match peripheral.discover_services().await { Ok(()) => { let chars = peripheral.characteristics(); let write_char = chars.into_iter() .find(|c| c.uuid == WRITE_UUID) .expect("Can't find WRITE_UUID in peripheral"); println!("Discovered peripheral {} with UUID {}", &local_name, WRITE_UUID); let data = hex::decode("7e01000000000000040000000501200000217e") .unwrap(); if let Err(e) = peripheral.write(&write_char, &data, WriteType::WithoutResponse) .await { eprintln!("Error writing to peripheral, skipping: {}", e); } }, Err(err) => { eprintln!("Error discovering peripheral {}: {}", &local_name, err); } } } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
The function at file
winrtble\ble\characteristic.rs
return an error:
{ code: HRESULT(0x80000013), message: "该对象已关闭。" }
Expected behavior
Actual behavior
Additional context
Windows info:
OS 名称: Microsoft Windows 10 企业版 LTSC
OS 版本: 10.0.17763 Build 17763
code:
The text was updated successfully, but these errors were encountered: