Пример #1
0
        internal void HandleReceiveData(Object sender, GroupDataReceivedEventArgs Data)
        {
            ushort red   = 0;
            ushort green = 0;
            ushort blue  = 0;

            if (float.Parse(Data.XY[0]) > 0)
            {
                ColourConverter.Point     point = new ColourConverter.Point(double.Parse(Data.XY[0]), double.Parse(Data.XY[1]));
                ColourConverter.RGBColour RGB   = ColourConverter.XYtoRGB(point, "LCT001");
                red   = Convert.ToUInt16(RGB.red * 255);
                green = Convert.ToUInt16(RGB.green * 255);
                blue  = Convert.ToUInt16(RGB.blue * 255);
            }

            newGroupInfo(Data.Name, Data.Type, Data.AllOn.ToString(), Data.AnyOn.ToString(), Data.On.ToString(), Data.Bri, Data.Hue, Data.Sat, red, green, blue);
            ID = Data.ID;
        }
Пример #2
0
        internal void HandleReceiveData(Object sender, LightDataReceivedEventArgs Data)
        {
            ushort red   = 0;
            ushort green = 0;
            ushort blue  = 0;

            if (Data.XY != null)
            {
                if (float.Parse(Data.XY[0]) > 0)
                {
                    ColourConverter.Point     point = new ColourConverter.Point(double.Parse(Data.XY[0]), double.Parse(Data.XY[1]));
                    ColourConverter.RGBColour RGB   = ColourConverter.XYtoRGB(point, Data.Model);
                    red   = Convert.ToUInt16(RGB.red * 255);
                    green = Convert.ToUInt16(RGB.green * 255);
                    blue  = Convert.ToUInt16(RGB.blue * 255);
                }
            }

            newLightInfo(Data.Name, Data.Type, Data.On.ToString(), Data.Bri, Data.Hue, Data.Sat, red, green,
                         blue, Data.Reachable.ToString());
            ID    = Data.ID;
            model = Data.Model;
        }