org.opengts.db
Class DCServerConfig

java.lang.Object
  extended by org.opengts.db.DCServerConfig
All Implemented Interfaces:
java.lang.Comparable

public class DCServerConfig
extends java.lang.Object
implements java.lang.Comparable


Nested Class Summary
 class DCServerConfig.Command
           
static class DCServerConfig.CommandArg
           
static class DCServerConfig.CommandProtocol
           
static class DCServerConfig.EventCode
          Device event code to status code translation
static class DCServerConfig.EventDataAnalogField
           
static class DCServerConfig.FuelLevelProfile
          FuelLevelProfile class
 
Field Summary
static java.lang.String COMMAND_CONFIG
           
static java.lang.String COMMAND_GEOZONE
           
static java.lang.String COMMAND_PING
           
static java.lang.String DEFAULT_ARG_NAME
           
static java.lang.String DEFAULT_PROP_GROUP_ID
           
static long F_COMMAND_SMS
           
static long F_COMMAND_TCP
           
static long F_COMMAND_UDP
           
static long F_HAS_INPUTS
           
static long F_HAS_OUTPUTS
           
static long F_JAR_OPTIONAL
           
static long F_NONE
           
static long F_STD_PERSONAL
           
static long F_STD_VEHICLE
           
static long F_XMIT_SAT
           
static long F_XMIT_SMS
           
static long F_XMIT_TCP
           
static long F_XMIT_UDP
           
static java.lang.String P_COMMAND_SMS
           
static java.lang.String P_COMMAND_TCP
           
static java.lang.String P_COMMAND_UDP
           
static java.lang.String P_HAS_INPUTS
           
static java.lang.String P_HAS_OUTPUTS
           
static java.lang.String P_JAR_OPTIONAL
           
static java.lang.String P_NONE
           
static java.lang.String P_XMIT_SAT
           
static java.lang.String P_XMIT_SMS
           
static java.lang.String P_XMIT_TCP
           
static java.lang.String P_XMIT_UDP
           
 
Constructor Summary
DCServerConfig()
          Blank Constructor
DCServerConfig(java.lang.String name, java.lang.String desc, int[] tcpPorts, int[] udpPorts, int commandPort, long flags, java.lang.String... uniqPfx)
          Constructor
 
Method Summary
 void addCommand(java.lang.String cmdName, java.lang.String cmdDesc, java.lang.String[] cmdTypes, java.lang.String cmdAclName, AclEntry.AccessLevel cmdAclDft, java.lang.String cmdString, boolean hasArgs, java.util.Collection<DCServerConfig.CommandArg> cmdArgList, java.lang.String cmdProto, boolean expectAck, int cmdSCode)
           
static double adjustFuelLevelProfile(double fuelLevel, DCServerConfig.FuelLevelProfile[] flp)
          Adjust the event fuel-level based on the specified profile
static double CalculateBatteryLevel(double voltage, double[] range)
          Calculates/returns the battery level based on the specified voltage range
 int compareTo(java.lang.Object other)
          Compares another DCServerConfig instance to this instance.
static byte[] convertToBytes(java.lang.String s)
          Convenience for converting the initial/final packet to a byte array.
 ServerSocketThread createServerSocketThread_TCP(int port)
          Create TCP ServerSocketThread
 ServerSocketThread createServerSocketThread_TCP(int port, boolean useSSL)
          Create TCP ServerSocketThread
 ServerSocketThread createServerSocketThread_UDP(int port)
          Create UDP ServerSocketThread
 boolean equals(java.lang.Object other)
          Returns true if the 'other' DCServerCOnfig is equal to this DCServerConfig based on the name.
static int getAckResponsePort(DCServerConfig dcsc, int dft)
          Gets the "ACK Response Port"
 int getAckResponsePort(int dft)
          Gets the "ACK Response Port"
 long getAttributeFlags()
          Gets the server attribute flags
static long GetAttributeFlags(RTProperties rtp)
           
static double[] getBatteryLevelRange(DCServerConfig dcsc, double[] dft)
          Gets the "Battery Level Range" config
 double[] getBatteryLevelRange(double[] dft)
          Gets the "Battery Level Range" config
 boolean getBooleanProperty(java.lang.String[] key, boolean dft)
           
 boolean getBooleanProperty(java.lang.String key, boolean dft)
           
 int getClientCommandPort_tcp(int dft)
          Gets the "Client Command Port"
 int getClientCommandPort_udp(int dft)
          Gets the "Client Command Port"
 DCServerConfig.Command getCommand(java.lang.String name)
           
 java.lang.String getCommandDescription(java.lang.String cmdName, java.lang.String dft)
          Gets the "Command Description" for the specified command
 java.util.Map<java.lang.String,java.lang.String> getCommandDescriptionMap(BasicPrivateLabel privLabel, User user, java.lang.String type)
          Gets the command's (name,description) map
 java.lang.String getCommandDispatcherHost()
          Gets the device command listen host
 int getCommandDispatcherPort()
          Gets the device command listen port (returns '0' if not supported)
 java.lang.String[] getCommandList()
          Gets the "Command List"
 java.util.Map<java.lang.String,DCServerConfig.Command> getCommandMap(BasicPrivateLabel privLabel, User user, java.lang.String type)
          Gets the command's (name,description) map
 DCServerConfig.CommandProtocol getCommandProtocol()
          Gets the command protocol to use when communicating with remote devices
static DCServerConfig.CommandProtocol getCommandProtocol(java.lang.String v)
           
 AclEntry.AccessLevel getCommandsAccessLevelDefault()
          Gets the Commands Acl AccessLevel default
 java.lang.String getCommandsAclName()
          Gets the Commands Acl name
 int getCommandStatusCode(java.lang.String cmdName, int code)
          Gets the status-code for the specified command.
 java.lang.String getCommandString(java.lang.String cmdName, java.lang.String dft)
          Gets the "Command String" for the specified command
 RTProperties getDefaultProperties()
           
 java.lang.String getDescription()
          Gets the server description
 boolean getDigitalInputState(long mask, int bit)
          Returns the state of the indicated bit within the mask for this device type.
 double getDoubleProperty(java.lang.String[] key, double dft)
           
 double getDoubleProperty(java.lang.String key, double dft)
           
 boolean getEstimateOdometer(boolean dft)
          Gets the "Estimate Odometer" flag
static boolean getEstimateOdometer(DCServerConfig dcsc, boolean dft)
          Gets the "Estimate Odometer" flag
 DCServerConfig.EventCode getEventCode(int code)
          Returns the EventCode instance for the specified code
 DCServerConfig.EventCode getEventCode(long code)
          Returns the EventCode instance for the specified code
 DCServerConfig.EventCode getEventCode(java.lang.String code)
          Returns the EventCode instance for the specified code
 boolean getEventCodeEnabled()
          Gets the "Event Code Map Enable" config
 byte[] getFinalPacket(byte[] dft)
          Gets the "Final Packet" byte array
 boolean getIgnoreDeviceOdometer(boolean dft)
          Gets the "Ignore Device Odometer" flag
static boolean getIgnoreDeviceOdometer(DCServerConfig dcsc, boolean dft)
          Gets the "Ignore Device Odometer" flag
 boolean getIgnoreInvalidGPSFlag(boolean dft)
          Gets the "Ignore Invalid GPS Location Flag" config
static boolean getIgnoreInvalidGPSFlag(DCServerConfig dcsc, boolean dft)
          Gets the "Ignore Invalid GPS Location Flag" config
 byte[] getInitialPacket(byte[] dft)
          Gets the "Initial Packet" byte array
 int getIntProperty(java.lang.String[] key, int dft)
           
 int getIntProperty(java.lang.String key, int dft)
           
 int[] getListenPorts()
          Returns an array of all TCP/UDP 'listen' ports
static java.io.File getLogFilePath(java.io.File jarPath)
          Return log file paths from jar file paths
 long getLongProperty(java.lang.String[] key, long dft)
           
 long getLongProperty(java.lang.String key, long dft)
           
static double getMaximumHDOP(DCServerConfig dcsc, double dft)
          Gets the "Maximum HDOP"
 double getMaximumHDOP(double dft)
          Gets the "Maximum HDOP"
static double getMinimumMovedMeters(DCServerConfig dcsc, double dft)
          Gets the "Minimum Moved Meters"
 double getMinimumMovedMeters(double dft)
          Gets the "Minimum Moved Meters"
static double getMinimumSpeedKPH(DCServerConfig dcsc, double dft)
          Gets the "Minimum Speed KPH"
 double getMinimumSpeedKPH(double dft)
          Gets the "Minimum Speed KPH"
 java.lang.String getName()
          Gets the server name/id
 java.lang.String getPortsString()
           
 java.lang.StringBuffer getPortsString(java.lang.StringBuffer sb)
           
 RTProperties getProperties(java.lang.String propID)
           
 RTProperties getProperties(java.lang.String propID, boolean createNewGroup)
           
 java.util.Set<java.lang.String> getPropertyGroupNames()
           
 java.util.Set<java.lang.String> getPropertyKeys(java.lang.String prefix)
           
static java.lang.String getPSJavaCommand_jar(java.lang.String name, java.lang.String display)
          Returns the "psjava" command relative to GTS_HOME, and returning the specified information for the named jar file
static java.lang.String getPSJavaCommand()
          Returns the "psjava" command relative to GTS_HOME
 java.io.File[] getRunningJarPath()
          Return running jar file path
static java.io.File[] getRunningJarPath(java.lang.String name)
          Returns the file path for the named running DCServerConfig jar files.
This method will return 'null' if no DCServerConfig jar files with the specified name are currently running.
All matching running DCServerConfig entries will be returned.
 boolean getSaveRawDataPackets(boolean dft)
          Gets the "Save Raw Data Packet" config
static boolean getSaveRawDataPackets(DCServerConfig dcsc, boolean dft)
          Gets the "Save Raw Data Packet" config
 boolean getSaveSessionStatistics(boolean dft)
          Gets the "Save Session Statistics" config
static boolean getSaveSessionStatistics(DCServerConfig dcsc, boolean dft)
          Gets the "Save Session Statistics" config
static long getSimulateDigitalInputs(DCServerConfig dcsc, long dft)
          Gets the "Simulate Geozones" mask
 long getSimulateDigitalInputs(long dft)
          Gets the "Simulate Geozones" mask
 boolean getSimulateGeozones(boolean dft)
          Gets the "Simulate Geozones"
static boolean getSimulateGeozones(DCServerConfig dcsc, boolean dft)
          Gets the "Simulate Geozones"
 boolean getStartStopSupported(boolean dft)
          Gets the "Start/Stop StatusCode supported" config
static boolean getStartStopSupported(DCServerConfig dcsc, boolean dft)
          Gets the "Start/Stop StatusCode supported" config
 boolean getStatusLocationInMotion(boolean dft)
          Gets the "Status Location/InMotion Translation" config
static boolean getStatusLocationInMotion(DCServerConfig dcsc, boolean dft)
          Gets the "Status Location/InMotion Translation" config
 java.lang.String[] getStringArrayProperty(java.lang.String[] key, java.lang.String[] dft)
           
 java.lang.String[] getStringArrayProperty(java.lang.String key, java.lang.String[] dft)
           
 java.lang.String getStringProperty(java.lang.String[] key, java.lang.String dft)
           
 java.lang.String getStringProperty(java.lang.String key, java.lang.String dft)
           
 long getTcpIdleTimeoutMS(long dft)
          Gets the "TCP idle timeout"
 long getTcpPacketTimeoutMS(long dft)
          Gets the "TCP packet timeout"
 java.net.InetAddress getTcpPortBindAddress(int port)
          Get TCP Port bind address
 int[] getTcpPorts()
          Gets the default TCP port for this server
 long getTcpSessionTimeoutMS(long dft)
          Gets the "TCP session timeout"
 long getUdpIdleTimeoutMS(long dft)
          Gets the "UDP idle timeout"
 long getUdpPacketTimeoutMS(long dft)
          Gets the "UDP packet timeout"
 java.net.InetAddress getUdpPortBindAddress(int port)
          Get UDP Port bind address
 int[] getUdpPorts()
          Gets the default UDP port for this server
 long getUdpSessionTimeoutMS(long dft)
          Gets the "UDP session timeout"
 java.lang.String[] getUniquePrefix()
          Gets the array of allowed UniqueID prefixes
 java.lang.String[] getUniquePrefix(java.lang.String[] dftPfx)
          Gets the array of allowed UniqueID prefixes
 boolean getUseLastValidGPSLocation(boolean dft)
          Gets the "Use Last Valid GPS Location" config
static boolean getUseLastValidGPSLocation(DCServerConfig dcsc, boolean dft)
          Gets the "Use Last Valid GPS Location" config
 boolean getUseSSL()
          Gets whether to use SSL on TCP connections
 boolean hasDigitalInputs()
          Returns true if this device supports digital inputs
 boolean hasDigitalOutputs()
          Returns true if this device supports digital outputs
 int hashCode()
          Return hashCode based on the DCServerConfig name
 boolean hasProperty(java.lang.String[] key, boolean inclDft)
           
 boolean isAttributeFlag(long mask)
          Returns true if the indicate mask is non-zero
 boolean isJarOptional()
          Returns true if this DCS requires a Jar file
 Device loadDeviceUniqueID(java.lang.String modemID)
          Load device record from unique-id (not yet used/tested)
 java.lang.String normalizeKey(java.lang.String key)
          Prepend DCS name to key
 java.lang.String[] normalizeKeys(java.lang.String[] key)
          Prepend DCS name to keys
static DCServerConfig.FuelLevelProfile[] ParseFuelLevelProfile(java.lang.String profile)
          Parse the FuelLevelProfile String
 boolean serverJarExists()
          Returns true if the named server is defined
 void setAttributeFlags(long f)
          Sets the server attribute flags
 void setCommandDispatcherHost(java.lang.String cmdHost)
          Sets the device command listen host (may be null to use default bind-address)
 void setCommandDispatcherPort(int cmdPort)
          Sets the device command listen port
 void setCommandDispatcherPort(int cmdPort, boolean checkRTP)
          Sets the device command listen port
 void setCommandProtocol(DCServerConfig.CommandProtocol proto)
          Sets the command protocol to use when communicating with remote devices
 void setCommandProtocol(java.lang.String proto)
          Sets the command protocol to use when communicating with remote devices
 void setCommandsAclName(java.lang.String aclName, AclEntry.AccessLevel dft)
          Sets the Commands Acl name
 void setDescription(java.lang.String d)
          Sets the server description
 void setEventCodeEnabled(boolean enabled)
          Sets the "Event Code Map Enable" config
 void setEventCodeMap(java.util.Map<java.lang.Object,DCServerConfig.EventCode> codeMap)
           
protected  void setName(java.lang.String n)
          Sets the server name/id
 void setTcpPorts(java.net.InetAddress bindAddr, int[] tcp, boolean checkRTP)
          Sets the default TCP port for this server
 void setUdpPorts(java.net.InetAddress bindAddr, int[] udp, boolean checkRTP)
          Sets the default UDP port for this server
 void setUniquePrefix(java.lang.String[] pfx)
          Sets the array of allowed UniqueID prefixes
 void setUseSSL(boolean useSSL)
          Sets whether to use SSL on TCP connections
static ServerSocketThread startCommandHandler(int port, java.lang.Class handler)
          Start Command Listener
static void startServerSocketThread(ServerSocketThread sst, java.lang.String type)
          Start ServerSocketThread
 java.lang.String toString()
          Returns a String representation of this instance
 java.lang.String toString(boolean inclName)
          Returns a String representation of this instance
 int translateStatusCode(int code, int dftStatusCode)
          Translates the specified device status code into a GTS status code
 int translateStatusCode(java.lang.String code, int dftStatusCode)
          Translates the specified device status code into a GTS status code
 boolean userHasAccessToCommand(BasicPrivateLabel privLabel, User user, java.lang.String commandName)
          Returns True if the specified user has access to the named command
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_PROP_GROUP_ID

public static final java.lang.String DEFAULT_PROP_GROUP_ID
See Also:
Constant Field Values

P_NONE

public static final java.lang.String P_NONE
See Also:
Constant Field Values

P_HAS_INPUTS

public static final java.lang.String P_HAS_INPUTS
See Also:
Constant Field Values

P_HAS_OUTPUTS

public static final java.lang.String P_HAS_OUTPUTS
See Also:
Constant Field Values

P_COMMAND_SMS

public static final java.lang.String P_COMMAND_SMS
See Also:
Constant Field Values

P_COMMAND_UDP

public static final java.lang.String P_COMMAND_UDP
See Also:
Constant Field Values

P_COMMAND_TCP

public static final java.lang.String P_COMMAND_TCP
See Also:
Constant Field Values

P_XMIT_TCP

public static final java.lang.String P_XMIT_TCP
See Also:
Constant Field Values

P_XMIT_UDP

public static final java.lang.String P_XMIT_UDP
See Also:
Constant Field Values

P_XMIT_SMS

public static final java.lang.String P_XMIT_SMS
See Also:
Constant Field Values

P_XMIT_SAT

public static final java.lang.String P_XMIT_SAT
See Also:
Constant Field Values

P_JAR_OPTIONAL

public static final java.lang.String P_JAR_OPTIONAL
See Also:
Constant Field Values

F_NONE

public static final long F_NONE
See Also:
Constant Field Values

F_HAS_INPUTS

public static final long F_HAS_INPUTS
See Also:
Constant Field Values

F_HAS_OUTPUTS

public static final long F_HAS_OUTPUTS
See Also:
Constant Field Values

F_COMMAND_TCP

public static final long F_COMMAND_TCP
See Also:
Constant Field Values

F_COMMAND_UDP

public static final long F_COMMAND_UDP
See Also:
Constant Field Values

F_COMMAND_SMS

public static final long F_COMMAND_SMS
See Also:
Constant Field Values

F_XMIT_TCP

public static final long F_XMIT_TCP
See Also:
Constant Field Values

F_XMIT_UDP

public static final long F_XMIT_UDP
See Also:
Constant Field Values

F_XMIT_SMS

public static final long F_XMIT_SMS
See Also:
Constant Field Values

F_XMIT_SAT

public static final long F_XMIT_SAT
See Also:
Constant Field Values

F_JAR_OPTIONAL

public static final long F_JAR_OPTIONAL
See Also:
Constant Field Values

F_STD_VEHICLE

public static final long F_STD_VEHICLE
See Also:
Constant Field Values

F_STD_PERSONAL

public static final long F_STD_PERSONAL
See Also:
Constant Field Values

COMMAND_CONFIG

public static final java.lang.String COMMAND_CONFIG
See Also:
Constant Field Values

COMMAND_PING

public static final java.lang.String COMMAND_PING
See Also:
Constant Field Values

COMMAND_GEOZONE

public static final java.lang.String COMMAND_GEOZONE
See Also:
Constant Field Values

DEFAULT_ARG_NAME

public static final java.lang.String DEFAULT_ARG_NAME
See Also:
Constant Field Values
Constructor Detail

DCServerConfig

public DCServerConfig()
Blank Constructor


DCServerConfig

public DCServerConfig(java.lang.String name,
                      java.lang.String desc,
                      int[] tcpPorts,
                      int[] udpPorts,
                      int commandPort,
                      long flags,
                      java.lang.String... uniqPfx)
Constructor

Method Detail

GetAttributeFlags

public static long GetAttributeFlags(RTProperties rtp)

getCommandProtocol

public static DCServerConfig.CommandProtocol getCommandProtocol(java.lang.String v)

getPSJavaCommand

public static java.lang.String getPSJavaCommand()
Returns the "psjava" command relative to GTS_HOME

Returns:
The "psjava" command relative to GTS_HOME

getPSJavaCommand_jar

public static java.lang.String getPSJavaCommand_jar(java.lang.String name,
                                                    java.lang.String display)
Returns the "psjava" command relative to GTS_HOME, and returning the specified information for the named jar file

Parameters:
name - The DCServerConfig name
display - The type of information to return ("pid", "name", "user")
Returns:
The returned 'display' information for the specified DCServerConfig

getRunningJarPath

public static java.io.File[] getRunningJarPath(java.lang.String name)
Returns the file path for the named running DCServerConfig jar files.
This method will return 'null' if no DCServerConfig jar files with the specified name are currently running.
All matching running DCServerConfig entries will be returned.

Parameters:
name - The DCServerConfig name
Returns:
The matching running jar file paths, or null if no matching server enteries are running.

getLogFilePath

public static java.io.File getLogFilePath(java.io.File jarPath)
Return log file paths from jar file paths


ParseFuelLevelProfile

public static DCServerConfig.FuelLevelProfile[] ParseFuelLevelProfile(java.lang.String profile)
Parse the FuelLevelProfile String

Parameters:
profile - The string containing the fuel-level profile
Returns:
An array of FuelLevelProfile entries

adjustFuelLevelProfile

public static double adjustFuelLevelProfile(double fuelLevel,
                                            DCServerConfig.FuelLevelProfile[] flp)
Adjust the event fuel-level based on the specified profile

Parameters:
fuelLevel - The event fuel-level to adjust
flp - The FuelLevelProfile array used to adjust the fuel-level
Returns:
The adjusted fuel-level

setName

protected void setName(java.lang.String n)
Sets the server name/id


getName

public java.lang.String getName()
Gets the server name/id


setDescription

public void setDescription(java.lang.String d)
Sets the server description


getDescription

public java.lang.String getDescription()
Gets the server description


setAttributeFlags

public void setAttributeFlags(long f)
Sets the server attribute flags


getAttributeFlags

public long getAttributeFlags()
Gets the server attribute flags


isAttributeFlag

public boolean isAttributeFlag(long mask)
Returns true if the indicate mask is non-zero


setUseSSL

public void setUseSSL(boolean useSSL)
Sets whether to use SSL on TCP connections


getUseSSL

public boolean getUseSSL()
Gets whether to use SSL on TCP connections


setTcpPorts

public void setTcpPorts(java.net.InetAddress bindAddr,
                        int[] tcp,
                        boolean checkRTP)
Sets the default TCP port for this server


getTcpPortBindAddress

public java.net.InetAddress getTcpPortBindAddress(int port)
Get TCP Port bind address


getTcpPorts

public int[] getTcpPorts()
Gets the default TCP port for this server


createServerSocketThread_TCP

public ServerSocketThread createServerSocketThread_TCP(int port)
                                                throws java.net.SocketException,
                                                       java.io.IOException
Create TCP ServerSocketThread

Throws:
java.net.SocketException
java.io.IOException

createServerSocketThread_TCP

public ServerSocketThread createServerSocketThread_TCP(int port,
                                                       boolean useSSL)
                                                throws java.net.SocketException,
                                                       java.io.IOException
Create TCP ServerSocketThread

Throws:
java.net.SocketException
java.io.IOException

setUdpPorts

public void setUdpPorts(java.net.InetAddress bindAddr,
                        int[] udp,
                        boolean checkRTP)
Sets the default UDP port for this server


getUdpPortBindAddress

public java.net.InetAddress getUdpPortBindAddress(int port)
Get UDP Port bind address


getUdpPorts

public int[] getUdpPorts()
Gets the default UDP port for this server


createServerSocketThread_UDP

public ServerSocketThread createServerSocketThread_UDP(int port)
                                                throws java.net.SocketException,
                                                       java.io.IOException
Create UDP ServerSocketThread

Throws:
java.net.SocketException
java.io.IOException

startCommandHandler

public static ServerSocketThread startCommandHandler(int port,
                                                     java.lang.Class handler)
                                              throws java.lang.Throwable
Start Command Listener

Parameters:
port - The listen port
handler - The command handler class
Throws:
java.lang.Throwable

startServerSocketThread

public static void startServerSocketThread(ServerSocketThread sst,
                                           java.lang.String type)
Start ServerSocketThread

Parameters:
sst - The ServerSocketThread to start
type - The short 'type' name of the socket listener

getListenPorts

public int[] getListenPorts()
Returns an array of all TCP/UDP 'listen' ports

Returns:
An array of all TCP/UDP 'listen' ports

loadDeviceUniqueID

public Device loadDeviceUniqueID(java.lang.String modemID)
Load device record from unique-id (not yet used/tested)

Parameters:
modemID - The unique modem ID (IMEI, ESN, etc)
Returns:
The Device record

serverJarExists

public boolean serverJarExists()
Returns true if the named server is defined


isJarOptional

public boolean isJarOptional()
Returns true if this DCS requires a Jar file


setCommandProtocol

public void setCommandProtocol(java.lang.String proto)
Sets the command protocol to use when communicating with remote devices

Parameters:
proto - The CommandProtocol

setCommandProtocol

public void setCommandProtocol(DCServerConfig.CommandProtocol proto)
Sets the command protocol to use when communicating with remote devices

Parameters:
proto - The CommandProtocol

getCommandProtocol

public DCServerConfig.CommandProtocol getCommandProtocol()
Gets the command protocol to use when communicating with remote devices

Returns:
The Command Protocol

getClientCommandPort_udp

public int getClientCommandPort_udp(int dft)
Gets the "Client Command Port"

Parameters:
dft - The default Client Command Port
Returns:
The Client Command Port

getClientCommandPort_tcp

public int getClientCommandPort_tcp(int dft)
Gets the "Client Command Port"

Parameters:
dft - The default Client Command Port
Returns:
The Client Command Port

getAckResponsePort

public int getAckResponsePort(int dft)
Gets the "ACK Response Port"

Parameters:
dft - The ACK response port
Returns:
The ack response port

getAckResponsePort

public static int getAckResponsePort(DCServerConfig dcsc,
                                     int dft)
Gets the "ACK Response Port"

Parameters:
dcsc - The DCServerConfig instance
dft - The ACK response port
Returns:
The ack response port

getTcpIdleTimeoutMS

public long getTcpIdleTimeoutMS(long dft)
Gets the "TCP idle timeout"

Parameters:
dft - The default timeout value
Returns:
The default timeout value

getTcpPacketTimeoutMS

public long getTcpPacketTimeoutMS(long dft)
Gets the "TCP packet timeout"

Parameters:
dft - The default timeout value
Returns:
The default timeout value

getTcpSessionTimeoutMS

public long getTcpSessionTimeoutMS(long dft)
Gets the "TCP session timeout"

Parameters:
dft - The default timeout value
Returns:
The default timeout value

getUdpIdleTimeoutMS

public long getUdpIdleTimeoutMS(long dft)
Gets the "UDP idle timeout"

Parameters:
dft - The default timeout value
Returns:
The default timeout value

getUdpPacketTimeoutMS

public long getUdpPacketTimeoutMS(long dft)
Gets the "UDP packet timeout"

Parameters:
dft - The default timeout value
Returns:
The default timeout value

getUdpSessionTimeoutMS

public long getUdpSessionTimeoutMS(long dft)
Gets the "UDP session timeout"

Parameters:
dft - The default timeout value
Returns:
The default timeout value

getUniquePrefix

public java.lang.String[] getUniquePrefix(java.lang.String[] dftPfx)
Gets the array of allowed UniqueID prefixes

Parameters:
dftPfx - The default list of prefixes
Returns:
The array of allowed UniqueID prefixes

getUniquePrefix

public java.lang.String[] getUniquePrefix()
Gets the array of allowed UniqueID prefixes

Returns:
The array of allowed UniqueID prefixes

setUniquePrefix

public void setUniquePrefix(java.lang.String[] pfx)
Sets the array of allowed UniqueID prefixes

Parameters:
pfx - The default UniqueID prefixes

getMinimumMovedMeters

public double getMinimumMovedMeters(double dft)
Gets the "Minimum Moved Meters"

Parameters:
dft - The default minimum distance
Returns:
The Minimum Moved Meters

getMinimumMovedMeters

public static double getMinimumMovedMeters(DCServerConfig dcsc,
                                           double dft)
Gets the "Minimum Moved Meters"

Parameters:
dcsc - The DCServerConfig instance
dft - The default minimum distance
Returns:
The Minimum Moved Meters

getMinimumSpeedKPH

public double getMinimumSpeedKPH(double dft)
Gets the "Minimum Speed KPH"

Parameters:
dft - The default minimum speed
Returns:
The Minimum Speed KPH

getMinimumSpeedKPH

public static double getMinimumSpeedKPH(DCServerConfig dcsc,
                                        double dft)
Gets the "Minimum Speed KPH"

Parameters:
dcsc - The DCServerConfig instance
dft - The default minimum speed
Returns:
The Minimum Speed KPH

getEstimateOdometer

public boolean getEstimateOdometer(boolean dft)
Gets the "Estimate Odometer" flag

Parameters:
dft - The default estimate odometer flag
Returns:
The Estimate Odometer flag

getEstimateOdometer

public static boolean getEstimateOdometer(DCServerConfig dcsc,
                                          boolean dft)
Gets the "Estimate Odometer" flag

Parameters:
dcsc - The DCServerConfig instance
dft - The default estimate odometer flag
Returns:
The Estimate Odometer flag

getIgnoreDeviceOdometer

public boolean getIgnoreDeviceOdometer(boolean dft)
Gets the "Ignore Device Odometer" flag

Parameters:
dft - The default ignore device odometer flag
Returns:
The Ignore Device Odometer flag

getIgnoreDeviceOdometer

public static boolean getIgnoreDeviceOdometer(DCServerConfig dcsc,
                                              boolean dft)
Gets the "Ignore Device Odometer" flag

Parameters:
dcsc - The DCServerConfig instance
dft - The default ignore device odometer flag
Returns:
The ignore device Odometer flag

getSimulateGeozones

public boolean getSimulateGeozones(boolean dft)
Gets the "Simulate Geozones"

Parameters:
dft - The default Simulate Geozones state
Returns:
The Simulate Geozones

getSimulateGeozones

public static boolean getSimulateGeozones(DCServerConfig dcsc,
                                          boolean dft)
Gets the "Simulate Geozones"

Parameters:
dcsc - The DCServerConfig instance
dft - The default Simulate Geozones state
Returns:
The Simulate Geozones

getMaximumHDOP

public double getMaximumHDOP(double dft)
Gets the "Maximum HDOP"

Parameters:
dft - The default maximum HDOP
Returns:
The Maximum HDOP

getMaximumHDOP

public static double getMaximumHDOP(DCServerConfig dcsc,
                                    double dft)
Gets the "Maximum HDOP"

Parameters:
dcsc - The DCServerConfig instance
dft - The default maximum HDOP
Returns:
The Maximum HDOP

getSaveRawDataPackets

public boolean getSaveRawDataPackets(boolean dft)
Gets the "Save Raw Data Packet" config

Parameters:
dft - The default "Save Raw Data Packet" state
Returns:
The "Save Raw Data Packet" state

getSaveRawDataPackets

public static boolean getSaveRawDataPackets(DCServerConfig dcsc,
                                            boolean dft)
Gets the "Save Raw Data Packet" config

Parameters:
dcsc - The DCServerConfig instance
dft - The default "Save Raw Data Packet" state
Returns:
The "Save Raw Data Packet" state

getStartStopSupported

public boolean getStartStopSupported(boolean dft)
Gets the "Start/Stop StatusCode supported" config

Parameters:
dft - The default "Start/Stop StatusCode supported" state
Returns:
The "Start/Stop StatusCode supported" state

getStartStopSupported

public static boolean getStartStopSupported(DCServerConfig dcsc,
                                            boolean dft)
Gets the "Start/Stop StatusCode supported" config

Parameters:
dcsc - The DCServerConfig instance
dft - The default "Start/Stop StatusCode supported" state
Returns:
The "Start/Stop StatusCode supported" state

getStatusLocationInMotion

public boolean getStatusLocationInMotion(boolean dft)
Gets the "Status Location/InMotion Translation" config

Parameters:
dft - The default "Status Location/InMotion Translation" state
Returns:
The "Status Location/InMotion Translation" state

getStatusLocationInMotion

public static boolean getStatusLocationInMotion(DCServerConfig dcsc,
                                                boolean dft)
Gets the "Status Location/InMotion Translation" config

Parameters:
dcsc - The DCServerConfig instance
dft - The default "Status Location/InMotion Translation" state
Returns:
The "Status Location/InMotion Translation" state

getIgnoreInvalidGPSFlag

public boolean getIgnoreInvalidGPSFlag(boolean dft)
Gets the "Ignore Invalid GPS Location Flag" config

Parameters:
dft - The default "Ignore Invalid GPS Location Flag" state
Returns:
The "Ignore Invalid GPS Location Flag" state

getIgnoreInvalidGPSFlag

public static boolean getIgnoreInvalidGPSFlag(DCServerConfig dcsc,
                                              boolean dft)
Gets the "Ignore Invalid GPS Location Flag" config

Parameters:
dcsc - The DCServerConfig instance
dft - The default "Ignore Invalid GPS Location Flag" state
Returns:
The "Ignore Invalid GPS Location Flag" state

getUseLastValidGPSLocation

public boolean getUseLastValidGPSLocation(boolean dft)
Gets the "Use Last Valid GPS Location" config

Parameters:
dft - The default "Use Last Valid GPS Location" state
Returns:
The "Use Last Valid GPS Location" state

getUseLastValidGPSLocation

public static boolean getUseLastValidGPSLocation(DCServerConfig dcsc,
                                                 boolean dft)
Gets the "Use Last Valid GPS Location" config

Parameters:
dcsc - The DCServerConfig instance
dft - The default "Use Last Valid GPS Location" state
Returns:
The "Use Last Valid GPS Location" state

getSaveSessionStatistics

public boolean getSaveSessionStatistics(boolean dft)
Gets the "Save Session Statistics" config

Parameters:
dft - The default "Save Session Statistics" state
Returns:
The "Save Session Statistics" state

getSaveSessionStatistics

public static boolean getSaveSessionStatistics(DCServerConfig dcsc,
                                               boolean dft)
Gets the "Save Session Statistics" config

Parameters:
dcsc - The DCServerConfig instance
dft - The default "Save Session Statistics" state
Returns:
The "Save Session Statistics" state

getBatteryLevelRange

public double[] getBatteryLevelRange(double[] dft)
Gets the "Battery Level Range" config

Parameters:
dft - The default "Battery Level Range" min/max values
Returns:
The "Battery Level Range" min/max values

getBatteryLevelRange

public static double[] getBatteryLevelRange(DCServerConfig dcsc,
                                            double[] dft)
Gets the "Battery Level Range" config

Parameters:
dcsc - The DCServerConfig instance
dft - The default "Battery Level Range" min/max values
Returns:
The "Battery Level Range" min/max values

CalculateBatteryLevel

public static double CalculateBatteryLevel(double voltage,
                                           double[] range)
Calculates/returns the battery level based on the specified voltage range

Parameters:
voltage - The current battery voltage
range - The allowed voltage range
Returns:
The battery level percent

getSimulateDigitalInputs

public long getSimulateDigitalInputs(long dft)
Gets the "Simulate Geozones" mask

Parameters:
dft - The default Simulate Geozones mask
Returns:
The Simulate Geozones mask

getSimulateDigitalInputs

public static long getSimulateDigitalInputs(DCServerConfig dcsc,
                                            long dft)
Gets the "Simulate Geozones" mask

Parameters:
dcsc - The DCServerConfig instance
dft - The default Simulate Geozones mask
Returns:
The Simulate Geozones mask

hasDigitalInputs

public boolean hasDigitalInputs()
Returns true if this device supports digital inputs

Returns:
True if this device supports digital inputs

hasDigitalOutputs

public boolean hasDigitalOutputs()
Returns true if this device supports digital outputs

Returns:
True if this device supports digital outputs

convertToBytes

public static byte[] convertToBytes(java.lang.String s)
Convenience for converting the initial/final packet to a byte array. If the string begins with "0x" the the remain string is assumed to be hex

Returns:
The byte array

getInitialPacket

public byte[] getInitialPacket(byte[] dft)
Gets the "Initial Packet" byte array

Parameters:
dft - The default "Initial Packet" byte array
Returns:
The "Initial Packet" byte array

getFinalPacket

public byte[] getFinalPacket(byte[] dft)
Gets the "Final Packet" byte array

Parameters:
dft - The default "Final Packet" byte array
Returns:
The "Final Packet" byte array

setEventCodeEnabled

public void setEventCodeEnabled(boolean enabled)
Sets the "Event Code Map Enable" config

Parameters:
enabled - The "Event Code Map Enable" state

getEventCodeEnabled

public boolean getEventCodeEnabled()
Gets the "Event Code Map Enable" config

Returns:
The "Event Code Map Enable" state

setEventCodeMap

public void setEventCodeMap(java.util.Map<java.lang.Object,DCServerConfig.EventCode> codeMap)

getEventCode

public DCServerConfig.EventCode getEventCode(int code)
Returns the EventCode instance for the specified code

Parameters:
code - The code
Returns:
The EventCode

getEventCode

public DCServerConfig.EventCode getEventCode(long code)
Returns the EventCode instance for the specified code

Parameters:
code - The code
Returns:
The EventCode

getEventCode

public DCServerConfig.EventCode getEventCode(java.lang.String code)
Returns the EventCode instance for the specified code

Parameters:
code - The code
Returns:
The EventCode

translateStatusCode

public int translateStatusCode(int code,
                               int dftStatusCode)
Translates the specified device status code into a GTS status code

Parameters:
code - The code to translate
dftStatusCode - The default code returned if no translation is defined
Returns:
The translated GTS status code

translateStatusCode

public int translateStatusCode(java.lang.String code,
                               int dftStatusCode)
Translates the specified device status code into a GTS status code

Parameters:
code - The code to translate
dftStatusCode - The default code returned if no translation is defined
Returns:
The translated GTS status code

setCommandDispatcherHost

public void setCommandDispatcherHost(java.lang.String cmdHost)
Sets the device command listen host (may be null to use default bind-address)

Parameters:
cmdHost - The device command listen host

getCommandDispatcherHost

public java.lang.String getCommandDispatcherHost()
Gets the device command listen host

Returns:
The device command listen host

setCommandDispatcherPort

public void setCommandDispatcherPort(int cmdPort,
                                     boolean checkRTP)
Sets the device command listen port

Parameters:
cmdPort - The device command listen port
checkRTP - True to allow the RTConfig propertiesto override this value

setCommandDispatcherPort

public void setCommandDispatcherPort(int cmdPort)
Sets the device command listen port

Parameters:
cmdPort - The device command listen port

getCommandDispatcherPort

public int getCommandDispatcherPort()
Gets the device command listen port (returns '0' if not supported)

Returns:
The device command listen port

setCommandsAclName

public void setCommandsAclName(java.lang.String aclName,
                               AclEntry.AccessLevel dft)
Sets the Commands Acl name

Parameters:
aclName - The Commands Acl name

getCommandsAclName

public java.lang.String getCommandsAclName()
Gets the Commands Acl name

Returns:
The Commands Acl name

getCommandsAccessLevelDefault

public AclEntry.AccessLevel getCommandsAccessLevelDefault()
Gets the Commands Acl AccessLevel default

Returns:
The Commands Acl AccessLevel default

userHasAccessToCommand

public boolean userHasAccessToCommand(BasicPrivateLabel privLabel,
                                      User user,
                                      java.lang.String commandName)
Returns True if the specified user has access to the named command


addCommand

public void addCommand(java.lang.String cmdName,
                       java.lang.String cmdDesc,
                       java.lang.String[] cmdTypes,
                       java.lang.String cmdAclName,
                       AclEntry.AccessLevel cmdAclDft,
                       java.lang.String cmdString,
                       boolean hasArgs,
                       java.util.Collection<DCServerConfig.CommandArg> cmdArgList,
                       java.lang.String cmdProto,
                       boolean expectAck,
                       int cmdSCode)

getCommand

public DCServerConfig.Command getCommand(java.lang.String name)

getCommandList

public java.lang.String[] getCommandList()
Gets the "Command List"

Returns:
The "Command List"

getCommandDescription

public java.lang.String getCommandDescription(java.lang.String cmdName,
                                              java.lang.String dft)
Gets the "Command Description" for the specified command

Parameters:
dft - The default "Command Description"
Returns:
The "Command Description" for the specified command

getCommandString

public java.lang.String getCommandString(java.lang.String cmdName,
                                         java.lang.String dft)
Gets the "Command String" for the specified command

Parameters:
dft - The default "Command String"
Returns:
The "Command String" for the specified command

getCommandStatusCode

public int getCommandStatusCode(java.lang.String cmdName,
                                int code)
Gets the status-code for the specified command. An event with this status code will be inserted into the EventData table when this command is sent to the device.

Parameters:
code - The default status-code
Returns:
The status-code for the specified command

getCommandMap

public java.util.Map<java.lang.String,DCServerConfig.Command> getCommandMap(BasicPrivateLabel privLabel,
                                                                            User user,
                                                                            java.lang.String type)
Gets the command's (name,description) map

Parameters:
type - The description type
Returns:
The command's (name,description) map

getCommandDescriptionMap

public java.util.Map<java.lang.String,java.lang.String> getCommandDescriptionMap(BasicPrivateLabel privLabel,
                                                                                 User user,
                                                                                 java.lang.String type)
Gets the command's (name,description) map

Parameters:
type - The description type
Returns:
The command's (name,description) map

getDefaultProperties

public RTProperties getDefaultProperties()

getPropertyGroupNames

public java.util.Set<java.lang.String> getPropertyGroupNames()

getProperties

public RTProperties getProperties(java.lang.String propID)

getProperties

public RTProperties getProperties(java.lang.String propID,
                                  boolean createNewGroup)

normalizeKey

public java.lang.String normalizeKey(java.lang.String key)
Prepend DCS name to key


normalizeKeys

public java.lang.String[] normalizeKeys(java.lang.String[] key)
Prepend DCS name to keys


hasProperty

public boolean hasProperty(java.lang.String[] key,
                           boolean inclDft)

getPropertyKeys

public java.util.Set<java.lang.String> getPropertyKeys(java.lang.String prefix)

getStringArrayProperty

public java.lang.String[] getStringArrayProperty(java.lang.String key,
                                                 java.lang.String[] dft)

getStringArrayProperty

public java.lang.String[] getStringArrayProperty(java.lang.String[] key,
                                                 java.lang.String[] dft)

getStringProperty

public java.lang.String getStringProperty(java.lang.String key,
                                          java.lang.String dft)

getStringProperty

public java.lang.String getStringProperty(java.lang.String[] key,
                                          java.lang.String dft)

getIntProperty

public int getIntProperty(java.lang.String key,
                          int dft)

getIntProperty

public int getIntProperty(java.lang.String[] key,
                          int dft)

getLongProperty

public long getLongProperty(java.lang.String key,
                            long dft)

getLongProperty

public long getLongProperty(java.lang.String[] key,
                            long dft)

getDoubleProperty

public double getDoubleProperty(java.lang.String key,
                                double dft)

getDoubleProperty

public double getDoubleProperty(java.lang.String[] key,
                                double dft)

getBooleanProperty

public boolean getBooleanProperty(java.lang.String key,
                                  boolean dft)

getBooleanProperty

public boolean getBooleanProperty(java.lang.String[] key,
                                  boolean dft)

getDigitalInputState

public boolean getDigitalInputState(long mask,
                                    int bit)
Returns the state of the indicated bit within the mask for this device type.

Parameters:
mask - The input mask from the device
bit - The bit to test

equals

public boolean equals(java.lang.Object other)
Returns true if the 'other' DCServerCOnfig is equal to this DCServerConfig based on the name.

Overrides:
equals in class java.lang.Object
Parameters:
other - The other DCServerConfig instance.
Returns:
True if the other DCServerConfig as the same name as this DCServerConfig

compareTo

public int compareTo(java.lang.Object other)
Compares another DCServerConfig instance to this instance.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
other - The other DCServerConfig instance.
Returns:
'compareTo' operator on DCServerConfig names.

hashCode

public int hashCode()
Return hashCode based on the DCServerConfig name

Overrides:
hashCode in class java.lang.Object
Returns:
this.getNmae().hashCoe()

toString

public java.lang.String toString()
Returns a String representation of this instance

Overrides:
toString in class java.lang.Object
Returns:
A String representation

toString

public java.lang.String toString(boolean inclName)
Returns a String representation of this instance

Parameters:
inclName - True to include the name in the returnsed String representation
Returns:
A String representation

getPortsString

public java.lang.StringBuffer getPortsString(java.lang.StringBuffer sb)

getPortsString

public java.lang.String getPortsString()

getRunningJarPath

public java.io.File[] getRunningJarPath()
Return running jar file path