BlinkStickDotNet.BlinkStick.GetColor C# (CSharp) Метод

GetColor() публичный Метод

Gets the color of the led.
public GetColor ( byte &r, byte &g, byte &b ) : System.Boolean
r byte The red component.
g byte The green component.
b byte The blue component.
Результат System.Boolean
        public Boolean GetColor (out byte r, out byte g, out byte b)
        {
            if (OnReceiveColor(0, out r, out g, out b))
                return true;

            byte[] report = new byte[33]; 
            report[0] = 1;

            if (connectedToDriver) {
                int attempt = 0;
                while (attempt < 5)
                {
                    attempt++;
                    try
                    {
                        stream.GetFeature(report, 0, 33);
                        break;
                    }
                    catch 
                    {
                        if (attempt == 5)
                            throw;

                        if (!WaitThread(20))
                            return false;
                    }
                }


                r = report [1];
                g = report [2];
                b = report [3];

                return true;
            } else {
                r = 0;
                g = 0;
                b = 0;

                return false;
            }
        }

Same methods

BlinkStick::GetColor ( byte index, byte &r, byte &g, byte &b ) : System.Boolean