{% /* * Part of AREDN® -- Used for creating Amateur Radio Emergency Data Networks * Copyright (C) 2024 Tim Wilkinson * See Contributors file for additional contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation version 3 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Additional Terms: * * Additional use restrictions exist on the AREDN® trademark and logo. * See AREDNLicense.txt for more info. * * Attributions to the AREDN® Project must be retained in the source code. * If importing this code into a new or existing project attribution * to the AREDN® project must be added to the source code. * * You must not misrepresent the origin of the material contained within. * * Modified versions must be modified to attribute to the original source * and be marked in reasonable ways as differentiate it from the original * version */ %} {% const radio = radios.getActiveConfiguration(); let midx = -1; let lidx = -1; let widx = -1; for (let i = 0; i < length(radio); i++) { switch (radio[i].mode) { case radios.RADIO_MESH: midx = i; break; case radios.RADIO_LAN: lidx = i; break; case radios.RADIO_WAN: widx = i; break; } } %}
Radio
{{hardware.getRadio().name}}
model
{% if (midx !== -1) { const r = radio[midx].modes[radios.RADIO_MESH]; %}
Mesh
{{r.channel}}
channel
{{hardware.getChannelFrequencyRange(radio[midx].iface, r.channel, r.bandwidth)}}
frequencies
{{r.bandwidth}} MHz
bandwidth
{{r.txpower + radio[midx].txpoweroffset}} dBm
tx power
{{int(0.5 + units.meters2distance(uci.get("aredn", "@lqm[0]", "max_distance")))}} {{units.distanceUnit()}}
maximum distance
{{uci.get("aredn", "@lqm[0]", "min_snr")}}
minimum snr
{% } if (lidx !== -1) { const r = radio[lidx].modes[radios.RADIO_LAN]; %}
LAN Hotspot
{{r.channel}}
channel
{{r.ssid}}
ssid
{% } if (widx !== -1) { const r = radio[widx].modes[radios.RADIO_WAN]; let wconnected = false; let winternet = false; let f = fs.popen(`/usr/sbin/iw dev wlan${widx} link 2> /dev/null`); if (f) { const mssid = `SSID: ${r.ssid}`; for (let l = f.read("line"); length(l); l = f.read("line")) { if (index(l, mssid) !== -1) { wconnected = true; } } f.close(); } if (wconnected) { if (system(`/bin/ping -I wlan${widx} -W 1 -c 1 1.1.1.1 > /dev/null 2>&1`, 250) === 0) { winternet = true; } } %}
WAN Client
{% if (wconnected && winternet) { %}
internet
{% } else if (wconnected) { %}
no internet
{% } else { %}
no connection
{% } %}
status
{{r.ssid}}
ssid
{% } %} {% if (midx !== -1) { %}
Antenna
{% const antenna = hardware.getAntennaInfo(radio[midx].iface, uci.get("aredn", "@location[0]", "antenna")); const antennaAux = hardware.getAntennaAuxInfo(radio[midx].iface, uci.get("aredn", "@location[0]", "antenna_aux")); %}
{{(antenna || { description: "-"}).description}}
antenna
{% if (antennaAux) { %}
{{(antennaAux || { description: "-"}).description}}
aux antenna
{% } %}
{% if (uci.get("aredn", "@location[0]", "azimuth")) { %}
{{uci.get("aredn", "@location[0]", "azimuth")}}°
{% } else { %}
-
{% } %}
azimuth
{% if (uci.get("aredn", "@location[0]", "height")) { %}
{{uci.get("aredn", "@location[0]", "height")}}m
{% } else { %}
-
{% } %}
height
{% if (uci.get("aredn", "@location[0]", "elevation")) { %}
{{uci.get("aredn", "@location[0]", "elevation")}}°
{% } else { %}
-
{% } %}
elevation
{% } %}