@springfield/ham-radio-api 17.4.0 → 17.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/radio/protocol.d.ts +45 -2
- package/dist/radio/protocol.d.ts.map +1 -1
- package/dist/radio/serial-config.d.ts +29 -0
- package/dist/radio/serial-config.d.ts.map +1 -1
- package/dist/radio/serial-config.js +12 -1
- package/dist/radio/serial-config.js.map +1 -1
- package/package.json +1 -1
- package/src/radio/protocol.ts +50 -2
- package/src/radio/serial-config.ts +36 -0
package/dist/radio/protocol.d.ts
CHANGED
|
@@ -14,14 +14,39 @@ export type RadioByteToken = number | string;
|
|
|
14
14
|
export interface RadioExpectBytes {
|
|
15
15
|
bytes: number;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Read until a delimiter byte. Used for Kenwood live CAT lines ending in CR.
|
|
19
|
+
*/
|
|
20
|
+
export interface RadioExpectUntil {
|
|
21
|
+
until: RadioByteToken;
|
|
22
|
+
}
|
|
17
23
|
/**
|
|
18
24
|
* Expected serial reply for an exchange.
|
|
19
25
|
*
|
|
20
26
|
* - token: exact 1-byte match (ACK)
|
|
21
27
|
* - token array: exact multi-byte match, or a framed reply with `$` placeholders
|
|
22
28
|
* - `{ bytes: N }`: any N bytes
|
|
29
|
+
* - `{ until: token }`: variable-length reply ending at the delimiter (the delimiter is not included)
|
|
30
|
+
*/
|
|
31
|
+
export type RadioExpect = RadioByteToken | RadioByteToken[] | RadioExpectBytes | RadioExpectUntil;
|
|
32
|
+
/**
|
|
33
|
+
* Packer that converts live CAT replies into a logical memory-map record.
|
|
34
|
+
* `kenwood-th-f6` parses `MR`/`MNA` CSV into the 32-byte TH-F6 channel image.
|
|
23
35
|
*/
|
|
24
|
-
export type
|
|
36
|
+
export type RadioCatPack = "kenwood-th-f6";
|
|
37
|
+
/**
|
|
38
|
+
* Live CAT memory loop: one logical record per channel index, not clone blocks.
|
|
39
|
+
*/
|
|
40
|
+
export interface RadioCatMemoryConfig {
|
|
41
|
+
segment: string;
|
|
42
|
+
count: number;
|
|
43
|
+
recordSize: number;
|
|
44
|
+
pack: RadioCatPack;
|
|
45
|
+
indexWidth?: number;
|
|
46
|
+
emptyByte?: number;
|
|
47
|
+
timeout?: number;
|
|
48
|
+
interCommandDelayMs?: number;
|
|
49
|
+
}
|
|
25
50
|
/**
|
|
26
51
|
* One serial exchange: send bytes and/or wait for a reply, and/or change baud.
|
|
27
52
|
* At least one of `send`, `expect`, or `setBaudRate` must be present.
|
|
@@ -31,6 +56,10 @@ export interface RadioExchange {
|
|
|
31
56
|
send?: RadioByteToken[];
|
|
32
57
|
expect?: RadioExpect;
|
|
33
58
|
timeout?: number;
|
|
59
|
+
/**
|
|
60
|
+
* Milliseconds to wait after send (Kenwood CAT wake CR before ID).
|
|
61
|
+
*/
|
|
62
|
+
delay?: number;
|
|
34
63
|
/**
|
|
35
64
|
* Switch the serial baud rate before send/expect. TH-D74 clone mode
|
|
36
65
|
* enters programming at 9600 then transfers at 57600.
|
|
@@ -72,5 +101,19 @@ export interface RadioWriteStep {
|
|
|
72
101
|
skip?: RadioMemorySegment[];
|
|
73
102
|
};
|
|
74
103
|
}
|
|
75
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Read memories with live CAT commands (Kenwood TH-F6 `MR`/`MNA`).
|
|
106
|
+
*/
|
|
107
|
+
export interface RadioCatReadStep {
|
|
108
|
+
description?: string;
|
|
109
|
+
catRead: RadioCatMemoryConfig;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Write memories with live CAT commands (Kenwood TH-F6 `MW`/`MNA`).
|
|
113
|
+
*/
|
|
114
|
+
export interface RadioCatWriteStep {
|
|
115
|
+
description?: string;
|
|
116
|
+
catWrite: RadioCatMemoryConfig;
|
|
117
|
+
}
|
|
118
|
+
export type RadioProtocolStep = RadioExchange | RadioReadStep | RadioWriteStep | RadioCatReadStep | RadioCatWriteStep;
|
|
76
119
|
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/radio/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9D;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;CACf;AAED
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/radio/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9D;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,cAAc,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,cAAc,GAAG,cAAc,EAAE,GAAG,gBAAgB,GAAG,gBAAgB,CAAC;AAElG;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,eAAe,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,YAAY,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,WAAW,CAAC,EAAE,MA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|
|
1
1
|
export interface RadioSerialConfig {
|
|
2
|
+
/**
|
|
3
|
+
* Default baud rate used to open the programming port.
|
|
4
|
+
*
|
|
5
|
+
* When `baudRates` is listed, this must be one of those values. HamBench
|
|
6
|
+
* selects it automatically unless the user previously chose another rate
|
|
7
|
+
* for the same radio.
|
|
8
|
+
*/
|
|
2
9
|
baudRate: number;
|
|
10
|
+
/**
|
|
11
|
+
* Baud rates the radio's programming port accepts.
|
|
12
|
+
*
|
|
13
|
+
* Omit when only `baudRate` is valid. HamBench shows a baud selector on
|
|
14
|
+
* import and write when this list has more than one value.
|
|
15
|
+
*/
|
|
16
|
+
baudRates?: number[];
|
|
3
17
|
dataBits?: 8 | 5 | 6 | 7;
|
|
4
18
|
stopBits?: 1 | 1.5 | 2;
|
|
5
19
|
parity?: "none" | "even" | "odd";
|
|
@@ -7,5 +21,20 @@ export interface RadioSerialConfig {
|
|
|
7
21
|
* Hardware RTS/CTS flow control. Kenwood TH-D74 clone mode needs this on macOS.
|
|
8
22
|
*/
|
|
9
23
|
rtscts?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Explicit RTS line. TH-F6 live CAT needs this false; omit to keep RTS asserted.
|
|
26
|
+
*/
|
|
27
|
+
rts?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Explicit DTR line. Omit to keep DTR asserted after open.
|
|
30
|
+
*/
|
|
31
|
+
dtr?: boolean;
|
|
10
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Baud rates the programming port may be opened at.
|
|
35
|
+
*
|
|
36
|
+
* Uses `baudRates` when the radio lists them; otherwise the single `baudRate`
|
|
37
|
+
* default is the only option.
|
|
38
|
+
*/
|
|
39
|
+
export declare function programmingPortBaudRates(config: RadioSerialConfig): number[];
|
|
11
40
|
//# sourceMappingURL=serial-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serial-config.d.ts","sourceRoot":"","sources":["../../src/radio/serial-config.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;IACjC;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"serial-config.d.ts","sourceRoot":"","sources":["../../src/radio/serial-config.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;IACjC;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IACd;;OAEG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,EAAE,CAM5E"}
|
|
@@ -1,2 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Baud rates the programming port may be opened at.
|
|
3
|
+
*
|
|
4
|
+
* Uses `baudRates` when the radio lists them; otherwise the single `baudRate`
|
|
5
|
+
* default is the only option.
|
|
6
|
+
*/
|
|
7
|
+
export function programmingPortBaudRates(config) {
|
|
8
|
+
if (config.baudRates && config.baudRates.length > 0) {
|
|
9
|
+
return [...config.baudRates];
|
|
10
|
+
}
|
|
11
|
+
return [config.baudRate];
|
|
12
|
+
}
|
|
2
13
|
//# sourceMappingURL=serial-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serial-config.js","sourceRoot":"","sources":["../../src/radio/serial-config.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"serial-config.js","sourceRoot":"","sources":["../../src/radio/serial-config.ts"],"names":[],"mappings":"AAiCA;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAAyB;IAChE,IAAI,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpD,OAAO,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC;IAED,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC3B,CAAC"}
|
package/package.json
CHANGED
package/src/radio/protocol.ts
CHANGED
|
@@ -17,14 +17,42 @@ export interface RadioExpectBytes {
|
|
|
17
17
|
bytes: number;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Read until a delimiter byte. Used for Kenwood live CAT lines ending in CR.
|
|
22
|
+
*/
|
|
23
|
+
export interface RadioExpectUntil {
|
|
24
|
+
until: RadioByteToken;
|
|
25
|
+
}
|
|
26
|
+
|
|
20
27
|
/**
|
|
21
28
|
* Expected serial reply for an exchange.
|
|
22
29
|
*
|
|
23
30
|
* - token: exact 1-byte match (ACK)
|
|
24
31
|
* - token array: exact multi-byte match, or a framed reply with `$` placeholders
|
|
25
32
|
* - `{ bytes: N }`: any N bytes
|
|
33
|
+
* - `{ until: token }`: variable-length reply ending at the delimiter (the delimiter is not included)
|
|
34
|
+
*/
|
|
35
|
+
export type RadioExpect = RadioByteToken | RadioByteToken[] | RadioExpectBytes | RadioExpectUntil;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Packer that converts live CAT replies into a logical memory-map record.
|
|
39
|
+
* `kenwood-th-f6` parses `MR`/`MNA` CSV into the 32-byte TH-F6 channel image.
|
|
40
|
+
*/
|
|
41
|
+
export type RadioCatPack = "kenwood-th-f6";
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Live CAT memory loop: one logical record per channel index, not clone blocks.
|
|
26
45
|
*/
|
|
27
|
-
export
|
|
46
|
+
export interface RadioCatMemoryConfig {
|
|
47
|
+
segment: string;
|
|
48
|
+
count: number;
|
|
49
|
+
recordSize: number;
|
|
50
|
+
pack: RadioCatPack;
|
|
51
|
+
indexWidth?: number;
|
|
52
|
+
emptyByte?: number;
|
|
53
|
+
timeout?: number;
|
|
54
|
+
interCommandDelayMs?: number;
|
|
55
|
+
}
|
|
28
56
|
|
|
29
57
|
/**
|
|
30
58
|
* One serial exchange: send bytes and/or wait for a reply, and/or change baud.
|
|
@@ -35,6 +63,10 @@ export interface RadioExchange {
|
|
|
35
63
|
send?: RadioByteToken[];
|
|
36
64
|
expect?: RadioExpect;
|
|
37
65
|
timeout?: number;
|
|
66
|
+
/**
|
|
67
|
+
* Milliseconds to wait after send (Kenwood CAT wake CR before ID).
|
|
68
|
+
*/
|
|
69
|
+
delay?: number;
|
|
38
70
|
/**
|
|
39
71
|
* Switch the serial baud rate before send/expect. TH-D74 clone mode
|
|
40
72
|
* enters programming at 9600 then transfers at 57600.
|
|
@@ -79,4 +111,20 @@ export interface RadioWriteStep {
|
|
|
79
111
|
};
|
|
80
112
|
}
|
|
81
113
|
|
|
82
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Read memories with live CAT commands (Kenwood TH-F6 `MR`/`MNA`).
|
|
116
|
+
*/
|
|
117
|
+
export interface RadioCatReadStep {
|
|
118
|
+
description?: string;
|
|
119
|
+
catRead: RadioCatMemoryConfig;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Write memories with live CAT commands (Kenwood TH-F6 `MW`/`MNA`).
|
|
124
|
+
*/
|
|
125
|
+
export interface RadioCatWriteStep {
|
|
126
|
+
description?: string;
|
|
127
|
+
catWrite: RadioCatMemoryConfig;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export type RadioProtocolStep = RadioExchange | RadioReadStep | RadioWriteStep | RadioCatReadStep | RadioCatWriteStep;
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
export interface RadioSerialConfig {
|
|
2
|
+
/**
|
|
3
|
+
* Default baud rate used to open the programming port.
|
|
4
|
+
*
|
|
5
|
+
* When `baudRates` is listed, this must be one of those values. HamBench
|
|
6
|
+
* selects it automatically unless the user previously chose another rate
|
|
7
|
+
* for the same radio.
|
|
8
|
+
*/
|
|
2
9
|
baudRate: number;
|
|
10
|
+
/**
|
|
11
|
+
* Baud rates the radio's programming port accepts.
|
|
12
|
+
*
|
|
13
|
+
* Omit when only `baudRate` is valid. HamBench shows a baud selector on
|
|
14
|
+
* import and write when this list has more than one value.
|
|
15
|
+
*/
|
|
16
|
+
baudRates?: number[];
|
|
3
17
|
dataBits?: 8 | 5 | 6 | 7;
|
|
4
18
|
stopBits?: 1 | 1.5 | 2;
|
|
5
19
|
parity?: "none" | "even" | "odd";
|
|
@@ -7,4 +21,26 @@ export interface RadioSerialConfig {
|
|
|
7
21
|
* Hardware RTS/CTS flow control. Kenwood TH-D74 clone mode needs this on macOS.
|
|
8
22
|
*/
|
|
9
23
|
rtscts?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Explicit RTS line. TH-F6 live CAT needs this false; omit to keep RTS asserted.
|
|
26
|
+
*/
|
|
27
|
+
rts?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Explicit DTR line. Omit to keep DTR asserted after open.
|
|
30
|
+
*/
|
|
31
|
+
dtr?: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Baud rates the programming port may be opened at.
|
|
36
|
+
*
|
|
37
|
+
* Uses `baudRates` when the radio lists them; otherwise the single `baudRate`
|
|
38
|
+
* default is the only option.
|
|
39
|
+
*/
|
|
40
|
+
export function programmingPortBaudRates(config: RadioSerialConfig): number[] {
|
|
41
|
+
if (config.baudRates && config.baudRates.length > 0) {
|
|
42
|
+
return [...config.baudRates];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return [config.baudRate];
|
|
10
46
|
}
|