- test script
This commit is contained in:
parent
2f67aec5bb
commit
6feb10f49a
|
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import bt_phone
|
||||
import bt_controller
|
||||
import time
|
||||
|
||||
EXIT_OK = 0
|
||||
EXIT_ERROR = 1
|
||||
|
||||
PHONE_BT_MAC = '40:B0:76:B4:36:98'
|
||||
|
||||
|
||||
# Connection to phone
|
||||
|
||||
bluetooth_ctl = bt_controller.Bluetoothctl()
|
||||
devices = bt_controller.get_paired_devices()
|
||||
print(f'Paired devices: {devices}')
|
||||
|
||||
# disconnect before connect
|
||||
bluetooth_ctl.disconnect( PHONE_BT_MAC )
|
||||
ret = bluetooth_ctl.connect( PHONE_BT_MAC )
|
||||
if ret == False:
|
||||
print(f'Connect to {PHONE_BT_MAC} failed')
|
||||
exit(EXIT_ERROR)
|
||||
|
||||
print(f'Connect to {PHONE_BT_MAC} success')
|
||||
|
||||
# Call
|
||||
# Initialize phone - this brings Ofono via D-Bus
|
||||
phone = bt_phone.Phone()
|
||||
phone.setup_dbus_loop()
|
||||
phone.call_number('111222')
|
||||
|
||||
# Wait 5 seconds
|
||||
time.sleep(5)
|
||||
|
||||
# Just to be sure
|
||||
phone.hangup_call()
|
||||
phone.quit_dbus_loop()
|
||||
|
||||
|
||||
exit(EXIT_OK)
|
||||
Loading…
Reference in New Issue