@springfield/ham-radio-utils 1.2.0 → 2.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.
Files changed (64) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/db/bands.json +46 -2
  3. package/dist/db/license-classes.json +4 -0
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +1 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/memory/segmented-memory.d.ts +1 -1
  9. package/dist/memory/segmented-memory.d.ts.map +1 -1
  10. package/dist/memory/segmented-memory.js +2 -2
  11. package/dist/memory/segmented-memory.js.map +1 -1
  12. package/dist/test-utils/radio-channel-factory.d.ts +2 -2
  13. package/dist/test-utils/radio-channel-factory.d.ts.map +1 -1
  14. package/dist/test-utils/radio-channel-factory.js +6 -6
  15. package/dist/test-utils/radio-channel-factory.js.map +1 -1
  16. package/dist/test-utils/radio-programmed-channel-factory.d.ts +1 -1
  17. package/dist/test-utils/radio-programmed-channel-factory.d.ts.map +1 -1
  18. package/dist/test-utils/radio-programmed-channel-factory.js.map +1 -1
  19. package/dist/utils/band-plan.d.ts +1 -1
  20. package/dist/utils/band-plan.d.ts.map +1 -1
  21. package/dist/utils/band-plan.js.map +1 -1
  22. package/dist/utils/bcd-to-number.d.ts +1 -1
  23. package/dist/utils/bcd-to-number.d.ts.map +1 -1
  24. package/dist/utils/bcd-to-number.js +2 -2
  25. package/dist/utils/bcd-to-number.js.map +1 -1
  26. package/dist/utils/frequency-display.d.ts +2 -2
  27. package/dist/utils/frequency-display.d.ts.map +1 -1
  28. package/dist/utils/frequency-display.js +2 -2
  29. package/dist/utils/frequency-display.js.map +1 -1
  30. package/dist/utils/memory-channel-utils.d.ts +1 -1
  31. package/dist/utils/memory-channel-utils.d.ts.map +1 -1
  32. package/dist/utils/memory-channel-utils.js +2 -2
  33. package/dist/utils/memory-channel-utils.js.map +1 -1
  34. package/dist/utils/memory-data-utils.d.ts +2 -0
  35. package/dist/utils/memory-data-utils.d.ts.map +1 -0
  36. package/dist/utils/memory-data-utils.js +6 -0
  37. package/dist/utils/memory-data-utils.js.map +1 -0
  38. package/dist/utils/memory-segment-utils.d.ts +2 -2
  39. package/dist/utils/memory-segment-utils.d.ts.map +1 -1
  40. package/dist/utils/memory-segment-utils.js +2 -2
  41. package/dist/utils/memory-segment-utils.js.map +1 -1
  42. package/dist/utils/number-to-bcd.d.ts +1 -1
  43. package/dist/utils/number-to-bcd.d.ts.map +1 -1
  44. package/dist/utils/number-to-bcd.js +3 -3
  45. package/dist/utils/number-to-bcd.js.map +1 -1
  46. package/dist/utils/to-hex-words.d.ts +1 -1
  47. package/dist/utils/to-hex-words.d.ts.map +1 -1
  48. package/dist/utils/to-hex-words.js +3 -3
  49. package/dist/utils/to-hex-words.js.map +1 -1
  50. package/package.json +6 -3
  51. package/src/db/bands.json +46 -2
  52. package/src/db/license-classes.json +4 -0
  53. package/src/index.ts +1 -1
  54. package/src/memory/segmented-memory.ts +3 -3
  55. package/src/test-utils/radio-channel-factory.ts +7 -7
  56. package/src/test-utils/radio-programmed-channel-factory.ts +1 -1
  57. package/src/utils/band-plan.ts +1 -1
  58. package/src/utils/bcd-to-number.ts +2 -2
  59. package/src/utils/frequency-display.ts +3 -3
  60. package/src/utils/memory-channel-utils.ts +2 -2
  61. package/src/utils/memory-data-utils.ts +6 -0
  62. package/src/utils/number-to-bcd.ts +3 -3
  63. package/src/utils/to-hex-words.ts +3 -3
  64. package/src/utils/memory-segment-utils.ts +0 -7
package/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## [2.0.0](https://gitlab.com/springfield-ham-radio/app/ham-radio-utils/compare/v1.3.0...v2.0.0) (2025-06-14)
2
+
3
+
4
+ ### ⚠ BREAKING CHANGES
5
+
6
+ * update memory utilities and fix segment address check
7
+
8
+ ### Features
9
+
10
+ * update memory utilities and fix segment address check ([12228b1](https://gitlab.com/springfield-ham-radio/app/ham-radio-utils/commit/12228b1e9c2031cc62ed2e340f729ca0f0d21e13))
11
+
12
+ ## [1.3.0](https://gitlab.com/springfield-ham-radio/app/ham-radio-utils/compare/v1.2.0...v1.3.0) (2025-05-31)
13
+
14
+
15
+ ### Features
16
+
17
+ * add weather radio ([ba29ee0](https://gitlab.com/springfield-ham-radio/app/ham-radio-utils/commit/ba29ee0746625f513ed02d7a295d515f1bb25ea6))
18
+
1
19
  ## [1.2.0](https://gitlab.com/springfield-ham-radio/app/ham-radio-utils/compare/v1.1.0...v1.2.0) (2025-05-31)
2
20
 
3
21
 
@@ -201,7 +201,8 @@
201
201
  "frequencyDisplayBaseMultiplier": 1000000,
202
202
  "frequencyDisplayNumberDecimals": 4,
203
203
  "privileges": [
204
- "27659a6b-78b6-47b1-8f91-f238ffd5ebcd"
204
+ "27659a6b-78b6-47b1-8f91-f238ffd5ebcd",
205
+ "a1a391d0-3708-4a26-94d3-00c07346b69b"
205
206
  ],
206
207
  "channels": [
207
208
  {
@@ -275,7 +276,8 @@
275
276
  "frequencyDisplayBaseMultiplier": 1000000,
276
277
  "frequencyDisplayNumberDecimals": 4,
277
278
  "privileges": [
278
- "27659a6b-78b6-47b1-8f91-f238ffd5ebcd"
279
+ "27659a6b-78b6-47b1-8f91-f238ffd5ebcd",
280
+ "a1a391d0-3708-4a26-94d3-00c07346b69b"
279
281
  ],
280
282
  "channels": [
281
283
  {
@@ -307,5 +309,47 @@
307
309
  "frequency": 467712500
308
310
  }
309
311
  ]
312
+ },
313
+ {
314
+ "id": "37240987-0f63-4ed2-bfbd-9c2e13c4bb5b",
315
+ "name": "Weather Radio",
316
+ "wavelength": 1.85,
317
+ "lowerFrequency": 162400000,
318
+ "upperFrequency": 162550000,
319
+ "frequencyDisplayBaseMultiplier": 1000000,
320
+ "frequencyDisplayNumberDecimals": 3,
321
+ "privileges": [
322
+ "9689b06f-dfb0-4ae6-8fdc-f9a4e6e1b88e"
323
+ ],
324
+ "channels": [
325
+ {
326
+ "name": "WX1",
327
+ "frequency": 162550000
328
+ },
329
+ {
330
+ "name": "WX2",
331
+ "frequency": 162400000
332
+ },
333
+ {
334
+ "name": "WX3",
335
+ "frequency": 62475000
336
+ },
337
+ {
338
+ "name": "WX4",
339
+ "frequency": 162425000
340
+ },
341
+ {
342
+ "name": "WX5",
343
+ "frequency": 162450000
344
+ },
345
+ {
346
+ "name": "WX6",
347
+ "frequency": 162500000
348
+ },
349
+ {
350
+ "name": "WX7",
351
+ "frequency": 162525000
352
+ }
353
+ ]
310
354
  }
311
355
  ]
@@ -26,5 +26,9 @@
26
26
  {
27
27
  "id": "a1a391d0-3708-4a26-94d3-00c07346b69b",
28
28
  "name": "FRS"
29
+ },
30
+ {
31
+ "id": "9689b06f-dfb0-4ae6-8fdc-f9a4e6e1b88e",
32
+ "name": "Weather Radio"
29
33
  }
30
34
  ]
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ export * from './utils/bcd-to-number.js';
5
5
  export * from './utils/band-plan.js';
6
6
  export * from './utils/frequency-display.js';
7
7
  export * from './utils/memory-channel-utils.js';
8
- export * from './utils/memory-segment-utils.js';
8
+ export * from './utils/memory-data-utils.js';
9
9
  export * from './utils/number-to-bcd.js';
10
10
  export * from './utils/to-hex-words.js';
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -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,iCAAiC,CAAC;AAChD,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,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,yBAAyB,CAAC"}
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ export * from './utils/bcd-to-number.js';
5
5
  export * from './utils/band-plan.js';
6
6
  export * from './utils/frequency-display.js';
7
7
  export * from './utils/memory-channel-utils.js';
8
- export * from './utils/memory-segment-utils.js';
8
+ export * from './utils/memory-data-utils.js';
9
9
  export * from './utils/number-to-bcd.js';
10
10
  export * from './utils/to-hex-words.js';
11
11
  //# 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,iCAAiC,CAAC;AAChD,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,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-segment-utils.js';\nexport * from './utils/number-to-bcd.js';\nexport * from './utils/to-hex-words.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,yBAAyB,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';\n"]}
@@ -1,4 +1,4 @@
1
- import { RadioMemorySegment } from '@springfield/ham-radio-api';
1
+ import type { RadioMemorySegment } from '@springfield/ham-radio-api';
2
2
  export declare class RadioSegmentedMemory {
3
3
  private segments;
4
4
  constructor(segments?: RadioMemorySegment[]);
@@ -1 +1 @@
1
- {"version":3,"file":"segmented-memory.d.ts","sourceRoot":"","sources":["../../src/memory/segmented-memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAkC;gBAEtC,QAAQ,CAAC,EAAE,kBAAkB,EAAE;IAUpC,UAAU,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI;IAI7C,WAAW,IAAI,gBAAgB,CAAC,kBAAkB,CAAC;IAInD,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAIhE,YAAY,IAAI,MAAM;IAItB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAiB5D,OAAO,IAAI,kBAAkB,EAAE;CAGvC"}
1
+ {"version":3,"file":"segmented-memory.d.ts","sourceRoot":"","sources":["../../src/memory/segmented-memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAkC;gBAEtC,QAAQ,CAAC,EAAE,kBAAkB,EAAE;IAUpC,UAAU,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI;IAI7C,WAAW,IAAI,gBAAgB,CAAC,kBAAkB,CAAC;IAInD,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAIhE,YAAY,IAAI,MAAM;IAItB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAiB5D,OAAO,IAAI,kBAAkB,EAAE;CAGvC"}
@@ -25,7 +25,7 @@ export class RadioSegmentedMemory {
25
25
  let result = iterator.next();
26
26
  while (!result.done) {
27
27
  const segment = result.value;
28
- if (segment.startAddress <= address && segment.startAddress + segment.length > address) {
28
+ if (segment.startAddress <= address && segment.endAddress > address) {
29
29
  return segment;
30
30
  }
31
31
  result = iterator.next();
@@ -33,7 +33,7 @@ export class RadioSegmentedMemory {
33
33
  return undefined;
34
34
  }
35
35
  toArray() {
36
- return Array.from(this.segments.values());
36
+ return [...this.segments.values()];
37
37
  }
38
38
  }
39
39
  //# sourceMappingURL=segmented-memory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"segmented-memory.js","sourceRoot":"","sources":["../../src/memory/segmented-memory.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,oBAAoB;IACvB,QAAQ,CAAkC;IAElD,YAAY,QAA+B;QACzC,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAC;QAE1B,IAAI,QAAQ,IAAI,SAAS,EAAE,CAAC;YAC1B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;gBAC/B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;IACH,CAAC;IAEM,UAAU,CAAC,OAA2B;QAC3C,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;IAEM,WAAW;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;IAChC,CAAC;IAEM,UAAU,CAAC,YAAoB;QACpC,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACzC,CAAC;IAEM,YAAY;QACjB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC5B,CAAC;IAEM,WAAW,CAAC,OAAe;QAChC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;QACxC,IAAI,MAAM,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;QAE7B,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACpB,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC;YAE7B,IAAI,OAAO,CAAC,YAAY,IAAI,OAAO,IAAI,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC,MAAM,GAAG,OAAO,EAAE,CAAC;gBACvF,OAAO,OAAO,CAAC;YACjB,CAAC;YAED,MAAM,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC3B,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAEM,OAAO;QACZ,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5C,CAAC;CACF","sourcesContent":["import { RadioMemorySegment } from '@springfield/ham-radio-api';\n\nexport class RadioSegmentedMemory {\n private segments: Map<number, RadioMemorySegment>;\n\n constructor(segments?: RadioMemorySegment[]) {\n this.segments = new Map();\n\n if (segments != undefined) {\n for (const segment of segments) {\n this.segments.set(segment.startAddress, segment);\n }\n }\n }\n\n public addSegment(segment: RadioMemorySegment): void {\n this.segments.set(segment.startAddress, segment);\n }\n\n public getSegments(): IterableIterator<RadioMemorySegment> {\n return this.segments.values();\n }\n\n public getSegment(startAddress: number): RadioMemorySegment | undefined {\n return this.segments.get(startAddress);\n }\n\n public segmentCount(): number {\n return this.segments.size;\n }\n\n public findSegment(address: number): RadioMemorySegment | undefined {\n const iterator = this.segments.values();\n let result = iterator.next();\n\n while (!result.done) {\n const segment = result.value;\n\n if (segment.startAddress <= address && segment.startAddress + segment.length > address) {\n return segment;\n }\n\n result = iterator.next();\n }\n\n return undefined;\n }\n\n public toArray(): RadioMemorySegment[] {\n return Array.from(this.segments.values());\n }\n}\n"]}
1
+ {"version":3,"file":"segmented-memory.js","sourceRoot":"","sources":["../../src/memory/segmented-memory.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,oBAAoB;IACvB,QAAQ,CAAkC;IAElD,YAAY,QAA+B;QACzC,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAC;QAE1B,IAAI,QAAQ,IAAI,SAAS,EAAE,CAAC;YAC1B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;gBAC/B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;IACH,CAAC;IAEM,UAAU,CAAC,OAA2B;QAC3C,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;IAEM,WAAW;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;IAChC,CAAC;IAEM,UAAU,CAAC,YAAoB;QACpC,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACzC,CAAC;IAEM,YAAY;QACjB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC5B,CAAC;IAEM,WAAW,CAAC,OAAe;QAChC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;QACxC,IAAI,MAAM,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;QAE7B,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACpB,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC;YAE7B,IAAI,OAAO,CAAC,YAAY,IAAI,OAAO,IAAI,OAAO,CAAC,UAAU,GAAG,OAAO,EAAE,CAAC;gBACpE,OAAO,OAAO,CAAC;YACjB,CAAC;YAED,MAAM,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC3B,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAEM,OAAO;QACZ,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACrC,CAAC;CACF","sourcesContent":["import type { RadioMemorySegment } from '@springfield/ham-radio-api';\n\nexport class RadioSegmentedMemory {\n private segments: Map<number, RadioMemorySegment>;\n\n constructor(segments?: RadioMemorySegment[]) {\n this.segments = new Map();\n\n if (segments != undefined) {\n for (const segment of segments) {\n this.segments.set(segment.startAddress, segment);\n }\n }\n }\n\n public addSegment(segment: RadioMemorySegment): void {\n this.segments.set(segment.startAddress, segment);\n }\n\n public getSegments(): IterableIterator<RadioMemorySegment> {\n return this.segments.values();\n }\n\n public getSegment(startAddress: number): RadioMemorySegment | undefined {\n return this.segments.get(startAddress);\n }\n\n public segmentCount(): number {\n return this.segments.size;\n }\n\n public findSegment(address: number): RadioMemorySegment | undefined {\n const iterator = this.segments.values();\n let result = iterator.next();\n\n while (!result.done) {\n const segment = result.value;\n\n if (segment.startAddress <= address && segment.endAddress > address) {\n return segment;\n }\n\n result = iterator.next();\n }\n\n return undefined;\n }\n\n public toArray(): RadioMemorySegment[] {\n return [...this.segments.values()];\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { CTCSS, RadioChannel } from '@springfield/ham-radio-api';
1
+ import { CTCSS, type RadioChannel } from '@springfield/ham-radio-api';
2
2
  import { Factory } from 'fishery';
3
- export declare function getRandomCTCSS(): CTCSS;
3
+ export declare const getRandomCTCSS: () => CTCSS;
4
4
  export declare const radioChannelFactory: Factory<RadioChannel, any, RadioChannel, import("fishery").DeepPartialObject<RadioChannel>>;
5
5
  //# sourceMappingURL=radio-channel-factory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"radio-channel-factory.d.ts","sourceRoot":"","sources":["../../src/test-utils/radio-channel-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAa,YAAY,EAAiC,MAAM,4BAA4B,CAAC;AAC3G,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,wBAAgB,cAAc,IAAI,KAAK,CAItC;AAED,eAAO,MAAM,mBAAmB,6FAO7B,CAAC"}
1
+ {"version":3,"file":"radio-channel-factory.d.ts","sourceRoot":"","sources":["../../src/test-utils/radio-channel-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAa,KAAK,YAAY,EAAiC,MAAM,4BAA4B,CAAC;AAChH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,eAAO,MAAM,cAAc,QAAO,KAIjC,CAAC;AAEF,eAAO,MAAM,mBAAmB,6FAO7B,CAAC"}
@@ -1,16 +1,16 @@
1
1
  import { CTCSS, Frequency, RadioChannelId, RadioToneType } from '@springfield/ham-radio-api';
2
2
  import { Factory } from 'fishery';
3
- export function getRandomCTCSS() {
3
+ export const getRandomCTCSS = () => {
4
4
  const values = Object.values(CTCSS); // Get all values from the enum
5
5
  const randomIndex = Math.floor(Math.random() * values.length); // Generate a random index
6
6
  return values[randomIndex]; // Return the randomly selected value
7
- }
7
+ };
8
8
  export const radioChannelFactory = Factory.define(({ sequence }) => ({
9
9
  id: RadioChannelId(sequence.toString()),
10
10
  name: `c-${sequence}`,
11
- transmitFrequency: Frequency(144000),
12
- receiveFrequency: Frequency(144000),
13
- transmitTone: { type: RadioToneType.CTCSS, tone: getRandomCTCSS() },
14
- receiveTone: { type: RadioToneType.CTCSS, tone: getRandomCTCSS() },
11
+ receiveFrequency: Frequency(144_000),
12
+ receiveTone: { tone: getRandomCTCSS(), type: RadioToneType.CTCSS },
13
+ transmitFrequency: Frequency(144_000),
14
+ transmitTone: { tone: getRandomCTCSS(), type: RadioToneType.CTCSS },
15
15
  }));
16
16
  //# sourceMappingURL=radio-channel-factory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"radio-channel-factory.js","sourceRoot":"","sources":["../../src/test-utils/radio-channel-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAgB,cAAc,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3G,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,MAAM,UAAU,cAAc;IAC5B,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,+BAA+B;IACpE,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,0BAA0B;IACzF,OAAO,MAAM,CAAC,WAAW,CAAU,CAAC,CAAC,qCAAqC;AAC5E,CAAC;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAe,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;IACjF,EAAE,EAAE,cAAc,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;IACvC,IAAI,EAAE,KAAK,QAAQ,EAAE;IACrB,iBAAiB,EAAE,SAAS,CAAC,MAAM,CAAC;IACpC,gBAAgB,EAAE,SAAS,CAAC,MAAM,CAAC;IACnC,YAAY,EAAE,EAAE,IAAI,EAAE,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE;IACnE,WAAW,EAAE,EAAE,IAAI,EAAE,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE;CACnE,CAAC,CAAC,CAAC","sourcesContent":["import { CTCSS, Frequency, RadioChannel, RadioChannelId, RadioToneType } from '@springfield/ham-radio-api';\nimport { Factory } from 'fishery';\n\nexport function getRandomCTCSS(): CTCSS {\n const values = Object.values(CTCSS); // Get all values from the enum\n const randomIndex = Math.floor(Math.random() * values.length); // Generate a random index\n return values[randomIndex] as CTCSS; // Return the randomly selected value\n}\n\nexport const radioChannelFactory = Factory.define<RadioChannel>(({ sequence }) => ({\n id: RadioChannelId(sequence.toString()),\n name: `c-${sequence}`,\n transmitFrequency: Frequency(144000),\n receiveFrequency: Frequency(144000),\n transmitTone: { type: RadioToneType.CTCSS, tone: getRandomCTCSS() },\n receiveTone: { type: RadioToneType.CTCSS, tone: getRandomCTCSS() },\n}));\n"]}
1
+ {"version":3,"file":"radio-channel-factory.js","sourceRoot":"","sources":["../../src/test-utils/radio-channel-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAqB,cAAc,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,MAAM,CAAC,MAAM,cAAc,GAAG,GAAU,EAAE;IACxC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,+BAA+B;IACpE,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,0BAA0B;IACzF,OAAO,MAAM,CAAC,WAAW,CAAU,CAAC,CAAC,qCAAqC;AAC5E,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAe,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;IACjF,EAAE,EAAE,cAAc,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;IACvC,IAAI,EAAE,KAAK,QAAQ,EAAE;IACrB,gBAAgB,EAAE,SAAS,CAAC,OAAO,CAAC;IACpC,WAAW,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,IAAI,EAAE,aAAa,CAAC,KAAK,EAAE;IAClE,iBAAiB,EAAE,SAAS,CAAC,OAAO,CAAC;IACrC,YAAY,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,IAAI,EAAE,aAAa,CAAC,KAAK,EAAE;CACpE,CAAC,CAAC,CAAC","sourcesContent":["import { CTCSS, Frequency, type RadioChannel, RadioChannelId, RadioToneType } from '@springfield/ham-radio-api';\nimport { Factory } from 'fishery';\n\nexport const getRandomCTCSS = (): CTCSS => {\n const values = Object.values(CTCSS); // Get all values from the enum\n const randomIndex = Math.floor(Math.random() * values.length); // Generate a random index\n return values[randomIndex] as CTCSS; // Return the randomly selected value\n};\n\nexport const radioChannelFactory = Factory.define<RadioChannel>(({ sequence }) => ({\n id: RadioChannelId(sequence.toString()),\n name: `c-${sequence}`,\n receiveFrequency: Frequency(144_000),\n receiveTone: { tone: getRandomCTCSS(), type: RadioToneType.CTCSS },\n transmitFrequency: Frequency(144_000),\n transmitTone: { tone: getRandomCTCSS(), type: RadioToneType.CTCSS },\n}));\n"]}
@@ -1,4 +1,4 @@
1
- import { RadioProgrammedChannel } from '@springfield/ham-radio-api';
2
1
  import { Factory } from 'fishery';
2
+ import type { RadioProgrammedChannel } from '@springfield/ham-radio-api';
3
3
  export declare const radioProgrammedChannelFactory: Factory<RadioProgrammedChannel, any, RadioProgrammedChannel, import("fishery").DeepPartialObject<RadioProgrammedChannel>>;
4
4
  //# sourceMappingURL=radio-programmed-channel-factory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"radio-programmed-channel-factory.d.ts","sourceRoot":"","sources":["../../src/test-utils/radio-programmed-channel-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGlC,eAAO,MAAM,6BAA6B,2HAGvC,CAAC"}
1
+ {"version":3,"file":"radio-programmed-channel-factory.d.ts","sourceRoot":"","sources":["../../src/test-utils/radio-programmed-channel-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAGzE,eAAO,MAAM,6BAA6B,2HAGvC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"radio-programmed-channel-factory.js","sourceRoot":"","sources":["../../src/test-utils/radio-programmed-channel-factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,MAAM,CAAC,MAAM,6BAA6B,GAAG,OAAO,CAAC,MAAM,CAAyB,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;IACrG,aAAa,EAAE,QAAQ;IACvB,YAAY,EAAE,mBAAmB,CAAC,KAAK,EAAE;CAC1C,CAAC,CAAC,CAAC","sourcesContent":["import { RadioProgrammedChannel } from '@springfield/ham-radio-api';\nimport { Factory } from 'fishery';\nimport { radioChannelFactory } from './radio-channel-factory.js';\n\nexport const radioProgrammedChannelFactory = Factory.define<RadioProgrammedChannel>(({ sequence }) => ({\n channelNumber: sequence,\n radioChannel: radioChannelFactory.build(),\n}));\n"]}
1
+ {"version":3,"file":"radio-programmed-channel-factory.js","sourceRoot":"","sources":["../../src/test-utils/radio-programmed-channel-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,MAAM,CAAC,MAAM,6BAA6B,GAAG,OAAO,CAAC,MAAM,CAAyB,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;IACrG,aAAa,EAAE,QAAQ;IACvB,YAAY,EAAE,mBAAmB,CAAC,KAAK,EAAE;CAC1C,CAAC,CAAC,CAAC","sourcesContent":["import { Factory } from 'fishery';\nimport type { RadioProgrammedChannel } from '@springfield/ham-radio-api';\nimport { radioChannelFactory } from './radio-channel-factory.js';\n\nexport const radioProgrammedChannelFactory = Factory.define<RadioProgrammedChannel>(({ sequence }) => ({\n channelNumber: sequence,\n radioChannel: radioChannelFactory.build(),\n}));\n"]}
@@ -1,4 +1,4 @@
1
- import { SpectrumBand } from '@springfield/ham-radio-api';
1
+ import type { SpectrumBand } from '@springfield/ham-radio-api';
2
2
  interface LicenseClass {
3
3
  id: string;
4
4
  name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"band-plan.d.ts","sourceRoot":"","sources":["../../src/utils/band-plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAI1D,UAAU,YAAY;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,qBAAa,QAAQ;IACnB,OAAO,CAAC,KAAK,CAAiB;IAC9B,OAAO,CAAC,cAAc,CAA4B;;IAOlD;;;;OAIG;IACH,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IAIhE;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;CAGxD"}
1
+ {"version":3,"file":"band-plan.d.ts","sourceRoot":"","sources":["../../src/utils/band-plan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAI/D,UAAU,YAAY;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,qBAAa,QAAQ;IACnB,OAAO,CAAC,KAAK,CAAiB;IAC9B,OAAO,CAAC,cAAc,CAA4B;;IAOlD;;;;OAIG;IACH,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IAIhE;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;CAGxD"}
@@ -1 +1 @@
1
- {"version":3,"file":"band-plan.js","sourceRoot":"","sources":["../../src/utils/band-plan.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,kBAAkB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAC/D,OAAO,kBAAkB,MAAM,4BAA4B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAOlF,MAAM,OAAO,QAAQ;IACX,KAAK,CAAiB;IACtB,cAAc,CAA4B;IAElD;QACE,IAAI,CAAC,KAAK,GAAG,SAA2B,CAAC;QACzC,IAAI,CAAC,cAAc,GAAG,IAAI,GAAG,CAAE,kBAAqC,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,EAAE,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;IAC/H,CAAC;IAED;;;;OAIG;IACH,mBAAmB,CAAC,SAAiB;QACnC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,IAAI,IAAI,CAAC,cAAc,IAAI,SAAS,IAAI,IAAI,CAAC,cAAc,CAAC,CAAC;IACzG,CAAC;IAED;;;;OAIG;IACH,iBAAiB,CAAC,EAAU;QAC1B,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACrC,CAAC;CACF","sourcesContent":["import { SpectrumBand } from '@springfield/ham-radio-api';\nimport bandsData from '../db/bands.json' with { type: 'json' };\nimport licenseClassesData from '../db/license-classes.json' with { type: 'json' };\n\ninterface LicenseClass {\n id: string;\n name: string;\n}\n\nexport class BandPlan {\n private bands: SpectrumBand[];\n private licenseClasses: Map<string, LicenseClass>;\n\n constructor() {\n this.bands = bandsData as SpectrumBand[];\n this.licenseClasses = new Map((licenseClassesData as LicenseClass[]).map((licenseClass) => [licenseClass.id, licenseClass]));\n }\n\n /**\n * Finds the spectrum band that contains the given frequency\n * @param frequency The frequency in Hz to find the band for\n * @returns The spectrum band containing the frequency, or undefined if no band contains it\n */\n findBandByFrequency(frequency: number): SpectrumBand | undefined {\n return this.bands.find((band) => frequency >= band.lowerFrequency && frequency <= band.upperFrequency);\n }\n\n /**\n * Finds a license class by its ID\n * @param id The ID of the license class to find\n * @returns The license class with the given ID, or undefined if not found\n */\n findPrivilegeById(id: string): LicenseClass | undefined {\n return this.licenseClasses.get(id);\n }\n}\n"]}
1
+ {"version":3,"file":"band-plan.js","sourceRoot":"","sources":["../../src/utils/band-plan.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,kBAAkB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAC/D,OAAO,kBAAkB,MAAM,4BAA4B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAOlF,MAAM,OAAO,QAAQ;IACX,KAAK,CAAiB;IACtB,cAAc,CAA4B;IAElD;QACE,IAAI,CAAC,KAAK,GAAG,SAA2B,CAAC;QACzC,IAAI,CAAC,cAAc,GAAG,IAAI,GAAG,CAAE,kBAAqC,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,EAAE,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;IAC/H,CAAC;IAED;;;;OAIG;IACH,mBAAmB,CAAC,SAAiB;QACnC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,IAAI,IAAI,CAAC,cAAc,IAAI,SAAS,IAAI,IAAI,CAAC,cAAc,CAAC,CAAC;IACzG,CAAC;IAED;;;;OAIG;IACH,iBAAiB,CAAC,EAAU;QAC1B,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACrC,CAAC;CACF","sourcesContent":["import type { SpectrumBand } from '@springfield/ham-radio-api';\nimport bandsData from '../db/bands.json' with { type: 'json' };\nimport licenseClassesData from '../db/license-classes.json' with { type: 'json' };\n\ninterface LicenseClass {\n id: string;\n name: string;\n}\n\nexport class BandPlan {\n private bands: SpectrumBand[];\n private licenseClasses: Map<string, LicenseClass>;\n\n constructor() {\n this.bands = bandsData as SpectrumBand[];\n this.licenseClasses = new Map((licenseClassesData as LicenseClass[]).map((licenseClass) => [licenseClass.id, licenseClass]));\n }\n\n /**\n * Finds the spectrum band that contains the given frequency\n * @param frequency The frequency in Hz to find the band for\n * @returns The spectrum band containing the frequency, or undefined if no band contains it\n */\n findBandByFrequency(frequency: number): SpectrumBand | undefined {\n return this.bands.find((band) => frequency >= band.lowerFrequency && frequency <= band.upperFrequency);\n }\n\n /**\n * Finds a license class by its ID\n * @param id The ID of the license class to find\n * @returns The license class with the given ID, or undefined if not found\n */\n findPrivilegeById(id: string): LicenseClass | undefined {\n return this.licenseClasses.get(id);\n }\n}\n"]}
@@ -1,2 +1,2 @@
1
- export declare function bcdToNumber(data: Uint8Array, offset?: number, length?: number): number;
1
+ export declare const bcdToNumber: (data: Uint8Array, offset?: number, length?: number) => number;
2
2
  //# sourceMappingURL=bcd-to-number.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bcd-to-number.d.ts","sourceRoot":"","sources":["../../src/utils/bcd-to-number.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAStF"}
1
+ {"version":3,"file":"bcd-to-number.d.ts","sourceRoot":"","sources":["../../src/utils/bcd-to-number.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,GAAI,MAAM,UAAU,EAAE,SAAS,MAAM,EAAE,SAAS,MAAM,KAAG,MAShF,CAAC"}
@@ -1,9 +1,9 @@
1
- export function bcdToNumber(data, offset, length) {
1
+ export const bcdToNumber = (data, offset, length) => {
2
2
  let bcd = 0;
3
3
  const size = length ?? data.length;
4
4
  for (let i = offset ?? 0; i < size; i++) {
5
5
  bcd |= data[i] << (8 * i);
6
6
  }
7
7
  return parseInt(bcd.toString(16), 10) * 10;
8
- }
8
+ };
9
9
  //# sourceMappingURL=bcd-to-number.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bcd-to-number.js","sourceRoot":"","sources":["../../src/utils/bcd-to-number.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,WAAW,CAAC,IAAgB,EAAE,MAAe,EAAE,MAAe;IAC5E,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,MAAM,IAAI,GAAG,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC;IAEnC,KAAK,IAAI,CAAC,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;QACxC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC;AAC7C,CAAC","sourcesContent":["export function bcdToNumber(data: Uint8Array, offset?: number, length?: number): number {\n let bcd = 0;\n const size = length ?? data.length;\n\n for (let i = offset ?? 0; i < size; i++) {\n bcd |= data[i] << (8 * i);\n }\n\n return parseInt(bcd.toString(16), 10) * 10;\n}\n"]}
1
+ {"version":3,"file":"bcd-to-number.js","sourceRoot":"","sources":["../../src/utils/bcd-to-number.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAgB,EAAE,MAAe,EAAE,MAAe,EAAU,EAAE;IACxF,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,MAAM,IAAI,GAAG,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC;IAEnC,KAAK,IAAI,CAAC,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;QACxC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC;AAC7C,CAAC,CAAC","sourcesContent":["export const bcdToNumber = (data: Uint8Array, offset?: number, length?: number): number => {\n let bcd = 0;\n const size = length ?? data.length;\n\n for (let i = offset ?? 0; i < size; i++) {\n bcd |= data[i] << (8 * i);\n }\n\n return parseInt(bcd.toString(16), 10) * 10;\n};\n"]}
@@ -1,3 +1,3 @@
1
- import { Frequency, SpectrumBand } from '@springfield/ham-radio-api';
2
- export declare function frequencyDisplay(frequency: Frequency, band: SpectrumBand): string;
1
+ import type { Frequency, SpectrumBand } from '@springfield/ham-radio-api';
2
+ export declare const frequencyDisplay: (frequency: Frequency, band: SpectrumBand) => string;
3
3
  //# sourceMappingURL=frequency-display.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"frequency-display.d.ts","sourceRoot":"","sources":["../../src/utils/frequency-display.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAErE,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,GAAG,MAAM,CAGjF"}
1
+ {"version":3,"file":"frequency-display.d.ts","sourceRoot":"","sources":["../../src/utils/frequency-display.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1E,eAAO,MAAM,gBAAgB,GAAI,WAAW,SAAS,EAAE,MAAM,YAAY,KAAG,MAG3E,CAAC"}
@@ -1,5 +1,5 @@
1
- export function frequencyDisplay(frequency, band) {
1
+ export const frequencyDisplay = (frequency, band) => {
2
2
  const frequencyDisplay = frequency / band.frequencyDisplayBaseMultiplier;
3
3
  return frequencyDisplay.toFixed(band.frequencyDisplayNumberDecimals);
4
- }
4
+ };
5
5
  //# sourceMappingURL=frequency-display.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"frequency-display.js","sourceRoot":"","sources":["../../src/utils/frequency-display.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,gBAAgB,CAAC,SAAoB,EAAE,IAAkB;IACvE,MAAM,gBAAgB,GAAG,SAAS,GAAG,IAAI,CAAC,8BAA8B,CAAC;IACzE,OAAO,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;AACvE,CAAC","sourcesContent":["import { Frequency, SpectrumBand } from '@springfield/ham-radio-api';\n\nexport function frequencyDisplay(frequency: Frequency, band: SpectrumBand): string {\n const frequencyDisplay = frequency / band.frequencyDisplayBaseMultiplier;\n return frequencyDisplay.toFixed(band.frequencyDisplayNumberDecimals);\n}\n"]}
1
+ {"version":3,"file":"frequency-display.js","sourceRoot":"","sources":["../../src/utils/frequency-display.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,SAAoB,EAAE,IAAkB,EAAU,EAAE;IACnF,MAAM,gBAAgB,GAAG,SAAS,GAAG,IAAI,CAAC,8BAA8B,CAAC;IACzE,OAAO,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;AACvE,CAAC,CAAC","sourcesContent":["import type { Frequency, SpectrumBand } from '@springfield/ham-radio-api';\n\nexport const frequencyDisplay = (frequency: Frequency, band: SpectrumBand): string => {\n const frequencyDisplay = frequency / band.frequencyDisplayBaseMultiplier;\n return frequencyDisplay.toFixed(band.frequencyDisplayNumberDecimals);\n};\n"]}
@@ -1,2 +1,2 @@
1
- export declare function formatChannel(channelNumber: number, data: Uint8Array): string;
1
+ export declare const formatChannel: (channelNumber: number, data: Uint8Array) => string;
2
2
  //# sourceMappingURL=memory-channel-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"memory-channel-utils.d.ts","sourceRoot":"","sources":["../../src/utils/memory-channel-utils.ts"],"names":[],"mappings":"AAGA,wBAAgB,aAAa,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CAE7E"}
1
+ {"version":3,"file":"memory-channel-utils.d.ts","sourceRoot":"","sources":["../../src/utils/memory-channel-utils.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,GAAI,eAAe,MAAM,EAAE,MAAM,UAAU,KAAG,MAEvE,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { sprintf } from 'sprintf-js';
2
2
  import { toHexWords } from './to-hex-words.js';
3
- export function formatChannel(channelNumber, data) {
3
+ export const formatChannel = (channelNumber, data) => {
4
4
  return sprintf('%2d : %s', channelNumber, toHexWords(data));
5
- }
5
+ };
6
6
  //# sourceMappingURL=memory-channel-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"memory-channel-utils.js","sourceRoot":"","sources":["../../src/utils/memory-channel-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,UAAU,aAAa,CAAC,aAAqB,EAAE,IAAgB;IACnE,OAAO,OAAO,CAAC,UAAU,EAAE,aAAa,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;AAC9D,CAAC","sourcesContent":["import { sprintf } from 'sprintf-js';\nimport { toHexWords } from './to-hex-words.js';\n\nexport function formatChannel(channelNumber: number, data: Uint8Array): string {\n return sprintf('%2d : %s', channelNumber, toHexWords(data));\n}\n"]}
1
+ {"version":3,"file":"memory-channel-utils.js","sourceRoot":"","sources":["../../src/utils/memory-channel-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,aAAqB,EAAE,IAAgB,EAAU,EAAE;IAC/E,OAAO,OAAO,CAAC,UAAU,EAAE,aAAa,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;AAC9D,CAAC,CAAC","sourcesContent":["import { sprintf } from 'sprintf-js';\nimport { toHexWords } from './to-hex-words.js';\n\nexport const formatChannel = (channelNumber: number, data: Uint8Array): string => {\n return sprintf('%2d : %s', channelNumber, toHexWords(data));\n};\n"]}
@@ -0,0 +1,2 @@
1
+ export declare const formatMemoryData: (address: number, data: Uint8Array) => string;
2
+ //# sourceMappingURL=memory-data-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-data-utils.d.ts","sourceRoot":"","sources":["../../src/utils/memory-data-utils.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB,GAAI,SAAS,MAAM,EAAE,MAAM,UAAU,KAAG,MAEpE,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { sprintf } from 'sprintf-js';
2
+ import { toHexWords } from './to-hex-words.js';
3
+ export const formatMemoryData = (address, data) => {
4
+ return sprintf('%04X : %s', address, toHexWords(data));
5
+ };
6
+ //# sourceMappingURL=memory-data-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-data-utils.js","sourceRoot":"","sources":["../../src/utils/memory-data-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAE,IAAgB,EAAU,EAAE;IAC5E,OAAO,OAAO,CAAC,WAAW,EAAE,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;AACzD,CAAC,CAAC","sourcesContent":["import { sprintf } from 'sprintf-js';\nimport { toHexWords } from './to-hex-words.js';\n\nexport const formatMemoryData = (address: number, data: Uint8Array): string => {\n return sprintf('%04X : %s', address, toHexWords(data));\n};\n"]}
@@ -1,3 +1,3 @@
1
- import { RadioMemorySegment } from '@springfield/ham-radio-api';
2
- export declare function formatSegment(segment: RadioMemorySegment): string;
1
+ import type { RadioMemorySegment } from '@springfield/ham-radio-api';
2
+ export declare const formatSegment: (segment: RadioMemorySegment) => string;
3
3
  //# sourceMappingURL=memory-segment-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"memory-segment-utils.d.ts","sourceRoot":"","sources":["../../src/utils/memory-segment-utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,wBAAgB,aAAa,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,CAEjE"}
1
+ {"version":3,"file":"memory-segment-utils.d.ts","sourceRoot":"","sources":["../../src/utils/memory-segment-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAIrE,eAAO,MAAM,aAAa,GAAI,SAAS,kBAAkB,KAAG,MAE3D,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { sprintf } from 'sprintf-js';
2
2
  import { toHexWords } from './to-hex-words.js';
3
- export function formatSegment(segment) {
3
+ export const formatSegment = (segment) => {
4
4
  return sprintf('%04X : %s', segment.startAddress, toHexWords(segment.data));
5
- }
5
+ };
6
6
  //# sourceMappingURL=memory-segment-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"memory-segment-utils.js","sourceRoot":"","sources":["../../src/utils/memory-segment-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C,MAAM,UAAU,aAAa,CAAC,OAA2B;IACvD,OAAO,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,YAAY,EAAE,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AAC9E,CAAC","sourcesContent":["import { sprintf } from 'sprintf-js';\nimport { toHexWords } from './to-hex-words.js';\nimport { RadioMemorySegment } from '@springfield/ham-radio-api';\n\nexport function formatSegment(segment: RadioMemorySegment): string {\n return sprintf('%04X : %s', segment.startAddress, toHexWords(segment.data));\n}\n"]}
1
+ {"version":3,"file":"memory-segment-utils.js","sourceRoot":"","sources":["../../src/utils/memory-segment-utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAA2B,EAAU,EAAE;IACnE,OAAO,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,YAAY,EAAE,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AAC9E,CAAC,CAAC","sourcesContent":["import type { RadioMemorySegment } from '@springfield/ham-radio-api';\nimport { sprintf } from 'sprintf-js';\nimport { toHexWords } from './to-hex-words.js';\n\nexport const formatSegment = (segment: RadioMemorySegment): string => {\n return sprintf('%04X : %s', segment.startAddress, toHexWords(segment.data));\n};\n"]}
@@ -1,2 +1,2 @@
1
- export declare function numberToBcd(value: number): Uint8Array;
1
+ export declare const numberToBcd: (value: number) => Uint8Array;
2
2
  //# sourceMappingURL=number-to-bcd.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"number-to-bcd.d.ts","sourceRoot":"","sources":["../../src/utils/number-to-bcd.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAcrD"}
1
+ {"version":3,"file":"number-to-bcd.d.ts","sourceRoot":"","sources":["../../src/utils/number-to-bcd.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,KAAG,UAc3C,CAAC"}
@@ -1,6 +1,6 @@
1
- export function numberToBcd(value) {
1
+ export const numberToBcd = (value) => {
2
2
  const digits = value.toString(10);
3
- const numberOfBytes = Math.ceil(digits.length / 2.0);
3
+ const numberOfBytes = Math.ceil(digits.length / 2);
4
4
  const data = new Uint8Array(numberOfBytes);
5
5
  let bcd = parseInt(digits, 16);
6
6
  for (let i = 0; i < numberOfBytes; i++) {
@@ -8,5 +8,5 @@ export function numberToBcd(value) {
8
8
  bcd >>= 8;
9
9
  }
10
10
  return data;
11
- }
11
+ };
12
12
  //# sourceMappingURL=number-to-bcd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"number-to-bcd.js","sourceRoot":"","sources":["../../src/utils/number-to-bcd.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAClC,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC;IAErD,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,aAAa,CAAC,CAAC;IAE3C,IAAI,GAAG,GAAG,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAE/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC;QACrB,GAAG,KAAK,CAAC,CAAC;IACZ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["export function numberToBcd(value: number): Uint8Array {\n const digits = value.toString(10);\n const numberOfBytes = Math.ceil(digits.length / 2.0);\n\n const data = new Uint8Array(numberOfBytes);\n\n let bcd = parseInt(digits, 16);\n\n for (let i = 0; i < numberOfBytes; i++) {\n data[i] = bcd & 0xff;\n bcd >>= 8;\n }\n\n return data;\n}\n"]}
1
+ {"version":3,"file":"number-to-bcd.js","sourceRoot":"","sources":["../../src/utils/number-to-bcd.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAa,EAAc,EAAE;IACvD,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAClC,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAEnD,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,aAAa,CAAC,CAAC;IAE3C,IAAI,GAAG,GAAG,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAE/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC;QACrB,GAAG,KAAK,CAAC,CAAC;IACZ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","sourcesContent":["export const numberToBcd = (value: number): Uint8Array => {\n const digits = value.toString(10);\n const numberOfBytes = Math.ceil(digits.length / 2);\n\n const data = new Uint8Array(numberOfBytes);\n\n let bcd = parseInt(digits, 16);\n\n for (let i = 0; i < numberOfBytes; i++) {\n data[i] = bcd & 0xff;\n bcd >>= 8;\n }\n\n return data;\n};\n"]}
@@ -1,2 +1,2 @@
1
- export declare function toHexWords(data: Uint8Array): string;
1
+ export declare const toHexWords: (data: Uint8Array) => string;
2
2
  //# sourceMappingURL=to-hex-words.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"to-hex-words.d.ts","sourceRoot":"","sources":["../../src/utils/to-hex-words.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAanD"}
1
+ {"version":3,"file":"to-hex-words.d.ts","sourceRoot":"","sources":["../../src/utils/to-hex-words.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,GAAI,MAAM,UAAU,KAAG,MAa7C,CAAC"}
@@ -1,12 +1,12 @@
1
- export function toHexWords(data) {
1
+ export const toHexWords = (data) => {
2
2
  const hexData = Buffer.from(data).toString('hex');
3
3
  let formattedData = '';
4
4
  for (let i = 0; i < hexData.length; i += 4) {
5
- if (i != 0) {
5
+ if (0 != i) {
6
6
  formattedData += ' ';
7
7
  }
8
8
  formattedData += hexData.substring(i, i + 4);
9
9
  }
10
10
  return formattedData;
11
- }
11
+ };
12
12
  //# sourceMappingURL=to-hex-words.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"to-hex-words.js","sourceRoot":"","sources":["../../src/utils/to-hex-words.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,UAAU,CAAC,IAAgB;IACzC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,IAAI,aAAa,GAAG,EAAE,CAAC;IAEvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3C,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACX,aAAa,IAAI,GAAG,CAAC;QACvB,CAAC;QAED,aAAa,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["export function toHexWords(data: Uint8Array): string {\n const hexData = Buffer.from(data).toString('hex');\n let formattedData = '';\n\n for (let i = 0; i < hexData.length; i += 4) {\n if (i != 0) {\n formattedData += ' ';\n }\n\n formattedData += hexData.substring(i, i + 4);\n }\n\n return formattedData;\n}\n"]}
1
+ {"version":3,"file":"to-hex-words.js","sourceRoot":"","sources":["../../src/utils/to-hex-words.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAgB,EAAU,EAAE;IACrD,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,IAAI,aAAa,GAAG,EAAE,CAAC;IAEvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3C,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACX,aAAa,IAAI,GAAG,CAAC;QACvB,CAAC;QAED,aAAa,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC","sourcesContent":["export const toHexWords = (data: Uint8Array): string => {\n const hexData = Buffer.from(data).toString('hex');\n let formattedData = '';\n\n for (let i = 0; i < hexData.length; i += 4) {\n if (0 != i) {\n formattedData += ' ';\n }\n\n formattedData += hexData.substring(i, i + 4);\n }\n\n return formattedData;\n};\n"]}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@springfield/ham-radio-utils",
3
- "version": "1.2.0",
3
+ "version": "2.0.0",
4
4
  "author": "Bryan Hunt",
5
- "packageManager": "yarn@4.9.1",
5
+ "packageManager": "yarn@4.9.2",
6
6
  "readme": "README.md",
7
7
  "type": "module",
8
8
  "main": "dist/index.js",
@@ -14,6 +14,8 @@
14
14
  "scripts": {
15
15
  "build": "tsc && cp src/db/* dist/db/",
16
16
  "commitlint": "commitlint --edit",
17
+ "lint": "oxlint",
18
+ "lint:fix": "oxlint --fix --fix-suggestions",
17
19
  "release": "semantic-release",
18
20
  "prepare": "husky"
19
21
  },
@@ -48,7 +50,7 @@
48
50
  "access": "public"
49
51
  },
50
52
  "dependencies": {
51
- "@springfield/ham-radio-api": "^12.0.1",
53
+ "@springfield/ham-radio-api": "^13.0.0",
52
54
  "fishery": "^2.3.1",
53
55
  "loglayer": "^6.4.2",
54
56
  "sprintf-js": "^1.1.3"
@@ -61,6 +63,7 @@
61
63
  "@semantic-release/gitlab": "13.2.5",
62
64
  "@types/sprintf-js": "1.1.4",
63
65
  "husky": "9.1.7",
66
+ "oxlint": "1.1.0",
64
67
  "semantic-release": "23.1.1",
65
68
  "semantic-release-yarn": "3.0.2",
66
69
  "typescript": "5.8.3"
package/src/db/bands.json CHANGED
@@ -201,7 +201,8 @@
201
201
  "frequencyDisplayBaseMultiplier": 1000000,
202
202
  "frequencyDisplayNumberDecimals": 4,
203
203
  "privileges": [
204
- "27659a6b-78b6-47b1-8f91-f238ffd5ebcd"
204
+ "27659a6b-78b6-47b1-8f91-f238ffd5ebcd",
205
+ "a1a391d0-3708-4a26-94d3-00c07346b69b"
205
206
  ],
206
207
  "channels": [
207
208
  {
@@ -275,7 +276,8 @@
275
276
  "frequencyDisplayBaseMultiplier": 1000000,
276
277
  "frequencyDisplayNumberDecimals": 4,
277
278
  "privileges": [
278
- "27659a6b-78b6-47b1-8f91-f238ffd5ebcd"
279
+ "27659a6b-78b6-47b1-8f91-f238ffd5ebcd",
280
+ "a1a391d0-3708-4a26-94d3-00c07346b69b"
279
281
  ],
280
282
  "channels": [
281
283
  {
@@ -307,5 +309,47 @@
307
309
  "frequency": 467712500
308
310
  }
309
311
  ]
312
+ },
313
+ {
314
+ "id": "37240987-0f63-4ed2-bfbd-9c2e13c4bb5b",
315
+ "name": "Weather Radio",
316
+ "wavelength": 1.85,
317
+ "lowerFrequency": 162400000,
318
+ "upperFrequency": 162550000,
319
+ "frequencyDisplayBaseMultiplier": 1000000,
320
+ "frequencyDisplayNumberDecimals": 3,
321
+ "privileges": [
322
+ "9689b06f-dfb0-4ae6-8fdc-f9a4e6e1b88e"
323
+ ],
324
+ "channels": [
325
+ {
326
+ "name": "WX1",
327
+ "frequency": 162550000
328
+ },
329
+ {
330
+ "name": "WX2",
331
+ "frequency": 162400000
332
+ },
333
+ {
334
+ "name": "WX3",
335
+ "frequency": 62475000
336
+ },
337
+ {
338
+ "name": "WX4",
339
+ "frequency": 162425000
340
+ },
341
+ {
342
+ "name": "WX5",
343
+ "frequency": 162450000
344
+ },
345
+ {
346
+ "name": "WX6",
347
+ "frequency": 162500000
348
+ },
349
+ {
350
+ "name": "WX7",
351
+ "frequency": 162525000
352
+ }
353
+ ]
310
354
  }
311
355
  ]
@@ -26,5 +26,9 @@
26
26
  {
27
27
  "id": "a1a391d0-3708-4a26-94d3-00c07346b69b",
28
28
  "name": "FRS"
29
+ },
30
+ {
31
+ "id": "9689b06f-dfb0-4ae6-8fdc-f9a4e6e1b88e",
32
+ "name": "Weather Radio"
29
33
  }
30
34
  ]
package/src/index.ts CHANGED
@@ -7,6 +7,6 @@ export * from './utils/bcd-to-number.js';
7
7
  export * from './utils/band-plan.js';
8
8
  export * from './utils/frequency-display.js';
9
9
  export * from './utils/memory-channel-utils.js';
10
- export * from './utils/memory-segment-utils.js';
10
+ export * from './utils/memory-data-utils.js';
11
11
  export * from './utils/number-to-bcd.js';
12
12
  export * from './utils/to-hex-words.js';
@@ -1,4 +1,4 @@
1
- import { RadioMemorySegment } from '@springfield/ham-radio-api';
1
+ import type { RadioMemorySegment } from '@springfield/ham-radio-api';
2
2
 
3
3
  export class RadioSegmentedMemory {
4
4
  private segments: Map<number, RadioMemorySegment>;
@@ -36,7 +36,7 @@ export class RadioSegmentedMemory {
36
36
  while (!result.done) {
37
37
  const segment = result.value;
38
38
 
39
- if (segment.startAddress <= address && segment.startAddress + segment.length > address) {
39
+ if (segment.startAddress <= address && segment.endAddress > address) {
40
40
  return segment;
41
41
  }
42
42
 
@@ -47,6 +47,6 @@ export class RadioSegmentedMemory {
47
47
  }
48
48
 
49
49
  public toArray(): RadioMemorySegment[] {
50
- return Array.from(this.segments.values());
50
+ return [...this.segments.values()];
51
51
  }
52
52
  }
@@ -1,17 +1,17 @@
1
- import { CTCSS, Frequency, RadioChannel, RadioChannelId, RadioToneType } from '@springfield/ham-radio-api';
1
+ import { CTCSS, Frequency, type RadioChannel, RadioChannelId, RadioToneType } from '@springfield/ham-radio-api';
2
2
  import { Factory } from 'fishery';
3
3
 
4
- export function getRandomCTCSS(): CTCSS {
4
+ export const getRandomCTCSS = (): CTCSS => {
5
5
  const values = Object.values(CTCSS); // Get all values from the enum
6
6
  const randomIndex = Math.floor(Math.random() * values.length); // Generate a random index
7
7
  return values[randomIndex] as CTCSS; // Return the randomly selected value
8
- }
8
+ };
9
9
 
10
10
  export const radioChannelFactory = Factory.define<RadioChannel>(({ sequence }) => ({
11
11
  id: RadioChannelId(sequence.toString()),
12
12
  name: `c-${sequence}`,
13
- transmitFrequency: Frequency(144000),
14
- receiveFrequency: Frequency(144000),
15
- transmitTone: { type: RadioToneType.CTCSS, tone: getRandomCTCSS() },
16
- receiveTone: { type: RadioToneType.CTCSS, tone: getRandomCTCSS() },
13
+ receiveFrequency: Frequency(144_000),
14
+ receiveTone: { tone: getRandomCTCSS(), type: RadioToneType.CTCSS },
15
+ transmitFrequency: Frequency(144_000),
16
+ transmitTone: { tone: getRandomCTCSS(), type: RadioToneType.CTCSS },
17
17
  }));
@@ -1,5 +1,5 @@
1
- import { RadioProgrammedChannel } from '@springfield/ham-radio-api';
2
1
  import { Factory } from 'fishery';
2
+ import type { RadioProgrammedChannel } from '@springfield/ham-radio-api';
3
3
  import { radioChannelFactory } from './radio-channel-factory.js';
4
4
 
5
5
  export const radioProgrammedChannelFactory = Factory.define<RadioProgrammedChannel>(({ sequence }) => ({
@@ -1,4 +1,4 @@
1
- import { SpectrumBand } from '@springfield/ham-radio-api';
1
+ import type { SpectrumBand } from '@springfield/ham-radio-api';
2
2
  import bandsData from '../db/bands.json' with { type: 'json' };
3
3
  import licenseClassesData from '../db/license-classes.json' with { type: 'json' };
4
4
 
@@ -1,4 +1,4 @@
1
- export function bcdToNumber(data: Uint8Array, offset?: number, length?: number): number {
1
+ export const bcdToNumber = (data: Uint8Array, offset?: number, length?: number): number => {
2
2
  let bcd = 0;
3
3
  const size = length ?? data.length;
4
4
 
@@ -7,4 +7,4 @@ export function bcdToNumber(data: Uint8Array, offset?: number, length?: number):
7
7
  }
8
8
 
9
9
  return parseInt(bcd.toString(16), 10) * 10;
10
- }
10
+ };
@@ -1,6 +1,6 @@
1
- import { Frequency, SpectrumBand } from '@springfield/ham-radio-api';
1
+ import type { Frequency, SpectrumBand } from '@springfield/ham-radio-api';
2
2
 
3
- export function frequencyDisplay(frequency: Frequency, band: SpectrumBand): string {
3
+ export const frequencyDisplay = (frequency: Frequency, band: SpectrumBand): string => {
4
4
  const frequencyDisplay = frequency / band.frequencyDisplayBaseMultiplier;
5
5
  return frequencyDisplay.toFixed(band.frequencyDisplayNumberDecimals);
6
- }
6
+ };
@@ -1,6 +1,6 @@
1
1
  import { sprintf } from 'sprintf-js';
2
2
  import { toHexWords } from './to-hex-words.js';
3
3
 
4
- export function formatChannel(channelNumber: number, data: Uint8Array): string {
4
+ export const formatChannel = (channelNumber: number, data: Uint8Array): string => {
5
5
  return sprintf('%2d : %s', channelNumber, toHexWords(data));
6
- }
6
+ };
@@ -0,0 +1,6 @@
1
+ import { sprintf } from 'sprintf-js';
2
+ import { toHexWords } from './to-hex-words.js';
3
+
4
+ export const formatMemoryData = (address: number, data: Uint8Array): string => {
5
+ return sprintf('%04X : %s', address, toHexWords(data));
6
+ };
@@ -1,6 +1,6 @@
1
- export function numberToBcd(value: number): Uint8Array {
1
+ export const numberToBcd = (value: number): Uint8Array => {
2
2
  const digits = value.toString(10);
3
- const numberOfBytes = Math.ceil(digits.length / 2.0);
3
+ const numberOfBytes = Math.ceil(digits.length / 2);
4
4
 
5
5
  const data = new Uint8Array(numberOfBytes);
6
6
 
@@ -12,4 +12,4 @@ export function numberToBcd(value: number): Uint8Array {
12
12
  }
13
13
 
14
14
  return data;
15
- }
15
+ };
@@ -1,9 +1,9 @@
1
- export function toHexWords(data: Uint8Array): string {
1
+ export const toHexWords = (data: Uint8Array): string => {
2
2
  const hexData = Buffer.from(data).toString('hex');
3
3
  let formattedData = '';
4
4
 
5
5
  for (let i = 0; i < hexData.length; i += 4) {
6
- if (i != 0) {
6
+ if (0 != i) {
7
7
  formattedData += ' ';
8
8
  }
9
9
 
@@ -11,4 +11,4 @@ export function toHexWords(data: Uint8Array): string {
11
11
  }
12
12
 
13
13
  return formattedData;
14
- }
14
+ };
@@ -1,7 +0,0 @@
1
- import { sprintf } from 'sprintf-js';
2
- import { toHexWords } from './to-hex-words.js';
3
- import { RadioMemorySegment } from '@springfield/ham-radio-api';
4
-
5
- export function formatSegment(segment: RadioMemorySegment): string {
6
- return sprintf('%04X : %s', segment.startAddress, toHexWords(segment.data));
7
- }