Skip to content

Instantly share code, notes, and snippets.

@pires
Last active December 16, 2015 09:39
Show Gist options
  • Save pires/5414594 to your computer and use it in GitHub Desktop.
Save pires/5414594 to your computer and use it in GitHub Desktop.
Generic ObdCommand that accepts a message in byte notation.
public class GenericObdCommand extends ObdCommand {
/**
* Default ctor.
*/
public GenericObdCommand(String bytes) {
super(bytes);
}
/**
* Copy ctor.
*
* @param other
*/
public GenericObdCommand(GenericObdCommand other) {
super(other);
}
/**
*
*/
public String getFormattedResult() {
String res = getResult();
if (!"NODATA".equals(res)) {
//Ignore first two bytes [hh hh] of the response.
int response = buffer.get(2);
// TODO work this out, depending on the PID you sent
res = "Result: " + response;
}
return res;
}
@Override
public String getName() {
return "Generic command";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment