mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-11-25 15:10:17 +00:00
Fixed buffered input stream reader not working on Android API levels < 30
This commit is contained in:
parent
de53a105a4
commit
cecb4b3acb
@ -193,7 +193,12 @@ class AndroidBluetoothManager():
|
|||||||
if self.connected and self.rfcomm_reader != None:
|
if self.connected and self.rfcomm_reader != None:
|
||||||
available = self.rfcomm_reader.available()
|
available = self.rfcomm_reader.available()
|
||||||
if available > 0:
|
if available > 0:
|
||||||
|
if hasattr(self.rfcomm_reader, "readNBytes"):
|
||||||
return self.rfcomm_reader.readNBytes(available)
|
return self.rfcomm_reader.readNBytes(available)
|
||||||
|
else:
|
||||||
|
# Compatibility mode for older android versions lacking readNBytes
|
||||||
|
rb = self.rfcomm_reader.read().to_bytes(1, "big")
|
||||||
|
return rb
|
||||||
else:
|
else:
|
||||||
return bytes([])
|
return bytes([])
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user