test: Add test/set-ddr
authorDenis Kenzior <denkenz@gmail.com>
Fri, 31 Jan 2014 21:17:23 +0000 (15:17 -0600)
committerDenis Kenzior <denkenz@gmail.com>
Mon, 20 Oct 2014 18:40:28 +0000 (13:40 -0500)
Script to set DistractedDrivingReduction property

Makefile.am
test/set-ddr [new file with mode: 0755]

index c85ce172ae93f363a0eb2fd706030ffc248c24cf..42b2136575feed2145c9bf4204f1b067965d1143 100644 (file)
@@ -665,7 +665,8 @@ test_scripts = test/backtrace \
                test/hangup-multiparty \
                test/hangup-call \
                test/display-icon \
-               test/set-msisdn
+               test/set-msisdn \
+               test/set-ddr
 
 if TEST
 testdir = $(pkglibdir)/test
diff --git a/test/set-ddr b/test/set-ddr
new file mode 100755 (executable)
index 0000000..5d061b9
--- /dev/null
@@ -0,0 +1,21 @@
+#!/usr/bin/python
+
+import sys
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+                                               'org.ofono.Manager')
+
+modems = manager.GetModems()
+
+for path, properties in modems:
+       if "org.ofono.Handsfree" not in properties["Interfaces"]:
+               continue
+
+       handsfree = dbus.Interface(bus.get_object('org.ofono', path),
+                                       'org.ofono.Handsfree')
+
+       handsfree.SetProperty("DistractedDrivingReduction",\
+                               dbus.Boolean(int(sys.argv[1])))