Proxy WIP

This commit is contained in:
Vasiliy Doylov 2024-10-27 20:08:20 +03:00
parent de6cf981e9
commit 7f1afd715f
Signed by: NekoCWD
GPG key ID: B7BE22D44474A582
4 changed files with 55 additions and 2 deletions

24
src/callaudiod.vala Normal file
View file

@ -0,0 +1,24 @@
using GLib;
[DBus(name = "org.mobian_project.CallAudio", timeout = 120000)]
public interface CallAudioD : GLib.Object {
[DBus(name = "SelectMode")]
public abstract bool select_mode(uint mode) throws DBusError, IOError;
[DBus(name = "AudioMode")]
public abstract uint audio_mode { get; }
[DBus(name = "EnableSpeaker")]
public abstract bool enable_speaker(bool enable) throws DBusError, IOError;
[DBus(name = "SpeakerState")]
public abstract uint speaker_state { get; }
[DBus(name = "MuteMic")]
public abstract bool mute_mic(bool mute) throws DBusError, IOError;
[DBus(name = "MicState")]
public abstract uint mic_state { get; }
}

View file

@ -17,8 +17,18 @@
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
int main (string[] args) {
stdout.printf ("Hello World\n");
Q6MeowD q6meowd_proxy = Bus.get_proxy_sync (BusType.SYSTEM, "org.postmarketos.q6meowd", "/org/postmarketos/q6meowd", DBusProxyFlags.NONE);
CallAudioD callaudiod_proxy = Bus.get_proxy_sync (BusType.SESSION, "org.mobian_project.CallAudio", "/org/mobian_project/CallAudio", DBusProxyFlags.NONE);
((DBusProxy) callaudiod_proxy).g_properties_changed.connect ((props, inv) => {
foreach (var prop in props) {
var name = prop.get_child_value (0).get_string ();
if (name == "SpeakerState") {
q6meowd_proxy.stop_stream ();
q6meowd_proxy.start_stream ();
}
}
});
new MainLoop ().run ();
return 0;
}

View file

@ -1,5 +1,7 @@
q6meow_output_switcher_sources = [
'main.vala',
'q6meowd.vala',
'callaudiod.vala',
]
q6meow_output_switcher_deps = [

17
src/q6meowd.vala Normal file
View file

@ -0,0 +1,17 @@
using GLib;
[DBus(name = "org.postmarketos.q6meowd", timeout = 120000)]
public interface Q6MeowD : GLib.Object {
[DBus(name = "StartStream")]
public abstract bool start_stream() throws DBusError, IOError;
[DBus(name = "StopStream")]
public abstract bool stop_stream() throws DBusError, IOError;
[DBus(name = "State")]
public abstract bool state { get; }
[DBus(name = "Device")]
public abstract string device { owned get; }
}