icom-wlan-node 0.2.6 → 0.2.7
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/README.md +27 -0
- package/dist/rig/IcomControl.d.ts +20 -1
- package/dist/rig/IcomControl.js +41 -0
- package/dist/rig/IcomRigCommands.d.ts +3 -0
- package/dist/rig/IcomRigCommands.js +15 -0
- package/dist/types.d.ts +14 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -117,6 +117,7 @@ await rig.setPtt(false);
|
|
|
117
117
|
- **Audio TX**: `setPtt(on: boolean)`, `sendAudioFloat32()`, `sendAudioPcm16()`
|
|
118
118
|
- **Rig Control**: `setFrequency()`, `setMode()`, `setConnectorDataMode()`, `setConnectorWLanLevel()`
|
|
119
119
|
- **Rig Query**: `readOperatingFrequency()`, `readOperatingMode()`, `readTransmitFrequency()`, `readTransceiverState()`, `readBandEdges()`
|
|
120
|
+
- **Antenna Tuner**: `readTunerStatus()`, `setTunerEnabled()`, `startManualTune()`
|
|
120
121
|
- **Meters (RX)**: `readSquelchStatus()`, `readAudioSquelch()`, `readOvfStatus()`, `getLevelMeter()`
|
|
121
122
|
- **Meters (TX)**: `readSWR()`, `readALC()`, `readPowerLevel()`, `readCompLevel()`
|
|
122
123
|
- **Power Supply**: `readVoltage()`, `readCurrent()`
|
|
@@ -421,3 +422,29 @@ ICOM_IP=192.168.31.253 ICOM_PORT=50001 ICOM_USER=icom ICOM_PASS=icomicom npm tes
|
|
|
421
422
|
## License
|
|
422
423
|
|
|
423
424
|
MIT
|
|
425
|
+
#### Antenna Tuner (ATU)
|
|
426
|
+
|
|
427
|
+
- `readTunerStatus(options?: QueryOptions) => Promise<{ raw: number; state: 'OFF'|'ON'|'TUNING' } | null>` — 读取天调状态(CI‑V 0x1A/0x00)
|
|
428
|
+
- `setTunerEnabled(enabled: boolean) => Promise<void>` — 开启/关闭内置天调(CI‑V 0x1A/0x01 00/01)
|
|
429
|
+
- `startManualTune() => Promise<void>` — 触发一次手动调谐(相当于 [TUNE] 键,CI‑V 0x1A/0x02/0x00)
|
|
430
|
+
|
|
431
|
+
示例:
|
|
432
|
+
|
|
433
|
+
```ts
|
|
434
|
+
// 读取天调状态
|
|
435
|
+
const atu = await rig.readTunerStatus({ timeout: 2000 });
|
|
436
|
+
if (atu) console.log('ATU:', atu.state); // OFF / ON / TUNING
|
|
437
|
+
|
|
438
|
+
// 启用内置天调
|
|
439
|
+
await rig.setTunerEnabled(true);
|
|
440
|
+
|
|
441
|
+
// 触发一次手动调谐
|
|
442
|
+
await rig.startManualTune();
|
|
443
|
+
|
|
444
|
+
// 可选:轮询状态直到结束
|
|
445
|
+
let status;
|
|
446
|
+
do {
|
|
447
|
+
await new Promise(r => setTimeout(r, 300));
|
|
448
|
+
status = await rig.readTunerStatus({ timeout: 1000 });
|
|
449
|
+
} while (status && status.state === 'TUNING');
|
|
450
|
+
```
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IcomRigOptions, RigEventEmitter, IcomMode, ConnectorDataMode, SetModeOptions, QueryOptions, SwrReading, AlcReading, WlanLevelReading, LevelMeterReading, SquelchStatusReading, AudioSquelchReading, OvfStatusReading, PowerLevelReading, CompLevelReading, VoltageReading, CurrentReading, ConnectionState, ConnectionMonitorConfig, ConnectionPhase, ConnectionMetrics, DisconnectReason, DisconnectOptions } from '../types';
|
|
1
|
+
import { IcomRigOptions, RigEventEmitter, IcomMode, ConnectorDataMode, SetModeOptions, QueryOptions, SwrReading, AlcReading, WlanLevelReading, LevelMeterReading, SquelchStatusReading, AudioSquelchReading, OvfStatusReading, PowerLevelReading, CompLevelReading, VoltageReading, CurrentReading, ConnectionState, ConnectionMonitorConfig, ConnectionPhase, ConnectionMetrics, DisconnectReason, DisconnectOptions, TunerStatusReading } from '../types';
|
|
2
2
|
import { IcomCiv } from './IcomCiv';
|
|
3
3
|
import { IcomAudio } from './IcomAudio';
|
|
4
4
|
export declare class IcomControl {
|
|
@@ -190,6 +190,25 @@ export declare class IcomControl {
|
|
|
190
190
|
* await rig.setConnectorDataMode('WLAN');
|
|
191
191
|
*/
|
|
192
192
|
setConnectorDataMode(mode: ConnectorDataMode | number): Promise<void>;
|
|
193
|
+
/**
|
|
194
|
+
* ==============================
|
|
195
|
+
* Antenna Tuner (ATU) Operations
|
|
196
|
+
* ==============================
|
|
197
|
+
*/
|
|
198
|
+
/**
|
|
199
|
+
* Read antenna tuner status (CI-V 0x1A/0x00)
|
|
200
|
+
* 00=OFF, 01=ON, 02=TUNING
|
|
201
|
+
*/
|
|
202
|
+
readTunerStatus(options?: QueryOptions): Promise<TunerStatusReading | null>;
|
|
203
|
+
/**
|
|
204
|
+
* Enable or disable internal antenna tuner (CI-V 0x1A/0x01)
|
|
205
|
+
* @param enabled true to enable, false to disable
|
|
206
|
+
*/
|
|
207
|
+
setTunerEnabled(enabled: boolean): Promise<void>;
|
|
208
|
+
/**
|
|
209
|
+
* Start a manual tuning cycle (same as [TUNE] key) (CI-V 0x1A/0x02/0x00)
|
|
210
|
+
*/
|
|
211
|
+
startManualTune(): Promise<void>;
|
|
193
212
|
/**
|
|
194
213
|
* Read squelch status (noise/signal gate state)
|
|
195
214
|
* @param options - Query options (timeout in ms, default 3000)
|
package/dist/rig/IcomControl.js
CHANGED
|
@@ -811,6 +811,47 @@ class IcomControl {
|
|
|
811
811
|
const modeCode = typeof mode === 'string' ? (0, IcomConstants_1.getConnectorModeCode)(mode) : mode;
|
|
812
812
|
this.sendCiv(IcomRigCommands_1.IcomRigCommands.setConnectorDataMode(ctrAddr, rigAddr, modeCode));
|
|
813
813
|
}
|
|
814
|
+
/**
|
|
815
|
+
* ==============================
|
|
816
|
+
* Antenna Tuner (ATU) Operations
|
|
817
|
+
* ==============================
|
|
818
|
+
*/
|
|
819
|
+
/**
|
|
820
|
+
* Read antenna tuner status (CI-V 0x1A/0x00)
|
|
821
|
+
* 00=OFF, 01=ON, 02=TUNING
|
|
822
|
+
*/
|
|
823
|
+
async readTunerStatus(options) {
|
|
824
|
+
const timeoutMs = options?.timeout ?? 3000;
|
|
825
|
+
const ctrAddr = IcomConstants_1.DEFAULT_CONTROLLER_ADDR;
|
|
826
|
+
const rigAddr = this.civ.civAddress & 0xff;
|
|
827
|
+
const req = IcomRigCommands_1.IcomRigCommands.getTunerStatus(ctrAddr, rigAddr);
|
|
828
|
+
const resp = await this.waitForCivFrame((frame) => IcomControl.matchCommandFrame(frame, 0x1a, [0x00], ctrAddr, rigAddr), timeoutMs, () => this.sendCiv(req));
|
|
829
|
+
if (!resp)
|
|
830
|
+
return null;
|
|
831
|
+
// Expect FE FE [ctr] [rig] 0x1A 0x00 [status] FD
|
|
832
|
+
const raw = resp.length > 6 ? (resp[6] & 0xff) : undefined;
|
|
833
|
+
if (raw === undefined)
|
|
834
|
+
return null;
|
|
835
|
+
const state = raw === 0x00 ? 'OFF' : raw === 0x01 ? 'ON' : raw === 0x02 ? 'TUNING' : 'OFF';
|
|
836
|
+
return { raw, state };
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* Enable or disable internal antenna tuner (CI-V 0x1A/0x01)
|
|
840
|
+
* @param enabled true to enable, false to disable
|
|
841
|
+
*/
|
|
842
|
+
async setTunerEnabled(enabled) {
|
|
843
|
+
const ctrAddr = IcomConstants_1.DEFAULT_CONTROLLER_ADDR;
|
|
844
|
+
const rigAddr = this.civ.civAddress & 0xff;
|
|
845
|
+
this.sendCiv(IcomRigCommands_1.IcomRigCommands.setTunerEnabled(ctrAddr, rigAddr, enabled));
|
|
846
|
+
}
|
|
847
|
+
/**
|
|
848
|
+
* Start a manual tuning cycle (same as [TUNE] key) (CI-V 0x1A/0x02/0x00)
|
|
849
|
+
*/
|
|
850
|
+
async startManualTune() {
|
|
851
|
+
const ctrAddr = IcomConstants_1.DEFAULT_CONTROLLER_ADDR;
|
|
852
|
+
const rigAddr = this.civ.civAddress & 0xff;
|
|
853
|
+
this.sendCiv(IcomRigCommands_1.IcomRigCommands.startManualTune(ctrAddr, rigAddr));
|
|
854
|
+
}
|
|
814
855
|
/**
|
|
815
856
|
* Read squelch status (noise/signal gate state)
|
|
816
857
|
* @param options - Query options (timeout in ms, default 3000)
|
|
@@ -21,4 +21,7 @@ export declare const IcomRigCommands: {
|
|
|
21
21
|
getCompLevel(ctrAddr: number, rigAddr: number): Buffer;
|
|
22
22
|
getVoltage(ctrAddr: number, rigAddr: number): Buffer;
|
|
23
23
|
getCurrent(ctrAddr: number, rigAddr: number): Buffer;
|
|
24
|
+
getTunerStatus(ctrAddr: number, rigAddr: number): Buffer;
|
|
25
|
+
setTunerEnabled(ctrAddr: number, rigAddr: number, on: boolean): Buffer;
|
|
26
|
+
startManualTune(ctrAddr: number, rigAddr: number): Buffer;
|
|
24
27
|
};
|
|
@@ -97,5 +97,20 @@ exports.IcomRigCommands = {
|
|
|
97
97
|
getCurrent(ctrAddr, rigAddr) {
|
|
98
98
|
// FE FE [rig] [ctr] 0x15 0x16 FD
|
|
99
99
|
return Buffer.from([0xfe, 0xfe, rigAddr & 0xff, ctrAddr & 0xff, 0x15, 0x16, 0xfd]);
|
|
100
|
+
},
|
|
101
|
+
// =====================
|
|
102
|
+
// Antenna Tuner (ATU)
|
|
103
|
+
// =====================
|
|
104
|
+
getTunerStatus(ctrAddr, rigAddr) {
|
|
105
|
+
// FE FE [rig] [ctr] 0x1A 0x00 FD
|
|
106
|
+
return Buffer.from([0xfe, 0xfe, rigAddr & 0xff, ctrAddr & 0xff, 0x1a, 0x00, 0xfd]);
|
|
107
|
+
},
|
|
108
|
+
setTunerEnabled(ctrAddr, rigAddr, on) {
|
|
109
|
+
// FE FE [rig] [ctr] 0x1A 0x01 [00|01] FD
|
|
110
|
+
return Buffer.from([0xfe, 0xfe, rigAddr & 0xff, ctrAddr & 0xff, 0x1a, 0x01, on ? 0x01 : 0x00, 0xfd]);
|
|
111
|
+
},
|
|
112
|
+
startManualTune(ctrAddr, rigAddr) {
|
|
113
|
+
// FE FE [rig] [ctr] 0x1A 0x02 0x00 FD
|
|
114
|
+
return Buffer.from([0xfe, 0xfe, rigAddr & 0xff, ctrAddr & 0xff, 0x1a, 0x02, 0x00, 0xfd]);
|
|
100
115
|
}
|
|
101
116
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -254,6 +254,20 @@ export interface CurrentReading {
|
|
|
254
254
|
/** Current in amperes */
|
|
255
255
|
amps: number;
|
|
256
256
|
}
|
|
257
|
+
/**
|
|
258
|
+
* Antenna tuner state (IC-705 CI-V 0x1A/0x00)
|
|
259
|
+
* 00=OFF, 01=ON, 02=TUNING
|
|
260
|
+
*/
|
|
261
|
+
export type TunerState = 'OFF' | 'ON' | 'TUNING';
|
|
262
|
+
/**
|
|
263
|
+
* Antenna tuner status reading
|
|
264
|
+
*/
|
|
265
|
+
export interface TunerStatusReading {
|
|
266
|
+
/** Raw status code (0x00, 0x01, 0x02) */
|
|
267
|
+
raw: number;
|
|
268
|
+
/** Parsed state name */
|
|
269
|
+
state: TunerState;
|
|
270
|
+
}
|
|
257
271
|
/**
|
|
258
272
|
* Connection state enumeration
|
|
259
273
|
* Represents the current state of a UDP session
|