node-lifx-lan-multi 1.1.8 → 1.2.0
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 +7 -5
- package/lib/lifx-lan.js +1 -0
- 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
|
/* ------------------------------------------------------------------
|
|
@@ -56,6 +56,9 @@ LifxLanUdp.prototype.init = function (config = {}) {
|
|
|
56
56
|
let promise = new Promise((resolve, reject) => {
|
|
57
57
|
this._source_id = Math.floor(Math.random() * 0xffffffff);
|
|
58
58
|
let netif_list = mAddress.getNetworkInterfaces();
|
|
59
|
+
if (config.network_interfaces && config.network_interfaces.length > 0) {
|
|
60
|
+
netif_list = (netif_list ?? []).filter(netif => config.network_interfaces.indexOf(netif.address) >= 0);
|
|
61
|
+
}
|
|
59
62
|
if (!netif_list || netif_list.length === 0) {
|
|
60
63
|
reject(new Error('No available network interface was found.'));
|
|
61
64
|
return;
|
|
@@ -67,7 +70,6 @@ LifxLanUdp.prototype.init = function (config = {}) {
|
|
|
67
70
|
reuseAddr: true
|
|
68
71
|
});
|
|
69
72
|
this._udp.once('error', (error) => {
|
|
70
|
-
console.error(error);
|
|
71
73
|
reject(error);
|
|
72
74
|
return;
|
|
73
75
|
});
|
package/lib/lifx-lan.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-lifx-lan-multi",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
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": [
|