All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] test: add set-call-forwarding
@ 2011-01-10  9:26 Jarko Poutiainen
  2011-01-11 15:07 ` Denis Kenzior
  0 siblings, 1 reply; 4+ messages in thread
From: Jarko Poutiainen @ 2011-01-10  9:26 UTC (permalink / raw)
  To: ofono

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

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

diff --git a/Makefile.am b/Makefile.am
index 8ad01cd..563da9f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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
diff --git a/test/set-call-forwarding b/test/set-call-forwarding
new file mode 100755
index 0000000..03bf542
--- /dev/null
+++ b/test/set-call-forwarding
@@ -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()
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH] test: add set-call-forwarding
@ 2011-01-12  9:14 Jarko Poutiainen
  2011-01-12 16:18 ` Marcel Holtmann
  0 siblings, 1 reply; 4+ messages in thread
From: Jarko Poutiainen @ 2011-01-12  9:14 UTC (permalink / raw)
  To: ofono

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

---
 Makefile.am              |    3 +-
 test/set-call-forwarding |   64 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+), 1 deletions(-)
 create mode 100755 test/set-call-forwarding

diff --git a/Makefile.am b/Makefile.am
index 4dec90a..ead154d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -449,7 +449,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
diff --git a/test/set-call-forwarding b/test/set-call-forwarding
new file mode 100755
index 0000000..159a27c
--- /dev/null
+++ b/test/set-call-forwarding
@@ -0,0 +1,64 @@
+#!/usr/bin/python
+
+import sys
+import gobject
+
+import dbus
+import dbus.mainloop.glib
+
+def property_changed(property, value):
+	if len(value.__str__()) > 0:
+		print "CF property %s changed to %s" % (property, value)
+	else:
+		print "CF 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()
-- 
1.7.0.4


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

end of thread, other threads:[~2011-01-12 16:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-10  9:26 [PATCH] test: add set-call-forwarding Jarko Poutiainen
2011-01-11 15:07 ` Denis Kenzior
  -- strict thread matches above, loose matches on Subject: below --
2011-01-12  9:14 Jarko Poutiainen
2011-01-12 16:18 ` Marcel Holtmann

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.