mirror of
https://github.com/markqvist/Reticulum.git
synced 2026-10-26 19:01:53 -04:00
Interface gravity base property and configuration
This commit is contained in:
parent
9bc73819f6
commit
c10c465c02
3 changed files with 12 additions and 2 deletions
|
|
@ -98,6 +98,7 @@ class Interface:
|
|||
def __init__(self):
|
||||
self.rxb = 0
|
||||
self.txb = 0
|
||||
self.gravity = 0
|
||||
self.created = time.time()
|
||||
self.detached = False
|
||||
self.online = False
|
||||
|
|
|
|||
|
|
@ -758,6 +758,9 @@ class Reticulum:
|
|||
elif c["mode"] == "internal":
|
||||
interface_mode = Interface.Interface.MODE_INTERNAL
|
||||
|
||||
gravity = None
|
||||
if "gravity" in c: gravity = c.as_int("gravity")
|
||||
|
||||
ifac_size = None
|
||||
if "ifac_size" in c:
|
||||
if c.as_int("ifac_size") >= Reticulum.IFAC_MIN_SIZE*8: ifac_size = c.as_int("ifac_size")//8
|
||||
|
|
@ -895,6 +898,7 @@ class Reticulum:
|
|||
else: interface.OUT = True
|
||||
|
||||
interface.mode = interface_mode
|
||||
interface.gravity = gravity
|
||||
interface.announce_cap = announce_cap
|
||||
interface.bootstrap_only = bootstrap_only
|
||||
if configured_bitrate: interface.bitrate = configured_bitrate
|
||||
|
|
@ -1075,15 +1079,17 @@ class Reticulum:
|
|||
RNS.trace_exception(e)
|
||||
RNS.panic()
|
||||
|
||||
def _add_interface(self, interface, mode = None, configured_bitrate=None, ifac_size=None, ifac_netname=None, ifac_netkey=None,
|
||||
def _add_interface(self, interface, mode=None, gravity=None, configured_bitrate=None, ifac_size=None, ifac_netname=None, ifac_netkey=None,
|
||||
announce_cap=None, announce_rate_target=None, announce_rate_grace=None, announce_rate_penalty=None,
|
||||
bootstrap_only=False, recursive_prs=False, announces_from_internal=True, announces_to_internal=None):
|
||||
|
||||
if not self.is_connected_to_shared_instance:
|
||||
if interface != None and issubclass(type(interface), RNS.Interfaces.Interface.Interface):
|
||||
|
||||
if mode == None: mode = Interface.Interface.MODE_FULL
|
||||
if mode == None: mode = Interface.Interface.MODE_FULL
|
||||
if gravity == None: gravity = 0
|
||||
interface.mode = mode
|
||||
interface.gravity = gravity
|
||||
interface.OUT = True
|
||||
|
||||
if configured_bitrate: interface.bitrate = configured_bitrate
|
||||
|
|
@ -1467,6 +1473,7 @@ class Reticulum:
|
|||
ifstats["pr_burst_activated"] = interface.ic_pr_burst_activated
|
||||
ifstats["status"] = interface.online
|
||||
ifstats["mode"] = interface.mode
|
||||
ifstats["gravity"] = interface.gravity
|
||||
ifstats["announces_to_internal"] = interface.announces_to_internal
|
||||
|
||||
interfaces.append(ifstats)
|
||||
|
|
|
|||
|
|
@ -418,6 +418,8 @@ def program_setup(configdir, dispall=False, verbosity=0, name_filter=None, json=
|
|||
if ifstat["status"]: ss = "Up"
|
||||
else: ss = "Down"
|
||||
|
||||
if "gravity" in ifstat and ifstat["gravity"]: ss += ", gravity "+str(ifstat["gravity"])
|
||||
|
||||
if ifstat["mode"] == RNS.Interfaces.Interface.Interface.MODE_ACCESS_POINT: modestr = "Access Point"
|
||||
elif ifstat["mode"] == RNS.Interfaces.Interface.Interface.MODE_POINT_TO_POINT: modestr = "Point-to-Point"
|
||||
elif ifstat["mode"] == RNS.Interfaces.Interface.Interface.MODE_ROAMING: modestr = "Roaming"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue