Beispiel #1
0
        public void SetRGBW(RGBColor color, WhiteColor white, bool persist = true)
        {
            if (m_protocol == LedProtocolType.kLedNet_Original)
            {
                throw new InvalidOperationException("Bulb does not support Warm White settings");
            }
            if (!m_rgbwprotocol)
            {
                throw new InvalidOperationException("Bulb does not support setting RGB and WW simultaneously");
            }

            var bcolor = color.AsBytes();
            var msg    = GetColorSetMsg(persist, COLOR_AND_WHITE_WRITEMASK);

            msg[1] = bcolor.r;
            msg[2] = bcolor.g;
            msg[3] = bcolor.b;

            msg[4] = white.WarmWhite;

            if (m_protocol == LedProtocolType.kLedNet_9byte)
            {
                msg[5] = white.ColdWhite;
            }

            SendMsg(msg);

            UpdateState();
        }
Beispiel #2
0
        public void SetWhite(WhiteColor white, bool persist = true)
        {
            if (m_protocol == LedProtocolType.kLedNet_Original)
            {
                throw new InvalidOperationException("This light does not support Warm White settings");
            }

            var msg = GetColorSetMsg(persist, WHITE_ONLY_WRITEMASK);

            msg[1] = 0x0;
            msg[2] = 0x0;
            msg[3] = 0x0;

            msg[4] = white.WarmWhite;

            if (m_protocol == LedProtocolType.kLedNet_9byte)
            {
                msg[5] = white.ColdWhite;
            }

            SendMsg(msg);

            UpdateState();
        }