AForge.Robotics.TeRK.Qwerk.Leds.SetLedsState C# (CSharp) Метод

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

Set state of all LEDs.

The ledsMask and states arrays specify which Qwerk's on-board LED's state should be updated. If value of the ledsMask array is set to , then corresponding LED's state is changed to the state, which is specified in states array.

Incorrect length of LEDs' masks or states array. No connection to Qwerk or its service. Connestion to Qwerk is lost.
public SetLedsState ( bool ledsMask, LedState states ) : void
ledsMask bool Mask array specifying which LED's state need to be set.
states LedState Array of LEDs' states.
Результат void
            public void SetLedsState( bool[] ledsMask, LedState[] states )
            {
                if ( ( ledsMask.Length != Count ) || ( states.Length != Count ) )
                {
                    throw new ArgumentException( "Incorrect length of leds' masks or states array." );
                }

                TeRKIceLib.LEDMode[] modes = new TeRKIceLib.LEDMode[Count];

                for ( int i = 0; i < Count; i++ )
                {
                    modes[i] = modesMapping[(int) states[i]];
                }

                // check controller
                if ( ledController == null )
                {
                    throw new NotConnectedException( "Qwerk's service is not connected." );
                }

                try
                {
                    // execute leds' command
                    ledController.execute( new TeRKIceLib.LEDCommand( ledsMask, modes ) );
                }
                catch
                {
                    throw new ConnectionLostException( "Connection is lost." );
                }
            }
        }

Same methods

Qwerk.Leds::SetLedsState ( LedState state ) : void