mirror of
https://github.com/Xetibo/ReSet.git
synced 2025-09-16 22:59:16 +02:00
feat: Implement new event API
This commit is contained in:
parent
9b93d22085
commit
35d2174136
17 changed files with 178 additions and 164 deletions
|
@ -68,12 +68,12 @@ fn set_card_profile_of_device(device_index: u32, profile_name: String) -> bool {
|
|||
gio::spawn_blocking(move || {
|
||||
let conn = Connection::new_session().unwrap();
|
||||
let proxy = conn.with_proxy(
|
||||
"org.xetibo.ReSet",
|
||||
"/org/xetibo/ReSet",
|
||||
"org.Xetibo.ReSetDaemon",
|
||||
"/org/Xetibo/ReSetDaemon",
|
||||
Duration::from_millis(1000),
|
||||
);
|
||||
let _: Result<(), Error> = proxy.method_call(
|
||||
"org.xetibo.ReSet",
|
||||
"org.Xetibo.ReSetAudio",
|
||||
"SetCardProfileOfDevice",
|
||||
(device_index, profile_name),
|
||||
);
|
||||
|
|
|
@ -39,12 +39,12 @@ impl Listeners {
|
|||
thread::spawn(|| {
|
||||
let conn = Connection::new_session().unwrap();
|
||||
let proxy = conn.with_proxy(
|
||||
"org.xetibo.ReSet",
|
||||
"/org/xetibo/ReSet",
|
||||
"org.Xetibo.ReSetDaemon",
|
||||
"/org/Xetibo/ReSetDaemon",
|
||||
Duration::from_millis(1000),
|
||||
);
|
||||
let _: Result<(bool,), Error> =
|
||||
proxy.method_call("org.xetibo.ReSet", "StopNetworkListener", ());
|
||||
proxy.method_call("org.Xetibo.ReSetWireless", "StopNetworkListener", ());
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ impl arg::ReadAll for SinkAdded {
|
|||
|
||||
impl dbus::message::SignalArgs for SinkAdded {
|
||||
const NAME: &'static str = "SinkAdded";
|
||||
const INTERFACE: &'static str = "org.xetibo.ReSet";
|
||||
const INTERFACE: &'static str = "org.Xetibo.ReSetAudio";
|
||||
}
|
||||
|
||||
impl GetVal<(Sink,)> for SinkAdded {
|
||||
|
@ -104,7 +104,7 @@ impl arg::ReadAll for SinkChanged {
|
|||
|
||||
impl dbus::message::SignalArgs for SinkChanged {
|
||||
const NAME: &'static str = "SinkChanged";
|
||||
const INTERFACE: &'static str = "org.xetibo.ReSet";
|
||||
const INTERFACE: &'static str = "org.Xetibo.ReSetAudio";
|
||||
}
|
||||
|
||||
impl GetVal<(Sink,)> for SinkChanged {
|
||||
|
@ -132,7 +132,7 @@ impl arg::ReadAll for SinkRemoved {
|
|||
|
||||
impl dbus::message::SignalArgs for SinkRemoved {
|
||||
const NAME: &'static str = "SinkRemoved";
|
||||
const INTERFACE: &'static str = "org.xetibo.ReSet";
|
||||
const INTERFACE: &'static str = "org.Xetibo.ReSetAudio";
|
||||
}
|
||||
|
||||
impl GetVal<(u32,)> for SinkRemoved {
|
||||
|
@ -160,7 +160,7 @@ impl arg::ReadAll for InputStreamAdded {
|
|||
|
||||
impl dbus::message::SignalArgs for InputStreamAdded {
|
||||
const NAME: &'static str = "InputStreamAdded";
|
||||
const INTERFACE: &'static str = "org.xetibo.ReSet";
|
||||
const INTERFACE: &'static str = "org.Xetibo.ReSetAudio";
|
||||
}
|
||||
|
||||
impl GetVal<(InputStream,)> for InputStreamAdded {
|
||||
|
@ -188,7 +188,7 @@ impl arg::ReadAll for InputStreamChanged {
|
|||
|
||||
impl dbus::message::SignalArgs for InputStreamChanged {
|
||||
const NAME: &'static str = "InputStreamChanged";
|
||||
const INTERFACE: &'static str = "org.xetibo.ReSet";
|
||||
const INTERFACE: &'static str = "org.Xetibo.ReSetAudio";
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -210,7 +210,7 @@ impl arg::ReadAll for InputStreamRemoved {
|
|||
|
||||
impl dbus::message::SignalArgs for InputStreamRemoved {
|
||||
const NAME: &'static str = "InputStreamRemoved";
|
||||
const INTERFACE: &'static str = "org.xetibo.ReSet";
|
||||
const INTERFACE: &'static str = "org.Xetibo.ReSetAudio";
|
||||
}
|
||||
|
||||
impl GetVal<(u32,)> for InputStreamRemoved {
|
||||
|
@ -238,7 +238,7 @@ impl arg::ReadAll for SourceAdded {
|
|||
|
||||
impl dbus::message::SignalArgs for SourceAdded {
|
||||
const NAME: &'static str = "SourceAdded";
|
||||
const INTERFACE: &'static str = "org.xetibo.ReSet";
|
||||
const INTERFACE: &'static str = "org.Xetibo.ReSetAudio";
|
||||
}
|
||||
|
||||
impl GetVal<(Source,)> for SourceAdded {
|
||||
|
@ -266,7 +266,7 @@ impl arg::ReadAll for SourceChanged {
|
|||
|
||||
impl dbus::message::SignalArgs for SourceChanged {
|
||||
const NAME: &'static str = "SourceChanged";
|
||||
const INTERFACE: &'static str = "org.xetibo.ReSet";
|
||||
const INTERFACE: &'static str = "org.Xetibo.ReSetAudio";
|
||||
}
|
||||
|
||||
impl GetVal<(Source,)> for SourceChanged {
|
||||
|
@ -294,7 +294,7 @@ impl arg::ReadAll for SourceRemoved {
|
|||
|
||||
impl dbus::message::SignalArgs for SourceRemoved {
|
||||
const NAME: &'static str = "SourceRemoved";
|
||||
const INTERFACE: &'static str = "org.xetibo.ReSet";
|
||||
const INTERFACE: &'static str = "org.Xetibo.ReSetAudio";
|
||||
}
|
||||
|
||||
impl GetVal<(u32,)> for SourceRemoved {
|
||||
|
@ -322,7 +322,7 @@ impl arg::ReadAll for OutputStreamAdded {
|
|||
|
||||
impl dbus::message::SignalArgs for OutputStreamAdded {
|
||||
const NAME: &'static str = "OutputStreamAdded";
|
||||
const INTERFACE: &'static str = "org.xetibo.ReSet";
|
||||
const INTERFACE: &'static str = "org.Xetibo.ReSetAudio";
|
||||
}
|
||||
|
||||
impl GetVal<(OutputStream,)> for OutputStreamAdded {
|
||||
|
@ -350,7 +350,7 @@ impl arg::ReadAll for OutputStreamChanged {
|
|||
|
||||
impl dbus::message::SignalArgs for OutputStreamChanged {
|
||||
const NAME: &'static str = "OutputStreamChanged";
|
||||
const INTERFACE: &'static str = "org.xetibo.ReSet";
|
||||
const INTERFACE: &'static str = "org.Xetibo.ReSetAudio";
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -372,7 +372,7 @@ impl arg::ReadAll for OutputStreamRemoved {
|
|||
|
||||
impl dbus::message::SignalArgs for OutputStreamRemoved {
|
||||
const NAME: &'static str = "OutputStreamRemoved";
|
||||
const INTERFACE: &'static str = "org.xetibo.ReSet";
|
||||
const INTERFACE: &'static str = "org.Xetibo.ReSetAudio";
|
||||
}
|
||||
|
||||
impl GetVal<(u32,)> for OutputStreamRemoved {
|
||||
|
@ -419,20 +419,20 @@ pub fn start_audio_listener(
|
|||
|
||||
fn start_dbus_audio_listener(conn: Connection) -> Connection {
|
||||
let proxy = conn.with_proxy(
|
||||
"org.xetibo.ReSet",
|
||||
"/org/xetibo/ReSet",
|
||||
"org.Xetibo.ReSetDaemon",
|
||||
"/org/Xetibo/ReSetDaemon",
|
||||
Duration::from_millis(1000),
|
||||
);
|
||||
let _: Result<(), Error> = proxy.method_call("org.xetibo.ReSet", "StartAudioListener", ());
|
||||
let _: Result<(), Error> = proxy.method_call("org.Xetibo.ReSetAudio", "StartAudioListener", ());
|
||||
conn
|
||||
}
|
||||
|
||||
fn stop_dbus_audio_listener(conn: Connection) {
|
||||
let proxy = conn.with_proxy(
|
||||
"org.xetibo.ReSet",
|
||||
"/org/xetibo/ReSet",
|
||||
"org.Xetibo.ReSetDaemon",
|
||||
"/org/Xetibo/ReSetDaemon",
|
||||
Duration::from_millis(1000),
|
||||
);
|
||||
let _: Result<(), Error> = proxy.method_call("org.xetibo.ReSet", "StopAudioListener", ());
|
||||
let _: Result<(), Error> = proxy.method_call("org.Xetibo.ReSetAudio", "StopAudioListener", ());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue