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." );
}
}
}