11import { EventEmitter } from 'events' ;
22
3- declare module 'dlink_websocketclient' {
4- class WebSocketClient extends EventEmitter . EventEmitter {
5- constructor ( options : {
6- /**
7- * ip of device as string
8- */
9- ip : string
10- /**
11- * either Pin on the back or device token (if paired with App! Needs to be extracted, see readme).
12- */
13- pin : string ;
14-
15- /**
16- * defaults to 8080
17- */
18- port ?: number ;
19-
20- /**
21- * either w115 or w245.
22- */
23- model ?: string ;
24-
25- /**
26- * function for debug logging, defaults to noop.
27- */
28- log ?: ( string ) => void ;
29-
30- /**
31- * seconds to ping, defaults to 30. 0 to turn off.
32- */
33- keepAlive ?: number ;
34-
35- /**
36- * library should get the device token from telnet (which needs to be active).
37- */
38- useTelnetForToken ?: boolean ;
39- } ) ;
40-
41- connect ( ) : Promise < boolean > ;
42- disconnect ( ) : void ;
43- getDeviceId ( ) : string ;
44- getDeviceInfoFromTelnet ( ) : Promise < Record < string , string > > ;
45- getTokenFromTelnet ( ) : Promise < boolean > ;
46- login ( ) : Promise < boolean > ;
47- setPin ( newPin : string ) : void ;
48- isDeviceReady ( ) : boolean ;
49- switch ( on : boolean , socket : number ) : Promise < boolean > ;
50- switchLED ( on : boolean , socket : number ) : Promise < boolean > ;
51- state ( socket : number ) : Promise < boolean > ;
52- }
3+ export = WebSocketClient ;
4+ declare class WebSocketClient extends EventEmitter . EventEmitter {
5+ constructor ( options : {
6+ /**
7+ * ip of device as string
8+ */
9+ ip : string
10+ /**
11+ * either Pin on the back or device token (if paired with App! Needs to be extracted, see readme).
12+ */
13+ pin : string ;
14+
15+ /**
16+ * defaults to 8080
17+ */
18+ port ?: number ;
19+
20+ /**
21+ * either w115 or w245.
22+ */
23+ model ?: string ;
24+
25+ /**
26+ * function for debug logging, defaults to noop.
27+ */
28+ log ?: ( string ) => void ;
29+
30+ /**
31+ * seconds to ping, defaults to 30. 0 to turn off.
32+ */
33+ keepAlive ?: number ;
34+
35+ /**
36+ * library should get the device token from telnet (which needs to be active).
37+ */
38+ useTelnetForToken ?: boolean ;
39+ } ) ;
40+
41+ connect ( ) : Promise < boolean > ;
42+
43+ disconnect ( ) : void ;
44+
45+ getDeviceId ( ) : string ;
46+
47+ getDeviceInfoFromTelnet ( ) : Promise < Record < string , string > > ;
48+
49+ getTokenFromTelnet ( ) : Promise < boolean > ;
50+
51+ login ( ) : Promise < boolean > ;
52+
53+ setPin ( newPin : string ) : void ;
54+
55+ isDeviceReady ( ) : boolean ;
56+
57+ switch ( on : boolean , socket ?: number ) : Promise < boolean > ;
58+
59+ switchLED ( on : boolean , led ?: number ) : Promise < boolean > ;
60+
61+ state ( socket ?: number ) : Promise < boolean | Array < boolean > > ;
5362}
0 commit comments