public boolean openDevice(boolean simulate) { if (simulate) return true; boolean found = false; try { USBFlash.open(); phoneident = new String(USBFlash.getLastReply()); cmd = new Command(_bundle.simulate()); cmd.send(Command.CMD01, Command.VALNULL, false); loaderident = new String(USBFlash.getLastReply()); found = true; } catch (Exception e) { found = false; } return found; }
public void send(int cmd, byte data[], boolean ongoing) throws X10FlashException, IOException { writeCommand(cmd, data, ongoing); reply = USBFlash.getLastReply(); if (USBFlash.getLastFlags() == 0) { writeCommand(Command.CMD07, Command.VALNULL, false); throw new X10FlashException(getLastReplyString()); } while (isMultiPacketMessage()) { writeCommand(cmd, data, ongoing); reply = Bytes.concat(reply, USBFlash.getLastReply()); if (USBFlash.getLastFlags() == 0) { writeCommand(Command.CMD07, Command.VALNULL, false); throw new X10FlashException(getLastReplyString()); } } LogProgress.updateProgress(); }