diff options
-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]) |