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 dbus
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object('org.ofono', '/'),
'org.ofono.Manager')
properties = manager.GetProperties()
for path in properties["Modems"]:
modem = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.Modem')
properties = modem.GetProperties()
print "[ %s ]" % (path)
for key in properties.keys():
if key in ["Interfaces"]:
val = ""
for i in properties[key]:
val += i + " "
else:
val = str(properties[key])
print " %s = %s" % (key, val)
for interface in properties["Interfaces"]:
object = dbus.Interface(bus.get_object('org.ofono', path),
interface)
print " [ %s ]" % (interface)
try:
properties = object.GetProperties()
except:
continue
for key in properties.keys():
if key in ["Operators", "Calls",
"MultipartyCalls",
"EmergencyNumbers",
"SubscriberNumbers",
"PreferredLanguages",
"PrimaryContexts",
"LockedPins"]:
val = ""
for i in properties[key]:
val += i + " "
elif key in ["ServiceNumbers"]:
val = ""
for i in properties[key]:
val += "[" + i + "] = '"
val += properties[key][i] + "' "
elif key in ["MobileNetworkCodeLength",
"VoicemailMessageCount",
"MicrophoneVolume",
"SpeakerVolume"]:
val = int(properties[key])
else:
val = str(properties[key])
print " %s = %s" % (key, val)
print
|