Check what is going on with the RTC
authorEnrico Zini <enrico@enricozini.org>
Wed, 19 Aug 2009 13:37:12 +0000 (14:37 +0100)
committerEnrico Zini <enrico@enricozini.org>
Wed, 19 Aug 2009 13:37:12 +0000 (14:37 +0100)
src/clock.vala

index b140c6189e74d38510472f2c620bdc5bd016ee5d..0545fe9feebb068550b8665558eb47ac8fa4e8fc 100644 (file)
@@ -68,7 +68,7 @@ public class Clock: zavai.Service
     protected AlarmNotification listener;
 
        protected dynamic DBus.Object otimed_alarm;
-       protected dynamic DBus.Object notification;
+       protected dynamic DBus.Object rtc;
     protected SList<Alarm> alarms;
 
     // Ticks once a minute
@@ -96,16 +96,14 @@ public class Clock: zavai.Service
                        "org.freesmartphone.otimed",
                        "/org/freesmartphone/Time/Alarm",
                        "org.freesmartphone.Time.Alarm");
-        if (otimed_alarm == null)
-            zavai.log.error("ALARM IS NULL");
+
+               rtc = zavai.registry.sbus.get_object(
+                       "org.freesmartphone.odeviced",
+                       "/org/freesmartphone/Device/RealTimeClock/0",
+                       "org.freesmartphone.RealTimeClock");
 
         zavai.registry.sbus.register_object("/", listener);
 
-        //notification = zavai.registry.sbus.get_object(
-        //    "org.freesmartphone",
-        //    "org/freesmartphone/Notification",
-        //    "org.freesmartphone.Notification");
-        //notification.Alarm += on_alarm;
        }
 
     public Alarm? next_alarm()
@@ -137,6 +135,9 @@ public class Clock: zavai.Service
             } catch (Error e) {
                 zavai.log.error("Cannot reschedule alarms: " + e.message);
             }
+
+stderr.printf("Current time: %d, RTC time: %d\n", (int)time_t(), (int)rtc.GetCurrentTime());
+stderr.printf("Scheduled alarm: %d, RTC wakeup time: %d\n", (int)alarms.data.deadline, (int)rtc.GetWakeupTime());
         } else
             zavai.log.info("No alarms left to reschedule");
         schedule_changed();