feat(cat): three transports for Kenwood/Elecraft, chosen not inferred
USB, RS-232-to-Ethernet, and the radio's own network protocol are three different things, so they are three entries in one dropdown — and the transport is now a stored setting rather than something deduced from which field happened to be filled in. The old rule (a host wins whenever it is not empty) is invisible from the settings page: someone who typed a host months ago and later set a COM port had a radio that never answered and nothing on screen to say why. The third entry is named and refused, with the reason. It is a session with its own framing and login, not the CAT byte stream over a socket, so it has to be written per radio and against one — and a K4 owner reading this list should be told that, not left wondering whether the empty address field was the problem. The upgrade reads an older install from what it has: a configured host means the bridge, which is what the previous code used it for. Pinned by a test, including the case that matters after the fact — choosing USB with a stale host still stored gives the COM port.
This commit is contained in:
+34
@@ -0,0 +1,34 @@
|
||||
package main
|
||||
|
||||
// How a Kenwood-dialect radio is reached.
|
||||
//
|
||||
// Three transports, and they are genuinely different things rather than three
|
||||
// spellings of one: a COM port, the same CAT bytes carried over TCP by a serial
|
||||
// bridge, and the radio's own network protocol — which is a session with its own
|
||||
// framing and authentication, and is not implemented here.
|
||||
//
|
||||
// Kept as an explicit setting rather than inferred from which field an operator
|
||||
// happened to fill in. The old code preferred a network address whenever one was
|
||||
// present, which is invisible from the settings page: someone who typed a host
|
||||
// months ago, then set a COM port, had a radio that never answered and nothing
|
||||
// on screen to explain it.
|
||||
|
||||
const (
|
||||
kenwoodLinkUSB = "usb" // a COM port
|
||||
kenwoodLinkBridge = "bridge" // RS-232 to Ethernet: the same CAT bytes over TCP
|
||||
kenwoodLinkNative = "native" // the radio's own network protocol — not supported
|
||||
)
|
||||
|
||||
// kenwoodLinkOr resolves the stored choice, falling back to what an older
|
||||
// install can be read as: a configured host meant the bridge, because that is
|
||||
// what the previous code used it for.
|
||||
func kenwoodLinkOr(link, host string) string {
|
||||
switch link {
|
||||
case kenwoodLinkUSB, kenwoodLinkBridge, kenwoodLinkNative:
|
||||
return link
|
||||
}
|
||||
if host != "" {
|
||||
return kenwoodLinkBridge
|
||||
}
|
||||
return kenwoodLinkUSB
|
||||
}
|
||||
Reference in New Issue
Block a user