lifxlan
Version:
TypeScript library for controlling LIFX products over LAN
172 lines • 5.62 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.GetServiceCommand = GetServiceCommand;
exports.GetHostFirmwareCommand = GetHostFirmwareCommand;
exports.GetWifiInfoCommand = GetWifiInfoCommand;
exports.GetWifiFirmwareCommand = GetWifiFirmwareCommand;
exports.GetPowerCommand = GetPowerCommand;
exports.SetPowerCommand = SetPowerCommand;
exports.GetLabelCommand = GetLabelCommand;
exports.SetLabelCommand = SetLabelCommand;
exports.GetVersionCommand = GetVersionCommand;
exports.GetInfoCommand = GetInfoCommand;
exports.SetRebootCommand = SetRebootCommand;
exports.GetLocationCommand = GetLocationCommand;
exports.SetLocationCommand = SetLocationCommand;
exports.GetGroupCommand = GetGroupCommand;
exports.SetGroupCommand = SetGroupCommand;
exports.EchoRequestCommand = EchoRequestCommand;
const Encoding = __importStar(require("../encoding.js"));
const index_js_1 = require("../constants/index.js");
const index_js_2 = require("../utils/index.js");
function GetServiceCommand() {
return {
type: index_js_1.Type.GetService,
decode: Encoding.decodeStateService,
defaultResponseMode: 'response',
};
}
function GetHostFirmwareCommand() {
return {
type: index_js_1.Type.GetHostFirmware,
decode: Encoding.decodeStateHostFirmware,
defaultResponseMode: 'response',
};
}
function GetWifiInfoCommand() {
return {
type: index_js_1.Type.GetWifiInfo,
decode: Encoding.decodeStateWifiInfo,
defaultResponseMode: 'response',
};
}
function GetWifiFirmwareCommand() {
return {
type: index_js_1.Type.GetWifiFirmware,
decode: Encoding.decodeStateWifiFirmware,
defaultResponseMode: 'response',
};
}
function GetPowerCommand() {
return {
type: index_js_1.Type.GetPower,
decode: Encoding.decodeStatePower,
defaultResponseMode: 'response',
};
}
function SetPowerCommand(power) {
return {
type: index_js_1.Type.SetPower,
payload: Encoding.encodeSetPower(power),
decode: Encoding.decodeStatePower,
defaultResponseMode: 'ack-only',
};
}
function GetLabelCommand() {
return {
type: index_js_1.Type.GetLabel,
decode: Encoding.decodeStateLabel,
defaultResponseMode: 'response',
};
}
function SetLabelCommand(label) {
return {
type: index_js_1.Type.SetLabel,
payload: Encoding.encodeString(label, 32),
decode: Encoding.decodeStateLabel,
defaultResponseMode: 'ack-only',
};
}
function GetVersionCommand() {
return {
type: index_js_1.Type.GetVersion,
decode: Encoding.decodeStateVersion,
defaultResponseMode: 'response',
};
}
function GetInfoCommand() {
return {
type: index_js_1.Type.GetInfo,
decode: Encoding.decodeStateInfo,
defaultResponseMode: 'response',
};
}
function SetRebootCommand() {
return {
type: index_js_1.Type.SetReboot,
decode: index_js_2.NOOP,
defaultResponseMode: 'ack-only',
};
}
function GetLocationCommand() {
return {
type: index_js_1.Type.GetLocation,
decode: Encoding.decodeStateLocation,
defaultResponseMode: 'response',
};
}
function SetLocationCommand(location, label, updatedAt) {
return {
type: index_js_1.Type.SetLocation,
payload: Encoding.encodeSetLocation(location, label, updatedAt),
decode: Encoding.decodeStateLocation,
defaultResponseMode: 'ack-only',
};
}
function GetGroupCommand() {
return {
type: index_js_1.Type.GetGroup,
decode: Encoding.decodeStateGroup,
defaultResponseMode: 'response',
};
}
function SetGroupCommand(group, label, updatedAt) {
return {
type: index_js_1.Type.SetGroup,
payload: Encoding.encodeSetGroup(group, label, updatedAt),
decode: Encoding.decodeStateGroup,
defaultResponseMode: 'ack-only',
};
}
function EchoRequestCommand(echoing) {
return {
type: index_js_1.Type.EchoRequest,
payload: Encoding.encodeEchoRequest(echoing),
decode: Encoding.decodeEchoResponse,
defaultResponseMode: 'response',
};
}
//# sourceMappingURL=device.js.map