File: test-message-waiting

package info (click to toggle)
ofono 2.18-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,064 kB
  • sloc: ansic: 224,979; sh: 5,012; python: 4,040; makefile: 956
file content (40 lines) | stat: -rwxr-xr-x 1,029 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/python3

from gi.repository import GLib
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 = GLib.MainLoop()
	mainloop.run()