use crate::DriverCallback;
use crate::DriverContext;
use crate::{
DriverCategory, DriverResult,
types::{Driver, DriverParameter},
};
use serde_json::{Value, json};
use std::collections::HashMap;
use tracing::{debug, info};
#[derive(Debug)]
pub struct BluetoothProfileListDriver;
#[async_trait::async_trait]
impl Driver for BluetoothProfileListDriver {
fn name(&self) -> &str {
"bluetooth_profile_list"
}
fn description(&self) -> &str {
"List supported Bluetooth profiles on the system (A2DP, HFP, SPP, etc.)"
}
fn usage_hint(&self) -> &str {
"Use this skill to see what Bluetooth profiles your system supports."
}
fn parameters(&self) -> Vec<DriverParameter> {
return vec![];
}
fn example_call(&self) -> DriverResult<Value> {
return Ok(json!({
"action": "bluetooth_profile_list"
}));
}
fn example_output(&self) -> String {
"Supported Bluetooth Profiles:\n1. A2DP (Audio)\n2. HFP (Hands-Free)\n3. SPP (Serial Port)\n4. HID (Human Interface)".to_string()
}
fn category(&self) -> DriverCategory {
DriverCategory::Bluetooth
}
async fn execute(
&self,
_parameters: &HashMap<String, Value>,
callback: Option<&dyn DriverCallback>,
context: Option<&DriverContext>,
) -> DriverResult<String> {
debug!("Executing bluetooth_profile_list driver");
let profiles = vec![
"A2DP (Audio Source/Sink)",
"HFP (Hands-Free Profile)",
"HSP (Headset Profile)",
"SPP (Serial Port Profile)",
"HID (Human Interface Device)",
"PAN (Personal Area Networking)",
"OBEX (Object Exchange)",
"GATT (Generic Attribute Profile)",
];
debug!("Found {} supported profiles", profiles.len());
let mut result = String::from("Supported Bluetooth Profiles:\n");
for (i, profile) in profiles.iter().enumerate() {
result.push_str(&format!("{}. {}\n", i + 1, profile));
}
info!("Listed {} supported Bluetooth profiles", profiles.len());
Ok(result)
}
}