UNPKG

@constructorfleet/ultimate-govee

Version:

Library for interacting with Govee devices written in Typescript.

107 lines 4.81 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.RGBICLightFactory = exports.RGBICLightDevice = exports.RGBICLightType = void 0; const common_1 = require("@nestjs/common"); const states_1 = require("../../../states"); const rgbic_light_modes_1 = require("./rgbic-light.modes"); const device_factory_1 = require("../../../device.factory"); const light_device_1 = require("../light.device"); const rgbic_light_modes_2 = require("./rgbic-light.modes"); const StateFactory = [ (device) => new states_1.PowerState(device), (device) => new states_1.ConnectedState(device), (device) => new states_1.ActiveState(device), (device) => new states_1.BrightnessState(device), (device) => new states_1.ColorTempState(device), (device) => new rgbic_light_modes_1.ColorModeState(device), (device) => new rgbic_light_modes_1.SceneModeState(device), (device) => new rgbic_light_modes_1.MicModeState(device), (device) => new rgbic_light_modes_1.DiyModeState(device), (device) => new rgbic_light_modes_1.SegmentColorModeState(device), ]; exports.RGBICLightType = 'rgbic'; class RGBICLightDevice extends light_device_1.LightDevice { get deviceType() { return RGBICLightDevice.deviceType; } constructor(device, eventBus, commandBus) { super(device, eventBus, commandBus, StateFactory); this.addState(new rgbic_light_modes_1.RGBICActiveState(device, [ this.state(rgbic_light_modes_1.WholeColorModeStateName), this.state(rgbic_light_modes_2.MicModeStateName), this.state(rgbic_light_modes_1.SegmentColorModeStateName), this.state(rgbic_light_modes_1.DiyModeStateName), this.state(states_1.LightEffectStateName), ])); } get [states_1.PowerStateName]() { return this.state(states_1.PowerStateName); } get [states_1.ConnectedStateName]() { return this.state(states_1.ConnectedStateName); } get [states_1.ActiveStateName]() { return this.state(states_1.ActiveStateName); } get [states_1.BrightnessStateName]() { return this.state(states_1.BrightnessStateName); } get [states_1.ColorTempStateName]() { return this.state(states_1.ColorTempStateName); } get [rgbic_light_modes_1.WholeColorModeStateName]() { return this.state(rgbic_light_modes_1.WholeColorModeStateName); } get [states_1.LightEffectStateName]() { return this.state(states_1.LightEffectStateName); } get [rgbic_light_modes_2.MicModeStateName]() { return this.state(rgbic_light_modes_2.MicModeStateName); } get [rgbic_light_modes_1.DiyModeStateName]() { return this.state(rgbic_light_modes_1.DiyModeStateName); } get [states_1.ModeStateName]() { return this.state(states_1.ModeStateName); } get [rgbic_light_modes_1.SegmentColorModeStateName]() { return this.state(rgbic_light_modes_1.SegmentColorModeStateName); } } exports.RGBICLightDevice = RGBICLightDevice; RGBICLightDevice.deviceType = exports.RGBICLightType; let RGBICLightFactory = class RGBICLightFactory extends device_factory_1.DeviceFactory { constructor() { super(RGBICLightDevice, { 'LED Strip Light': { 'RGBIC Strip Lights': [/.*rgbic strip light.*/i, /.*rgbic.*/i], }, 'Indoor Lighting': { 'Floor Lamps': [/.*rgbic strip light.*/i, /.*rgbic.*/i], 'Wall Lamps': [/.*glide.*/i], }, 'Outdoor Lighting': { 'Strip Lights': [/.*phantasy.*/i, /.*rgbic.*/i], 'String Lights': [/.*rgbic.*/i], }, 'Other Lights': { 'Car Lights': [/.*rgbic.*/i], }, }); } }; exports.RGBICLightFactory = RGBICLightFactory; exports.RGBICLightFactory = RGBICLightFactory = __decorate([ (0, common_1.Injectable)(), __metadata("design:paramtypes", []) ], RGBICLightFactory); //# sourceMappingURL=rgbic-light.js.map