/** * Iterate all commands, send them and read response. * * @param in a {@link java.io.InputStream} object. * @param out a {@link java.io.OutputStream} object. * @throws java.io.IOException if any. * @throws java.lang.InterruptedException if any. */ public void sendCommands(InputStream in, OutputStream out) throws IOException, InterruptedException { for (ObdCommand command : commands) command.run(in, out); }
/** {@inheritDoc} */ @Override public void run(InputStream in, OutputStream out) throws IOException, InterruptedException { String key = getClass().getSimpleName(); if (knownValues.containsKey(key)) { rawData = knownValues.get(key); buffer = knownBuffers.get(key); performCalculations(); } else { super.run(in, out); } } }
job.setState(ObdCommandJobState.RUNNING); Log.d(TAG, job.getCommand().getName()); job.getCommand().run(new ByteArrayInputStream("41 00 00 00>41 00 00 00>41 00 00 00>".getBytes()), new ByteArrayOutputStream()); } else { Log.e(TAG, "Job state was not new, so it shouldn't be in queue. BUG ALERT!");
job.setState(ObdCommandJobState.RUNNING); if (sock.isConnected()) { job.getCommand().run(sock.getInputStream(), sock.getOutputStream()); } else { job.setState(ObdCommandJobState.EXECUTION_ERROR);