node-lifx-lan-multi 1.1.7 → 1.1.9
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/lib/lifx-lan-device.js +0 -2
- package/lib/lifx-lan-udp.js +4 -11
- package/package.json +1 -1
package/lib/lifx-lan-device.js
CHANGED
|
@@ -74,7 +74,6 @@ LifxLanDevice.prototype._request = function (type, payload) {
|
|
|
74
74
|
: this._extractPayload(res);
|
|
75
75
|
resolve(payload);
|
|
76
76
|
}).catch((error) => {
|
|
77
|
-
console.error(error);
|
|
78
77
|
reject(error);
|
|
79
78
|
});
|
|
80
79
|
});
|
|
@@ -370,7 +369,6 @@ LifxLanDevice.prototype.getDeviceInfo = function () {
|
|
|
370
369
|
this.deviceInfo = info;
|
|
371
370
|
resolve(JSON.parse(JSON.stringify(info)));
|
|
372
371
|
}).catch((error) => {
|
|
373
|
-
console.error(error);
|
|
374
372
|
reject(error);
|
|
375
373
|
});
|
|
376
374
|
});
|
package/lib/lifx-lan-udp.js
CHANGED
|
@@ -20,13 +20,13 @@ const LifxLanUdp = function () {
|
|
|
20
20
|
this._udp = null;
|
|
21
21
|
this._requests = {};
|
|
22
22
|
this._sequence = 0;
|
|
23
|
-
this._timeout =
|
|
23
|
+
this._timeout = 30000; // msec
|
|
24
24
|
this._source_id = 0;
|
|
25
25
|
this._netif_list = null;
|
|
26
26
|
|
|
27
|
-
this._send_times_for_req =
|
|
28
|
-
this._send_times_for_cast =
|
|
29
|
-
this._send_interval =
|
|
27
|
+
this._send_times_for_req = 3;
|
|
28
|
+
this._send_times_for_cast = 2;
|
|
29
|
+
this._send_interval = 100; // msec
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
/* ------------------------------------------------------------------
|
|
@@ -67,7 +67,6 @@ LifxLanUdp.prototype.init = function (config = {}) {
|
|
|
67
67
|
reuseAddr: true
|
|
68
68
|
});
|
|
69
69
|
this._udp.once('error', (error) => {
|
|
70
|
-
console.error(error);
|
|
71
70
|
reject(error);
|
|
72
71
|
return;
|
|
73
72
|
});
|
|
@@ -317,24 +316,18 @@ LifxLanUdp.prototype._checkRequestParams = function (params) {
|
|
|
317
316
|
};
|
|
318
317
|
|
|
319
318
|
LifxLanUdp.prototype._receivePacket = function (buf, rinfo) {
|
|
320
|
-
console.log("LIFX packet received");
|
|
321
319
|
if (this._isNetworkInterfaceAddress(rinfo.address)) {
|
|
322
|
-
console.log("LIFX packet is addressed to network interface address, ignoring");
|
|
323
320
|
return;
|
|
324
321
|
}
|
|
325
322
|
let parsed = mParser.parse(buf);
|
|
326
323
|
if (!parsed) {
|
|
327
|
-
console.log("LIFX packet could not be parsed");
|
|
328
324
|
return;
|
|
329
325
|
}
|
|
330
326
|
parsed['address'] = rinfo.address;
|
|
331
327
|
let seq = parsed['header']['sequence'];
|
|
332
328
|
let callback = this._requests[seq];
|
|
333
329
|
if (callback) {
|
|
334
|
-
console.log("LIFX packet callback");
|
|
335
330
|
callback(parsed);
|
|
336
|
-
} else {
|
|
337
|
-
console.log("LIFX packet no callback identified");
|
|
338
331
|
}
|
|
339
332
|
};
|
|
340
333
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-lifx-lan-multi",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.9",
|
|
4
4
|
"description": "The node-lifx-lan is a Node.js module which allows you to communicate with the Wi-Fi LED smart light products \"LIFX\" using the LAN protocol.",
|
|
5
5
|
"main": "./lib/lifx-lan.js",
|
|
6
6
|
"files": [
|