Fixed init fail due to missing library on Android/Termux
This commit is contained in:
parent
f461a7827b
commit
903ab53fc9
|
@ -28,8 +28,14 @@ import time
|
|||
import math
|
||||
import RNS
|
||||
|
||||
from able import BluetoothDispatcher, GATT_SUCCESS
|
||||
from able.adapter import require_bluetooth_enabled
|
||||
try:
|
||||
from able import BluetoothDispatcher, GATT_SUCCESS
|
||||
except Exception as e:
|
||||
GATT_SUCCESS = 0x00
|
||||
class BluetoothDispatcher():
|
||||
def __init__(**kwargs):
|
||||
RNS.log("Attempt to initialise BLE connectivity, but Android BLE support library is unavailable", RNS.LOG_ERROR)
|
||||
raise OSError("No BLE support available")
|
||||
|
||||
class KISS():
|
||||
FEND = 0xC0
|
||||
|
@ -81,6 +87,8 @@ class KISS():
|
|||
ERROR_INITRADIO = 0x01
|
||||
ERROR_TXFAILED = 0x02
|
||||
ERROR_EEPROM_LOCKED = 0x03
|
||||
ERROR_QUEUE_FULL = 0x04
|
||||
ERROR_MEMORY_LOW = 0x05
|
||||
ERROR_INVALID_FIRMWARE = 0x10
|
||||
ERROR_INVALID_BLE_MTU = 0x20
|
||||
|
||||
|
@ -1242,6 +1250,9 @@ class RNodeInterface(Interface):
|
|||
elif (byte == KISS.ERROR_TXFAILED):
|
||||
RNS.log(str(self)+" hardware TX error (code "+RNS.hexrep(byte)+")", RNS.LOG_ERROR)
|
||||
raise IOError("Hardware transmit failure")
|
||||
elif (byte == KISS.ERROR_MEMORY_LOW):
|
||||
RNS.log(str(self)+" hardware error (code "+RNS.hexrep(byte)+"): Memory exhausted", RNS.LOG_ERROR)
|
||||
self.hw_errors.append({"error": KISS.ERROR_MEMORY_LOW, "description": "Memory exhausted on connected device"})
|
||||
else:
|
||||
RNS.log(str(self)+" hardware error (code "+RNS.hexrep(byte)+")", RNS.LOG_ERROR)
|
||||
raise IOError("Unknown hardware failure")
|
||||
|
|
Loading…
Reference in New Issue