예제 #1
0
        public void CreateTwoProgramSets_WorksWithSync()
        {
            var zlm = new ZLM(loadZoneModules: false, loadZonesFromConfig: false, loadProgramSetsFromConfig: false);

            var leftWing  = zlm.Zones.Add(new Zone("LeftWing"));
            var center    = zlm.Zones.Add(new Zone("Center"));
            var rightWing = zlm.Zones.Add(new Zone("RightWing"));

            //create program set
            zlm.CreateProgramSet("", "Stepper", true, null, new List <Zone>()
            {
                leftWing,
                center,
            });

            //create program set
            zlm.CreateProgramSet("", "Stepper", true, null, new List <Zone>()
            {
                rightWing
            });

            TestHelpers.ValidateSteppersInSync(
                new BetterList <Zone> {
                leftWing, center
            }.Select(z => z.ZoneProgram).Cast <IStepper>(), 100);
            TestHelpers.ValidateSteppersRunning(
                new BetterList <Zone> {
                rightWing
            }.Select(z => z.ZoneProgram).Cast <IStepper>(), 10);

            //cleanup
            zlm.Dispose();
        }
예제 #2
0
        public static void AddFourZonesAndStepperProgramSetWithSyncToZLM(ZLM zlm)
        {
            var notificationSyncContext = new SyncContext("NotificationContext");

            //add zones
            var zoneA = ZoneScaffolder.Instance.AddFadeCandyZone(zlm.Zones, "ZoneA", PixelType.FadeCandyWS2812Pixel, 16, 1);
            var zoneB = ZoneScaffolder.Instance.AddFadeCandyZone(zlm.Zones, "ZoneB", PixelType.FadeCandyWS2812Pixel, 16, 2);
            var zoneC = ZoneScaffolder.Instance.AddFadeCandyZone(zlm.Zones, "ZoneC", PixelType.FadeCandyWS2812Pixel, 16, 3);
            var zoneD = ZoneScaffolder.Instance.AddFadeCandyZone(zlm.Zones, "ZoneD", PixelType.FadeCandyWS2812Pixel, 16, 4);

            zlm.CreateProgramSet("StepperSet", "Stepper", true, null, zlm.Zones);

            //setup interrupting inputs - in the real code this method should not be used. The ZoneScaffolder.AddInterruptingProgram should be used.
            zoneA.AddInterruptingProgram(new BlinkColorReactive(), null, notificationSyncContext);
            zoneB.AddInterruptingProgram(new BlinkColorReactive(), null, notificationSyncContext);
            zoneC.AddInterruptingProgram(new BlinkColorReactive(), null, notificationSyncContext);
            zoneD.AddInterruptingProgram(new BlinkColorReactive(), null, notificationSyncContext);

            //synchronize and start interrupting programs
            notificationSyncContext.Sync(zoneA.InterruptingPrograms[0],
                                         zoneB.InterruptingPrograms[0],
                                         zoneC.InterruptingPrograms[0],
                                         zoneD.InterruptingPrograms[0]);

            zoneA.InterruptingPrograms[0].Start();
            zoneB.InterruptingPrograms[0].Start();
            zoneC.InterruptingPrograms[0].Start();
            zoneD.InterruptingPrograms[0].Start();
        }
예제 #3
0
        public static void AddNeopixelZonesAndProgramsWithSyncMethod(ZLM zlm)
        {
            var notificationSyncContext = new SyncContext("NotificationContext");

            //add zones
            //var row12 = ZoneScaffolder.Instance.AddFadeCandyZone(zlm.Zones, "Row12", PixelType.FadeCandyWS2812Pixel, 16, 1, 0.5);
            //var row34 = ZoneScaffolder.Instance.AddFadeCandyZone(zlm.Zones, "Row34", PixelType.FadeCandyWS2812Pixel, 16, 2, 0.5);
            //var row56 = ZoneScaffolder.Instance.AddFadeCandyZone(zlm.Zones, "Row56", PixelType.FadeCandyWS2812Pixel, 16, 3, 0.5);
            //var row78 = ZoneScaffolder.Instance.AddFadeCandyZone(zlm.Zones, "Row78", PixelType.FadeCandyWS2812Pixel, 16, 4, 0.5);

            var neoMatrix = CreateNeoMatrixZone(zlm);

            var isv = new ISV();

            isv.Add("MaxFadeSpeed", 1);
            isv.Add("MaxFadeDelay", 20);
            isv.Add("Density", 1.0);
            isv.Add("Brightness", 0.3);
            isv.Add("Random", true);

            zlm.CreateProgramSet("ShimmerSet", "Shimmer", false, isv, zlm.Zones);

            //setup interrupting inputs - in the real code this method should not be used. The ZoneScaffolder.AddInterruptingProgram should be used.
            neoMatrix.AddInterruptingProgram(new BlinkColorReactive(), null, notificationSyncContext);

            //synchronize and start interrupting programs
            notificationSyncContext.Sync(neoMatrix.InterruptingPrograms[0]);

            neoMatrix.InterruptingPrograms[0].Start();
        }
예제 #4
0
        public static void AddBasementZonesAndProgramsWithSync(ZLM zlm)
        {
            var notificationSyncContext = new SyncContext("NotificationContext");

            //add zones
            var leftWing = ZoneScaffolder.Instance.AddFadeCandyZone(zlm.Zones, "LeftWing", PixelType.FadeCandyWS2812Pixel, 6,
                                                                    1);
            var center    = ZoneScaffolder.Instance.AddFadeCandyZone(zlm.Zones, "Center", PixelType.FadeCandyWS2811Pixel, 21, 2);
            var rightWing = ZoneScaffolder.Instance.AddFadeCandyZone(zlm.Zones, "RightWing", PixelType.FadeCandyWS2812Pixel,
                                                                     12, 3);
            var baiClock = ZoneScaffolder.Instance.AddFadeCandyZone(zlm.Zones, "BaiClock", PixelType.FadeCandyWS2812Pixel, 24,
                                                                    4);

            zlm.CreateProgramSet("RainbowSet", "Rainbow", true, null, zlm.Zones);

            //setup interrupting inputs - in the real code this method should not be used. The ZoneScaffolder.AddInterruptingProgram should be used.
            leftWing.AddInterruptingProgram(new BlinkColorReactive(), null, notificationSyncContext);
            rightWing.AddInterruptingProgram(new BlinkColorReactive(), null, notificationSyncContext);
            center.AddInterruptingProgram(new BlinkColorReactive(), null, notificationSyncContext);
            baiClock.AddInterruptingProgram(new BlinkColorReactive(), null, notificationSyncContext);

            //synchronize and start interrupting programs
            notificationSyncContext.Sync(leftWing.InterruptingPrograms[0],
                                         rightWing.InterruptingPrograms[0],
                                         center.InterruptingPrograms[0],
                                         baiClock.InterruptingPrograms[0]);

            leftWing.InterruptingPrograms[0].Start();
            rightWing.InterruptingPrograms[0].Start();
            center.InterruptingPrograms[0].Start();
            baiClock.InterruptingPrograms[0].Start();
        }
예제 #5
0
        public void RecreateProgramSetWithoutZone_Works()
        {
            string  programSetName = "RainbowSet";
            string  programName    = "Rainbow";
            var     zoneName       = "FadeCandyZone";
            dynamic isv            = new ISV();

            isv.Speed = 50;

            var zlm            = new ZLM(false, false, false);
            var zlmrpc         = new ZLMRPC(zlm);
            var fadeCandyZone1 = zlm.AddFadeCandyZone("FadeCandyZone1", PixelType.FadeCandyWS2812Pixel, 8, 1);
            var fadeCandyZone2 = zlm.AddFadeCandyZone("FadeCandyZone2", PixelType.FadeCandyWS2812Pixel, 8, 2);

            zlm.CreateProgramSet(programSetName, programName, zlm.Zones.Select(z => z.Name), true, isv);

            Assert.That(zlm.ProgramSets[programSetName].Zones, Contains.Item(fadeCandyZone1));
            Assert.That(zlm.ProgramSets[programSetName].Zones, Contains.Item(fadeCandyZone2));

            //act
            zlmrpc.RecreateProgramSetWithoutZone(programSetName, fadeCandyZone2.Name);

            //assert
            Assert.That(zlm.ProgramSets[programSetName].Zones, Contains.Item(fadeCandyZone1));
            Assert.That(zlm.ProgramSets[programSetName].Zones, Is.Not.Contains(fadeCandyZone2));

            Assert.That(zlm.AvailableZones, Contains.Item(fadeCandyZone2));

            zlmrpc.Dispose();
        }
예제 #6
0
        public void SetZoneInputs_Works()
        {
            string  programSetName = "RainbowSet";
            string  programName    = "Rainbow";
            dynamic isv            = new ISV();

            isv.Speed = 50;

            var zlm    = new ZLM(false, false, false);
            var zlmrpc = new ZLMRPC(zlm);
            var zone1  = zlm.AddFadeCandyZone("Zone1", PixelType.FadeCandyWS2812Pixel, 8, 1);
            var zone2  = zlm.AddFadeCandyZone("Zone2", PixelType.FadeCandyWS2812Pixel, 8, 1);

            zlm.CreateProgramSet(programSetName, programName, zlm.Zones.Select(z => z.Name), true, isv);

            isv.Speed = 90;

            //act
            zlmrpc.SetZoneInputs("Zone1", isv);

            //assert
            Assert.That(zone1.ZoneProgram.GetInput("Speed").Value, Is.EqualTo(90));
            Assert.That(zone2.ZoneProgram.GetInput("Speed").Value, Is.EqualTo(50));

            zlmrpc.Dispose();
        }
예제 #7
0
        public void GetZones_OneRunningOneStopped_Works()
        {
            string  programSetName = "RainbowSet";
            string  programName    = "Rainbow";
            dynamic isv            = new ISV();

            isv.Speed = 50;

            var zlm    = new ZLM(false, false, false);
            var zlmrpc = new ZLMRPC(zlm);
            var zone1  = zlm.AddFadeCandyZone("Zone1", PixelType.FadeCandyWS2812Pixel, 8, 1);
            var zone2  = zlm.AddFadeCandyZone("Zone2", PixelType.FadeCandyWS2812Pixel, 8, 1);

            zlm.CreateProgramSet(programSetName, programName, "Zone2".Listify(), true, isv);

            //act
            var zones = zlmrpc.GetZones();

            //assert
            Assert.That(zones.First(x => x.Name == "Zone1").Brightness, Is.EqualTo(zlm.Zones["Zone1"].Brightness));
            Assert.That(zones.First(x => x.Name == "Zone1").LightCount, Is.EqualTo(zlm.Zones["Zone1"].LightCount));
            Assert.That(zones.First(x => x.Name == "Zone1").Running, Is.EqualTo(zlm.Zones["Zone1"].Running));
            Assert.That(zones.First(x => x.Name == "Zone1").ZoneProgramName, Is.EqualTo(string.Empty).Or.EqualTo(null));

            Assert.That(zones.First(x => x.Name == "Zone2").Brightness, Is.EqualTo(zlm.Zones["Zone2"].Brightness));
            Assert.That(zones.First(x => x.Name == "Zone2").LightCount, Is.EqualTo(zlm.Zones["Zone2"].LightCount));
            Assert.That(zones.First(x => x.Name == "Zone2").Running, Is.EqualTo(zlm.Zones["Zone2"].Running));
            Assert.That(zones.First(x => x.Name == "Zone2").ZoneProgramName, Is.EqualTo(zlm.Zones["Zone2"].ZoneProgram.Name));

            zlmrpc.Dispose();
        }
예제 #8
0
        public void AvailableZones_ReturnsZonesOnWhichNoProgramSetWasCreated()
        {
            var zlm = new ZLM(loadZoneModules: false, loadZonesFromConfig: false, loadProgramSetsFromConfig: false);

            var leftWing  = zlm.Zones.Add(new Zone("LeftWing"));
            var center    = zlm.Zones.Add(new Zone("Center"));
            var rightWing = zlm.Zones.Add(new Zone("RightWing"));

            //check if zones and availablezones are the same, since no program sets have been created yet
            Assert.AreEqual(zlm.Zones, zlm.AvailableZones);

            //create program set with all but one zone
            zlm.CreateProgramSet("", "Stepper", true, null, new List <Zone>()
            {
                leftWing,
                center
            });

            //the zone on which no program set was created should be the only one available
            Assert.True(zlm.AvailableZones.Count == 1);
            Assert.True(zlm.AvailableZones[0] == rightWing);

            //cleanup
            zlm.Dispose();
        }
예제 #9
0
        public void SetProgramSetInputs_Works()
        {
            string  programSetName = "RainbowSet";
            string  programName    = "Rainbow";
            var     zoneName       = "FadeCandyZone";
            dynamic isv            = new ISV();

            isv.Speed = 50;

            var zlm    = new ZLM(false, false, false);
            var zlmrpc = new ZLMRPC(zlm);

            zlm.AddFadeCandyZone(zoneName, PixelType.FadeCandyWS2812Pixel, 8, 1);
            zlm.CreateProgramSet(programSetName, programName, zlm.Zones.Select(z => z.Name), true, isv);
            zlm.Zones.ForEach(zone =>
            {
                Assert.That(zone.ZoneProgram, Is.Not.Null);
                Assert.That(zone.ZoneProgram.State, Is.EqualTo(ProgramState.Started));
                Assert.That(zone.ZoneProgram.GetInput("Speed").Value, Is.EqualTo(50));
            });

            isv.Speed = 90;

            //act
            zlmrpc.SetProgramSetInputs(programSetName, isv);

            //assert
            zlm.Zones.ForEach(zone =>
            {
                Assert.That(zone.ZoneProgram.GetInput("Speed").Value, Is.EqualTo(90));
            });

            zlmrpc.Dispose();
        }
예제 #10
0
        public void StartProgramSet_Works()
        {
            var programSetName = "StepperSet";

            var zlm    = new ZLM(false, false, false);
            var zlmrpc = new ZLMRPC(zlm);

            zlm.AddFadeCandyZone("FadeCandyZone", PixelType.FadeCandyWS2812Pixel, 8, 1);
            zlm.CreateProgramSet(programSetName, "Stepper", zlm.Zones.Select(z => z.Name));
            zlm.Zones.ForEach(zone =>
            {
                Assert.That(zone.ZoneProgram.State, Is.EqualTo(ProgramState.Started));
            });

            zlm.ProgramSets[programSetName].Stop();

            zlm.Zones.ForEach(zone =>
            {
                Assert.That(zone.ZoneProgram.State, Is.EqualTo(ProgramState.Stopped));
            });

            //act
            zlmrpc.StartProgramSet(programSetName);

            //assert
            zlm.Zones.ForEach(zone =>
            {
                Assert.That(zone.ZoneProgram.State, Is.EqualTo(ProgramState.Started));
            });

            zlmrpc.Dispose();
        }
예제 #11
0
        public static void RunRainbowInBasement(ZLM zlm)
        {
            var leftWing = ZoneScaffolder.Instance.AddFadeCandyZone(zlm.Zones, "LeftWing", PixelType.FadeCandyWS2812Pixel,
                                                                    6, 1);
            var rightwing = ZoneScaffolder.Instance.AddFadeCandyZone(zlm.Zones, "RightWing", PixelType.FadeCandyWS2812Pixel,
                                                                     12, 3);

            zlm.CreateProgramSet("RainbowSet", "Rainbow", true, null, zlm.Zones);
        }
예제 #12
0
        public static void RunMidiTwoDimensionalFadeOnNeoMatrix(ZLM zlm)
        {
            var neomatrix = ZoneScaffolder.Instance.AddFadeCandyZone(zlm.Zones, "NeoMatrix", PixelType.FadeCandyWS2812Pixel,
                                                                     64, 1);
            dynamic startingParameters = new ExpandoObject();

            startingParameters.DeviceID = int.Parse(Config.Get("MIDIDeviceID"));
            zlm.CreateProgramSet("MidiTwoDimensionalFadeSet", "MidiTwoDimensionalFade", false, null, zlm.Zones,
                                 startingParameters);
        }
예제 #13
0
        public static void RunMidiPlayInLivingRoom(ZLM zlm)
        {
            dynamic startingParameters = new ExpandoObject();

            startingParameters.DeviceID = int.Parse(Config.Get("MIDIDeviceID"));

            var zone = CreateLivingRoomZone(zlm);

            zlm.CreateProgramSet("MidiPlaySet", "LivingRoomMidiPlay", false, null, zlm.Zones, startingParameters);
        }
예제 #14
0
        public static void RunRainbowOnNeoMatrix(ZLM zlm)
        {
            var isv = new ISV();

            isv.Add("Speed", 10);
            isv.Add("DelayTime", 10);
            var neomatrix = ZoneScaffolder.Instance.AddFadeCandyZone(zlm.Zones, "NeoMatrix", PixelType.FadeCandyWS2812Pixel,
                                                                     64, 1, 0.5);

            zlm.CreateProgramSet("RainbowSet", "Rainbow", false, isv, zlm.Zones);
        }
예제 #15
0
        public void CreateProgramSet_PassInUnavailableZone_ThrowsException()
        {
            var zlm = new ZLM(loadZoneModules: false, loadZonesFromConfig: false, loadProgramSetsFromConfig: false);

            var leftWing = zlm.Zones.Add(new Zone("LeftWing"));
            var center   = zlm.Zones.Add(new Zone("Center"));

            //create program set
            zlm.CreateProgramSet("", "Stepper", true, null, new List <Zone>()
            {
                leftWing,
                center,
            });

            Assert.Throws <Exception>(() =>
                                      zlm.CreateProgramSet("", "Stepper", true, null, new List <Zone>()
            {
                leftWing
            }));

            //cleanup
            zlm.Dispose();
        }
예제 #16
0
        public static void RunMidiTwoDimensionalFadeInBasement(ZLM zlm)
        {
            var isv      = new ISV();
            var leftWing = ZoneScaffolder.Instance.AddFadeCandyZone(zlm.Zones, "LeftWing", PixelType.FadeCandyWS2812Pixel,
                                                                    6, 1);
            var rightwing = ZoneScaffolder.Instance.AddFadeCandyZone(zlm.Zones, "RightWing", PixelType.FadeCandyWS2812Pixel,
                                                                     12, 3);
            var center = ZoneScaffolder.Instance.AddFadeCandyZone(zlm.Zones, "Center", PixelType.FadeCandyWS2811Pixel,
                                                                  21, 2);
            dynamic startingParameters = new ExpandoObject();

            startingParameters.DeviceID = int.Parse(Config.Get("MIDIDeviceID"));
            zlm.CreateProgramSet("MidiTwoDimensionalFadeSet", "MidiTwoDimensionalFade", false, isv, zlm.Zones,
                                 startingParameters);
        }
예제 #17
0
        public static void RunShimmerOnNeoMatrixFourZones(ZLM zlm)
        {
            var isv = new ISV();

            isv.Add("MaxFadeSpeed", 1);
            isv.Add("MaxFadeDelay", 20);
            isv.Add("Density", 1.0);
            isv.Add("Brightness", 1.0);
            isv.Add("Random", true);
            var firstRow  = ZoneScaffolder.Instance.AddFadeCandyZone(zlm.Zones, "FirstRow", PixelType.FadeCandyWS2812Pixel, 16, 1);
            var secondRow = ZoneScaffolder.Instance.AddFadeCandyZone(zlm.Zones, "SecondRow", PixelType.FadeCandyWS2812Pixel, 16, 2);
            var thirdRow  = ZoneScaffolder.Instance.AddFadeCandyZone(zlm.Zones, "ThirdRow", PixelType.FadeCandyWS2812Pixel, 16, 3);
            var fourthRow = ZoneScaffolder.Instance.AddFadeCandyZone(zlm.Zones, "FourthRow", PixelType.FadeCandyWS2812Pixel, 16, 4);

            zlm.CreateProgramSet("ShimmerSet", "Shimmer", false, isv, zlm.Zones);
        }
예제 #18
0
        public void GetStatus_Works(string programSetName, string programName, bool sync = true)
        {
            var zlm    = new ZLM(false, false, false);
            var zlmrpc = new ZLMRPC(zlm);

            zlm.AddFadeCandyZone("FadeCandyZone", PixelType.FadeCandyWS2812Pixel, 8, 1);
            zlm.CreateProgramSet(programSetName, programName, zlm.Zones.Select(z => z.Name), sync);

            //act
            var status = zlmrpc.GetStatus();

            //assert
            Assert.That(status, Is.EqualTo("--ZoneLighting Summary--\r\n=============================\r\n1 ProgramSet(s) currently running:\r\nStepperSet running Stepper on zone(s) FadeCandyZone in sync\r\n--End of Summary--\r\n"));

            zlmrpc.Dispose();
        }
예제 #19
0
        public void GetZoneSummary_OneZone_Running_Works()
        {
            string expected       = "Currently 1 zones are loaded.\r\n===================\r\nZone: FadeCandyZone\r\nProgram: Stepper\r\n-------------------\r\n";
            var    programSetName = "StepperSet";

            var zlm      = new ZLM(false, false, false);
            var zlmrpc   = new ZLMRPC(zlm);
            var zoneName = "FadeCandyZone";

            zlm.AddFadeCandyZone(zoneName, PixelType.FadeCandyWS2812Pixel, 8, 1);
            zlm.CreateProgramSet(programSetName, "Stepper", zlm.Zones.Select(z => z.Name));

            var zoneSummary = zlmrpc.GetZoneSummary();

            Assert.That(zoneSummary, Is.EqualTo(expected));

            zlmrpc.Dispose();
        }
예제 #20
0
        public static void RunShimmerInBasement(ZLM zlm)
        {
            var isv = new ISV();

            isv.Add("MaxFadeSpeed", 1);
            isv.Add("MaxFadeDelay", 20);
            isv.Add("Density", 1.0);
            isv.Add("Brightness", 1.0);
            isv.Add("Random", true);
            var leftWing = ZoneScaffolder.Instance.AddFadeCandyZone(zlm.Zones, "LeftWing", PixelType.FadeCandyWS2812Pixel,
                                                                    6, 1);
            var rightwing = ZoneScaffolder.Instance.AddFadeCandyZone(zlm.Zones, "RightWing", PixelType.FadeCandyWS2812Pixel,
                                                                     12, 3);
            var center = ZoneScaffolder.Instance.AddFadeCandyZone(zlm.Zones, "Center", PixelType.FadeCandyWS2811Pixel,
                                                                  21, 2);

            zlm.CreateProgramSet("ShimmerSet", "Shimmer", false, isv, zlm.Zones);
        }
예제 #21
0
        public static void RunShimmerOnNeoMatrix(ZLM zlm)
        {
            var isv = new ISV();

            isv.Add("MaxFadeSpeed", 1);
            isv.Add("MaxFadeDelay", 20);
            isv.Add("Density", 1.0);
            isv.Add("Brightness", 0.3);
            isv.Add("Random", true);
            //isv.Add("ColorScheme", ColorScheme.Primaries);

            dynamic startingParameters = new ExpandoObject();

            startingParameters.DeviceID = int.Parse(Config.Get("MIDIDeviceID"));

            CreateNeoMatrixZone(zlm);
            zlm.CreateProgramSet("ShimmerSet", "Shimmer", false, isv, zlm.Zones, startingParameters: startingParameters);
        }
예제 #22
0
        public void StopZone_Works()
        {
            var programSetName = "StepperSet";

            var zlm      = new ZLM(false, false, false);
            var zlmrpc   = new ZLMRPC(zlm);
            var zoneName = "FadeCandyZone";

            zlm.AddFadeCandyZone(zoneName, PixelType.FadeCandyWS2812Pixel, 8, 1);
            zlm.CreateProgramSet(programSetName, "Stepper", zlm.Zones.Select(z => z.Name));
            Assert.That(zlm.Zones[zoneName].Running, Is.True);

            //act
            zlmrpc.StopZone(zoneName, false);

            //assert
            Assert.That(zlm.Zones[zoneName].Running, Is.False);

            zlmrpc.Dispose();
        }
예제 #23
0
        public void DisposeProgramSet_Works(string programSetName, string programName, bool sync = true)
        {
            var zlm    = new ZLM(false, false, false);
            var zlmrpc = new ZLMRPC(zlm);

            zlm.AddFadeCandyZone("FadeCandyZone", PixelType.FadeCandyWS2812Pixel, 8, 1);
            zlm.CreateProgramSet(programSetName, programName, zlm.Zones.Select(z => z.Name), sync);
            zlm.Zones.ForEach(zone =>
            {
                Assert.That(zone.ZoneProgram, Is.Not.Null);
                Assert.That(zone.ZoneProgram.State, Is.EqualTo(ProgramState.Started));
            });

            //act
            zlmrpc.DisposeProgramSet(programSetName);

            //assert
            zlm.Zones.ForEach(zone => Assert.That(zone.ZoneProgram, Is.Null));

            zlmrpc.Dispose();
        }
예제 #24
0
        public static void RunShimmerInLivingRoom(ZLM zlm)
        {
            var isv = new ISV();

            isv.Add("MaxFadeSpeed", 1);
            isv.Add("MaxFadeDelay", 20);
            isv.Add("Density", 1.0);
            isv.Add("Brightness", 1.0);
            isv.Add("Random", true);
            //isv.Add("ColorScheme", ColorScheme.Primaries);

            dynamic startingParameters = new ExpandoObject();

            startingParameters.DeviceID = int.Parse(Config.Get("MIDIDeviceID"));

            var zone = CreateLivingRoomZone(zlm);

            zlm.CreateProgramSet("ShimmerSet", "Shimmer", false, isv, zlm.Zones, startingParameters);
            //zone.AddInterruptingProgram(new BlinkColorReactive());
            //zone.InterruptingPrograms[0].Start();
        }
예제 #25
0
        public void CreateProgramSet_CreatesAndRunsProgramOnZones()
        {
            var zlm = new ZLM(loadZoneModules: false, loadZonesFromConfig: false, loadProgramSetsFromConfig: false);

            var leftWing  = zlm.Zones.Add(new Zone("LeftWing"));
            var center    = zlm.Zones.Add(new Zone("Center"));
            var rightWing = zlm.Zones.Add(new Zone("RightWing"));

            //create program set
            zlm.CreateProgramSet("", "Stepper", true, null, new List <Zone>()
            {
                leftWing,
                center,
                rightWing
            });

            //check that steppers are running
            TestHelpers.ValidateSteppersRunning(zlm.Zones.Select(z => z.ZoneProgram).Cast <IStepper>(), 100);

            //cleanup
            zlm.Dispose();
        }
예제 #26
0
        public void GetZoneSummary_TwoZones_Running_Works()
        {
            string  expected       = "Currently 2 zones are loaded.\r\n===================\r\nZone: FadeCandyZone1\r\nProgram: Rainbow\r\n-------------------\r\nZone: FadeCandyZone2\r\nProgram: Rainbow\r\n-------------------\r\n";
            string  programSetName = "RainbowSet";
            string  programName    = "Rainbow";
            var     zoneName       = "FadeCandyZone";
            dynamic isv            = new ISV();

            isv.Speed = 50;

            var zlm            = new ZLM(false, false, false);
            var zlmrpc         = new ZLMRPC(zlm);
            var fadeCandyZone1 = zlm.AddFadeCandyZone("FadeCandyZone1", PixelType.FadeCandyWS2812Pixel, 8, 1);
            var fadeCandyZone2 = zlm.AddFadeCandyZone("FadeCandyZone2", PixelType.FadeCandyWS2812Pixel, 8, 2);

            zlm.CreateProgramSet(programSetName, programName, zlm.Zones.Select(z => z.Name), true, isv);

            var zoneSummary = zlmrpc.GetZoneSummary();

            Assert.That(zoneSummary, Is.EqualTo(expected));

            zlmrpc.Dispose();
        }
예제 #27
0
        public void CreateProgramSet_TwoZonesOutOfThree_TwoZonesRunning_OneZoneNotRunning()
        {
            var zlm = new ZLM(loadZoneModules: false, loadZonesFromConfig: false, loadProgramSetsFromConfig: false);

            var leftWing  = zlm.Zones.Add(new Zone("LeftWing"));
            var center    = zlm.Zones.Add(new Zone("Center"));
            var rightWing = zlm.Zones.Add(new Zone("RightWing"));

            //create program set
            zlm.CreateProgramSet("", "Stepper", true, null, new List <Zone>()
            {
                leftWing,
                center,
            });

            //check that steppers are running
            Assert.False(rightWing.Running);
            TestHelpers.ValidateSteppersRunning(new BetterList <Zone> {
                leftWing, center
            }.Select(z => z.ZoneProgram).Cast <IStepper>(), 100);

            //cleanup
            zlm.Dispose();
        }
예제 #28
0
        public static void RunStopWatchBlinkInLivingRoom(ZLM zlm)
        {
            var zone = CreateLivingRoomZone(zlm);

            zlm.CreateProgramSet("StopWatchBlinkSet", "StopWatchBlink", false, null, zlm.Zones);
        }
예제 #29
0
        public static void RunMicroTimerClockBlinkOnNeoMatrix(ZLM zlm)
        {
            var zone = CreateNeoMatrixZone(zlm);

            zlm.CreateProgramSet("MicroTimerClockBlinkSet", "MicroTimerClockBlink", false, null, zlm.Zones);
        }
예제 #30
0
        public static void RunStopWatchBlinkOnNeoMatrix(ZLM zlm)
        {
            var zone = CreateNeoMatrixZone(zlm);

            zlm.CreateProgramSet("StopWatchBlinkSet", "StopWatchBlink", false, null, zlm.Zones);
        }