Compare commits

..

2 Commits

Author SHA1 Message Date
Mark Qvist
cecb4b3acb Fixed buffered input stream reader not working on Android API levels < 30 2022-11-23 20:39:49 +01:00
Mark Qvist
de53a105a4 Improved time pretty-print function 2022-11-23 17:15:46 +01:00
2 changed files with 10 additions and 2 deletions

View File

@ -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:
return self.rfcomm_reader.readNBytes(available) if hasattr(self.rfcomm_reader, "readNBytes"):
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:

View File

@ -217,7 +217,10 @@ def prettytime(time, verbose=False):
tstr += c tstr += c
return tstr if tstr == "":
return "0s"
else:
return tstr
def phyparams(): def phyparams():
print("Required Physical Layer MTU : "+str(Reticulum.MTU)+" bytes") print("Required Physical Layer MTU : "+str(Reticulum.MTU)+" bytes")