@springfield/ham-radio-api 16.3.4 → 17.0.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.
@@ -1,4 +1,5 @@
1
1
  export interface RadioMemorySegment {
2
+ /** Inclusive end of the segment (a range 0–6143 is 6144 bytes). */
2
3
  endAddress: number;
3
4
  startAddress: number;
4
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"memory-segment.d.ts","sourceRoot":"","sources":["../../src/radio/memory-segment.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB"}
1
+ {"version":3,"file":"memory-segment.d.ts","sourceRoot":"","sources":["../../src/radio/memory-segment.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,mEAAmE;IACnE,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB"}
@@ -1,79 +1,68 @@
1
- export interface RadioExactReceivePattern {
2
- type: "exact";
3
- value: number;
4
- length: number;
1
+ /**
2
+ * A byte in a send or expect array.
3
+ *
4
+ * - number 0–255: literal byte
5
+ * - hex string such as `"0x50"`: literal byte
6
+ * - single-character string such as `"S"`: ASCII opcode
7
+ * - placeholder: `"$address"`, `"$chunkSize"`, `"$length"`, `"$data"`
8
+ */
9
+ export type RadioByteToken = number | string;
10
+ /**
11
+ * Receive any content of a fixed length, such as a radio identifier.
12
+ */
13
+ export interface RadioExpectBytes {
14
+ bytes: number;
5
15
  }
6
- export interface RadioVariableReceivePattern {
7
- type: "variable";
8
- length: number;
9
- }
10
- export interface RadioPatternReceivePattern {
11
- type: "pattern";
12
- pattern: (string | number | {
13
- field: string;
14
- size: number;
15
- })[];
16
- dataLength?: number | string;
17
- }
18
- export interface RadioAnyReceivePattern {
19
- type: "any";
20
- length: number;
21
- }
22
- export type RadioReceivePattern = RadioExactReceivePattern | RadioVariableReceivePattern | RadioPatternReceivePattern | RadioAnyReceivePattern;
23
- export interface RadioSendReceiveStep {
24
- sendReceive: {
25
- send: (string | number)[];
26
- receive: RadioReceivePattern;
27
- timeout?: number;
28
- description?: string;
29
- };
30
- }
31
- export interface RadioSendStep {
32
- send: {
33
- data: (string | number)[];
34
- description?: string;
35
- };
36
- }
37
- export interface RadioReceiveStep {
38
- receive: {
39
- type: "exact" | "variable" | "pattern" | "any";
40
- value?: number;
41
- length: number;
42
- pattern?: (string | number | {
43
- field: string;
44
- size: number;
45
- })[];
46
- description?: string;
47
- };
48
- }
49
- export interface RadioReadSegmentStep {
50
- readSegment: {
16
+ /**
17
+ * Expected serial reply for an exchange.
18
+ *
19
+ * - token: exact 1-byte match (ACK)
20
+ * - token array: exact multi-byte match, or a framed reply with `$` placeholders
21
+ * - `{ bytes: N }`: any N bytes
22
+ */
23
+ export type RadioExpect = RadioByteToken | RadioByteToken[] | RadioExpectBytes;
24
+ /**
25
+ * One serial exchange: send bytes and/or wait for a reply.
26
+ * At least one of `send` or `expect` must be present.
27
+ */
28
+ export type RadioExchange = {
29
+ description?: string;
30
+ send: RadioByteToken[];
31
+ expect?: RadioExpect;
32
+ timeout?: number;
33
+ } | {
34
+ description?: string;
35
+ send?: RadioByteToken[];
36
+ expect: RadioExpect;
37
+ timeout?: number;
38
+ };
39
+ /**
40
+ * Chunked memory read: repeat an exchange across named segments.
41
+ * `$data` in `expect` is captured into the memory buffer.
42
+ * Optional `ack` is a second exchange after each chunk (for example an ACK).
43
+ */
44
+ export interface RadioReadStep {
45
+ description?: string;
46
+ read: {
51
47
  segments: string[];
52
- startChunk: {
53
- send: (string | number)[];
54
- receive: RadioReceivePattern;
55
- };
56
- endChunk: {
57
- send: (string | number)[];
58
- receive: RadioReceivePattern;
59
- };
60
- description?: string;
48
+ send: RadioByteToken[];
49
+ expect: RadioExpect;
50
+ ack?: RadioExchange;
51
+ timeout?: number;
61
52
  };
62
53
  }
63
- export interface RadioWriteSegmentStep {
64
- writeSegment: {
54
+ /**
55
+ * Chunked memory write: repeat an exchange across named segments.
56
+ * `$data` in `send` emits the current chunk from the memory buffer.
57
+ */
58
+ export interface RadioWriteStep {
59
+ description?: string;
60
+ write: {
65
61
  segments: string[];
66
- send: (string | number)[];
67
- data: string;
68
- receive: RadioReceivePattern;
69
- description?: string;
70
- };
71
- }
72
- export interface RadioSetVariableStep {
73
- setVariable: {
74
- name: string;
75
- value: string | number;
62
+ send: RadioByteToken[];
63
+ expect: RadioExpect;
64
+ timeout?: number;
76
65
  };
77
66
  }
78
- export type RadioProtocolStep = RadioSendReceiveStep | RadioSendStep | RadioReceiveStep | RadioReadSegmentStep | RadioWriteSegmentStep | RadioSetVariableStep;
67
+ export type RadioProtocolStep = RadioExchange | RadioReadStep | RadioWriteStep;
79
68
  //# sourceMappingURL=protocol.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/radio/protocol.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;IAC/D,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,mBAAmB,GAAG,wBAAwB,GAAG,2BAA2B,GAAG,0BAA0B,GAAG,sB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AAc,EAAE,CAAC;QACvB,MAAM,EAAE,WAAW,CAAC;QACpB,GAAG,CAAC,EAAE,aAAa,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE;QACL,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,IAAI,EAAE,cAAc,EAAE,CAAC;QACvB,MAAM,EAAE,WAAW,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG,aAAa,GAAG,cAAc,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@springfield/ham-radio-api",
3
- "version": "16.3.4",
3
+ "version": "17.0.0",
4
4
  "author": "Bryan Hunt",
5
5
  "files": [
6
6
  "dist/",
@@ -1,4 +1,5 @@
1
1
  export interface RadioMemorySegment {
2
+ /** Inclusive end of the segment (a range 0–6143 is 6144 bytes). */
2
3
  endAddress: number;
3
4
  startAddress: number;
4
5
  }
@@ -1,83 +1,75 @@
1
- export interface RadioExactReceivePattern {
2
- type: "exact";
3
- value: number;
4
- length: number;
5
- }
6
-
7
- export interface RadioVariableReceivePattern {
8
- type: "variable";
9
- length: number;
10
- }
11
-
12
- export interface RadioPatternReceivePattern {
13
- type: "pattern";
14
- pattern: (string | number | { field: string; size: number })[];
15
- dataLength?: number | string; // Optional - actual length determined by segment configuration
16
- }
17
-
18
- export interface RadioAnyReceivePattern {
19
- type: "any";
20
- length: number;
21
- }
22
-
23
- export type RadioReceivePattern = RadioExactReceivePattern | RadioVariableReceivePattern | RadioPatternReceivePattern | RadioAnyReceivePattern;
24
-
25
- export interface RadioSendReceiveStep {
26
- sendReceive: {
27
- send: (string | number)[];
28
- receive: RadioReceivePattern;
29
- timeout?: number;
30
- description?: string;
31
- };
32
- }
1
+ /**
2
+ * A byte in a send or expect array.
3
+ *
4
+ * - number 0–255: literal byte
5
+ * - hex string such as `"0x50"`: literal byte
6
+ * - single-character string such as `"S"`: ASCII opcode
7
+ * - placeholder: `"$address"`, `"$chunkSize"`, `"$length"`, `"$data"`
8
+ */
9
+ export type RadioByteToken = number | string;
33
10
 
34
- export interface RadioSendStep {
35
- send: {
36
- data: (string | number)[];
37
- description?: string;
38
- };
11
+ /**
12
+ * Receive any content of a fixed length, such as a radio identifier.
13
+ */
14
+ export interface RadioExpectBytes {
15
+ bytes: number;
39
16
  }
40
17
 
41
- export interface RadioReceiveStep {
42
- receive: {
43
- type: "exact" | "variable" | "pattern" | "any";
44
- value?: number;
45
- length: number;
46
- pattern?: (string | number | { field: string; size: number })[];
47
- description?: string;
48
- };
49
- }
18
+ /**
19
+ * Expected serial reply for an exchange.
20
+ *
21
+ * - token: exact 1-byte match (ACK)
22
+ * - token array: exact multi-byte match, or a framed reply with `$` placeholders
23
+ * - `{ bytes: N }`: any N bytes
24
+ */
25
+ export type RadioExpect = RadioByteToken | RadioByteToken[] | RadioExpectBytes;
50
26
 
51
- export interface RadioReadSegmentStep {
52
- readSegment: {
53
- segments: string[];
54
- startChunk: {
55
- send: (string | number)[];
56
- receive: RadioReceivePattern;
57
- };
58
- endChunk: {
59
- send: (string | number)[];
60
- receive: RadioReceivePattern;
27
+ /**
28
+ * One serial exchange: send bytes and/or wait for a reply.
29
+ * At least one of `send` or `expect` must be present.
30
+ */
31
+ export type RadioExchange =
32
+ | {
33
+ description?: string;
34
+ send: RadioByteToken[];
35
+ expect?: RadioExpect;
36
+ timeout?: number;
37
+ }
38
+ | {
39
+ description?: string;
40
+ send?: RadioByteToken[];
41
+ expect: RadioExpect;
42
+ timeout?: number;
61
43
  };
62
- description?: string;
63
- };
64
- }
65
44
 
66
- export interface RadioWriteSegmentStep {
67
- writeSegment: {
45
+ /**
46
+ * Chunked memory read: repeat an exchange across named segments.
47
+ * `$data` in `expect` is captured into the memory buffer.
48
+ * Optional `ack` is a second exchange after each chunk (for example an ACK).
49
+ */
50
+ export interface RadioReadStep {
51
+ description?: string;
52
+ read: {
68
53
  segments: string[];
69
- send: (string | number)[];
70
- data: string;
71
- receive: RadioReceivePattern;
72
- description?: string;
54
+ send: RadioByteToken[];
55
+ expect: RadioExpect;
56
+ ack?: RadioExchange;
57
+ timeout?: number;
73
58
  };
74
59
  }
75
60
 
76
- export interface RadioSetVariableStep {
77
- setVariable: {
78
- name: string;
79
- value: string | number;
61
+ /**
62
+ * Chunked memory write: repeat an exchange across named segments.
63
+ * `$data` in `send` emits the current chunk from the memory buffer.
64
+ */
65
+ export interface RadioWriteStep {
66
+ description?: string;
67
+ write: {
68
+ segments: string[];
69
+ send: RadioByteToken[];
70
+ expect: RadioExpect;
71
+ timeout?: number;
80
72
  };
81
73
  }
82
74
 
83
- export type RadioProtocolStep = RadioSendReceiveStep | RadioSendStep | RadioReceiveStep | RadioReadSegmentStep | RadioWriteSegmentStep | RadioSetVariableStep;
75
+ export type RadioProtocolStep = RadioExchange | RadioReadStep | RadioWriteStep;