Updated connectivity status

This commit is contained in:
Mark Qvist 2022-10-13 22:40:48 +02:00
parent 6e70f84425
commit ca04e89c3a

View File

@ -196,6 +196,8 @@ class SidebandService():
ts = "Disabled" ts = "Disabled"
i2s = "Disabled" i2s = "Disabled"
stat = "[size=22dp][b]Connectivity Status[/b][/size]\n\n"
if self.sideband.interface_local != None: if self.sideband.interface_local != None:
np = len(self.sideband.interface_local.peers) np = len(self.sideband.interface_local.peers)
if np == 1: if np == 1:
@ -203,19 +205,33 @@ class SidebandService():
else: else:
ws = str(np)+" reachable peers" ws = str(np)+" reachable peers"
stat += "[b]Local[/b]\n{ws}\n\n".format(ws=ws)
if self.sideband.interface_rnode != None:
if self.sideband.interface_rnode.online:
rs = "On-air at "+str(self.sideband.interface_rnode.bitrate_kbps)+" Kbps"
else:
rs = "Interface Down"
stat += "[b]RNode[/b]\n{rs}\n\n".format(rs=rs)
if self.sideband.interface_tcp != None: if self.sideband.interface_tcp != None:
if self.sideband.interface_tcp.online: if self.sideband.interface_tcp.online:
ts = "Connected to "+str(self.sideband.interface_tcp.target_ip)+":"+str(self.sideband.interface_tcp.target_port) ts = "Connected to "+str(self.sideband.interface_tcp.target_ip)+":"+str(self.sideband.interface_tcp.target_port)
else: else:
ts = "Interface Down" ts = "Interface Down"
stat += "[b]TCP[/b]\n{ts}\n\n".format(ts=ts)
if self.sideband.interface_i2p != None: if self.sideband.interface_i2p != None:
if self.sideband.interface_i2p.online: if self.sideband.interface_i2p.online:
i2s = "Connected" i2s = "Connected"
else: else:
i2s = "Connecting to I2P" i2s = "Connecting to I2P"
return "[size=22dp][b]Connectivity Status[/b][/size]\n\n[b]Local[/b]\n{ws}\n\n[b]TCP[/b]\n{ts}\n\n[b]I2P[/b]\n{i2s}".format(ws=ws, ts=ts, i2s=i2s) stat += "[b]I2P[/b]\n{i2s}".format(i2s=i2s)
return stat
def run(self): def run(self):
while self.should_run: while self.should_run: