Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions lib/lifx-lan-composer.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ LifxLanComposer.prototype._composePayload58 = function(payload) {
* - saturation | Float | Required | 0.0 - 1.0
* - brightness | Float | Required | 0.0 - 1.0
* - kelvin | Float | Required | 1500 - 9000
* - duration | Integer | Optional | The default value is 0 msec
* - duration | Integer | Optional | The default value is 0 (msec) - 4294967295 (msec).
* ---------------------------------------------------------------- */
LifxLanComposer.prototype._composePayload102 = function(payload) {
// Check the payload
Expand All @@ -389,8 +389,8 @@ LifxLanComposer.prototype._composePayload102 = function(payload) {
let duration = 0;
if('duration' in payload) {
duration = payload['duration'];
if(typeof(duration) !== 'number' || duration % 1 !== 0 || duration < 0 || duration > 65535) {
return {error: new Error('The `duration` must be an integer between 0 and 65535.')};
if (typeof (duration) !== 'number' || duration % 1 !== 0 || duration < 0 || duration > 0xffffffff) {
return { error: new Error('The `duration` must be an integer between 0 and 4294967295.')};
}
}
// Compose a payload
Expand Down Expand Up @@ -548,7 +548,7 @@ LifxLanComposer.prototype._composePayload103 = function(payload) {
* Method: _composePayload117(payload) : lightSetPower
* - payload:
* - level | Integer | Required | 0 or 1
* - duration | Integer | Optional | The default value is 0 msec.
* - duration | Integer | Optional | The default value is 0 (msec) - 4294967295 (msec).
* ---------------------------------------------------------------- */
LifxLanComposer.prototype._composePayload117 = function(payload) {
// Check the payload
Expand All @@ -575,7 +575,7 @@ LifxLanComposer.prototype._composePayload117 = function(payload) {
if(typeof(v) === 'number' && v % 1 === 0 && v >= 0 && v <= 0xffffffff) {
duration = v;
} else {
return {error: new Error('The value of the `duration` must be an integer between 0 and 65535.')};
return {error: new Error('The value of the `duration` must be an integer between 0 and 4294967295.')};
}
}
// Compose a payload
Expand Down Expand Up @@ -622,7 +622,7 @@ LifxLanComposer.prototype._composePayload122 = function(payload) {
* - saturation | Float | Required | 0.0 - 1.0
* - brightness | Float | Required | 0.0 - 1.0
* - kelvin | Float | Required | 1500 - 9000
* - duration | Integer | Optional | The default value is 0 msec
* - duration | Integer | Optional | The default value is 0 (msec) - 4294967295 (msec).
* - apply | Integer | Optional | The default value is 1.
* 0: NO_APPLY, 1: APPLY, 2: APPLY_ONLY
* ---------------------------------------------------------------- */
Expand Down Expand Up @@ -672,7 +672,7 @@ LifxLanComposer.prototype._composePayload501 = function(payload) {
if(typeof(v) === 'number' && v % 1 === 0 && v >= 0 && v <= 0xffffffff) {
duration = v;
} else {
return {error: new Error('The value of the `duration` must be an integer between 0 and 0xffffffff.')};
return { error: new Error('The value of the `duration` must be an integer between 0 and 4294967295.')};
}
}
// Check the `apply`
Expand Down Expand Up @@ -856,7 +856,7 @@ LifxLanComposer.prototype._composePayload707 = function(payload) {
* - x | Integer | Optional | (default: 0)
* - y | Integer | Optional | (default: 0)
* - width | Integer | Optional | (default: 8)
* - duration | Integer | Optional | Duration in milliseconds (default: 0)
* - duration | Integer | Optional | The default value is 0 (msec) - 4294967295 (msec).
* - colors | Array[Object] | Required | Array of 64 HSBK objects
* - hue | Float | Required | 0.0 - 1.0
* - saturation | Float | Required | 0.0 - 1.0
Expand Down Expand Up @@ -914,8 +914,8 @@ LifxLanComposer.prototype._composePayload715 = function(payload) {
let duration = 0;
if('duration' in payload) {
duration = payload['duration'];
if(typeof(duration) !== 'number' || duration % 1 !== 0 || duration < 0 || duration > 65535) {
return {error: new Error('The `duration` must be an integer between 0 and 65535.')};
if (typeof (duration) !== 'number' || duration % 1 !== 0 || duration < 0 || duration > 0xffffffff) {
return { error: new Error('The `duration` must be an integer between 0 and 4294967295.')};
}
}
// Check the `colors`
Expand Down Expand Up @@ -959,7 +959,7 @@ LifxLanComposer.prototype._composePayload715 = function(payload) {
* - payload:
* - type | Integer | Required | 0 or 1
* - speed | Integer | Required | Speed in milliseconds
* - duration | Integer | Optional | Duration in milliseconds (default: 0 - infinite)
* - duration | Integer | Optional | Duration in milliseconds (default: 0 - 18,446,744,073,709,551,615)
* - direction | Integer | Optional | (default: 0)
* ---------------------------------------------------------------- */
//
Expand Down Expand Up @@ -987,7 +987,7 @@ LifxLanComposer.prototype._composePayload508 = function(payload) {
let duration = 0;
if('duration' in payload) {
duration = payload['duration'] * 1000000; // convert from miliseconds to nanoseconds
if(typeof(duration) !== 'number' || duration % 1 !== 0 || duration < 0 || duration > Math.pow(2, 64)) {
if(typeof(duration) !== 'number' || duration % 1 !== 0 || duration < 0 || duration >= Math.pow(2, 64)) {
return {error: new Error('The `duration` must be an integer between 0 and 2^64.')};
}
}
Expand Down