mirror of git://git.sysmocom.de/ofono
test: Add test-message-waiting
Add a new test file to validate org.ofono.MessageWaiting interface
This commit is contained in:
parent
8ee5a49fc2
commit
afd4773d54
|
@ -499,7 +499,8 @@ test_scripts = test/backtrace \
|
|||
test/cdma-hangup \
|
||||
test/disable-call-forwarding \
|
||||
test/list-messages \
|
||||
test/test-sms
|
||||
test/test-sms \
|
||||
test/test-message-waiting
|
||||
|
||||
if TEST
|
||||
testdir = $(pkglibdir)/test
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import gobject
|
||||
import sys
|
||||
import dbus
|
||||
import dbus.mainloop.glib
|
||||
|
||||
def mw_property_changed(name, value):
|
||||
if name == 'VoicemailMessageCount':
|
||||
print "MessageWaiting property: '%s' changed to '%d'" %\
|
||||
(name,value)
|
||||
else:
|
||||
print "MessageWaiting property: '%s' changed to '%s'" %\
|
||||
(name,value)
|
||||
|
||||
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()
|
Loading…
Reference in New Issue