Fluke/dbus refactor

This commit is contained in:
Luke Jones
2023-12-03 20:44:01 +00:00
parent f6e4cc0626
commit 0a69c23288
143 changed files with 5421 additions and 10343 deletions

View File

@@ -1,5 +1,5 @@
use rog_anime::usb::{AnimAwake, AnimBooting, AnimShutdown, AnimSleeping, Brightness};
use rog_anime::{AnimeDataBuffer, DeviceState as AnimeDeviceState};
use rog_anime::usb::Brightness;
use rog_anime::{Animations, AnimeDataBuffer, DeviceState as AnimeDeviceState};
use zbus::dbus_proxy;
#[dbus_proxy(
@@ -8,41 +8,58 @@ use zbus::dbus_proxy;
default_path = "/org/asuslinux/Anime"
)]
trait Anime {
/// Set the global base brightness
fn set_brightness(&self, bright: Brightness) -> zbus::Result<()>;
/// Set whether the AniMe will show boot, suspend, or off animations
fn set_builtins_enabled(&self, enabled: bool) -> zbus::Result<()>;
/// Set which builtin animation is used for each stage
fn set_builtin_animations(
&self,
boot: AnimBooting,
awake: AnimAwake,
sleep: AnimSleeping,
shutdown: AnimShutdown,
) -> zbus::Result<()>;
/// Set whether the AniMe is displaying images/data
fn set_enable_display(&self, status: bool) -> zbus::Result<()>;
/// SetOffWhenLidClosed method
fn set_off_when_lid_closed(&self, enabled: bool) -> zbus::Result<()>;
/// SetOffWhenSuspended method
fn set_off_when_suspended(&self, enabled: bool) -> zbus::Result<()>;
/// SetOffWhenUnplugged method
fn set_off_when_unplugged(&self, enabled: bool) -> zbus::Result<()>;
/// Writes a data stream of length. Will force system thread to exit until
/// it is restarted
fn write(&self, input: AnimeDataBuffer) -> zbus::Result<()>;
// #[dbus_proxy(property)]
/// DeviceState method
fn device_state(&self) -> zbus::Result<AnimeDeviceState>;
/// RunMainLoop method
fn run_main_loop(&self, start: bool) -> zbus::Result<()>;
/// Write method
fn write(&self, input: AnimeDataBuffer) -> zbus::Result<()>;
/// NotifyDeviceState signal
#[dbus_proxy(signal)]
fn notify_device_state(&self, data: AnimeDeviceState) -> zbus::Result<()>;
/// Brightness property
#[dbus_proxy(property)]
fn brightness(&self) -> zbus::Result<Brightness>;
#[dbus_proxy(property)]
fn set_brightness(&self, value: Brightness) -> zbus::Result<()>;
/// BuiltinAnimations property
#[dbus_proxy(property)]
fn builtin_animations(&self) -> zbus::Result<Animations>;
#[dbus_proxy(property)]
fn set_builtin_animations(&self, value: Animations) -> zbus::Result<()>;
/// BuiltinsEnabled property
#[dbus_proxy(property)]
fn builtins_enabled(&self) -> zbus::Result<bool>;
#[dbus_proxy(property)]
fn set_builtins_enabled(&self, value: bool) -> zbus::Result<()>;
/// EnableDisplay property
#[dbus_proxy(property)]
fn enable_display(&self) -> zbus::Result<bool>;
#[dbus_proxy(property)]
fn set_enable_display(&self, value: bool) -> zbus::Result<()>;
/// OffWhenLidClosed property
#[dbus_proxy(property)]
fn off_when_lid_closed(&self) -> zbus::Result<bool>;
#[dbus_proxy(property)]
fn set_off_when_lid_closed(&self, value: bool) -> zbus::Result<()>;
/// OffWhenSuspended property
#[dbus_proxy(property)]
fn off_when_suspended(&self) -> zbus::Result<bool>;
#[dbus_proxy(property)]
fn set_off_when_suspended(&self, value: bool) -> zbus::Result<()>;
/// OffWhenUnplugged property
#[dbus_proxy(property)]
fn off_when_unplugged(&self) -> zbus::Result<bool>;
#[dbus_proxy(property)]
fn set_off_when_unplugged(&self, value: bool) -> zbus::Result<()>;
}