[PATCH] test: Add new script for GCF testing

2012-07-30 Thread Guillaume Zajac
---
 Makefile.am  |3 ++-
 test/hold-and-answer |   20 
 2 files changed, 22 insertions(+), 1 deletions(-)
 create mode 100755 test/hold-and-answer

diff --git a/Makefile.am b/Makefile.am
index b35cf1f..4410043 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -622,7 +622,8 @@ test_scripts = test/backtrace \
test/set-context-property \
test/test-gnss \
test/swap-calls \
-   test/release-and-answer
+   test/release-and-answer \
+   test/hold-and-answer
 
 if TEST
 testdir = $(pkglibdir)/test
diff --git a/test/hold-and-answer b/test/hold-and-answer
new file mode 100755
index 000..2c47e27
--- /dev/null
+++ b/test/hold-and-answer
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+
+import sys
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+
+modems = manager.GetModems()
+modem = modems[0][0]
+
+if (len(sys.argv) == 2):
+   modem = sys.argv[1]
+
+manager = dbus.Interface(bus.get_object('org.ofono', modem),
+   'org.ofono.VoiceCallManager')
+
+manager.HoldAndAnswer(timeout=100)
-- 
1.7.5.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 1/2] test: Rename script hangup-active to hangup

2012-07-30 Thread Guillaume Zajac
---
 Makefile.am|2 +-
 test/hangup|   29 +
 test/hangup-active |   29 -
 3 files changed, 30 insertions(+), 30 deletions(-)
 create mode 100755 test/hangup
 delete mode 100755 test/hangup-active

diff --git a/Makefile.am b/Makefile.am
index 4410043..a3681c3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -554,7 +554,7 @@ test_scripts = test/backtrace \
test/enter-pin \
test/reset-pin \
test/hangup-all \
-   test/hangup-active \
+   test/hangup \
test/set-mms-details \
test/set-roaming-allowed \
test/list-contexts \
diff --git a/test/hangup b/test/hangup
new file mode 100755
index 000..6444b23
--- /dev/null
+++ b/test/hangup
@@ -0,0 +1,29 @@
+#!/usr/bin/python
+
+import sys
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+
+modems = manager.GetModems()
+path = modems[0][0]
+
+manager = dbus.Interface(bus.get_object('org.ofono', path),
+   'org.ofono.VoiceCallManager')
+
+calls = manager.GetCalls()
+
+for path, properties in calls:
+   state = properties[State]
+   print [ %s ] %s % (path, state)
+
+   if state != active:
+   continue
+
+   call = dbus.Interface(bus.get_object('org.ofono', path),
+   'org.ofono.VoiceCall')
+
+   call.Hangup()
diff --git a/test/hangup-active b/test/hangup-active
deleted file mode 100755
index 6444b23..000
--- a/test/hangup-active
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/python
-
-import sys
-import dbus
-
-bus = dbus.SystemBus()
-
-manager = dbus.Interface(bus.get_object('org.ofono', '/'),
-   'org.ofono.Manager')
-
-modems = manager.GetModems()
-path = modems[0][0]
-
-manager = dbus.Interface(bus.get_object('org.ofono', path),
-   'org.ofono.VoiceCallManager')
-
-calls = manager.GetCalls()
-
-for path, properties in calls:
-   state = properties[State]
-   print [ %s ] %s % (path, state)
-
-   if state != active:
-   continue
-
-   call = dbus.Interface(bus.get_object('org.ofono', path),
-   'org.ofono.VoiceCall')
-
-   call.Hangup()
-- 
1.7.5.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 2/2] test: Tweak hangup script to clear waiting active and held calls

2012-07-30 Thread Guillaume Zajac
---
 test/hangup |   12 +++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/test/hangup b/test/hangup
index 6444b23..60858a8 100755
--- a/test/hangup
+++ b/test/hangup
@@ -3,6 +3,16 @@
 import sys
 import dbus
 
+if (len(sys.argv)  2):
+   print Usage: %s call state % (sys.argv[0])
+   sys.exit(1)
+
+cstate = sys.argv[1]
+
+if cstate != active and cstate != waiting and cstate != held:
+   print Valid call state is active / waiting / held
+   sys.exit(1)
+
 bus = dbus.SystemBus()
 
 manager = dbus.Interface(bus.get_object('org.ofono', '/'),
@@ -20,7 +30,7 @@ for path, properties in calls:
state = properties[State]
print [ %s ] %s % (path, state)
 
-   if state != active:
+   if state != cstate:
continue
 
call = dbus.Interface(bus.get_object('org.ofono', path),
-- 
1.7.5.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 1/2] test: Rename script hangup-active to hangup

2012-07-30 Thread Marcel Holtmann
Hi Guillaume,

  Makefile.am|2 +-
  test/hangup|   29 +
  test/hangup-active |   29 -
  3 files changed, 30 insertions(+), 30 deletions(-)
  create mode 100755 test/hangup
  delete mode 100755 test/hangup-active

and why are we renaming this?

Regards

Marcel


___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 2/2] test: Tweak hangup script to clear waiting active and held calls

2012-07-30 Thread Marcel Holtmann
Hi Guillaume,

  test/hangup |   12 +++-
  1 files changed, 11 insertions(+), 1 deletions(-)

this is a case where you should have done a summary email to describe
why are you doing things.

 
 diff --git a/test/hangup b/test/hangup
 index 6444b23..60858a8 100755
 --- a/test/hangup
 +++ b/test/hangup
 @@ -3,6 +3,16 @@
  import sys
  import dbus
  
 +if (len(sys.argv)  2):
 + print Usage: %s call state % (sys.argv[0])
 + sys.exit(1)
 +
 +cstate = sys.argv[1]
 +
 +if cstate != active and cstate != waiting and cstate != held:
 + print Valid call state is active / waiting / held
 + sys.exit(1)
 +

If you wanna do things like this, then at least the call without
parameter should list the current calls and in what state they are.
Otherwise this is making things worse.

And don't bother renaming the script first. Just introduce a new script
and delete the duplicate later on.

Regards

Marcel


___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono