Drop FX.25 for now

This commit is contained in:
2026-03-12 09:28:53 +01:00
parent 1d78a3ff09
commit 5ece69412e
10 changed files with 282 additions and 77 deletions

View File

@@ -96,4 +96,148 @@ describe('Frame.toHDLC', () => {
expect(unescaped[unescaped.length - 2]).toBe(fcs & 0xff);
expect(unescaped[unescaped.length - 1]).toBe((fcs >> 8) & 0xff);
});
describe('Frame.fromBytes (embedded hex test vectors)', () => {
// Helper to convert hex string to Uint8Array
const hexToBytes = (hex: string): Uint8Array => {
const clean = hex.replace(/[^a-fA-F0-9]/g, '');
const arr = [];
for (let i = 0; i < clean.length; i += 2) {
arr.push(parseInt(clean.slice(i, i + 2), 16));
}
return new Uint8Array(arr);
};
// Common property keys for all vectors
const commonKeys = [
'hex', 'length', 'type', 'source', 'destination', 'repeaters', 'control', 'pid', 'infoHex', 'toString',
];
// Test vectors generated from radio.sample.log
const vectors = [
{
hex: '82a0aa646a9ce09c6cae96b44066aea46c828488e103f03d333734362e34324e3131323232362e30305723207b55495633324e7d0d',
length: 53,
type: 'UnnumberedFrame',
source: 'N6WKZ-3',
destination: 'APU25N-0',
repeaters: ["WR6ABD-0"],
control: 3,
pid: 240,
infoHex: '3d333734362e34324e3131323232362e30305723207b55495633324e7d0d',
infoStr: '=3746.42N112226.00W# {UIV32N}\n',
toString: 'fm N6WKZ-3 to APU25N-0 via WR6ABD-0* ctl UI- pid F0 len=30: =3746.42N112226.00W# {UIV32N}\n',
},
{
hex: '82a0a866626260ae628a94404074ae846ca89aa6ea9c6cb4b04040e6ae92888a6440e103f02f3231303732357a333831342e32394e2f31323233362e3933573e3237352f3030302f413d3030303031332f4544204a20534147',
length: 89,
type: 'UnnumberedFrame',
source: 'W1EJ-10',
destination: 'APT311-0',
repeaters: ["WB6TMS-5","N6ZX-3","WIDE2-0"],
control: 3,
pid: 240,
infoHex: '2f3231303732357a333831342e32394e2f31323233362e3933573e3237352f3030302f413d3030303031332f4544204a20534147',
infoStr: '/210725z3814.29N/12236.93W>275/000/A=000013/ED J SAG',
toString: 'fm W1EJ-10 to APT311-0 via WB6TMS-5,N6ZX-3,WIDE2-0* ctl UI- pid F0 len=52: /210725z3814.29N/12236.93W>275/000/A=000013/ED J SAG',
},
{
hex: '82a09c667262608682a4a69e9c608a86909e4040e09c6cb4b04040e6ae92888a6440e103f021333834312e36384e3131313935392e33365723504847373633362f4e43416e2c54454d506e2f574736442f436172736f6e20506173732c2043412f413d3030383537330d',
length: 106,
type: 'UnnumberedFrame',
source: 'CARSON-0',
destination: 'APN391-0',
repeaters: ["ECHO-0","N6ZX-3","WIDE2-0"],
control: 3,
pid: 240,
infoHex: '21333834312e36384e3131313935392e33365723504847373633362f4e43416e2c54454d506e2f574736442f436172736f6e20506173732c2043412f413d3030383537330d',
infoStr: '!3841.68N111959.36W#PHG7636/NCAn,TEMPn/WG6D/Carson Pass, CA/A=008573\n',
toString: 'fm CARSON-0 to APN391-0 via ECHO-0,N6ZX-3,WIDE2-0* ctl UI- pid F0 len=69: !3841.68N111959.36W#PHG7636/NCAn,TEMPn/WG6D/Carson Pass, CA/A=008573\n',
},
{
hex: '82a0aa646a9ce0968a6c96b29260966ca8aa9e40e69c6cb4b04040e6ae92888a6440e103f0403231303732367a333735312e35334e2f31323031322e3833575f3231332f3030306730303074303633723030307030303050303030683435623130303936415052532f43574f5020576561746865720d',
length: 118,
type: 'UnnumberedFrame',
source: 'KE6KYI-0',
destination: 'APU25N-0',
repeaters: ["K6TUO-3","N6ZX-3","WIDE2-0"],
control: 3,
pid: 240,
infoHex: '403231303732367a333735312e35334e2f31323031322e3833575f3231332f3030306730303074303633723030307030303050303030683435623130303936415052532f43574f5020576561746865720d',
infoStr: '@210726z3751.53N/12012.83W_213/000g000t063r000p000P000h45b10096APRS/CWOP Weather\n',
toString: 'fm KE6KYI-0 to APU25N-0 via K6TUO-3,N6ZX-3,WIDE2-0* ctl UI- pid F0 len=81: @210726z3751.53N/12012.83W_213/000g000t063r000p000P000h45b10096APRS/CWOP Weather\n',
},
{
hex: '66b06aa6a4a460968e6cb498a2788a86909e4040e0ae92888a6240e09c6cb4b04040e6ae92888a6440e103f060305a296c227b6a2f22494e7d',
length: 57,
type: 'UnnumberedFrame',
source: 'KG6ZLQ-12',
destination: '3X5SRR-0',
repeaters: ["ECHO-0","WIDE1-0","N6ZX-3","WIDE2-0"],
control: 3,
pid: 240,
infoHex: '60305a296c227b6a2f22494e7d',
infoStr: '`0Z)l"{j/"IN}',
toString: 'fm KG6ZLQ-12 to 3X5SRR-0 via ECHO-0,WIDE1-0,N6ZX-3,WIDE2-0* ctl UI- pid F0 len=13: `0Z)l"{j/"IN}',
},
{
hex: '82a0a664647060ae6ca6928e4060ae6c86b04040e703f03d333833342e32324e2f31323131382e3336576f504847333344302043616c454d412d4d61746865720d',
length: 65,
type: 'UnnumberedFrame',
source: 'W6SIG-0',
destination: 'APS228-0',
repeaters: ["W6CX-3"],
control: 3,
pid: 240,
infoStr: '=3834.22N/12118.36WoPHG33D0 CalEMA-Mather',
toString: 'fm W6SIG-0 to APS228-0 via W6CX-3* ctl UI- pid F0 len=42: =3834.22N/12118.36WoPHG33D0 CalEMA-Mather',
},
{
hex: 'a66ea6b0aeac6096926c82a69060ae826ca89eaee4ae6c86b04040e6ae92888a64406103f0603234676c201c3e2f272233757d4d542d5254477c25562560276e7c21777755217c33',
length: 72,
type: 'UnnumberedFrame',
source: 'KI6ASH-0',
destination: 'S7SXWV-0',
repeaters: ["WA6TOW-2","W6CX-3","WIDE2-0"],
control: 3,
pid: 240,
infoHex: '603234676c201c3e2f272233757d4d542d5254477c25562560276e7c21777755217c33',
toString: 'fm KI6ASH-0 to S7SXWV-0 via WA6TOW-2,W6CX-3*,WIDE2-0 ctl UI- pid F0 len=35',
},
];
// Tests for each vector: assert properties for parsed frames
vectors.forEach((vector) => {
it(`parses ${vector.toString} (all properties)`, () => {
const buf = hexToBytes(vector.hex);
const frame = Frame.fromBytes(buf);
expect(frame).toBeDefined();
expect(buf.length).toBe(vector.length);
expect(frame.constructor.name).toBe(vector.type);
expect(frame.source.toString()).toBe(vector.source);
expect(frame.destination.toString()).toBe(vector.destination);
if (vector.repeaters && frame.repeaters) {
const printable = vector.repeaters.every(r => /^[\x20-\x7E,]*$/.test(r));
if (printable) {
expect(frame.repeaters.map(d => d.toString())).toEqual(vector.repeaters);
}
}
expect(frame.control).toBe(vector.control);
expect(frame.pid).toBe(vector.pid);
if (vector.infoStr !== undefined) {
const got = new TextDecoder().decode(frame.info).replace(/\r\n?/g, "\n").replace(/\n+$/g, "");
const expected = vector.infoStr.replace(/\r\n?/g, "\n").replace(/\n+$/g, "");
expect(got).toBe(expected);
} else {
expect(Buffer.from(frame.info).toString('hex')).toBe(vector.infoHex);
}
if (vector.toString !== undefined) {
const got = frame.toString().replace(/\r\n?/g, "\n").replace(/\n+$/g, "");
const expected = vector.toString.replace(/\r\n?/g, "\n").replace(/\n+$/g, "");
expect(got).toBe(expected);
}
});
});
});
});