test: Add test/set-ddr

Script to set DistractedDrivingReduction property
This commit is contained in:
Denis Kenzior 2014-01-31 15:17:23 -06:00
parent d3560b3784
commit fb1b213e22
2 changed files with 23 additions and 1 deletions

View 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

21
test/set-ddr Executable file
View File

@ -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])))