private void open ( ) throws ModbusIOException { if ( commPort != null && ! commPort . isOpen ( ) ) { setTimeout ( timeout ) ; try { commPort . open ( ) ; } catch ( IOException e ) { throw new ModbusIOException ( String . format ( "Cannot open port %s - %s" , commPort . getDescriptivePortName ( ) , e . getMessage ( ) ) ) ; } } }
Opens the port if it isn t already open