summaryrefslogtreecommitdiffstats
path: root/test/test-modem
blob: c91caa3cb67e26bf2937874b089f8f1f839efa0c (plain)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/python

import gobject

import dbus
import dbus.mainloop.glib

def property_changed(name, value):
	print "Modem 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()
	modem = dbus.Interface(bus.get_object('org.ofono', modems[0][0]),
							'org.ofono.Modem')

	modem.connect_to_signal("PropertyChanged", property_changed)

	properties = modem.GetProperties()

	if properties.has_key('Name'):
		print "Name: %s" % (properties['Name'])

	if properties.has_key('Manufacturer'):
		print "Manufacturer: %s" % (properties['Manufacturer'])

	if properties.has_key('Model'):
		print "Model: %s" % (properties['Model'])

	if properties.has_key('Revision'):
		print "Revision: %s" % (properties['Revision'])

	if properties.has_key('Serial'):
		print "Serial: %s" % (properties['Serial'])

	if properties.has_key('Powered'):
		print "Powered: %s" % (properties['Powered'])

	if properties.has_key('Online'):
		print "Online: %s" % (properties['Online'])

	if properties.has_key('Lockdown'):
		print "Lockdown: %s" % (properties['Lockdown'])

	if properties.has_key('Emergency'):
		print "Emergency: %s" % (properties['Emergency'])

	if properties.has_key('Features'):
		print "Features:"
		for feature in properties["Features"]:
			print "    [ %s ]" % (feature)

	if properties.has_key('Interfaces'):
		print "Interfaces:"
		for interface in properties["Interfaces"]:
			print "    [ %s ]" % (interface)

	mainloop = gobject.MainLoop()
	mainloop.run()