All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] test/answer-calls: answer waiting calls, too
@ 2010-11-11 12:54 Pekka.Pessi
  2010-11-11 15:14 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Pekka.Pessi @ 2010-11-11 12:54 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1367 bytes --]

From: Pekka Pessi <Pekka.Pessi@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')
 
 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()
 
-		call.Answer()
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] test/answer-calls: answer waiting calls, too
  2010-11-11 12:54 [PATCH] test/answer-calls: answer waiting calls, too Pekka.Pessi
@ 2010-11-11 15:14 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2010-11-11 15:14 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1772 bytes --]

Hi Pekka,

On 11/11/2010 06:54 AM, Pekka.Pessi(a)nokia.com wrote:
> From: Pekka Pessi <Pekka.Pessi@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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-11-11 15:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-11 12:54 [PATCH] test/answer-calls: answer waiting calls, too Pekka.Pessi
2010-11-11 15:14 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.