@springfield/ham-radio-utils 2.1.0 → 2.2.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/CHANGELOG.md +9 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/schemas/radio-protocol-schema.json +538 -0
- package/dist/utils/schema-validator.d.ts +10 -0
- package/dist/utils/schema-validator.d.ts.map +1 -0
- package/dist/utils/schema-validator.js +29 -0
- package/dist/utils/schema-validator.js.map +1 -0
- package/dist/utils/ui-logger-factory.d.ts +3 -3
- package/dist/utils/ui-logger-factory.d.ts.map +1 -1
- package/dist/utils/ui-logger-factory.js +13 -13
- package/dist/utils/ui-logger-factory.js.map +1 -1
- package/dist/utils/ui-logger.d.ts.map +1 -1
- package/dist/utils/ui-logger.js +49 -33
- package/dist/utils/ui-logger.js.map +1 -1
- package/package.json +9 -4
- package/src/index.ts +4 -0
- package/src/schemas/radio-protocol-schema.json +538 -0
- package/src/utils/schema-validator.ts +40 -0
- package/src/utils/ui-logger-factory.ts +14 -14
- package/src/utils/ui-logger.ts +62 -33
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [2.2.0](https://gitlab.com/springfield-ham-radio/app/ham-radio-utils/compare/v2.1.0...v2.2.0) (2025-06-24)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add radio protocol schema and schema validation ([af974f1](https://gitlab.com/springfield-ham-radio/app/ham-radio-utils/commit/af974f18fff0ba4bba9d748d1951df4b69bc9310))
|
|
7
|
+
* enhance radio protocol schema with additional fields and validation ([9ad48d7](https://gitlab.com/springfield-ham-radio/app/ham-radio-utils/commit/9ad48d748a7b7a9eb9d4640be081a44a9f74cd4d))
|
|
8
|
+
* update CI configuration, package dependencies, and schema import syntax ([2b0855b](https://gitlab.com/springfield-ham-radio/app/ham-radio-utils/commit/2b0855b78b2fdc1575e612c4027fb7f017e27c98))
|
|
9
|
+
|
|
1
10
|
## [2.1.0](https://gitlab.com/springfield-ham-radio/app/ham-radio-utils/compare/v2.0.2...v2.1.0) (2025-06-21)
|
|
2
11
|
|
|
3
12
|
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,9 @@ export * from './utils/frequency-display.js';
|
|
|
7
7
|
export * from './utils/memory-channel-utils.js';
|
|
8
8
|
export * from './utils/memory-data-utils.js';
|
|
9
9
|
export * from './utils/number-to-bcd.js';
|
|
10
|
+
export * from './utils/schema-validator.js';
|
|
10
11
|
export * from './utils/to-hex-words.js';
|
|
11
12
|
export * from './utils/ui-logger.js';
|
|
12
13
|
export * from './utils/ui-logger-factory.js';
|
|
14
|
+
export { default as radioProtocolSchema } from './schemas/radio-protocol-schema.json';
|
|
13
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAE7C,cAAc,uCAAuC,CAAC;AACtD,cAAc,kDAAkD,CAAC;AAEjE,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAE7C,cAAc,uCAAuC,CAAC;AACtD,cAAc,kDAAkD,CAAC;AAEjE,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAG7C,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,sCAAsC,CAAuB"}
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,10 @@ export * from './utils/frequency-display.js';
|
|
|
7
7
|
export * from './utils/memory-channel-utils.js';
|
|
8
8
|
export * from './utils/memory-data-utils.js';
|
|
9
9
|
export * from './utils/number-to-bcd.js';
|
|
10
|
+
export * from './utils/schema-validator.js';
|
|
10
11
|
export * from './utils/to-hex-words.js';
|
|
11
12
|
export * from './utils/ui-logger.js';
|
|
12
13
|
export * from './utils/ui-logger-factory.js';
|
|
14
|
+
// Export the radio protocol schema
|
|
15
|
+
export { default as radioProtocolSchema } from './schemas/radio-protocol-schema.json' with { type: 'json' };
|
|
13
16
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAE7C,cAAc,uCAAuC,CAAC;AACtD,cAAc,kDAAkD,CAAC;AAEjE,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC","sourcesContent":["export * from './memory/segmented-memory.js';\n\nexport * from './test-utils/radio-channel-factory.js';\nexport * from './test-utils/radio-programmed-channel-factory.js';\n\nexport * from './utils/bcd-to-number.js';\nexport * from './utils/band-plan.js';\nexport * from './utils/frequency-display.js';\nexport * from './utils/memory-channel-utils.js';\nexport * from './utils/memory-data-utils.js';\nexport * from './utils/number-to-bcd.js';\nexport * from './utils/to-hex-words.js';\nexport * from './utils/ui-logger.js';\nexport * from './utils/ui-logger-factory.js';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAE7C,cAAc,uCAAuC,CAAC;AACtD,cAAc,kDAAkD,CAAC;AAEjE,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAE7C,mCAAmC;AACnC,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,sCAAsC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["export * from './memory/segmented-memory.js';\n\nexport * from './test-utils/radio-channel-factory.js';\nexport * from './test-utils/radio-programmed-channel-factory.js';\n\nexport * from './utils/bcd-to-number.js';\nexport * from './utils/band-plan.js';\nexport * from './utils/frequency-display.js';\nexport * from './utils/memory-channel-utils.js';\nexport * from './utils/memory-data-utils.js';\nexport * from './utils/number-to-bcd.js';\nexport * from './utils/schema-validator.js';\nexport * from './utils/to-hex-words.js';\nexport * from './utils/ui-logger.js';\nexport * from './utils/ui-logger-factory.js';\n\n// Export the radio protocol schema\nexport { default as radioProtocolSchema } from './schemas/radio-protocol-schema.json' with { type: 'json' };\n"]}
|
|
@@ -0,0 +1,538 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "Radio Protocol DSL Schema",
|
|
4
|
+
"description": "Schema for defining radio communication protocols in a declarative JSON format",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": [
|
|
7
|
+
"id",
|
|
8
|
+
"version",
|
|
9
|
+
"description",
|
|
10
|
+
"serialConfig",
|
|
11
|
+
"memoryConfig",
|
|
12
|
+
"settingsSchema",
|
|
13
|
+
"readMemory",
|
|
14
|
+
"writeMemory"
|
|
15
|
+
],
|
|
16
|
+
"properties": {
|
|
17
|
+
"id": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"description": "Radio identification information",
|
|
20
|
+
"required": [
|
|
21
|
+
"model",
|
|
22
|
+
"name",
|
|
23
|
+
"manufacturer"
|
|
24
|
+
],
|
|
25
|
+
"properties": {
|
|
26
|
+
"model": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"description": "Radio model identifier"
|
|
29
|
+
},
|
|
30
|
+
"name": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"description": "Human-readable radio name"
|
|
33
|
+
},
|
|
34
|
+
"manufacturer": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"description": "Radio manufacturer name"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"version": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"description": "Version of the radio configuration",
|
|
43
|
+
"pattern": "^\\d+\\.\\d+\\.\\d+$"
|
|
44
|
+
},
|
|
45
|
+
"description": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"description": "Human-readable description of the radio configuration"
|
|
48
|
+
},
|
|
49
|
+
"settingsSchema": {
|
|
50
|
+
"type": "object",
|
|
51
|
+
"description": "Schema definitions for radio settings and channels",
|
|
52
|
+
"required": [
|
|
53
|
+
"model",
|
|
54
|
+
"settingsSchema",
|
|
55
|
+
"channelSchema"
|
|
56
|
+
],
|
|
57
|
+
"properties": {
|
|
58
|
+
"model": {
|
|
59
|
+
"type": "string",
|
|
60
|
+
"description": "Radio model identifier"
|
|
61
|
+
},
|
|
62
|
+
"settingsSchema": {
|
|
63
|
+
"type": "object",
|
|
64
|
+
"description": "JSON schema for radio settings"
|
|
65
|
+
},
|
|
66
|
+
"channelSchema": {
|
|
67
|
+
"type": "object",
|
|
68
|
+
"description": "JSON schema for radio channels"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"serialConfig": {
|
|
73
|
+
"type": "object",
|
|
74
|
+
"description": "Serial port configuration",
|
|
75
|
+
"required": [
|
|
76
|
+
"baudRate"
|
|
77
|
+
],
|
|
78
|
+
"properties": {
|
|
79
|
+
"baudRate": {
|
|
80
|
+
"type": "integer",
|
|
81
|
+
"description": "Serial baud rate",
|
|
82
|
+
"minimum": 1200,
|
|
83
|
+
"maximum": 115200
|
|
84
|
+
},
|
|
85
|
+
"dataBits": {
|
|
86
|
+
"type": "integer",
|
|
87
|
+
"description": "Number of data bits",
|
|
88
|
+
"enum": [
|
|
89
|
+
5,
|
|
90
|
+
6,
|
|
91
|
+
7,
|
|
92
|
+
8
|
|
93
|
+
],
|
|
94
|
+
"default": 8
|
|
95
|
+
},
|
|
96
|
+
"stopBits": {
|
|
97
|
+
"oneOf": [
|
|
98
|
+
{
|
|
99
|
+
"type": "integer",
|
|
100
|
+
"enum": [
|
|
101
|
+
1,
|
|
102
|
+
2
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"type": "number",
|
|
107
|
+
"enum": [
|
|
108
|
+
1.5
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
"description": "Number of stop bits",
|
|
113
|
+
"default": 1
|
|
114
|
+
},
|
|
115
|
+
"parity": {
|
|
116
|
+
"type": "string",
|
|
117
|
+
"enum": [
|
|
118
|
+
"none",
|
|
119
|
+
"even",
|
|
120
|
+
"odd"
|
|
121
|
+
],
|
|
122
|
+
"default": "none"
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
"memoryConfig": {
|
|
127
|
+
"type": "object",
|
|
128
|
+
"description": "Memory configuration for radio segments",
|
|
129
|
+
"required": [
|
|
130
|
+
"chunkSize",
|
|
131
|
+
"segments"
|
|
132
|
+
],
|
|
133
|
+
"properties": {
|
|
134
|
+
"chunkSize": {
|
|
135
|
+
"type": "integer",
|
|
136
|
+
"description": "Size of memory chunks in bytes",
|
|
137
|
+
"minimum": 1
|
|
138
|
+
},
|
|
139
|
+
"segments": {
|
|
140
|
+
"type": "object",
|
|
141
|
+
"description": "Memory segment definitions",
|
|
142
|
+
"additionalProperties": {
|
|
143
|
+
"type": "object",
|
|
144
|
+
"required": [
|
|
145
|
+
"startAddress",
|
|
146
|
+
"endAddress"
|
|
147
|
+
],
|
|
148
|
+
"properties": {
|
|
149
|
+
"startAddress": {
|
|
150
|
+
"type": "integer",
|
|
151
|
+
"description": "Starting address of the memory segment",
|
|
152
|
+
"minimum": 0
|
|
153
|
+
},
|
|
154
|
+
"endAddress": {
|
|
155
|
+
"type": "integer",
|
|
156
|
+
"description": "Ending address (inclusive) of the memory segment",
|
|
157
|
+
"minimum": 0
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"readMemory": {
|
|
165
|
+
"type": "array",
|
|
166
|
+
"description": "Protocol steps for reading memory",
|
|
167
|
+
"items": {
|
|
168
|
+
"$ref": "#/definitions/protocolStep"
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"writeMemory": {
|
|
172
|
+
"type": "array",
|
|
173
|
+
"description": "Protocol steps for writing memory",
|
|
174
|
+
"items": {
|
|
175
|
+
"$ref": "#/definitions/protocolStep"
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"definitions": {
|
|
180
|
+
"protocolStep": {
|
|
181
|
+
"type": "object",
|
|
182
|
+
"description": "A single protocol step",
|
|
183
|
+
"oneOf": [
|
|
184
|
+
{
|
|
185
|
+
"type": "object",
|
|
186
|
+
"required": [
|
|
187
|
+
"sendReceive"
|
|
188
|
+
],
|
|
189
|
+
"properties": {
|
|
190
|
+
"sendReceive": {
|
|
191
|
+
"$ref": "#/definitions/sendReceiveStep"
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"type": "object",
|
|
197
|
+
"required": [
|
|
198
|
+
"send"
|
|
199
|
+
],
|
|
200
|
+
"properties": {
|
|
201
|
+
"send": {
|
|
202
|
+
"$ref": "#/definitions/sendStep"
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"type": "object",
|
|
208
|
+
"required": [
|
|
209
|
+
"receive"
|
|
210
|
+
],
|
|
211
|
+
"properties": {
|
|
212
|
+
"receive": {
|
|
213
|
+
"$ref": "#/definitions/receiveStep"
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"type": "object",
|
|
219
|
+
"required": [
|
|
220
|
+
"readSegment"
|
|
221
|
+
],
|
|
222
|
+
"properties": {
|
|
223
|
+
"readSegment": {
|
|
224
|
+
"$ref": "#/definitions/readSegmentStep"
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"type": "object",
|
|
230
|
+
"required": [
|
|
231
|
+
"writeSegment"
|
|
232
|
+
],
|
|
233
|
+
"properties": {
|
|
234
|
+
"writeSegment": {
|
|
235
|
+
"$ref": "#/definitions/writeSegmentStep"
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"type": "object",
|
|
241
|
+
"required": [
|
|
242
|
+
"setVariable"
|
|
243
|
+
],
|
|
244
|
+
"properties": {
|
|
245
|
+
"setVariable": {
|
|
246
|
+
"$ref": "#/definitions/setVariableStep"
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
]
|
|
251
|
+
},
|
|
252
|
+
"sendReceiveStep": {
|
|
253
|
+
"type": "object",
|
|
254
|
+
"description": "Send data and receive response",
|
|
255
|
+
"required": [
|
|
256
|
+
"send",
|
|
257
|
+
"receive"
|
|
258
|
+
],
|
|
259
|
+
"properties": {
|
|
260
|
+
"send": {
|
|
261
|
+
"$ref": "#/definitions/sendData"
|
|
262
|
+
},
|
|
263
|
+
"receive": {
|
|
264
|
+
"$ref": "#/definitions/receiveConfig"
|
|
265
|
+
},
|
|
266
|
+
"timeout": {
|
|
267
|
+
"type": "integer",
|
|
268
|
+
"description": "Timeout in milliseconds",
|
|
269
|
+
"minimum": 1,
|
|
270
|
+
"default": 5000
|
|
271
|
+
},
|
|
272
|
+
"description": {
|
|
273
|
+
"type": "string",
|
|
274
|
+
"description": "Human-readable description of the step"
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
"sendStep": {
|
|
279
|
+
"type": "object",
|
|
280
|
+
"description": "Send data only",
|
|
281
|
+
"required": [
|
|
282
|
+
"data"
|
|
283
|
+
],
|
|
284
|
+
"properties": {
|
|
285
|
+
"data": {
|
|
286
|
+
"$ref": "#/definitions/sendData"
|
|
287
|
+
},
|
|
288
|
+
"description": {
|
|
289
|
+
"type": "string",
|
|
290
|
+
"description": "Human-readable description of the step"
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
"receiveStep": {
|
|
295
|
+
"type": "object",
|
|
296
|
+
"description": "Receive data only",
|
|
297
|
+
"required": [
|
|
298
|
+
"type",
|
|
299
|
+
"length"
|
|
300
|
+
],
|
|
301
|
+
"properties": {
|
|
302
|
+
"type": {
|
|
303
|
+
"type": "string",
|
|
304
|
+
"enum": [
|
|
305
|
+
"exact",
|
|
306
|
+
"variable",
|
|
307
|
+
"pattern",
|
|
308
|
+
"any"
|
|
309
|
+
],
|
|
310
|
+
"description": "Type of receive operation"
|
|
311
|
+
},
|
|
312
|
+
"value": {
|
|
313
|
+
"type": "integer",
|
|
314
|
+
"description": "Expected value for exact match",
|
|
315
|
+
"minimum": 0,
|
|
316
|
+
"maximum": 255
|
|
317
|
+
},
|
|
318
|
+
"length": {
|
|
319
|
+
"type": "integer",
|
|
320
|
+
"description": "Expected length in bytes",
|
|
321
|
+
"minimum": 1
|
|
322
|
+
},
|
|
323
|
+
"pattern": {
|
|
324
|
+
"type": "array",
|
|
325
|
+
"description": "Pattern for structured responses",
|
|
326
|
+
"items": {
|
|
327
|
+
"oneOf": [
|
|
328
|
+
{
|
|
329
|
+
"type": "string",
|
|
330
|
+
"description": "Literal value (1 byte)"
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
"type": "number",
|
|
334
|
+
"description": "Literal value (1 byte)"
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
"type": "object",
|
|
338
|
+
"required": [
|
|
339
|
+
"field",
|
|
340
|
+
"size"
|
|
341
|
+
],
|
|
342
|
+
"properties": {
|
|
343
|
+
"field": {
|
|
344
|
+
"type": "string",
|
|
345
|
+
"description": "Field name for extracted data"
|
|
346
|
+
},
|
|
347
|
+
"size": {
|
|
348
|
+
"type": "integer",
|
|
349
|
+
"description": "Size in bytes (0 for variable length)",
|
|
350
|
+
"minimum": 0
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
]
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
"description": {
|
|
358
|
+
"type": "string",
|
|
359
|
+
"description": "Human-readable description of the step"
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
},
|
|
363
|
+
"readSegmentStep": {
|
|
364
|
+
"type": "object",
|
|
365
|
+
"description": "Read memory segments",
|
|
366
|
+
"required": [
|
|
367
|
+
"segments",
|
|
368
|
+
"startChunk",
|
|
369
|
+
"endChunk"
|
|
370
|
+
],
|
|
371
|
+
"properties": {
|
|
372
|
+
"segments": {
|
|
373
|
+
"type": "array",
|
|
374
|
+
"description": "List of segment names to read",
|
|
375
|
+
"items": {
|
|
376
|
+
"type": "string"
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
"startChunk": {
|
|
380
|
+
"$ref": "#/definitions/sendReceiveStep",
|
|
381
|
+
"description": "Protocol for starting a chunk read"
|
|
382
|
+
},
|
|
383
|
+
"endChunk": {
|
|
384
|
+
"$ref": "#/definitions/sendReceiveStep",
|
|
385
|
+
"description": "Protocol for ending a chunk read"
|
|
386
|
+
},
|
|
387
|
+
"description": {
|
|
388
|
+
"type": "string",
|
|
389
|
+
"description": "Human-readable description of the step"
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
"writeSegmentStep": {
|
|
394
|
+
"type": "object",
|
|
395
|
+
"description": "Write memory segments",
|
|
396
|
+
"required": [
|
|
397
|
+
"segments",
|
|
398
|
+
"send",
|
|
399
|
+
"data",
|
|
400
|
+
"receive"
|
|
401
|
+
],
|
|
402
|
+
"properties": {
|
|
403
|
+
"segments": {
|
|
404
|
+
"type": "array",
|
|
405
|
+
"description": "List of segment names to write",
|
|
406
|
+
"items": {
|
|
407
|
+
"type": "string"
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
"send": {
|
|
411
|
+
"$ref": "#/definitions/sendData",
|
|
412
|
+
"description": "Data to send for write command"
|
|
413
|
+
},
|
|
414
|
+
"data": {
|
|
415
|
+
"type": "string",
|
|
416
|
+
"description": "Expression for segment data to write"
|
|
417
|
+
},
|
|
418
|
+
"receive": {
|
|
419
|
+
"$ref": "#/definitions/receiveConfig",
|
|
420
|
+
"description": "Expected response for write command"
|
|
421
|
+
},
|
|
422
|
+
"description": {
|
|
423
|
+
"type": "string",
|
|
424
|
+
"description": "Human-readable description of the step"
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
},
|
|
428
|
+
"setVariableStep": {
|
|
429
|
+
"type": "object",
|
|
430
|
+
"description": "Set a variable value",
|
|
431
|
+
"required": [
|
|
432
|
+
"name",
|
|
433
|
+
"value"
|
|
434
|
+
],
|
|
435
|
+
"properties": {
|
|
436
|
+
"name": {
|
|
437
|
+
"type": "string",
|
|
438
|
+
"description": "Variable name"
|
|
439
|
+
},
|
|
440
|
+
"value": {
|
|
441
|
+
"oneOf": [
|
|
442
|
+
{
|
|
443
|
+
"type": "string",
|
|
444
|
+
"description": "Expression or literal value"
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
"type": "number",
|
|
448
|
+
"description": "Numeric value"
|
|
449
|
+
}
|
|
450
|
+
],
|
|
451
|
+
"description": "Value to assign to the variable"
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
},
|
|
455
|
+
"sendData": {
|
|
456
|
+
"type": "array",
|
|
457
|
+
"description": "Array of data to send",
|
|
458
|
+
"items": {
|
|
459
|
+
"oneOf": [
|
|
460
|
+
{
|
|
461
|
+
"type": "string",
|
|
462
|
+
"description": "String literal or expression"
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
"type": "number",
|
|
466
|
+
"description": "Numeric literal or expression",
|
|
467
|
+
"minimum": 0,
|
|
468
|
+
"maximum": 255
|
|
469
|
+
}
|
|
470
|
+
]
|
|
471
|
+
}
|
|
472
|
+
},
|
|
473
|
+
"receiveConfig": {
|
|
474
|
+
"type": "object",
|
|
475
|
+
"description": "Configuration for receiving data",
|
|
476
|
+
"required": [
|
|
477
|
+
"type"
|
|
478
|
+
],
|
|
479
|
+
"properties": {
|
|
480
|
+
"type": {
|
|
481
|
+
"type": "string",
|
|
482
|
+
"enum": [
|
|
483
|
+
"exact",
|
|
484
|
+
"variable",
|
|
485
|
+
"pattern",
|
|
486
|
+
"any"
|
|
487
|
+
],
|
|
488
|
+
"description": "Type of receive operation"
|
|
489
|
+
},
|
|
490
|
+
"value": {
|
|
491
|
+
"type": "integer",
|
|
492
|
+
"description": "Expected value for exact match",
|
|
493
|
+
"minimum": 0,
|
|
494
|
+
"maximum": 255
|
|
495
|
+
},
|
|
496
|
+
"length": {
|
|
497
|
+
"type": "integer",
|
|
498
|
+
"description": "Expected length in bytes",
|
|
499
|
+
"minimum": 1
|
|
500
|
+
},
|
|
501
|
+
"pattern": {
|
|
502
|
+
"type": "array",
|
|
503
|
+
"description": "Pattern for structured responses",
|
|
504
|
+
"items": {
|
|
505
|
+
"oneOf": [
|
|
506
|
+
{
|
|
507
|
+
"type": "string",
|
|
508
|
+
"description": "Literal value (1 byte)"
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
"type": "number",
|
|
512
|
+
"description": "Literal value (1 byte)"
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
"type": "object",
|
|
516
|
+
"required": [
|
|
517
|
+
"field",
|
|
518
|
+
"size"
|
|
519
|
+
],
|
|
520
|
+
"properties": {
|
|
521
|
+
"field": {
|
|
522
|
+
"type": "string",
|
|
523
|
+
"description": "Field name for extracted data"
|
|
524
|
+
},
|
|
525
|
+
"size": {
|
|
526
|
+
"type": "integer",
|
|
527
|
+
"description": "Size in bytes (0 for variable length)",
|
|
528
|
+
"minimum": 0
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
]
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface ValidationResult {
|
|
2
|
+
valid: boolean;
|
|
3
|
+
errors?: string[];
|
|
4
|
+
}
|
|
5
|
+
export declare class SchemaValidator {
|
|
6
|
+
private ajv;
|
|
7
|
+
constructor();
|
|
8
|
+
validateRadioProtocol(config: unknown): ValidationResult;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=schema-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-validator.d.ts","sourceRoot":"","sources":["../../src/utils/schema-validator.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,GAAG,CAAM;;IAUjB,qBAAqB,CAAC,MAAM,EAAE,OAAO,GAAG,gBAAgB;CAmBzD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import Ajv from 'ajv';
|
|
2
|
+
import addFormats from 'ajv-formats';
|
|
3
|
+
import radioProtocolSchema from '../schemas/radio-protocol-schema.json' with { type: 'json' };
|
|
4
|
+
export class SchemaValidator {
|
|
5
|
+
ajv;
|
|
6
|
+
constructor() {
|
|
7
|
+
this.ajv = new Ajv({
|
|
8
|
+
allErrors: true,
|
|
9
|
+
verbose: true,
|
|
10
|
+
});
|
|
11
|
+
addFormats(this.ajv);
|
|
12
|
+
}
|
|
13
|
+
validateRadioProtocol(config) {
|
|
14
|
+
const validate = this.ajv.compile(radioProtocolSchema);
|
|
15
|
+
const valid = validate(config);
|
|
16
|
+
if (valid) {
|
|
17
|
+
return { valid: true };
|
|
18
|
+
}
|
|
19
|
+
const errors = validate.errors?.map((error) => {
|
|
20
|
+
const path = error.instancePath || 'root';
|
|
21
|
+
return `${path}: ${error.message}`;
|
|
22
|
+
}) || [];
|
|
23
|
+
return {
|
|
24
|
+
errors,
|
|
25
|
+
valid: false,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=schema-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-validator.js","sourceRoot":"","sources":["../../src/utils/schema-validator.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,mBAAmB,MAAM,uCAAuC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAO9F,MAAM,OAAO,eAAe;IAClB,GAAG,CAAM;IAEjB;QACE,IAAI,CAAC,GAAG,GAAG,IAAK,GAAW,CAAC;YAC1B,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,IAAI;SACd,CAAC,CAAC;QACF,UAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IAED,qBAAqB,CAAC,MAAe;QACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;QACvD,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;QAE/B,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QAED,MAAM,MAAM,GACV,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,KAAkD,EAAE,EAAE;YAC1E,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,IAAI,MAAM,CAAC;YAC1C,OAAO,GAAG,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;QACrC,CAAC,CAAC,IAAI,EAAE,CAAC;QAEX,OAAO;YACL,MAAM;YACN,KAAK,EAAE,KAAK;SACb,CAAC;IACJ,CAAC;CACF","sourcesContent":["import Ajv from 'ajv';\nimport addFormats from 'ajv-formats';\nimport radioProtocolSchema from '../schemas/radio-protocol-schema.json' with { type: 'json' };\n\nexport interface ValidationResult {\n valid: boolean;\n errors?: string[];\n}\n\nexport class SchemaValidator {\n private ajv: any;\n\n constructor() {\n this.ajv = new (Ajv as any)({\n allErrors: true,\n verbose: true,\n });\n (addFormats as any)(this.ajv);\n }\n\n validateRadioProtocol(config: unknown): ValidationResult {\n const validate = this.ajv.compile(radioProtocolSchema);\n const valid = validate(config);\n\n if (valid) {\n return { valid: true };\n }\n\n const errors =\n validate.errors?.map((error: { instancePath?: string; message?: string }) => {\n const path = error.instancePath || 'root';\n return `${path}: ${error.message}`;\n }) || [];\n\n return {\n errors,\n valid: false,\n };\n }\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { UILogger } from './ui-logger.js';
|
|
2
2
|
export interface UILoggerConfig {
|
|
3
|
-
enableConsoleDebug?: boolean;
|
|
4
3
|
customTransport?: any;
|
|
4
|
+
enableConsoleDebug?: boolean;
|
|
5
5
|
}
|
|
6
|
-
export declare
|
|
7
|
-
export declare
|
|
6
|
+
export declare const createUILogger: (config?: UILoggerConfig) => UILogger;
|
|
7
|
+
export declare const createUILoggerWithCallback: (callback: (logEntry: any) => void, config?: UILoggerConfig) => UILogger;
|
|
8
8
|
//# sourceMappingURL=ui-logger-factory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui-logger-factory.d.ts","sourceRoot":"","sources":["../../src/utils/ui-logger-factory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AA2B1C,MAAM,WAAW,cAAc;IAC7B,
|
|
1
|
+
{"version":3,"file":"ui-logger-factory.d.ts","sourceRoot":"","sources":["../../src/utils/ui-logger-factory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AA2B1C,MAAM,WAAW,cAAc;IAC7B,eAAe,CAAC,EAAE,GAAG,CAAC;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,eAAO,MAAM,cAAc,GAA2B,SAAQ,cAAmB,KAAG,QAYnF,CAAC;AAEF,eAAO,MAAM,0BAA0B,GAAuC,UAAU,CAAC,QAAQ,EAAE,GAAG,KAAK,IAAI,EAAE,SAAQ,cAAmB,KAAG,QAQ9I,CAAC"}
|