@Override
	public void serialEvent(SerialPortEvent events) {
        if(events.isRXCHAR()) {
        	if(!portOpened) return;
            try {
            	int len = events.getEventValue();
				byte [] buffer = serialPort.readBytes(len);
				if( len>0 ) {
					String line2 = new String(buffer,0,len);
					Log(line2);
					line3+=line2;
					// wait for the cue to send another command
					if(line3.lastIndexOf(cue)!=-1) {
						waitingForCue=false;
						if(ConfirmPort(line3)) {
							line3="";
							SendQueuedCommand();
						}
					}
				}
            } catch (SerialPortException e) {}
        }
	}