mirror of git://git.sysmocom.de/ofono
test: Update test-voicecall to reflect DBus types
This commit is contained in:
parent
cd8df455e1
commit
0a6637bda6
|
@ -10,31 +10,36 @@ def hangup_all():
|
||||||
print "Hanging up"
|
print "Hanging up"
|
||||||
vcmanager.HangupAll()
|
vcmanager.HangupAll()
|
||||||
|
|
||||||
def print_calls(value):
|
def print_calls():
|
||||||
for p in value:
|
calls = vcmanager.GetCalls()
|
||||||
call = dbus.Interface(bus.get_object('org.ofono', p),
|
if (len(calls) != 0):
|
||||||
'org.ofono.VoiceCall')
|
print "No calls available"
|
||||||
properties = call.GetProperties()
|
|
||||||
status = properties['State']
|
|
||||||
lineid = properties['LineIdentification']
|
|
||||||
|
|
||||||
print "Call %s, Status: %s, LineId: %s" %\
|
|
||||||
(p, status, lineid)
|
|
||||||
|
|
||||||
def voicecalls_property_changed(name, value):
|
|
||||||
if name == 'Calls':
|
|
||||||
print "Call list modification>"
|
|
||||||
if len(value) == 0:
|
|
||||||
print "No calls in systems"
|
|
||||||
else:
|
else:
|
||||||
print_calls(value)
|
for path, properties in calls:
|
||||||
else:
|
print " [ %s ]" % (path)
|
||||||
print "VoiceCallManager property: '%s' changed to '%s'" %\
|
|
||||||
(name, value)
|
for key in properties.keys():
|
||||||
|
val = str(properties[key])
|
||||||
|
print " %s = %s" % (key, val)
|
||||||
|
print
|
||||||
|
|
||||||
|
def voicecalls_call_added(path, properties):
|
||||||
|
print " Voice Call [ %s ] Added" % (path)
|
||||||
|
|
||||||
|
for key in properties.keys():
|
||||||
|
val = str(properties[key])
|
||||||
|
print " %s = %s" % (key, val)
|
||||||
|
print
|
||||||
|
|
||||||
|
def voicecalls_call_removed(path):
|
||||||
|
print " Voice Call [ %s ] Removed" % (path)
|
||||||
|
|
||||||
def voicecall_property_changed(name, value):
|
def voicecall_property_changed(name, value):
|
||||||
print "Voicecall property: '%s' changed to '%s'" % (name, value)
|
print "Voicecall property: '%s' changed to '%s'" % (name, value)
|
||||||
|
|
||||||
|
def voicecall_disconnect_reason(reason):
|
||||||
|
print "Voicecall disconnect reason: '%s'" % (reason)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
global vcmanager
|
global vcmanager
|
||||||
|
|
||||||
|
@ -63,14 +68,11 @@ if __name__ == "__main__":
|
||||||
vcmanager = dbus.Interface(bus.get_object('org.ofono', modem),
|
vcmanager = dbus.Interface(bus.get_object('org.ofono', modem),
|
||||||
'org.ofono.VoiceCallManager')
|
'org.ofono.VoiceCallManager')
|
||||||
|
|
||||||
vcmanager.connect_to_signal("PropertyChanged",
|
vcmanager.connect_to_signal("CallAdded", voicecalls_call_added)
|
||||||
voicecalls_property_changed)
|
|
||||||
|
|
||||||
properties = vcmanager.GetProperties()
|
vcmanager.connect_to_signal("CallRemoved", voicecalls_call_removed)
|
||||||
|
|
||||||
print properties['Calls']
|
print_calls()
|
||||||
|
|
||||||
voicecalls_property_changed('Calls', properties['Calls'])
|
|
||||||
|
|
||||||
print "Dialing %s..." % number
|
print "Dialing %s..." % number
|
||||||
obj = vcmanager.Dial(number, "")
|
obj = vcmanager.Dial(number, "")
|
||||||
|
@ -85,6 +87,7 @@ if __name__ == "__main__":
|
||||||
(properties['State'], properties['LineIdentification'])
|
(properties['State'], properties['LineIdentification'])
|
||||||
|
|
||||||
call.connect_to_signal("PropertyChanged", voicecall_property_changed)
|
call.connect_to_signal("PropertyChanged", voicecall_property_changed)
|
||||||
|
call.connect_to_signal("DisconnectReason", voicecall_disconnect_reason)
|
||||||
|
|
||||||
gobject.timeout_add(1000000, hangup_all)
|
gobject.timeout_add(1000000, hangup_all)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue