/// <summary> /// Updates the devices used in ZipatoDevices. /// </summary> public void Update() { for (int i = 0; i < Switches.Count; ++i) { var uuid = Switches[i].Uuid; Switches[i] = new Switch(_zipato, uuid); } for (int i = 0; i < OnOffSwitches.Count; ++i) { var uuid = OnOffSwitches[i].Uuid; OnOffSwitches[i] = new OnOff(_zipato, uuid); } for (int i = 0; i < Wallplugs.Count; ++i) { var uuid = Wallplugs[i].Uuid; Wallplugs[i] = new Plug(_zipato, uuid); } for (int i = 0; i < Dimmers.Count; ++i) { var uuid = Dimmers[i].Uuid; Dimmers[i] = new Dimmer(_zipato, uuid); } for (int i = 0; i < RGBControls.Count; ++i) { var uuid = RGBControls[i].Uuid; RGBControls[i] = new RGBControl(_zipato, uuid); } Status = _zipato?.Data?.Status ?? Uncertain; }
void ShowModuleScreen(Module m) { BaseWidget widget = null; // ModuleParameter widgetProperty = m.GetProperty("Widget.DisplayModule"); if (widgetProperty != null && !String.IsNullOrEmpty(widgetProperty.Value)) { switch (widgetProperty.Value) { case "homegenie/generic/light": case "homegenie/generic/switch": widget = new Switch(); break; case "homegenie/generic/dimmer": widget = new Dimmer(); break; case "homegenie/generic/colorlight": widget = new ColorLight(); break; case "weather/wunderground/conditions": widget = new Weather(); break; default: break; } } // if (widget == null) { if (m.DeviceType == "Dimmer" || m.DeviceType == "Light" || m.DeviceType == "Shutter" || m.DeviceType == "Siren") { widget = new Dimmer(); } else if (m.DeviceType == "Switch") { widget = new Switch(); } } // if (widget != null) { widget.CloseButtonClicked += (sender, args) => { this.Controls.Remove(widget); this.Controls.Add(currentWidget); widgetCycle.Start(); }; widget.Module = m; widget.Dock = DockStyle.Fill; // widgetCycle.Stop(); this.Controls.Remove(currentWidget); this.Controls.Add(widget); } }
public HomeTheatreFacade( Dimmer dimmer, Dvd dvd, DvdPlayer dvdPlayer) { this.dvd = dvd; this.dimmer = dimmer; this.dvdPlayer = dvdPlayer; }
public void AddLoadsFromCrestronDevice(int LoadID, Dimmer _dimmer) { foreach (LightLoad load in _dimmer.DimmingLoads) { LightingLoad newLoad = new LightingLoad(LoadID, load, _dimmer.Description); this._loads.Add(newLoad); } }
public XmasScene1(IEnumerable <string> args, System.Collections.Specialized.NameValueCollection settings) { testPixels = new Pixel1D("G35", 50); explosion1 = new Dimmer("Explosion 1"); explosion2 = new Dimmer("Explosion 2"); explosion3 = new Dimmer("Explosion 3"); explosion4 = new Dimmer("Explosion 4"); testButton = new DigitalInput("Test"); audioPlayer = new Physical.NetworkAudioPlayer( settings["NetworkAudioPlayerIP"], int.Parse(settings["NetworkAudioPlayerPort"])); }
public TestScene1(IEnumerable <string> args) { georgeStrobeLight = new StrobeDimmer("George Strobe"); spiderLight = new StrobeColorDimmer("Spider Light"); skullsLight = new Dimmer("Skulls"); cobWebLight = new Dimmer("Cob Web"); blinkyEyesLight = new Switch("Blinky Eyes"); rgbLightRight = new StrobeColorDimmer("Light Right"); rgbLight3 = new StrobeColorDimmer("Light 3"); rgbLight4 = new StrobeColorDimmer("Light 4"); georgeMotor = new MotorWithFeedback("George Motor"); spiderLift = new Switch("Spider Lift"); pressureMat = new DigitalInput("Pressure Mat"); pulsatingEffect = new Effect.Pulsating(S(1), 0.2, 0.7); flickerEffect = new Effect.Flicker(0.4, 0.6); }
private void quickCollapseMenu() { LeftMenu.animate(WidthProperty, 300, 65, 0, new CubicEase { EasingMode = EasingMode.EaseOut }); Dimmer.animate(OpacityProperty, 300, 0, 0); AppToolbar.animate(OpacityProperty, 300, 1, 0, new CubicEase { EasingMode = EasingMode.EaseOut }); LeftIconMenu.animate(WidthProperty, 300, 65, 0, new CubicEase { EasingMode = EasingMode.EaseOut }); LeftTitleBar.animate(OpacityProperty, 100, 0, 0, new CubicEase { EasingMode = EasingMode.EaseOut }); LeftPanelItems.animate(OpacityProperty, 150, 0, 100, new CubicEase { EasingMode = EasingMode.EaseOut }); }
private void expandMenu() { LeftMenu.animate(WidthProperty, 300, 360, 0, new CubicEase { EasingMode = EasingMode.EaseOut }); Dimmer.animate(OpacityProperty, 300, .5); AppToolbar.animate(OpacityProperty, 300, .3, 0, new CubicEase { EasingMode = EasingMode.EaseOut }); LeftIconMenu.animate(WidthProperty, 300, 0, 0, new CubicEase { EasingMode = EasingMode.EaseOut }); LeftTitleBar.animate(OpacityProperty, 200, 1, 200, new CubicEase { EasingMode = EasingMode.EaseOut }); LeftPanelItems.animate(OpacityProperty, 300, 1, 300, new CubicEase { EasingMode = EasingMode.EaseOut }); }
/// <summary> /// Invokes the DimmerChanged event. /// </summary> /// <param name="dimmer">The dimmer that has been changed.</param> /// <param name="properties">List of propertynames that have been changed.</param> internal void OnDimmerChanged(Dimmer dimmer, List <string> properties) { if (ItemChanged != null) { try { ItemChanged(this, new ClientItemChangedEventArgs <NamedItem>(dimmer, properties)); } catch { } } if (DimmerChanged != null) { try { DimmerChanged(this, new ClientItemChangedEventArgs <Dimmer>(dimmer, properties)); } catch { } } }
public HalloweenScene1(IEnumerable <string> args, System.Collections.Specialized.NameValueCollection settings) { hours = new OperatingHours("Hours"); georgeStrobeLight = new StrobeDimmer("George Strobe"); spiderLight = new StrobeColorDimmer("Spider Light"); skullsLight = new Dimmer("Skulls"); cobWebLight = new Dimmer("Cob Web"); blinkyEyesLight = new Switch("Blinky Eyes"); rgbLightRight = new StrobeColorDimmer("Light Right"); georgeLight = new StrobeColorDimmer("George Light"); leftSkeletonLight = new StrobeColorDimmer("Skeleton Light"); georgeMotor = new MotorWithFeedback("George Motor"); candyLight = new StrobeColorDimmer("Candy Light"); spiderLift = new Switch("Slider Lift"); smokeMachine = new Switch("Smoke Machine"); spiderEyes = new Switch("Spider Eyes"); pressureMat = new DigitalInput("Pressure Mat"); testButton = new DigitalInput("Test"); pulsatingEffect1 = new Effect.Pulsating(S(2), 0.1, 0.4); pulsatingEffect2 = new Effect.Pulsating(S(2), 0.3, 0.5); candyPulse = new Effect.Pulsating(S(3), 0.01, 0.1); flickerEffect = new Effect.Flicker(0.4, 0.6); audioPlayer = new Physical.NetworkAudioPlayer( settings["NetworkAudioPlayerIP"], int.Parse(settings["NetworkAudioPlayerPort"])); hours.AddRange("6:00 pm", "10:00 pm"); var testSequence = new Controller.Sequence("Test Sequence"); testSequence .WhenExecuted .Execute(instance => { candyPulse.Start(); audioPlayer.PlayEffect("Laugh"); georgeMotor.SetVector(1.0, 160, S(5)); georgeStrobeLight.SetStrobe(0.55, 1.0); georgeLight.SetStrobe(0.78, Color.Brown); georgeMotor.WaitForVectorReached(); instance.WaitFor(S(2)); georgeStrobeLight.TurnOff(); georgeLight.TurnOff(); georgeMotor.SetVector(0.9, 0, S(6)); georgeMotor.WaitForVectorReached(); candyPulse.Stop(); }); var testSequence2 = new Controller.Sequence("Test Sequence 2"); testSequence2.WhenExecuted .Execute(instance => { audioPlayer.PlayEffect("348 Spider Hiss"); spiderLight.SetStrobe(0.78, Color.Red); spiderLift.SetPower(true); instance.WaitFor(S(3)); // Spider up audioPlayer.PlayEffect("Scream"); spiderLift.SetPower(false); instance.WaitFor(S(2)); spiderLight.TurnOff(); }); var testSequence3 = new Controller.Sequence("Test Sequence 3"); testSequence3.WhenExecuted .Execute(instance => { spiderEyes.SetPower(true); instance.WaitFor(S(10)); spiderEyes.SetPower(false); }); var mainSequence = new Controller.Sequence("Main Sequence"); mainSequence.WhenExecuted .Execute(instance => { pulsatingEffect1.Stop(); pulsatingEffect2.Stop(); flickerEffect.Stop(); blinkyEyesLight.SetPower(false); candyLight.SetColor(Color.Red); audioPlayer.PauseBackground(); audioPlayer.PlayEffect("Door-creak"); instance.WaitFor(S(2)); instance.WaitFor(S(2)); candyPulse.Stop(); candyLight.SetStrobe(1, Color.White); instance.WaitFor(S(0.5)); candyLight.TurnOff(); instance.WaitFor(S(1)); audioPlayer.PlayEffect("348 Spider Hiss"); instance.WaitFor(S(0.5)); spiderLight.SetStrobe(0.78, Color.Red); spiderLift.SetPower(true); spiderEyes.SetPower(true); instance.WaitFor(S(1)); audioPlayer.PlayEffect("348 Spider Hiss"); instance.WaitFor(S(2)); // Spider up audioPlayer.PlayEffect("Scream"); spiderLift.SetPower(false); spiderEyes.SetPower(false); smokeMachine.SetPower(true); instance.WaitFor(S(2)); spiderLight.TurnOff(); audioPlayer.PlayEffect("Violin screech"); instance.WaitFor(S(2)); // Skeleton to the right // audioPlayer.PlayEffect("Ghostly"); rgbLightRight.SetStrobe(0.78, Color.Violet); instance.WaitFor(MS(1000)); rgbLightRight.SetColor(Color.Red); instance.WaitFor(MS(1000)); rgbLightRight.SetColor(Color.Blue); instance.WaitFor(S(2)); rgbLightRight.TurnOff(); instance.WaitFor(S(1)); // Skeleton to the left audioPlayer.PlayEffect("death-scream"); instance.WaitFor(S(0.5)); leftSkeletonLight.SetStrobe(0.78, Color.Pink); instance.WaitFor(S(3)); smokeMachine.SetPower(false); instance.WaitFor(S(1)); leftSkeletonLight.TurnOff(); // George audioPlayer.PlayEffect("Laugh"); instance.WaitFor(MS(800)); georgeMotor.SetVector(1.0, 160, S(5)); georgeStrobeLight.SetStrobe(0.55, 1.0); georgeLight.SetStrobe(0.78, Color.Brown); georgeMotor.WaitForVectorReached(); instance.WaitFor(S(2)); georgeStrobeLight.TurnOff(); georgeLight.TurnOff(); candyPulse.MinBrightness = 0.05; candyPulse.MaxBrightness = 1.0; candyLight.SetColor(Color.Violet); candyPulse.Start(); georgeMotor.SetVector(0.9, 0, S(6)); georgeMotor.WaitForVectorReached(); blinkyEyesLight.SetPower(true); flickerEffect.Start(); pulsatingEffect1.Start(); instance.WaitFor(S(5)); smokeMachine.SetPower(true); audioPlayer.PlayBackground(); // Wait for reset instance.WaitFor(S(15)); pulsatingEffect2.Start(); candyPulse.MinBrightness = 0.01; candyPulse.MaxBrightness = 0.1; candyLight.SetColor(Color.Green); smokeMachine.SetPower(false); }); pressureMat.ActiveChanged += (sender, e) => { if (e.NewState) { if (hours.IsOpen) { Executor.Current.Execute(mainSequence); } else { audioPlayer.PlayEffect("Laugh"); } } }; testButton.ActiveChanged += (sender, e) => { if (e.NewState) { Executor.Current.Execute(mainSequence); } }; hours.OpenHoursChanged += (sender, e) => { if (e.IsOpenNow) { pulsatingEffect1.Start(); pulsatingEffect2.Start(); flickerEffect.Start(); candyPulse.Start(); blinkyEyesLight.SetPower(true); audioPlayer.PlayBackground(); } else { pulsatingEffect1.Stop(); pulsatingEffect2.Stop(); flickerEffect.Stop(); candyPulse.Stop(); blinkyEyesLight.SetPower(false); audioPlayer.PauseBackground(); } }; // Have it turned off, but prepare it with blue color for the effect rgbLightRight.SetColor(Color.Blue, 0); candyLight.SetColor(Color.Green, 0); pulsatingEffect1.AddDevice(rgbLightRight); pulsatingEffect2.AddDevice(cobWebLight); candyPulse.AddDevice(candyLight); flickerEffect.AddDevice(skullsLight); }
public override bool Call(ISmartHouse sh, out string output, params string[] args) { bool result = true; output = null; int max = 100; int min = 0; int step = 0; int i = 0; string devName; if (args == null || args.Length == 0 || args.Length > 4) { output = MISSING_ARGS + Name; return false; } else if (sh[args[i]] != null) { output = string.Format("Устройство с именем \"{0}\" уже есть в системе", args[i]); return false; } devName = args[i]; if (args.Length > ++i) { if (!int.TryParse(args[i], out max)) { output = string.Format("Второй аргумент \"{0}\" не является целым числом", args[i]); return false; } } if (args.Length > ++i) { if (!int.TryParse(args[i], out min)) { output = string.Format("Третий аргумент \"{0}\" не является целым числом", args[i]); return false; } } else { min = max / 10; } if (args.Length > ++i) { if (!int.TryParse(args[i], out step)) { output = string.Format("Четвёртый аргумент \"{0}\" не является целым числом", args[i]); return false; } } else { step = max / 10; } try { IAdjustable<int> dimmer = new Dimmer(max, min, step); ISmartDevice dev = new SmartLamp(devName, dimmer); sh.AddDevice(dev); } catch (Exception e) { output = e.Message; return false; } return result; }
public void CodigoProductoInvalido() { Dimmer dimmer = new Dimmer("Dimmer", "Variador de luz", "0501", Dimmer.ELampara.Incandescente); }
public HomeTheatreFacade(Dimmer dimmer, Dvd dvd, DvdPlayer dvdPlayer) { _dvd = dvd; _dimmer = dimmer; _dvdPlayer = dvdPlayer; }
public Xmas2013scene(IEnumerable <string> args) { hours = new OperatingHours("Hours"); timeline1 = new Controller.Timeline <string>(1); stateMachine = new Controller.EnumStateMachine <States>("Main"); hatLightState = new Controller.IntStateMachine("Hats"); lightJesus = new StrobeColorDimmer("Jesus"); lightStar = new Dimmer("Star"); lightHat1 = new Dimmer("Hat 1"); lightHat2 = new Dimmer("Hat 2"); lightHat3 = new Dimmer("Hat 3"); lightHat4 = new Dimmer("Hat 4"); lightSnow1 = new Dimmer("Snow 1"); lightSnow2 = new Dimmer("Snow 2"); lightStairs1 = new Dimmer("Stair 1"); lightStairs2 = new Dimmer("Stairs 2"); lightGarland1 = new Dimmer("Garland 1"); lightGarland2 = new Dimmer("Garland 2"); lightGarland3 = new Dimmer("Garland 3"); lightGarland4 = new Dimmer("Garland 4"); lightString1 = new Dimmer("String 1"); lightString2 = new Dimmer("String 1"); lightXmasTree = new Dimmer("Xmas Tree"); lightDeerLarge = new Dimmer("Deer Large"); lightDeerSmall = new Dimmer("Deer Small"); lightTreeUp = new StrobeColorDimmer("Tree up"); switchSanta = new Switch("Santa"); switchDeerHuge = new Switch("Deer Huge"); lightTopperSmall = new Dimmer("Topper Small"); lightTopperLarge = new Dimmer("Topper Large"); lightNet1 = new Dimmer("Net 1"); lightNet2 = new Dimmer("Net 2"); lightVader = new StrobeColorDimmer("Vader"); light3wise = new StrobeColorDimmer("3wise"); pulsatingEffect1 = new Effect.Pulsating(S(4), 0.4, 1.0, false); pulsatingStar = new Effect.Pulsating(S(2), 0.2, 0.4, false); flickerEffect = new Effect.Flicker(0.5, 0.6, false); faderIn = new Effect.Fader(S(2), 0.0, 1.0, false); candyCane = new Controller.Sequence("Candy Cane"); twinkleSeq = new Controller.Sequence("Twinkle"); backgroundLoop = new Controller.Sequence("Background"); music1Seq = new Controller.Sequence("Christmas Canon"); starwarsCane = new Controller.Sequence("Starwars Cane"); fatherSeq = new Controller.Sequence("Father"); offHours1Seq = new Controller.Sequence("Off hours 1"); offHours2Seq = new Controller.Sequence("Off hours 2"); waveformSeq = new Controller.Sequence("Waveform"); allPixels = new VirtualPixel1D(100); starwarsPixels = new VirtualPixel1D(50); saberPixels = new VirtualPixel1D(60); buttonTest = new DigitalInput("Test"); buttonStartInflatables = new DigitalInput("Inflatables"); buttonOverrideHours = new DigitalInput("Override hours", true); buttonBlue = new DigitalInput("Blue"); buttonRed = new DigitalInput("Red"); switchButtonBlue = new Switch("Blue"); switchButtonRed = new Switch("Red"); elJesus = new Switch("Jesus Halo"); audioPlayer = new AudioPlayer("Audio"); popOut1Piano = new Effect.PopOut(S(0.4)); popOut1Drums = new Effect.PopOut(S(0.4)); popOut1DrumsFast = new Effect.PopOut(S(0.3)); popOut1Chord = new Effect.PopOut(S(0.4)); popOut1Solo = new Effect.PopOut(S(0.3)); popOut1Solo2 = new Effect.PopOut(S(0.2)); popOut1Choir = new Effect.PopOut(S(1.0)); popOut1Voice = new Effect.PopOut(S(1.0)); popOut1Vocal2 = new Effect.PopOut(S(2.0)); popOut1VocalLong = new Effect.PopOut(S(5.0)); popOut1End = new Effect.PopOut(S(5.0)); this.oscServer = new Expander.OscServer(10000); raspberry.DigitalInputs[4].Connect(buttonRed); raspberry.DigitalInputs[5].Connect(buttonBlue); raspberry.DigitalOutputs[0].Connect(switchButtonBlue); raspberry.DigitalOutputs[1].Connect(switchButtonRed); raspberry.DigitalOutputs[2].Connect(elJesus); raspberry.Connect(audioPlayer); }
/// <summary> /// Parse the content of one update message. /// </summary> /// <param name="message">The update message as received from the Domotech iRemote Server</param> private void ParsePollMessage(string message) { // The update message is a token string with a colon as separator string[] msg = message.Split(':'); // Split the message into tokens int index; try { // The second number mostly represents the item index index = int.Parse(msg[1]); } catch { index = 0; } int stepIndex; List <string> properties = new List <string>(); switch (msg[0]) // The first number always represents the message type { #region ACHANGED case "ACHANGED": { // Alarm parameter(s) changed Alarm alarm = client.lists.alarmList[index]; bool active = (byte.Parse(msg[2]) != 0); bool wasActive = (byte.Parse(msg[3]) != 0); byte timesOn = byte.Parse(msg[4]); if (alarm.active != active) { alarm.active = active; properties.Add("Active"); } if (alarm.wasActive != wasActive) { alarm.wasActive = wasActive; properties.Add("WasActive"); } if (alarm.timesOn != timesOn) { alarm.timesOn = timesOn; properties.Add("TimesOn"); } client.OnAlarmChanged(alarm, properties); } break; #endregion #region AIRCOCHANGED case "AIRCOCHANGED": { // Room airco temperature changed Room room = client.lists.roomList[index]; room.aircoTemp = Core.TempToDegrees(int.Parse(msg[2])); properties.Add("AircoTemp"); client.OnRoomChanged(room, properties); } break; #endregion #region AIRCOONOFFCHANGED case "AIRCOONOFFCHANGED": { // Room airco state changed Room room = client.lists.roomList[index]; room.aircoEnabled = (byte.Parse(msg[2]) != 0); properties.Add("AircoEnabled"); client.OnRoomChanged(room, properties); } break; #endregion #region AIRCOTCHANGED case "AIRCOTCHANGED": { // Room airco type changed Room room = client.lists.roomList[index]; room.aircoType = (RoomAircoType)byte.Parse(msg[2]); properties.Add("AircoType"); client.OnRoomChanged(room, properties); } break; #endregion /*case "ALARMNROK": * break;*/ /*case "ALARMOFF": * break;*/ #region ALARMTEXTUPD case "ALARMTEXTUPD": { // Alarm text changed Alarm alarm = client.lists.alarmList[index]; alarm.name = msg[2]; properties.Add("Name"); client.OnAlarmChanged(alarm, properties); } break; #endregion #region ALLCHANGED case "ALLCHANGED": // Recall init client.OnClientStatus(ClientStatusValue.ConfigChanged); client.Disconnect(); // Thread will reconnect & redownload break; #endregion /*case "ALSIL": * break;*/ /*case "ARESET": * break;*/ #region ASCHANGED case "ASCHANGED": { // Room airco activity changed Room room = client.lists.roomList[index]; room.aircoActive = (byte.Parse(msg[2]) != 0); properties.Add("AircoActive"); client.OnRoomChanged(room, properties); } break; #endregion #region AU_BASCHANGED case "AU_BASCHANGED": { // AudioZone bass value changed AudioZone audioZone = client.lists.audioZoneList[index]; audioZone.bass = Core.ValueToBassTreble(byte.Parse(msg[2])); properties.Add("Bass"); client.OnAudioZoneChanged(audioZone, properties); } break; #endregion #region AU_MUTECHANGED case "AU_MUTECHANGED": { // AudioZone mute value changed AudioZone audioZone = client.lists.audioZoneList[index]; audioZone.mute = (byte.Parse(msg[2]) != 0); properties.Add("Mute"); client.OnAudioZoneChanged(audioZone, properties); } break; #endregion #region AU_ONOFFCHANGED case "AU_ONOFFCHANGED": { // AudioZone state changed AudioZone audioZone = client.lists.audioZoneList[index]; audioZone.state = (byte.Parse(msg[2]) != 0); properties.Add("State"); client.OnAudioZoneChanged(audioZone, properties); } break; #endregion #region AU_SRCCHANGED case "AU_SRCCHANGED": { // AudioZone source changed AudioZone audioZone = client.lists.audioZoneList[index]; audioZone.inputSource = byte.Parse(msg[2]); properties.Add("InputSource"); client.OnAudioZoneChanged(audioZone, properties); } break; #endregion #region AU_TRECHANGED case "AU_TRECHANGED": { // AudioZone treble changed AudioZone audioZone = client.lists.audioZoneList[index]; audioZone.treble = Core.ValueToBassTreble(byte.Parse(msg[2])); properties.Add("Treble"); client.OnAudioZoneChanged(audioZone, properties); } break; #endregion #region AU_VOLCHANGED case "AU_VOLCHANGED": { // AudioZone volume changed AudioZone audioZone = client.lists.audioZoneList[index]; audioZone.volume = Core.ValueToVolume(byte.Parse(msg[2])); properties.Add("Volume"); client.OnAudioZoneChanged(audioZone, properties); } break; #endregion #region AUDIOINIT case "AUDIOINIT": // Return value of AudioInit // 1 when audiocontroller found, 0 when not client.lists.audioInitOk = (byte.Parse(msg[1]) != 0); break; #endregion /*case "AUDIONROK": * break;*/ #region AUSRCTEXTUPD case "AUSRCTEXTUPD": { // AudioSrouce text changed AudioSource audioSource = client.lists.audioSourceList[index]; audioSource.name = msg[2]; properties.Add("Name"); client.OnAudioSourceChanged(audioSource, properties); } break; #endregion #region AUZONTEXTUPD case "AUZONTEXTUPD": { // AudioZone text changed AudioZone audioZone = client.lists.audioZoneList[index]; audioZone.name = msg[2]; properties.Add("Name"); client.OnAudioZoneChanged(audioZone, properties); } break; #endregion #region B case "B": // Broadcast message from broadcastClientName break; #endregion #region CLIENTNAME case "CLIENTNAME": // Set the client name for the next broadcast message broadcastClientName = msg[1]; break; #endregion #region CLKCHANGED case "CLKCHANGED": // Domotech Master clock changed client.lists.clockHour = byte.Parse(msg[1]); client.lists.clockMinute = byte.Parse(msg[2]); break; #endregion #region DCHANGED case "DCHANGED": { // Dimmer parameter(s) changed Dimmer dimmer = client.lists.dimmerList[index]; byte value = byte.Parse(msg[2]); bool state = (byte.Parse(msg[3]) != 0); if (dimmer.value != value) { dimmer.value = value; properties.Add("Value"); } if (dimmer.state != state) { dimmer.state = state; properties.Add("State"); } client.OnDimmerChanged(dimmer, properties); } break; #endregion #region DIMMERTEXTUPD case "DIMMERTEXTUPD": { // Dimmer text changed Dimmer dimmer = client.lists.dimmerList[index]; dimmer.name = msg[2]; properties.Add("Name"); client.OnDimmerChanged(dimmer, properties); } break; #endregion #region GOODBYE case "GOODBYE": // Domotech iRemote Server is shutting down // Stop polling & warn user break; #endregion #region INSTRNROK case "INSTRNROK": break; #endregion #region LCHANGED case "LCHANGED": { // Light state changed Light light = client.lists.lightList[index]; light.state = (byte.Parse(msg[2]) != 0); properties.Add("State"); client.OnLightChanged(light, properties); } break; #endregion #region LIGHTTEXTUPD case "LIGHTTEXTUPD": { // Light text changed Light light = client.lists.lightList[index]; light.name = msg[2]; properties.Add("Name"); client.OnLightChanged(light, properties); } break; #endregion #region LOGVARTEXTUPD case "LOGVARTEXTUPD": { // LogVar text changed LogVar logVar = client.lists.logVarList[index]; logVar.name = msg[2]; properties.Add("Name"); client.OnLogVarChanged(logVar, properties); } break; #endregion #region MASTERINIT case "MASTERINIT": // Domotech iRemote Server started to download the // configuration from the Domotech Master. // Disable GUI until this operation has finished. break; #endregion #region MASTERLOST case "MASTERLOST": // Serial connection between the Domotech iRemote Server and // Domotech Master is lost. // Disable GUI until the connection is fixed. break; #endregion /*case "OK": * break;*/ /*case "ROOMNROK": * break;*/ #region ROOMTEXTUPD case "ROOMTEXTUPD": { // Room text changed Room room = client.lists.roomList[index]; room.name = msg[2]; properties.Add("Name"); client.OnRoomChanged(room, properties); } break; #endregion #region SCENNROK case "SCENNROK": { // Scenario has been executed Scenario scenario = client.lists.scenarioList[index]; scenario.busy = false; properties.Add("Busy"); client.OnScenarioChanged(scenario, properties); } break; #endregion #region SCENTEXTUPD case "SCENTEXTUPD": { // Scenario text changed Scenario scenario = client.lists.scenarioList[index]; scenario.name = msg[2]; properties.Add("Name"); client.OnScenarioChanged(scenario, properties); } break; #endregion #region SCHANGED case "SCHANGED": { // Socket state changed Socket socket = client.lists.socketList[index]; socket.state = (byte.Parse(msg[2]) != 0); properties.Add("State"); client.OnSocketChanged(socket, properties); } break; #endregion #region SHUTTERTEXTUPD case "SHUTTERTEXTUPD": { // Shutter text changed Shutter shutter = client.lists.shutterList[index]; shutter.name = msg[2]; properties.Add("Name"); client.OnShutterChanged(shutter, properties); } break; #endregion #region SOCKETTEXTUPD case "SOCKETTEXTUPD": { // Socket text changed Socket socket = client.lists.socketList[index]; socket.name = msg[2]; properties.Add("Name"); client.OnSocketChanged(socket, properties); } break; #endregion #region TATIMCHANGED case "TATIMCHANGED": { // Time of step in temp curve changed stepIndex = int.Parse(msg[2]); Room room = client.lists.roomList[index]; CurveStep curveStep = room.CurveSteps[stepIndex]; byte hour = byte.Parse(msg[3]); byte minute = byte.Parse(msg[4]); if (curveStep.hour != hour) { curveStep.hour = hour; properties.Add("Hour"); } if (curveStep.minute != minute) { curveStep.minute = minute; properties.Add("Minute"); } client.OnCurveStepChanged(curveStep, properties); } break; #endregion #region TATMPCHANGED case "TATMPCHANGED": { // Temperature of step in temp curve changed stepIndex = int.Parse(msg[2]); Room room = client.lists.roomList[index]; CurveStep curveStep = room.CurveSteps[stepIndex]; curveStep.temperature = Core.TempToDegrees(int.Parse(msg[3])); properties.Add("Temperature"); client.OnCurveStepChanged(curveStep, properties); } break; #endregion #region TCCHANGED case "TCCHANGED": { // Room temperature correction changed Room room = client.lists.roomList[index]; room.tempCorrection = Core.CorrectionToDegrees(byte.Parse(msg[2])); properties.Add("TempCorrection"); client.OnRoomChanged(room, properties); } break; #endregion #region TCHANGED case "TCHANGED": { // Room measured temperature changed Room room = client.lists.roomList[index]; room.measuredTemp = Core.TempToDegrees(int.Parse(msg[2])); properties.Add("MeasuredTemp"); client.OnRoomChanged(room, properties); } break; #endregion #region TDCHANGED case "TDCHANGED": { // Room day temperature changed Room room = client.lists.roomList[index]; room.dayTemp = Core.TempToDegrees(int.Parse(msg[2])); properties.Add("DayTemp"); client.OnRoomChanged(room, properties); } break; #endregion #region TIMCHANGED case "TIMCHANGED": { // Timer parameter(s) changed Timer timer = client.lists.timerList[index]; byte day = byte.Parse(msg[2]); byte hour = byte.Parse(msg[3]); byte minute = byte.Parse(msg[4]); if (timer.day != day) { timer.day = day; properties.Add("Day"); } if (timer.hour != hour) { timer.hour = hour; properties.Add("Hour"); } if (timer.minute != minute) { timer.minute = minute; properties.Add("Minute"); } client.OnTimerChanged(timer, properties); } break; #endregion /*case "TIMERADDED": * break;*/ /*case "TIMERNROK": * break;*/ /*case "TIMERREMOVED": * break;*/ #region TIMONOFFCHANGED case "TIMONOFFCHANGED": { // Timer state changed Timer timer = client.lists.timerList[index]; timer.state = (byte.Parse(msg[2]) != 0); properties.Add("State"); client.OnTimerChanged(timer, properties); } break; #endregion #region TNCHANGED case "TNCHANGED": { // Room night temperature changed Room room = client.lists.roomList[index]; room.nightTemp = Core.TempToDegrees(int.Parse(msg[2])); properties.Add("NightTemp"); client.OnRoomChanged(room, properties); } break; #endregion #region TONOFFCHANGED case "TONOFFCHANGED": { // Room temperature control state changed Room room = client.lists.roomList[index]; room.tempEnabled = (byte.Parse(msg[2]) != 0); properties.Add("TempEnabled"); client.OnRoomChanged(room, properties); } break; #endregion #region TSCHANGED case "TSCHANGED": { // Room temperature control activity changed Room room = client.lists.roomList[index]; room.tempActive = (byte.Parse(msg[2]) != 0); properties.Add("TempActive"); client.OnRoomChanged(room, properties); } break; #endregion #region TTCHANGED case "TTCHANGED": { // Room temperature control type changed Room room = client.lists.roomList[index]; room.tempType = (RoomTempType)byte.Parse(msg[2]); properties.Add("TempType"); client.OnRoomChanged(room, properties); } break; #endregion #region VCHANGED case "VCHANGED": { // LogVar state changed LogVar logVar = client.lists.logVarList[index]; logVar.state = (byte.Parse(msg[2]) != 0); properties.Add("State"); client.OnLogVarChanged(logVar, properties); } break; #endregion } }
public XmasScene2(IEnumerable <string> args, System.Collections.Specialized.NameValueCollection settings) { hours = new OperatingHours("Hours"); if (!args.Contains("TEST")) { hours.AddRange("5:00 pm", "10:00 pm"); hours.AddRange("5:00 am", "7:00 am"); } lightNetRight = new Dimmer("Net Right"); lightGarlandRight = new Dimmer("Garland Right"); lightHatsRight = new Dimmer("Hats Right"); lightTreesRight = new Dimmer("Trees Right"); lightReindeers = new Dimmer("Reindeers"); lightIcicles = new Dimmer("Icicles"); lightNetLeft = new Dimmer("Net Left"); lightTree = new Dimmer("Tree"); lightGarlandLeft = new Dimmer("Garland Left"); lightUnused1 = new Dimmer("Unused 1"); lightUnused2 = new Dimmer("Unused 2"); lightJesus = new StrobeColorDimmer("Jesus"); lightCeiling1 = new StrobeColorDimmer("Ceiling 1"); lightCeiling2 = new StrobeColorDimmer("Ceiling 2"); lightCeiling3 = new StrobeColorDimmer("Ceiling 3"); lightVader = new StrobeColorDimmer("Vader"); buttonLightRed = new Switch("Button Red"); buttonLightBlue = new Switch("Button Blue"); elLightsaber = new Switch("Lightsaber"); elJesus = new Switch("Jesus Halo"); bigReindeer = new Switch("Big Reindeer"); buttonBlue = new DigitalInput("Button Blue"); buttonRed = new DigitalInput("Button Red"); buttonStartReindeer = new DigitalInput("Start Reindeer"); timeline = new Controller.Timeline <string>(1); stateMachine = new Controller.EnumStateMachine <States>("Main"); candyCane = new Controller.Sequence("Candy Cane"); starwarsCane = new Controller.Sequence("Starwars Cane"); backgroundLoop = new Controller.Sequence("Background"); musicSeq = new Controller.Sequence("Christmas Canon"); buttonSeq = new Controller.Sequence("Buttons"); fatherSeq = new Controller.Sequence("Father"); breathSeq = new Controller.Sequence("Breath"); laserSeq = new Controller.Sequence("Laser"); allPixels = new VirtualPixel1D(100); pulsatingEffect1 = new Effect.Pulsating(S(2), 0.3, 1.0, false); pulsatingEffect2 = new Effect.Pulsating(S(2), 0.3, 1.0, false); popOutPiano = new Effect.PopOut(S(0.4)); popOutDrums = new Effect.PopOut(S(0.4)); popOutDrumsFast = new Effect.PopOut(S(0.3)); popOutChord = new Effect.PopOut(S(0.4)); popOutSolo = new Effect.PopOut(S(0.3)); popOutSolo2 = new Effect.PopOut(S(0.2)); popOutChoir = new Effect.PopOut(S(1.0)); popOutVoice = new Effect.PopOut(S(1.0)); popOutVocal2 = new Effect.PopOut(S(2.0)); popOutVocalLong = new Effect.PopOut(S(5.0)); popOutEnd = new Effect.PopOut(S(5.0)); popOutPiano .AddDevice(lightIcicles); popOutDrums .AddDevice(lightReindeers) .AddDevice(lightHatsRight); popOutDrumsFast .AddDevice(lightCeiling1) .AddDevice(allPixels); popOutChord .AddDevice(lightTree) .AddDevice(lightCeiling2) .AddDevice(lightCeiling3); popOutSolo .AddDevice(lightNetLeft) .AddDevice(lightNetRight) .AddDevice(lightCeiling1) .AddDevice(lightCeiling3) .SetPriority(2); popOutSolo2 .AddDevice(lightCeiling1) .AddDevice(lightCeiling3) .SetPriority(2); popOutChoir .AddDevice(lightGarlandRight) .AddDevice(lightTreesRight) .AddDevice(lightCeiling1); popOutVoice .AddDevice(lightGarlandLeft) .AddDevice(lightCeiling3); popOutVocal2 .AddDevice(lightReindeers) .AddDevice(allPixels) .SetPriority(10); popOutVocalLong .AddDevice(lightNetRight) .AddDevice(lightGarlandRight) .AddDevice(lightHatsRight) .SetPriority(10); popOutEnd .AddDevice(lightIcicles) .AddDevice(lightReindeers) .AddDevice(lightHatsRight) .AddDevice(lightCeiling1) .AddDevice(lightCeiling2) .AddDevice(lightCeiling3) .AddDevice(lightGarlandRight) .AddDevice(lightGarlandLeft) .AddDevice(lightTreesRight) .AddDevice(lightNetRight) .AddDevice(lightNetLeft) .AddDevice(allPixels) .SetPriority(100); timeline.AddMs(0, "INIT"); timeline.PopulateFromCSV("Christmas Canon Rock All Labels.csv"); int state = 0; int halfSolo = 0; timeline.TimelineTrigger += (sender, e) => { switch (e.Step) { case 62: // First drum state = 1; allPixels.TurnOff(); break; case 69: state = 2; lightCeiling2.SetOnlyColor(Color.Green); lightCeiling3.SetOnlyColor(Color.Blue); break; case 136: // First solo state = 3; allPixels.TurnOff(); lightCeiling2.SetOnlyColor(Color.White); lightCeiling3.SetOnlyColor(Color.Red); break; case 265: // First choir allPixels.TurnOff(); state = 4; break; case 396: // Vocal 2 state = 5; allPixels.SetAllOnlyColor(Color.Blue); break; case 497: // Second solo state = 6; allPixels.TurnOff(); lightCeiling2.SetOnlyColor(Color.White); lightCeiling3.SetOnlyColor(Color.Red); break; case 561: // End second solo state = 7; allPixels.TurnOff(); break; case 585: // End third solo state = 8; allPixels.TurnOff(); break; case 721: // End third solo state = 9; allPixels.TurnOff(); break; } switch (e.Code) { case "INIT": state = 0; halfSolo = 0; lightCeiling1.SetColor(Color.White, 0); lightCeiling2.SetColor(Color.Blue, 0); lightCeiling3.SetColor(Color.Red, 0); break; case "N1": popOutPiano.Pop(0.4); if (state == 0) { allPixels.Inject(Color.Red, 0.5); } break; case "N2": popOutPiano.Pop(0.6); if (state == 0) { allPixels.Inject(Color.White, 0.5); } break; case "N3": popOutPiano.Pop(0.8); if (state == 0) { allPixels.Inject(Color.Blue, 0.5); } break; case "N4": popOutPiano.Pop(1.0); if (state == 0) { allPixels.Inject(Color.Black, 0.0); } break; case "Base": popOutDrums.Pop(1.0); if (state < 3) { allPixels.SetAllOnlyColor(Color.Purple); popOutDrumsFast.Pop(1.0); } break; case "Cymbal": popOutDrums.Pop(1.0); if (state < 3) { allPixels.SetAllOnlyColor(Color.Green); popOutDrumsFast.Pop(1.0); } break; case "Chord": popOutChord.Pop(1.0); break; case "Solo": popOutSolo.Pop(1.0); if ((halfSolo++ % 2) == 0) { popOutSolo2.Pop(0.8); } if (state == 3 || state == 6 || state == 8) { Color pixCol = Color.Black; switch (e.Step % 4) { case 0: pixCol = Color.Red; break; case 1: pixCol = Color.Yellow; break; case 2: pixCol = Color.Blue; break; case 3: pixCol = Color.Pink; break; } allPixels.Inject(pixCol, 1.0); } break; case "Choir": popOutChoir.Pop(1.0); break; case "Voice": popOutVoice.Pop(1.0); break; case "Vocal2": popOutVocal2.Pop(1.0); break; case "Long": popOutVocalLong.Pop(1.0); break; case "LongUp": // TODO break; case "Down": // TODO break; case "End": EverythingOff(); popOutEnd.Pop(1.0); break; default: this.log.Information("Unhandled code: " + e.Code); break; } }; audioPlayer = new Physical.NetworkAudioPlayer( settings["NetworkAudioPlayerIP"], int.Parse(settings["NetworkAudioPlayerPort"])); }
public TestRenard1(IEnumerable <string> args) { buttonTest1 = new DigitalInput("Test 1"); testLight1 = new Dimmer("Test 1"); }
public HalloweenScene2013B(IEnumerable <string> args) { this.lastFogRun = DateTime.Now; stateMachine = new Controller.EnumStateMachine <States>("Main"); pulsatingEffect1 = new Effect.Pulsating(S(2), 0.1, 0.5, false); pulsatingEffect2 = new Effect.Pulsating(S(2), 0.2, 0.8, false); flickerEffect = new Effect.Flicker(0.4, 0.6, false); flickerEffect2 = new Effect.Flicker(0.4, 0.6, false); popOutEffect = new Effect.PopOut(S(1)); hoursSmall = new OperatingHours("Hours Small"); hoursFull = new OperatingHours("Hours Full"); buttonMotionCat = new DigitalInput("Walkway Motion"); buttonMotionBeauty = new DigitalInput("Beauty Motion"); buttonTriggerStairs = new DigitalInput("Stairs Trigger 1"); buttonTriggerPopup = new DigitalInput("Popup Trigger"); buttonTestA = new DigitalInput("Test A"); buttonTestB = new DigitalInput("Test B"); buttonTestC = new DigitalInput("Test C"); buttonTestSpider = new DigitalInput("Spider"); switchDeadendDrive = new Switch("Deadend dr"); catLights = new Switch("Cat lights"); catFan = new Switch("Cat"); georgeMotor = new MotorWithFeedback("George Motor"); lightPopup = new StrobeDimmer("Popup light"); lightGeorge = new StrobeColorDimmer("George light"); lightBeauty = new StrobeColorDimmer("Beauty light"); lightFloor = new StrobeColorDimmer("Floor light"); lightSign = new StrobeColorDimmer("Sign"); skullsLight = new Dimmer("Skulls"); lightTreeGhost = new Dimmer("Ghosts in tree"); skullsLight2 = new Dimmer("Skulls 2"); lightSpiderWeb = new Dimmer("Spiderweb"); lightEyes = new Switch("Eyes"); audioCat = new AudioPlayer("Audio Cat"); audioGeorge = new AudioPlayer("Audio George"); audioBeauty = new AudioPlayer("Audio Beauty"); audioSpider = new AudioPlayer("Audio Spider"); switchHand = new Switch("Hand"); switchHead = new Switch("Head"); switchDrawer1 = new Switch("Drawer 1"); switchDrawer2 = new Switch("Drawer 2"); switchPopEyes = new Switch("Pop Eyes"); switchPopUp = new Switch("Pop Up"); switchSpider = new Switch("Spider"); switchSpiderEyes1 = new Switch("Spider Eyes 1"); switchSpiderEyes2 = new Switch("Spider Eyes 2"); switchFog = new Switch("Fog"); allPixels = new VirtualPixel1D(28 + 50); // Cat raspberry1.DigitalInputs[0].Connect(buttonMotionCat); raspberry1.DigitalInputs[4].Connect(buttonTriggerStairs, true); raspberry1.DigitalOutputs[0].Connect(switchDeadendDrive); raspberry1.DigitalOutputs[1].Connect(switchFog); raspberry1.Motor.Connect(georgeMotor); raspberry1.Connect(audioCat); // Beauty raspberry2.Connect(audioBeauty); raspberry2.DigitalOutputs[7].Connect(switchHand); raspberry2.DigitalOutputs[2].Connect(switchHead); raspberry2.DigitalOutputs[5].Connect(switchDrawer1); raspberry2.DigitalOutputs[6].Connect(switchDrawer2); raspberry2.DigitalOutputs[3].Connect(switchPopEyes); raspberry2.DigitalOutputs[4].Connect(switchPopUp); raspberry2.DigitalInputs[5].Connect(buttonMotionBeauty, true); raspberry2.DigitalInputs[6].Connect(buttonTriggerPopup, true); // Background/George raspberry3.Connect(audioGeorge); // Spider raspberry4.Connect(audioSpider); raspberry4.DigitalOutputs[0].Connect(switchSpider); raspberry4.DigitalOutputs[2].Connect(switchSpiderEyes1); raspberry4.DigitalOutputs[3].Connect(switchSpiderEyes2); }
void DisplayAllChannelsValuesVerital(Dimmer oDimmer) { if (oDimmer == null) { return; } if (oDimmer.Areas == null) { return; } byte bytAreaID = 1; int DataGridHeight = 0; // get ready satble header and other basic information RowMergeView oDg = (RowMergeView)this.Controls.Find("Dg" + totalDimmers.ToString(), false)[0]; oDg.ColumnHeadersHeight = 48; // oDg.Columns.Add("Clm1", "Remark"); oDg.Columns.Add("Clm1", "Zone"); oDg.Columns.Add("Clm2", "Channel"); oDg.Columns.Add("Clm3", "Name"); for (int i = 0; i <= 12; i++) { //显示所有列的信息 运行时间和回路数 oDg.Columns.Add("Clm" + (i + 4).ToString(), "场景 " + i.ToString()); oDg.Columns[3 + i].Width = oDg.Width / 20; } oDg.AddSpanHeader(0, 16, oDimmer.DeviceName); for (byte bytTmp = 1; bytTmp <= oDimmer.Areas.Count; bytTmp++) { bytAreaID = bytTmp; Dimmer.Area oArea = null; foreach (Dimmer.Area Tmp in oDimmer.Areas) { if (Tmp.ID == bytAreaID) { oArea = Tmp; break; } } if (oArea.Scen == null) { return; } foreach (Dimmer.Channel oChn in oDimmer.Chans) { if (oChn.intBelongs == bytAreaID) { object[] oTmp = new object[16]; oTmp[0] = "区" + bytAreaID.ToString(); oTmp[1] = oChn.ID; oTmp[2] = oChn.Remark; for (int i = 0; i < 13; i++) { oTmp[3 + i] = oArea.Scen[i].light[oChn.ID - 1].ToString(); } oDg.Rows.Add(oTmp); DataGridHeight += 30; } } } oDg.MergeColumnNames.Add("Clm1"); oDg.Height = DataGridHeight; totalDimmers++; }
static void Main(string[] args) { //Intancio una nueva empresa y dos nuevos clientes Empresa miEmpresa = new Empresa("Electronica de control"); Cliente clienteUno = new Cliente("Juan", "Perez", Cliente.EMetodoDePago.Efectivo, 123); Cliente clienteDos = new Cliente("Jose", "Gomez", Cliente.EMetodoDePago.Tarjeta, 124); //Agrego los clientes a la lista de ventas miEmpresa.Ventas.Add(clienteUno); miEmpresa.Ventas.Add(clienteDos); try { Dimmer dimmer1 = new Dimmer("Dimmer", "Variador de luz", "DI 0501", Dimmer.ELampara.LED); miEmpresa += dimmer1; clienteUno += dimmer1; } catch (ProductoInvalidoException ex) { Console.WriteLine(ex.Message); } try { Dimmer dimmer2 = new Dimmer("Dimmer", "", "DI 7901", Dimmer.ELampara.Incandescente); miEmpresa += dimmer2; clienteDos += dimmer2; } catch (ProductoInvalidoException ex) { Console.WriteLine(ex.Message); } try { DetectorMovimiento detector1 = new DetectorMovimiento("Detector de movimiento", null, "DE 2987", DetectorMovimiento.ETipoColocacion.Pared); miEmpresa += detector1; clienteUno += detector1; } catch (ProductoInvalidoException ex) { Console.WriteLine(ex.Message); } try { DetectorMovimiento detector2 = new DetectorMovimiento("Detector de movimiento", "Detector IR", "DE 2981", DetectorMovimiento.ETipoColocacion.Techo); miEmpresa += detector2; clienteDos += detector2; } catch (ProductoInvalidoException ex) { Console.WriteLine(ex.Message); } try { Serializacion <Cliente> serializacion = new Serializacion <Cliente>(); serializacion.Serializar(clienteUno, "ClienteUno.xml"); serializacion.Serializar(clienteDos, "ClienteDos.xml"); } catch (Exception e) { Console.WriteLine(e.Message); } Console.WriteLine("---------------------------------------------"); Console.WriteLine(clienteUno.Facturacion()); Console.WriteLine("---------------------------------------------"); Console.WriteLine(clienteDos.Facturacion()); Console.ReadKey(); }