com.gtosoft.libvoyager.session
Class MonitorSession

java.lang.Object
  extended by com.gtosoft.libvoyager.session.MonitorSession

public class MonitorSession
extends java.lang.Object

This class will communicate with the ELMBT layer to maintain a consistent BT and OBD state, while presenting new data to upper layers by way of a callback method.

Author:
Brad Hein / GTOSoft LLC. All Rights Reserved.

Field Summary
static int INTERFACE_STANDARD
           
static int INTERFACE_SWCAN
           
static int STATE_BTCONFIGURED
           
static int STATE_BTCONNECTED
           
static int STATE_OBDCONNECTED
           
static int STATE_SNIFFING
           
static int STATE_UNINITIALIZED
           
 
Constructor Summary
MonitorSession(ELMBT elmbt, int CANNetworkProtocol, PIDDecoder p)
          Constructor.
 
Method Summary
 boolean _suspend()
          Suspend operations by this class/session and return the network to a usable state for others.
 long getBufferFullsPerMinute()
           
 int getCurrentState()
          Returns the current state as an integer.
 GeneralStats getStats()
           
 long getTimeInCurrentState()
           
 boolean isIODoneTrying()
           
 void monitorAll()
          set the monitor mode to "monitor everything", no filters.
 void monitorReceiver(java.lang.String whichReceiver)
          Monitor the bus for packets with receiver field set to this.
 void monitorTransmitter(java.lang.String whichTransmistter)
          monitor the bus for packets with source node address equal to that specified.
 void registerMessageCallback(EventCallback eventCallback)
          A means for a parent class to receive messages generated by this class.
 void registerMonitorStateChangeListener(EventCallback ecb)
           
 boolean resume()
           
 void setIOReconnectNOW()
          Will kick the I/O Layer into trying to connect again.
 void setProto(int interfaceType)
          Specifies the protocol of the connected device.
 void shutdown()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INTERFACE_STANDARD

public static final int INTERFACE_STANDARD
See Also:
Constant Field Values

INTERFACE_SWCAN

public static final int INTERFACE_SWCAN
See Also:
Constant Field Values

STATE_UNINITIALIZED

public static final int STATE_UNINITIALIZED
See Also:
Constant Field Values

STATE_BTCONNECTED

public static final int STATE_BTCONNECTED
See Also:
Constant Field Values

STATE_BTCONFIGURED

public static final int STATE_BTCONFIGURED
See Also:
Constant Field Values

STATE_OBDCONNECTED

public static final int STATE_OBDCONNECTED
See Also:
Constant Field Values

STATE_SNIFFING

public static final int STATE_SNIFFING
See Also:
Constant Field Values
Constructor Detail

MonitorSession

public MonitorSession(ELMBT elmbt,
                      int CANNetworkProtocol,
                      PIDDecoder p)
Constructor.

Parameters:
elmbt - - an instance of elmbt which has been initialized and ready for us to use.
Method Detail

monitorAll

public void monitorAll()
set the monitor mode to "monitor everything", no filters.


monitorTransmitter

public void monitorTransmitter(java.lang.String whichTransmistter)
monitor the bus for packets with source node address equal to that specified.

Parameters:
whichTransmistter -

monitorReceiver

public void monitorReceiver(java.lang.String whichReceiver)
Monitor the bus for packets with receiver field set to this.

Parameters:
whichReceiver -

setProto

public void setProto(int interfaceType)
Specifies the protocol of the connected device. By default, expect standard CAN/OBD.


getCurrentState

public int getCurrentState()
Returns the current state as an integer.

Returns:
- the current state - corresponds to one of MonitorSession.STATE_* constants.

shutdown

public void shutdown()

registerMessageCallback

public void registerMessageCallback(EventCallback eventCallback)
A means for a parent class to receive messages generated by this class. Very useful for debugging.

Parameters:
eventCallback - - override the newMessage() method.

registerMonitorStateChangeListener

public void registerMonitorStateChangeListener(EventCallback ecb)

getTimeInCurrentState

public long getTimeInCurrentState()

getBufferFullsPerMinute

public long getBufferFullsPerMinute()

isIODoneTrying

public boolean isIODoneTrying()
Returns:
- returns true if the IO layer is done trying to reconnect.

setIOReconnectNOW

public void setIOReconnectNOW()
Will kick the I/O Layer into trying to connect again.


getStats

public GeneralStats getStats()

_suspend

public boolean _suspend()
Suspend operations by this class/session and return the network to a usable state for others. We will go to sleep as long as we're suspended.

Returns:

resume

public boolean resume()