org.opengts.servers.template
Class TrackClientPacketHandler

java.lang.Object
  extended by org.opengts.util.AbstractClientPacketHandler
      extended by org.opengts.servers.template.TrackClientPacketHandler
All Implemented Interfaces:
ClientPacketHandler

public class TrackClientPacketHandler
extends AbstractClientPacketHandler

TrackClientPacketHandler - This module contains the general "business logic" for parsing incoming data packets from the remote tracking Device.


Field Summary
static int DATA_FORMAT_OPTION
           
static boolean ESTIMATE_ODOMETER
           
static double KILOMETERS_PER_KNOT
           
static double KNOTS_PER_KILOMETER
           
static double MINIMUM_SPEED_KPH
           
static long SIMEVENT_DIGITAL_INPUTS
           
static boolean SIMEVENT_GEOZONES
           
static boolean USE_STANDARD_TCP_SESSION_ID
           
 
Fields inherited from class org.opengts.util.AbstractClientPacketHandler
GMT_Timezone, PACKET_LEN_END_OF_STREAM, PACKET_LEN_LINE_TERMINATOR
 
Constructor Summary
TrackClientPacketHandler()
           
 
Method Summary
static int _main(boolean fromMain)
          Main entry point used for debug purposes only
static void configInit()
          Initialize runtime configuration
static java.lang.String CreateTcpSessionID(Device dev)
           
 int getActualPacketLength(byte[] packet, int packetLen)
          Callback to obtain the length of the next packet, based on the provided partial packet data.
 byte[] getFinalPacket(boolean hasError)
          Returns the final packet that should be sent to the device before closing the socket connection.
 byte[] getHandlePacket(byte[] pktBytes)
          Parse the provided packet information, and return any response that should be sent back to the remote device
 byte[] getInitialPacket()
          Returns the initial packet that should be sent to the device upon openning the socket connection .
 java.lang.String getSessionID()
          Returns the session ID (override only)
static java.lang.String GetTcpSessionID(Device dev)
           
 boolean getTerminateSession()
          Callback to determine if the current session should be terminated
static void main(java.lang.String[] argv)
          Main entry point used for debug purposes only
 void sessionStarted(java.net.InetAddress inetAddr, boolean isTCP, boolean isText)
          Called when the session has started
 void sessionTerminated(java.lang.Throwable err, long readCount, long writeCount)
          Callback just before the session is terminated
 
Methods inherited from class org.opengts.util.AbstractClientPacketHandler
clearSavedEventCount, clearTerminateSession, equals, equalsSessionID, forceCloseTCPSession, GetDebugMode, getHostAddress, getInetAddress, getIPAddress, getLocalPort, getMaximumPacketLength, getMinimumPacketLength, getName, getPromptEnabled, getRemotePort, getResponsePort, getSavedEventCount, getSequenceID, getSessionInfo, getSessionStartTime, getSessionStartTimeMS, getSessionType, getThreadName, hasHostAddress, hasIPAddress, hasSavedEvents, idleTimeoutInterrupt, incrementSavedEventCount, IsDebugMode, isDuplex, isInputStream, isTCP, isTextPackets, isUDP, printSessionStart, printSessionTerminated, SetDebugMode, setPromptEnabled, setSavedEventCount, setSessionInfo, setTerminateSession, setTerminateSession, tcpWrite, terminateSession
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATA_FORMAT_OPTION

public static int DATA_FORMAT_OPTION

ESTIMATE_ODOMETER

public static boolean ESTIMATE_ODOMETER

SIMEVENT_GEOZONES

public static boolean SIMEVENT_GEOZONES

SIMEVENT_DIGITAL_INPUTS

public static long SIMEVENT_DIGITAL_INPUTS

MINIMUM_SPEED_KPH

public static double MINIMUM_SPEED_KPH

KILOMETERS_PER_KNOT

public static final double KILOMETERS_PER_KNOT
See Also:
Constant Field Values

KNOTS_PER_KILOMETER

public static final double KNOTS_PER_KILOMETER
See Also:
Constant Field Values

USE_STANDARD_TCP_SESSION_ID

public static final boolean USE_STANDARD_TCP_SESSION_ID
See Also:
Constant Field Values
Constructor Detail

TrackClientPacketHandler

public TrackClientPacketHandler()
Method Detail

sessionStarted

public void sessionStarted(java.net.InetAddress inetAddr,
                           boolean isTCP,
                           boolean isText)
Description copied from class: AbstractClientPacketHandler
Called when the session has started

Specified by:
sessionStarted in interface ClientPacketHandler
Overrides:
sessionStarted in class AbstractClientPacketHandler
Parameters:
inetAddr - The host IP address
isTCP - True if the connection is TCP
isText - True if the connection is text

sessionTerminated

public void sessionTerminated(java.lang.Throwable err,
                              long readCount,
                              long writeCount)
Description copied from class: AbstractClientPacketHandler
Callback just before the session is terminated

Specified by:
sessionTerminated in interface ClientPacketHandler
Overrides:
sessionTerminated in class AbstractClientPacketHandler

getSessionID

public java.lang.String getSessionID()
Description copied from class: AbstractClientPacketHandler
Returns the session ID (override only)

Overrides:
getSessionID in class AbstractClientPacketHandler
Returns:
The session ID

GetTcpSessionID

public static java.lang.String GetTcpSessionID(Device dev)

CreateTcpSessionID

public static java.lang.String CreateTcpSessionID(Device dev)

getActualPacketLength

public int getActualPacketLength(byte[] packet,
                                 int packetLen)
Description copied from class: AbstractClientPacketHandler
Callback to obtain the length of the next packet, based on the provided partial packet data.

Specified by:
getActualPacketLength in interface ClientPacketHandler
Overrides:
getActualPacketLength in class AbstractClientPacketHandler

getTerminateSession

public boolean getTerminateSession()
Description copied from class: AbstractClientPacketHandler
Callback to determine if the current session should be terminated

Specified by:
getTerminateSession in interface ClientPacketHandler
Overrides:
getTerminateSession in class AbstractClientPacketHandler
Returns:
True if the session should terminate

getInitialPacket

public byte[] getInitialPacket()
                        throws java.lang.Exception
Description copied from class: AbstractClientPacketHandler
Returns the initial packet that should be sent to the device upon openning the socket connection .

Specified by:
getInitialPacket in interface ClientPacketHandler
Overrides:
getInitialPacket in class AbstractClientPacketHandler
Returns:
The initial response to be sent when the session opens
Throws:
java.lang.Exception

getHandlePacket

public byte[] getHandlePacket(byte[] pktBytes)
Description copied from class: AbstractClientPacketHandler
Parse the provided packet information, and return any response that should be sent back to the remote device

Specified by:
getHandlePacket in interface ClientPacketHandler
Specified by:
getHandlePacket in class AbstractClientPacketHandler
Parameters:
pktBytes - The packet
Returns:
The response

getFinalPacket

public byte[] getFinalPacket(boolean hasError)
                      throws java.lang.Exception
Description copied from class: AbstractClientPacketHandler
Returns the final packet that should be sent to the device before closing the socket connection.

Specified by:
getFinalPacket in interface ClientPacketHandler
Overrides:
getFinalPacket in class AbstractClientPacketHandler
Returns:
the final response to be sent before the session closes
Throws:
java.lang.Exception

configInit

public static void configInit()
Initialize runtime configuration


_main

public static int _main(boolean fromMain)
Main entry point used for debug purposes only


main

public static void main(java.lang.String[] argv)
Main entry point used for debug purposes only