@springfield/ham-radio-utils 1.3.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.
- package/CHANGELOG.md +11 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/memory/segmented-memory.d.ts +1 -1
- package/dist/memory/segmented-memory.d.ts.map +1 -1
- package/dist/memory/segmented-memory.js +2 -2
- package/dist/memory/segmented-memory.js.map +1 -1
- package/dist/test-utils/radio-channel-factory.d.ts +2 -2
- package/dist/test-utils/radio-channel-factory.d.ts.map +1 -1
- package/dist/test-utils/radio-channel-factory.js +6 -6
- package/dist/test-utils/radio-channel-factory.js.map +1 -1
- package/dist/test-utils/radio-programmed-channel-factory.d.ts +1 -1
- package/dist/test-utils/radio-programmed-channel-factory.d.ts.map +1 -1
- package/dist/test-utils/radio-programmed-channel-factory.js.map +1 -1
- package/dist/utils/band-plan.d.ts +1 -1
- package/dist/utils/band-plan.d.ts.map +1 -1
- package/dist/utils/band-plan.js.map +1 -1
- package/dist/utils/bcd-to-number.d.ts +1 -1
- package/dist/utils/bcd-to-number.d.ts.map +1 -1
- package/dist/utils/bcd-to-number.js +2 -2
- package/dist/utils/bcd-to-number.js.map +1 -1
- package/dist/utils/frequency-display.d.ts +2 -2
- package/dist/utils/frequency-display.d.ts.map +1 -1
- package/dist/utils/frequency-display.js +2 -2
- package/dist/utils/frequency-display.js.map +1 -1
- package/dist/utils/memory-channel-utils.d.ts +1 -1
- package/dist/utils/memory-channel-utils.d.ts.map +1 -1
- package/dist/utils/memory-channel-utils.js +2 -2
- package/dist/utils/memory-channel-utils.js.map +1 -1
- package/dist/utils/memory-data-utils.d.ts +2 -0
- package/dist/utils/memory-data-utils.d.ts.map +1 -0
- package/dist/utils/memory-data-utils.js +6 -0
- package/dist/utils/memory-data-utils.js.map +1 -0
- package/dist/utils/memory-segment-utils.d.ts +2 -2
- package/dist/utils/memory-segment-utils.d.ts.map +1 -1
- package/dist/utils/memory-segment-utils.js +2 -2
- package/dist/utils/memory-segment-utils.js.map +1 -1
- package/dist/utils/number-to-bcd.d.ts +1 -1
- package/dist/utils/number-to-bcd.d.ts.map +1 -1
- package/dist/utils/number-to-bcd.js +3 -3
- package/dist/utils/number-to-bcd.js.map +1 -1
- package/dist/utils/to-hex-words.d.ts +1 -1
- package/dist/utils/to-hex-words.d.ts.map +1 -1
- package/dist/utils/to-hex-words.js +3 -3
- package/dist/utils/to-hex-words.js.map +1 -1
- package/package.json +6 -3
- package/src/index.ts +1 -1
- package/src/memory/segmented-memory.ts +3 -3
- package/src/test-utils/radio-channel-factory.ts +7 -7
- package/src/test-utils/radio-programmed-channel-factory.ts +1 -1
- package/src/utils/band-plan.ts +1 -1
- package/src/utils/bcd-to-number.ts +2 -2
- package/src/utils/frequency-display.ts +3 -3
- package/src/utils/memory-channel-utils.ts +2 -2
- package/src/utils/memory-data-utils.ts +6 -0
- package/src/utils/number-to-bcd.ts +3 -3
- package/src/utils/to-hex-words.ts +3 -3
- package/src/utils/memory-segment-utils.ts +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
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
|
+
|
|
1
12
|
## [1.3.0](https://gitlab.com/springfield-ham-radio/app/ham-radio-utils/compare/v1.2.0...v1.3.0) (2025-05-31)
|
|
2
13
|
|
|
3
14
|
|
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-
|
|
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
|
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,
|
|
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-
|
|
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,
|
|
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 +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;
|
|
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.
|
|
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
|
|
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,
|
|
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
|
|
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;
|
|
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
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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,
|
|
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,
|
|
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":"
|
|
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 +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;
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
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
|
|
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;
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
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 @@
|
|
|
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 @@
|
|
|
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
|
|
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":"
|
|
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
|
|
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":"
|
|
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
|
|
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,
|
|
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
|
|
1
|
+
export const numberToBcd = (value) => {
|
|
2
2
|
const digits = value.toString(10);
|
|
3
|
-
const numberOfBytes = Math.ceil(digits.length / 2
|
|
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,
|
|
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
|
|
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,
|
|
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
|
|
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 (
|
|
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,
|
|
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": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"author": "Bryan Hunt",
|
|
5
|
-
"packageManager": "yarn@4.9.
|
|
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": "^
|
|
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/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-
|
|
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.
|
|
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
|
|
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
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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 }) => ({
|
package/src/utils/band-plan.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
4
|
+
export const formatChannel = (channelNumber: number, data: Uint8Array): string => {
|
|
5
5
|
return sprintf('%2d : %s', channelNumber, toHexWords(data));
|
|
6
|
-
}
|
|
6
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const numberToBcd = (value: number): Uint8Array => {
|
|
2
2
|
const digits = value.toString(10);
|
|
3
|
-
const numberOfBytes = Math.ceil(digits.length / 2
|
|
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
|
|
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 (
|
|
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
|
-
}
|