* @throws SerialPortException the serial port exception
*/
private synchronized void writeSerialData(byte[] cmdfull) throws SerialPortException {
//TODO handle the 128 byte buffer limit!
if (port==null) {
throw new SerialPortException("port is not ready!");
}
//log.log(Level.INFO, "Serial Wire Size: {0}", cmdfull.length);
try {
port.output.write(cmdfull);
//port.output.flush();
//DO NOT flush the buffer... hmm not sure about this, processing flush also
//and i discovered strange "hangs"...
} catch (Exception e) {
LOG.log(Level.INFO, "Error sending serial data!", e);
connectionErrorCounter++;
throw new SerialPortException("cannot send serial data, errorNr: "+connectionErrorCounter+", Error: "+e);
}
}