public int[] SetPositions( bool[] mask, int[] positions )
{
if ( ( mask.Length != Count ) || ( positions.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.ServoCommand command = CreateCommand( );
for ( int i = 0; i < Count; i++ )
{
command.servoMask[i] = mask[i];
command.servoModes[i] = TeRKIceLib.ServoMode.ServoMotorPositionControl;
command.servoPositions[i] = positions[i];
command.servoSpeeds[i] = DefaultSpeed;
}
// execute servos' command
TeRKIceLib.ServoState state = servoController.execute( command );
return state.servoPositions;
}
catch
{
throw new ConnectionLostException( "Connection is lost." );
}
}