use super::adapter::Adapter;
use crate::{api, Result};
use async_trait::async_trait;
use windows::Devices::Radios::{Radio, RadioKind};
#[derive(Clone, Debug)]
pub struct Manager {}
impl Manager {
pub async fn new() -> Result<Self> {
Ok(Self {})
}
}
#[async_trait]
impl api::Manager for Manager {
type Adapter = Adapter;
async fn adapters(&self) -> Result<Vec<Adapter>> {
let mut result: Vec<Adapter> = vec![];
let radios = Radio::GetRadiosAsync().unwrap().await.unwrap();
for radio in &radios {
let kind = radio.Kind().unwrap();
if kind == RadioKind::Bluetooth {
result.push(Adapter::new());
}
}
return Ok(result);
}
}