private void sendDataEvents(boolean read, boolean write) { if (read && m_NotifyOnDataAvailable && !m_DataAvailableNotified) { m_DataAvailableNotified = true; m_EventListener.serialEvent(new SerialPortEvent(this, SerialPortEvent.DATA_AVAILABLE, false, true)); } if (write && m_NotifyOnOutputEmpty && !m_OutputEmptyNotified) { m_OutputEmptyNotified = true; m_EventListener.serialEvent(new SerialPortEvent(this, SerialPortEvent.OUTPUT_BUFFER_EMPTY, false, true)); } }
private void sendDataEvents(boolean read, boolean write) { if (read && m_NotifyOnDataAvailable && !m_DataAvailableNotified) { m_DataAvailableNotified = true; m_EventListener.serialEvent(new SerialPortEvent(this, SerialPortEvent.DATA_AVAILABLE, false, true)); } if (write && m_NotifyOnOutputEmpty && !m_OutputEmptyNotified) { m_OutputEmptyNotified = true; m_EventListener.serialEvent(new SerialPortEvent(this, SerialPortEvent.OUTPUT_BUFFER_EMPTY, false, true)); } }
private void sendDataEvents(boolean read, boolean write) { if (read && m_NotifyOnDataAvailable && !m_DataAvailableNotified) { m_DataAvailableNotified = true; m_EventListener.serialEvent(new SerialPortEvent(this, SerialPortEvent.DATA_AVAILABLE, false, true)); } if (write && m_NotifyOnOutputEmpty && !m_OutputEmptyNotified) { m_OutputEmptyNotified = true; m_EventListener.serialEvent(new SerialPortEvent(this, SerialPortEvent.OUTPUT_BUFFER_EMPTY, false, true)); } }
private synchronized void sendNonDataEvents() { if (ioctl(m_FD, TIOCMGET, m_ioctl) < 0) return; // FIXME decide what to with errors in the background thread int oldstates = m_ControlLineStates; m_ControlLineStates = m_ioctl[0]; int newstates = m_ControlLineStates; int changes = oldstates ^ newstates; if (changes == 0) return; int line; if (m_NotifyOnCTS && (((line = TIOCM_CTS) & changes) != 0)) m_EventListener.serialEvent(new SerialPortEvent(this, SerialPortEvent.CTS, (oldstates & line) != 0, (newstates & line) != 0)); if (m_NotifyOnDSR && (((line = TIOCM_DSR) & changes) != 0)) m_EventListener.serialEvent(new SerialPortEvent(this, SerialPortEvent.DSR, (oldstates & line) != 0, (newstates & line) != 0)); if (m_NotifyOnRI && (((line = TIOCM_RI) & changes) != 0)) m_EventListener.serialEvent(new SerialPortEvent(this, SerialPortEvent.RI, (oldstates & line) != 0, (newstates & line) != 0)); if (m_NotifyOnCD && (((line = TIOCM_CD) & changes) != 0)) m_EventListener.serialEvent(new SerialPortEvent(this, SerialPortEvent.CD, (oldstates & line) != 0, (newstates & line) != 0)); }
private synchronized void sendNonDataEvents() { if (ioctl(m_FD, TIOCMGET, m_ioctl) < 0) return; // FIXME decide what to with errors in the background thread int oldstates = m_ControlLineStates; m_ControlLineStates = m_ioctl[0]; int newstates = m_ControlLineStates; int changes = oldstates ^ newstates; if (changes == 0) return; int line; if (m_NotifyOnCTS && (((line = TIOCM_CTS) & changes) != 0)) m_EventListener.serialEvent(new SerialPortEvent(this, SerialPortEvent.CTS, (oldstates & line) != 0, (newstates & line) != 0)); if (m_NotifyOnDSR && (((line = TIOCM_DSR) & changes) != 0)) m_EventListener.serialEvent(new SerialPortEvent(this, SerialPortEvent.DSR, (oldstates & line) != 0, (newstates & line) != 0)); if (m_NotifyOnRI && (((line = TIOCM_RI) & changes) != 0)) m_EventListener.serialEvent(new SerialPortEvent(this, SerialPortEvent.RI, (oldstates & line) != 0, (newstates & line) != 0)); if (m_NotifyOnCD && (((line = TIOCM_CD) & changes) != 0)) m_EventListener.serialEvent(new SerialPortEvent(this, SerialPortEvent.CD, (oldstates & line) != 0, (newstates & line) != 0)); }
private synchronized void sendNonDataEvents() { if (ioctl(m_FD, TIOCMGET, m_ioctl) < 0) return; // FIXME decide what to with errors in the background thread int oldstates = m_ControlLineStates; m_ControlLineStates = m_ioctl[0]; int newstates = m_ControlLineStates; int changes = oldstates ^ newstates; if (changes == 0) return; int line; if (m_NotifyOnCTS && (((line = TIOCM_CTS) & changes) != 0)) m_EventListener.serialEvent(new SerialPortEvent(this, SerialPortEvent.CTS, (oldstates & line) != 0, (newstates & line) != 0)); if (m_NotifyOnDSR && (((line = TIOCM_DSR) & changes) != 0)) m_EventListener.serialEvent(new SerialPortEvent(this, SerialPortEvent.DSR, (oldstates & line) != 0, (newstates & line) != 0)); if (m_NotifyOnRI && (((line = TIOCM_RI) & changes) != 0)) m_EventListener.serialEvent(new SerialPortEvent(this, SerialPortEvent.RI, (oldstates & line) != 0, (newstates & line) != 0)); if (m_NotifyOnCD && (((line = TIOCM_CD) & changes) != 0)) m_EventListener.serialEvent(new SerialPortEvent(this, SerialPortEvent.CD, (oldstates & line) != 0, (newstates & line) != 0)); }