Last active
December 16, 2015 09:39
-
-
Save pires/5414594 to your computer and use it in GitHub Desktop.
Generic ObdCommand that accepts a message in byte notation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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