From 171457713bdddc82ba69c6de334805c303c5b88e Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Tue, 20 Dec 2022 15:17:46 +0100 Subject: [PATCH] Improved RNode hotplug over Bluetooth on Android --- RNS/Interfaces/Android/RNodeInterface.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/RNS/Interfaces/Android/RNodeInterface.py b/RNS/Interfaces/Android/RNodeInterface.py index 0a94e27..46518f1 100644 --- a/RNS/Interfaces/Android/RNodeInterface.py +++ b/RNS/Interfaces/Android/RNodeInterface.py @@ -329,11 +329,13 @@ class RNodeInterface(Interface): from usbserial4a import serial4a as serial self.parity = "N" + self.bt_target_device_name = target_device_name + self.bt_target_device_address = target_device_address if allow_bluetooth: self.bt_manager = AndroidBluetoothManager( owner = self, - target_device_name = target_device_name, - target_device_address = target_device_address + target_device_name = self.bt_target_device_name, + target_device_address = self.bt_target_device_address ) else: @@ -544,6 +546,13 @@ class RNodeInterface(Interface): RNS.log(str(self)+" USB write timeout set to "+str(self.serial.USB_WRITE_TIMEOUT_MILLIS)+"ms", RNS.LOG_DEBUG) elif self.allow_bluetooth: + if self.bt_manager == None: + self.bt_manager = AndroidBluetoothManager( + owner = self, + target_device_name = self.bt_target_device_name, + target_device_address = self.bt_target_device_address + ) + if self.bt_manager != None: self.bt_manager.connect_any_device()