mirror of
https://github.com/kawasaki/pyscrlink.git
synced 2025-09-07 10:10:24 +02:00
BLESession.handle_request: Simplify Peripheral constructor call
Passing the device variable itself into Peripheral() will give the addr, addrType and the iface to the Peripheral().
This commit is contained in:
committed by
Shin'ichiro Kawasaki
parent
e281543cb8
commit
3a68a0109e
@@ -549,8 +549,7 @@ class BLESession(Session):
|
|||||||
self.device = self.found_devices[params['peripheralId']]
|
self.device = self.found_devices[params['peripheralId']]
|
||||||
self.deviceName = self.device.getValueText(0x9) or self.device.getValueText(0x8)
|
self.deviceName = self.device.getValueText(0x9) or self.device.getValueText(0x8)
|
||||||
try:
|
try:
|
||||||
self.perip = Peripheral(self.device.addr,
|
self.perip = Peripheral(self.device)
|
||||||
self.device.addrType)
|
|
||||||
logger.info(f"connected to the BLE peripheral: {self.deviceName}")
|
logger.info(f"connected to the BLE peripheral: {self.deviceName}")
|
||||||
except BTLEDisconnectError as e:
|
except BTLEDisconnectError as e:
|
||||||
logger.error(f"failed to connect to the BLE device \"{self.deviceName}\": {e}")
|
logger.error(f"failed to connect to the BLE device \"{self.deviceName}\": {e}")
|
||||||
|
Reference in New Issue
Block a user