use super::adapter::Adapter;
#[allow(unused_imports)]
use crate::{Error, Result};
use winrt::{
windows::devices::radios::{Radio, RadioKind},
RtAsyncOperation,
};
#[derive(Debug)]
pub struct Manager {}
impl Manager {
pub fn new() -> Result<Self> {
Ok(Self {})
}
pub fn adapters(&self) -> Result<Vec<Adapter>> {
let mut result: Vec<Adapter> = vec![];
let radios = Radio::get_radios_async()
.unwrap()
.blocking_get()
.unwrap()
.unwrap();
for radio in &radios {
if let Some(radio) = radio {
if let Ok(kind) = radio.get_kind() {
if kind == RadioKind::Bluetooth {
result.push(Adapter::new());
}
}
}
}
return Ok(result);
}
}