com.gtosoft.libvoyager.util
Class OBDPacketParser
java.lang.Object
com.gtosoft.libvoyager.util.OBDPacketParser
public class OBDPacketParser
- extends java.lang.Object
- Author:
- brad
The purpose of this class is to facilitate the process of finding the data bytes within OBD packets.
The problem being that there are a ton of protocols - 10 in fact are supported by the ELM327.
So basically the hard part is extracting the data from the packets while also hopefully retaining
other important information such as transmitter node address.
The ultimate goal is to pass this class something like this:
Request =03
Response=03|7E8 02 43 00 |7EA 02 43 00 ||>
Protocol=6 (AUTO, ISO 15765-4 (CAN 11/500))
And for us to produce a hashmap containing the following representation of that data:
7E8=43 00
7EA=43 00
Usage: Instantiate it once for the life of the protocol you're using. make repeated calls for various packets to decode them.
Constructor Summary |
OBDPacketParser(int ELMProtocolNumber)
Default constructor |
Method Summary |
java.util.HashMap<java.lang.String,java.lang.String> |
getData_CAN(java.lang.String request,
java.lang.String response)
|
java.util.HashMap<java.lang.String,java.lang.String> |
getData_NONCAN(java.lang.String request,
java.lang.String response)
|
java.util.HashMap<java.lang.String,java.lang.String> |
getData(java.lang.String request,
java.lang.String response)
|
GeneralStats |
getStats()
Returns a reference to our generalstats object so you can make a copy of it or access items from it. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PROTOCOL_SAEJ1850PWM
public static final int PROTOCOL_SAEJ1850PWM
- See Also:
- Constant Field Values
PROTOCOL_SAEJ1850VPW
public static final int PROTOCOL_SAEJ1850VPW
- See Also:
- Constant Field Values
PROTOCOL_ISO9141_2
public static final int PROTOCOL_ISO9141_2
- See Also:
- Constant Field Values
PROTOCOL_ISO14230_4KWP
public static final int PROTOCOL_ISO14230_4KWP
- See Also:
- Constant Field Values
PROTOCOL_ISO14230_4KWPfast
public static final int PROTOCOL_ISO14230_4KWPfast
- See Also:
- Constant Field Values
PROTOCOL_ISO15765_4CAN11500
public static final int PROTOCOL_ISO15765_4CAN11500
- See Also:
- Constant Field Values
PROTOCOL_ISO15765_4CAN29500
public static final int PROTOCOL_ISO15765_4CAN29500
- See Also:
- Constant Field Values
PROTOCOL_ISO15765_4CAN11250
public static final int PROTOCOL_ISO15765_4CAN11250
- See Also:
- Constant Field Values
PROTOCOL_ISO15765_4CAN29250
public static final int PROTOCOL_ISO15765_4CAN29250
- See Also:
- Constant Field Values
PROTOCOL_SAEJ1939CAN29250
public static final int PROTOCOL_SAEJ1939CAN29250
- See Also:
- Constant Field Values
OBDPacketParser
public OBDPacketParser(int ELMProtocolNumber)
- Default constructor
- Parameters:
ELMProtocolNumber
- - the protocol number from ELM327 command "AT DPN"
getStats
public GeneralStats getStats()
- Returns a reference to our generalstats object so you can make a copy of it or access items from it. Please don't modify it.
- Returns:
- - returns our GeneralStats object.
getData
public java.util.HashMap<java.lang.String,java.lang.String> getData(java.lang.String request,
java.lang.String response)
getData_NONCAN
public java.util.HashMap<java.lang.String,java.lang.String> getData_NONCAN(java.lang.String request,
java.lang.String response)
- Parameters:
request
- - request sequence, for example "03" or "01 0C"response
- - the exact response received, including all formatting.
- Returns:
- - returns a hashmap containing the full re-assembled data for each different node. Or a blank hashmap on error.
getData_CAN
public java.util.HashMap<java.lang.String,java.lang.String> getData_CAN(java.lang.String request,
java.lang.String response)
- Parameters:
request
- - request sequence, for example "03" or "01 0C"response
- - the exact response received, including all formatting.
- Returns:
- - returns a hashmap containing the full re-assembled data for each different node. Or a blank hashmap on error.