Auto-set sensible interface rate defaults

This commit is contained in:
Mark Qvist 2022-04-17 19:35:31 +02:00
parent dd55899775
commit 124ec006b4
5 changed files with 44 additions and 0 deletions

View file

@ -58,6 +58,7 @@ class AX25():
class AX25KISSInterface(Interface):
MAX_CHUNK = 32768
BITRATE_GUESS = 1200
owner = None
port = None
@ -94,6 +95,7 @@ class AX25KISSInterface(Interface):
self.stopbits = stopbits
self.timeout = 100
self.online = False
self.bitrate = KISSInterface.BITRATE_GUESS
self.packet_queue = []
self.flow_control = flow_control

View file

@ -210,6 +210,7 @@ class I2PInterfacePeer(Interface):
self.i2p_dest = None
self.i2p_tunnel_ready = False
self.mode = RNS.Interfaces.Interface.Interface.MODE_FULL
self.bitrate = I2PInterface.BITRATE_GUESS
if max_reconnect_tries == None:
self.max_reconnect_tries = I2PInterfacePeer.RECONNECT_MAX_TRIES
@ -523,6 +524,7 @@ class I2PInterfacePeer(Interface):
class I2PInterface(Interface):
BITRATE_GUESS = 256*1000
def __init__(self, owner, name, rns_storagepath, peers, connectable = True):
self.rxb = 0
@ -546,6 +548,7 @@ class I2PInterface(Interface):
self.bind_ip = "127.0.0.1"
self.bind_port = self.i2p.get_free_port()
self.address = (self.bind_ip, self.bind_port)
self.bitrate = I2PInterface.BITRATE_GUESS
i2p_thread = threading.Thread(target=self.i2p.start)
i2p_thread.setDaemon(True)

View file

@ -51,6 +51,7 @@ class KISS():
class KISSInterface(Interface):
MAX_CHUNK = 32768
BITRATE_GUESS = 1200
owner = None
port = None
@ -89,6 +90,7 @@ class KISSInterface(Interface):
self.beacon_i = beacon_interval
self.beacon_d = beacon_data.encode("utf-8")
self.first_tx = None
self.bitrate = KISSInterface.BITRATE_GUESS
self.packet_queue = []
self.flow_control = flow_control

View file

@ -74,6 +74,7 @@ class SerialInterface(Interface):
self.stopbits = stopbits
self.timeout = 100
self.online = False
self.bitrate = self.speed
if parity.lower() == "e" or parity.lower() == "even":
self.parity = serial.PARITY_EVEN