tci-client-node 0.3.0 → 0.4.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 (39) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +24 -0
  3. package/dist/audio/index.d.cts +2 -1
  4. package/dist/audio/index.d.ts +2 -1
  5. package/dist/dialect/index.cjs +175 -12
  6. package/dist/dialect/index.cjs.map +1 -1
  7. package/dist/dialect/index.d.cts +3 -2
  8. package/dist/dialect/index.d.ts +3 -2
  9. package/dist/dialect/index.js +175 -12
  10. package/dist/dialect/index.js.map +1 -1
  11. package/dist/errors-CT3b8LLw.d.cts +9 -0
  12. package/dist/errors-CT3b8LLw.d.ts +9 -0
  13. package/dist/index.cjs +404 -5
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +14 -5
  16. package/dist/index.d.ts +14 -5
  17. package/dist/index.js +399 -5
  18. package/dist/index.js.map +1 -1
  19. package/dist/meter/index.cjs +348 -0
  20. package/dist/meter/index.cjs.map +1 -0
  21. package/dist/meter/index.d.cts +78 -0
  22. package/dist/meter/index.d.ts +78 -0
  23. package/dist/meter/index.js +317 -0
  24. package/dist/meter/index.js.map +1 -0
  25. package/dist/protocol/index.d.cts +36 -2
  26. package/dist/protocol/index.d.ts +36 -2
  27. package/dist/testing/index.cjs +32 -0
  28. package/dist/testing/index.cjs.map +1 -1
  29. package/dist/testing/index.d.cts +19 -1
  30. package/dist/testing/index.d.ts +19 -1
  31. package/dist/testing/index.js +32 -0
  32. package/dist/testing/index.js.map +1 -1
  33. package/dist/types-C0qVJVSO.d.ts +74 -0
  34. package/dist/types-C4MtLKoy.d.cts +74 -0
  35. package/dist/{types-1YXGwrgI.d.cts → types-CYK_NOTz.d.cts} +2 -0
  36. package/dist/{types-BtPh4Dbd.d.ts → types-DVIPU-VR.d.ts} +2 -0
  37. package/package.json +11 -2
  38. package/dist/index-lbK6NGY4.d.cts +0 -42
  39. package/dist/index-paj1AOJY.d.ts +0 -42
@@ -0,0 +1,74 @@
1
+ import { T as TciCommand } from './text-BwCWY1k1.js';
2
+
3
+ type TciMeterSupport = 'unknown' | 'declared' | 'acknowledged' | 'observed' | 'unsupported';
4
+ interface TciMeterCapabilities {
5
+ rxLevel: TciMeterSupport;
6
+ rxAverageLevel: TciMeterSupport;
7
+ rxPeakBin: TciMeterSupport;
8
+ txMicLevel: TciMeterSupport;
9
+ txRmsPower: TciMeterSupport;
10
+ txPeakPower: TciMeterSupport;
11
+ txSwr: TciMeterSupport;
12
+ txAlcDbfs: TciMeterSupport;
13
+ }
14
+ type TciRxMeterSource = 'rx_sensors' | 'rx_channel_sensors' | 'rx_channel_sensors_ex';
15
+ interface TciRxMeterFrame {
16
+ receiver: number;
17
+ channel: number;
18
+ levelDbm: number;
19
+ averageLevelDbm?: number;
20
+ peakBinDbm?: number;
21
+ source: TciRxMeterSource;
22
+ receivedAtMs: number;
23
+ extraArgs?: readonly string[];
24
+ }
25
+ interface TciTxMeterFrame {
26
+ trx: number;
27
+ micLevelDbm?: number;
28
+ rmsPowerWatts?: number;
29
+ peakPowerWatts?: number;
30
+ swr?: number;
31
+ alc?: {
32
+ value: number;
33
+ unit: 'dbfs' | 'percent';
34
+ };
35
+ receivedAtMs: number;
36
+ extraArgs?: readonly string[];
37
+ }
38
+ interface TciMeterStreamOptions {
39
+ receiver?: number;
40
+ channel?: number;
41
+ trx?: number;
42
+ rx?: boolean;
43
+ tx?: boolean;
44
+ intervalMs?: number;
45
+ }
46
+ interface TciMeterInterval {
47
+ requestedMs: number;
48
+ appliedMs?: number;
49
+ }
50
+ interface TciMeterCommand {
51
+ name: string;
52
+ args: readonly unknown[];
53
+ }
54
+ type TciMeterDecodedFrame = {
55
+ kind: 'rx';
56
+ frame: TciRxMeterFrame;
57
+ } | {
58
+ kind: 'tx';
59
+ frame: TciTxMeterFrame;
60
+ };
61
+ interface TciMeterDecodeResult {
62
+ decoded?: TciMeterDecodedFrame;
63
+ issue?: string;
64
+ }
65
+ interface TciMeterAdapter {
66
+ readonly declaredCapabilities: TciMeterCapabilities;
67
+ normalizeInterval(intervalMs: number): TciMeterInterval;
68
+ buildEnableCommand(kind: 'rx' | 'tx', enabled: boolean, intervalMs: number): TciMeterCommand;
69
+ decode(command: TciCommand, receivedAtMs: number): TciMeterDecodeResult | undefined;
70
+ }
71
+ declare const UNKNOWN_TCI_METER_CAPABILITIES: TciMeterCapabilities;
72
+ declare function cloneMeterCapabilities(capabilities: TciMeterCapabilities): TciMeterCapabilities;
73
+
74
+ export { type TciMeterCapabilities as T, UNKNOWN_TCI_METER_CAPABILITIES as U, type TciMeterStreamOptions as a, type TciMeterAdapter as b, type TciMeterCommand as c, type TciMeterDecodeResult as d, type TciMeterDecodedFrame as e, type TciMeterInterval as f, type TciMeterSupport as g, type TciRxMeterFrame as h, type TciRxMeterSource as i, type TciTxMeterFrame as j, cloneMeterCapabilities as k };
@@ -0,0 +1,74 @@
1
+ import { T as TciCommand } from './text-BwCWY1k1.cjs';
2
+
3
+ type TciMeterSupport = 'unknown' | 'declared' | 'acknowledged' | 'observed' | 'unsupported';
4
+ interface TciMeterCapabilities {
5
+ rxLevel: TciMeterSupport;
6
+ rxAverageLevel: TciMeterSupport;
7
+ rxPeakBin: TciMeterSupport;
8
+ txMicLevel: TciMeterSupport;
9
+ txRmsPower: TciMeterSupport;
10
+ txPeakPower: TciMeterSupport;
11
+ txSwr: TciMeterSupport;
12
+ txAlcDbfs: TciMeterSupport;
13
+ }
14
+ type TciRxMeterSource = 'rx_sensors' | 'rx_channel_sensors' | 'rx_channel_sensors_ex';
15
+ interface TciRxMeterFrame {
16
+ receiver: number;
17
+ channel: number;
18
+ levelDbm: number;
19
+ averageLevelDbm?: number;
20
+ peakBinDbm?: number;
21
+ source: TciRxMeterSource;
22
+ receivedAtMs: number;
23
+ extraArgs?: readonly string[];
24
+ }
25
+ interface TciTxMeterFrame {
26
+ trx: number;
27
+ micLevelDbm?: number;
28
+ rmsPowerWatts?: number;
29
+ peakPowerWatts?: number;
30
+ swr?: number;
31
+ alc?: {
32
+ value: number;
33
+ unit: 'dbfs' | 'percent';
34
+ };
35
+ receivedAtMs: number;
36
+ extraArgs?: readonly string[];
37
+ }
38
+ interface TciMeterStreamOptions {
39
+ receiver?: number;
40
+ channel?: number;
41
+ trx?: number;
42
+ rx?: boolean;
43
+ tx?: boolean;
44
+ intervalMs?: number;
45
+ }
46
+ interface TciMeterInterval {
47
+ requestedMs: number;
48
+ appliedMs?: number;
49
+ }
50
+ interface TciMeterCommand {
51
+ name: string;
52
+ args: readonly unknown[];
53
+ }
54
+ type TciMeterDecodedFrame = {
55
+ kind: 'rx';
56
+ frame: TciRxMeterFrame;
57
+ } | {
58
+ kind: 'tx';
59
+ frame: TciTxMeterFrame;
60
+ };
61
+ interface TciMeterDecodeResult {
62
+ decoded?: TciMeterDecodedFrame;
63
+ issue?: string;
64
+ }
65
+ interface TciMeterAdapter {
66
+ readonly declaredCapabilities: TciMeterCapabilities;
67
+ normalizeInterval(intervalMs: number): TciMeterInterval;
68
+ buildEnableCommand(kind: 'rx' | 'tx', enabled: boolean, intervalMs: number): TciMeterCommand;
69
+ decode(command: TciCommand, receivedAtMs: number): TciMeterDecodeResult | undefined;
70
+ }
71
+ declare const UNKNOWN_TCI_METER_CAPABILITIES: TciMeterCapabilities;
72
+ declare function cloneMeterCapabilities(capabilities: TciMeterCapabilities): TciMeterCapabilities;
73
+
74
+ export { type TciMeterCapabilities as T, UNKNOWN_TCI_METER_CAPABILITIES as U, type TciMeterStreamOptions as a, type TciMeterAdapter as b, type TciMeterCommand as c, type TciMeterDecodeResult as d, type TciMeterDecodedFrame as e, type TciMeterInterval as f, type TciMeterSupport as g, type TciRxMeterFrame as h, type TciRxMeterSource as i, type TciTxMeterFrame as j, cloneMeterCapabilities as k };
@@ -1,4 +1,5 @@
1
1
  import { T as TciCommand } from './text-BwCWY1k1.cjs';
2
+ import { b as TciMeterAdapter } from './types-C4MtLKoy.cjs';
2
3
 
3
4
  type BuiltInTciDialectId = 'expertsdr-1.4' | 'expertsdr-1.5-1.8' | 'expertsdr-1.9-2.0' | 'aethersdr-1.5' | 'thetis-2.0' | 'generic-observed';
4
5
  type TciDialectId = BuiltInTciDialectId | (string & {
@@ -34,6 +35,7 @@ interface TciDialect {
34
35
  readonly supportsTxAudioSource: boolean;
35
36
  readonly supportsIqStream: boolean;
36
37
  readonly iqSampleRates: readonly number[];
38
+ readonly meterAdapter?: TciMeterAdapter;
37
39
  detect(context: TciDialectDetectionContext): TciDialectScore;
38
40
  resolve?(context: TciDialectDetectionContext): TciDialect;
39
41
  buildDriveSetArgs(trx: number, value: number): readonly unknown[];
@@ -1,4 +1,5 @@
1
1
  import { T as TciCommand } from './text-BwCWY1k1.js';
2
+ import { b as TciMeterAdapter } from './types-C0qVJVSO.js';
2
3
 
3
4
  type BuiltInTciDialectId = 'expertsdr-1.4' | 'expertsdr-1.5-1.8' | 'expertsdr-1.9-2.0' | 'aethersdr-1.5' | 'thetis-2.0' | 'generic-observed';
4
5
  type TciDialectId = BuiltInTciDialectId | (string & {
@@ -34,6 +35,7 @@ interface TciDialect {
34
35
  readonly supportsTxAudioSource: boolean;
35
36
  readonly supportsIqStream: boolean;
36
37
  readonly iqSampleRates: readonly number[];
38
+ readonly meterAdapter?: TciMeterAdapter;
37
39
  detect(context: TciDialectDetectionContext): TciDialectScore;
38
40
  resolve?(context: TciDialectDetectionContext): TciDialect;
39
41
  buildDriveSetArgs(trx: number, value: number): readonly unknown[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tci-client-node",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Pure TypeScript TCI (Transceiver Control Interface) client for SunSDR/ExpertSDR.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -24,7 +24,8 @@
24
24
  "hamradio",
25
25
  "cat",
26
26
  "websocket",
27
- "audio"
27
+ "audio",
28
+ "meter"
28
29
  ],
29
30
  "files": [
30
31
  "dist",
@@ -43,6 +44,9 @@
43
44
  "audio": [
44
45
  "./dist/audio/index.d.ts"
45
46
  ],
47
+ "meter": [
48
+ "./dist/meter/index.d.ts"
49
+ ],
46
50
  "testing": [
47
51
  "./dist/testing/index.d.ts"
48
52
  ],
@@ -77,6 +81,11 @@
77
81
  "import": "./dist/transport/index.js",
78
82
  "require": "./dist/transport/index.cjs"
79
83
  },
84
+ "./meter": {
85
+ "types": "./dist/meter/index.d.ts",
86
+ "import": "./dist/meter/index.js",
87
+ "require": "./dist/meter/index.cjs"
88
+ },
80
89
  "./testing": {
81
90
  "types": "./dist/testing/index.d.ts",
82
91
  "import": "./dist/testing/index.js",
@@ -1,42 +0,0 @@
1
- import { T as TciCommand, a as TciCommandInput } from './text-BwCWY1k1.cjs';
2
-
3
- type TciErrorCode = 'connect-timeout' | 'handshake-timeout' | 'invalid-handshake' | 'unknown-dialect' | 'command-timeout' | 'not-connected' | 'disconnected' | 'protocol-error' | 'invalid-frame' | 'cancelled';
4
- declare class TciError extends Error {
5
- readonly code: TciErrorCode;
6
- readonly details?: unknown;
7
- constructor(code: TciErrorCode, message: string, details?: unknown);
8
- }
9
- declare function toTciError(error: unknown, fallbackCode?: TciErrorCode): TciError;
10
-
11
- type TciCommandMatcher = (reply: TciCommand, request: TciCommand) => boolean;
12
- interface QueueCommandOptions {
13
- timeoutMs?: number;
14
- matcher?: TciCommandMatcher;
15
- signal?: AbortSignal;
16
- }
17
- interface QueuedCommandResult {
18
- request: TciCommand;
19
- reply: TciCommand;
20
- }
21
- interface TciCommandQueueOptions {
22
- send: (raw: string) => void | Promise<void>;
23
- timeoutMs?: number;
24
- }
25
- declare class TciCommandQueue {
26
- private readonly send;
27
- private readonly defaultTimeoutMs;
28
- private queue;
29
- private active?;
30
- private connected;
31
- constructor(options: TciCommandQueueOptions);
32
- setConnected(connected: boolean): void;
33
- enqueue(command: TciCommandInput, options?: QueueCommandOptions): Promise<QueuedCommandResult>;
34
- handleCommand(commandInput: TciCommandInput): boolean;
35
- cancelAll(error?: TciError): void;
36
- get size(): number;
37
- private pump;
38
- private finishActive;
39
- private rejectPending;
40
- }
41
-
42
- export { type QueueCommandOptions as Q, TciError as T, type QueuedCommandResult as a, type TciCommandMatcher as b, TciCommandQueue as c, type TciCommandQueueOptions as d, type TciErrorCode as e, toTciError as t };
@@ -1,42 +0,0 @@
1
- import { T as TciCommand, a as TciCommandInput } from './text-BwCWY1k1.js';
2
-
3
- type TciErrorCode = 'connect-timeout' | 'handshake-timeout' | 'invalid-handshake' | 'unknown-dialect' | 'command-timeout' | 'not-connected' | 'disconnected' | 'protocol-error' | 'invalid-frame' | 'cancelled';
4
- declare class TciError extends Error {
5
- readonly code: TciErrorCode;
6
- readonly details?: unknown;
7
- constructor(code: TciErrorCode, message: string, details?: unknown);
8
- }
9
- declare function toTciError(error: unknown, fallbackCode?: TciErrorCode): TciError;
10
-
11
- type TciCommandMatcher = (reply: TciCommand, request: TciCommand) => boolean;
12
- interface QueueCommandOptions {
13
- timeoutMs?: number;
14
- matcher?: TciCommandMatcher;
15
- signal?: AbortSignal;
16
- }
17
- interface QueuedCommandResult {
18
- request: TciCommand;
19
- reply: TciCommand;
20
- }
21
- interface TciCommandQueueOptions {
22
- send: (raw: string) => void | Promise<void>;
23
- timeoutMs?: number;
24
- }
25
- declare class TciCommandQueue {
26
- private readonly send;
27
- private readonly defaultTimeoutMs;
28
- private queue;
29
- private active?;
30
- private connected;
31
- constructor(options: TciCommandQueueOptions);
32
- setConnected(connected: boolean): void;
33
- enqueue(command: TciCommandInput, options?: QueueCommandOptions): Promise<QueuedCommandResult>;
34
- handleCommand(commandInput: TciCommandInput): boolean;
35
- cancelAll(error?: TciError): void;
36
- get size(): number;
37
- private pump;
38
- private finishActive;
39
- private rejectPending;
40
- }
41
-
42
- export { type QueueCommandOptions as Q, TciError as T, type QueuedCommandResult as a, type TciCommandMatcher as b, TciCommandQueue as c, type TciCommandQueueOptions as d, type TciErrorCode as e, toTciError as t };