Added serial port and radio modem options to connectivity

This commit is contained in:
Mark Qvist 2022-10-15 11:11:34 +02:00
parent 712a099c8b
commit 535a3fcbfe
3 changed files with 65 additions and 13 deletions

View File

@ -1062,6 +1062,14 @@ class SidebandApp(MDApp):
self.sideband.config["connect_rnode_ifac_netname"] = self.root.ids.connectivity_rnode_ifac_netname.text self.sideband.config["connect_rnode_ifac_netname"] = self.root.ids.connectivity_rnode_ifac_netname.text
self.sideband.config["connect_rnode_ifac_passphrase"] = self.root.ids.connectivity_rnode_ifac_passphrase.text self.sideband.config["connect_rnode_ifac_passphrase"] = self.root.ids.connectivity_rnode_ifac_passphrase.text
self.sideband.config["connect_serial"] = self.root.ids.connectivity_use_serial.active
self.sideband.config["connect_serial_ifac_netname"] = self.root.ids.connectivity_serial_ifac_netname.text
self.sideband.config["connect_serial_ifac_passphrase"] = self.root.ids.connectivity_serial_ifac_passphrase.text
self.sideband.config["connect_modem"] = self.root.ids.connectivity_use_modem.active
self.sideband.config["connect_modem_ifac_netname"] = self.root.ids.connectivity_modem_ifac_netname.text
self.sideband.config["connect_modem_ifac_passphrase"] = self.root.ids.connectivity_modem_ifac_passphrase.text
con_collapse_local(collapse=not self.root.ids.connectivity_use_local.active) con_collapse_local(collapse=not self.root.ids.connectivity_use_local.active)
con_collapse_tcp(collapse=not self.root.ids.connectivity_use_tcp.active) con_collapse_tcp(collapse=not self.root.ids.connectivity_use_tcp.active)
con_collapse_i2p(collapse=not self.root.ids.connectivity_use_i2p.active) con_collapse_i2p(collapse=not self.root.ids.connectivity_use_i2p.active)
@ -1072,6 +1080,20 @@ class SidebandApp(MDApp):
self.sideband.save_configuration() self.sideband.save_configuration()
def serial_connectivity_save(sender=None, event=None):
if sender.active:
self.root.ids.connectivity_use_rnode.unbind(active=serial_connectivity_save)
self.root.ids.connectivity_use_modem.unbind(active=serial_connectivity_save)
self.root.ids.connectivity_use_serial.unbind(active=serial_connectivity_save)
self.root.ids.connectivity_use_rnode.active = False
self.root.ids.connectivity_use_modem.active = False
self.root.ids.connectivity_use_serial.active = False
sender.active = True
self.root.ids.connectivity_use_rnode.bind(active=serial_connectivity_save)
self.root.ids.connectivity_use_modem.bind(active=serial_connectivity_save)
self.root.ids.connectivity_use_serial.bind(active=serial_connectivity_save)
save_connectivity(sender, event)
def focus_save(sender=None, event=None): def focus_save(sender=None, event=None):
if not sender.focus: if not sender.focus:
save_connectivity(sender, event) save_connectivity(sender, event)
@ -1116,11 +1138,16 @@ class SidebandApp(MDApp):
self.root.ids.connectivity_use_bluetooth.active = False self.root.ids.connectivity_use_bluetooth.active = False
con_collapse_bluetooth(collapse=not self.root.ids.connectivity_use_bluetooth.active) con_collapse_bluetooth(collapse=not self.root.ids.connectivity_use_bluetooth.active)
self.root.ids.connectivity_use_modem.active = False
con_collapse_modem(collapse=not self.root.ids.connectivity_use_modem.active)
self.root.ids.connectivity_use_serial.active = False self.root.ids.connectivity_use_modem.active = self.sideband.config["connect_modem"]
con_collapse_modem(collapse=not self.root.ids.connectivity_use_modem.active)
self.root.ids.connectivity_modem_ifac_netname.text = self.sideband.config["connect_modem_ifac_netname"]
self.root.ids.connectivity_modem_ifac_passphrase.text = self.sideband.config["connect_modem_ifac_passphrase"]
self.root.ids.connectivity_use_serial.active = self.sideband.config["connect_serial"]
con_collapse_serial(collapse=not self.root.ids.connectivity_use_serial.active) con_collapse_serial(collapse=not self.root.ids.connectivity_use_serial.active)
self.root.ids.connectivity_serial_ifac_netname.text = self.sideband.config["connect_serial_ifac_netname"]
self.root.ids.connectivity_serial_ifac_passphrase.text = self.sideband.config["connect_serial_ifac_passphrase"]
self.root.ids.connectivity_use_local.bind(active=save_connectivity) self.root.ids.connectivity_use_local.bind(active=save_connectivity)
self.root.ids.connectivity_local_groupid.bind(on_text_validate=save_connectivity) self.root.ids.connectivity_local_groupid.bind(on_text_validate=save_connectivity)
@ -1135,13 +1162,14 @@ class SidebandApp(MDApp):
self.root.ids.connectivity_i2p_b32.bind(on_text_validate=save_connectivity) self.root.ids.connectivity_i2p_b32.bind(on_text_validate=save_connectivity)
self.root.ids.connectivity_i2p_ifac_netname.bind(on_text_validate=save_connectivity) self.root.ids.connectivity_i2p_ifac_netname.bind(on_text_validate=save_connectivity)
self.root.ids.connectivity_i2p_ifac_passphrase.bind(on_text_validate=save_connectivity) self.root.ids.connectivity_i2p_ifac_passphrase.bind(on_text_validate=save_connectivity)
self.root.ids.connectivity_use_rnode.bind(active=save_connectivity)
self.root.ids.connectivity_rnode_ifac_netname.bind(on_text_validate=save_connectivity) self.root.ids.connectivity_rnode_ifac_netname.bind(on_text_validate=save_connectivity)
self.root.ids.connectivity_rnode_ifac_passphrase.bind(on_text_validate=save_connectivity) self.root.ids.connectivity_rnode_ifac_passphrase.bind(on_text_validate=save_connectivity)
self.root.ids.connectivity_use_modem.bind(active=save_connectivity)
self.root.ids.connectivity_use_serial.bind(active=save_connectivity)
self.root.ids.connectivity_use_bluetooth.bind(active=save_connectivity) self.root.ids.connectivity_use_bluetooth.bind(active=save_connectivity)
self.root.ids.connectivity_use_rnode.bind(active=serial_connectivity_save)
self.root.ids.connectivity_use_modem.bind(active=serial_connectivity_save)
self.root.ids.connectivity_use_serial.bind(active=serial_connectivity_save)
self.root.ids.connectivity_local_groupid.bind(focus=focus_save) self.root.ids.connectivity_local_groupid.bind(focus=focus_save)
self.root.ids.connectivity_local_ifac_netname.bind(focus=focus_save) self.root.ids.connectivity_local_ifac_netname.bind(focus=focus_save)
self.root.ids.connectivity_local_ifac_passphrase.bind(focus=focus_save) self.root.ids.connectivity_local_ifac_passphrase.bind(focus=focus_save)
@ -1155,6 +1183,12 @@ class SidebandApp(MDApp):
self.root.ids.connectivity_rnode_ifac_netname.bind(focus=focus_save) self.root.ids.connectivity_rnode_ifac_netname.bind(focus=focus_save)
self.root.ids.connectivity_rnode_ifac_passphrase.bind(focus=focus_save) self.root.ids.connectivity_rnode_ifac_passphrase.bind(focus=focus_save)
self.root.ids.connectivity_modem_ifac_netname.bind(focus=focus_save)
self.root.ids.connectivity_modem_ifac_passphrase.bind(focus=focus_save)
self.root.ids.connectivity_serial_ifac_netname.bind(focus=focus_save)
self.root.ids.connectivity_serial_ifac_passphrase.bind(focus=focus_save)
else: else:
info = "" info = ""
@ -1205,8 +1239,9 @@ class SidebandApp(MDApp):
con_collapse_local(collapse=not self.root.ids.connectivity_use_local.active) con_collapse_local(collapse=not self.root.ids.connectivity_use_local.active)
self.sideband.save_configuration() self.sideband.save_configuration()
if RNS.vendor.platformutils.get_platform() == "android": # TODO: Reset
if not self.sideband.getpersistent("service.is_controlling_connectivity"): if True or RNS.vendor.platformutils.get_platform() == "android":
if False and not self.sideband.getpersistent("service.is_controlling_connectivity"):
info = "Sideband is connected via a shared Reticulum instance running on this system.\n\n" info = "Sideband is connected via a shared Reticulum instance running on this system.\n\n"
info += "To configure hardware parameters, edit the relevant configuration file for the instance." info += "To configure hardware parameters, edit the relevant configuration file for the instance."
self.root.ids.hardware_info.text = info self.root.ids.hardware_info.text = info

View File

@ -193,6 +193,12 @@ class SidebandCore():
self.config["connect_rnode"] = False self.config["connect_rnode"] = False
self.config["connect_rnode_ifac_netname"] = "" self.config["connect_rnode_ifac_netname"] = ""
self.config["connect_rnode_ifac_passphrase"] = "" self.config["connect_rnode_ifac_passphrase"] = ""
self.config["connect_serial"] = False
self.config["connect_serial_ifac_netname"] = ""
self.config["connect_serial_ifac_passphrase"] = ""
self.config["connect_modem"] = False
self.config["connect_modem_ifac_netname"] = ""
self.config["connect_modem_ifac_passphrase"] = ""
# Hardware # Hardware
self.config["hw_rnode_frequency"] = None self.config["hw_rnode_frequency"] = None
self.config["hw_rnode_modulation"] = "LoRa" self.config["hw_rnode_modulation"] = "LoRa"
@ -249,7 +255,18 @@ class SidebandCore():
self.config["connect_rnode_ifac_netname"] = "" self.config["connect_rnode_ifac_netname"] = ""
if not "connect_rnode_ifac_passphrase" in self.config: if not "connect_rnode_ifac_passphrase" in self.config:
self.config["connect_rnode_ifac_passphrase"] = "" self.config["connect_rnode_ifac_passphrase"] = ""
if not "connect_serial" in self.config:
self.config["connect_serial"] = False
if not "connect_serial_ifac_netname" in self.config:
self.config["connect_serial_ifac_netname"] = ""
if not "connect_serial_ifac_passphrase" in self.config:
self.config["connect_serial_ifac_passphrase"] = ""
if not "connect_modem" in self.config:
self.config["connect_modem"] = False
if not "connect_modem_ifac_netname" in self.config:
self.config["connect_modem_ifac_netname"] = ""
if not "connect_modem_ifac_passphrase" in self.config:
self.config["connect_modem_ifac_passphrase"] = ""
if not "hw_rnode_frequency" in self.config: if not "hw_rnode_frequency" in self.config:
self.config["hw_rnode_frequency"] = None self.config["hw_rnode_frequency"] = None
if not "hw_rnode_modulation" in self.config: if not "hw_rnode_modulation" in self.config:

View File

@ -422,13 +422,13 @@ MDNavigationLayout:
id: connectivity_modem_label id: connectivity_modem_label
text: "Connect via Radio Modem" text: "Connect via Radio Modem"
font_style: "H6" font_style: "H6"
disabled: True disabled: False
MDSwitch: MDSwitch:
id: connectivity_use_modem id: connectivity_use_modem
active: False active: False
pos_hint: {"center_y": 0.3} pos_hint: {"center_y": 0.3}
disabled: True disabled: False
MDBoxLayout: MDBoxLayout:
id: connectivity_modem_fields id: connectivity_modem_fields
@ -460,13 +460,13 @@ MDNavigationLayout:
id: connectivity_serial_label id: connectivity_serial_label
text: "Connect via Serial Port" text: "Connect via Serial Port"
font_style: "H6" font_style: "H6"
disabled: True disabled: False
MDSwitch: MDSwitch:
id: connectivity_use_serial id: connectivity_use_serial
active: False active: False
pos_hint: {"center_y": 0.3} pos_hint: {"center_y": 0.3}
disabled: True disabled: False
MDBoxLayout: MDBoxLayout:
id: connectivity_serial_fields id: connectivity_serial_fields