mirror of
https://github.com/markqvist/Reticulum.git
synced 2025-06-08 23:13:17 -04:00
Prepare interface modularity for Android-specific interfaces
This commit is contained in:
parent
7b43ff0cef
commit
760ab981d0
3 changed files with 52 additions and 8 deletions
|
@ -42,6 +42,7 @@ class HDLC():
|
|||
|
||||
class SerialInterface(Interface):
|
||||
MAX_CHUNK = 32768
|
||||
DEFAULT_IFAC_SIZE = 8
|
||||
|
||||
owner = None
|
||||
port = None
|
||||
|
@ -51,7 +52,7 @@ class SerialInterface(Interface):
|
|||
stopbits = None
|
||||
serial = None
|
||||
|
||||
def __init__(self, owner, name, port, speed, databits, parity, stopbits):
|
||||
def __init__(self, owner, configuration):
|
||||
import importlib
|
||||
if RNS.vendor.platformutils.is_android():
|
||||
self.on_android = True
|
||||
|
@ -74,6 +75,17 @@ class SerialInterface(Interface):
|
|||
|
||||
super().__init__()
|
||||
|
||||
c = configuration
|
||||
name = c["name"]
|
||||
port = c["port"] if "port" in c else None
|
||||
speed = int(c["speed"]) if "speed" in c else 9600
|
||||
databits = int(c["databits"]) if "databits" in c else 8
|
||||
parity = c["parity"] if "parity" in c else "N"
|
||||
stopbits = int(c["stopbits"]) if "stopbits" in c else 1
|
||||
|
||||
if port == None:
|
||||
raise ValueError("No port specified for serial interface")
|
||||
|
||||
self.HW_MTU = 564
|
||||
|
||||
self.pyserial = serial
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue