blob: ddae6d3e4ac13116138b6bba9b5e0ee91d26e9ff (
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
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
|
#!/usr/bin/python3
from gi.repository import GLib
import dbus
import dbus.mainloop.glib
def property_changed(property, value):
print("CallBarring property %s changed to %s" % (property, value))
def print_properties(cb):
properties = cb.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')
modems = manager.GetModems()
cb = dbus.Interface(bus.get_object('org.ofono', modems[0][0]),
'org.ofono.CallBarring')
cb.connect_to_signal("PropertyChanged", property_changed)
ss = dbus.Interface(bus.get_object('org.ofono', modems[0]),
'org.ofono.SupplementaryServices')
print_properties(cb)
print("Trying invalid SS request for CB")
try:
print(ss.Initiate("*33#456666"))
except dbus.DBusException as e:
print("Failed with %s - Good" % e)
print("Trying invalid SS request for CB")
try:
print(ss.Initiate("*33*ABC#"))
except dbus.DBusException as e:
print("Failed with %s - Good" % e)
print("Trying invalid SS request for CB")
try:
print(ss.Initiate("*33**ABC#"))
except dbus.DBusException as e:
print("Failed with %s - Good" % e)
print("Trying invalid SS request for CB")
try:
print(ss.Initiate("*33***12#"))
except dbus.DBusException as e:
print("Failed with %s - Good" % e)
print("Query Outgoing All")
print(ss.Initiate("*#33#"))
print("Query Outgoing International")
print(ss.Initiate("*#331#"))
print("Query Outgoing except home country")
print(ss.Initiate("*#332#"))
print("Query Incoming All")
print(ss.Initiate("*#35#"))
print("Query Incoming while Roaming")
print(ss.Initiate("*#351#"))
print("Query All Outgoing")
print(ss.Initiate("*#333#"))
print("Query All Incoming")
print(ss.Initiate("*#353#"))
print("Query All")
print(ss.Initiate("*#330#"))
print("Enable Barring for Outgoing International calls for Voice")
print(ss.Initiate("*33*3579*11#"))
print_properties(cb)
print("Disable All Barrings")
print(ss.Initiate("#330*3579#"))
mainloop = GLib.MainLoop()
mainloop.run()
|