public bool Connect( string portName )
{
lock ( sync )
{
if ( communicationInterface != null )
return true;
// create communication interface,
communicationInterface = new SerialCommunication( portName );
// connect and check if NXT is alive
if ( ( communicationInterface.Connect( ) ) && ( IsAlive( ) ) )
return true;
Disconnect( );
}
return false;
}