public synchronized int init5Baud(int address){
  int result=0;
  setCurrAddress(address);
  try {
    commTimer.stop();
    setDeviceName(deviceName);
    for (int i=0; i < baudRates.length; i++) {
      setProtStat(ProtStatus.CONNECTING);
      log.info(String.format("Init Device:%s Address:%02x, Speed:%d",deviceName,address,baudRates[i]));
      setCustomBaudRate(baudRates[i]);
      setCurrBaudRate(baudRates[i]);
      send5Baud(address);
      try {
        Thread.sleep(500);
      }
 catch (      InterruptedException e) {
        log.error("Sleep",e);
      }
      if (getProtStat() != ProtStatus.CONNECTING) {
        log.info(String.format("Init OK Device:%s Address:%02x, Speed:%d",deviceName,address,baudRates[i]));
        result=getCurrBaudRate();
        commTimer.restart();
        break;
      }
    }
    if (result == 0) {
      log.warn(String.format("Init Timeout Device:%s Address:%02x",deviceName,address));
      close();
    }
  }
 catch (  Exception ex) {
    log.error(deviceName + ": " + ex.toString());
    close();
    setProtStat(ProtStatus.ERROR);
    result=0;
  }
  setCurrBaudRate(result);
  return (result);
}

public synchronized int init5Baud ( int address ) { int result = 0 ; setCurrAddress ( address ) ; try { commTimer . stop ( ) ; setDeviceName ( deviceName ) ; for ( int i = 0 ; i < baudRates . length ; i ++ ) { setProtStat ( ProtStatus . CONNECTING ) ; log . info ( String . format ( "Init Device:%s Address:%02x, Speed:%d" , deviceName , address , baudRates [ i ] ) ) ; setCustomBaudRate ( baudRates [ i ] ) ; setCurrBaudRate ( baudRates [ i ] ) ; send5Baud ( address ) ; try { Thread . sleep ( 500 ) ; } catch ( InterruptedException e ) { log . error ( "Sleep" , e ) ; } if ( getProtStat ( ) != ProtStatus . CONNECTING ) { log . info ( String . format ( "Init OK Device:%s Address:%02x, Speed:%d" , deviceName , address , baudRates [ i ] ) ) ; result = getCurrBaudRate ( ) ; commTimer . restart ( ) ; break ; } } if ( result == 0 ) { log . warn ( String . format ( "Init Timeout Device:%s Address:%02x" , deviceName , address ) ) ; close ( ) ; } } catch ( Exception ex ) { log . error ( deviceName + ": " + ex . toString ( ) ) ; close ( ) ; setProtStat ( ProtStatus . ERROR ) ; result = 0 ; } setCurrBaudRate ( result ) ; return ( result ) ; }
initialize communication by sending specified ecu address with 5 baud
