use tauri::{AppHandle, Runtime};
use crate::models::{BrightnessPayload, Diagnostics, MonitorInfo};
use crate::Result;
pub struct Brightness<R: Runtime> {
#[allow(dead_code)]
app: AppHandle<R>,
}
impl<R: Runtime> Brightness<R> {
pub fn new(app: AppHandle<R>) -> Self {
Self { app }
}
pub fn list_monitors(&self) -> Vec<MonitorInfo> {
Vec::new()
}
pub fn get_brightness(&self, _id: &str) -> Result<BrightnessPayload> {
Err(unsupported().into())
}
pub fn set_brightness(&self, _id: &str, _value: u8) -> Result<()> {
Err(unsupported().into())
}
pub fn diagnose(&self) -> Diagnostics {
Diagnostics {
i2c_dev_loaded: false,
i2c_dev_sysfs: false,
i2c_devices: Vec::new(),
in_i2c_group: false,
in_video_group: false,
ddcutil_available: false,
ddcutil_detect_output: String::new(),
ddc_hi_count: 0,
ddcutil_count: 0,
backlight_count: 0,
has_nvidia: false,
suggestions: vec![
"Display brightness control is only available on desktop platforms".to_string(),
],
}
}
}
fn unsupported() -> tauri_brightness_core::Error {
tauri_brightness_core::Error::Os(
"display brightness control is not supported on this platform".to_string(),
)
}