diff options
author | Mika Linnanoja <mika.linnanoja@nokia.com> | 2008-10-04 14:44:32 +0200 |
---|---|---|
committer | Mika Linnanoja <mika.linnanoja@nokia.com> | 2008-10-04 14:44:32 +0200 |
commit | 363567a7d2d1706a29acf595ad0acec2851645ea (patch) | |
tree | 5f4074b1737e10133fcb6475a0d1bbff3a7e2898 | |
parent | b33d56deeac1577b2e87f604ab86139c19b05967 (diff) |
Add support for connecting/disconnecting headsets.
-rwxr-xr-x | test/test-telephony | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/test/test-telephony b/test/test-telephony index 99e7c197..76041b99 100755 --- a/test/test-telephony +++ b/test/test-telephony @@ -5,11 +5,17 @@ import dbus bus = dbus.SystemBus() +manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.bluez.Manager") +adapter = dbus.Interface(bus.get_object("org.bluez", manager.DefaultAdapter()), + "org.bluez.Adapter") test = dbus.Interface(bus.get_object("org.bluez", "/org/bluez/test"), - "org.bluez.TelephonyTest") + "org.bluez.TelephonyTest") + if len(sys.argv) < 2: print """Usage: %s <command> + connect <bdaddr> + disconnect <bdaddr> outgoing <number> incoming <number> cancel @@ -21,6 +27,26 @@ if len(sys.argv) < 2: """ % sys.argv[0] sys.exit(1) +if sys.argv[1] == "connect": + if len(sys.argv) < 3: + print "Need device address parameter" + sys.exit(1) + device = adapter.FindDevice(sys.argv[2]) + headset = dbus.Interface(bus.get_object("org.bluez", device), + "org.bluez.Headset") + headset.Connect() + sys.exit(0) + +if sys.argv[1] == "disconnect": + if len(sys.argv) < 3: + print "Need device address parameter" + sys.exit(1) + device = adapter.FindDevice(sys.argv[2]) + headset = dbus.Interface(bus.get_object("org.bluez", device), + "org.bluez.Headset") + headset.Disconnect() + sys.exit(0) + if sys.argv[1] == "outgoing": if len(sys.argv) > 2: test.OutgoingCall(sys.argv[2]) |