Hi Pekka,
On 11/11/2010 06:54 AM, Pekka.Pessi(a)nokia.com wrote:
From: Pekka Pessi <Pekka.Pessi(a)nokia.com>
---
test/answer-calls | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/test/answer-calls b/test/answer-calls
index 0deb832..1218c66 100755
--- a/test/answer-calls
+++ b/test/answer-calls
@@ -4,8 +4,11 @@ import dbus
bus = dbus.SystemBus()
-manager = dbus.Interface(bus.get_object('org.ofono', '/'),
- 'org.ofono.Manager')
+def oface(path, name):
+ obj = bus.get_object('org.ofono', path)
+ return dbus.Interface(obj, name)
+
+manager = oface('/', 'org.ofono.Manager')
I'd really like to keep things consistent even inside the test
directory. Right now we have about two or three distinct styles of
python, and this change isn't helping ;)
modems = manager.GetModems()
@@ -15,8 +18,7 @@ for path, properties in modems:
if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
continue
- mgr = dbus.Interface(bus.get_object('org.ofono', path),
- 'org.ofono.VoiceCallManager')
+ mgr = oface(path, 'org.ofono.VoiceCallManager')
calls = mgr.GetCalls()
@@ -24,10 +26,8 @@ for path, properties in modems:
state = properties["State"]
print "[ %s ] %s" % (path, state)
- if state != "incoming":
- continue
-
- call = dbus.Interface(bus.get_object('org.ofono', path),
- 'org.ofono.VoiceCall')
+ if state == "incoming":
+ oface(path, 'org.ofono.VoiceCall').Answer()
+ elif state == "waiting":
+ mgr.HoldAndAnswer()
Actually I'd prefer a separate script for this.
- call.Answer()
Regards,
-Denis