/** * Wait the specified time period for the device state to go active. * @param timeout Timeout value if milliseconds, <= 0 is indefinite. * @return False if timed out waiting for the specified value, otherwise true. * @throws InterruptedException If interrupted while waiting.- */ public boolean waitForActive(int timeout) throws InterruptedException { return waitForValue(activeHigh, timeout); }
/** * Wait the specified time period for the device state to go inactive. * @param timeout Timeout value if milliseconds, <= 0 is indefinite. * @return False if timed out waiting for the specified value, otherwise true. * @throws InterruptedException If interrupted while waiting.- */ public boolean waitForInactive(int timeout) throws InterruptedException { return waitForValue(!activeHigh, timeout); }
if (! echo.waitForValue(true, 1000)) { Logger.warn("Timed-out waiting for echo pin to go high, max={}ms", Integer.valueOf(1000)); return -1; if (! echo.waitForValue(false, MAX_ECHO_TIME_MS)) { Logger.warn("Timed-out waiting for echo pin to go low, max={}ms", Long.valueOf(MAX_ECHO_TIME_MS)); return -1;