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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
#!/usr/bin/python
import gobject
import dbus
import dbus.mainloop.glib
def property_changed(property, value):
print "CallSettings property %s changed to %s" % (property, value)
def print_properties(cs):
properties = cs.GetProperties()
for p in properties:
print "property %s, value: %s" % (p, properties[p])
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')
try:
modems = manager.GetProperties()['Modems']
except dbus.DBusException, e:
print "Unable to get the Modems property %s" % e
cs = dbus.Interface(bus.get_object('org.ofono', modems[0]),
'org.ofono.CallSettings')
cs.connect_to_signal("PropertyChanged", property_changed)
ss = dbus.Interface(bus.get_object('org.ofono', modems[0]),
'org.ofono.SupplementaryServices')
print_properties(cs)
print "Trying invalid SS request for CLIR"
try:
print ss.Initiate("*31#456666")
except dbus.DBusException, e:
print "Failed with %s - Good" % e
print "Trying invalid SS request for CLIR"
try:
print ss.Initiate("*31*455*4#")
except dbus.DBusException, e:
print "Failed with %s - Good" % e
print "Trying invalid SS request for CLIR"
try:
print ss.Initiate("*31**44435#")
except dbus.DBusException, e:
print "Failed with %s - Good" % e
print "Query CLIP"
print ss.Initiate("*#30#")
print "Query COLP"
print ss.Initiate("*#76#")
print "Query CLIR"
print ss.Initiate("*#31#")
print "Activate CLIR"
print ss.Initiate("*31#")
print_properties(cs)
print "Deactivate CLIR"
print ss.Initiate("#31#")
print_properties(cs)
print "Trying invalid SS request for CW"
try:
print ss.Initiate("*43#456666")
except dbus.DBusException, e:
print "Failed with %s - Good" % e
print "Trying invalid SS request for CW"
try:
print ss.Initiate("*43*455*4#")
except dbus.DBusException, e:
print "Failed with %s - Good" % e
print "Trying invalid SS request for CW"
try:
print ss.Initiate("*43**44435#")
except dbus.DBusException, e:
print "Failed with %s - Good" % e
print "Query CW"
print ss.Initiate("*#43#")
print "Query CW, only Voice"
print ss.Initiate("*#43*11#")
print "Query CW, only Fax"
print ss.Initiate("*#43*13#")
print "Disable CW for everything"
print ss.Initiate("#43#");
print_properties(cs)
print "Enable CW for Voice"
print ss.Initiate("*43*11#")
print_properties(cs)
mainloop = gobject.MainLoop()
mainloop.run()
|