/**************************************************************************************************************/
        /* Lighting fixtures                                                                                          */
        /**************************************************************************************************************/
        public static void AddLight(LightingFixtureSettings settings, bool saveToFile = true)
        {
            if (!FixtureNameOk(settings.name))
            {
                throw new Exception(string.Format("Lighting Fixture {0} already exists", settings.name));
            }

            if (settings.dimmingChannel.IsNotEmpty())
            {
                AddDimmingLight(
                    settings.name,
                    settings.channel,
                    settings.dimmingChannel,
                    settings.lightingStates,
                    settings.highTempLockout);
            }
            else
            {
                AddLight(
                    settings.name,
                    settings.channel,
                    settings.lightingStates,
                    settings.highTempLockout);
            }

            if (saveToFile)
            {
                AddFixtureSettingsToFile(settings);
            }
        }
 public static void UpdateLight(string fixtureName, LightingFixtureSettings settings)
 {
     if (CheckFixtureKeyNoThrow(fixtureName))
     {
         settings.lightingStates = GetLightingFixtureLightingStates(fixtureName);
         RemoveLight(fixtureName);
     }
     AddLight(settings);
 }
        /**************************************************************************************************************/
        /* Settings                                                                                                   */
        /**************************************************************************************************************/
        public static LightingFixtureSettings GetLightingFixtureSettings(string fixtureName)
        {
            CheckFixtureKey(fixtureName);
            var settings = new LightingFixtureSettings();

            settings.name            = fixtureName;
            settings.channel         = GetFixtureOutletIndividualControl(fixtureName);
            settings.highTempLockout = GetFixtureTemperatureLockout(fixtureName);
            settings.lightingStates  = GetLightingFixtureLightingStates(fixtureName);
            if (IsDimmingFixture(fixtureName))
            {
                settings.dimmingChannel = GetDimmingChannelIndividualControl(fixtureName);
            }
            return(settings);
        }
        protected static void AddLight(
            string name,
            IndividualControl powerOutlet,
            LightingState[] lightingStates,
            bool highTempLockout)
        {
            var fixtureSettings = new LightingFixtureSettings();

            fixtureSettings.name            = name;
            fixtureSettings.channel         = powerOutlet;
            fixtureSettings.lightingStates  = lightingStates;
            fixtureSettings.highTempLockout = highTempLockout;

            fixtures[name] = new LightingFixture(fixtureSettings);
        }
Example #5
0
            public LightingFixtureDimming(LightingFixtureSettings settings) : base(settings)
            {
                currentDimmingLevel   = 0.0f;
                autoDimmingLevel      = 0.0f;
                requestedDimmingLevel = 0.0f;
                rateOfChangeLimiter   = new RateOfChangeLimiter(1.0f);

                dimmingChannel = settings.dimmingChannel;
                dimmingMode    = Mode.Auto;
                var dimmingSettings = new GenericDeviceSettings();

                dimmingSettings.name    = name + " Dimming Output";
                dimmingSettings.channel = dimmingChannel;
                dimmingEquipment        = new DimmingEquipment(dimmingSettings, this);
                Driver.AnalogOutput.AddOutputChannel(dimmingChannel, name, dimmingEquipment.key);
            }
 protected static void AddFixtureSettingsToFile(LightingFixtureSettings settings)
 {
     SettingsHelper.AddSettingsToArray(settingsFile, settingsArrayName, settings);
 }