@Test public void testGetBlPrompt() { boolean response = getBlPrompt(CR + "BL >"); assertEquals(true, response); }
private boolean getBlPrompt() { int[] matcher = new int[] { 'B', 'L', ' ', '>' }; int matcherCount = 0; int retryCount = 0; while (retryCount < MENU_MAX_RETRIES) { try { Thread.sleep(1500); } catch (InterruptedException e) { } serialPort.purgeRxBuffer(); serialPort.write(CRN); long finish = System.currentTimeMillis() + 250; while (System.currentTimeMillis() < finish) { int val = serialPort.read(250); if (val == -1) { break; } logger.trace("GET PROMPT: {}", String.format("%02X %c", val, val)); if (val != matcher[matcherCount]) { matcherCount = 0; continue; } matcherCount++; if (matcherCount == matcher.length) { return true; } } retryCount++; } logger.debug("Ember bootloader: Unable to get bootloader prompt."); transferComplete(ZigBeeTransportFirmwareStatus.FIRMWARE_UPDATE_FAILED); return false; }
EmberFirmwareUpdateHandler { private boolean getBlPrompt() { int[] matcher = new int[] { 'B', 'L', ' ', '>' }; int matcherCount = 0; int retryCount = 0; while (retryCount < MENU_MAX_RETRIES) { try { Thread.sleep(1500); } catch (InterruptedException e) { } serialPort.purgeRxBuffer(); serialPort.write(CRN); long finish = System.currentTimeMillis() + 250; while (System.currentTimeMillis() < finish) { int val = serialPort.read(250); if (val == -1) { break; } logger.trace("GET PROMPT: {}", String.format("%02X %c", val, val)); if (val != matcher[matcherCount]) { matcherCount = 0; continue; } matcherCount++; if (matcherCount == matcher.length) { return true; } } retryCount++; } logger.debug("Ember bootloader: Unable to get bootloader prompt."); transferComplete(ZigBeeTransportFirmwareStatus.FIRMWARE_UPDATE_FAILED); return false; } }
EmberFirmwareUpdateHandler { private boolean getBlPrompt() { int[] matcher = new int[] { 'B', 'L', ' ', '>' }; int matcherCount = 0; int retryCount = 0; while (retryCount < MENU_MAX_RETRIES) { try { Thread.sleep(1500); } catch (InterruptedException e) { } serialPort.purgeRxBuffer(); serialPort.write(CRN); long finish = System.currentTimeMillis() + 250; while (System.currentTimeMillis() < finish) { int val = serialPort.read(250); if (val == -1) { break; } logger.trace("GET PROMPT: {}", String.format("%02X %c", val, val)); if (val != matcher[matcherCount]) { matcherCount = 0; continue; } matcherCount++; if (matcherCount == matcher.length) { return true; } } retryCount++; } logger.debug("Ember bootloader: Unable to get bootloader prompt."); transferComplete(ZigBeeTransportFirmwareStatus.FIRMWARE_UPDATE_FAILED); return false; } EmberFirmwareUpdateHandler(ZigBeeDongleEzsp dongle, InputStream firmware, ZigBeePort serialPort,
            ZigBeeTransportFirmwareCallback callback); }
EmberFirmwareUpdateHandler { private boolean getBlPrompt() { int[] matcher = new int[] { 'B', 'L', ' ', '>' }; int matcherCount = 0; int retryCount = 0; while (retryCount < MENU_MAX_RETRIES) { try { Thread.sleep(1500); } catch (InterruptedException e) { } serialPort.purgeRxBuffer(); serialPort.write(CRN); long finish = System.currentTimeMillis() + 250; while (System.currentTimeMillis() < finish) { int val = serialPort.read(250); if (val == -1) { break; } logger.trace("GET PROMPT: {}", String.format("%02X %c", val, val)); if (val != matcher[matcherCount]) { matcherCount = 0; continue; } matcherCount++; if (matcherCount == matcher.length) { return true; } } retryCount++; } logger.debug("Ember bootloader: Unable to get bootloader prompt."); transferComplete(ZigBeeTransportFirmwareStatus.FIRMWARE_UPDATE_FAILED); return false; } EmberFirmwareUpdateHandler(ZigBeeDongleEzsp dongle, InputStream firmware, ZigBeePort serialPort,
            ZigBeeTransportFirmwareCallback callback); void startBootload(); void cancelUpdate(); }
EmberFirmwareUpdateHandler { private boolean getBlPrompt() { int[] matcher = new int[] { 'B', 'L', ' ', '>' }; int matcherCount = 0; int retryCount = 0; while (retryCount < MENU_MAX_RETRIES) { try { Thread.sleep(1500); } catch (InterruptedException e) { } serialPort.purgeRxBuffer(); serialPort.write(CRN); long finish = System.currentTimeMillis() + 250; while (System.currentTimeMillis() < finish) { int val = serialPort.read(250); if (val == -1) { break; } logger.trace("GET PROMPT: {}", String.format("%02X %c", val, val)); if (val != matcher[matcherCount]) { matcherCount = 0; continue; } matcherCount++; if (matcherCount == matcher.length) { return true; } } retryCount++; } logger.debug("Ember bootloader: Unable to get bootloader prompt."); transferComplete(ZigBeeTransportFirmwareStatus.FIRMWARE_UPDATE_FAILED); return false; } EmberFirmwareUpdateHandler(ZigBeeDongleEzsp dongle, InputStream firmware, ZigBeePort serialPort,
            ZigBeeTransportFirmwareCallback callback); void startBootload(); void cancelUpdate();  }