Adding lldp.json to the simulator

Moving the global on/off onto the LLDP page

Building a table of LLDP status from the S ports. Later on, if
we wish to implement an lldp receiver we can display the remote
details here

Adding support to the cmd parser for the lldp commands
This commit is contained in:
Rob Emery committed 2026-10-10 09:50:01 +01:00
1 parent 4f1a2f04d8
commit 58fd1a3ccc
9 files changed
+100 -20

No files matched your search

+19 -1
View File
@@ -49,6 +49,9 @@ extern __xdata char sfp_module_model[2][17];
extern __xdata char sfp_module_serial[2][17];
extern __xdata uint8_t sfp_options[2];
extern __xdata uint16_t lldp_physical_port_status;
extern __xdata bool lldp_enabled;
__code const uint8_t * __code const HTTP_RESPONCE_JSON = "HTTP/1.1 200 OK\r\nConnection: close\r\nContent-Type: application/json\r\n\r\n";
__code const uint8_t * __code const HTTP_RESPONCE_TXT = "HTTP/1.1 200 OK\r\nConnection: close\r\nContent-Type: text/plain\r\n\r\n";
@@ -619,7 +622,6 @@ static void bridge_to_html(void)
byte_to_html(pi_mac[i]);
}
void send_stp(void)
{
uint8_t i, j, st, dsg;
@@ -734,6 +736,22 @@ void send_stp(void)
slen += strtox(outbuf + slen, "]}");
}
void send_lldp(void)
{
dbg_string("send_lldp called\n");
slen = strtox(outbuf, HTTP_RESPONCE_JSON);
slen += strtox(outbuf + slen, "{\"on\":");
bool_to_html(lldp_enabled);
slen += strtox(outbuf + slen, ",\"port_status\": [");
for (uint8_t port = machine.min_port; port <= machine.max_port; port++) {
bool_to_html((1 << machine.log_to_phys_port[port]) & lldp_physical_port_status);
slen += strtox(outbuf + slen, ",");
}
slen += strtox(outbuf + slen, "]}");
}