Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65ccd1a025 | ||
|
|
fb1c733699 | ||
|
|
404cc5fb6c | ||
|
|
1fa6f2251c | ||
|
|
db328336f1 | ||
|
|
455a4794e3 | ||
|
|
33a020f15c | ||
|
|
907d439c7d | ||
|
|
debc6650d4 | ||
|
|
969098c491
|
@@ -1 +1,7 @@
|
|||||||
node_modules
|
node_modules
|
||||||
|
.idea
|
||||||
|
dist
|
||||||
|
/packaging/arch/src
|
||||||
|
/packaging/arch/pkg
|
||||||
|
/packaging/arch/RotRouter
|
||||||
|
/packaging/arch/*.pkg.tar.*
|
||||||
|
|||||||
+20
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"rotators": {
|
||||||
"rot14": {
|
"rot14": {
|
||||||
"ip": "192.168.33.82",
|
"ip": "192.168.33.82",
|
||||||
"bands": [
|
"bands": [
|
||||||
@@ -17,4 +18,23 @@
|
|||||||
21, 144
|
21, 144
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"stations": {
|
||||||
|
"DELL1": {
|
||||||
|
"ip": "192.168.0.21",
|
||||||
|
"color": "#00ff00"
|
||||||
|
},
|
||||||
|
"FUJI2": {
|
||||||
|
"ip": "192.168.0.22",
|
||||||
|
"color": "#ff0000"
|
||||||
|
},
|
||||||
|
"FUJI3": {
|
||||||
|
"ip": "192.168.0.23",
|
||||||
|
"color": "#FFFF00"
|
||||||
|
},
|
||||||
|
"DELL4": {
|
||||||
|
"ip": "192.168.0.24",
|
||||||
|
"color": "#ffffff"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
## Radio Info
|
||||||
|
```xml
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RadioInfo>
|
||||||
|
<app>N1MM</app>
|
||||||
|
<StationName>CW-80m</StationName>
|
||||||
|
<RadioNr>1</RadioNr>
|
||||||
|
<Freq>352211</Freq>
|
||||||
|
<TXFreq>352211</TXFreq>
|
||||||
|
<Mode>CW</Mode>
|
||||||
|
<mycall>W1ABC</mycall>
|
||||||
|
<OpCall>W1ABC</OpCall>
|
||||||
|
<IsRunning>False</IsRunning>
|
||||||
|
<FocusEntry>204626</FocusEntry>
|
||||||
|
<EntryWindowHwnd>275678</EntryWindowHwnd>
|
||||||
|
<Antenna>8</Antenna>
|
||||||
|
<Rotors></Rotors>
|
||||||
|
<FocusRadioNr>1</FocusRadioNr>
|
||||||
|
<IsStereo>False</IsStereo>
|
||||||
|
<IsSplit>False</IsSplit>
|
||||||
|
<ActiveRadioNr>1</ActiveRadioNr>
|
||||||
|
<IsTransmitting>False</IsTransmitting>
|
||||||
|
<FunctionKeyCaption></FunctionKeyCaption>
|
||||||
|
<RadioName></RadioName>
|
||||||
|
<AuxAntSelected>-1</AuxAntSelected>
|
||||||
|
<AuxAntSelectedName></AuxAntSelectedName>
|
||||||
|
<IsConnected></IsConnected>
|
||||||
|
</RadioInfo>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Radio Info Notes
|
||||||
|
- **app** is a short name of the logger program sending the packet. Examples: “N1MM”, “DXLab”, “Logger32”, “UcxLog”, “Log4OM”
|
||||||
|
- **StationName** is the NetBios name of the computer that is sending these messages. It is the name used in Multi-Computer networking. Windows limits it to 15 characters. If the computer name is greater than 15 characters long, the first 15 characters will be used.
|
||||||
|
- **RadioNr** is the radio number associated with a specific XML packet – in other words, the source of the information in that packet. When in SO2V or SO2R mode, N1MM+ sends two packets every ten seconds – one packet each from RadioNr1 and RadioNr2
|
||||||
|
- **Freq** is the receive frequency represented as values to the tens digit with no delimiter. For example: 160 meters: 181234; 40 meters: 712345; 10 meters: 2812345; 6 meters: 5012345
|
||||||
|
- **TXFreq** is the transmit frequency represented as values to the tens digit with no delimiter. For example: 160 meters: 181234; 40 meters: 712345; 10 meters: 2812345; 6 meters: 5012345
|
||||||
|
- **Mode** is the logging mode and could be any one of the following: CW, USB, LSB, RTTY, PSK31, PSK63, PSK125, PSK250, QPSK31, QPSK63, QPSK125, QPSK250, FSK, GMSK, DOMINO, HELL, FMHELL, HELL80, MT63, THOR, THRB, THRBX, OLIVIA, MFSK8, MFSK16
|
||||||
|
- **mycall** is the station callsign
|
||||||
|
- **OpCall** is the callsign entered by the operator after OPON (or Ctl-O). Defaults to the station call
|
||||||
|
- **IsRunning** represents the value of the RUN versus S&P radio buttons in the Entry Window. If you are on your CQ frequency, IsRunning will normally be True
|
||||||
|
- **FocusEntry** is the Windows assigned handle of the Entry Window with program focus
|
||||||
|
- **EntryWindowHwnd** allows external software to send commands to a specific EntryWindow (i.e. using AHK to send F1 to EW2 etc.)
|
||||||
|
- **Antenna** is the currently selected antenna for this radio (0-63), from the Antenna tab in the Configurer
|
||||||
|
- **Rotors** is the name of the currently selected rotor from the Antenna table in the Configurer
|
||||||
|
- **FocusRadioNr** Receive Radio Focus or keyboard focus – the Green Dot in the Entry Window. Enables signal switching for SO2R operation, facilitating the routing of Microphone, Audio, PTT, CW signals to/from the selected radio. FocusRadioNr toggles between 1 and 2 when the program, a mouse click, or the \ key selects the opposite Entry Window
|
||||||
|
- **IsStereo** enables audio switching for SO2R operation.The ` key (backquote) toggles its value between True and False
|
||||||
|
- **ActiveRadioNr** Transmit Radio Focus – the Red Dot in the Entry Window. Enables signal switching for SO2R operation, facilitating the routing of Microphone, Audio, PTT, CW signals to/from the selected radio. ActiveRadioNr toggles between 1 and 2 when the program or pressing the [Pause] key selects the opposite Entry Window
|
||||||
|
- **IsSplit** Transceiver is in Split VFO mode (for example: vfoA=Rx, vfoB=Tx). Not available on all – especially older – rigs
|
||||||
|
- **IsTransmitting** The program (as distinct from the radio) is in transmit (True) or receive (False) mode. See IsTransmitting warning, below
|
||||||
|
- **FunctionKeyCaption** The label of the Function Key that was pressed to initiate this transmission
|
||||||
|
- **RadioName** The name of the radio, as shown in the Entry Window (i.e. “TS-590”)
|
||||||
|
- **AuxAntSelected** is normally “-1”, until the user presses an Entry Window function key containing the {auxantsel} macro. A UDP packet containing the selected antenna number is sent once per keypress, after which `<AuxAntSelected>` reverts to “-1”
|
||||||
|
- **AuxAntSelectedName** is normally blank, until the user presses an Entry Window function key containing the {auxantsel} macro. A UDP packet containing the selected antenna name is sent once per keypress, after which `<AuxAntSelectedName>` reverts to a blank field
|
||||||
|
- **IsConnected** indicates whether a radio is connected. It may take some time for a disconnection (False) to be registered
|
||||||
|
|
||||||
|
The program sends Radio Info packets at 10 second intervals, or immediately after an event where any of the information in one of these fields changes (for example: user changes bands, spins the VFO dial, switches from Run to S&P, or selects vfoB).
|
||||||
|
|
||||||
|
## Transmitting with `<IsTransmitting>` = False
|
||||||
|
The IsTransmitting tag in RadioInfo only displays as True when N1MM+ has initiated a transmission. When a transmission is initiated external to N1MM+ – for example, a microphone PTT button or CW paddle key – IsTransmitting will still be displayed as False. Be careful when using IsTransmitting to control external devices that need to know when the radio is in Tx or Rx.
|
||||||
|
|
||||||
|
## RadioInfo broadcasts in SO2V
|
||||||
|
Using RadioInfo broadcasts when the Logger is in SO2V mode may require special consideration. In SO2V, packets in which RadioNr and ActiveRadioNr are different from each other should not be relied upon for information about the transmit frequency.
|
||||||
|
|
||||||
|
Explanation: N1MM+ treats the two VFOs in SO2V similarly to the way it treats the two radios in SO2R. Broadcasts with RadioNr = 1 relate to VFO A (the main receiver in most dual-receiver radios), and broadcasts with RadioNr = 2 relate to VFO B (the subreceiver in radios so equipped). In each of these broadcasts, the exported value of TxFreq is normally the same as the receive frequency (Freq), regardless of which VFO is active (as if RadioNr 1 and RadioNr 2 were two separate radios). The exception is the special case when the program is in Split mode. In this case (and only in this case) TxFreq will indicate the frequency in the other VFO to reflect the Split mode status.
|
||||||
|
|
||||||
|
What this means is that programs receiving RadioInfo broadcast packets and requiring knowledge of the transmit frequency or band (such as programs controlling amplifiers or antenna switches) must take the ActiveRadioNr into account. In SO2V mode, the TxFreq reported in packets in which RadioNr is not the same as ActiveRadioNr will generally not be the actual transmit frequency. This is not likely to be a major problem when the two VFOs are on the same band, but if the two VFOs are on different bands, the TxFreq reported in these inactive radio packets will be misleading. To determine the correct transmit frequency, when N1MM+ is in SO2V such programs should only use TxFreq from packets in which RadioNr and ActiveRadioNr have the same value.
|
||||||
Generated
+108
-107
@@ -16,14 +16,15 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^25.5.0",
|
"@types/node": "^25.5.0",
|
||||||
|
"esbuild": "^0.27.7",
|
||||||
"tsx": "^4.21.0",
|
"tsx": "^4.21.0",
|
||||||
"typescript": "^5.9.3"
|
"typescript": "^5.9.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/aix-ppc64": {
|
"node_modules/@esbuild/aix-ppc64": {
|
||||||
"version": "0.27.4",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.4.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.7.tgz",
|
||||||
"integrity": "sha512-cQPwL2mp2nSmHHJlCyoXgHGhbEPMrEEU5xhkcy3Hs/O7nGZqEpZ2sUtLaL9MORLtDfRvVl2/3PAuEkYZH0Ty8Q==",
|
"integrity": "sha512-EKX3Qwmhz1eMdEJokhALr0YiD0lhQNwDqkPYyPhiSwKrh7/4KRjQc04sZ8db+5DVVnZ1LmbNDI1uAMPEUBnQPg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"ppc64"
|
"ppc64"
|
||||||
],
|
],
|
||||||
@@ -38,9 +39,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/android-arm": {
|
"node_modules/@esbuild/android-arm": {
|
||||||
"version": "0.27.4",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.4.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.7.tgz",
|
||||||
"integrity": "sha512-X9bUgvxiC8CHAGKYufLIHGXPJWnr0OCdR0anD2e21vdvgCI8lIfqFbnoeOz7lBjdrAGUhqLZLcQo6MLhTO2DKQ==",
|
"integrity": "sha512-jbPXvB4Yj2yBV7HUfE2KHe4GJX51QplCN1pGbYjvsyCZbQmies29EoJbkEc+vYuU5o45AfQn37vZlyXy4YJ8RQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm"
|
"arm"
|
||||||
],
|
],
|
||||||
@@ -55,9 +56,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/android-arm64": {
|
"node_modules/@esbuild/android-arm64": {
|
||||||
"version": "0.27.4",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.4.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.7.tgz",
|
||||||
"integrity": "sha512-gdLscB7v75wRfu7QSm/zg6Rx29VLdy9eTr2t44sfTW7CxwAtQghZ4ZnqHk3/ogz7xao0QAgrkradbBzcqFPasw==",
|
"integrity": "sha512-62dPZHpIXzvChfvfLJow3q5dDtiNMkwiRzPylSCfriLvZeq0a1bWChrGx/BbUbPwOrsWKMn8idSllklzBy+dgQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -72,9 +73,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/android-x64": {
|
"node_modules/@esbuild/android-x64": {
|
||||||
"version": "0.27.4",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.4.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.7.tgz",
|
||||||
"integrity": "sha512-PzPFnBNVF292sfpfhiyiXCGSn9HZg5BcAz+ivBuSsl6Rk4ga1oEXAamhOXRFyMcjwr2DVtm40G65N3GLeH1Lvw==",
|
"integrity": "sha512-x5VpMODneVDb70PYV2VQOmIUUiBtY3D3mPBG8NxVk5CogneYhkR7MmM3yR/uMdITLrC1ml/NV1rj4bMJuy9MCg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -89,9 +90,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/darwin-arm64": {
|
"node_modules/@esbuild/darwin-arm64": {
|
||||||
"version": "0.27.4",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.4.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.7.tgz",
|
||||||
"integrity": "sha512-b7xaGIwdJlht8ZFCvMkpDN6uiSmnxxK56N2GDTMYPr2/gzvfdQN8rTfBsvVKmIVY/X7EM+/hJKEIbbHs9oA4tQ==",
|
"integrity": "sha512-5lckdqeuBPlKUwvoCXIgI2D9/ABmPq3Rdp7IfL70393YgaASt7tbju3Ac+ePVi3KDH6N2RqePfHnXkaDtY9fkw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -106,9 +107,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/darwin-x64": {
|
"node_modules/@esbuild/darwin-x64": {
|
||||||
"version": "0.27.4",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.4.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.7.tgz",
|
||||||
"integrity": "sha512-sR+OiKLwd15nmCdqpXMnuJ9W2kpy0KigzqScqHI3Hqwr7IXxBp3Yva+yJwoqh7rE8V77tdoheRYataNKL4QrPw==",
|
"integrity": "sha512-rYnXrKcXuT7Z+WL5K980jVFdvVKhCHhUwid+dDYQpH+qu+TefcomiMAJpIiC2EM3Rjtq0sO3StMV/+3w3MyyqQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -123,9 +124,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/freebsd-arm64": {
|
"node_modules/@esbuild/freebsd-arm64": {
|
||||||
"version": "0.27.4",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.4.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.7.tgz",
|
||||||
"integrity": "sha512-jnfpKe+p79tCnm4GVav68A7tUFeKQwQyLgESwEAUzyxk/TJr4QdGog9sqWNcUbr/bZt/O/HXouspuQDd9JxFSw==",
|
"integrity": "sha512-B48PqeCsEgOtzME2GbNM2roU29AMTuOIN91dsMO30t+Ydis3z/3Ngoj5hhnsOSSwNzS+6JppqWsuhTp6E82l2w==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -140,9 +141,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/freebsd-x64": {
|
"node_modules/@esbuild/freebsd-x64": {
|
||||||
"version": "0.27.4",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.4.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.7.tgz",
|
||||||
"integrity": "sha512-2kb4ceA/CpfUrIcTUl1wrP/9ad9Atrp5J94Lq69w7UwOMolPIGrfLSvAKJp0RTvkPPyn6CIWrNy13kyLikZRZQ==",
|
"integrity": "sha512-jOBDK5XEjA4m5IJK3bpAQF9/Lelu/Z9ZcdhTRLf4cajlB+8VEhFFRjWgfy3M1O4rO2GQ/b2dLwCUGpiF/eATNQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -157,9 +158,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/linux-arm": {
|
"node_modules/@esbuild/linux-arm": {
|
||||||
"version": "0.27.4",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.4.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.7.tgz",
|
||||||
"integrity": "sha512-aBYgcIxX/wd5n2ys0yESGeYMGF+pv6g0DhZr3G1ZG4jMfruU9Tl1i2Z+Wnj9/KjGz1lTLCcorqE2viePZqj4Eg==",
|
"integrity": "sha512-RkT/YXYBTSULo3+af8Ib0ykH8u2MBh57o7q/DAs3lTJlyVQkgQvlrPTnjIzzRPQyavxtPtfg0EopvDyIt0j1rA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm"
|
"arm"
|
||||||
],
|
],
|
||||||
@@ -174,9 +175,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/linux-arm64": {
|
"node_modules/@esbuild/linux-arm64": {
|
||||||
"version": "0.27.4",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.4.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.7.tgz",
|
||||||
"integrity": "sha512-7nQOttdzVGth1iz57kxg9uCz57dxQLHWxopL6mYuYthohPKEK0vU0C3O21CcBK6KDlkYVcnDXY099HcCDXd9dA==",
|
"integrity": "sha512-RZPHBoxXuNnPQO9rvjh5jdkRmVizktkT7TCDkDmQ0W2SwHInKCAV95GRuvdSvA7w4VMwfCjUiPwDi0ZO6Nfe9A==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -191,9 +192,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/linux-ia32": {
|
"node_modules/@esbuild/linux-ia32": {
|
||||||
"version": "0.27.4",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.4.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.7.tgz",
|
||||||
"integrity": "sha512-oPtixtAIzgvzYcKBQM/qZ3R+9TEUd1aNJQu0HhGyqtx6oS7qTpvjheIWBbes4+qu1bNlo2V4cbkISr8q6gRBFA==",
|
"integrity": "sha512-GA48aKNkyQDbd3KtkplYWT102C5sn/EZTY4XROkxONgruHPU72l+gW+FfF8tf2cFjeHaRbWpOYa/uRBz/Xq1Pg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"ia32"
|
"ia32"
|
||||||
],
|
],
|
||||||
@@ -208,9 +209,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/linux-loong64": {
|
"node_modules/@esbuild/linux-loong64": {
|
||||||
"version": "0.27.4",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.4.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.7.tgz",
|
||||||
"integrity": "sha512-8mL/vh8qeCoRcFH2nM8wm5uJP+ZcVYGGayMavi8GmRJjuI3g1v6Z7Ni0JJKAJW+m0EtUuARb6Lmp4hMjzCBWzA==",
|
"integrity": "sha512-a4POruNM2oWsD4WKvBSEKGIiWQF8fZOAsycHOt6JBpZ+JN2n2JH9WAv56SOyu9X5IqAjqSIPTaJkqN8F7XOQ5Q==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"loong64"
|
"loong64"
|
||||||
],
|
],
|
||||||
@@ -225,9 +226,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/linux-mips64el": {
|
"node_modules/@esbuild/linux-mips64el": {
|
||||||
"version": "0.27.4",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.4.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.7.tgz",
|
||||||
"integrity": "sha512-1RdrWFFiiLIW7LQq9Q2NES+HiD4NyT8Itj9AUeCl0IVCA459WnPhREKgwrpaIfTOe+/2rdntisegiPWn/r/aAw==",
|
"integrity": "sha512-KabT5I6StirGfIz0FMgl1I+R1H73Gp0ofL9A3nG3i/cYFJzKHhouBV5VWK1CSgKvVaG4q1RNpCTR2LuTVB3fIw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"mips64el"
|
"mips64el"
|
||||||
],
|
],
|
||||||
@@ -242,9 +243,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/linux-ppc64": {
|
"node_modules/@esbuild/linux-ppc64": {
|
||||||
"version": "0.27.4",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.4.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.7.tgz",
|
||||||
"integrity": "sha512-tLCwNG47l3sd9lpfyx9LAGEGItCUeRCWeAx6x2Jmbav65nAwoPXfewtAdtbtit/pJFLUWOhpv0FpS6GQAmPrHA==",
|
"integrity": "sha512-gRsL4x6wsGHGRqhtI+ifpN/vpOFTQtnbsupUF5R5YTAg+y/lKelYR1hXbnBdzDjGbMYjVJLJTd2OFmMewAgwlQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"ppc64"
|
"ppc64"
|
||||||
],
|
],
|
||||||
@@ -259,9 +260,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/linux-riscv64": {
|
"node_modules/@esbuild/linux-riscv64": {
|
||||||
"version": "0.27.4",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.4.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.7.tgz",
|
||||||
"integrity": "sha512-BnASypppbUWyqjd1KIpU4AUBiIhVr6YlHx/cnPgqEkNoVOhHg+YiSVxM1RLfiy4t9cAulbRGTNCKOcqHrEQLIw==",
|
"integrity": "sha512-hL25LbxO1QOngGzu2U5xeXtxXcW+/GvMN3ejANqXkxZ/opySAZMrc+9LY/WyjAan41unrR3YrmtTsUpwT66InQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"riscv64"
|
"riscv64"
|
||||||
],
|
],
|
||||||
@@ -276,9 +277,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/linux-s390x": {
|
"node_modules/@esbuild/linux-s390x": {
|
||||||
"version": "0.27.4",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.4.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.7.tgz",
|
||||||
"integrity": "sha512-+eUqgb/Z7vxVLezG8bVB9SfBie89gMueS+I0xYh2tJdw3vqA/0ImZJ2ROeWwVJN59ihBeZ7Tu92dF/5dy5FttA==",
|
"integrity": "sha512-2k8go8Ycu1Kb46vEelhu1vqEP+UeRVj2zY1pSuPdgvbd5ykAw82Lrro28vXUrRmzEsUV0NzCf54yARIK8r0fdw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"s390x"
|
"s390x"
|
||||||
],
|
],
|
||||||
@@ -293,9 +294,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/linux-x64": {
|
"node_modules/@esbuild/linux-x64": {
|
||||||
"version": "0.27.4",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.4.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.7.tgz",
|
||||||
"integrity": "sha512-S5qOXrKV8BQEzJPVxAwnryi2+Iq5pB40gTEIT69BQONqR7JH1EPIcQ/Uiv9mCnn05jff9umq/5nqzxlqTOg9NA==",
|
"integrity": "sha512-hzznmADPt+OmsYzw1EE33ccA+HPdIqiCRq7cQeL1Jlq2gb1+OyWBkMCrYGBJ+sxVzve2ZJEVeePbLM2iEIZSxA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -310,9 +311,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/netbsd-arm64": {
|
"node_modules/@esbuild/netbsd-arm64": {
|
||||||
"version": "0.27.4",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.4.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.7.tgz",
|
||||||
"integrity": "sha512-xHT8X4sb0GS8qTqiwzHqpY00C95DPAq7nAwX35Ie/s+LO9830hrMd3oX0ZMKLvy7vsonee73x0lmcdOVXFzd6Q==",
|
"integrity": "sha512-b6pqtrQdigZBwZxAn1UpazEisvwaIDvdbMbmrly7cDTMFnw/+3lVxxCTGOrkPVnsYIosJJXAsILG9XcQS+Yu6w==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -327,9 +328,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/netbsd-x64": {
|
"node_modules/@esbuild/netbsd-x64": {
|
||||||
"version": "0.27.4",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.4.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.7.tgz",
|
||||||
"integrity": "sha512-RugOvOdXfdyi5Tyv40kgQnI0byv66BFgAqjdgtAKqHoZTbTF2QqfQrFwa7cHEORJf6X2ht+l9ABLMP0dnKYsgg==",
|
"integrity": "sha512-OfatkLojr6U+WN5EDYuoQhtM+1xco+/6FSzJJnuWiUw5eVcicbyK3dq5EeV/QHT1uy6GoDhGbFpprUiHUYggrw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -344,9 +345,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/openbsd-arm64": {
|
"node_modules/@esbuild/openbsd-arm64": {
|
||||||
"version": "0.27.4",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.4.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.7.tgz",
|
||||||
"integrity": "sha512-2MyL3IAaTX+1/qP0O1SwskwcwCoOI4kV2IBX1xYnDDqthmq5ArrW94qSIKCAuRraMgPOmG0RDTA74mzYNQA9ow==",
|
"integrity": "sha512-AFuojMQTxAz75Fo8idVcqoQWEHIXFRbOc1TrVcFSgCZtQfSdc1RXgB3tjOn/krRHENUB4j00bfGjyl2mJrU37A==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -361,9 +362,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/openbsd-x64": {
|
"node_modules/@esbuild/openbsd-x64": {
|
||||||
"version": "0.27.4",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.4.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.7.tgz",
|
||||||
"integrity": "sha512-u8fg/jQ5aQDfsnIV6+KwLOf1CmJnfu1ShpwqdwC0uA7ZPwFws55Ngc12vBdeUdnuWoQYx/SOQLGDcdlfXhYmXQ==",
|
"integrity": "sha512-+A1NJmfM8WNDv5CLVQYJ5PshuRm/4cI6WMZRg1by1GwPIQPCTs1GLEUHwiiQGT5zDdyLiRM/l1G0Pv54gvtKIg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -378,9 +379,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/openharmony-arm64": {
|
"node_modules/@esbuild/openharmony-arm64": {
|
||||||
"version": "0.27.4",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.4.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.7.tgz",
|
||||||
"integrity": "sha512-JkTZrl6VbyO8lDQO3yv26nNr2RM2yZzNrNHEsj9bm6dOwwu9OYN28CjzZkH57bh4w0I2F7IodpQvUAEd1mbWXg==",
|
"integrity": "sha512-+KrvYb/C8zA9CU/g0sR6w2RBw7IGc5J2BPnc3dYc5VJxHCSF1yNMxTV5LQ7GuKteQXZtspjFbiuW5/dOj7H4Yw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -395,9 +396,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/sunos-x64": {
|
"node_modules/@esbuild/sunos-x64": {
|
||||||
"version": "0.27.4",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.4.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.7.tgz",
|
||||||
"integrity": "sha512-/gOzgaewZJfeJTlsWhvUEmUG4tWEY2Spp5M20INYRg2ZKl9QPO3QEEgPeRtLjEWSW8FilRNacPOg8R1uaYkA6g==",
|
"integrity": "sha512-ikktIhFBzQNt/QDyOL580ti9+5mL/YZeUPKU2ivGtGjdTYoqz6jObj6nOMfhASpS4GU4Q/Clh1QtxWAvcYKamA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -412,9 +413,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/win32-arm64": {
|
"node_modules/@esbuild/win32-arm64": {
|
||||||
"version": "0.27.4",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.4.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.7.tgz",
|
||||||
"integrity": "sha512-Z9SExBg2y32smoDQdf1HRwHRt6vAHLXcxD2uGgO/v2jK7Y718Ix4ndsbNMU/+1Qiem9OiOdaqitioZwxivhXYg==",
|
"integrity": "sha512-7yRhbHvPqSpRUV7Q20VuDwbjW5kIMwTHpptuUzV+AA46kiPze5Z7qgt6CLCK3pWFrHeNfDd1VKgyP4O+ng17CA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -429,9 +430,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/win32-ia32": {
|
"node_modules/@esbuild/win32-ia32": {
|
||||||
"version": "0.27.4",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.4.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.7.tgz",
|
||||||
"integrity": "sha512-DAyGLS0Jz5G5iixEbMHi5KdiApqHBWMGzTtMiJ72ZOLhbu/bzxgAe8Ue8CTS3n3HbIUHQz/L51yMdGMeoxXNJw==",
|
"integrity": "sha512-SmwKXe6VHIyZYbBLJrhOoCJRB/Z1tckzmgTLfFYOfpMAx63BJEaL9ExI8x7v0oAO3Zh6D/Oi1gVxEYr5oUCFhw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"ia32"
|
"ia32"
|
||||||
],
|
],
|
||||||
@@ -446,9 +447,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/win32-x64": {
|
"node_modules/@esbuild/win32-x64": {
|
||||||
"version": "0.27.4",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.4.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.7.tgz",
|
||||||
"integrity": "sha512-+knoa0BDoeXgkNvvV1vvbZX4+hizelrkwmGJBdT17t8FNPwG2lKemmuMZlmaNQ3ws3DKKCxpb4zRZEIp3UxFCg==",
|
"integrity": "sha512-56hiAJPhwQ1R4i+21FVF7V8kSD5zZTdHcVuRFMW0hn753vVfQN8xlx4uOPT4xoGH0Z/oVATuR82AiqSTDIpaHg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -501,9 +502,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/esbuild": {
|
"node_modules/esbuild": {
|
||||||
"version": "0.27.4",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.4.tgz",
|
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.7.tgz",
|
||||||
"integrity": "sha512-Rq4vbHnYkK5fws5NF7MYTU68FPRE1ajX7heQ/8QXXWqNgqqJ/GkmmyxIzUnf2Sr/bakf8l54716CcMGHYhMrrQ==",
|
"integrity": "sha512-IxpibTjyVnmrIQo5aqNpCgoACA/dTKLTlhMHihVHhdkxKyPO1uBBthumT0rdHmcsk9uMonIWS0m4FljWzILh3w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@@ -514,32 +515,32 @@
|
|||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@esbuild/aix-ppc64": "0.27.4",
|
"@esbuild/aix-ppc64": "0.27.7",
|
||||||
"@esbuild/android-arm": "0.27.4",
|
"@esbuild/android-arm": "0.27.7",
|
||||||
"@esbuild/android-arm64": "0.27.4",
|
"@esbuild/android-arm64": "0.27.7",
|
||||||
"@esbuild/android-x64": "0.27.4",
|
"@esbuild/android-x64": "0.27.7",
|
||||||
"@esbuild/darwin-arm64": "0.27.4",
|
"@esbuild/darwin-arm64": "0.27.7",
|
||||||
"@esbuild/darwin-x64": "0.27.4",
|
"@esbuild/darwin-x64": "0.27.7",
|
||||||
"@esbuild/freebsd-arm64": "0.27.4",
|
"@esbuild/freebsd-arm64": "0.27.7",
|
||||||
"@esbuild/freebsd-x64": "0.27.4",
|
"@esbuild/freebsd-x64": "0.27.7",
|
||||||
"@esbuild/linux-arm": "0.27.4",
|
"@esbuild/linux-arm": "0.27.7",
|
||||||
"@esbuild/linux-arm64": "0.27.4",
|
"@esbuild/linux-arm64": "0.27.7",
|
||||||
"@esbuild/linux-ia32": "0.27.4",
|
"@esbuild/linux-ia32": "0.27.7",
|
||||||
"@esbuild/linux-loong64": "0.27.4",
|
"@esbuild/linux-loong64": "0.27.7",
|
||||||
"@esbuild/linux-mips64el": "0.27.4",
|
"@esbuild/linux-mips64el": "0.27.7",
|
||||||
"@esbuild/linux-ppc64": "0.27.4",
|
"@esbuild/linux-ppc64": "0.27.7",
|
||||||
"@esbuild/linux-riscv64": "0.27.4",
|
"@esbuild/linux-riscv64": "0.27.7",
|
||||||
"@esbuild/linux-s390x": "0.27.4",
|
"@esbuild/linux-s390x": "0.27.7",
|
||||||
"@esbuild/linux-x64": "0.27.4",
|
"@esbuild/linux-x64": "0.27.7",
|
||||||
"@esbuild/netbsd-arm64": "0.27.4",
|
"@esbuild/netbsd-arm64": "0.27.7",
|
||||||
"@esbuild/netbsd-x64": "0.27.4",
|
"@esbuild/netbsd-x64": "0.27.7",
|
||||||
"@esbuild/openbsd-arm64": "0.27.4",
|
"@esbuild/openbsd-arm64": "0.27.7",
|
||||||
"@esbuild/openbsd-x64": "0.27.4",
|
"@esbuild/openbsd-x64": "0.27.7",
|
||||||
"@esbuild/openharmony-arm64": "0.27.4",
|
"@esbuild/openharmony-arm64": "0.27.7",
|
||||||
"@esbuild/sunos-x64": "0.27.4",
|
"@esbuild/sunos-x64": "0.27.7",
|
||||||
"@esbuild/win32-arm64": "0.27.4",
|
"@esbuild/win32-arm64": "0.27.7",
|
||||||
"@esbuild/win32-ia32": "0.27.4",
|
"@esbuild/win32-ia32": "0.27.7",
|
||||||
"@esbuild/win32-x64": "0.27.4"
|
"@esbuild/win32-x64": "0.27.7"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/fast-xml-parser": {
|
"node_modules/fast-xml-parser": {
|
||||||
|
|||||||
+3
-2
@@ -8,8 +8,8 @@
|
|||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "tsx src/index.ts",
|
"start": "tsx src/index.ts",
|
||||||
"typecheck": "tsc --noEmit",
|
"build": "esbuild src/index.ts --bundle --platform=node --target=node22 --format=cjs --outfile=dist/rotrouter.cjs --external:bufferutil --external:utf-8-validate",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"typecheck": "tsc --noEmit"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hono/node-server": "^1.19.11",
|
"@hono/node-server": "^1.19.11",
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^25.5.0",
|
"@types/node": "^25.5.0",
|
||||||
|
"esbuild": "^0.27.7",
|
||||||
"tsx": "^4.21.0",
|
"tsx": "^4.21.0",
|
||||||
"typescript": "^5.9.3"
|
"typescript": "^5.9.3"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
# Maintainer: ericek111
|
||||||
|
|
||||||
|
pkgname=rotrouter-git
|
||||||
|
_pkgname=RotRouter
|
||||||
|
pkgver=r0
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc='Routes N1MM Logger+ antenna rotator commands to the right rotator controller by band'
|
||||||
|
arch=('any')
|
||||||
|
url='https://git.lixko.eu/ericek111/RotRouter'
|
||||||
|
license=('ISC')
|
||||||
|
depends=('nodejs')
|
||||||
|
makedepends=('git' 'npm')
|
||||||
|
provides=('rotrouter')
|
||||||
|
conflicts=('rotrouter')
|
||||||
|
backup=('etc/rotrouter/config.json')
|
||||||
|
source=("$_pkgname::git+ssh://git@git.lixko.eu/ericek111/RotRouter.git")
|
||||||
|
sha256sums=('SKIP')
|
||||||
|
|
||||||
|
pkgver() {
|
||||||
|
cd "$_pkgname"
|
||||||
|
printf 'r%s.%s' "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
|
||||||
|
}
|
||||||
|
|
||||||
|
prepare() {
|
||||||
|
cd "$_pkgname"
|
||||||
|
npm ci --cache "$srcdir/npm-cache" --no-audit --no-fund
|
||||||
|
}
|
||||||
|
|
||||||
|
build() {
|
||||||
|
cd "$_pkgname"
|
||||||
|
npm run build
|
||||||
|
}
|
||||||
|
|
||||||
|
check() {
|
||||||
|
cd "$_pkgname"
|
||||||
|
npm run typecheck
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
cd "$_pkgname"
|
||||||
|
install -Dm644 dist/rotrouter.cjs "$pkgdir/usr/lib/rotrouter/rotrouter.cjs"
|
||||||
|
install -Dm644 public/index.html "$pkgdir/usr/share/rotrouter/public/index.html"
|
||||||
|
install -Dm644 config.json "$pkgdir/etc/rotrouter/config.json"
|
||||||
|
install -Dm644 packaging/arch/rotrouter.service "$pkgdir/usr/lib/systemd/system/rotrouter.service"
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=RotRouter - N1MM antenna rotator router
|
||||||
|
Wants=network-online.target
|
||||||
|
After=network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
Environment=ROTROUTER_CONFIG=/etc/rotrouter/config.json
|
||||||
|
Environment=ROTROUTER_PUBLIC=/usr/share/rotrouter/public
|
||||||
|
ExecStart=/usr/bin/node /usr/lib/rotrouter/rotrouter.cjs
|
||||||
|
Restart=on-failure
|
||||||
|
RestartSec=5
|
||||||
|
|
||||||
|
# Run as an unprivileged user that systemd allocates on start and releases on
|
||||||
|
# stop; nothing has to be created at install time. Ports 8787 (HTTP) and
|
||||||
|
# 12040 (N1MM UDP) are above 1024, so no capabilities are needed.
|
||||||
|
User=rotrouter
|
||||||
|
DynamicUser=yes
|
||||||
|
CapabilityBoundingSet=
|
||||||
|
AmbientCapabilities=
|
||||||
|
NoNewPrivileges=yes
|
||||||
|
UMask=0077
|
||||||
|
|
||||||
|
# Read-only view of the system; the service writes nothing to disk.
|
||||||
|
ProtectSystem=strict
|
||||||
|
ProtectHome=yes
|
||||||
|
PrivateTmp=yes
|
||||||
|
PrivateDevices=yes
|
||||||
|
ProtectProc=invisible
|
||||||
|
ProcSubset=pid
|
||||||
|
ProtectClock=yes
|
||||||
|
ProtectHostname=yes
|
||||||
|
ProtectKernelTunables=yes
|
||||||
|
ProtectKernelModules=yes
|
||||||
|
ProtectKernelLogs=yes
|
||||||
|
ProtectControlGroups=yes
|
||||||
|
|
||||||
|
RestrictAddressFamilies=AF_INET AF_INET6
|
||||||
|
RestrictNamespaces=yes
|
||||||
|
RestrictRealtime=yes
|
||||||
|
LockPersonality=yes
|
||||||
|
SystemCallArchitectures=native
|
||||||
|
SystemCallFilter=@system-service
|
||||||
|
SystemCallErrorNumber=EPERM
|
||||||
|
# MemoryDenyWriteExecute is deliberately not set: V8's JIT needs W+X memory.
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
+337
-61
@@ -16,6 +16,28 @@
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
.tab-bar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
background: #111;
|
||||||
|
border-bottom: 1px solid #333;
|
||||||
|
padding: 0 8px;
|
||||||
|
gap: 0;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
.tab {
|
||||||
|
padding: 10px 18px;
|
||||||
|
font-size: 15px;
|
||||||
|
color: #888;
|
||||||
|
cursor: pointer;
|
||||||
|
border-bottom: 2px solid transparent;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.tab:hover { color: #ccc; }
|
||||||
|
.tab.active {
|
||||||
|
color: #fff;
|
||||||
|
border-bottom-color: #4a9eff;
|
||||||
|
}
|
||||||
.rotators {
|
.rotators {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
@@ -24,10 +46,13 @@
|
|||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
.rotator-card {
|
.rotator-card {
|
||||||
display: flex;
|
display: none;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
.rotator-card.visible {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
canvas {
|
canvas {
|
||||||
display: block;
|
display: block;
|
||||||
cursor: crosshair;
|
cursor: crosshair;
|
||||||
@@ -71,13 +96,56 @@
|
|||||||
.turned-by .source {
|
.turned-by .source {
|
||||||
color: #e0e040;
|
color: #e0e040;
|
||||||
}
|
}
|
||||||
|
.station-bar {
|
||||||
|
display: none;
|
||||||
|
gap: 8px;
|
||||||
|
padding: 8px 12px;
|
||||||
|
background: #0a0a0a;
|
||||||
|
border-bottom: 1px solid #222;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
.station-bar.visible {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
.station-pill {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
padding: 5px 12px;
|
||||||
|
border: 2px solid #333;
|
||||||
|
border-radius: 16px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #888;
|
||||||
|
transition: border-color 0.15s;
|
||||||
|
}
|
||||||
|
.station-pill:hover { border-color: #666; }
|
||||||
|
.station-pill.selected { color: #fff; }
|
||||||
|
.station-pill .dot {
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
.station-pill .freq {
|
||||||
|
color: #666;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
.station-pill.selected .freq { color: #aaa; }
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
<div class="tab-bar" id="tab-bar"></div>
|
||||||
|
<div class="station-bar" id="station-bar"></div>
|
||||||
<div class="rotators" id="rotators"></div>
|
<div class="rotators" id="rotators"></div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
// Same default as the IP-rotator firmware: a live xplanet grayline map centred on OK.
|
||||||
|
const DEFAULT_MAP_URL = 'https://remoteqth.com/xplanet/OK.png';
|
||||||
|
const MAP_REFRESH_MS = 30 * 60 * 1000;
|
||||||
|
const MAP_RETRY_MS = 10 * 1000;
|
||||||
|
|
||||||
class RotatorState {
|
class RotatorState {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.boxSize = 400;
|
this.boxSize = 400;
|
||||||
@@ -94,6 +162,7 @@
|
|||||||
this.adc = 0;
|
this.adc = 0;
|
||||||
this.online = false;
|
this.online = false;
|
||||||
this.bands = [];
|
this.bands = [];
|
||||||
|
this.targetAngle = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,8 +177,11 @@
|
|||||||
this.bgCanvas.height = state.boxSize;
|
this.bgCanvas.height = state.boxSize;
|
||||||
this.bgCtx = this.bgCanvas.getContext('2d');
|
this.bgCtx = this.bgCanvas.getContext('2d');
|
||||||
|
|
||||||
this.mapImage = new Image();
|
this.mapImage = null;
|
||||||
this.mapImage.onload = () => this.drawBackgroundCache();
|
this.mapUrl = null;
|
||||||
|
this.mapLoadGeneration = 0;
|
||||||
|
this.mapRetryTimer = null;
|
||||||
|
setInterval(() => this.loadMap(), MAP_REFRESH_MS);
|
||||||
}
|
}
|
||||||
|
|
||||||
getPoint(angle, radius) {
|
getPoint(angle, radius) {
|
||||||
@@ -120,12 +192,34 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Sets the background map; elevation rotators get none, like in the firmware UI. */
|
||||||
updateMap(url) {
|
updateMap(url) {
|
||||||
if (url && this.mapImage.src !== new URL(url, document.baseURI).href) {
|
const nextUrl = this.state.elevation !== 0 ? null
|
||||||
this.mapImage.src = url;
|
: (url && url !== '0') ? url : DEFAULT_MAP_URL;
|
||||||
} else {
|
if (nextUrl !== this.mapUrl) {
|
||||||
|
this.mapUrl = nextUrl;
|
||||||
|
this.mapImage = null;
|
||||||
|
this.loadMap();
|
||||||
|
}
|
||||||
this.drawBackgroundCache();
|
this.drawBackgroundCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** (Re)loads the map with a cache-buster so the grayline stays current. */
|
||||||
|
loadMap() {
|
||||||
|
clearTimeout(this.mapRetryTimer);
|
||||||
|
if (!this.mapUrl) return;
|
||||||
|
const generation = ++this.mapLoadGeneration;
|
||||||
|
const img = new Image();
|
||||||
|
img.onload = () => {
|
||||||
|
if (generation !== this.mapLoadGeneration) return;
|
||||||
|
this.mapImage = img;
|
||||||
|
this.drawBackgroundCache();
|
||||||
|
};
|
||||||
|
img.onerror = () => {
|
||||||
|
if (generation !== this.mapLoadGeneration) return;
|
||||||
|
this.mapRetryTimer = setTimeout(() => this.loadMap(), MAP_RETRY_MS);
|
||||||
|
};
|
||||||
|
img.src = this.mapUrl + (this.mapUrl.includes('?') ? '&' : '?') + 't=' + Date.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
drawBackgroundCache() {
|
drawBackgroundCache() {
|
||||||
@@ -136,6 +230,11 @@
|
|||||||
|
|
||||||
ctx.clearRect(0, 0, sz, sz);
|
ctx.clearRect(0, 0, sz, sz);
|
||||||
|
|
||||||
|
// The map's globe has the same 0.9 radius as the scale, so it is drawn at full size.
|
||||||
|
if (this.mapImage) {
|
||||||
|
ctx.drawImage(this.mapImage, 0, 0, sz, sz);
|
||||||
|
}
|
||||||
|
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.lineWidth = 1;
|
ctx.lineWidth = 1;
|
||||||
ctx.strokeStyle = '#606060';
|
ctx.strokeStyle = '#606060';
|
||||||
@@ -148,10 +247,6 @@
|
|||||||
}
|
}
|
||||||
ctx.stroke();
|
ctx.stroke();
|
||||||
|
|
||||||
if (this.mapImage.complete && this.mapImage.naturalHeight !== 0) {
|
|
||||||
ctx.drawImage(this.mapImage, 0, 0, sz, sz);
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx.lineWidth = 8;
|
ctx.lineWidth = 8;
|
||||||
ctx.strokeStyle = 'orange';
|
ctx.strokeStyle = 'orange';
|
||||||
if (this.state.azRange > 360) {
|
if (this.state.azRange > 360) {
|
||||||
@@ -351,8 +446,9 @@
|
|||||||
this.state = state;
|
this.state = state;
|
||||||
this.label = label;
|
this.label = label;
|
||||||
|
|
||||||
const card = document.createElement('div');
|
this.card = document.createElement('div');
|
||||||
card.className = 'rotator-card';
|
this.card.className = 'rotator-card';
|
||||||
|
const card = this.card;
|
||||||
|
|
||||||
this.nameEl = document.createElement('p');
|
this.nameEl = document.createElement('p');
|
||||||
this.nameEl.className = 'rotator-label';
|
this.nameEl.className = 'rotator-label';
|
||||||
@@ -410,6 +506,8 @@
|
|||||||
body: `ROT=${angle}`
|
body: `ROT=${angle}`
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.updateStatic();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateStatic() {
|
updateStatic() {
|
||||||
@@ -435,74 +533,177 @@
|
|||||||
: " | <span class=\"text-red\">•</span> Offline";
|
: " | <span class=\"text-red\">•</span> Offline";
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTurnedBy(sourceIp, targetAz) {
|
updateTurnedBy(setpoint, station) {
|
||||||
this.els.turnedBy.textContent = `${sourceIp} \u2192 ${targetAz}\u00B0`;
|
const el = this.els.turnedBy;
|
||||||
|
el.textContent = `${setpoint.station ?? setpoint.sourceIp} \u2192 ${setpoint.targetAz}\u00B0`;
|
||||||
|
el.style.color = station ? station.color : '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class RotatorApp {
|
class RotatorApp {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.rotators = {};
|
this.rotators = {};
|
||||||
|
this.labels = [];
|
||||||
|
this.stations = {};
|
||||||
|
this.stationPills = {};
|
||||||
|
this.stationRadio = {};
|
||||||
|
this.selectedStation = null;
|
||||||
|
this.autoMode = false;
|
||||||
this.container = document.getElementById('rotators');
|
this.container = document.getElementById('rotators');
|
||||||
|
this.tabBar = document.getElementById('tab-bar');
|
||||||
|
this.stationBar = document.getElementById('station-bar');
|
||||||
this.websocket = null;
|
this.websocket = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
async initialize() {
|
async initialize() {
|
||||||
const initState = await this.startWs();
|
const init = await this.startWs();
|
||||||
|
|
||||||
for (const [label, clientState] of Object.entries(initState)) {
|
this.stations = init.stations;
|
||||||
|
this.stationRadio = init.stationRadio;
|
||||||
|
const stored = loadSelectedStation();
|
||||||
|
this.selectedStation = (stored && this.stations[stored]) ? stored : init.clientStation;
|
||||||
|
|
||||||
|
for (const [label, rotState] of Object.entries(init.rotators)) {
|
||||||
const state = new RotatorState();
|
const state = new RotatorState();
|
||||||
|
state.bands = rotState.bands;
|
||||||
if (clientState.initData) {
|
|
||||||
for (const [key, value] of Object.entries(clientState.initData)) {
|
|
||||||
state[key] = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
state.bands = clientState.bands || [];
|
|
||||||
|
|
||||||
const ui = new RotatorUI(label, this.container, state);
|
const ui = new RotatorUI(label, this.container, state);
|
||||||
ui.updateStatic();
|
|
||||||
|
|
||||||
if (clientState.setpoint) {
|
|
||||||
state.targetAngle = clientState.setpoint.targetAz;
|
|
||||||
ui.updateTurnedBy(clientState.setpoint.sourceIp, clientState.setpoint.targetAz);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.rotators[label] = { state, ui };
|
this.rotators[label] = { state, ui };
|
||||||
|
this.labels.push(label);
|
||||||
|
|
||||||
|
if (rotState.initData) this.applyInitData(label, rotState.initData);
|
||||||
|
if (rotState.dynamic) this.applyDynamic(label, rotState.dynamic);
|
||||||
|
if (rotState.setpoint) this.applySetpoint(label, rotState.setpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.buildTabBar();
|
||||||
|
this.buildStationBar();
|
||||||
|
this.updateTitle();
|
||||||
|
this.applyHash();
|
||||||
|
window.addEventListener('hashchange', () => this.applyHash());
|
||||||
|
}
|
||||||
|
|
||||||
|
updateTitle() {
|
||||||
document.title = Object.values(this.rotators)
|
document.title = Object.values(this.rotators)
|
||||||
.map(r => r.state.antName || "Rotator")
|
.map(r => r.state.antName || "Rotator")
|
||||||
.join(" / ");
|
.join(" / ");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async startWs() {
|
buildTabBar() {
|
||||||
return new Promise((resolve) => {
|
this.autoTab = this.createTab('Auto', 'auto');
|
||||||
this.websocket = new WebSocket(document.location.href.replace(/\/?$/, '/') + "ws");
|
for (const label of this.labels) {
|
||||||
let resolved = false;
|
this.rotators[label].tab = this.createTab(this.rotators[label].state.antName || label, label);
|
||||||
|
}
|
||||||
this.websocket.addEventListener("message", (e) => {
|
this.allTab = this.createTab('All', 'all');
|
||||||
if (!e || !e.data) return;
|
|
||||||
|
|
||||||
const parsed = JSON.parse(e.data);
|
|
||||||
if (!parsed || !parsed.data) return;
|
|
||||||
|
|
||||||
const data = parsed.data;
|
|
||||||
|
|
||||||
if (!resolved) {
|
|
||||||
resolved = true;
|
|
||||||
resolve(data);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const [label, rotData] of Object.entries(data)) {
|
createTab(text, hash) {
|
||||||
|
const tab = document.createElement('div');
|
||||||
|
tab.className = 'tab';
|
||||||
|
tab.textContent = text;
|
||||||
|
tab.addEventListener('click', () => { location.hash = encodeURIComponent(hash); });
|
||||||
|
this.tabBar.appendChild(tab);
|
||||||
|
return tab;
|
||||||
|
}
|
||||||
|
|
||||||
|
buildStationBar() {
|
||||||
|
for (const [name, cfg] of Object.entries(this.stations)) {
|
||||||
|
const pill = document.createElement('div');
|
||||||
|
pill.className = 'station-pill';
|
||||||
|
|
||||||
|
const dot = document.createElement('span');
|
||||||
|
dot.className = 'dot';
|
||||||
|
dot.style.background = cfg.color;
|
||||||
|
pill.appendChild(dot);
|
||||||
|
|
||||||
|
const nameSpan = document.createElement('span');
|
||||||
|
nameSpan.textContent = name;
|
||||||
|
pill.appendChild(nameSpan);
|
||||||
|
|
||||||
|
const freq = document.createElement('span');
|
||||||
|
freq.className = 'freq';
|
||||||
|
const radio = this.stationRadio[name];
|
||||||
|
freq.textContent = radio ? formatFreq(radio.freq) : '';
|
||||||
|
pill.appendChild(freq);
|
||||||
|
|
||||||
|
pill.addEventListener('click', () => {
|
||||||
|
this.selectedStation = name;
|
||||||
|
saveSelectedStation(name);
|
||||||
|
this.updateStationSelection();
|
||||||
|
this.applyAutoTab();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.stationBar.appendChild(pill);
|
||||||
|
this.stationPills[name] = { el: pill, freqEl: freq };
|
||||||
|
}
|
||||||
|
this.updateStationSelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
updateStationSelection() {
|
||||||
|
for (const [name, pill] of Object.entries(this.stationPills)) {
|
||||||
|
const selected = name === this.selectedStation;
|
||||||
|
pill.el.classList.toggle('selected', selected);
|
||||||
|
pill.el.style.borderColor = selected ? this.stations[name].color : '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
applyHash() {
|
||||||
|
const hash = decodeURIComponent(location.hash.slice(1));
|
||||||
|
this.autoMode = hash !== 'all' && !this.rotators[hash];
|
||||||
|
|
||||||
|
if (this.autoMode) this.applyAutoTab();
|
||||||
|
else if (hash === 'all') this.showAll();
|
||||||
|
else this.showTab(hash);
|
||||||
|
|
||||||
|
const hasStations = Object.keys(this.stations).length > 0;
|
||||||
|
this.stationBar.classList.toggle('visible', this.autoMode && hasStations);
|
||||||
|
this.autoTab.classList.toggle('active', this.autoMode);
|
||||||
|
this.allTab.classList.toggle('active', hash === 'all');
|
||||||
|
}
|
||||||
|
|
||||||
|
applyAutoTab() {
|
||||||
|
const radio = this.selectedStation ? this.stationRadio[this.selectedStation] : null;
|
||||||
|
const match = radio ? this.findRotatorForBand(radio.band) : null;
|
||||||
|
if (match) this.showTab(match, true);
|
||||||
|
else this.showAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
findRotatorForBand(band) {
|
||||||
|
return this.labels.find(l => this.rotators[l].state.bands.includes(band)) ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
showTab(label, isAuto = false) {
|
||||||
|
for (const l of this.labels) {
|
||||||
|
const rot = this.rotators[l];
|
||||||
|
const visible = l === label;
|
||||||
|
rot.ui.card.classList.toggle('visible', visible);
|
||||||
|
rot.tab.classList.toggle('active', !isAuto && visible);
|
||||||
|
}
|
||||||
|
// re-render: the canvas may have been hidden
|
||||||
|
this.rotators[label].ui.renderer.render();
|
||||||
|
}
|
||||||
|
|
||||||
|
showAll() {
|
||||||
|
for (const l of this.labels) {
|
||||||
|
const rot = this.rotators[l];
|
||||||
|
rot.ui.card.classList.add('visible');
|
||||||
|
rot.tab.classList.remove('active');
|
||||||
|
rot.ui.renderer.render();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
applyInitData(label, initData) {
|
||||||
const rot = this.rotators[label];
|
const rot = this.rotators[label];
|
||||||
if (!rot) continue;
|
for (const [key, value] of Object.entries(initData)) {
|
||||||
|
if (value !== null) rot.state[key] = value;
|
||||||
|
}
|
||||||
|
rot.ui.updateStatic();
|
||||||
|
if (rot.tab) rot.tab.textContent = rot.state.antName || label;
|
||||||
|
this.updateTitle();
|
||||||
|
}
|
||||||
|
|
||||||
if (rotData.dynamic) {
|
applyDynamic(label, { azimuth, status, adc, online }) {
|
||||||
const { azimuth, status, adc, online } = rotData.dynamic;
|
const rot = this.rotators[label];
|
||||||
let needsRender = rot.state.azimuth !== azimuth
|
const needsRender = rot.state.azimuth !== azimuth
|
||||||
|| rot.state.status !== status
|
|| rot.state.status !== status
|
||||||
|| rot.state.online !== online;
|
|| rot.state.online !== online;
|
||||||
|
|
||||||
@@ -515,24 +716,99 @@
|
|||||||
rot.ui.updateDynamic();
|
rot.ui.updateDynamic();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rotData.turnedBy) {
|
applySetpoint(label, setpoint) {
|
||||||
rot.state.targetAngle = rotData.targetAz;
|
const rot = this.rotators[label];
|
||||||
|
rot.state.targetAngle = setpoint.targetAz;
|
||||||
rot.ui.renderer.render();
|
rot.ui.renderer.render();
|
||||||
rot.ui.updateTurnedBy(rotData.turnedBy, rotData.targetAz);
|
rot.ui.updateTurnedBy(setpoint, this.stations[setpoint.station]);
|
||||||
|
}
|
||||||
|
|
||||||
|
handleRadioInfo({ station, band, freq }) {
|
||||||
|
this.stationRadio[station] = { band, freq };
|
||||||
|
const pill = this.stationPills[station];
|
||||||
|
if (pill) pill.freqEl.textContent = formatFreq(freq);
|
||||||
|
if (this.autoMode && station === this.selectedStation) this.applyAutoTab();
|
||||||
|
}
|
||||||
|
|
||||||
|
handleMessage(msg) {
|
||||||
|
if (msg.type === 'radioInfo') {
|
||||||
|
this.handleRadioInfo(msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!this.rotators[msg.label]) return;
|
||||||
|
switch (msg.type) {
|
||||||
|
case 'initData': this.applyInitData(msg.label, msg.initData); break;
|
||||||
|
case 'dynamic': this.applyDynamic(msg.label, msg.dynamic); break;
|
||||||
|
case 'setpoint': this.applySetpoint(msg.label, msg.setpoint); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
startWs() {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
const ws = new WebSocket(wsUrl());
|
||||||
|
this.websocket = ws;
|
||||||
|
|
||||||
|
ws.addEventListener("message", (e) => {
|
||||||
|
let msg;
|
||||||
|
try {
|
||||||
|
msg = JSON.parse(e.data);
|
||||||
|
} catch {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (msg.type === 'init') resolve(msg);
|
||||||
|
else this.handleMessage(msg);
|
||||||
});
|
});
|
||||||
|
|
||||||
setInterval(() => {
|
const pingTimer = setInterval(() => {
|
||||||
this.websocket.send(JSON.stringify({ ping: 1 }));
|
if (ws.readyState === WebSocket.OPEN) ws.send(JSON.stringify({ ping: 1 }));
|
||||||
}, 2000);
|
}, 2000);
|
||||||
|
|
||||||
|
ws.addEventListener("close", () => {
|
||||||
|
clearInterval(pingTimer);
|
||||||
|
reloadWhenServerIsBack();
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function wsUrl() {
|
||||||
|
return location.origin.replace(/^http/, 'ws') + location.pathname.replace(/\/?$/, '/') + 'ws';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Polls until the server accepts a WebSocket again, then reloads to get a fresh state. */
|
||||||
|
function reloadWhenServerIsBack() {
|
||||||
|
setTimeout(() => {
|
||||||
|
const probe = new WebSocket(wsUrl());
|
||||||
|
probe.addEventListener("open", () => location.reload());
|
||||||
|
probe.addEventListener("error", () => reloadWhenServerIsBack());
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** N1MM frequencies are in tens of Hz. */
|
||||||
|
function formatFreq(freq) {
|
||||||
|
return (freq / 100000).toFixed(3) + ' MHz';
|
||||||
|
}
|
||||||
|
|
||||||
|
const STATION_STORAGE_KEY = 'rotrouter.selectedStation';
|
||||||
|
|
||||||
|
function loadSelectedStation() {
|
||||||
|
try {
|
||||||
|
return localStorage.getItem(STATION_STORAGE_KEY);
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveSelectedStation(name) {
|
||||||
|
try {
|
||||||
|
localStorage.setItem(STATION_STORAGE_KEY, name);
|
||||||
|
} catch {
|
||||||
|
// storage unavailable (private mode etc.) — selection just won't persist
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", () => {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
const app = new RotatorApp();
|
new RotatorApp().initialize();
|
||||||
app.initialize();
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
+57
-21
@@ -1,57 +1,93 @@
|
|||||||
import dgram from 'node:dgram';
|
import dgram from 'node:dgram';
|
||||||
import { XMLParser } from 'fast-xml-parser';
|
import { XMLParser } from 'fast-xml-parser';
|
||||||
import type { TurnMessageHandler } from './types.js';
|
import { freqToBand } from './bands.js';
|
||||||
|
import type { RadioInfoMessage, TurnMessage } from './types.js';
|
||||||
|
|
||||||
interface N1MMRotorXml {
|
const N1MM_PORT = 12040;
|
||||||
|
|
||||||
|
// fast-xml-parser converts numeric-looking tag values to numbers.
|
||||||
|
interface ParsedXml {
|
||||||
N1MMRotor?: {
|
N1MMRotor?: {
|
||||||
freqband?: string;
|
freqband?: string | number;
|
||||||
goazi?: string;
|
goazi?: string | number;
|
||||||
};
|
};
|
||||||
|
RadioInfo?: {
|
||||||
|
Freq?: number;
|
||||||
|
RadioNr?: number;
|
||||||
|
FocusRadioNr?: number;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Takes the first entry of a possibly comma-separated N1MM value. */
|
||||||
|
function firstNumber(value: string | number | undefined): number {
|
||||||
|
return parseFloat(String(value ?? '').split(',')[0] ?? '');
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class N1mmServer {
|
export default class N1mmServer {
|
||||||
private readonly xmlParser = new XMLParser();
|
private readonly xmlParser = new XMLParser();
|
||||||
private readonly turnHandlers: TurnMessageHandler[] = [];
|
private readonly turnHandlers: Array<(msg: TurnMessage) => void> = [];
|
||||||
|
private readonly radioInfoHandlers: Array<(msg: RadioInfoMessage) => void> = [];
|
||||||
|
|
||||||
start(): void {
|
start(): void {
|
||||||
const server = dgram.createSocket('udp4');
|
const server = dgram.createSocket('udp4');
|
||||||
|
|
||||||
server.on('error', err => {
|
server.on('error', err => {
|
||||||
console.error(`server error:\n${err.stack}`);
|
console.error('N1MM UDP server error:', err);
|
||||||
server.close();
|
server.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
server.on('listening', () => {
|
server.on('listening', () => {
|
||||||
const { address, port } = server.address();
|
const { address, port } = server.address();
|
||||||
console.log(`server listening ${address}:${port}`);
|
console.log(`N1MM UDP server listening on ${address}:${port}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
server.on('message', (msg, rinfo) => {
|
server.on('message', (msg, rinfo) => {
|
||||||
console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
|
this.processXml(msg.toString(), rinfo.address);
|
||||||
this.processN1mmXml(msg.toString(), rinfo.address);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
server.bind(12040);
|
server.bind(N1MM_PORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
onTurnMessage(handler: TurnMessageHandler): void {
|
onTurnMessage(handler: (msg: TurnMessage) => void): void {
|
||||||
this.turnHandlers.push(handler);
|
this.turnHandlers.push(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
private processN1mmXml(xml: string, sourceIp: string): void {
|
onRadioInfo(handler: (msg: RadioInfoMessage) => void): void {
|
||||||
try {
|
this.radioInfoHandlers.push(handler);
|
||||||
const parsed = this.xmlParser.parse(xml) as N1MMRotorXml;
|
}
|
||||||
const band = parseInt(parsed?.N1MMRotor?.freqband?.split(',')[0] ?? '0', 10);
|
|
||||||
const az = parseInt(parsed?.N1MMRotor?.goazi?.split(',')[0] ?? '0', 10);
|
|
||||||
|
|
||||||
if (!band || !az) {
|
private processXml(xml: string, sourceIp: string): void {
|
||||||
console.error('Missing band or azimuth');
|
let parsed: ParsedXml;
|
||||||
|
try {
|
||||||
|
parsed = this.xmlParser.parse(xml) as ParsedXml;
|
||||||
|
} catch (ex) {
|
||||||
|
console.error(`Failed to parse N1MM packet from ${sourceIp}: ${xml}`, ex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.turnHandlers.forEach(h => h.handleTurnMessage({ band, az, sourceIp }));
|
if (parsed.N1MMRotor) {
|
||||||
} catch (ex) {
|
this.processRotor(parsed.N1MMRotor, sourceIp);
|
||||||
console.error(`Failed to parse: ${xml}`, ex);
|
} else if (parsed.RadioInfo) {
|
||||||
|
this.processRadioInfo(parsed.RadioInfo, sourceIp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private processRotor(rotor: NonNullable<ParsedXml['N1MMRotor']>, sourceIp: string): void {
|
||||||
|
const band = firstNumber(rotor.freqband);
|
||||||
|
const az = Math.round(firstNumber(rotor.goazi));
|
||||||
|
if (!Number.isFinite(band) || !Number.isFinite(az)) {
|
||||||
|
console.error(`Rotor packet from ${sourceIp} is missing band or azimuth`, rotor);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.turnHandlers.forEach(h => h({ band, az, sourceIp }));
|
||||||
|
}
|
||||||
|
|
||||||
|
private processRadioInfo(info: NonNullable<ParsedXml['RadioInfo']>, sourceIp: string): void {
|
||||||
|
const freq = Number(info.Freq ?? 0);
|
||||||
|
// In SO2R/SO2V, only follow the radio that has keyboard focus.
|
||||||
|
if (!freq || Number(info.RadioNr) !== Number(info.FocusRadioNr)) return;
|
||||||
|
const band = freqToBand(freq / 100_000);
|
||||||
|
if (band === null) return;
|
||||||
|
this.radioInfoHandlers.forEach(h => h({ band, freq, sourceIp }));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+97
-100
@@ -1,16 +1,20 @@
|
|||||||
import type { ClientConfig, DynamicData, InitData } from './types.js';
|
import type { DynamicData, InitData, RotatorConfig, RotatorState, Setpoint } from './types.js';
|
||||||
|
|
||||||
const enum NumType {
|
const ROTATOR_PORT = 88;
|
||||||
String,
|
const POLL_INTERVAL_MS = 1000;
|
||||||
Int,
|
const REQUEST_TIMEOUT_MS = 2000;
|
||||||
Float,
|
|
||||||
}
|
|
||||||
|
|
||||||
interface EndpointDef {
|
type NumType = 'string' | 'int' | 'float';
|
||||||
key: string;
|
|
||||||
url: string;
|
const INIT_ENDPOINTS: ReadonlyArray<[keyof InitData, string, NumType]> = [
|
||||||
numType: NumType;
|
['azShift', 'readStart', 'int' ],
|
||||||
}
|
['azRange', 'readMax', 'int' ],
|
||||||
|
['antRadiationAngle', 'readAnt', 'int' ],
|
||||||
|
['antName', 'readAntName', 'string'],
|
||||||
|
['mapUrl', 'readMapUrl', 'string'],
|
||||||
|
['mac', 'readMAC', 'string'],
|
||||||
|
['elevation', 'readElevation', 'int' ],
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client for the simple_rotator_interface_v protocol.
|
* Client for the simple_rotator_interface_v protocol.
|
||||||
@@ -20,122 +24,115 @@ export default class RotClient {
|
|||||||
readonly label: string;
|
readonly label: string;
|
||||||
private readonly ip: string;
|
private readonly ip: string;
|
||||||
private readonly bands: number[];
|
private readonly bands: number[];
|
||||||
private cachedData: InitData | null = null;
|
private initData: InitData | null = null;
|
||||||
|
private initDataLoading = false;
|
||||||
private dynamicData: DynamicData | null = null;
|
private dynamicData: DynamicData | null = null;
|
||||||
|
private setpoint: Setpoint | null = null;
|
||||||
private readonly dynamicHandlers: Array<(data: DynamicData) => void> = [];
|
private readonly dynamicHandlers: Array<(data: DynamicData) => void> = [];
|
||||||
|
private readonly initDataHandlers: Array<(data: InitData) => void> = [];
|
||||||
|
|
||||||
constructor(label: string, { ip, bands }: ClientConfig) {
|
constructor(label: string, { ip, bands }: RotatorConfig) {
|
||||||
this.label = label;
|
this.label = label;
|
||||||
this.ip = ip;
|
this.ip = ip;
|
||||||
this.bands = bands;
|
this.bands = bands;
|
||||||
|
|
||||||
setInterval(() => void this.fetchDynamicData(), 1000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async readInitData(): Promise<InitData> {
|
/** Starts polling the controller. Init data is loaded once the rotator is reachable. */
|
||||||
if (this.cachedData) return this.cachedData;
|
start(): void {
|
||||||
|
const poll = async () => {
|
||||||
const endpoints: EndpointDef[] = [
|
await this.fetchDynamicData();
|
||||||
{ key: 'azShift', url: 'readStart', numType: NumType.Int },
|
setTimeout(() => void poll(), POLL_INTERVAL_MS);
|
||||||
{ key: 'azRange', url: 'readMax', numType: NumType.Int },
|
|
||||||
{ key: 'antRadiationAngle', url: 'readAnt', numType: NumType.Int },
|
|
||||||
{ key: 'antName', url: 'readAntName', numType: NumType.String },
|
|
||||||
{ key: 'mapUrl', url: 'readMapUrl', numType: NumType.String },
|
|
||||||
{ key: 'mac', url: 'readMAC', numType: NumType.String },
|
|
||||||
{ key: 'elevation', url: 'readElevation', numType: NumType.Int },
|
|
||||||
];
|
|
||||||
|
|
||||||
this.cachedData = await this.readEndpoints(endpoints) as unknown as InitData;
|
|
||||||
console.log(`${this.label} Set the initial offset to ${this.cachedData.azShift}.`);
|
|
||||||
return this.cachedData;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async readEndpoints(endpoints: EndpointDef[]): Promise<Record<string, string | number | null>> {
|
|
||||||
const data: Record<string, string | number | null> = {};
|
|
||||||
for (const { key, url, numType } of endpoints) {
|
|
||||||
data[key] = await this.readKey(url, numType);
|
|
||||||
}
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async fetchDynamicData(): Promise<void> {
|
|
||||||
const endpoints: EndpointDef[] = [
|
|
||||||
{ key: 'adc', url: 'readADC', numType: NumType.Float },
|
|
||||||
{ key: 'azimuth', url: 'readAZ', numType: NumType.Int },
|
|
||||||
{ key: 'status', url: 'readStat', numType: NumType.Int },
|
|
||||||
];
|
|
||||||
|
|
||||||
const raw = await this.readEndpoints(endpoints);
|
|
||||||
const data: DynamicData = {
|
|
||||||
adc: raw.adc as number | null,
|
|
||||||
azimuth: raw.azimuth as number | null,
|
|
||||||
status: raw.status as number | null,
|
|
||||||
online: raw.azimuth !== null,
|
|
||||||
};
|
};
|
||||||
|
void poll();
|
||||||
if (this.dynamicData !== null) {
|
|
||||||
const oldData = this.dynamicData;
|
|
||||||
const hasChanged = (Object.keys(oldData) as Array<keyof DynamicData>).some(
|
|
||||||
key => oldData[key] !== data[key]
|
|
||||||
);
|
|
||||||
if (hasChanged) {
|
|
||||||
this.dynamicHandlers.forEach(handler => handler(data));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.dynamicData = data;
|
|
||||||
console.log(`${this.label}: `, this.dynamicData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onDynamicDataUpdate(handler: (data: DynamicData) => void): void {
|
onDynamicDataUpdate(handler: (data: DynamicData) => void): void {
|
||||||
this.dynamicHandlers.push(handler);
|
this.dynamicHandlers.push(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onInitDataLoaded(handler: (data: InitData) => void): void {
|
||||||
|
this.initDataHandlers.push(handler);
|
||||||
|
}
|
||||||
|
|
||||||
hasBand(band: number): boolean {
|
hasBand(band: number): boolean {
|
||||||
return this.bands.includes(band);
|
return this.bands.includes(band);
|
||||||
}
|
}
|
||||||
|
|
||||||
getBands(): number[] {
|
getState(): RotatorState {
|
||||||
return this.bands;
|
return {
|
||||||
|
initData: this.initData,
|
||||||
|
dynamic: this.dynamicData,
|
||||||
|
bands: this.bands,
|
||||||
|
setpoint: this.setpoint,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
turn(az: number): void {
|
turn(setpoint: Setpoint): void {
|
||||||
fetch(`http://${this.ip}:88/`, {
|
this.setpoint = setpoint;
|
||||||
body: `ROT=${az}`,
|
console.log(`Turning ${this.label} to ${setpoint.targetAz}° (by ${setpoint.station ?? setpoint.sourceIp})`);
|
||||||
|
fetch(`${this.baseUrl()}/`, {
|
||||||
|
body: `ROT=${setpoint.targetAz}`,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' },
|
||||||
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
|
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
|
||||||
},
|
}).catch((ex: Error) => console.error(`${this.label}: Failed to send turn command: ${ex.cause ?? ex.message}`));
|
||||||
}).catch(() => {});
|
|
||||||
console.log(`Turning ${this.label} to ${az}°...`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async readKey(endpoint: string, numType: NumType): Promise<string | number | null> {
|
private baseUrl(): string {
|
||||||
|
return `http://${this.ip}:${ROTATOR_PORT}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async loadInitData(): Promise<void> {
|
||||||
|
if (this.initData || this.initDataLoading) return;
|
||||||
|
this.initDataLoading = true;
|
||||||
try {
|
try {
|
||||||
const resp = await fetch(`http://${this.ip}:88/${endpoint}`);
|
const values = await Promise.all(INIT_ENDPOINTS.map(([, url, type]) => this.readKey(url, type)));
|
||||||
|
// The rotator may have dropped off mid-read; retry on the next successful poll.
|
||||||
|
if (values.every(v => v === null)) return;
|
||||||
|
const data = Object.fromEntries(INIT_ENDPOINTS.map(([key], i) => [key, values[i]])) as unknown as InitData;
|
||||||
|
this.initData = data;
|
||||||
|
console.log(`${this.label}: Loaded init data (azimuth offset ${data.azShift}°).`);
|
||||||
|
this.initDataHandlers.forEach(h => h(data));
|
||||||
|
} finally {
|
||||||
|
this.initDataLoading = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async fetchDynamicData(): Promise<void> {
|
||||||
|
const [adc, azimuth, status] = await Promise.all([
|
||||||
|
this.readKey('readADC', 'float'),
|
||||||
|
this.readKey('readAZ', 'int'),
|
||||||
|
this.readKey('readStat', 'int'),
|
||||||
|
]);
|
||||||
|
const data: DynamicData = {
|
||||||
|
adc: adc as number | null,
|
||||||
|
azimuth: azimuth as number | null,
|
||||||
|
status: status as number | null,
|
||||||
|
online: azimuth !== null,
|
||||||
|
};
|
||||||
|
|
||||||
|
const old = this.dynamicData;
|
||||||
|
const changed = !old || (Object.keys(data) as Array<keyof DynamicData>).some(k => old[k] !== data[k]);
|
||||||
|
this.dynamicData = data;
|
||||||
|
|
||||||
|
if (old?.online !== data.online) {
|
||||||
|
console.log(`${this.label}: ${data.online ? 'online' : 'offline'}`);
|
||||||
|
}
|
||||||
|
if (data.online) void this.loadInitData();
|
||||||
|
if (changed) this.dynamicHandlers.forEach(h => h(data));
|
||||||
|
}
|
||||||
|
|
||||||
|
private async readKey(endpoint: string, type: NumType): Promise<string | number | null> {
|
||||||
|
try {
|
||||||
|
const resp = await fetch(`${this.baseUrl()}/${endpoint}`, { signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS) });
|
||||||
|
if (!resp.ok) return null;
|
||||||
const text = await resp.text();
|
const text = await resp.text();
|
||||||
if (numType === NumType.String) return text;
|
if (type === 'string') return text;
|
||||||
if (numType === NumType.Int) return parseInt(text, 10);
|
const value = type === 'int' ? parseInt(text, 10) : parseFloat(text);
|
||||||
return parseFloat(text);
|
return Number.isFinite(value) ? value : null;
|
||||||
} catch (ex) {
|
} catch {
|
||||||
console.error(`${this.label}: Failed to read ${endpoint}:`, ex);
|
// Unreachable rotators are reported via the `online` flag rather than logged every second.
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getDynamicData(): DynamicData | null {
|
|
||||||
return this.dynamicData;
|
|
||||||
}
|
|
||||||
|
|
||||||
getAzimuth(): number | null {
|
|
||||||
return this.dynamicData?.azimuth ?? null;
|
|
||||||
}
|
|
||||||
|
|
||||||
getAdc(): number | null {
|
|
||||||
return this.dynamicData?.adc ?? null;
|
|
||||||
}
|
|
||||||
|
|
||||||
getStatus(): number | null {
|
|
||||||
return this.dynamicData?.status ?? null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+78
-40
@@ -1,72 +1,110 @@
|
|||||||
import { readFileSync } from 'node:fs';
|
import { readFileSync } from 'node:fs';
|
||||||
import RotClient from './RotClient.js';
|
import RotClient from './RotClient.js';
|
||||||
import type { Config, DynamicData, InitialState, TurnMessage, TurnMessageHandler } from './types.js';
|
import type {
|
||||||
|
Config,
|
||||||
|
DynamicData,
|
||||||
|
InitData,
|
||||||
|
RadioInfoMessage,
|
||||||
|
RotatorState,
|
||||||
|
Setpoint,
|
||||||
|
StationConfig,
|
||||||
|
StationRadio,
|
||||||
|
TurnMessage,
|
||||||
|
} from './types.js';
|
||||||
|
|
||||||
export interface TurnEvent {
|
export interface RadioInfoEvent extends StationRadio {
|
||||||
label: string;
|
station: string;
|
||||||
az: number;
|
|
||||||
sourceIp: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class RotRouter implements TurnMessageHandler {
|
export default class RotRouter {
|
||||||
private readonly clients: Record<string, RotClient> = {};
|
private readonly clients = new Map<string, RotClient>();
|
||||||
private readonly routerDataHandlers: Array<(rotator: RotClient, data: DynamicData) => void> = [];
|
private readonly stations: Record<string, StationConfig>;
|
||||||
private readonly turnEventHandlers: Array<(event: TurnEvent) => void> = [];
|
private readonly stationsByIp = new Map<string, string>();
|
||||||
|
private readonly stationRadio: Record<string, StationRadio> = {};
|
||||||
|
private readonly dynamicDataHandlers: Array<(label: string, data: DynamicData) => void> = [];
|
||||||
|
private readonly initDataHandlers: Array<(label: string, data: InitData) => void> = [];
|
||||||
|
private readonly setpointHandlers: Array<(label: string, setpoint: Setpoint) => void> = [];
|
||||||
|
private readonly radioInfoHandlers: Array<(event: RadioInfoEvent) => void> = [];
|
||||||
|
|
||||||
constructor() {
|
constructor(configPath: string) {
|
||||||
this.loadConfig();
|
const config = JSON.parse(readFileSync(configPath, 'utf-8')) as Config;
|
||||||
|
|
||||||
|
for (const [label, rotatorConfig] of Object.entries(config.rotators)) {
|
||||||
|
const client = new RotClient(label, rotatorConfig);
|
||||||
|
client.onDynamicDataUpdate(data => this.dynamicDataHandlers.forEach(h => h(label, data)));
|
||||||
|
client.onInitDataLoaded(data => this.initDataHandlers.forEach(h => h(label, data)));
|
||||||
|
this.clients.set(label, client);
|
||||||
}
|
}
|
||||||
|
|
||||||
private loadConfig(): void {
|
this.stations = config.stations;
|
||||||
const raw = readFileSync('config.json', 'utf-8');
|
for (const [name, { ip }] of Object.entries(config.stations)) {
|
||||||
const parsed = JSON.parse(raw) as Config;
|
this.stationsByIp.set(ip, name);
|
||||||
for (const [label, clientConfig] of Object.entries(parsed)) {
|
|
||||||
const client = new RotClient(label, clientConfig);
|
|
||||||
client.onDynamicDataUpdate(data => this.routerDataHandlers.forEach(h => h(client, data)));
|
|
||||||
this.clients[label] = client;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private findClientForBand(band: number): RotClient | null {
|
start(): void {
|
||||||
return Object.values(this.clients).find(c => c.hasBand(band)) ?? null;
|
this.clients.forEach(c => c.start());
|
||||||
}
|
}
|
||||||
|
|
||||||
handleTurnMessage(msg: TurnMessage): void {
|
resolveStation(ip: string): string | null {
|
||||||
const client = this.findClientForBand(msg.band);
|
return this.stationsByIp.get(ip) ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
getStations(): Record<string, StationConfig> {
|
||||||
|
return this.stations;
|
||||||
|
}
|
||||||
|
|
||||||
|
getStationRadio(): Record<string, StationRadio> {
|
||||||
|
return this.stationRadio;
|
||||||
|
}
|
||||||
|
|
||||||
|
getRotatorStates(): Record<string, RotatorState> {
|
||||||
|
return Object.fromEntries([...this.clients].map(([label, c]) => [label, c.getState()]));
|
||||||
|
}
|
||||||
|
|
||||||
|
handleRadioInfo({ sourceIp, band, freq }: RadioInfoMessage): void {
|
||||||
|
const station = this.resolveStation(sourceIp);
|
||||||
|
if (!station) return;
|
||||||
|
this.stationRadio[station] = { band, freq };
|
||||||
|
this.radioInfoHandlers.forEach(h => h({ station, band, freq }));
|
||||||
|
}
|
||||||
|
|
||||||
|
handleTurnMessage({ band, az, sourceIp }: TurnMessage): void {
|
||||||
|
const client = [...this.clients.values()].find(c => c.hasBand(band));
|
||||||
if (!client) {
|
if (!client) {
|
||||||
console.error(`No RotClient found for the ${msg.band} band!`);
|
console.error(`No rotator configured for the ${band} MHz band!`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
client.turn(msg.az);
|
this.turnClient(client, az, sourceIp);
|
||||||
this.fireTurnEvent(client.label, msg.az, msg.sourceIp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Turns the rotator with the given label. Returns false if no such rotator exists. */
|
||||||
turn(label: string, az: number, sourceIp: string): boolean {
|
turn(label: string, az: number, sourceIp: string): boolean {
|
||||||
const client = this.clients[label];
|
const client = this.clients.get(label);
|
||||||
if (!client) return false;
|
if (!client) return false;
|
||||||
client.turn(az);
|
this.turnClient(client, az, sourceIp);
|
||||||
this.fireTurnEvent(label, az, sourceIp);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private fireTurnEvent(label: string, az: number, sourceIp: string): void {
|
private turnClient(client: RotClient, targetAz: number, sourceIp: string): void {
|
||||||
const event: TurnEvent = { label, az, sourceIp };
|
const setpoint: Setpoint = { targetAz, sourceIp, station: this.resolveStation(sourceIp) };
|
||||||
this.turnEventHandlers.forEach(h => h(event));
|
client.turn(setpoint);
|
||||||
|
this.setpointHandlers.forEach(h => h(client.label, setpoint));
|
||||||
}
|
}
|
||||||
|
|
||||||
onTurnEvent(handler: (event: TurnEvent) => void): void {
|
onDynamicData(handler: (label: string, data: DynamicData) => void): void {
|
||||||
this.turnEventHandlers.push(handler);
|
this.dynamicDataHandlers.push(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
onRotatorData(handler: (rotator: RotClient, data: DynamicData) => void): void {
|
onInitData(handler: (label: string, data: InitData) => void): void {
|
||||||
this.routerDataHandlers.push(handler);
|
this.initDataHandlers.push(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
async readInitialState(): Promise<InitialState> {
|
onSetpoint(handler: (label: string, setpoint: Setpoint) => void): void {
|
||||||
const state: InitialState = {};
|
this.setpointHandlers.push(handler);
|
||||||
for (const client of Object.values(this.clients)) {
|
|
||||||
state[client.label] = { initData: await client.readInitData(), bands: client.getBands() };
|
|
||||||
}
|
}
|
||||||
return state;
|
|
||||||
|
onRadioInfo(handler: (event: RadioInfoEvent) => void): void {
|
||||||
|
this.radioInfoHandlers.push(handler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+32
-53
@@ -1,80 +1,59 @@
|
|||||||
import type { WSContext } from 'hono/ws';
|
import type { WSContext } from 'hono/ws';
|
||||||
|
import type { ServerMessage } from './types.js';
|
||||||
|
|
||||||
interface IncomingMessage {
|
const PING_TIMEOUT_MS = 60_000;
|
||||||
ping?: boolean;
|
const PING_CHECK_INTERVAL_MS = 10_000;
|
||||||
data?: unknown;
|
|
||||||
|
interface ClientMessage {
|
||||||
|
ping?: unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class WebsocketManager {
|
export default class WebsocketManager {
|
||||||
private readonly clients = new Set<WSContext>();
|
/** Last ping time per client. A Map keys by identity; a plain object would stringify every WSContext to the same key. */
|
||||||
// Map correctly tracks identity — plain object keys would stringify all WSContext to "[object Object]"
|
private readonly clients = new Map<WSContext, number>();
|
||||||
private readonly lastPing = new Map<WSContext, number>();
|
private readonly buildInit: (clientStation: string | null) => ServerMessage;
|
||||||
private initData: unknown = null;
|
|
||||||
|
|
||||||
constructor() {
|
/** @param buildInit builds the `init` message sent to each newly connected client. */
|
||||||
|
constructor(buildInit: (clientStation: string | null) => ServerMessage) {
|
||||||
|
this.buildInit = buildInit;
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
const threshold = Date.now() - 60_000;
|
const threshold = Date.now() - PING_TIMEOUT_MS;
|
||||||
for (const [client, ping] of this.lastPing) {
|
for (const [ws, lastPing] of this.clients) {
|
||||||
if (ping < threshold) this.leaveClient(client);
|
if (lastPing < threshold) {
|
||||||
|
this.clients.delete(ws);
|
||||||
|
ws.close();
|
||||||
}
|
}
|
||||||
}, 10_000);
|
}
|
||||||
|
}, PING_CHECK_INTERVAL_MS);
|
||||||
}
|
}
|
||||||
|
|
||||||
getHandler() {
|
getHandler(clientStation: string | null) {
|
||||||
return {
|
return {
|
||||||
onOpen: (_event: Event, ws: WSContext) => {
|
onOpen: (_event: Event, ws: WSContext) => {
|
||||||
this.joinClient(ws);
|
this.clients.set(ws, Date.now());
|
||||||
|
this.send(ws, this.buildInit(clientStation));
|
||||||
},
|
},
|
||||||
onMessage: (event: MessageEvent, ws: WSContext) => {
|
onMessage: (event: MessageEvent, ws: WSContext) => {
|
||||||
if (!event.data) return;
|
if (typeof event.data !== 'string') return;
|
||||||
|
|
||||||
let msg: IncomingMessage;
|
|
||||||
try {
|
try {
|
||||||
msg = JSON.parse(event.data as string) as IncomingMessage;
|
const msg = JSON.parse(event.data) as ClientMessage;
|
||||||
|
if (msg.ping) this.clients.set(ws, Date.now());
|
||||||
} catch {
|
} catch {
|
||||||
return;
|
// ignore malformed messages
|
||||||
}
|
|
||||||
|
|
||||||
if (msg.ping) {
|
|
||||||
this.lastPing.set(ws, Date.now());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (msg.data !== undefined) {
|
|
||||||
this.handleMessage(ws, msg.data);
|
|
||||||
console.log(`Data from client: ${event.data}`);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onClose: (_event: CloseEvent, ws: WSContext) => {
|
onClose: (_event: CloseEvent, ws: WSContext) => {
|
||||||
this.leaveClient(ws);
|
this.clients.delete(ws);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
broadcast(msg: ServerMessage): void {
|
||||||
private handleMessage(_ws: WSContext, _data: unknown): void {
|
const payload = JSON.stringify(msg);
|
||||||
// Reserved for future incoming-message handling
|
for (const ws of this.clients.keys()) ws.send(payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
private send(ws: WSContext, data: unknown): void {
|
private send(ws: WSContext, msg: ServerMessage): void {
|
||||||
ws.send(JSON.stringify({ data }));
|
ws.send(JSON.stringify(msg));
|
||||||
}
|
|
||||||
|
|
||||||
broadcast(data: unknown): void {
|
|
||||||
this.clients.forEach(client => this.send(client, data));
|
|
||||||
}
|
|
||||||
|
|
||||||
private joinClient(ws: WSContext): void {
|
|
||||||
this.clients.add(ws);
|
|
||||||
this.lastPing.set(ws, Date.now());
|
|
||||||
this.send(ws, this.initData);
|
|
||||||
}
|
|
||||||
|
|
||||||
private leaveClient(ws: WSContext): void {
|
|
||||||
this.clients.delete(ws);
|
|
||||||
this.lastPing.delete(ws);
|
|
||||||
}
|
|
||||||
|
|
||||||
setInitData(initData: unknown): void {
|
|
||||||
this.initData = initData;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/**
|
||||||
|
* Amateur bands as [lower edge in MHz, band number]. The band number matches what
|
||||||
|
* N1MM sends in `<freqband>` and what `config.json` uses in `bands`.
|
||||||
|
*/
|
||||||
|
const BANDS: ReadonlyArray<readonly [number, number]> = [
|
||||||
|
[1.8, 1.8],
|
||||||
|
[3.5, 3.5],
|
||||||
|
[5, 5],
|
||||||
|
[7, 7],
|
||||||
|
[10, 10],
|
||||||
|
[14, 14],
|
||||||
|
[18, 18],
|
||||||
|
[21, 21],
|
||||||
|
[24, 24],
|
||||||
|
[28, 28],
|
||||||
|
[50, 50],
|
||||||
|
[70, 70],
|
||||||
|
[144, 144],
|
||||||
|
[222, 222],
|
||||||
|
[420, 432],
|
||||||
|
[902, 902],
|
||||||
|
[1240, 1296],
|
||||||
|
[2300, 2304],
|
||||||
|
[3300, 3400],
|
||||||
|
[5650, 5760],
|
||||||
|
[10000, 10000],
|
||||||
|
];
|
||||||
|
|
||||||
|
/** Maps a frequency in MHz to its band number, or null if below the lowest band. */
|
||||||
|
export function freqToBand(mhz: number): number | null {
|
||||||
|
let band: number | null = null;
|
||||||
|
for (const [edge, number] of BANDS) {
|
||||||
|
if (mhz < edge) break;
|
||||||
|
band = number;
|
||||||
|
}
|
||||||
|
return band;
|
||||||
|
}
|
||||||
+42
-31
@@ -1,54 +1,65 @@
|
|||||||
import { Hono } from 'hono';
|
import { Hono, type Context } from 'hono';
|
||||||
import { serve } from '@hono/node-server';
|
import { serve } from '@hono/node-server';
|
||||||
import { serveStatic } from '@hono/node-server/serve-static';
|
import { serveStatic } from '@hono/node-server/serve-static';
|
||||||
|
import { getConnInfo } from '@hono/node-server/conninfo';
|
||||||
import { createNodeWebSocket } from '@hono/node-ws';
|
import { createNodeWebSocket } from '@hono/node-ws';
|
||||||
import RotRouter from './RotRouter.js';
|
import RotRouter from './RotRouter.js';
|
||||||
import N1mmServer from './N1mmServer.js';
|
import N1mmServer from './N1mmServer.js';
|
||||||
import WebsocketManager from './WebsocketManager.js';
|
import WebsocketManager from './WebsocketManager.js';
|
||||||
import { getConnInfo } from '@hono/node-server/conninfo';
|
|
||||||
|
|
||||||
const router = new RotRouter();
|
const HTTP_PORT = 8787;
|
||||||
|
const CONFIG_PATH = process.env.ROTROUTER_CONFIG ?? 'config.json';
|
||||||
|
const PUBLIC_DIR = process.env.ROTROUTER_PUBLIC ?? './public';
|
||||||
|
|
||||||
|
const router = new RotRouter(CONFIG_PATH);
|
||||||
|
|
||||||
|
const websocketManager = new WebsocketManager(clientStation => ({
|
||||||
|
type: 'init',
|
||||||
|
rotators: router.getRotatorStates(),
|
||||||
|
stations: router.getStations(),
|
||||||
|
stationRadio: router.getStationRadio(),
|
||||||
|
clientStation,
|
||||||
|
}));
|
||||||
|
|
||||||
|
router.onDynamicData((label, dynamic) => websocketManager.broadcast({ type: 'dynamic', label, dynamic }));
|
||||||
|
router.onInitData((label, initData) => websocketManager.broadcast({ type: 'initData', label, initData }));
|
||||||
|
router.onSetpoint((label, setpoint) => websocketManager.broadcast({ type: 'setpoint', label, setpoint }));
|
||||||
|
router.onRadioInfo(event => websocketManager.broadcast({ type: 'radioInfo', ...event }));
|
||||||
|
|
||||||
const n1mm = new N1mmServer();
|
const n1mm = new N1mmServer();
|
||||||
n1mm.onTurnMessage(router);
|
n1mm.onTurnMessage(msg => router.handleTurnMessage(msg));
|
||||||
// n1mm.start();
|
n1mm.onRadioInfo(msg => router.handleRadioInfo(msg));
|
||||||
|
|
||||||
|
function resolveClientIp(c: Context): string {
|
||||||
|
const forwarded = c.req.header('x-forwarded-for')?.split(',')[0]?.trim();
|
||||||
|
const rawIp = forwarded || getConnInfo(c).remote.address || 'unknown';
|
||||||
|
return rawIp.startsWith('::ffff:') ? rawIp.slice(7) : rawIp;
|
||||||
|
}
|
||||||
|
|
||||||
const app = new Hono();
|
const app = new Hono();
|
||||||
app.use('/*', serveStatic({ root: './public' }));
|
|
||||||
|
|
||||||
const websocketManager = new WebsocketManager();
|
|
||||||
const { injectWebSocket, upgradeWebSocket } = createNodeWebSocket({ app });
|
const { injectWebSocket, upgradeWebSocket } = createNodeWebSocket({ app });
|
||||||
|
|
||||||
const initialState = await router.readInitialState();
|
|
||||||
websocketManager.setInitData(initialState);
|
|
||||||
|
|
||||||
router.onRotatorData((rotator, data) => {
|
|
||||||
websocketManager.broadcast({ [rotator.label]: { dynamic: data } });
|
|
||||||
});
|
|
||||||
|
|
||||||
router.onTurnEvent((event) => {
|
|
||||||
const setpoint = { targetAz: event.az, sourceIp: event.sourceIp };
|
|
||||||
const client = initialState[event.label];
|
|
||||||
if (client) client.setpoint = setpoint;
|
|
||||||
websocketManager.broadcast({ [event.label]: { turnedBy: event.sourceIp, targetAz: event.az } });
|
|
||||||
});
|
|
||||||
|
|
||||||
app.post('/turn/:label', async (c) => {
|
app.post('/turn/:label', async (c) => {
|
||||||
const label = c.req.param('label');
|
const label = c.req.param('label');
|
||||||
const body = await c.req.parseBody();
|
const rot = (await c.req.parseBody())['ROT'];
|
||||||
const az = Number(body['ROT']);
|
const az = typeof rot === 'string' && rot.trim() !== '' ? Number(rot) : NaN;
|
||||||
if (isNaN(az)) return c.text('Invalid azimuth', 400);
|
if (!Number.isInteger(az) || az < 0) return c.text('Invalid azimuth', 400);
|
||||||
const rawIp = c.req.header('x-forwarded-for') ?? getConnInfo(c).remote.address ?? 'unknown';
|
const ok = router.turn(label, az, resolveClientIp(c));
|
||||||
const sourceIp = rawIp.startsWith('::ffff:') ? rawIp.slice(7) : rawIp;
|
|
||||||
const ok = router.turn(label, az, sourceIp);
|
|
||||||
return ok ? c.text(`Turning ${label} to ${az}`) : c.text('Unknown rotator', 404);
|
return ok ? c.text(`Turning ${label} to ${az}`) : c.text('Unknown rotator', 404);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/ws', upgradeWebSocket(() => websocketManager.getHandler()));
|
app.get('/ws', upgradeWebSocket((c) => {
|
||||||
|
const clientStation = router.resolveStation(resolveClientIp(c));
|
||||||
|
return websocketManager.getHandler(clientStation);
|
||||||
|
}));
|
||||||
|
|
||||||
|
app.use('/*', serveStatic({ root: PUBLIC_DIR }));
|
||||||
|
|
||||||
const server = serve(
|
const server = serve(
|
||||||
{ fetch: app.fetch, port: 8787 },
|
{ fetch: app.fetch, port: HTTP_PORT },
|
||||||
info => console.log(`Listening on http://localhost:${info.port}`),
|
info => console.log(`Listening on http://localhost:${info.port}`),
|
||||||
);
|
);
|
||||||
|
|
||||||
injectWebSocket(server);
|
injectWebSocket(server);
|
||||||
|
|
||||||
|
router.start();
|
||||||
|
n1mm.start();
|
||||||
|
|||||||
+38
-8
@@ -4,16 +4,27 @@ export interface TurnMessage {
|
|||||||
sourceIp: string;
|
sourceIp: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TurnMessageHandler {
|
export interface RadioInfoMessage {
|
||||||
handleTurnMessage(msg: TurnMessage): void;
|
band: number;
|
||||||
|
/** Receive frequency in tens of Hz, as sent by N1MM. */
|
||||||
|
freq: number;
|
||||||
|
sourceIp: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ClientConfig {
|
export interface RotatorConfig {
|
||||||
ip: string;
|
ip: string;
|
||||||
bands: number[];
|
bands: number[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Config = Record<string, ClientConfig>;
|
export interface StationConfig {
|
||||||
|
ip: string;
|
||||||
|
color: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Config {
|
||||||
|
rotators: Record<string, RotatorConfig>;
|
||||||
|
stations: Record<string, StationConfig>;
|
||||||
|
}
|
||||||
|
|
||||||
export interface DynamicData {
|
export interface DynamicData {
|
||||||
adc: number | null;
|
adc: number | null;
|
||||||
@@ -35,12 +46,31 @@ export interface InitData {
|
|||||||
export interface Setpoint {
|
export interface Setpoint {
|
||||||
targetAz: number;
|
targetAz: number;
|
||||||
sourceIp: string;
|
sourceIp: string;
|
||||||
|
station: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ClientState {
|
export interface RotatorState {
|
||||||
initData: InitData;
|
initData: InitData | null;
|
||||||
|
dynamic: DynamicData | null;
|
||||||
bands: number[];
|
bands: number[];
|
||||||
setpoint?: Setpoint;
|
setpoint: Setpoint | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type InitialState = Record<string, ClientState>;
|
export interface StationRadio {
|
||||||
|
band: number;
|
||||||
|
freq: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Messages pushed from the server to browser clients over WebSocket. */
|
||||||
|
export type ServerMessage =
|
||||||
|
| {
|
||||||
|
type: 'init';
|
||||||
|
rotators: Record<string, RotatorState>;
|
||||||
|
stations: Record<string, StationConfig>;
|
||||||
|
stationRadio: Record<string, StationRadio>;
|
||||||
|
clientStation: string | null;
|
||||||
|
}
|
||||||
|
| { type: 'initData'; label: string; initData: InitData }
|
||||||
|
| { type: 'dynamic'; label: string; dynamic: DynamicData }
|
||||||
|
| { type: 'setpoint'; label: string; setpoint: Setpoint }
|
||||||
|
| { type: 'radioInfo'; station: string; band: number; freq: number };
|
||||||
|
|||||||
Reference in New Issue
Block a user