com.gtosoft.libvoyager.util
Class EventCallback

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

public class EventCallback
extends java.lang.Object

This class was designed to privode a means for low level classes to percolate messages and events up the stack in an event-driven manner. For example, if a low level I/O class wants to notify a higher level class that new data is available for processing, it may do so by using a method defined in this class. The higher level class defines an instance of this class and overrides the needed method, then registers the class with the lower level class the lower level class checks to see if the class has been registered and runs the methdo if so.

Author:
brad

Constructor Summary
EventCallback()
           
 
Method Summary
 void newMsg(java.lang.String message)
          A method to be executed by a lower level class in order to
 void newPacket(java.lang.String packet)
          To be used to pass packets from the session layer up to the decoder.
 void onDPArrived(java.lang.String DPN, java.lang.String sDecodedData, int iDecodedData)
          This method gets fired off by the PIDDecoder class every time a new datapoint is decoded.
 void onELMDeviceChosen(java.lang.String MAC)
          This method is to be used by the libVoyager ActivityHelper class which can be used to discover nearby ELM devices.
 void onNewDataArrived(java.lang.String dataPointName, java.lang.String header, java.lang.String oldData, java.lang.String newData, boolean isNew, boolean dataChanged)
          This method should be kicked off any time new data arrives.
 void onOOBDataArrived(java.lang.String dataName, java.lang.String dataValue)
          This will be used to pass certain information up the layers to the top.
 void onStateChange(int oldState, int newState)
          A method to be executed when the connection state changes.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventCallback

public EventCallback()
Method Detail

newPacket

public void newPacket(java.lang.String packet)
To be used to pass packets from the session layer up to the decoder.

Parameters:
packet -

newMsg

public void newMsg(java.lang.String message)
A method to be executed by a lower level class in order to

Parameters:
message -

onStateChange

public void onStateChange(int oldState,
                          int newState)
A method to be executed when the connection state changes.

Parameters:
newState -

onNewDataArrived

public void onNewDataArrived(java.lang.String dataPointName,
                             java.lang.String header,
                             java.lang.String oldData,
                             java.lang.String newData,
                             boolean isNew,
                             boolean dataChanged)
This method should be kicked off any time new data arrives. The second arg may be optional depending on the situation.

Parameters:
dataPointName -
newData -

onDPArrived

public void onDPArrived(java.lang.String DPN,
                        java.lang.String sDecodedData,
                        int iDecodedData)
This method gets fired off by the PIDDecoder class every time a new datapoint is decoded. A Parent class can then use the data specified in either the string or int arg, depending on the type of data.

Parameters:
DPN - - DataPointName
sDecodedData - - String representation of the datapoint
iDecodedData - - integer representation of the datapoint.

onOOBDataArrived

public void onOOBDataArrived(java.lang.String dataName,
                             java.lang.String dataValue)
This will be used to pass certain information up the layers to the top. The type of information being passed upward will be of an "out of band" nature. For example, one message might contain results from a network device scan.

Parameters:
dataName - - name of the value, "like" a datapoint, but out of band stuff doesn't have DPNs.
dataValue - - string representation of the value, most commonly used
iDataValue - - in some instances it may be beneficial to pass the information as an integer, in which case this arg may be utilized.

onELMDeviceChosen

public void onELMDeviceChosen(java.lang.String MAC)
This method is to be used by the libVoyager ActivityHelper class which can be used to discover nearby ELM devices.

Parameters:
MAC -