Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions software/release/all/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'adxl345.py': 3,
'am1.py': 1,
'hm1.py': 1,
'ssp_networking.py': 3,
'ssp_networking.py': 4,
'files.py': 2,
'icons.py': 2,
'prefs.py': 2,
Expand All @@ -13,7 +13,7 @@
'sm3.py': 1,
'sl1.py': 1,
'smartlight.py': 1,
'networking.py': 5,
'networking.py': 6,
'main.py': 2,
'boot.py': 0
}
Expand Down
28 changes: 25 additions & 3 deletions software/release/all/ssp_networking.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ def hive_configure(self, mac, hive_config, channel=None, ifidx=None, sudo=False)
self.networking.dprint("net.cmd.hive_configure")
self.send_custom("Hive-Configure", mac, f"{hive_config}", channel, ifidx, sudo)

def hive_file(self, mac, file_name, hive_file, channel=None, ifidx=None, sudo=False):
self.networking.dprint("net.cmd.hive_file")
self.send_custom("Hive-File", mac, f"{[file_name, hive_file]}", channel, ifidx, sudo)

def firmware_update(self, mac, channel=None, ifidx=None, sudo=False):
self.networking.dprint("net.cmd.firmware_update")
self.send_custom("Firmware-Update", mac, None, channel, ifidx, sudo)
Expand Down Expand Up @@ -265,7 +269,7 @@ def custom_cmd_handler(data):
if __check_authorisation(sender_mac, payload):
try:
from config import hive_config
new_config = payload[0]
new_config = eval(payload[0])
hive_config.update(new_config)
file_path = "config.py"
with open(file_path, "r") as f:
Expand All @@ -283,6 +287,24 @@ def custom_cmd_handler(data):
__send_confirmation("Fail", sender_mac, f"{msg_subkey} ({subtype})", payload, e)
else:
__send_confirmation("Fail", sender_mac, f"{msg_subkey} ({subtype})", payload, "Not authorised")
elif (msg_subkey := "Hive-File") and subtype == msg_subcodes[msg_key][msg_subkey]: # File-Hive
self.master.networking.iprint(f"{msg_subkey} ({subtype}) command received from {sender_mac} ({self.master.networking.aen.peer_name(sender_mac)})")
if __check_authorisation(sender_mac, payload):
try:
# Insert write file logic here
file_path = eval(payload[0])
file_hive = eval(payload[1])
if isinstance(file_hive, str):
file_hive = [file_hive]
with open(file_path, "w") as f:
f.write(f"{file_hive}\n")
self.master.networking.iprint("No file-hive logic written just yet")
__send_confirmation("Success", sender_mac, f"{msg_subkey} ({subtype})", payload)
except Exception as e:
self.master.networking.eprint(f"Error: {e} with payload: {payload}")
__send_confirmation("Fail", sender_mac, f"{msg_subkey} ({subtype})", payload, e)
else:
__send_confirmation("Fail", sender_mac, f"{msg_subkey} ({subtype})", payload, "Not authorised")
elif (msg_subkey := "Firmware-Update") and subtype == msg_subcodes[msg_key][msg_subkey]: # Firmware-Update
self.master.networking.iprint(f"{msg_subkey} ({subtype}) command received from {sender_mac} ({self.master.networking.aen.peer_name(sender_mac)})")
if __check_authorisation(sender_mac, payload):
Expand Down Expand Up @@ -390,7 +412,8 @@ def custom_cmd_handler(data):
f"{msg_subkey} ({subtype}) command received from {sender_mac} ({self.master.networking.aen.peer_name(sender_mac)})")
if __check_authorisation(sender_mac, payload):
try:
self.master.config.update(payload[0])
new_config = eval(payload[0])
self.master.config.update(new_config)
if payload[1]:
file_path = "config.py"
with open(file_path, "r") as f:
Expand Down Expand Up @@ -619,4 +642,3 @@ def custom_ack_handler(data):
self.master.networking.aen.cmd(custom_cmd_handler)
self.master.networking.aen.inf(custom_inf_handler)
self.master.networking.aen.ack(custom_ack_handler)

5 changes: 2 additions & 3 deletions software/release/am1/config.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
config = {'ap_channel': 1, 'id': None, 'name': 'Nick', 'sta_mac': None, 'ap_mac': None, 'configuration': None, 'sta_channel': 1, 'version': '2025-10-12-155152'}
config = {'ap_channel': 1, 'id': None, 'name': 'Nick', 'sta_mac': None, 'ap_mac': None, 'configuration': None, 'sta_channel': 1, 'version': '2025-10-12-175607'}
version = {
'adxl345.py': 3,
'am1.py': 1,
'hm1.py': 1,
'ssp_networking.py': 3,
'ssp_networking.py': 4,
'files.py': 2,
'icons.py': 2,
'prefs.py': 2,
Expand Down Expand Up @@ -39,7 +39,6 @@
"Resend": 0x16,
"Hive-Set": 0x17,
"Hive-Configure": 0x18,
"Hive-File": 0x19,
"Web-Repl": 0x20,
"WiFi-Connect": 0x21,
"WiFi-Disconnect": 0x22,
Expand Down
28 changes: 25 additions & 3 deletions software/release/am1/ssp_networking.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ def hive_configure(self, mac, hive_config, channel=None, ifidx=None, sudo=False)
self.networking.dprint("net.cmd.hive_configure")
self.send_custom("Hive-Configure", mac, f"{hive_config}", channel, ifidx, sudo)

def hive_file(self, mac, file_name, hive_file, channel=None, ifidx=None, sudo=False):
self.networking.dprint("net.cmd.hive_file")
self.send_custom("Hive-File", mac, f"{[file_name, hive_file]}", channel, ifidx, sudo)

def firmware_update(self, mac, channel=None, ifidx=None, sudo=False):
self.networking.dprint("net.cmd.firmware_update")
self.send_custom("Firmware-Update", mac, None, channel, ifidx, sudo)
Expand Down Expand Up @@ -265,7 +269,7 @@ def custom_cmd_handler(data):
if __check_authorisation(sender_mac, payload):
try:
from config import hive_config
new_config = payload[0]
new_config = eval(payload[0])
hive_config.update(new_config)
file_path = "config.py"
with open(file_path, "r") as f:
Expand All @@ -283,6 +287,24 @@ def custom_cmd_handler(data):
__send_confirmation("Fail", sender_mac, f"{msg_subkey} ({subtype})", payload, e)
else:
__send_confirmation("Fail", sender_mac, f"{msg_subkey} ({subtype})", payload, "Not authorised")
elif (msg_subkey := "Hive-File") and subtype == msg_subcodes[msg_key][msg_subkey]: # File-Hive
self.master.networking.iprint(f"{msg_subkey} ({subtype}) command received from {sender_mac} ({self.master.networking.aen.peer_name(sender_mac)})")
if __check_authorisation(sender_mac, payload):
try:
# Insert write file logic here
file_path = eval(payload[0])
file_hive = eval(payload[1])
if isinstance(file_hive, str):
file_hive = [file_hive]
with open(file_path, "w") as f:
f.write(f"{file_hive}\n")
self.master.networking.iprint("No file-hive logic written just yet")
__send_confirmation("Success", sender_mac, f"{msg_subkey} ({subtype})", payload)
except Exception as e:
self.master.networking.eprint(f"Error: {e} with payload: {payload}")
__send_confirmation("Fail", sender_mac, f"{msg_subkey} ({subtype})", payload, e)
else:
__send_confirmation("Fail", sender_mac, f"{msg_subkey} ({subtype})", payload, "Not authorised")
elif (msg_subkey := "Firmware-Update") and subtype == msg_subcodes[msg_key][msg_subkey]: # Firmware-Update
self.master.networking.iprint(f"{msg_subkey} ({subtype}) command received from {sender_mac} ({self.master.networking.aen.peer_name(sender_mac)})")
if __check_authorisation(sender_mac, payload):
Expand Down Expand Up @@ -390,7 +412,8 @@ def custom_cmd_handler(data):
f"{msg_subkey} ({subtype}) command received from {sender_mac} ({self.master.networking.aen.peer_name(sender_mac)})")
if __check_authorisation(sender_mac, payload):
try:
self.master.config.update(payload[0])
new_config = eval(payload[0])
self.master.config.update(new_config)
if payload[1]:
file_path = "config.py"
with open(file_path, "r") as f:
Expand Down Expand Up @@ -619,4 +642,3 @@ def custom_ack_handler(data):
self.master.networking.aen.cmd(custom_cmd_handler)
self.master.networking.aen.inf(custom_inf_handler)
self.master.networking.aen.ack(custom_ack_handler)

4 changes: 2 additions & 2 deletions software/release/hm3/config.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
config = {'ap_channel': 1, 'id': None, 'name': 'Nick', 'sta_mac': None, 'ap_mac': None, 'configuration': None, 'sta_channel': 1, 'version': '2025-10-12-155152'}
config = {'ap_channel': 1, 'id': None, 'name': 'Nick', 'sta_mac': None, 'ap_mac': None, 'configuration': None, 'sta_channel': 1, 'version': '2025-10-12-175607'}
version = {
'adxl345.py': 3,
'am1.py': 1,
'hm1.py': 1,
'ssp_networking.py': 3,
'ssp_networking.py': 4,
'files.py': 2,
'icons.py': 2,
'prefs.py': 2,
Expand Down
28 changes: 25 additions & 3 deletions software/release/hm3/ssp_networking.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ def hive_configure(self, mac, hive_config, channel=None, ifidx=None, sudo=False)
self.networking.dprint("net.cmd.hive_configure")
self.send_custom("Hive-Configure", mac, f"{hive_config}", channel, ifidx, sudo)

def hive_file(self, mac, file_name, hive_file, channel=None, ifidx=None, sudo=False):
self.networking.dprint("net.cmd.hive_file")
self.send_custom("Hive-File", mac, f"{[file_name, hive_file]}", channel, ifidx, sudo)

def firmware_update(self, mac, channel=None, ifidx=None, sudo=False):
self.networking.dprint("net.cmd.firmware_update")
self.send_custom("Firmware-Update", mac, None, channel, ifidx, sudo)
Expand Down Expand Up @@ -265,7 +269,7 @@ def custom_cmd_handler(data):
if __check_authorisation(sender_mac, payload):
try:
from config import hive_config
new_config = payload[0]
new_config = eval(payload[0])
hive_config.update(new_config)
file_path = "config.py"
with open(file_path, "r") as f:
Expand All @@ -283,6 +287,24 @@ def custom_cmd_handler(data):
__send_confirmation("Fail", sender_mac, f"{msg_subkey} ({subtype})", payload, e)
else:
__send_confirmation("Fail", sender_mac, f"{msg_subkey} ({subtype})", payload, "Not authorised")
elif (msg_subkey := "Hive-File") and subtype == msg_subcodes[msg_key][msg_subkey]: # File-Hive
self.master.networking.iprint(f"{msg_subkey} ({subtype}) command received from {sender_mac} ({self.master.networking.aen.peer_name(sender_mac)})")
if __check_authorisation(sender_mac, payload):
try:
# Insert write file logic here
file_path = eval(payload[0])
file_hive = eval(payload[1])
if isinstance(file_hive, str):
file_hive = [file_hive]
with open(file_path, "w") as f:
f.write(f"{file_hive}\n")
self.master.networking.iprint("No file-hive logic written just yet")
__send_confirmation("Success", sender_mac, f"{msg_subkey} ({subtype})", payload)
except Exception as e:
self.master.networking.eprint(f"Error: {e} with payload: {payload}")
__send_confirmation("Fail", sender_mac, f"{msg_subkey} ({subtype})", payload, e)
else:
__send_confirmation("Fail", sender_mac, f"{msg_subkey} ({subtype})", payload, "Not authorised")
elif (msg_subkey := "Firmware-Update") and subtype == msg_subcodes[msg_key][msg_subkey]: # Firmware-Update
self.master.networking.iprint(f"{msg_subkey} ({subtype}) command received from {sender_mac} ({self.master.networking.aen.peer_name(sender_mac)})")
if __check_authorisation(sender_mac, payload):
Expand Down Expand Up @@ -390,7 +412,8 @@ def custom_cmd_handler(data):
f"{msg_subkey} ({subtype}) command received from {sender_mac} ({self.master.networking.aen.peer_name(sender_mac)})")
if __check_authorisation(sender_mac, payload):
try:
self.master.config.update(payload[0])
new_config = eval(payload[0])
self.master.config.update(new_config)
if payload[1]:
file_path = "config.py"
with open(file_path, "r") as f:
Expand Down Expand Up @@ -619,4 +642,3 @@ def custom_ack_handler(data):
self.master.networking.aen.cmd(custom_cmd_handler)
self.master.networking.aen.inf(custom_inf_handler)
self.master.networking.aen.ack(custom_ack_handler)

4 changes: 2 additions & 2 deletions software/release/mm1/config.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
config = {'ap_channel': 1, 'id': None, 'name': 'Nick', 'sta_mac': None, 'ap_mac': None, 'configuration': None, 'sta_channel': 1, 'version': '2025-10-12-155152'}
config = {'ap_channel': 1, 'id': None, 'name': 'Nick', 'sta_mac': None, 'ap_mac': None, 'configuration': None, 'sta_channel': 1, 'version': '2025-10-12-175607'}
version = {
'adxl345.py': 3,
'am1.py': 1,
'hm1.py': 1,
'ssp_networking.py': 3,
'ssp_networking.py': 4,
'files.py': 2,
'icons.py': 2,
'prefs.py': 2,
Expand Down
28 changes: 25 additions & 3 deletions software/release/mm1/ssp_networking.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ def hive_configure(self, mac, hive_config, channel=None, ifidx=None, sudo=False)
self.networking.dprint("net.cmd.hive_configure")
self.send_custom("Hive-Configure", mac, f"{hive_config}", channel, ifidx, sudo)

def hive_file(self, mac, file_name, hive_file, channel=None, ifidx=None, sudo=False):
self.networking.dprint("net.cmd.hive_file")
self.send_custom("Hive-File", mac, f"{[file_name, hive_file]}", channel, ifidx, sudo)

def firmware_update(self, mac, channel=None, ifidx=None, sudo=False):
self.networking.dprint("net.cmd.firmware_update")
self.send_custom("Firmware-Update", mac, None, channel, ifidx, sudo)
Expand Down Expand Up @@ -265,7 +269,7 @@ def custom_cmd_handler(data):
if __check_authorisation(sender_mac, payload):
try:
from config import hive_config
new_config = payload[0]
new_config = eval(payload[0])
hive_config.update(new_config)
file_path = "config.py"
with open(file_path, "r") as f:
Expand All @@ -283,6 +287,24 @@ def custom_cmd_handler(data):
__send_confirmation("Fail", sender_mac, f"{msg_subkey} ({subtype})", payload, e)
else:
__send_confirmation("Fail", sender_mac, f"{msg_subkey} ({subtype})", payload, "Not authorised")
elif (msg_subkey := "Hive-File") and subtype == msg_subcodes[msg_key][msg_subkey]: # File-Hive
self.master.networking.iprint(f"{msg_subkey} ({subtype}) command received from {sender_mac} ({self.master.networking.aen.peer_name(sender_mac)})")
if __check_authorisation(sender_mac, payload):
try:
# Insert write file logic here
file_path = eval(payload[0])
file_hive = eval(payload[1])
if isinstance(file_hive, str):
file_hive = [file_hive]
with open(file_path, "w") as f:
f.write(f"{file_hive}\n")
self.master.networking.iprint("No file-hive logic written just yet")
__send_confirmation("Success", sender_mac, f"{msg_subkey} ({subtype})", payload)
except Exception as e:
self.master.networking.eprint(f"Error: {e} with payload: {payload}")
__send_confirmation("Fail", sender_mac, f"{msg_subkey} ({subtype})", payload, e)
else:
__send_confirmation("Fail", sender_mac, f"{msg_subkey} ({subtype})", payload, "Not authorised")
elif (msg_subkey := "Firmware-Update") and subtype == msg_subcodes[msg_key][msg_subkey]: # Firmware-Update
self.master.networking.iprint(f"{msg_subkey} ({subtype}) command received from {sender_mac} ({self.master.networking.aen.peer_name(sender_mac)})")
if __check_authorisation(sender_mac, payload):
Expand Down Expand Up @@ -390,7 +412,8 @@ def custom_cmd_handler(data):
f"{msg_subkey} ({subtype}) command received from {sender_mac} ({self.master.networking.aen.peer_name(sender_mac)})")
if __check_authorisation(sender_mac, payload):
try:
self.master.config.update(payload[0])
new_config = eval(payload[0])
self.master.config.update(new_config)
if payload[1]:
file_path = "config.py"
with open(file_path, "r") as f:
Expand Down Expand Up @@ -619,4 +642,3 @@ def custom_ack_handler(data):
self.master.networking.aen.cmd(custom_cmd_handler)
self.master.networking.aen.inf(custom_inf_handler)
self.master.networking.aen.ack(custom_ack_handler)

4 changes: 2 additions & 2 deletions software/release/sl1/config.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
config = {'ap_channel': 1, 'id': None, 'name': 'Nick', 'sta_mac': None, 'ap_mac': None, 'configuration': None, 'sta_channel': 1, 'version': '2025-10-12-155152'}
config = {'ap_channel': 1, 'id': None, 'name': 'Nick', 'sta_mac': None, 'ap_mac': None, 'configuration': None, 'sta_channel': 1, 'version': '2025-10-12-175607'}
version = {
'adxl345.py': 3,
'am1.py': 1,
'hm1.py': 1,
'ssp_networking.py': 3,
'ssp_networking.py': 4,
'files.py': 2,
'icons.py': 2,
'prefs.py': 2,
Expand Down
Loading