d8eebc96ce
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Alexander <akotenev2003@gmail.com>
53 lines
1.9 KiB
Rust
53 lines
1.9 KiB
Rust
//! Клиентские `#[proxy]`-трейты (ipc §3). zbus генерит `Power1Proxy` / `Settings1Proxy`.
|
|
//! Enum-значения передаются строками (`types`); `Settings` — D-Bus variant (`zvariant::Value`/`OwnedValue`).
|
|
|
|
use zbus::proxy;
|
|
use zbus::zvariant::{OwnedValue, Value};
|
|
|
|
/// `ru.shturman.Power1` — питание/жизненный цикл (домен B).
|
|
#[proxy(
|
|
interface = "ru.shturman.Power1",
|
|
default_service = "ru.shturman.Power",
|
|
default_path = "/ru/shturman/Power"
|
|
)]
|
|
pub trait Power1 {
|
|
/// Текущее состояние (enum-строка `PowerState`).
|
|
fn get_power_state(&self) -> zbus::Result<String>;
|
|
/// Внутренний запрос сна (в v0-стабе — no-op).
|
|
fn request_sleep(&self) -> zbus::Result<()>;
|
|
|
|
#[zbus(property)]
|
|
fn ignition_state(&self) -> zbus::Result<String>;
|
|
#[zbus(property)]
|
|
fn uptime(&self) -> zbus::Result<u64>;
|
|
#[zbus(property)]
|
|
fn power_source(&self) -> zbus::Result<String>;
|
|
|
|
#[zbus(signal)]
|
|
fn acc_changed(&self, on: bool) -> zbus::Result<()>;
|
|
#[zbus(signal)]
|
|
fn shutdown_imminent(&self, seconds: u32, reason: String) -> zbus::Result<()>;
|
|
#[zbus(signal)]
|
|
fn shutdown_aborted(&self) -> zbus::Result<()>;
|
|
#[zbus(signal)]
|
|
fn sleep(&self) -> zbus::Result<()>;
|
|
#[zbus(signal)]
|
|
fn wake(&self) -> zbus::Result<()>;
|
|
}
|
|
|
|
/// `ru.shturman.Settings1` — конфигурация и состояние.
|
|
#[proxy(
|
|
interface = "ru.shturman.Settings1",
|
|
default_service = "ru.shturman.Settings",
|
|
default_path = "/ru/shturman/Settings"
|
|
)]
|
|
pub trait Settings1 {
|
|
fn get(&self, key: &str) -> zbus::Result<OwnedValue>;
|
|
fn set(&self, key: &str, value: &Value<'_>) -> zbus::Result<()>;
|
|
fn list(&self, prefix: &str) -> zbus::Result<Vec<String>>;
|
|
fn reset(&self, key: &str) -> zbus::Result<()>;
|
|
|
|
#[zbus(signal)]
|
|
fn changed(&self, key: String, value: OwnedValue) -> zbus::Result<()>;
|
|
}
|