[Vala] help with rygael
- From: Dennis Kerrisk <dennis psaudio com>
- To: "'vala-list gnome org'" <vala-list gnome org>
- Subject: [Vala] help with rygael
- Date: Tue, 22 Jun 2010 12:56:23 +0000
We need a way to be able to send data from another program to Rygel via a dbus connection,
that is handled immediately. We have the code in the other program that will send the data to Rygel. Below
is the Rygel class that showing the data we need to get into Rygel. Currently the other program will send
the data to Rygel, but it will not get handled immediately. Can someone help me by showing me how get the
code to get handled immediately??
[DBus (name = "org.gnome.Rygel2")]
public class Rygel.DBusService2 : Object {
private static string RYGEL_SERVICE = "org.gnome.Rygel2";
private static string RYGEL_PATH = "/org/gnome/Ryge2";
private static DBusService2 instance;
public static DBusService2 get_default() {
if (instance != null) {
return instance;
}
try {
instance = new DBusService2();
} catch (DBus.Error err) {
warning ("Failed to create D-Bus service: %s", err.message);
return null;
}
return instance;
}
public int ChangeVolume (uint Cvolume,uint Cmute)
{
stdout.printf ("ChangeVolume
2 to %u Mute to %u\n",Cvolume,Cmute);
return 1;
}
public int ChangePhase (uint Cphase)
{
stdout.printf ("ChangePhase 2
to %u \n",Cphase);
return 1;
}
public int ChangeFilter (string Cfilter)
{
stdout.printf ("ChangeFilter
2 to %s \n",Cfilter);
return 1;
}
public int ChangeInputSelect (string Cinputselect)
{
stdout.printf
("ChangeInputSelect 2 to %s \n",Cinputselect);
return 1;
}
public int ChangeSampleRate (string Csamplerate)
{
stdout.printf
("ChangeSampleRate 2 to %s \n",Csamplerate);
return 1;
}
}
Below is the Rygel main function that I am using:
private static int main (string[] args) {
Main main;
DBusService service;
DBusService2 service2;
NetworkManagerService nm_service;
try {
nm_service = new NetworkManagerService ();
} catch (DBus.Error err) {
warning ("Failed to start D-Bus service: %s", err.message);
}
try {
// Parse commandline options
CmdlineConfig.parse_args (ref args);
main = Main.get_default ();
service = DBusService.get_default ();
} catch (DBus.Error err) {
warning ("Failed to start D-Bus service: %s", err.message);
} catch (CmdlineConfigError.VERSION_ONLY err) {
return 0;
} catch (GLib.Error err) {
error ("%s", err.message);
return -1;
}
try {
var conn1 = DBus.Bus.get(DBus.BusType.SESSION);
dynamic DBus.Object bus = conn1.get_object("org.freedesktop.DBus",
"/org/freedesktop/DBus",
"org.freedesktop.DBus");
// try to register service in session bus
uint reply = bus.request_name("org.gnome.Rygel2", (uint) 0);
assert(reply == DBus.RequestNameReply.PRIMARY_OWNER);
// start service
service2 = new DBusService2();
// service2 = DBusService2.get_default ();
conn1.register_object("/org/gnome/Rygel2", service2);
stdout.printf("dak DBUS Connected to /org/gnome/Rygel2\n");
// start main loop
} catch (DBus.Error err) {
stdout.printf("dak DBUS Error: %s\n", err.message);
}
int exit_code = main.run ();
return exit_code;
}
}
Dennis Kerrisk | Design Engineer | PS Audio
4826 Sterling Drive, Boulder, CO 80301
Ph 720-406-8946 x123
www.psaudio.com<http://www.psaudio.com>
dennis psaudio com<mailto:jim psaudio com>
Dennis Kerrisk | Design Engineer | PS Audio
4826 Sterling Drive, Boulder, CO 80301
Ph 720-406-8946 x123
www.psaudio.com<http://www.psaudio.com>
dennis psaudio com<mailto:jim psaudio com>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]