- system_config.normalize(): a P25 system with config.mode "conventional"
carries config.channels [{freq MHz, name, nac?}] (1-2, within 1.5 MHz) and
can no longer carry control channels (422). A missing mode is trunked and
passes through untouched, so there is no migration. An analog channel is
mirrored into control_channels for older nodes.
- talkgroups.name_from_system resolves the edge node's synthetic per-channel
id (freq in 100 Hz units) to the channel name.
- The checkin persists radio_channels (conventional channels + encryption).
- Systems editor: Type = P25 trunked / P25 conventional / Analog (NBFM) /
DMR, plus a channel-row editor for conventional and a one-frequency form for
analog. The node page shows conventional channels and an encryption notice.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
60 lines
2.8 KiB
TypeScript
60 lines
2.8 KiB
TypeScript
import type { RadioChannel } from "@/lib/types";
|
|
|
|
// node-26#24. A node on a conventional system reports each channel it
|
|
// decodes and whether the agency encrypts it — the one decode failure nothing
|
|
// on the node can fix, so it has to be said plainly here.
|
|
const ALGIDS: Record<number, string> = {
|
|
0x81: "DES-OFB", 0x83: "Triple DES", 0x84: "AES-256", 0x85: "AES-128",
|
|
0x9f: "DES-XL", 0xa0: "DVI-XL", 0xa1: "DVP-XL", 0xaa: "ADP (RC4)",
|
|
};
|
|
|
|
function mhz(hz: number | null): string {
|
|
return hz ? `${(hz / 1e6).toFixed(4)} MHz` : "";
|
|
}
|
|
|
|
function hex(n: number, width: number): string {
|
|
return n.toString(16).toUpperCase().padStart(width, "0");
|
|
}
|
|
|
|
export function RadioChannels({ channels }: { channels?: RadioChannel[] | null }) {
|
|
if (!channels || channels.length === 0) return null;
|
|
const encrypted = channels.filter((c) => c.encrypted);
|
|
// "Reassign the node" only when nothing in the clear has ever been heard on
|
|
// any channel — `encrypted` alone means the most recent call was.
|
|
const all = encrypted.length === channels.length && channels.every((c) => c.clear_calls === 0);
|
|
const subject = all
|
|
? channels.length === 1 ? "This channel is" : "Every channel is"
|
|
: `${encrypted.length} of ${channels.length} channels ${encrypted.length === 1 ? "is" : "are"} now`;
|
|
return (
|
|
<section>
|
|
<h2 className="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-3">Conventional Channels</h2>
|
|
{encrypted.length > 0 && (
|
|
<p role="status" className="text-xs text-red-300 bg-red-950 border border-red-900 rounded-lg px-3 py-2 mb-3 font-mono">
|
|
{subject} encrypted — those calls can't be decoded, so nothing from{" "}
|
|
{encrypted.length === 1 ? "it" : "them"} is recorded. Nothing to fix on the node
|
|
{all ? "; assign this node a different system." : "; clear calls are still recorded."}
|
|
</p>
|
|
)}
|
|
<ul className="space-y-1 font-mono text-xs">
|
|
{channels.map((c, i) => (
|
|
<li key={i} className="flex flex-wrap gap-x-3 text-gray-300">
|
|
<span className="text-white">{c.name || mhz(c.freq)}</span>
|
|
{c.name && <span className="text-gray-500">{mhz(c.freq)}</span>}
|
|
{c.nac != null && <span className="text-gray-500">NAC {hex(c.nac, 3)}</span>}
|
|
{c.encrypted ? (
|
|
<span className="text-red-400">
|
|
✕ Encrypted{c.algid != null ? ` · ${ALGIDS[c.algid] ?? `ALGID ${hex(c.algid, 2)}`}` : ""}
|
|
{c.keyid != null ? ` · key ${hex(c.keyid, 4)}` : ""}
|
|
</span>
|
|
) : (
|
|
<span className="text-gray-400">
|
|
{c.clear_calls > 0 ? `Clear · ${c.clear_calls} calls heard` : "No traffic heard yet"}
|
|
</span>
|
|
)}
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</section>
|
|
);
|
|
}
|