@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 +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"}
|
package/dist/radio/protocol.d.ts
CHANGED
|
@@ -1,79 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
|
|
64
|
-
|
|
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:
|
|
67
|
-
|
|
68
|
-
|
|
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 =
|
|
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
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/radio/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,CAAC;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
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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
|
-
|
|
67
|
-
|
|
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:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
54
|
+
send: RadioByteToken[];
|
|
55
|
+
expect: RadioExpect;
|
|
56
|
+
ack?: RadioExchange;
|
|
57
|
+
timeout?: number;
|
|
73
58
|
};
|
|
74
59
|
}
|
|
75
60
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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 =
|
|
75
|
+
export type RadioProtocolStep = RadioExchange | RadioReadStep | RadioWriteStep;
|