@ecobridge.xyz/devicemanager 3.0.2
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/.gitea/workflows/default_nottags.yaml +66 -0
- package/.gitea/workflows/default_tags.yaml +124 -0
- package/.vscode/launch.json +11 -0
- package/.vscode/settings.json +26 -0
- package/changelog.md +91 -0
- package/dist_ts/00_commitinfo_data.d.ts +8 -0
- package/dist_ts/00_commitinfo_data.js +9 -0
- package/dist_ts/device/device.classes.device.d.ts +205 -0
- package/dist_ts/device/device.classes.device.js +344 -0
- package/dist_ts/devicemanager.classes.devicemanager.d.ts +210 -0
- package/dist_ts/devicemanager.classes.devicemanager.js +835 -0
- package/dist_ts/discovery/discovery.classes.homeassistant.d.ts +101 -0
- package/dist_ts/discovery/discovery.classes.homeassistant.js +313 -0
- package/dist_ts/discovery/discovery.classes.mdns.d.ts +90 -0
- package/dist_ts/discovery/discovery.classes.mdns.js +291 -0
- package/dist_ts/discovery/discovery.classes.networkscanner.d.ts +64 -0
- package/dist_ts/discovery/discovery.classes.networkscanner.js +535 -0
- package/dist_ts/discovery/discovery.classes.ssdp.d.ts +112 -0
- package/dist_ts/discovery/discovery.classes.ssdp.js +255 -0
- package/dist_ts/factories/index.d.ts +190 -0
- package/dist_ts/factories/index.js +350 -0
- package/dist_ts/features/feature.abstract.d.ts +118 -0
- package/dist_ts/features/feature.abstract.js +172 -0
- package/dist_ts/features/feature.camera.d.ts +95 -0
- package/dist_ts/features/feature.camera.js +162 -0
- package/dist_ts/features/feature.climate.d.ts +174 -0
- package/dist_ts/features/feature.climate.js +328 -0
- package/dist_ts/features/feature.cover.d.ts +121 -0
- package/dist_ts/features/feature.cover.js +217 -0
- package/dist_ts/features/feature.fan.d.ts +127 -0
- package/dist_ts/features/feature.fan.js +235 -0
- package/dist_ts/features/feature.light.d.ts +156 -0
- package/dist_ts/features/feature.light.js +296 -0
- package/dist_ts/features/feature.lock.d.ts +103 -0
- package/dist_ts/features/feature.lock.js +170 -0
- package/dist_ts/features/feature.playback.d.ts +98 -0
- package/dist_ts/features/feature.playback.js +191 -0
- package/dist_ts/features/feature.power.d.ts +79 -0
- package/dist_ts/features/feature.power.js +173 -0
- package/dist_ts/features/feature.print.d.ts +78 -0
- package/dist_ts/features/feature.print.js +226 -0
- package/dist_ts/features/feature.scan.d.ts +79 -0
- package/dist_ts/features/feature.scan.js +315 -0
- package/dist_ts/features/feature.sensor.d.ts +95 -0
- package/dist_ts/features/feature.sensor.js +147 -0
- package/dist_ts/features/feature.snmp.d.ts +88 -0
- package/dist_ts/features/feature.snmp.js +175 -0
- package/dist_ts/features/feature.switch.d.ts +75 -0
- package/dist_ts/features/feature.switch.js +126 -0
- package/dist_ts/features/feature.volume.d.ts +104 -0
- package/dist_ts/features/feature.volume.js +186 -0
- package/dist_ts/features/index.d.ts +19 -0
- package/dist_ts/features/index.js +23 -0
- package/dist_ts/helpers/helpers.iprange.d.ts +35 -0
- package/dist_ts/helpers/helpers.iprange.js +151 -0
- package/dist_ts/helpers/helpers.retry.d.ts +25 -0
- package/dist_ts/helpers/helpers.retry.js +69 -0
- package/dist_ts/index.d.ts +15 -0
- package/dist_ts/index.js +40 -0
- package/dist_ts/interfaces/feature.interfaces.d.ts +255 -0
- package/dist_ts/interfaces/feature.interfaces.js +6 -0
- package/dist_ts/interfaces/homeassistant.interfaces.d.ts +550 -0
- package/dist_ts/interfaces/homeassistant.interfaces.js +111 -0
- package/dist_ts/interfaces/index.d.ts +330 -0
- package/dist_ts/interfaces/index.js +16 -0
- package/dist_ts/interfaces/smarthome.interfaces.d.ts +282 -0
- package/dist_ts/interfaces/smarthome.interfaces.js +7 -0
- package/dist_ts/paths.d.ts +1 -0
- package/dist_ts/paths.js +3 -0
- package/dist_ts/plugins.d.ts +23 -0
- package/dist_ts/plugins.js +30 -0
- package/dist_ts/protocols/index.d.ts +12 -0
- package/dist_ts/protocols/index.js +21 -0
- package/dist_ts/protocols/protocol.escl.d.ts +58 -0
- package/dist_ts/protocols/protocol.escl.js +364 -0
- package/dist_ts/protocols/protocol.homeassistant.d.ts +248 -0
- package/dist_ts/protocols/protocol.homeassistant.js +611 -0
- package/dist_ts/protocols/protocol.ipp.d.ts +45 -0
- package/dist_ts/protocols/protocol.ipp.js +284 -0
- package/dist_ts/protocols/protocol.nut.d.ts +160 -0
- package/dist_ts/protocols/protocol.nut.js +364 -0
- package/dist_ts/protocols/protocol.sane.d.ts +104 -0
- package/dist_ts/protocols/protocol.sane.js +597 -0
- package/dist_ts/protocols/protocol.snmp.d.ts +133 -0
- package/dist_ts/protocols/protocol.snmp.js +333 -0
- package/dist_ts/protocols/protocol.upnp.d.ts +207 -0
- package/dist_ts/protocols/protocol.upnp.js +442 -0
- package/dist_ts/protocols/protocol.upssnmp.d.ts +160 -0
- package/dist_ts/protocols/protocol.upssnmp.js +263 -0
- package/npmextra.json +24 -0
- package/package.json +39 -0
- package/readme.hints.md +115 -0
- package/readme.md +624 -0
- package/test/test.ts +261 -0
- package/ts/00_commitinfo_data.ts +8 -0
- package/ts/device/device.classes.device.ts +454 -0
- package/ts/devicemanager.classes.devicemanager.ts +1219 -0
- package/ts/discovery/discovery.classes.homeassistant.ts +376 -0
- package/ts/discovery/discovery.classes.mdns.ts +347 -0
- package/ts/discovery/discovery.classes.networkscanner.ts +648 -0
- package/ts/discovery/discovery.classes.ssdp.ts +357 -0
- package/ts/factories/index.ts +696 -0
- package/ts/features/feature.abstract.ts +251 -0
- package/ts/features/feature.camera.ts +214 -0
- package/ts/features/feature.climate.ts +407 -0
- package/ts/features/feature.cover.ts +278 -0
- package/ts/features/feature.fan.ts +296 -0
- package/ts/features/feature.light.ts +369 -0
- package/ts/features/feature.lock.ts +223 -0
- package/ts/features/feature.playback.ts +246 -0
- package/ts/features/feature.power.ts +231 -0
- package/ts/features/feature.print.ts +297 -0
- package/ts/features/feature.scan.ts +370 -0
- package/ts/features/feature.sensor.ts +202 -0
- package/ts/features/feature.snmp.ts +235 -0
- package/ts/features/feature.switch.ts +170 -0
- package/ts/features/feature.volume.ts +256 -0
- package/ts/features/index.ts +25 -0
- package/ts/helpers/helpers.iprange.ts +172 -0
- package/ts/helpers/helpers.retry.ts +100 -0
- package/ts/index.ts +165 -0
- package/ts/interfaces/feature.interfaces.ts +359 -0
- package/ts/interfaces/homeassistant.interfaces.ts +666 -0
- package/ts/interfaces/index.ts +421 -0
- package/ts/interfaces/smarthome.interfaces.ts +421 -0
- package/ts/paths.ts +5 -0
- package/ts/plugins.ts +41 -0
- package/ts/protocols/index.ts +59 -0
- package/ts/protocols/protocol.escl.ts +439 -0
- package/ts/protocols/protocol.homeassistant.ts +737 -0
- package/ts/protocols/protocol.ipp.ts +329 -0
- package/ts/protocols/protocol.nut.ts +471 -0
- package/ts/protocols/protocol.sane.ts +694 -0
- package/ts/protocols/protocol.snmp.ts +439 -0
- package/ts/protocols/protocol.upnp.ts +627 -0
- package/ts/protocols/protocol.upssnmp.ts +377 -0
- package/tsconfig.json +12 -0
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Device Manager Type Definitions
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// Device Types
|
|
7
|
+
// ============================================================================
|
|
8
|
+
|
|
9
|
+
export type TDeviceType = 'scanner' | 'printer' | 'snmp' | 'ups' | 'speaker' | 'dlna-renderer' | 'dlna-server';
|
|
10
|
+
export type TDeviceStatus = 'online' | 'offline' | 'busy' | 'error' | 'unknown';
|
|
11
|
+
export type TConnectionState = 'disconnected' | 'connecting' | 'connected' | 'error';
|
|
12
|
+
|
|
13
|
+
// ============================================================================
|
|
14
|
+
// Scanner Types
|
|
15
|
+
// ============================================================================
|
|
16
|
+
|
|
17
|
+
export type TScannerProtocol = 'sane' | 'escl';
|
|
18
|
+
export type TScanFormat = 'png' | 'jpeg' | 'pdf' | 'tiff';
|
|
19
|
+
export type TColorMode = 'color' | 'grayscale' | 'blackwhite';
|
|
20
|
+
export type TScanSource = 'flatbed' | 'adf' | 'adf-duplex';
|
|
21
|
+
|
|
22
|
+
// ============================================================================
|
|
23
|
+
// Base Interfaces
|
|
24
|
+
// ============================================================================
|
|
25
|
+
|
|
26
|
+
export interface IDeviceInfo {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
type: TDeviceType;
|
|
30
|
+
address: string;
|
|
31
|
+
port: number;
|
|
32
|
+
status: TDeviceStatus;
|
|
33
|
+
manufacturer?: string;
|
|
34
|
+
model?: string;
|
|
35
|
+
serialNumber?: string;
|
|
36
|
+
firmwareVersion?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface IDeviceManagerOptions {
|
|
40
|
+
/** Enable auto-discovery on startup */
|
|
41
|
+
autoDiscovery?: boolean;
|
|
42
|
+
/** Discovery timeout in milliseconds */
|
|
43
|
+
discoveryTimeout?: number;
|
|
44
|
+
/** Enable retry with exponential backoff */
|
|
45
|
+
enableRetry?: boolean;
|
|
46
|
+
/** Maximum retry attempts */
|
|
47
|
+
maxRetries?: number;
|
|
48
|
+
/** Base delay for retry backoff in milliseconds */
|
|
49
|
+
retryBaseDelay?: number;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// ============================================================================
|
|
53
|
+
// Scanner Interfaces
|
|
54
|
+
// ============================================================================
|
|
55
|
+
|
|
56
|
+
export interface IScannerInfo extends IDeviceInfo {
|
|
57
|
+
type: 'scanner';
|
|
58
|
+
protocol: TScannerProtocol;
|
|
59
|
+
supportedFormats: TScanFormat[];
|
|
60
|
+
supportedResolutions: number[];
|
|
61
|
+
supportedColorModes: TColorMode[];
|
|
62
|
+
supportedSources: TScanSource[];
|
|
63
|
+
hasAdf: boolean;
|
|
64
|
+
hasDuplex: boolean;
|
|
65
|
+
maxWidth?: number; // in mm
|
|
66
|
+
maxHeight?: number; // in mm
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface IScanArea {
|
|
70
|
+
x: number; // X offset in mm
|
|
71
|
+
y: number; // Y offset in mm
|
|
72
|
+
width: number; // Width in mm
|
|
73
|
+
height: number; // Height in mm
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface IScanOptions {
|
|
77
|
+
/** Resolution in DPI (default: 300) */
|
|
78
|
+
resolution?: number;
|
|
79
|
+
/** Output format (default: 'png') */
|
|
80
|
+
format?: TScanFormat;
|
|
81
|
+
/** Color mode (default: 'color') */
|
|
82
|
+
colorMode?: TColorMode;
|
|
83
|
+
/** Scan source (default: 'flatbed') */
|
|
84
|
+
source?: TScanSource;
|
|
85
|
+
/** Scan area (default: full page) */
|
|
86
|
+
area?: IScanArea;
|
|
87
|
+
/** Document intent for optimization */
|
|
88
|
+
intent?: 'document' | 'photo' | 'preview';
|
|
89
|
+
/** Compression quality for JPEG (1-100) */
|
|
90
|
+
quality?: number;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface IScanResult {
|
|
94
|
+
/** Scanned image data */
|
|
95
|
+
data: Buffer;
|
|
96
|
+
/** Output format */
|
|
97
|
+
format: TScanFormat;
|
|
98
|
+
/** Image width in pixels */
|
|
99
|
+
width: number;
|
|
100
|
+
/** Image height in pixels */
|
|
101
|
+
height: number;
|
|
102
|
+
/** Scan resolution in DPI */
|
|
103
|
+
resolution: number;
|
|
104
|
+
/** Color mode used */
|
|
105
|
+
colorMode: TColorMode;
|
|
106
|
+
/** MIME type */
|
|
107
|
+
mimeType: string;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface IScannerCapabilities {
|
|
111
|
+
resolutions: number[];
|
|
112
|
+
formats: TScanFormat[];
|
|
113
|
+
colorModes: TColorMode[];
|
|
114
|
+
sources: TScanSource[];
|
|
115
|
+
maxWidth: number;
|
|
116
|
+
maxHeight: number;
|
|
117
|
+
minWidth: number;
|
|
118
|
+
minHeight: number;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// ============================================================================
|
|
122
|
+
// Printer Interfaces
|
|
123
|
+
// ============================================================================
|
|
124
|
+
|
|
125
|
+
export interface IPrinterInfo extends IDeviceInfo {
|
|
126
|
+
type: 'printer';
|
|
127
|
+
uri: string;
|
|
128
|
+
supportsColor: boolean;
|
|
129
|
+
supportsDuplex: boolean;
|
|
130
|
+
supportedMediaTypes: string[];
|
|
131
|
+
supportedMediaSizes: string[];
|
|
132
|
+
maxCopies: number;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface IPrintOptions {
|
|
136
|
+
/** Number of copies (default: 1) */
|
|
137
|
+
copies?: number;
|
|
138
|
+
/** Media size (e.g., 'iso_a4_210x297mm') */
|
|
139
|
+
mediaSize?: string;
|
|
140
|
+
/** Media type (e.g., 'stationery') */
|
|
141
|
+
mediaType?: string;
|
|
142
|
+
/** Print sides: 'one-sided', 'two-sided-long-edge', 'two-sided-short-edge' */
|
|
143
|
+
sides?: 'one-sided' | 'two-sided-long-edge' | 'two-sided-short-edge';
|
|
144
|
+
/** Print quality */
|
|
145
|
+
quality?: 'draft' | 'normal' | 'high';
|
|
146
|
+
/** Color mode */
|
|
147
|
+
colorMode?: 'color' | 'monochrome';
|
|
148
|
+
/** Job name */
|
|
149
|
+
jobName?: string;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export interface IPrintJob {
|
|
153
|
+
id: number;
|
|
154
|
+
name: string;
|
|
155
|
+
state: 'pending' | 'processing' | 'completed' | 'canceled' | 'aborted';
|
|
156
|
+
stateReason?: string;
|
|
157
|
+
createdAt: Date;
|
|
158
|
+
completedAt?: Date;
|
|
159
|
+
pagesPrinted?: number;
|
|
160
|
+
pagesTotal?: number;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export interface IPrinterCapabilities {
|
|
164
|
+
colorSupported: boolean;
|
|
165
|
+
duplexSupported: boolean;
|
|
166
|
+
mediaSizes: string[];
|
|
167
|
+
mediaTypes: string[];
|
|
168
|
+
resolutions: number[];
|
|
169
|
+
maxCopies: number;
|
|
170
|
+
sidesSupported: string[];
|
|
171
|
+
qualitySupported: string[];
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// ============================================================================
|
|
175
|
+
// Discovery Interfaces
|
|
176
|
+
// ============================================================================
|
|
177
|
+
|
|
178
|
+
export interface IDiscoveredDevice {
|
|
179
|
+
id: string;
|
|
180
|
+
name: string;
|
|
181
|
+
type: TDeviceType;
|
|
182
|
+
protocol: string; // 'escl' | 'sane' | 'ipp' | 'airplay' | 'sonos' | 'chromecast' | etc.
|
|
183
|
+
address: string;
|
|
184
|
+
port: number;
|
|
185
|
+
txtRecords: Record<string, string>;
|
|
186
|
+
serviceType: string;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export interface IDiscoveryOptions {
|
|
190
|
+
/** Service types to discover */
|
|
191
|
+
serviceTypes?: string[];
|
|
192
|
+
/** Discovery timeout in ms */
|
|
193
|
+
timeout?: number;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// ============================================================================
|
|
197
|
+
// Retry Configuration
|
|
198
|
+
// ============================================================================
|
|
199
|
+
|
|
200
|
+
export interface IRetryOptions {
|
|
201
|
+
/** Maximum number of retry attempts */
|
|
202
|
+
maxRetries?: number;
|
|
203
|
+
/** Base delay in milliseconds */
|
|
204
|
+
baseDelay?: number;
|
|
205
|
+
/** Maximum delay in milliseconds */
|
|
206
|
+
maxDelay?: number;
|
|
207
|
+
/** Delay multiplier for exponential backoff */
|
|
208
|
+
multiplier?: number;
|
|
209
|
+
/** Whether to add jitter to delays */
|
|
210
|
+
jitter?: boolean;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// ============================================================================
|
|
214
|
+
// Event Types
|
|
215
|
+
// ============================================================================
|
|
216
|
+
|
|
217
|
+
export type TDeviceManagerEvents = {
|
|
218
|
+
'scanner:found': (scanner: IScannerInfo) => void;
|
|
219
|
+
'scanner:lost': (scannerId: string) => void;
|
|
220
|
+
'printer:found': (printer: IPrinterInfo) => void;
|
|
221
|
+
'printer:lost': (printerId: string) => void;
|
|
222
|
+
'device:updated': (device: IDeviceInfo) => void;
|
|
223
|
+
'discovery:started': () => void;
|
|
224
|
+
'discovery:stopped': () => void;
|
|
225
|
+
'error': (error: Error) => void;
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
// ============================================================================
|
|
229
|
+
// eSCL Protocol Types
|
|
230
|
+
// ============================================================================
|
|
231
|
+
|
|
232
|
+
export interface IEsclCapabilities {
|
|
233
|
+
version: string;
|
|
234
|
+
makeAndModel: string;
|
|
235
|
+
serialNumber?: string;
|
|
236
|
+
uuid?: string;
|
|
237
|
+
adminUri?: string;
|
|
238
|
+
iconUri?: string;
|
|
239
|
+
platen?: IEsclInputSource;
|
|
240
|
+
adf?: IEsclInputSource;
|
|
241
|
+
adfDuplex?: IEsclInputSource;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export interface IEsclInputSource {
|
|
245
|
+
minWidth: number;
|
|
246
|
+
maxWidth: number;
|
|
247
|
+
minHeight: number;
|
|
248
|
+
maxHeight: number;
|
|
249
|
+
maxScanRegions: number;
|
|
250
|
+
supportedResolutions: number[];
|
|
251
|
+
colorModes: string[];
|
|
252
|
+
documentFormats: string[];
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export interface IEsclScanStatus {
|
|
256
|
+
state: 'Idle' | 'Processing' | 'Stopped' | 'Testing';
|
|
257
|
+
adfState?: 'Empty' | 'Loaded' | 'Jammed' | 'Open' | 'Closed';
|
|
258
|
+
jobs?: IEsclJobInfo[];
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export interface IEsclJobInfo {
|
|
262
|
+
jobUri: string;
|
|
263
|
+
jobUuid: string;
|
|
264
|
+
age: number;
|
|
265
|
+
imagesCompleted: number;
|
|
266
|
+
imagesToTransfer: number;
|
|
267
|
+
jobState: 'Pending' | 'Processing' | 'Completed' | 'Canceled' | 'Aborted';
|
|
268
|
+
jobStateReason?: string;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// ============================================================================
|
|
272
|
+
// SANE Protocol Types
|
|
273
|
+
// ============================================================================
|
|
274
|
+
|
|
275
|
+
export interface ISaneDevice {
|
|
276
|
+
name: string;
|
|
277
|
+
vendor: string;
|
|
278
|
+
model: string;
|
|
279
|
+
type: string;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export interface ISaneOption {
|
|
283
|
+
name: string;
|
|
284
|
+
title: string;
|
|
285
|
+
description: string;
|
|
286
|
+
type: 'bool' | 'int' | 'fixed' | 'string' | 'button' | 'group';
|
|
287
|
+
unit: 'none' | 'pixel' | 'bit' | 'mm' | 'dpi' | 'percent' | 'microsecond';
|
|
288
|
+
size: number;
|
|
289
|
+
capabilities: number;
|
|
290
|
+
constraintType: 'none' | 'range' | 'word_list' | 'string_list';
|
|
291
|
+
constraint?: ISaneConstraint;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export interface ISaneConstraint {
|
|
295
|
+
range?: { min: number; max: number; quant: number };
|
|
296
|
+
wordList?: number[];
|
|
297
|
+
stringList?: string[];
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export interface ISaneParameters {
|
|
301
|
+
format: 'gray' | 'rgb' | 'red' | 'green' | 'blue';
|
|
302
|
+
lastFrame: boolean;
|
|
303
|
+
bytesPerLine: number;
|
|
304
|
+
pixelsPerLine: number;
|
|
305
|
+
lines: number;
|
|
306
|
+
depth: number;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// ============================================================================
|
|
310
|
+
// Network Scanner Interfaces (IP-based discovery)
|
|
311
|
+
// ============================================================================
|
|
312
|
+
|
|
313
|
+
export interface INetworkScanOptions {
|
|
314
|
+
/** CIDR notation (e.g., "192.168.1.0/24") */
|
|
315
|
+
ipRange?: string;
|
|
316
|
+
/** Start IP address for range scan */
|
|
317
|
+
startIp?: string;
|
|
318
|
+
/** End IP address for range scan */
|
|
319
|
+
endIp?: string;
|
|
320
|
+
/** Maximum concurrent probes (default: 50) */
|
|
321
|
+
concurrency?: number;
|
|
322
|
+
/** Timeout per probe in milliseconds (default: 2000) */
|
|
323
|
+
timeout?: number;
|
|
324
|
+
/** Ports to probe (default: [80, 443, 631, 6566, 9100, 7000, 1400, 8009]) */
|
|
325
|
+
ports?: number[];
|
|
326
|
+
/** Check for eSCL scanners (default: true) */
|
|
327
|
+
probeEscl?: boolean;
|
|
328
|
+
/** Check for IPP printers (default: true) */
|
|
329
|
+
probeIpp?: boolean;
|
|
330
|
+
/** Check for SANE scanners (default: true) */
|
|
331
|
+
probeSane?: boolean;
|
|
332
|
+
/** Check for AirPlay speakers (default: true) */
|
|
333
|
+
probeAirplay?: boolean;
|
|
334
|
+
/** Check for Sonos speakers (default: true) */
|
|
335
|
+
probeSonos?: boolean;
|
|
336
|
+
/** Check for Chromecast devices (default: true) */
|
|
337
|
+
probeChromecast?: boolean;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
export interface INetworkScanDevice {
|
|
341
|
+
type: 'scanner' | 'printer' | 'speaker';
|
|
342
|
+
protocol: 'escl' | 'sane' | 'ipp' | 'jetdirect' | 'airplay' | 'sonos' | 'chromecast';
|
|
343
|
+
port: number;
|
|
344
|
+
name?: string;
|
|
345
|
+
model?: string;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
export interface INetworkScanResult {
|
|
349
|
+
address: string;
|
|
350
|
+
devices: INetworkScanDevice[];
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
export interface INetworkScanProgress {
|
|
354
|
+
/** Total IPs to scan */
|
|
355
|
+
total: number;
|
|
356
|
+
/** IPs scanned so far */
|
|
357
|
+
scanned: number;
|
|
358
|
+
/** Percentage complete (0-100) */
|
|
359
|
+
percentage: number;
|
|
360
|
+
/** Current IP being scanned */
|
|
361
|
+
currentIp?: string;
|
|
362
|
+
/** Devices found so far */
|
|
363
|
+
devicesFound: number;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
export type TNetworkScannerEvents = {
|
|
367
|
+
'progress': (progress: INetworkScanProgress) => void;
|
|
368
|
+
'device:found': (result: INetworkScanResult) => void;
|
|
369
|
+
'complete': (results: INetworkScanResult[]) => void;
|
|
370
|
+
'error': (error: Error) => void;
|
|
371
|
+
'cancelled': () => void;
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
// ============================================================================
|
|
375
|
+
// Device Selector Interface
|
|
376
|
+
// ============================================================================
|
|
377
|
+
|
|
378
|
+
import type { TFeatureType } from './feature.interfaces.js';
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Criteria for selecting devices from the manager.
|
|
382
|
+
* Identity selectors (id, address) match exactly.
|
|
383
|
+
* Attribute selectors (name, model, manufacturer) match partially (case-insensitive).
|
|
384
|
+
* Capability selectors filter by feature availability.
|
|
385
|
+
*/
|
|
386
|
+
export interface IDeviceSelector {
|
|
387
|
+
/** Exact match on device ID */
|
|
388
|
+
id?: string;
|
|
389
|
+
/** Exact match on IP address */
|
|
390
|
+
address?: string;
|
|
391
|
+
/** Partial match on device name (case-insensitive) */
|
|
392
|
+
name?: string;
|
|
393
|
+
/** Partial match on device model (case-insensitive) */
|
|
394
|
+
model?: string;
|
|
395
|
+
/** Partial match on manufacturer name (case-insensitive) */
|
|
396
|
+
manufacturer?: string;
|
|
397
|
+
/** Device must have this feature */
|
|
398
|
+
hasFeature?: TFeatureType;
|
|
399
|
+
/** Device must have ALL of these features */
|
|
400
|
+
hasFeatures?: TFeatureType[];
|
|
401
|
+
/** Device must have ANY of these features */
|
|
402
|
+
hasAnyFeature?: TFeatureType[];
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// ============================================================================
|
|
406
|
+
// Feature Types (Universal Device Architecture)
|
|
407
|
+
// ============================================================================
|
|
408
|
+
|
|
409
|
+
export * from './feature.interfaces.js';
|
|
410
|
+
|
|
411
|
+
// ============================================================================
|
|
412
|
+
// Smart Home Types (Generic, Protocol-agnostic)
|
|
413
|
+
// ============================================================================
|
|
414
|
+
|
|
415
|
+
export * from './smarthome.interfaces.js';
|
|
416
|
+
|
|
417
|
+
// ============================================================================
|
|
418
|
+
// Home Assistant Specific Types
|
|
419
|
+
// ============================================================================
|
|
420
|
+
|
|
421
|
+
export * from './homeassistant.interfaces.js';
|