public void detectAll(){
            for(int baud : BAUD_RATES) {
                SerialPort serialPort = null;
                InputStream in = null;
                OutputStream out = null;
                try {
                    log.info("Opening serial port...");
                    serialPort = (SerialPort) portIdentifier.open("ATDeviceDetector", 2000);
                    log.info("Port opened.  Setting flow control mode...");
                    serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_RTSCTS_IN);
                    log.info("Flow control mode set.  Setting port params...");
                    serialPort.setSerialPortParams(baud, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
                    log.info("Port params set.  Opening input stream...");
                    in = serialPort.getInputStream();
                    log.info("Input stram opened.  Opening output stream...");
                    out = serialPort.getOutputStream();
                    log.info("Output stream opened.  Enabling receive timeout...");
                    serialPort.enableReceiveTimeout(1000);
                    log.info("Receive timeout enabled.");

                    log.trace("LOOPING.");
                    // discard all data currently waiting on the input stream
                    Utils.readAll(in);
                    Utils.writeCommand(out, "AT");
                    Thread.sleep(1000);
                    String response = Utils.readAll(in);
                    if(!Utils.isResponseOk(response)) {
                        //throw new ATDeviceDetectionException("Bad response: " + response);
                    }
                    serial = getSerial(in, out);

                    maxBaudRate = Math.max(maxBaudRate, baud);
				
                    // detection is complete, so let's try and get the device manufacturer, model and phone number
                    manufacturer = getManufacturer(in, out);
                    model = getModel(in, out);
                    phoneNumber = getPhoneNumber(in, out);
                    lockType = getLockType(in, out);
                    setSmsSupport(in, out);
                    imsi = getImsi(in, out);
                }
                catch(Exception ex) {
                    
                }
                finally {
                    if(out != null) 
                        try { 
                            out.close(); 
                        } catch(Throwable t) {
                            log.warn("Error closing output stream.", t); 
                        }	
                    if(in != null) try {
                        in.close(); 
                    } catch(Throwable t) {
                        log.warn("Error closing input stream.", t); 
                    }
                }
                finished = true;		
                log.info("Detection completed on port: " + this.portIdentifier.getName() +
				"; manufacturer: " + manufacturer +
				"; model: " + model +
				"; phoneNumber: " + phoneNumber);
                
            }
        }