5151def convertByteArrayToHexString (array ):
5252 return (bytes (array ).hex ())
5353
54-
5554class bluetoothTxRxHandler :
5655 def __init__ (self , deviceDriver ):
5756 self .deviceRxChannelUUIDs = getattr (deviceDriver , "deviceRxChannelUUIDs" , LEGACY_DEVICE_RX_CHANNEL_UUIDS )
@@ -95,7 +94,6 @@ def _callbackForRxChannels(self, BleakGATTChar, rxBytes):
9594 else :
9695 rxChannelId = self .rxHandleToChannelId [BleakGATTChar .handle ]
9796 self .rxRawChannelBuffer [rxChannelId ] = rxBytes
98-
9997 logger .debug (f"rx ch{ rxChannelId } < { convertByteArrayToHexString (rxBytes )} " )
10098 if self .rxRawChannelBuffer [0 ]: #if there is data present in the first rx buffer
10199 if len (self .deviceRxChannelUUIDs ) == 1 :
@@ -285,7 +283,6 @@ async def writeNewUnlockKey(self, newKeyByteArray = pairingKey):
285283 logger .info (f"Paired device successfully with new key { newKeyByteArray } ." )
286284 logger .info ("From now on you can connect omit the -p flag, even on other PCs with different bluetooth-mac-addresses." )
287285 return
288-
289286 async def unlockWithUnlockKey (self , keyByteArray = pairingKey ):
290287 if not self .requiresUnlock :
291288 return
@@ -454,15 +451,14 @@ def _detection_cb(device, _adv_data):
454451 path = details .get ("path" ) or details .get ("props" , {}).get ("Adapter" )
455452 if isinstance (path , str ) and "/hci" in path :
456453 adapter_name = path .split ("/" )[3 ] if path .startswith ("/org/bluez/" ) else None
457-
454+
458455 # Code change for Export2Garmin
459456 adapter_name = adapter_name or args .adapter
460457 client_kwargs = {"bluez" : {"adapter" : adapter_name }} if adapter_name else {}
461458 logger .debug (f"Connecting via adapter: { adapter_name or 'default' } " )
462459 bleClient = bleak .BleakClient (found_device_holder [0 ], ** client_kwargs )
463460 else :
464461 bleClient = bleak .BleakClient (bleAddr )
465-
466462 try :
467463 logger .info (f"Attempt connecting to { bleAddr } ." )
468464 await bleClient .connect ()
@@ -514,4 +510,4 @@ def _detection_cb(device, _adv_data):
514510 except Exception as e :
515511 logger .debug (f"Scanner stop raised (ignored): { e } " )
516512
517- asyncio .run (main ())
513+ asyncio .run (main ())
0 commit comments