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. |
return | 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." );
}
}
}
Qwerk.Leds::SetLedsState ( LedState state ) : void |