com.gtosoft.libvoyager.util
Class GTOMath

java.lang.Object
  extended by com.gtosoft.libvoyager.util.GTOMath

public class GTOMath
extends java.lang.Object

A Class which will compute OBD math stuff.


Field Summary
static java.util.HashMap<java.lang.String,java.lang.String> mhmResponses
           
 
Constructor Summary
GTOMath()
           
 
Method Summary
static java.lang.String decodeAutoDetect(int ELMProtocolNumber, java.lang.String request, java.lang.String formula, java.lang.String response, java.lang.String hexBytes)
           
static java.lang.String dumpHashMap(java.util.HashMap<java.lang.String,java.lang.String> hm)
           
static java.lang.String getAsATResponse(java.lang.String response)
           
static java.lang.String getAsDTCs(int ELMProtocolNumber, java.lang.String request, java.lang.String response)
           
static java.lang.String getAsMultipleDTCs(java.lang.String hexBytes)
          DTCs are binary coded decimal - each 4 bits represents a character.
static java.lang.String getAsSingleDTC(java.lang.String hexBytes)
          Given a single DTC (2 bytes), return the DTC held within those two bytes.
static java.lang.String getAsSupportedPIDs(java.lang.String response)
           
static java.lang.String getAsVIN(java.lang.String hexBytes)
           
static double safeStringToDouble(java.lang.String doubleAsString)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mhmResponses

public static java.util.HashMap<java.lang.String,java.lang.String> mhmResponses
Constructor Detail

GTOMath

public GTOMath()
Method Detail

dumpHashMap

public static java.lang.String dumpHashMap(java.util.HashMap<java.lang.String,java.lang.String> hm)

getAsATResponse

public static java.lang.String getAsATResponse(java.lang.String response)

getAsVIN

public static java.lang.String getAsVIN(java.lang.String hexBytes)

getAsDTCs

public static java.lang.String getAsDTCs(int ELMProtocolNumber,
                                         java.lang.String request,
                                         java.lang.String response)

getAsMultipleDTCs

public static java.lang.String getAsMultipleDTCs(java.lang.String hexBytes)
DTCs are binary coded decimal - each 4 bits represents a character. With a prefix for the category of the DTC.

Parameters:
response - - hex bytes of the response
Returns:
- human readable DTCs, comma separated if more than one present. "unknown" if hexbytes is blank "NONE" if hexbytes is all zeros, indicating no codes are present

getAsSingleDTC

public static java.lang.String getAsSingleDTC(java.lang.String hexBytes)
Given a single DTC (2 bytes), return the DTC held within those two bytes.

Parameters:
hexBytes - - two hex bytes which we'll turn into a DTC.
Returns:
- a single DTC code, such as "P2048".

getAsSupportedPIDs

public static java.lang.String getAsSupportedPIDs(java.lang.String response)

decodeAutoDetect

public static java.lang.String decodeAutoDetect(int ELMProtocolNumber,
                                                java.lang.String request,
                                                java.lang.String formula,
                                                java.lang.String response,
                                                java.lang.String hexBytes)

safeStringToDouble

public static double safeStringToDouble(java.lang.String doubleAsString)