test: add test/set-tty script
authorLucas De Marchi <lucas.demarchi@profusion.mobi>
Thu, 25 Nov 2010 17:42:00 +0000 (15:42 -0200)
committerDenis Kenzior <denkenz@gmail.com>
Fri, 26 Nov 2010 19:21:50 +0000 (13:21 -0600)
To enable/disable text-telephony support

test/set-tty [new file with mode: 0755]

diff --git a/test/set-tty b/test/set-tty
new file mode 100755 (executable)
index 0000000..67876af
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/python
+
+import dbus
+import sys
+
+bus = dbus.SystemBus()
+
+if len(sys.argv) == 3:
+       path = sys.argv[1]
+       enable = int(sys.argv[2])
+elif len(sys.argv) == 2:
+       manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+                                               'org.ofono.Manager')
+       modems = manager.GetModems()
+       path = modems[0][0]
+       enable = int(sys.argv[1])
+else:
+       print "%s [PATH] {0|1}" % (sys.argv[0])
+       exit(1)
+
+print "Setting TTY for modem %s..." % path
+texttelephony = dbus.Interface(bus.get_object('org.ofono', path),
+                                               'org.ofono.TextTelephony')
+
+texttelephony.SetProperty("Enabled", dbus.Boolean(enable));