Hi Bertrand,
On 03/08/2011 10:27 AM, Bertrand Aygon wrote:
---
test/test-message-waiting | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
create mode 100755 test/test-message-waiting
Please also add this to Makefile.am
diff --git a/test/test-message-waiting b/test/test-message-waiting
new file mode 100755
index 0000000..79fe810
--- /dev/null
+++ b/test/test-message-waiting
@@ -0,0 +1,36 @@
+#!/usr/bin/python
+
+import gobject
+import sys
+import dbus
+import dbus.mainloop.glib
+
+def mw_property_changed(name, value):
+ if name == 'VoicemailMessageCount':
There is a mix of tabs and spaces here.
+ print "MessageWaiting property: '%s' changed to
'%d'" % (name, value)
+ else:
+ print "MessageWaiting property: '%s' changed to '%s'" %
(name, value)
+
Can you rewrite the code to not go over 80 characters per line? Even in
our test scripts we try to stick to that rule.
+if __name__ == "__main__":
+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+
+ bus = dbus.SystemBus()
+
+ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+ 'org.ofono.Manager')
+
+ modems = manager.GetModems()
+
+ mw = dbus.Interface(bus.get_object('org.ofono', modems[0][0]),
+ 'org.ofono.MessageWaiting')
+
+ mw.connect_to_signal("PropertyChanged", mw_property_changed)
+
+ properties = mw.GetProperties()
+
+ print "Voicemail waiting: %s" % (properties['VoicemailWaiting'])
+ print "Voicemail message count: %d" %
(properties['VoicemailMessageCount'])
+ print "Voicemail mailbox number: %s" %
(properties['VoicemailMailboxNumber'])
+
+ mainloop = gobject.MainLoop()
+ mainloop.run()
Regards,
-Denis