示例#1
0
        static void Main(string[] args)
        {
            var fascade = new ArtNetFascade(0, "255.255.255.255");
            var fixtures = new Dictionary<short, ArtNetWhiteFixture>();

            while (true)
            {
                Console.WriteLine("Write addresses and values seperated by comma. (1,1,2,2 to set address 1 to value 1 and address 2 to value 2)");
                var s = Console.ReadLine();
                var array = s.Split(',');
                if (array.Length % 2 != 0)
                    Console.WriteLine("Odd number of values.");
                else
                {
                    //var pairs = new List<AddressValuePair>();
                    for (int i = 0; i < array.Length - 1; i += 2)
                    {
                        var address = short.Parse(array[i], CultureInfo.InvariantCulture);
                        var value = double.Parse(array[i + 1], CultureInfo.InvariantCulture);
                        //pairs.Add(new AddressValuePair(address, value));
                        ArtNetWhiteFixture fixture;
                        if (!fixtures.TryGetValue(address, out fixture))
                        {
                            fixture = new ArtNetWhiteFixture(fascade, address, address.ToString());
                            fixtures[address] = fixture;
                        }
                        fixture.Fade(value, 1000);
                    }

                    //fascade.SendAsync(pairs.ToArray()).Wait();
                    Console.WriteLine("Package sent.");
                    Console.WriteLine();
                }
            }
        }
 public ArtNetWhiteFixture(ArtNetFascade fascade, short startAddress, string name)
     : base(fascade, startAddress)
 {
     fadeTimer.Elapsed += fadeTimer_Elapsed;
     Name = name;
     Intensity = ByteToDouble(fascade.Get(startAddress));
 }
示例#3
0
        public ArtNetFixture(ArtNetFascade fascade, short startAddress)
        {
            if (fascade == null)
                throw new ArgumentNullException("fascade");
            if (startAddress < 1 || startAddress > 512)
                throw new ArgumentOutOfRangeException("startAddress", "startAddress must be between 1 and 512");

            fadeTimer = new Timer(10);
            fadeTimer.AutoReset = true;
            this.fascade = fascade;
            StartAddress = startAddress;
        }
示例#4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ArtNetHubClient"/> class.
 /// </summary>
 public ArtNetHubClient()
     : base(nameof(ArtNet), nameof(ArtNet))
 {
     fascade = new ArtNetFascade(universe, hosts);
 }