mirror of
https://github.com/liberatedsystems/openCom-Companion.git
synced 2024-11-22 13:30:36 +01:00
Added RNode IFAC to config mote import/export. Added focus event binds for connectivity fields. Cleanup.
This commit is contained in:
parent
e991d54def
commit
9dbcaac40d
@ -1011,7 +1011,6 @@ class SidebandApp(MDApp):
|
||||
self.widget_hide(self.root.ids.connectivity_bluetooth_fields)
|
||||
self.widget_hide(self.root.ids.connectivity_transport_label)
|
||||
self.widget_hide(self.root.ids.connectivity_enable_transport)
|
||||
# self.widget_hide(self.root.ids.rnode_support_info)
|
||||
|
||||
def con_collapse_local(collapse=True):
|
||||
self.widget_hide(self.root.ids.connectivity_local_fields, collapse)
|
||||
@ -1031,6 +1030,9 @@ class SidebandApp(MDApp):
|
||||
def con_collapse_modem(collapse=True):
|
||||
self.widget_hide(self.root.ids.connectivity_modem_fields, collapse)
|
||||
|
||||
def con_collapse_serial(collapse=True):
|
||||
self.widget_hide(self.root.ids.connectivity_serial_fields, collapse)
|
||||
|
||||
def save_connectivity(sender=None, event=None):
|
||||
self.sideband.config["connect_local"] = self.root.ids.connectivity_use_local.active
|
||||
self.sideband.config["connect_local_groupid"] = self.root.ids.connectivity_local_groupid.text
|
||||
@ -1055,9 +1057,14 @@ class SidebandApp(MDApp):
|
||||
con_collapse_rnode(collapse=not self.root.ids.connectivity_use_rnode.active)
|
||||
con_collapse_bluetooth(collapse=not self.root.ids.connectivity_use_bluetooth.active)
|
||||
con_collapse_modem(collapse=not self.root.ids.connectivity_use_modem.active)
|
||||
con_collapse_serial(collapse=not self.root.ids.connectivity_use_serial.active)
|
||||
|
||||
self.sideband.save_configuration()
|
||||
|
||||
def focus_save(sender=None, event=None):
|
||||
if not sender.focus:
|
||||
save_connectivity(sender, event)
|
||||
|
||||
if RNS.vendor.platformutils.get_platform() == "android":
|
||||
if not self.sideband.getpersistent("service.is_controlling_connectivity"):
|
||||
info = "Sideband is connected via a shared Reticulum instance running on this system.\n\n"
|
||||
@ -1090,8 +1097,10 @@ class SidebandApp(MDApp):
|
||||
self.root.ids.connectivity_i2p_ifac_netname.text = self.sideband.config["connect_i2p_ifac_netname"]
|
||||
self.root.ids.connectivity_i2p_ifac_passphrase.text = self.sideband.config["connect_i2p_ifac_passphrase"]
|
||||
|
||||
self.root.ids.connectivity_use_rnode.active = False
|
||||
self.root.ids.connectivity_use_rnode.active = self.sideband.config["connect_rnode"]
|
||||
con_collapse_rnode(collapse=not self.root.ids.connectivity_use_rnode.active)
|
||||
self.root.ids.connectivity_rnode_ifac_netname.text = self.sideband.config["connect_rnode_ifac_netname"]
|
||||
self.root.ids.connectivity_rnode_ifac_passphrase.text = self.sideband.config["connect_rnode_ifac_passphrase"]
|
||||
|
||||
self.root.ids.connectivity_use_bluetooth.active = False
|
||||
con_collapse_bluetooth(collapse=not self.root.ids.connectivity_use_bluetooth.active)
|
||||
@ -1099,6 +1108,9 @@ class SidebandApp(MDApp):
|
||||
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
|
||||
con_collapse_serial(collapse=not self.root.ids.connectivity_use_serial.active)
|
||||
|
||||
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_ifac_netname.bind(on_text_validate=save_connectivity)
|
||||
@ -1113,8 +1125,25 @@ class SidebandApp(MDApp):
|
||||
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_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_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_local_groupid.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_tcp_host.bind(focus=focus_save)
|
||||
self.root.ids.connectivity_tcp_port.bind(focus=focus_save)
|
||||
self.root.ids.connectivity_tcp_ifac_netname.bind(focus=focus_save)
|
||||
self.root.ids.connectivity_tcp_ifac_passphrase.bind(focus=focus_save)
|
||||
self.root.ids.connectivity_i2p_b32.bind(focus=focus_save)
|
||||
self.root.ids.connectivity_i2p_ifac_netname.bind(focus=focus_save)
|
||||
self.root.ids.connectivity_i2p_ifac_passphrase.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)
|
||||
|
||||
else:
|
||||
info = ""
|
||||
|
||||
@ -1171,6 +1200,8 @@ class SidebandApp(MDApp):
|
||||
else:
|
||||
self.sideband.config["hw_rnode_beacondata"] = self.root.ids.hardware_rnode_beacondata.text
|
||||
|
||||
self.sideband.save_configuration()
|
||||
|
||||
def hardware_rnode_init(self, sender=None):
|
||||
if not self.hardware_rnode_ready:
|
||||
def save_connectivity(sender=None, event=None):
|
||||
@ -1233,7 +1264,6 @@ class SidebandApp(MDApp):
|
||||
self.root.ids.hardware_rnode_beaconinterval.bind(on_text_validate=save_connectivity)
|
||||
self.root.ids.hardware_rnode_beacondata.bind(on_text_validate=save_connectivity)
|
||||
|
||||
|
||||
def hardware_rnode_validate(self, sender=None):
|
||||
valid = True
|
||||
try:
|
||||
@ -1320,11 +1350,25 @@ class SidebandApp(MDApp):
|
||||
|
||||
try:
|
||||
config = msgpack.unpackb(base64.b32decode(mote))
|
||||
self.root.ids.hardware_rnode_frequency.text = str(config["f"]/1000000.0)
|
||||
self.root.ids.hardware_rnode_bandwidth.text = str(config["b"]/1000.0)
|
||||
self.root.ids.hardware_rnode_txpower.text = str(config["t"])
|
||||
self.root.ids.hardware_rnode_spreadingfactor.text = str(config["s"])
|
||||
self.root.ids.hardware_rnode_codingrate.text = str(config["c"])
|
||||
self.root.ids.hardware_rnode_frequency.text = str(config["f"]/1000000.0)
|
||||
self.root.ids.hardware_rnode_bandwidth.text = str(config["b"]/1000.0)
|
||||
self.root.ids.hardware_rnode_txpower.text = str(config["t"])
|
||||
self.root.ids.hardware_rnode_spreadingfactor.text = str(config["s"])
|
||||
self.root.ids.hardware_rnode_codingrate.text = str(config["c"])
|
||||
|
||||
if "n" in config and config["n"] != None:
|
||||
ifn = str(config["n"])
|
||||
else:
|
||||
ifn = ""
|
||||
if "p" in config and config["p"] != None:
|
||||
ifp = str(config["p"])
|
||||
else:
|
||||
ifp = ""
|
||||
|
||||
self.root.ids.connectivity_rnode_ifac_netname.text = ifn
|
||||
self.sideband.config["connect_rnode_ifac_netname"] = ifn
|
||||
self.root.ids.connectivity_rnode_ifac_passphrase.text = ifp
|
||||
self.sideband.config["connect_rnode_ifac_passphrase"] = ifp
|
||||
|
||||
if config["i"] != None:
|
||||
ti = str(config["i"])
|
||||
@ -1366,7 +1410,6 @@ class SidebandApp(MDApp):
|
||||
yes_button.bind(on_release=dl_yes)
|
||||
dialog.open()
|
||||
|
||||
|
||||
def hardware_rnode_export(self, sender=None):
|
||||
mote = None
|
||||
try:
|
||||
@ -1378,6 +1421,8 @@ class SidebandApp(MDApp):
|
||||
"c": self.sideband.config["hw_rnode_coding_rate"],
|
||||
"i": self.sideband.config["hw_rnode_beaconinterval"],
|
||||
"d": self.sideband.config["hw_rnode_beacondata"],
|
||||
"n": self.sideband.config["connect_rnode_ifac_netname"],
|
||||
"p": self.sideband.config["connect_rnode_ifac_passphrase"],
|
||||
}))
|
||||
except Exception as e:
|
||||
pass
|
||||
|
@ -421,39 +421,6 @@ MDNavigationLayout:
|
||||
font_size: dp(24)
|
||||
|
||||
|
||||
MDBoxLayout:
|
||||
orientation: "horizontal"
|
||||
padding: [0,0,dp(24),0]
|
||||
size_hint_y: None
|
||||
height: dp(24)
|
||||
|
||||
MDLabel:
|
||||
id: connectivity_bluetooth_label
|
||||
text: "Connect via Bluetooth"
|
||||
font_style: "H6"
|
||||
disabled: True
|
||||
|
||||
MDSwitch:
|
||||
id: connectivity_use_bluetooth
|
||||
active: False
|
||||
pos_hint: {"center_y": 0.3}
|
||||
disabled: True
|
||||
|
||||
MDBoxLayout:
|
||||
id: connectivity_bluetooth_fields
|
||||
orientation: "vertical"
|
||||
size_hint_y: None
|
||||
height: self.minimum_height
|
||||
padding: [0, 0, 0, dp(32)]
|
||||
|
||||
MDTextField:
|
||||
id: connectivity_bluetooth_cid
|
||||
hint_text: "Bluetooth Pairing ID"
|
||||
text: ""
|
||||
font_size: dp(24)
|
||||
# disabled: True
|
||||
|
||||
|
||||
MDBoxLayout:
|
||||
orientation: "horizontal"
|
||||
padding: [0,0,dp(24),0]
|
||||
@ -487,6 +454,72 @@ MDNavigationLayout:
|
||||
# disabled: True
|
||||
|
||||
|
||||
MDBoxLayout:
|
||||
orientation: "horizontal"
|
||||
padding: [0,0,dp(24),0]
|
||||
size_hint_y: None
|
||||
height: dp(24)
|
||||
|
||||
MDLabel:
|
||||
id: connectivity_serial_label
|
||||
text: "Connect via Serial Port"
|
||||
font_style: "H6"
|
||||
disabled: True
|
||||
|
||||
MDSwitch:
|
||||
id: connectivity_use_serial
|
||||
active: False
|
||||
pos_hint: {"center_y": 0.3}
|
||||
disabled: True
|
||||
|
||||
MDBoxLayout:
|
||||
id: connectivity_serial_fields
|
||||
orientation: "vertical"
|
||||
size_hint_y: None
|
||||
height: self.minimum_height
|
||||
padding: [0, 0, 0, dp(32)]
|
||||
|
||||
MDTextField:
|
||||
id: connectivity_serial_baud
|
||||
hint_text: "Baud Rate"
|
||||
text: ""
|
||||
font_size: dp(24)
|
||||
# disabled: True
|
||||
|
||||
|
||||
MDBoxLayout:
|
||||
orientation: "horizontal"
|
||||
padding: [0,0,dp(24),0]
|
||||
size_hint_y: None
|
||||
height: dp(24)
|
||||
|
||||
MDLabel:
|
||||
id: connectivity_bluetooth_label
|
||||
text: "Connect via Bluetooth"
|
||||
font_style: "H6"
|
||||
disabled: True
|
||||
|
||||
MDSwitch:
|
||||
id: connectivity_use_bluetooth
|
||||
active: False
|
||||
pos_hint: {"center_y": 0.3}
|
||||
disabled: True
|
||||
|
||||
MDBoxLayout:
|
||||
id: connectivity_bluetooth_fields
|
||||
orientation: "vertical"
|
||||
size_hint_y: None
|
||||
height: self.minimum_height
|
||||
padding: [0, 0, 0, dp(32)]
|
||||
|
||||
MDTextField:
|
||||
id: connectivity_bluetooth_cid
|
||||
hint_text: "Bluetooth Pairing ID"
|
||||
text: ""
|
||||
font_size: dp(24)
|
||||
# disabled: True
|
||||
|
||||
|
||||
MDBoxLayout:
|
||||
orientation: "horizontal"
|
||||
padding: [0,0,dp(24),0]
|
||||
|
Loading…
Reference in New Issue
Block a user