- preconnect phone before checking BT modem
This commit is contained in:
parent
1256f3ad21
commit
eccf8d1934
|
|
@ -472,6 +472,12 @@ if __name__ == '__main__':
|
||||||
bt_ctl = Bluetoothctl()
|
bt_ctl = Bluetoothctl()
|
||||||
bt_ctl.connect(CONFIG.BT_MAC)
|
bt_ctl.connect(CONFIG.BT_MAC)
|
||||||
utils.log(f' Done.')
|
utils.log(f' Done.')
|
||||||
|
else:
|
||||||
|
utils.log_error(f'No BT MAC specified, cannot connect. Exiting.')
|
||||||
|
raise SystemExit(EXIT_ERROR)
|
||||||
|
|
||||||
|
# Init BT modem
|
||||||
|
bt_call_controller.init()
|
||||||
|
|
||||||
# Logging settings
|
# Logging settings
|
||||||
utils.verbose_logging = CONFIG.Verbose
|
utils.verbose_logging = CONFIG.Verbose
|
||||||
|
|
|
||||||
|
|
@ -42,13 +42,18 @@ class CallState(bt_phone.Observer):
|
||||||
|
|
||||||
|
|
||||||
# Listen to call changes
|
# Listen to call changes
|
||||||
CALL_STATE_EVENT = CallState()
|
CALL_STATE_EVENT = None
|
||||||
PHONE = bt_phone.Phone()
|
PHONE = None
|
||||||
PHONE.addObserver(CALL_STATE_EVENT)
|
|
||||||
|
|
||||||
# virtualmic module
|
# virtualmic module
|
||||||
PA_MODULE_IDX = -1
|
PA_MODULE_IDX = -1
|
||||||
|
|
||||||
|
def init():
|
||||||
|
global CALL_STATE_EVENT, PHONE
|
||||||
|
CALL_STATE_EVENT = CallState()
|
||||||
|
PHONE = bt_phone.Phone()
|
||||||
|
PHONE.addObserver(CALL_STATE_EVENT)
|
||||||
|
|
||||||
|
|
||||||
# Set volume 0..100%
|
# Set volume 0..100%
|
||||||
def set_headset_spk_volume(vol: float):
|
def set_headset_spk_volume(vol: float):
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ class Phone(Observable):
|
||||||
model_serial = properties['Serial']
|
model_serial = properties['Serial']
|
||||||
modem_online = properties['Online']
|
modem_online = properties['Online']
|
||||||
|
|
||||||
utils.log(f'Found modem: {path} name: {modem_name} serial: {model_serial} online: {modem_online}')
|
# utils.log(f'Found modem: {path} name: {modem_name} serial: {model_serial} online: {modem_online}')
|
||||||
if modem_online == 1:
|
if modem_online == 1:
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue