public int writeTelegram(char[] buffer,int type,Object id){
  int result=0;
  try {
    String msg=new String(buffer);
    msg+="\n";
    wrtr.write(msg.getBytes());
    result=buffer.length;
  }
 catch (  IOException ex) {
    ex.printStackTrace();
  }
  return (result);
}

public int writeTelegram ( char [ ] buffer , int type , Object id ) { int result = 0 ; try { String msg = new String ( buffer ) ; msg += "\n" ; wrtr . write ( msg . getBytes ( ) ) ; result = buffer . length ; } catch ( IOException ex ) { ex . printStackTrace ( ) ; } return ( result ) ; }
write a telegram to serial port
