UNPKG

lifxlan

Version:

TypeScript library for controlling LIFX products over LAN

149 lines 5.83 kB
"use strict"; 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.GetColorCommand = GetColorCommand; exports.SetColorCommand = SetColorCommand; exports.SetWaveformCommand = SetWaveformCommand; exports.GetLightPowerCommand = GetLightPowerCommand; exports.SetLightPowerCommand = SetLightPowerCommand; exports.SetWaveformOptionalCommand = SetWaveformOptionalCommand; exports.GetInfraredCommand = GetInfraredCommand; exports.SetInfraredCommand = SetInfraredCommand; exports.GetHevCycleCommand = GetHevCycleCommand; exports.SetHevCycleCommand = SetHevCycleCommand; exports.GetHevCycleConfigurationCommand = GetHevCycleConfigurationCommand; exports.SetHevCycleConfigurationCommand = SetHevCycleConfigurationCommand; exports.GetLastHevCycleResultCommand = GetLastHevCycleResultCommand; const Encoding = __importStar(require("../encoding.js")); const index_js_1 = require("../constants/index.js"); function GetColorCommand() { return { type: index_js_1.Type.GetColor, decode: Encoding.decodeLightState, defaultResponseMode: 'response', }; } function SetColorCommand(hue, saturation, brightness, kelvin, duration) { return { type: index_js_1.Type.SetColor, payload: Encoding.encodeSetColor(hue, saturation, brightness, kelvin, duration), decode: Encoding.decodeLightState, defaultResponseMode: 'ack-only', }; } function SetWaveformCommand(transient, hue, saturation, brightness, kelvin, period, cycles, skewRatio, waveform) { return { type: index_js_1.Type.SetWaveform, payload: Encoding.encodeSetWaveform(transient, hue, saturation, brightness, kelvin, period, cycles, skewRatio, waveform), decode: Encoding.decodeLightState, defaultResponseMode: 'ack-only', }; } function GetLightPowerCommand() { return { type: index_js_1.Type.GetLightPower, decode: Encoding.decodeStateLightPower, defaultResponseMode: 'response', }; } function SetLightPowerCommand(level, duration) { return { type: index_js_1.Type.SetLightPower, payload: Encoding.encodeSetLightPower(level, duration), decode: Encoding.decodeStateLightPower, defaultResponseMode: 'ack-only', }; } function SetWaveformOptionalCommand(transient, hue, saturation, brightness, kelvin, period, cycles, skewRatio, waveform, setHue, setSaturation, setBrightness, setKelvin) { return { type: index_js_1.Type.SetWaveformOptional, payload: Encoding.encodeSetWaveformOptional(transient, hue, saturation, brightness, kelvin, period, cycles, skewRatio, waveform, setHue, setSaturation, setBrightness, setKelvin), decode: Encoding.decodeStateLightPower, defaultResponseMode: 'ack-only', }; } function GetInfraredCommand() { return { type: index_js_1.Type.GetInfrared, decode: Encoding.decodeStateInfrared, defaultResponseMode: 'response', }; } function SetInfraredCommand(brightness) { return { type: index_js_1.Type.SetInfrared, payload: Encoding.encodeSetInfrared(brightness), decode: Encoding.decodeStateInfrared, defaultResponseMode: 'ack-only', }; } function GetHevCycleCommand() { return { type: index_js_1.Type.GetHevCycle, decode: Encoding.decodeStateHevCycle, defaultResponseMode: 'response', }; } function SetHevCycleCommand(enable, durationSeconds) { return { type: index_js_1.Type.SetHevCycle, payload: Encoding.encodeSetHevCycle(enable, durationSeconds), decode: Encoding.decodeStateHevCycle, defaultResponseMode: 'ack-only', }; } function GetHevCycleConfigurationCommand() { return { type: index_js_1.Type.GetHevCycleConfiguration, decode: Encoding.decodeStateHevCycleConfiguration, defaultResponseMode: 'response', }; } function SetHevCycleConfigurationCommand(indication, durationSeconds) { return { type: index_js_1.Type.SetHevCycleConfiguration, payload: Encoding.encodeSetHevCycleConfiguration(indication, durationSeconds), decode: Encoding.decodeStateHevCycleConfiguration, defaultResponseMode: 'ack-only', }; } function GetLastHevCycleResultCommand() { return { type: index_js_1.Type.GetLastHevCycleResult, decode: Encoding.decodeStateLastHevCycleResult, defaultResponseMode: 'response', }; } //# sourceMappingURL=light.js.map