connectcore-demo-example: add support to a third ethernet interface
Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
This commit is contained in:
parent
a326832902
commit
5d801b0386
|
|
@ -186,24 +186,22 @@ class RequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||||
"ethernet0_ip": ZERO_IP,
|
"ethernet0_ip": ZERO_IP,
|
||||||
"ethernet1_mac": ZERO_MAC,
|
"ethernet1_mac": ZERO_MAC,
|
||||||
"ethernet1_ip": ZERO_IP,
|
"ethernet1_ip": ZERO_IP,
|
||||||
|
"ethernet2_mac": ZERO_MAC,
|
||||||
|
"ethernet2_ip": ZERO_IP,
|
||||||
}
|
}
|
||||||
# Fill ethernet interfaces data.
|
# Fill ethernet interfaces data.
|
||||||
try:
|
try:
|
||||||
interfaces = NetworkInterface.list_interfaces()
|
interfaces = NetworkInterface.list_interfaces()
|
||||||
if interfaces and "eth0" in interfaces:
|
for iface in interfaces:
|
||||||
|
if iface not in ("eth0", "eth1", "eth2"):
|
||||||
|
continue
|
||||||
try:
|
try:
|
||||||
net_iface = NetworkInterface.get("eth0")
|
net_iface = NetworkInterface.get(iface)
|
||||||
info["ethernet0_mac"] = str(net_iface.mac)
|
index = iface[len("eth"):]
|
||||||
info["ethernet0_ip"] = str(net_iface.ipv4)
|
info["ethernet%s_mac" % index] = str(net_iface.mac)
|
||||||
|
info["ethernet%s_ip" % index] = str(net_iface.ipv4)
|
||||||
except NetworkException as exc2:
|
except NetworkException as exc2:
|
||||||
log.error("Error reading interface 'eth0' data: %s", str(exc2))
|
log.error("Error reading interface '%s' data: %s", iface, str(exc2))
|
||||||
if interfaces and "eth1" in interfaces:
|
|
||||||
try:
|
|
||||||
net_iface = NetworkInterface.get("eth1")
|
|
||||||
info["ethernet1_mac"] = mac_to_human_string(net_iface.mac)
|
|
||||||
info["ethernet1_ip"] = str(net_iface.ipv4)
|
|
||||||
except NetworkException as exc2:
|
|
||||||
log.error("Error reading interface 'eth1' data: %s", str(exc2))
|
|
||||||
except DigiAPIXException as exc:
|
except DigiAPIXException as exc:
|
||||||
log.error("Error listing network interfaces: %s", str(exc))
|
log.error("Error listing network interfaces: %s", str(exc))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -586,6 +586,62 @@ Digi Demo - Dashboard
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="ethernet2_panel_area" class="panel-area panel-tooltip" onclick="toggleInfoPanelVisibility('ethernet2')">
|
||||||
|
<span class="panel-tooltip-text">Ethernet 2 stats</span>
|
||||||
|
<span id="ethernet2_panel_icon" class="fas fa-ethernet panel-area-icon"></span>
|
||||||
|
</div>
|
||||||
|
<div id="ethernet2_panel" class="device-card ethernet-panel shadow-sm">
|
||||||
|
<span id="ethernet2_panel_arrow" class="panel-arrow"></span>
|
||||||
|
<div class="device-card-header">
|
||||||
|
<span class="fas fa-ethernet fa-lg mr-2"></span>
|
||||||
|
<span>Ethernet 2 stats</span>
|
||||||
|
<div class="fas fa-window-close fa-lg device-card-header-button" onclick="setInfoPanelVisible('ethernet2', false)"></div>
|
||||||
|
</div>
|
||||||
|
<div class="device-card-content">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<span class="device-card-content-text">Status:</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span id="ethernet2_state" class="device-card-content-value">-</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<span class="device-card-content-text">MAC:</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span id="ethernet2_mac" class="device-card-content-value">-</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<span class="device-card-content-text">IP:</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span id="ethernet2_ip" class="device-card-content-value">-</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<span class="device-card-content-text">TX data:</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span id="ethernet2_sent_data" class="device-card-content-value">-</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<span class="device-card-content-text">RX data:</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span id="ethernet2_received_data" class="device-card-content-value">-</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div id="video_panel_area" class="panel-area panel-tooltip" onclick="toggleInfoPanelVisibility('video')">
|
<div id="video_panel_area" class="panel-area panel-tooltip" onclick="toggleInfoPanelVisibility('video')">
|
||||||
<span class="panel-tooltip-text">Video info</span>
|
<span class="panel-tooltip-text">Video info</span>
|
||||||
<span id="video_panel_icon" class="fas fa-desktop panel-area-icon"></span>
|
<span id="video_panel_icon" class="fas fa-desktop panel-area-icon"></span>
|
||||||
|
|
|
||||||
|
|
@ -240,6 +240,63 @@ Digi Demo - Network
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="eth2" class="card shadow-sm" style="padding: 0px">
|
||||||
|
<div id="eth2_panel_header" class="interface-header" style="cursor: pointer;" onclick="togglePanelVisibility('eth2')">
|
||||||
|
<span class="fas fa-ethernet fa-lg mr-2"></span>
|
||||||
|
<span id="eth2_title" class="card-title interface-title">Ethernet 2</span>
|
||||||
|
<div id="eth2_toggle_button" class="fas fa-caret-down fa-lg device-card-header-button"></div>
|
||||||
|
</div>
|
||||||
|
<div id="eth2_panel_container" class="interface-panel-container" style="display: none;">
|
||||||
|
<div>Configure ethernet 2 parameters.</div>
|
||||||
|
<div class="param-container">
|
||||||
|
<span class="param-label">MAC Address:</span>
|
||||||
|
<span id="eth2_mac" class="param-value"></span>
|
||||||
|
</div>
|
||||||
|
<div class="param-container">
|
||||||
|
<span class="param-label">Connected:</span>
|
||||||
|
<label class="switch-control">
|
||||||
|
<input id="eth2_enable" type="checkbox">
|
||||||
|
<span class="slider-control round"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div id="eth2_ip_mode_param" class="param-container">
|
||||||
|
<span class="param-label">IP mode:</span>
|
||||||
|
<select name="eth2_ip_mode" id="eth2_ip_mode" class="select-control">
|
||||||
|
<option value="static">Static</option>
|
||||||
|
<option value="dhcp" selected="selected">DHCP</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div id="eth2_ip_addr_param" class="param-container">
|
||||||
|
<span class="param-label">IP address:</span>
|
||||||
|
<input id="eth2_ip_addr" class="input-control input-control-wide" type="text"/>
|
||||||
|
<div id="eth2_ip_addr_error" class="error-label"></div>
|
||||||
|
</div>
|
||||||
|
<div id="eth2_subnet_mask_param" class="param-container">
|
||||||
|
<span class="param-label">Subnet mask:</span>
|
||||||
|
<input id="eth2_subnet_mask" class="input-control input-control-wide" type="text"/>
|
||||||
|
<div id="eth2_subnet_mask_error" class="error-label"></div>
|
||||||
|
</div>
|
||||||
|
<div id="eth2_default_gateway_param" class="param-container">
|
||||||
|
<span class="param-label">Default gateway:</span>
|
||||||
|
<input id="eth2_default_gateway" class="input-control input-control-wide" type="text"/>
|
||||||
|
<div id="eth2_default_gateway_error" class="error-label"></div>
|
||||||
|
</div>
|
||||||
|
<div id="eth2_dns1_addr_param" class="param-container">
|
||||||
|
<span class="param-label">DNS1 address:</span>
|
||||||
|
<input id="eth2_dns1_addr" class="input-control input-control-wide" type="text"/>
|
||||||
|
<div id="eth2_dns1_addr_error" class="error-label"></div>
|
||||||
|
</div>
|
||||||
|
<div id="eth2_dns2_addr_param" class="param-container">
|
||||||
|
<span class="param-label">DNS2 address:</span>
|
||||||
|
<input id="eth2_dns2_addr" class="input-control input-control-wide" type="text"/>
|
||||||
|
<div id="eth2_dns2_addr_error" class="error-label"></div>
|
||||||
|
</div>
|
||||||
|
<div class="buttons-container">
|
||||||
|
<div id="eth2_refresh_button" class="device-card-button config-button" onclick="readConfiguration(['ethernet'], 'eth2')">Refresh</div>
|
||||||
|
<div id="eth2_save_button" class="device-card-button config-button config-button-disabled" onclick="saveInterface('ethernet', 'eth2')">Save</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div id="wlan0" class="card shadow-sm" style="padding: 0px;">
|
<div id="wlan0" class="card shadow-sm" style="padding: 0px;">
|
||||||
<div id="wlan0_panel_header" class="interface-header" style="cursor: pointer;" onclick="togglePanelVisibility('wlan0')">
|
<div id="wlan0_panel_header" class="interface-header" style="cursor: pointer;" onclick="togglePanelVisibility('wlan0')">
|
||||||
<span class="fas fa-wifi fa-lg mr-2"></span>
|
<span class="fas fa-wifi fa-lg mr-2"></span>
|
||||||
|
|
@ -379,6 +436,27 @@ Digi Demo - Network
|
||||||
$("#eth1_dns2_addr").on("input", function(event) {
|
$("#eth1_dns2_addr").on("input", function(event) {
|
||||||
validateInterface("eth1");
|
validateInterface("eth1");
|
||||||
});
|
});
|
||||||
|
$('#eth2_enable').click(function(){
|
||||||
|
updateInterfaceControls("eth2");
|
||||||
|
});
|
||||||
|
$("#eth2_ip_mode").on("change", function(event) {
|
||||||
|
updateInterfaceControls("eth2");
|
||||||
|
});
|
||||||
|
$("#eth2_ip_addr").on("input", function(event) {
|
||||||
|
validateInterface("eth2");
|
||||||
|
});
|
||||||
|
$("#eth2_subnet_mask").on("input", function(event) {
|
||||||
|
validateInterface("eth2");
|
||||||
|
});
|
||||||
|
$("#eth2_default_gateway").on("input", function(event) {
|
||||||
|
validateInterface("eth2");
|
||||||
|
});
|
||||||
|
$("#eth2_dns1_addr").on("input", function(event) {
|
||||||
|
validateInterface("eth2");
|
||||||
|
});
|
||||||
|
$("#eth2_dns2_addr").on("input", function(event) {
|
||||||
|
validateInterface("eth2");
|
||||||
|
});
|
||||||
$('#wlan0_enable').click(function(){
|
$('#wlan0_enable').click(function(){
|
||||||
updateInterfaceControls("wlan0");
|
updateInterfaceControls("wlan0");
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023, Digi International Inc.
|
* Copyright 2023,2024 Digi International Inc.
|
||||||
*
|
*
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
|
@ -151,7 +151,7 @@ class CCIMX6QPSBC extends ConnectCoreDevice {
|
||||||
|
|
||||||
// Capabilities
|
// Capabilities
|
||||||
SUPPORTS_VIDEO_BRIGHTNESS = false;
|
SUPPORTS_VIDEO_BRIGHTNESS = false;
|
||||||
SUPPORTS_DUAL_ETHERNET = false;
|
SUPPORTS_NUM_ETHERNET = 1;
|
||||||
|
|
||||||
// Misc info
|
// Misc info
|
||||||
PCB_COLOR = ID_COLOR_GREEN;
|
PCB_COLOR = ID_COLOR_GREEN;
|
||||||
|
|
@ -160,4 +160,4 @@ class CCIMX6QPSBC extends ConnectCoreDevice {
|
||||||
constructor(deviceData) {
|
constructor(deviceData) {
|
||||||
super(CCIMX6QPSBC.DEVICE_TYPE, CCIMX6QPSBC.PLATFORM_NAME, deviceData);
|
super(CCIMX6QPSBC.DEVICE_TYPE, CCIMX6QPSBC.PLATFORM_NAME, deviceData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023, Digi International Inc.
|
* Copyright 2023,2024 Digi International Inc.
|
||||||
*
|
*
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
|
@ -151,7 +151,7 @@ class CCIMX6SBC extends ConnectCoreDevice {
|
||||||
|
|
||||||
// Capabilities
|
// Capabilities
|
||||||
SUPPORTS_VIDEO_BRIGHTNESS = false;
|
SUPPORTS_VIDEO_BRIGHTNESS = false;
|
||||||
SUPPORTS_DUAL_ETHERNET = false;
|
SUPPORTS_NUM_ETHERNET = 1;
|
||||||
|
|
||||||
// Misc info
|
// Misc info
|
||||||
PCB_COLOR = ID_COLOR_GREEN;
|
PCB_COLOR = ID_COLOR_GREEN;
|
||||||
|
|
@ -160,4 +160,4 @@ class CCIMX6SBC extends ConnectCoreDevice {
|
||||||
constructor(deviceData) {
|
constructor(deviceData) {
|
||||||
super(CCIMX6SBC.DEVICE_TYPE, CCIMX6SBC.PLATFORM_NAME, deviceData);
|
super(CCIMX6SBC.DEVICE_TYPE, CCIMX6SBC.PLATFORM_NAME, deviceData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2022, 2023, Digi International Inc.
|
* Copyright 2022-2024, Digi International Inc.
|
||||||
*
|
*
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
|
@ -151,7 +151,7 @@ class CCIMX6ULSBC extends ConnectCoreDevice {
|
||||||
|
|
||||||
// Capabilities
|
// Capabilities
|
||||||
SUPPORTS_VIDEO_BRIGHTNESS = false;
|
SUPPORTS_VIDEO_BRIGHTNESS = false;
|
||||||
SUPPORTS_DUAL_ETHERNET = true;
|
SUPPORTS_NUM_ETHERNET = 2;
|
||||||
|
|
||||||
// Misc info
|
// Misc info
|
||||||
PCB_COLOR = ID_COLOR_BLUE;
|
PCB_COLOR = ID_COLOR_BLUE;
|
||||||
|
|
@ -160,4 +160,4 @@ class CCIMX6ULSBC extends ConnectCoreDevice {
|
||||||
constructor(deviceData) {
|
constructor(deviceData) {
|
||||||
super(CCIMX6ULSBC.DEVICE_TYPE, CCIMX6ULSBC.PLATFORM_NAME, deviceData);
|
super(CCIMX6ULSBC.DEVICE_TYPE, CCIMX6ULSBC.PLATFORM_NAME, deviceData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2022, 2023, Digi International Inc.
|
* Copyright 2022-2024, Digi International Inc.
|
||||||
*
|
*
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
|
@ -138,7 +138,7 @@ class CCIMX8MNANO extends ConnectCoreDevice {
|
||||||
|
|
||||||
// Capabilities
|
// Capabilities
|
||||||
SUPPORTS_VIDEO_BRIGHTNESS = false;
|
SUPPORTS_VIDEO_BRIGHTNESS = false;
|
||||||
SUPPORTS_DUAL_ETHERNET = false;
|
SUPPORTS_NUM_ETHERNET = 1;
|
||||||
|
|
||||||
// Misc info
|
// Misc info
|
||||||
PCB_COLOR = ID_COLOR_BLUE;
|
PCB_COLOR = ID_COLOR_BLUE;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2022, 2023, Digi International Inc.
|
* Copyright 2022-2024, Digi International Inc.
|
||||||
*
|
*
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
|
@ -138,7 +138,7 @@ class CCIMX8MMINI extends ConnectCoreDevice {
|
||||||
|
|
||||||
// Capabilities
|
// Capabilities
|
||||||
SUPPORTS_VIDEO_BRIGHTNESS = false;
|
SUPPORTS_VIDEO_BRIGHTNESS = false;
|
||||||
SUPPORTS_DUAL_ETHERNET = false;
|
SUPPORTS_NUM_ETHERNET = 1;
|
||||||
|
|
||||||
// Misc info
|
// Misc info
|
||||||
PCB_COLOR = ID_COLOR_BLUE;
|
PCB_COLOR = ID_COLOR_BLUE;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2022, 2023, Digi International Inc.
|
* Copyright 2022-2024, Digi International Inc.
|
||||||
*
|
*
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
|
@ -151,7 +151,7 @@ class CCIMX8X extends ConnectCoreDevice {
|
||||||
|
|
||||||
// Capabilities
|
// Capabilities
|
||||||
SUPPORTS_VIDEO_BRIGHTNESS = false;
|
SUPPORTS_VIDEO_BRIGHTNESS = false;
|
||||||
SUPPORTS_DUAL_ETHERNET = true;
|
SUPPORTS_NUM_ETHERNET = 2;
|
||||||
|
|
||||||
// Misc info
|
// Misc info
|
||||||
PCB_COLOR = ID_COLOR_BLUE;
|
PCB_COLOR = ID_COLOR_BLUE;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023, Digi International Inc.
|
* Copyright 2022-2024, Digi International Inc.
|
||||||
*
|
*
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
|
@ -151,7 +151,7 @@ class CCIMX93 extends ConnectCoreDevice {
|
||||||
|
|
||||||
// Capabilities
|
// Capabilities
|
||||||
SUPPORTS_VIDEO_BRIGHTNESS = false;
|
SUPPORTS_VIDEO_BRIGHTNESS = false;
|
||||||
SUPPORTS_DUAL_ETHERNET = true;
|
SUPPORTS_NUM_ETHERNET = 2;
|
||||||
|
|
||||||
// Misc info
|
// Misc info
|
||||||
PCB_COLOR = ID_COLOR_BLUE;
|
PCB_COLOR = ID_COLOR_BLUE;
|
||||||
|
|
@ -160,4 +160,4 @@ class CCIMX93 extends ConnectCoreDevice {
|
||||||
constructor(deviceData) {
|
constructor(deviceData) {
|
||||||
super(CCIMX93.DEVICE_TYPE, CCIMX93.PLATFORM_NAME, deviceData);
|
super(CCIMX93.DEVICE_TYPE, CCIMX93.PLATFORM_NAME, deviceData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2022, 2023, Digi International Inc.
|
* Copyright 2022-2024, Digi International Inc.
|
||||||
*
|
*
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
|
@ -138,7 +138,7 @@ class CCMP133 extends ConnectCoreDevice {
|
||||||
|
|
||||||
// Capabilities
|
// Capabilities
|
||||||
SUPPORTS_VIDEO_BRIGHTNESS = false;
|
SUPPORTS_VIDEO_BRIGHTNESS = false;
|
||||||
SUPPORTS_DUAL_ETHERNET = false;
|
SUPPORTS_NUM_ETHERNET = 1;
|
||||||
|
|
||||||
// Misc info
|
// Misc info
|
||||||
PCB_COLOR = ID_COLOR_BLUE;
|
PCB_COLOR = ID_COLOR_BLUE;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2022, 2023, Digi International Inc.
|
* Copyright 2022-2024, Digi International Inc.
|
||||||
*
|
*
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
|
@ -138,7 +138,7 @@ class CCMP157 extends ConnectCoreDevice {
|
||||||
|
|
||||||
// Capabilities
|
// Capabilities
|
||||||
SUPPORTS_VIDEO_BRIGHTNESS = false;
|
SUPPORTS_VIDEO_BRIGHTNESS = false;
|
||||||
SUPPORTS_DUAL_ETHERNET = false;
|
SUPPORTS_NUM_ETHERNET = 1;
|
||||||
|
|
||||||
// Misc info
|
// Misc info
|
||||||
PCB_COLOR = ID_COLOR_BLUE;
|
PCB_COLOR = ID_COLOR_BLUE;
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,19 @@ class CCMP255 extends ConnectCoreDevice {
|
||||||
ETHERNET1_COMPONENT_AREA_WIDTH_PERCENT = 9.8;
|
ETHERNET1_COMPONENT_AREA_WIDTH_PERCENT = 9.8;
|
||||||
ETHERNET1_COMPONENT_AREA_HEIGHT_PERCENT = 17;
|
ETHERNET1_COMPONENT_AREA_HEIGHT_PERCENT = 17;
|
||||||
|
|
||||||
|
ETHERNET2_COMPONENT_VISIBLE = false;
|
||||||
|
ETHERNET2_COMPONENT_HAS_PANEL = true;
|
||||||
|
ETHERNET2_COMPONENT_HAS_ARROW = true;
|
||||||
|
ETHERNET2_COMPONENT_PANEL_ALWAYS_VISIBLE = false;
|
||||||
|
ETHERNET2_COMPONENT_PANEL_ORIENTATION = VALUE_TOP;
|
||||||
|
ETHERNET2_COMPONENT_PANEL_HORIZONTAL_PERCENT = 33;
|
||||||
|
ETHERNET2_COMPONENT_PANEL_VERTICAL_PERCENT = 22.5;
|
||||||
|
ETHERNET2_COMPONENT_ARROW_PERCENT = 47.5;
|
||||||
|
ETHERNET2_COMPONENT_AREA_TOP_PERCENT = 2;
|
||||||
|
ETHERNET2_COMPONENT_AREA_LEFT_PERCENT = 44;
|
||||||
|
ETHERNET2_COMPONENT_AREA_WIDTH_PERCENT = 9.8;
|
||||||
|
ETHERNET2_COMPONENT_AREA_HEIGHT_PERCENT = 17;
|
||||||
|
|
||||||
CONSOLE_COMPONENT_VISIBLE = true;
|
CONSOLE_COMPONENT_VISIBLE = true;
|
||||||
CONSOLE_COMPONENT_HAS_PANEL = false;
|
CONSOLE_COMPONENT_HAS_PANEL = false;
|
||||||
CONSOLE_COMPONENT_HAS_ARROW = false;
|
CONSOLE_COMPONENT_HAS_ARROW = false;
|
||||||
|
|
@ -151,7 +164,7 @@ class CCMP255 extends ConnectCoreDevice {
|
||||||
|
|
||||||
// Capabilities
|
// Capabilities
|
||||||
SUPPORTS_VIDEO_BRIGHTNESS = false;
|
SUPPORTS_VIDEO_BRIGHTNESS = false;
|
||||||
SUPPORTS_DUAL_ETHERNET = true;
|
SUPPORTS_NUM_ETHERNET = 2;
|
||||||
|
|
||||||
// Misc info
|
// Misc info
|
||||||
PCB_COLOR = ID_COLOR_BLUE;
|
PCB_COLOR = ID_COLOR_BLUE;
|
||||||
|
|
|
||||||
|
|
@ -55,16 +55,22 @@ const ID_ERROR_MESSAGE = "error_msg";
|
||||||
const ID_ERROR_TITLE = "error_title";
|
const ID_ERROR_TITLE = "error_title";
|
||||||
const ID_ETHERNET0 = "ethernet0";
|
const ID_ETHERNET0 = "ethernet0";
|
||||||
const ID_ETHERNET1 = "ethernet1";
|
const ID_ETHERNET1 = "ethernet1";
|
||||||
|
const ID_ETHERNET2 = "ethernet2";
|
||||||
const ID_ETHERNET0_IP = "ethernet0_ip";
|
const ID_ETHERNET0_IP = "ethernet0_ip";
|
||||||
const ID_ETHERNET1_IP = "ethernet1_ip";
|
const ID_ETHERNET1_IP = "ethernet1_ip";
|
||||||
|
const ID_ETHERNET2_IP = "ethernet2_ip";
|
||||||
const ID_ETHERNET0_MAC = "ethernet0_mac";
|
const ID_ETHERNET0_MAC = "ethernet0_mac";
|
||||||
const ID_ETHERNET1_MAC = "ethernet1_mac";
|
const ID_ETHERNET1_MAC = "ethernet1_mac";
|
||||||
|
const ID_ETHERNET2_MAC = "ethernet2_mac";
|
||||||
const ID_ETHERNET0_READ_DATA = "ethernet0_received_data";
|
const ID_ETHERNET0_READ_DATA = "ethernet0_received_data";
|
||||||
const ID_ETHERNET1_READ_DATA = "ethernet1_received_data";
|
const ID_ETHERNET1_READ_DATA = "ethernet1_received_data";
|
||||||
|
const ID_ETHERNET2_READ_DATA = "ethernet2_received_data";
|
||||||
const ID_ETHERNET0_SENT_DATA = "ethernet0_sent_data";
|
const ID_ETHERNET0_SENT_DATA = "ethernet0_sent_data";
|
||||||
const ID_ETHERNET1_SENT_DATA = "ethernet1_sent_data";
|
const ID_ETHERNET1_SENT_DATA = "ethernet1_sent_data";
|
||||||
|
const ID_ETHERNET2_SENT_DATA = "ethernet2_sent_data";
|
||||||
const ID_ETHERNET0_STATE = "ethernet0_state";
|
const ID_ETHERNET0_STATE = "ethernet0_state";
|
||||||
const ID_ETHERNET1_STATE = "ethernet1_state";
|
const ID_ETHERNET1_STATE = "ethernet1_state";
|
||||||
|
const ID_ETHERNET2_STATE = "ethernet2_state";
|
||||||
const ID_FILES = "files";
|
const ID_FILES = "files";
|
||||||
const ID_FLASH_MEMORY = "flash_memory";
|
const ID_FLASH_MEMORY = "flash_memory";
|
||||||
const ID_FLASH_SIZE = "flash_size";
|
const ID_FLASH_SIZE = "flash_size";
|
||||||
|
|
@ -160,6 +166,7 @@ const ERROR_UNKNOWN_ERROR = "Unknown error. Make sure that the server is running
|
||||||
const IFACE_BT = "hci0";
|
const IFACE_BT = "hci0";
|
||||||
const IFACE_ETH0 = "eth0";
|
const IFACE_ETH0 = "eth0";
|
||||||
const IFACE_ETH1 = "eth1";
|
const IFACE_ETH1 = "eth1";
|
||||||
|
const IFACE_ETH2 = "eth2";
|
||||||
const IFACE_WIFI = "wlan0";
|
const IFACE_WIFI = "wlan0";
|
||||||
|
|
||||||
const PREFIX_STREAM = "system_monitor/";
|
const PREFIX_STREAM = "system_monitor/";
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,10 @@ const ID_ETHERNET1_PANEL = "ethernet1_panel";
|
||||||
const ID_ETHERNET1_PANEL_AREA = "ethernet1_panel_area";
|
const ID_ETHERNET1_PANEL_AREA = "ethernet1_panel_area";
|
||||||
const ID_ETHERNET1_PANEL_ARROW = "ethernet1_panel_arrow";
|
const ID_ETHERNET1_PANEL_ARROW = "ethernet1_panel_arrow";
|
||||||
const ID_ETHERNET1_PANEL_ICON = "ethernet1_panel_icon";
|
const ID_ETHERNET1_PANEL_ICON = "ethernet1_panel_icon";
|
||||||
|
const ID_ETHERNET2_PANEL = "ethernet2_panel";
|
||||||
|
const ID_ETHERNET2_PANEL_AREA = "ethernet2_panel_area";
|
||||||
|
const ID_ETHERNET2_PANEL_ARROW = "ethernet2_panel_arrow";
|
||||||
|
const ID_ETHERNET2_PANEL_ICON = "ethernet2_panel_icon";
|
||||||
const ID_FLASH_MEMORY_PANEL = "flash_memory_panel";
|
const ID_FLASH_MEMORY_PANEL = "flash_memory_panel";
|
||||||
const ID_FLASH_MEMORY_PANEL_AREA = "flash_memory_panel_area";
|
const ID_FLASH_MEMORY_PANEL_AREA = "flash_memory_panel_area";
|
||||||
const ID_FLASH_MEMORY_PANEL_ARROW = "flash_memory_panel_arrow";
|
const ID_FLASH_MEMORY_PANEL_ARROW = "flash_memory_panel_arrow";
|
||||||
|
|
@ -69,6 +73,11 @@ const ID_WIFI_BT_PANEL = "wifi_bt_panel";
|
||||||
const ID_WIFI_BT_PANEL_AREA = "wifi_bt_panel_area";
|
const ID_WIFI_BT_PANEL_AREA = "wifi_bt_panel_area";
|
||||||
const ID_WIFI_BT_PANEL_ARROW = "wifi_bt_panel_arrow";
|
const ID_WIFI_BT_PANEL_ARROW = "wifi_bt_panel_arrow";
|
||||||
const ID_WIFI_BT_PANEL_ICON = "wifi_bt_panel_icon";
|
const ID_WIFI_BT_PANEL_ICON = "wifi_bt_panel_icon";
|
||||||
|
const ID_ETHERNETX = "ethernet{index}";
|
||||||
|
const ID_ETHERNETX_PANEL = "ethernet{index}_panel";
|
||||||
|
const ID_ETHERNETX_PANEL_AREA = "ethernet{index}_panel_area";
|
||||||
|
const ID_ETHERNETX_PANEL_ARROW = "ethernet{index}_panel_arrow";
|
||||||
|
const ID_ETHERNETX_PANEL_ICON = "ethernet{index}_panel_icon";
|
||||||
|
|
||||||
const USER_LED = "user_led";
|
const USER_LED = "user_led";
|
||||||
|
|
||||||
|
|
@ -81,6 +90,9 @@ const STREAM_ETHERNET0_STATE = PREFIX_STREAM + IFACE_ETH0 + "/state";
|
||||||
const STREAM_ETHERNET1_READ_BYTES = PREFIX_STREAM + IFACE_ETH1 + "/rx_bytes";
|
const STREAM_ETHERNET1_READ_BYTES = PREFIX_STREAM + IFACE_ETH1 + "/rx_bytes";
|
||||||
const STREAM_ETHERNET1_SENT_BYTES = PREFIX_STREAM + IFACE_ETH1 + "/tx_bytes";
|
const STREAM_ETHERNET1_SENT_BYTES = PREFIX_STREAM + IFACE_ETH1 + "/tx_bytes";
|
||||||
const STREAM_ETHERNET1_STATE = PREFIX_STREAM + IFACE_ETH1 + "/state";
|
const STREAM_ETHERNET1_STATE = PREFIX_STREAM + IFACE_ETH1 + "/state";
|
||||||
|
const STREAM_ETHERNET2_READ_BYTES = PREFIX_STREAM + IFACE_ETH2 + "/rx_bytes";
|
||||||
|
const STREAM_ETHERNET2_SENT_BYTES = PREFIX_STREAM + IFACE_ETH2 + "/tx_bytes";
|
||||||
|
const STREAM_ETHERNET2_STATE = PREFIX_STREAM + IFACE_ETH2 + "/state";
|
||||||
const STREAM_LED_STATUS = PREFIX_STREAM + "led_status";
|
const STREAM_LED_STATUS = PREFIX_STREAM + "led_status";
|
||||||
const STREAM_MEMORY_USED = PREFIX_STREAM + "used_memory";
|
const STREAM_MEMORY_USED = PREFIX_STREAM + "used_memory";
|
||||||
const STREAM_WIFI_READ_BYTES = PREFIX_STREAM + IFACE_WIFI + "/rx_bytes";
|
const STREAM_WIFI_READ_BYTES = PREFIX_STREAM + IFACE_WIFI + "/rx_bytes";
|
||||||
|
|
@ -275,7 +287,7 @@ function refreshDevice() {
|
||||||
initializingDevice = false;
|
initializingDevice = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
device.refreshIPs(data[ID_ETHERNET0_IP], data[ID_ETHERNET1_IP], data[ID_WIFI_IP]);
|
device.refreshIPs(data[ID_ETHERNET0_IP], data[ID_ETHERNET1_IP], data[ID_ETHERNET2_IP], data[ID_WIFI_IP]);
|
||||||
updateInfoValues();
|
updateInfoValues();
|
||||||
}
|
}
|
||||||
).fail(function(response) {
|
).fail(function(response) {
|
||||||
|
|
@ -339,6 +351,7 @@ function processDeviceStatusResponse(response) {
|
||||||
// Check if IP values are initialized.
|
// Check if IP values are initialized.
|
||||||
if ((response[STREAM_ETHERNET0_STATE] == 1 && device.getEthernetIP(0) == "0.0.0.0")
|
if ((response[STREAM_ETHERNET0_STATE] == 1 && device.getEthernetIP(0) == "0.0.0.0")
|
||||||
|| (response[STREAM_ETHERNET1_STATE] == 1 && device.getEthernetIP(1) == "0.0.0.0")
|
|| (response[STREAM_ETHERNET1_STATE] == 1 && device.getEthernetIP(1) == "0.0.0.0")
|
||||||
|
|| (response[STREAM_ETHERNET2_STATE] == 1 && device.getEthernetIP(2) == "0.0.0.0")
|
||||||
|| (response[STREAM_WIFI_STATE] == 1 && device.getWifiIP() == "0.0.0.0")) {
|
|| (response[STREAM_WIFI_STATE] == 1 && device.getWifiIP() == "0.0.0.0")) {
|
||||||
deviceInitialized = false;
|
deviceInitialized = false;
|
||||||
}
|
}
|
||||||
|
|
@ -456,26 +469,25 @@ function initializeComponents() {
|
||||||
var wifiBtPanelIcon = document.getElementById(ID_WIFI_BT_PANEL_ICON);
|
var wifiBtPanelIcon = document.getElementById(ID_WIFI_BT_PANEL_ICON);
|
||||||
var wifiBtInfo = {"panel": wifiBtPanel, "arrow": wifiBtPanelArrow, "area": wifiBtPanelArea, "icon": wifiBtPanelIcon, "data": device.getWifiBtComponentData()};
|
var wifiBtInfo = {"panel": wifiBtPanel, "arrow": wifiBtPanelArrow, "area": wifiBtPanelArea, "icon": wifiBtPanelIcon, "data": device.getWifiBtComponentData()};
|
||||||
components[ID_WIFI_BT] = wifiBtInfo;
|
components[ID_WIFI_BT] = wifiBtInfo;
|
||||||
// Ethernet 0 component.
|
// Ethernet components.
|
||||||
var ethernet0Panel = document.getElementById(ID_ETHERNET0_PANEL);
|
for (var i = 0; i < device.getEthernetNumSupported(); i++) {
|
||||||
var ethernet0PanelArrow = document.getElementById(ID_ETHERNET0_PANEL_ARROW);
|
var idEth = ID_ETHERNETX.replace('{index}', i);
|
||||||
var ethernet0PanelArea = document.getElementById(ID_ETHERNET0_PANEL_AREA);
|
var idEthPanel = ID_ETHERNETX_PANEL.replace('{index}', i);
|
||||||
if (device.getPCBColor() == ID_COLOR_GREEN)
|
var idEthPanelArea = ID_ETHERNETX_PANEL_AREA.replace('{index}', i);
|
||||||
ethernet0PanelArea.classList.add(CLASS_PANEL_BLUE);
|
var idEthPanelArrow = ID_ETHERNETX_PANEL_ARROW.replace('{index}', i);
|
||||||
var ethernet0PanelIcon = document.getElementById(ID_ETHERNET0_PANEL_ICON);
|
var idEthPanelIcon = ID_ETHERNETX_PANEL_ICON.replace('{index}', i);
|
||||||
var ethernet0Info = {"panel": ethernet0Panel, "arrow": ethernet0PanelArrow, "area": ethernet0PanelArea, "icon": ethernet0PanelIcon, "data": device.getEthernetComponentData(0)};
|
|
||||||
components[ID_ETHERNET0] = ethernet0Info;
|
var ethernetPanel = document.getElementById(idEthPanel);
|
||||||
if (device.supportsDualEthernet()) {
|
var ethernetPanelArrow = document.getElementById(idEthPanelArrow);
|
||||||
// Ethernet 1 component.
|
var ethernetPanelArea = document.getElementById(idEthPanelArea);
|
||||||
var ethernet1Panel = document.getElementById(ID_ETHERNET1_PANEL);
|
|
||||||
var ethernet1PanelArrow = document.getElementById(ID_ETHERNET1_PANEL_ARROW);
|
|
||||||
var ethernet1PanelArea = document.getElementById(ID_ETHERNET1_PANEL_AREA);
|
|
||||||
if (device.getPCBColor() == ID_COLOR_GREEN)
|
if (device.getPCBColor() == ID_COLOR_GREEN)
|
||||||
ethernet1PanelArea.classList.add(CLASS_PANEL_BLUE);
|
ethernetPanelArea.classList.add(CLASS_PANEL_BLUE);
|
||||||
var ethernet1PanelIcon = document.getElementById(ID_ETHERNET1_PANEL_ICON);
|
var ethernetPanelIcon = document.getElementById(idEthPanelIcon);
|
||||||
var ethernet1Info = {"panel": ethernet1Panel, "arrow": ethernet1PanelArrow, "area": ethernet1PanelArea, "icon": ethernet1PanelIcon, "data": device.getEthernetComponentData(1)};
|
var ethernetInfo = {"panel": ethernetPanel, "arrow": ethernetPanelArrow, "area": ethernetPanelArea, "icon": ethernetPanelIcon, "data": device.getEthernetComponentData(i)};
|
||||||
components[ID_ETHERNET1] = ethernet1Info;
|
components[idEth] = ethernetInfo;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if (device.getEthernetNumSupported() <= 0) {
|
||||||
// Update tooltip and title to reflect there is only one Ethernet interface.
|
// Update tooltip and title to reflect there is only one Ethernet interface.
|
||||||
document.getElementById(ID_ETHERNET0_TOOLTIP).innerText = "Ethernet stats";
|
document.getElementById(ID_ETHERNET0_TOOLTIP).innerText = "Ethernet stats";
|
||||||
document.getElementById(ID_ETHERNET0_TITLE).innerText = "Ethernet stats";
|
document.getElementById(ID_ETHERNET0_TITLE).innerText = "Ethernet stats";
|
||||||
|
|
@ -678,7 +690,7 @@ function updateInfoValues() {
|
||||||
// Set MCA HW version.
|
// Set MCA HW version.
|
||||||
updateFieldValue(ID_MCA_HW_VERSION, device.getMCAHWVersion());
|
updateFieldValue(ID_MCA_HW_VERSION, device.getMCAHWVersion());
|
||||||
// Iterate Ethernet interfaces.
|
// Iterate Ethernet interfaces.
|
||||||
for (var index = 0; index < device.NUM_ETHERNET_INTERFACES; index++) {
|
for (var index = 0; index < device.getEthernetNumSupported(); index++) {
|
||||||
// Set Ethernet MAC address.
|
// Set Ethernet MAC address.
|
||||||
updateFieldValue(eval("ID_ETHERNET" + index + "_MAC"), device.getEthernetMAC(index));
|
updateFieldValue(eval("ID_ETHERNET" + index + "_MAC"), device.getEthernetMAC(index));
|
||||||
// Set Ethernet IP address.
|
// Set Ethernet IP address.
|
||||||
|
|
@ -752,6 +764,15 @@ function updateDataPointValue(streamID, value) {
|
||||||
case STREAM_ETHERNET1_SENT_BYTES:
|
case STREAM_ETHERNET1_SENT_BYTES:
|
||||||
updateValueWithEffect(ID_ETHERNET1_SENT_DATA, sizeToHumanRead(value));
|
updateValueWithEffect(ID_ETHERNET1_SENT_DATA, sizeToHumanRead(value));
|
||||||
break;
|
break;
|
||||||
|
case STREAM_ETHERNET2_STATE:
|
||||||
|
updateValueWithEffect(ID_ETHERNET2_STATE, onOffStatus(value));
|
||||||
|
break;
|
||||||
|
case STREAM_ETHERNET2_READ_BYTES:
|
||||||
|
updateValueWithEffect(ID_ETHERNET2_READ_DATA, sizeToHumanRead(value));
|
||||||
|
break;
|
||||||
|
case STREAM_ETHERNET2_SENT_BYTES:
|
||||||
|
updateValueWithEffect(ID_ETHERNET2_SENT_DATA, sizeToHumanRead(value));
|
||||||
|
break;
|
||||||
case STREAM_WIFI_STATE:
|
case STREAM_WIFI_STATE:
|
||||||
updateValueWithEffect(ID_WIFI_STATE, onOffStatus(value));
|
updateValueWithEffect(ID_WIFI_STATE, onOffStatus(value));
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2022, 2023, Digi International Inc.
|
* Copyright (C) 2022-2024, Digi International Inc.
|
||||||
*
|
*
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
|
@ -109,6 +109,20 @@ class ConnectCoreDevice {
|
||||||
ETHERNET1_COMPONENT_AREA_WIDTH_PERCENT = 0;
|
ETHERNET1_COMPONENT_AREA_WIDTH_PERCENT = 0;
|
||||||
ETHERNET1_COMPONENT_AREA_HEIGHT_PERCENT = 0;
|
ETHERNET1_COMPONENT_AREA_HEIGHT_PERCENT = 0;
|
||||||
|
|
||||||
|
// Ethernet2 panel.
|
||||||
|
ETHERNET2_COMPONENT_VISIBLE = false;
|
||||||
|
ETHERNET2_COMPONENT_HAS_PANEL = false;
|
||||||
|
ETHERNET2_COMPONENT_HAS_ARROW = false;
|
||||||
|
ETHERNET2_COMPONENT_PANEL_ALWAYS_VISIBLE = false;
|
||||||
|
ETHERNET2_COMPONENT_PANEL_ORIENTATION = VALUE_TOP;
|
||||||
|
ETHERNET2_COMPONENT_PANEL_HORIZONTAL_PERCENT = 0;
|
||||||
|
ETHERNET2_COMPONENT_PANEL_VERTICAL_PERCENT = 0;
|
||||||
|
ETHERNET2_COMPONENT_ARROW_PERCENT = 0;
|
||||||
|
ETHERNET2_COMPONENT_AREA_TOP_PERCENT = 0;
|
||||||
|
ETHERNET2_COMPONENT_AREA_LEFT_PERCENT = 0;
|
||||||
|
ETHERNET2_COMPONENT_AREA_WIDTH_PERCENT = 0;
|
||||||
|
ETHERNET2_COMPONENT_AREA_HEIGHT_PERCENT = 0;
|
||||||
|
|
||||||
// Console.
|
// Console.
|
||||||
CONSOLE_COMPONENT_VISIBLE = false;
|
CONSOLE_COMPONENT_VISIBLE = false;
|
||||||
CONSOLE_COMPONENT_HAS_PANEL = false;
|
CONSOLE_COMPONENT_HAS_PANEL = false;
|
||||||
|
|
@ -181,9 +195,9 @@ class ConnectCoreDevice {
|
||||||
|
|
||||||
// Capabilities
|
// Capabilities
|
||||||
SUPPORTS_VIDEO_BRIGHTNESS;
|
SUPPORTS_VIDEO_BRIGHTNESS;
|
||||||
SUPPORTS_DUAL_ETHERNET;
|
SUPPORTS_NUM_ETHERNET;
|
||||||
|
|
||||||
NUM_ETHERNET_INTERFACES = 2;
|
MAX_NUM_ETHERNET_INTERFACES = 3;
|
||||||
|
|
||||||
// Device information.
|
// Device information.
|
||||||
#deviceType;
|
#deviceType;
|
||||||
|
|
@ -234,15 +248,18 @@ class ConnectCoreDevice {
|
||||||
this.#videoResolution = deviceData[ID_VIDEO_RESOLUTION];
|
this.#videoResolution = deviceData[ID_VIDEO_RESOLUTION];
|
||||||
this.#sampleRate = deviceData[ID_SAMPLE_RATE];
|
this.#sampleRate = deviceData[ID_SAMPLE_RATE];
|
||||||
this.#numSamplesUpload = deviceData[ID_NUM_SAMPLES_UPLOAD];
|
this.#numSamplesUpload = deviceData[ID_NUM_SAMPLES_UPLOAD];
|
||||||
for (var index = 0; index < this.NUM_ETHERNET_INTERFACES; index++) {
|
for (var index = 0; index < this.MAX_NUM_ETHERNET_INTERFACES; index++) {
|
||||||
this.#ethernetMAC[index] = deviceData[eval("ID_ETHERNET" + index + "_MAC")];
|
if (deviceData[eval("ID_ETHERNET" + index + "_MAC")]) {
|
||||||
this.#ethernetIP[index] = deviceData[eval("ID_ETHERNET" + index + "_IP")];
|
this.#ethernetMAC[index] = deviceData[eval("ID_ETHERNET" + index + "_MAC")];
|
||||||
|
this.#ethernetIP[index] = deviceData[eval("ID_ETHERNET" + index + "_IP")];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshIPs(eth0_ip, eth1_ip, wifi_ip) {
|
refreshIPs(eth0_ip, eth1_ip, eth2_ip, wifi_ip) {
|
||||||
this.#ethernetIP[0] = eth0_ip;
|
this.#ethernetIP[0] = eth0_ip;
|
||||||
this.#ethernetIP[1] = eth1_ip;
|
this.#ethernetIP[1] = eth1_ip;
|
||||||
|
this.#ethernetIP[2] = eth2_ip;
|
||||||
this.#wifiIP = wifi_ip;
|
this.#wifiIP = wifi_ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -313,14 +330,14 @@ class ConnectCoreDevice {
|
||||||
|
|
||||||
// Returns the device Ethernet MAC address for the given interface index.
|
// Returns the device Ethernet MAC address for the given interface index.
|
||||||
getEthernetMAC(index=0) {
|
getEthernetMAC(index=0) {
|
||||||
if (index >= this.NUM_ETHERNET_INTERFACES)
|
if (index >= this.MAX_NUM_ETHERNET_INTERFACES)
|
||||||
return "";
|
return "";
|
||||||
return this.#ethernetMAC[index];
|
return this.#ethernetMAC[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the device Ethernet IP address for the given interface index.
|
// Returns the device Ethernet IP address for the given interface index.
|
||||||
getEthernetIP(index=0) {
|
getEthernetIP(index=0) {
|
||||||
if (index >= this.NUM_ETHERNET_INTERFACES)
|
if (index >= this.MAX_NUM_ETHERNET_INTERFACES)
|
||||||
return "";
|
return "";
|
||||||
return this.#ethernetIP[index];
|
return this.#ethernetIP[index];
|
||||||
}
|
}
|
||||||
|
|
@ -420,7 +437,7 @@ class ConnectCoreDevice {
|
||||||
|
|
||||||
// Returns the Ethernet panel data for the given interface index.
|
// Returns the Ethernet panel data for the given interface index.
|
||||||
getEthernetComponentData(index=0) {
|
getEthernetComponentData(index=0) {
|
||||||
if (index >= this.NUM_ETHERNET_INTERFACES)
|
if (index >= this.SUPPORTS_NUM_ETHERNET)
|
||||||
return "";
|
return "";
|
||||||
return JSON.parse(TEMPLATE_COMPONENT_DATA.format(eval("this.ETHERNET" + index + "_COMPONENT_VISIBLE"),
|
return JSON.parse(TEMPLATE_COMPONENT_DATA.format(eval("this.ETHERNET" + index + "_COMPONENT_VISIBLE"),
|
||||||
eval("this.ETHERNET" + index + "_COMPONENT_HAS_PANEL"),
|
eval("this.ETHERNET" + index + "_COMPONENT_HAS_PANEL"),
|
||||||
|
|
@ -436,6 +453,11 @@ class ConnectCoreDevice {
|
||||||
eval("this.ETHERNET" + index + "_COMPONENT_AREA_HEIGHT_PERCENT")));
|
eval("this.ETHERNET" + index + "_COMPONENT_AREA_HEIGHT_PERCENT")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns number ethernet interfaces the device supports.
|
||||||
|
getEthernetNumSupported() {
|
||||||
|
return this.SUPPORTS_NUM_ETHERNET;
|
||||||
|
}
|
||||||
|
|
||||||
// Returns the Console panel data.
|
// Returns the Console panel data.
|
||||||
getConsoleComponentData() {
|
getConsoleComponentData() {
|
||||||
return JSON.parse(TEMPLATE_COMPONENT_DATA.format(this.CONSOLE_COMPONENT_VISIBLE,
|
return JSON.parse(TEMPLATE_COMPONENT_DATA.format(this.CONSOLE_COMPONENT_VISIBLE,
|
||||||
|
|
@ -521,11 +543,6 @@ class ConnectCoreDevice {
|
||||||
return this.SUPPORTS_VIDEO_BRIGHTNESS;
|
return this.SUPPORTS_VIDEO_BRIGHTNESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns whether the device supports dual ethernet or not.
|
|
||||||
supportsDualEthernet() {
|
|
||||||
return this.SUPPORTS_DUAL_ETHERNET;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns the color of the device PCB.
|
// Returns the color of the device PCB.
|
||||||
getPCBColor() {
|
getPCBColor() {
|
||||||
return this.PCB_COLOR;
|
return this.PCB_COLOR;
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,10 @@ function fillNetworkInfo(response, parseElement) {
|
||||||
if (parseElement == ALL_ELEMENTS) {
|
if (parseElement == ALL_ELEMENTS) {
|
||||||
if (numEthernetIfaces == 1) {
|
if (numEthernetIfaces == 1) {
|
||||||
document.getElementById(IFACE_ETH1).style.display = "none";
|
document.getElementById(IFACE_ETH1).style.display = "none";
|
||||||
|
document.getElementById(IFACE_ETH2).style.display = "none";
|
||||||
document.getElementById(ID_ETH0_TITLE).innerHTML = "Ethernet";
|
document.getElementById(ID_ETH0_TITLE).innerHTML = "Ethernet";
|
||||||
|
} else if (numEthernetIfaces == 2) {
|
||||||
|
document.getElementById(IFACE_ETH2).style.display = "none";
|
||||||
}
|
}
|
||||||
if (numWifiIfaces == 0)
|
if (numWifiIfaces == 0)
|
||||||
document.getElementById(IFACE_WIFI).style.display = "none";
|
document.getElementById(IFACE_WIFI).style.display = "none";
|
||||||
|
|
@ -203,6 +206,7 @@ function fillNetworkInfo(response, parseElement) {
|
||||||
function updateAllControls() {
|
function updateAllControls() {
|
||||||
updateInterfaceControls(IFACE_ETH0);
|
updateInterfaceControls(IFACE_ETH0);
|
||||||
updateInterfaceControls(IFACE_ETH1);
|
updateInterfaceControls(IFACE_ETH1);
|
||||||
|
updateInterfaceControls(IFACE_ETH2);
|
||||||
updateInterfaceControls(IFACE_WIFI);
|
updateInterfaceControls(IFACE_WIFI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -456,4 +460,4 @@ function togglePanelVisibility(interface) {
|
||||||
panelButton.classList.add(CLASS_ARROW_UP);
|
panelButton.classList.add(CLASS_ARROW_UP);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue