From ab3513158fff36b13884fae09d9ce1ac53210a3a Mon Sep 17 00:00:00 2001 From: Enrico Zini Date: Sun, 29 Nov 2009 17:17:53 +0100 Subject: [PATCH] Managed to export a proper dbus interface for alarm notification --- src/clock.vala | 15 ++++++--------- src/zavai.vala | 13 +++++++------ 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/clock.vala b/src/clock.vala index edc1ca1..5a22847 100644 --- a/src/clock.vala +++ b/src/clock.vala @@ -147,15 +147,12 @@ public class AlarmNotification : Object { public void Alarm () { clock.check_alarms(); } - public void AtAlarm (string label) { - clock.notify(label); - } } [DBus (name = "org.enricozini.zavai.Alarm")] -public class ZavaiAlarm : Object { - public void Notify () { - clock.notify("ciao"); +public class ZavaiClock : Object { + public void Notify (string label) { + clock.notify(label); } } @@ -170,7 +167,7 @@ public class Clock: zavai.Service protected time_t chosen_time; protected SourceType chosen_type; protected AlarmNotification listener; - protected ZavaiAlarm listener1; + protected ZavaiClock dbusClock; protected dynamic DBus.Object otimed_alarm; protected dynamic DBus.Object rtc; @@ -185,7 +182,7 @@ public class Clock: zavai.Service Object(name: "clock"); alarms = null; listener = new AlarmNotification(); - listener1 = new ZavaiAlarm(); + dbusClock = new ZavaiClock(); last_minute = 0; last_gps_time = 0; last_gps_time_system_time = 0; @@ -209,7 +206,7 @@ public class Clock: zavai.Service "org.freesmartphone.Device.RealtimeClock"); zavai.registry.sbus.register_object("/", listener); - + zavai.registry.sbus.register_object("/org/enricozini/Zavai/Clock", dbusClock); } public void notify(string label) diff --git a/src/zavai.vala b/src/zavai.vala index 33e0bd7..467aab6 100644 --- a/src/zavai.vala +++ b/src/zavai.vala @@ -58,7 +58,7 @@ static int main (string[] args) { return 0; */ - if (args[1] == "notify") + if (args.length > 1 && args[1] == "notify") { DBus.Connection sbus; dynamic DBus.Object zav; @@ -71,11 +71,12 @@ static int main (string[] args) { // see mdbus -s org.freesmartphone.ousaged /org/freesmartphone/Usage zav = sbus.get_object( "org.enricozini.zavai", - "/", - "org.freesmartphone.Notification"); - zav.AtAlarm("ciao"); - // "org.enricozini.zavai.Alarm"); - //zav.Notify(); + "/org/enricozini/Zavai/Clock", + "org.enricozini.zavai.Alarm"); + if (args.length > 2) + zav.Notify(args[2]); + else + zav.Notify("Alarm"); return 0; } -- 2.30.2