Skip to contentSkip to conversation

test: add set-call-forwarding

PATCH In review Jarko Poutiainen 2 participants 2 messages Jan 10, 2011 – Jan 11, 2011 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test: add set-call-forwarding

---
  Makefile.am              |    3 +-
  test/set-call-forwarding |   65 
++++++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 67 insertions(+), 1 deletions(-)

create mode 100755 test/set-call-forwarding

Makefile.am +2 -1
index 8ad01cd..563da9f 100644
@@ -440,7 +440,8 @@ test_scripts = test/backtrace \
          test/set-tty \
          test/set-gsm-band \
          test/set-umts-band \
-        test/lockdown-modem
+        test/lockdown-modem \
+        test/set-call-forwarding
 
  if TEST
  testdir = $(pkglibdir)/test
test/set-call-forwarding new file +12 -0
new file mode 100755
index 0000000..03bf542
@@ -0,0 +1,65 @@
+#!/usr/bin/python
+
+import sys
+import gobject
+
+import dbus
+import dbus.mainloop.glib
+
+def property_changed(property, value):
+
+    if len(value.__str__()) > 0:
+        print "CallForwarding property %s changed to %s" % (property, 

value)
+ else:
+ print "CallForwarding property %s changed to disabled" % (property)
+
+ if canexit:
+ mainloop.quit();
+
+if __name__ == "__main__":
+
+ if len(sys.argv) < 3:

+        print "Usage: %s <property> <value>" % (sys.argv[0])
+        print "Properties can be: VoiceUnconditional, VoiceBusy,"
+        print "    VoiceNoReply, VoiceNoReplyTimeout, VoiceNotReachable"
+        print "Value: number to or the timeout"
+        sys.exit(1)

+
+ property = sys.argv[1]
+ value = sys.argv[2]
+
+ canexit = False
+
+ 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()
+
+ cf = dbus.Interface(bus.get_object('org.ofono', modems[0][0]),
+ 'org.ofono.CallForwarding')
+
+ cf.connect_to_signal("PropertyChanged", property_changed)
+
+ if (property == "VoiceNoReplyTimeout"):
+ try:
+ cf.SetProperty(property, dbus.UInt16(value), timeout = 100)
+ except dbus.DBusException, e:
+ print "Unable SetProperty", e
+ sys.exit(1);
+ else:
+ try:
+ cf.SetProperty(property, value, timeout = 100)
+ except dbus.DBusException, e:
+ print "Unable SetProperty", e
+ sys.exit(1);
+
+ print "Set Property successfull"
+
+ canexit = True
+
+ mainloop = gobject.MainLoop()
+ mainloop.run()

Signature · 1 line
1.7.0.4
#1 lore raw

Hi Jarko,

Quoted 7 lines · Jarko Poutiainen
---
 Makefile.am              |    3 +-
 test/set-call-forwarding |   65
++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 67 insertions(+), 1 deletions(-)
 create mode 100755 test/set-call-forwarding

This patch does not apply cleanly:

Applying: test: add set-call-forwarding /home/denkenz/ofono-master/.git/rebase-apply/patch:39: trailing whitespace.
print "CallForwarding property %s changed to %s" % (property,
fatal: corrupt patch at line 40
Patch failed at 0001 test: add set-call-forwarding
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip". To restore the original branch and stop patching run "git am --abort".

Quoted 20 lines
Makefile.am +2 -1
index 8ad01cd..563da9f 100644
@@ -440,7 +440,8 @@ test_scripts = test/backtrace \
         test/set-tty \
         test/set-gsm-band \
         test/set-umts-band \
-        test/lockdown-modem
+        test/lockdown-modem \
+        test/set-call-forwarding
 
 if TEST
 testdir = $(pkglibdir)/test
test/set-call-forwarding new file +0 -0
new file mode 100755
index 0000000..03bf542

test/set-call-forwarding line 10

Quoted 10 lines
test/set-call-forwarding new file +10 -0
@@ -0,0 +1,65 @@
+#!/usr/bin/python
+
+import sys
+import gobject
+
+import dbus
+import dbus.mainloop.glib
+
+def property_changed(property, value):
+

Can you please get rid of this empty line?

Quoted 7 lines
test/set-call-forwarding new file +2 -0
+    if len(value.__str__()) > 0:
+        print "CallForwarding property %s changed to %s" % (property,

value)

test/set-call-forwarding new file +2 -0
+    else:
+        print "CallForwarding property %s changed to disabled" %

(property)
+

Please don't go over 80 characters / line. This makes this script hard to read.

test/set-call-forwarding

Quoted 5 lines
test/set-call-forwarding new file +5 -0
+    if canexit:
+        mainloop.quit();
+
+if __name__ == "__main__":
+

Please remove this empty line

Quoted 35 lines
test/set-call-forwarding new file +35 -0
+    if len(sys.argv) < 3:
+        print "Usage: %s <property> <value>" % (sys.argv[0])
+        print "Properties can be: VoiceUnconditional, VoiceBusy,"
+        print "    VoiceNoReply, VoiceNoReplyTimeout, VoiceNotReachable"
+        print "Value: number to or the timeout"
+        sys.exit(1)
+
+    property = sys.argv[1]
+    value = sys.argv[2]
+
+    canexit = False
+
+    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()
+
+    cf = dbus.Interface(bus.get_object('org.ofono', modems[0][0]),
+                'org.ofono.CallForwarding')
+
+    cf.connect_to_signal("PropertyChanged", property_changed)
+
+    if (property == "VoiceNoReplyTimeout"):
+        try:
+            cf.SetProperty(property, dbus.UInt16(value), timeout = 100)
+        except dbus.DBusException, e:
+            print "Unable SetProperty", e
+            sys.exit(1);
+    else:
+        try:
+            cf.SetProperty(property, value, timeout = 100)

test/set-call-forwarding

Quoted 10 lines
test/set-call-forwarding new file +10 -0
+        except dbus.DBusException, e:
+            print "Unable SetProperty", e
+            sys.exit(1);
+
+    print "Set Property successfull"
+
+    canexit = True
+
+    mainloop = gobject.MainLoop()
+    mainloop.run()

Regards,
-Denis