use super::common::mute;
use crate::{
DriverCallback, DriverCategory, DriverContext, DriverError, DriverResult,
types::{Driver, DriverParameter},
};
use serde_json::{Value, json};
use std::collections::HashMap;
use tracing::{debug, info};
#[derive(Debug)]
pub struct AudioControlMuteDriver;
#[async_trait::async_trait]
impl Driver for AudioControlMuteDriver {
fn name(&self) -> &str {
"audio_control_mute"
}
fn description(&self) -> &str {
"Mute system audio"
}
fn usage_hint(&self) -> &str {
"Use this skill to mute all system sounds."
}
fn parameters(&self) -> Vec<DriverParameter> {
return vec![];
}
fn example_call(&self) -> DriverResult<Value> {
return Ok(json!({
"action": "audio_control_mute"
}));
}
fn example_output(&self) -> String {
"Audio muted".to_string()
}
fn category(&self) -> DriverCategory {
DriverCategory::Audio
}
async fn execute(
&self,
_parameters: &HashMap<String, Value>,
_callback: Option<&dyn DriverCallback>,
_context: Option<&DriverContext>,
) -> DriverResult<String> {
debug!("Executing audio_control_mute driver");
mute().map_err(|e| DriverError::execution(format!("Failed to mute audio: {}", e)))?;
info!("Audio muted");
Ok("Audio muted".to_string())
}
}