public void SetBounds( bool[] mask, IntRange[] bounds )
{
if ( ( mask.Length != Count ) || ( bounds.Length != Count ) )
{
throw new ArgumentException( "Incorrect length of mask or positions array." );
}
// check controller
if ( servoController == null )
{
throw new NotConnectedException( "Qwerk's service is not connected." );
}
try
{
TeRKIceLib.Bounds[] nativeBounds = new TeRKIceLib.Bounds[Count];
for ( int i = 0; i < Count; i++ )
{
if ( mask[i] )
{
nativeBounds[i].min = bounds[i].Min;
nativeBounds[i].max = bounds[i].Max;
}
}
// set servos' bounds
servoController.setBounds( mask, nativeBounds );
}
catch
{
throw new ConnectionLostException( "Connection is lost." );
}
}