@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
package/ts/index.ts
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @push.rocks/devicemanager
|
|
3
|
+
* A comprehensive device manager for discovering and communicating with network devices
|
|
4
|
+
* Supports: Scanners, Printers, SNMP devices, UPS, DLNA, Sonos, AirPlay, Chromecast
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// Core Device Manager
|
|
9
|
+
// ============================================================================
|
|
10
|
+
|
|
11
|
+
export {
|
|
12
|
+
DeviceManager,
|
|
13
|
+
MdnsDiscovery,
|
|
14
|
+
NetworkScanner,
|
|
15
|
+
SsdpDiscovery,
|
|
16
|
+
SERVICE_TYPES,
|
|
17
|
+
SSDP_SERVICE_TYPES,
|
|
18
|
+
} from './devicemanager.classes.devicemanager.js';
|
|
19
|
+
|
|
20
|
+
// ============================================================================
|
|
21
|
+
// Universal Device & Features
|
|
22
|
+
// ============================================================================
|
|
23
|
+
|
|
24
|
+
export { UniversalDevice, type IUniversalDeviceInfo, type IDeviceCreateOptions } from './device/device.classes.device.js';
|
|
25
|
+
export {
|
|
26
|
+
Feature,
|
|
27
|
+
ScanFeature,
|
|
28
|
+
PrintFeature,
|
|
29
|
+
PlaybackFeature,
|
|
30
|
+
VolumeFeature,
|
|
31
|
+
PowerFeature,
|
|
32
|
+
SnmpFeature,
|
|
33
|
+
// Smart home features
|
|
34
|
+
SwitchFeature,
|
|
35
|
+
SensorFeature,
|
|
36
|
+
LightFeature,
|
|
37
|
+
CoverFeature,
|
|
38
|
+
LockFeature,
|
|
39
|
+
FanFeature,
|
|
40
|
+
ClimateFeature,
|
|
41
|
+
CameraFeature,
|
|
42
|
+
type TDeviceReference,
|
|
43
|
+
type IScanFeatureOptions,
|
|
44
|
+
type IPrintFeatureOptions,
|
|
45
|
+
type IPlaybackFeatureOptions,
|
|
46
|
+
type IVolumeFeatureOptions,
|
|
47
|
+
type IVolumeController,
|
|
48
|
+
type IPowerFeatureOptions,
|
|
49
|
+
type ISnmpFeatureOptions,
|
|
50
|
+
type ISwitchFeatureOptions,
|
|
51
|
+
type ISensorFeatureOptions,
|
|
52
|
+
type ILightFeatureOptions,
|
|
53
|
+
type ICoverFeatureOptions,
|
|
54
|
+
type ILockFeatureOptions,
|
|
55
|
+
type IFanFeatureOptions,
|
|
56
|
+
type IClimateFeatureOptions,
|
|
57
|
+
type ICameraFeatureOptions,
|
|
58
|
+
} from './features/index.js';
|
|
59
|
+
|
|
60
|
+
// ============================================================================
|
|
61
|
+
// Device Factories
|
|
62
|
+
// ============================================================================
|
|
63
|
+
|
|
64
|
+
export {
|
|
65
|
+
createScanner,
|
|
66
|
+
createPrinter,
|
|
67
|
+
createSnmpDevice,
|
|
68
|
+
createUpsDevice,
|
|
69
|
+
createSpeaker,
|
|
70
|
+
createDlnaRenderer,
|
|
71
|
+
// Smart home factories
|
|
72
|
+
createSmartSwitch,
|
|
73
|
+
createSmartSensor,
|
|
74
|
+
createSmartLight,
|
|
75
|
+
createSmartCover,
|
|
76
|
+
createSmartLock,
|
|
77
|
+
createSmartFan,
|
|
78
|
+
createSmartClimate,
|
|
79
|
+
createSmartCamera,
|
|
80
|
+
type IScannerDiscoveryInfo,
|
|
81
|
+
type IPrinterDiscoveryInfo,
|
|
82
|
+
type ISnmpDiscoveryInfo,
|
|
83
|
+
type IUpsDiscoveryInfo,
|
|
84
|
+
type ISpeakerDiscoveryInfo,
|
|
85
|
+
type IDlnaRendererDiscoveryInfo,
|
|
86
|
+
type ISmartSwitchDiscoveryInfo,
|
|
87
|
+
type ISmartSensorDiscoveryInfo,
|
|
88
|
+
type ISmartLightDiscoveryInfo,
|
|
89
|
+
type ISmartCoverDiscoveryInfo,
|
|
90
|
+
type ISmartLockDiscoveryInfo,
|
|
91
|
+
type ISmartFanDiscoveryInfo,
|
|
92
|
+
type ISmartClimateDiscoveryInfo,
|
|
93
|
+
type ISmartCameraDiscoveryInfo,
|
|
94
|
+
} from './factories/index.js';
|
|
95
|
+
|
|
96
|
+
// ============================================================================
|
|
97
|
+
// Protocol Implementations
|
|
98
|
+
// ============================================================================
|
|
99
|
+
|
|
100
|
+
export {
|
|
101
|
+
EsclProtocol,
|
|
102
|
+
SaneProtocol,
|
|
103
|
+
IppProtocol,
|
|
104
|
+
SnmpProtocol,
|
|
105
|
+
SNMP_OIDS,
|
|
106
|
+
NutProtocol,
|
|
107
|
+
NUT_COMMANDS,
|
|
108
|
+
NUT_VARIABLES,
|
|
109
|
+
UpnpSoapClient,
|
|
110
|
+
UPNP_SERVICE_TYPES,
|
|
111
|
+
UPNP_DEVICE_TYPES,
|
|
112
|
+
UpsSnmpHandler,
|
|
113
|
+
UPS_SNMP_OIDS,
|
|
114
|
+
// Home Assistant protocol
|
|
115
|
+
HomeAssistantProtocol,
|
|
116
|
+
type ISnmpOptions,
|
|
117
|
+
type ISnmpVarbind,
|
|
118
|
+
type TSnmpValueType,
|
|
119
|
+
type TNutStatusFlag,
|
|
120
|
+
type INutUpsInfo,
|
|
121
|
+
type INutVariable,
|
|
122
|
+
type TDlnaTransportState,
|
|
123
|
+
type TDlnaTransportStatus,
|
|
124
|
+
type IDlnaPositionInfo,
|
|
125
|
+
type IDlnaTransportInfo,
|
|
126
|
+
type IDlnaMediaInfo,
|
|
127
|
+
type IDlnaContentItem,
|
|
128
|
+
type IDlnaBrowseResult,
|
|
129
|
+
type TUpsBatteryStatus,
|
|
130
|
+
type TUpsOutputSource,
|
|
131
|
+
type TUpsTestResult,
|
|
132
|
+
type IUpsSnmpStatus,
|
|
133
|
+
} from './protocols/index.js';
|
|
134
|
+
|
|
135
|
+
// Home Assistant Discovery
|
|
136
|
+
export { HomeAssistantDiscovery, HA_SERVICE_TYPE } from './discovery/discovery.classes.homeassistant.js';
|
|
137
|
+
|
|
138
|
+
// ============================================================================
|
|
139
|
+
// Helpers
|
|
140
|
+
// ============================================================================
|
|
141
|
+
|
|
142
|
+
export { withRetry, createRetryable, defaultRetryOptions } from './helpers/helpers.retry.js';
|
|
143
|
+
export {
|
|
144
|
+
isValidIp,
|
|
145
|
+
ipToNumber,
|
|
146
|
+
numberToIp,
|
|
147
|
+
ipRangeToIps,
|
|
148
|
+
cidrToIps,
|
|
149
|
+
getLocalSubnet,
|
|
150
|
+
countIpsInCidr,
|
|
151
|
+
} from './helpers/helpers.iprange.js';
|
|
152
|
+
|
|
153
|
+
// ============================================================================
|
|
154
|
+
// All Interfaces and Types
|
|
155
|
+
// ============================================================================
|
|
156
|
+
|
|
157
|
+
export * from './interfaces/index.js';
|
|
158
|
+
|
|
159
|
+
// SSDP types
|
|
160
|
+
export type {
|
|
161
|
+
ISsdpDevice,
|
|
162
|
+
ISsdpDeviceDescription,
|
|
163
|
+
ISsdpService,
|
|
164
|
+
ISsdpIcon,
|
|
165
|
+
} from './discovery/discovery.classes.ssdp.js';
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feature Type Definitions
|
|
3
|
+
* Features are composable capabilities that can be attached to devices
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { IRetryOptions } from './index.js';
|
|
7
|
+
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// Feature Types
|
|
10
|
+
// ============================================================================
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* All supported feature types
|
|
14
|
+
*/
|
|
15
|
+
export type TFeatureType =
|
|
16
|
+
// Document handling
|
|
17
|
+
| 'scan' // Can scan documents (eSCL, SANE)
|
|
18
|
+
| 'print' // Can print documents (IPP, JetDirect)
|
|
19
|
+
| 'fax' // Can send/receive fax
|
|
20
|
+
| 'copy' // Can copy (scan + print combined)
|
|
21
|
+
// Media playback
|
|
22
|
+
| 'playback' // Can play media (audio/video)
|
|
23
|
+
| 'volume' // Has volume control
|
|
24
|
+
// Infrastructure
|
|
25
|
+
| 'power' // Has power status (UPS, smart plug)
|
|
26
|
+
| 'snmp' // SNMP queryable
|
|
27
|
+
// DLNA
|
|
28
|
+
| 'dlna-render' // DLNA renderer
|
|
29
|
+
| 'dlna-serve' // DLNA server (content provider)
|
|
30
|
+
// Smart home (protocol-agnostic: home-assistant, hue, mqtt, etc.)
|
|
31
|
+
| 'light' // Brightness, color, effects
|
|
32
|
+
| 'climate' // Temperature, HVAC modes
|
|
33
|
+
| 'sensor' // Read-only state values
|
|
34
|
+
| 'camera' // Snapshots, streams
|
|
35
|
+
| 'cover' // Blinds, garage doors
|
|
36
|
+
| 'switch' // Binary on/off
|
|
37
|
+
| 'lock' // Lock/unlock
|
|
38
|
+
| 'fan' // Speed, oscillation
|
|
39
|
+
;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Feature connection state
|
|
43
|
+
*/
|
|
44
|
+
export type TFeatureState = 'disconnected' | 'connecting' | 'connected' | 'error';
|
|
45
|
+
|
|
46
|
+
// ============================================================================
|
|
47
|
+
// Base Feature Interface
|
|
48
|
+
// ============================================================================
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Base interface for all features
|
|
52
|
+
*/
|
|
53
|
+
export interface IFeature {
|
|
54
|
+
/** Feature type identifier */
|
|
55
|
+
readonly type: TFeatureType;
|
|
56
|
+
/** Protocol used by this feature */
|
|
57
|
+
readonly protocol: string;
|
|
58
|
+
/** Current feature state */
|
|
59
|
+
readonly state: TFeatureState;
|
|
60
|
+
/** Port used by this feature (may differ from device port) */
|
|
61
|
+
readonly port: number;
|
|
62
|
+
/** Connect to the feature endpoint */
|
|
63
|
+
connect(): Promise<void>;
|
|
64
|
+
/** Disconnect from the feature endpoint */
|
|
65
|
+
disconnect(): Promise<void>;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Feature info for serialization
|
|
70
|
+
*/
|
|
71
|
+
export interface IFeatureInfo {
|
|
72
|
+
type: TFeatureType;
|
|
73
|
+
protocol: string;
|
|
74
|
+
port: number;
|
|
75
|
+
state: TFeatureState;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// ============================================================================
|
|
79
|
+
// Scan Feature
|
|
80
|
+
// ============================================================================
|
|
81
|
+
|
|
82
|
+
export type TScanProtocol = 'escl' | 'sane' | 'wia';
|
|
83
|
+
export type TScanFormat = 'png' | 'jpeg' | 'pdf' | 'tiff';
|
|
84
|
+
export type TColorMode = 'color' | 'grayscale' | 'blackwhite';
|
|
85
|
+
export type TScanSource = 'flatbed' | 'adf' | 'adf-duplex';
|
|
86
|
+
|
|
87
|
+
export interface IScanCapabilities {
|
|
88
|
+
resolutions: number[];
|
|
89
|
+
formats: TScanFormat[];
|
|
90
|
+
colorModes: TColorMode[];
|
|
91
|
+
sources: TScanSource[];
|
|
92
|
+
maxWidth: number; // mm
|
|
93
|
+
maxHeight: number; // mm
|
|
94
|
+
minWidth: number; // mm
|
|
95
|
+
minHeight: number; // mm
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface IScanArea {
|
|
99
|
+
x: number; // X offset in mm
|
|
100
|
+
y: number; // Y offset in mm
|
|
101
|
+
width: number; // Width in mm
|
|
102
|
+
height: number; // Height in mm
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface IScanOptions {
|
|
106
|
+
resolution?: number;
|
|
107
|
+
format?: TScanFormat;
|
|
108
|
+
colorMode?: TColorMode;
|
|
109
|
+
source?: TScanSource;
|
|
110
|
+
area?: IScanArea;
|
|
111
|
+
intent?: 'document' | 'photo' | 'preview';
|
|
112
|
+
quality?: number; // 1-100 for JPEG
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface IScanResult {
|
|
116
|
+
data: Buffer;
|
|
117
|
+
format: TScanFormat;
|
|
118
|
+
width: number;
|
|
119
|
+
height: number;
|
|
120
|
+
resolution: number;
|
|
121
|
+
colorMode: TColorMode;
|
|
122
|
+
mimeType: string;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface IScanFeatureInfo extends IFeatureInfo {
|
|
126
|
+
type: 'scan';
|
|
127
|
+
protocol: TScanProtocol;
|
|
128
|
+
supportedFormats: TScanFormat[];
|
|
129
|
+
supportedResolutions: number[];
|
|
130
|
+
supportedColorModes: TColorMode[];
|
|
131
|
+
supportedSources: TScanSource[];
|
|
132
|
+
hasAdf: boolean;
|
|
133
|
+
hasDuplex: boolean;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// ============================================================================
|
|
137
|
+
// Print Feature
|
|
138
|
+
// ============================================================================
|
|
139
|
+
|
|
140
|
+
export type TPrintProtocol = 'ipp' | 'jetdirect' | 'lpd';
|
|
141
|
+
export type TPrintSides = 'one-sided' | 'two-sided-long-edge' | 'two-sided-short-edge';
|
|
142
|
+
export type TPrintQuality = 'draft' | 'normal' | 'high';
|
|
143
|
+
export type TPrintColorMode = 'color' | 'monochrome';
|
|
144
|
+
|
|
145
|
+
export interface IPrintCapabilities {
|
|
146
|
+
colorSupported: boolean;
|
|
147
|
+
duplexSupported: boolean;
|
|
148
|
+
mediaSizes: string[];
|
|
149
|
+
mediaTypes: string[];
|
|
150
|
+
resolutions: number[];
|
|
151
|
+
maxCopies: number;
|
|
152
|
+
sidesSupported: TPrintSides[];
|
|
153
|
+
qualitySupported: TPrintQuality[];
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export interface IPrintOptions {
|
|
157
|
+
copies?: number;
|
|
158
|
+
mediaSize?: string;
|
|
159
|
+
mediaType?: string;
|
|
160
|
+
sides?: TPrintSides;
|
|
161
|
+
quality?: TPrintQuality;
|
|
162
|
+
colorMode?: TPrintColorMode;
|
|
163
|
+
jobName?: string;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface IPrintJob {
|
|
167
|
+
id: number;
|
|
168
|
+
name: string;
|
|
169
|
+
state: 'pending' | 'processing' | 'completed' | 'canceled' | 'aborted';
|
|
170
|
+
stateReason?: string;
|
|
171
|
+
createdAt: Date;
|
|
172
|
+
completedAt?: Date;
|
|
173
|
+
pagesPrinted?: number;
|
|
174
|
+
pagesTotal?: number;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export interface IPrintFeatureInfo extends IFeatureInfo {
|
|
178
|
+
type: 'print';
|
|
179
|
+
protocol: TPrintProtocol;
|
|
180
|
+
supportsColor: boolean;
|
|
181
|
+
supportsDuplex: boolean;
|
|
182
|
+
supportedMediaSizes: string[];
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// ============================================================================
|
|
186
|
+
// Playback Feature
|
|
187
|
+
// ============================================================================
|
|
188
|
+
|
|
189
|
+
export type TPlaybackProtocol = 'sonos' | 'airplay' | 'chromecast' | 'dlna';
|
|
190
|
+
export type TPlaybackState = 'playing' | 'paused' | 'stopped' | 'buffering' | 'unknown';
|
|
191
|
+
|
|
192
|
+
export interface ITrackInfo {
|
|
193
|
+
title?: string;
|
|
194
|
+
artist?: string;
|
|
195
|
+
album?: string;
|
|
196
|
+
albumArtUri?: string;
|
|
197
|
+
duration?: number; // seconds
|
|
198
|
+
uri?: string;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export interface IPlaybackStatus {
|
|
202
|
+
state: TPlaybackState;
|
|
203
|
+
position: number; // seconds
|
|
204
|
+
duration: number; // seconds
|
|
205
|
+
track?: ITrackInfo;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export interface IPlaybackFeatureInfo extends IFeatureInfo {
|
|
209
|
+
type: 'playback';
|
|
210
|
+
protocol: TPlaybackProtocol;
|
|
211
|
+
supportsQueue: boolean;
|
|
212
|
+
supportsSeek: boolean;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// ============================================================================
|
|
216
|
+
// Volume Feature
|
|
217
|
+
// ============================================================================
|
|
218
|
+
|
|
219
|
+
export interface IVolumeFeatureInfo extends IFeatureInfo {
|
|
220
|
+
type: 'volume';
|
|
221
|
+
minVolume: number;
|
|
222
|
+
maxVolume: number;
|
|
223
|
+
volumeStep: number;
|
|
224
|
+
supportsMute: boolean;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// ============================================================================
|
|
228
|
+
// Power Feature (UPS, Smart Plugs)
|
|
229
|
+
// ============================================================================
|
|
230
|
+
|
|
231
|
+
export type TPowerProtocol = 'nut' | 'snmp' | 'smart-plug';
|
|
232
|
+
export type TPowerStatus = 'online' | 'onbattery' | 'lowbattery' | 'charging' | 'discharging' | 'bypass' | 'offline' | 'error' | 'unknown';
|
|
233
|
+
|
|
234
|
+
export interface IBatteryInfo {
|
|
235
|
+
charge: number; // 0-100%
|
|
236
|
+
runtime: number; // seconds remaining
|
|
237
|
+
voltage?: number; // volts
|
|
238
|
+
temperature?: number; // celsius
|
|
239
|
+
health?: 'good' | 'weak' | 'replace';
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export interface IPowerInfo {
|
|
243
|
+
inputVoltage?: number;
|
|
244
|
+
outputVoltage?: number;
|
|
245
|
+
inputFrequency?: number;
|
|
246
|
+
outputFrequency?: number;
|
|
247
|
+
load?: number; // 0-100%
|
|
248
|
+
power?: number; // watts
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export interface IPowerFeatureInfo extends IFeatureInfo {
|
|
252
|
+
type: 'power';
|
|
253
|
+
protocol: TPowerProtocol;
|
|
254
|
+
hasBattery: boolean;
|
|
255
|
+
supportsShutdown: boolean;
|
|
256
|
+
supportsTest: boolean;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// ============================================================================
|
|
260
|
+
// SNMP Feature
|
|
261
|
+
// ============================================================================
|
|
262
|
+
|
|
263
|
+
export type TSnmpVersion = 'v1' | 'v2c' | 'v3';
|
|
264
|
+
|
|
265
|
+
export interface ISnmpVarbind {
|
|
266
|
+
oid: string;
|
|
267
|
+
type: number;
|
|
268
|
+
value: unknown;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export interface ISnmpFeatureInfo extends IFeatureInfo {
|
|
272
|
+
type: 'snmp';
|
|
273
|
+
version: TSnmpVersion;
|
|
274
|
+
community?: string; // for v1/v2c
|
|
275
|
+
sysDescr?: string;
|
|
276
|
+
sysName?: string;
|
|
277
|
+
sysLocation?: string;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// ============================================================================
|
|
281
|
+
// DLNA Render Feature
|
|
282
|
+
// ============================================================================
|
|
283
|
+
|
|
284
|
+
export interface IDlnaTransportInfo {
|
|
285
|
+
state: 'STOPPED' | 'PLAYING' | 'PAUSED' | 'TRANSITIONING' | 'NO_MEDIA_PRESENT';
|
|
286
|
+
status: string;
|
|
287
|
+
speed: string;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export interface IDlnaPositionInfo {
|
|
291
|
+
track: number;
|
|
292
|
+
trackDuration: string;
|
|
293
|
+
trackMetaData?: string;
|
|
294
|
+
trackUri?: string;
|
|
295
|
+
relTime: string;
|
|
296
|
+
absTime: string;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export interface IDlnaRenderFeatureInfo extends IFeatureInfo {
|
|
300
|
+
type: 'dlna-render';
|
|
301
|
+
udn: string;
|
|
302
|
+
friendlyName: string;
|
|
303
|
+
supportsVolume: boolean;
|
|
304
|
+
supportedProtocols: string[];
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// ============================================================================
|
|
308
|
+
// DLNA Server Feature
|
|
309
|
+
// ============================================================================
|
|
310
|
+
|
|
311
|
+
export interface IDlnaContentItem {
|
|
312
|
+
id: string;
|
|
313
|
+
parentId: string;
|
|
314
|
+
title: string;
|
|
315
|
+
class: string;
|
|
316
|
+
restricted: boolean;
|
|
317
|
+
uri?: string;
|
|
318
|
+
albumArtUri?: string;
|
|
319
|
+
duration?: string;
|
|
320
|
+
size?: number;
|
|
321
|
+
isContainer: boolean;
|
|
322
|
+
childCount?: number;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export interface IDlnaBrowseResult {
|
|
326
|
+
items: IDlnaContentItem[];
|
|
327
|
+
numberReturned: number;
|
|
328
|
+
totalMatches: number;
|
|
329
|
+
updateId: number;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
export interface IDlnaServeFeatureInfo extends IFeatureInfo {
|
|
333
|
+
type: 'dlna-serve';
|
|
334
|
+
udn: string;
|
|
335
|
+
friendlyName: string;
|
|
336
|
+
contentCount?: number;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// ============================================================================
|
|
340
|
+
// Discovery Types
|
|
341
|
+
// ============================================================================
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Feature discovered during network scan or mDNS/SSDP
|
|
345
|
+
*/
|
|
346
|
+
export interface IDiscoveredFeature {
|
|
347
|
+
type: TFeatureType;
|
|
348
|
+
protocol: string;
|
|
349
|
+
port: number;
|
|
350
|
+
metadata: Record<string, unknown>;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Options for creating a feature instance
|
|
355
|
+
*/
|
|
356
|
+
export interface IFeatureOptions {
|
|
357
|
+
retryOptions?: IRetryOptions;
|
|
358
|
+
metadata?: Record<string, unknown>;
|
|
359
|
+
}
|