com.eurotech.framework.protocol.pcn
Class Pcn1001MasterConfig

java.lang.Object
  extended by com.eurotech.framework.protocol.pcn.Pcn1001MasterConfig

public class Pcn1001MasterConfig
extends Object

Defines PCN-1001 Master configuration class.

Author:
ilya.binshtok

Field Summary
static int DFLT_BAUD_RATE
           
static int DFLT_DATA_BITS
           
static boolean DFLT_INIT_COUNT_ENABLE
           
static boolean DFLT_INIT_COUNT_RESET
           
static boolean DFLT_INIT_DIAGNOSTICS_ENABLE
           
static boolean DFLT_INIT_SET_DATETIME
           
static int DFLT_INOUT_POLL_RATE_FAST
           
static int DFLT_INOUT_POLL_RATE_SLOW
           
static int DFLT_INPUT0_FUNCTION
           
static int DFLT_INPUT1_FUNCTION
           
static String DFLT_IP_ADDRESS
           
static int DFLT_LED_INTENSITY
           
static boolean DFLT_LED_PROPS_ENABLE
           
static int DFLT_NUM_COMM_RETRIES
           
static int DFLT_NUM_RETRIES
           
static int DFLT_OUTPUT0_OPEN_TIME
           
static int DFLT_OUTPUT1_OPEN_TIME
           
static int DFLT_PARITY
           
static String DFLT_PRODUCT_ID
           
static int DFLT_SERIAL_MODE
           
static int DFLT_SNP_CMD_TOUT
           
static int DFLT_SNP_MASTER_ADDR
           
static int DFLT_SNP_POLL_TOUT
           
static int DFLT_SNP_SLAVE_ADDR
           
static int DFLT_STOP_BITS
           
static boolean DFLT_USE_AUTOLED
           
static String DFLT_VENDOR_ID
           
static boolean DFLT_VERIFY_FUNCTIONALITY
           
static boolean DFLT_VERIFY_RESET
           
static String INVALID_PRODUCT_ID
           
static String INVALID_VENDOR_ID
           
 
Constructor Summary
Pcn1001MasterConfig()
          Pcn1001MasterConfig default constructor.
Pcn1001MasterConfig(int[] pcn1001SnpAddresses, int commBaudRate, int commDataBits, int commStopBits, int commParity, int commSerialMode, boolean initialCountReset, boolean initialCountEnable, boolean initialSetDateTime)
          Pcn1001MasterConfig constructor
Pcn1001MasterConfig(String serialDeviceVendorID, String serialDeviceProductID, int[] pcn1001SnpAddresses, int commBaudRate, int commDataBits, int commStopBits, int commParity, int commSerialMode, boolean initialCountReset, boolean initialCountEnable, boolean initialSetDateTime)
          Pcn1001MasterConfig constructor
 
Method Summary
 int getCommBaudRate()
          Reports baud rate.
 int getCommDataBits()
          Reports number of data bits.
 int getCommParity()
          Reports parity.
 int getCommSerialMode()
          Reports serial mode (type of flow control).
 int getCommStopBits()
          Reports number of stop bits.
 Hashtable getHtPcn1001Config()
           
 int getInOutPollRateFast()
          Reports fast IN/OUT poll rate.
 int getInOutPollRateSlow()
          Reports slow IN/OUT poll rate.
 int getInput0Function()
          Reports input0 function.
 int getInput1Function()
          Reports input1 function.
 int getNumCommRetries()
          Reports number of communication retries.
 int getOutput0OpenTime()
          Reports output0 open time in milliseconds.
 int getOutput1OpenTime()
          Reports output1 open time in milliseconds.
 int[] getPcn1001SnpAddresses()
          Reports an array of SNP addresses of the passenger counters attached.
 String getSerialDeviceProductID()
          Reports serial device product ID
 String getSerialDeviceVendorID()
          Reports serial device vendor ID
 String getSerialPortName()
          Reports serial port name.
 boolean isInitialCountEnable()
          Reports if counting needs to be enabled on startup.
 boolean isInitialCountReset()
          Reports if IN/OUT counters need to be reset on startup.
 boolean isInitialDiagnosticsEnable()
          Reports if diagnostics need to be enabled on startup.
 boolean isInitialSetDateTime()
          Reports if system date and time needs to be set at startup.
 boolean isLedPropsEnabled()
          Reports if led-related properties are enabled.
 boolean isUseAutoLed()
          Reports if 'autoled' functionality is enabled.
 boolean isVerifyFunctionality()
          Reports if PCN-1001 functionality needs to be verified with SNP poll.
 boolean isVerifyReset()
          Reports if IN/OUT count reset needs to be verified with 'gcounters' command.
 void setCommBaudRate(int commBaudRate)
          Sets baud rate.
 void setCommDataBits(int commDataBits)
          Sets number of data bits.
 void setCommParity(int commParity)
          Sets parity.
 void setCommSerialMode(int commSerialMode)
          Sets serial mode (type of flow control)
 void setCommStopBits(int commStopBits)
          Sets number of stop bits.
 void setHtPcn1001Config(Hashtable htPcn1001Config)
           
 void setInitialCountEnable(boolean initialCountEnable)
          Sets the InitialCountEnable flag.
 void setInitialCountReset(boolean initialCountReset)
          Sets InitialCountReset flag
 void setInitialDiagnosticsEnable(boolean initialDiagnosticsEnable)
          Sets the InitialDiagnosticsEnable flag.
 void setInitialSetDateTime(boolean initialSetDateTime)
          Sets the initialSetDateTime flag.
 void setInOutPollRateFast(int inOutPollRateFast)
          Sets fast IN/OUT poll rate.
 void setInOutPollRateSlow(int inOutPollRateSlow)
          Sets slow IN/OUT poll rate.
 void setInput0Function(int input0Function)
          Sets input0 function.
 void setInput1Function(int input1Function)
          Sets input1 function.
 void setLedPropsEnable(boolean ledPropsEnable)
          Sets the value of led-related properties flag.
 void setNumCommRetries(int numCommRetries)
          Sets number of communication retries.
 void setOutput0OpenTime(int output0OpenTime)
          Sets output0 open time.
 void setOutput1OpenTime(int output1OpenTime)
          Sets output1 open time.
 void setPcn1001SnpAddresses(int[] pcn1001SnpAddresses)
          Sets an array of SNP addresses of the passenger
 void setSerialDeviceProductID(String serialDeviceProductID)
          Sets serial device product ID
 void setSerialDeviceVendorID(String serialDeviceVendorID)
          Sets serial device vendor ID
 void setSerialPortName(String serialPortName)
          Set the serial port name.
 void setUseAutoLed(boolean useAutoLed)
          Sets the value of 'autoled' flag.
 void setVerifyFunctionality(boolean verifyFunctionality)
          Set the 'verify functionality' flag.
 void setVerifyReset(boolean verifyReset)
          Sets 'verify reset' flag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DFLT_SNP_POLL_TOUT

public static final int DFLT_SNP_POLL_TOUT
See Also:
Constant Field Values

DFLT_SNP_CMD_TOUT

public static final int DFLT_SNP_CMD_TOUT
See Also:
Constant Field Values

DFLT_NUM_RETRIES

public static final int DFLT_NUM_RETRIES
See Also:
Constant Field Values

DFLT_INIT_COUNT_RESET

public static final boolean DFLT_INIT_COUNT_RESET
See Also:
Constant Field Values

DFLT_INIT_COUNT_ENABLE

public static final boolean DFLT_INIT_COUNT_ENABLE
See Also:
Constant Field Values

DFLT_INIT_DIAGNOSTICS_ENABLE

public static final boolean DFLT_INIT_DIAGNOSTICS_ENABLE
See Also:
Constant Field Values

DFLT_INIT_SET_DATETIME

public static final boolean DFLT_INIT_SET_DATETIME
See Also:
Constant Field Values

DFLT_SNP_MASTER_ADDR

public static final int DFLT_SNP_MASTER_ADDR
See Also:
Constant Field Values

DFLT_SNP_SLAVE_ADDR

public static final int DFLT_SNP_SLAVE_ADDR
See Also:
Constant Field Values

DFLT_LED_PROPS_ENABLE

public static final boolean DFLT_LED_PROPS_ENABLE
See Also:
Constant Field Values

DFLT_USE_AUTOLED

public static final boolean DFLT_USE_AUTOLED
See Also:
Constant Field Values

DFLT_LED_INTENSITY

public static final int DFLT_LED_INTENSITY
See Also:
Constant Field Values

DFLT_IP_ADDRESS

public static final String DFLT_IP_ADDRESS
See Also:
Constant Field Values

DFLT_VENDOR_ID

public static final String DFLT_VENDOR_ID
See Also:
Constant Field Values

DFLT_PRODUCT_ID

public static final String DFLT_PRODUCT_ID
See Also:
Constant Field Values

INVALID_VENDOR_ID

public static final String INVALID_VENDOR_ID
See Also:
Constant Field Values

INVALID_PRODUCT_ID

public static final String INVALID_PRODUCT_ID
See Also:
Constant Field Values

DFLT_NUM_COMM_RETRIES

public static final int DFLT_NUM_COMM_RETRIES
See Also:
Constant Field Values

DFLT_BAUD_RATE

public static final int DFLT_BAUD_RATE
See Also:
Constant Field Values

DFLT_DATA_BITS

public static final int DFLT_DATA_BITS
See Also:
Constant Field Values

DFLT_STOP_BITS

public static final int DFLT_STOP_BITS
See Also:
Constant Field Values

DFLT_PARITY

public static final int DFLT_PARITY
See Also:
Constant Field Values

DFLT_SERIAL_MODE

public static final int DFLT_SERIAL_MODE
See Also:
Constant Field Values

DFLT_INOUT_POLL_RATE_FAST

public static final int DFLT_INOUT_POLL_RATE_FAST
See Also:
Constant Field Values

DFLT_INOUT_POLL_RATE_SLOW

public static final int DFLT_INOUT_POLL_RATE_SLOW
See Also:
Constant Field Values

DFLT_INPUT0_FUNCTION

public static final int DFLT_INPUT0_FUNCTION
See Also:
Constant Field Values

DFLT_INPUT1_FUNCTION

public static final int DFLT_INPUT1_FUNCTION
See Also:
Constant Field Values

DFLT_OUTPUT0_OPEN_TIME

public static final int DFLT_OUTPUT0_OPEN_TIME
See Also:
Constant Field Values

DFLT_OUTPUT1_OPEN_TIME

public static final int DFLT_OUTPUT1_OPEN_TIME
See Also:
Constant Field Values

DFLT_VERIFY_FUNCTIONALITY

public static final boolean DFLT_VERIFY_FUNCTIONALITY
See Also:
Constant Field Values

DFLT_VERIFY_RESET

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

Pcn1001MasterConfig

public Pcn1001MasterConfig()
Pcn1001MasterConfig default constructor.


Pcn1001MasterConfig

public Pcn1001MasterConfig(int[] pcn1001SnpAddresses,
                           int commBaudRate,
                           int commDataBits,
                           int commStopBits,
                           int commParity,
                           int commSerialMode,
                           boolean initialCountReset,
                           boolean initialCountEnable,
                           boolean initialSetDateTime)
Pcn1001MasterConfig constructor

Parameters:
pcn1001SnpAddresses - - SNP addresses of passenger couters attached as int[]
commBaudRate - - baud rate as int
commDataBits - - number of data bits as int
commStopBits - - number of stop bits as int
commParity - - parity as int
commSerialMode - - mode (type of flow control) as int
initialCountReset - - reset IN/OUT counters at startup as boolean
initialCountEnable - - enable counting software at startup as boolean
initialSetDateTime - - set system date and time at startup as boolean

Pcn1001MasterConfig

public Pcn1001MasterConfig(String serialDeviceVendorID,
                           String serialDeviceProductID,
                           int[] pcn1001SnpAddresses,
                           int commBaudRate,
                           int commDataBits,
                           int commStopBits,
                           int commParity,
                           int commSerialMode,
                           boolean initialCountReset,
                           boolean initialCountEnable,
                           boolean initialSetDateTime)
Pcn1001MasterConfig constructor

Parameters:
serialDeviceVendorId - - serial device vendor ID as String
serialDeviceProductId - - serial device product ID as String
pcn1001SnpAddresses - - SNP addresses of passenger couters attached as int[]
commBaudRate - - baud rate as int
commDataBits - - number of data bits as int
commStopBits - - number of stop bits as int
commParity - - parity as int
commSerialMode - - mode (type of flow control) as int
initialCountReset - - reset IN/OUT counters at startup as boolean
initialCountEnable - - enable counting software at startup as boolean
initialSetDateTime - - set system date and time at startup as boolean
Method Detail

getSerialDeviceVendorID

public String getSerialDeviceVendorID()
Reports serial device vendor ID

Returns:
vendor ID as String

setSerialDeviceVendorID

public void setSerialDeviceVendorID(String serialDeviceVendorID)
Sets serial device vendor ID

Parameters:
serialDeviceVendorID - as String

getSerialDeviceProductID

public String getSerialDeviceProductID()
Reports serial device product ID

Returns:
product ID as String

setSerialDeviceProductID

public void setSerialDeviceProductID(String serialDeviceProductID)
Sets serial device product ID

Parameters:
serialDeviceProductID - - product ID as String

getNumCommRetries

public int getNumCommRetries()
Reports number of communication retries.

Returns:
number of communication retries as int

setNumCommRetries

public void setNumCommRetries(int numCommRetries)
Sets number of communication retries.

Parameters:
numCommRetries - - number of communication retries as int

getPcn1001SnpAddresses

public int[] getPcn1001SnpAddresses()
Reports an array of SNP addresses of the passenger counters attached.

Returns:
SNP addresses as int[]

setPcn1001SnpAddresses

public void setPcn1001SnpAddresses(int[] pcn1001SnpAddresses)
Sets an array of SNP addresses of the passenger

Parameters:
pcn1001SnpAddresses - - SNP addresses as int[]

isLedPropsEnabled

public boolean isLedPropsEnabled()
Reports if led-related properties are enabled.

Returns:
boolean

setLedPropsEnable

public void setLedPropsEnable(boolean ledPropsEnable)
Sets the value of led-related properties flag.

Parameters:
ledPropsEnable - - of led-related properties flag as boolean

isUseAutoLed

public boolean isUseAutoLed()
Reports if 'autoled' functionality is enabled.

Returns:
boolean

setUseAutoLed

public void setUseAutoLed(boolean useAutoLed)
Sets the value of 'autoled' flag.

Parameters:
useAutoLed - - value of 'autoled' flag as boolean

getHtPcn1001Config

public Hashtable getHtPcn1001Config()
Returns:

setHtPcn1001Config

public void setHtPcn1001Config(Hashtable htPcn1001Config)
Parameters:
htPcn1001Config -

getSerialPortName

public String getSerialPortName()
Reports serial port name.

Returns:
serial port name as String

setSerialPortName

public void setSerialPortName(String serialPortName)
Set the serial port name.

Parameters:
serialPortName - - serial port name as String. The name is OS dependent (e.g. "COM1" under Windows, "/dev/ttyS0" under Linux).

getCommBaudRate

public int getCommBaudRate()
Reports baud rate.

Returns:
baud rate as int

setCommBaudRate

public void setCommBaudRate(int commBaudRate)
Sets baud rate.

Parameters:
commBaudRate - - baud rate as int

getCommDataBits

public int getCommDataBits()
Reports number of data bits.

Returns:
number of data bits as int

setCommDataBits

public void setCommDataBits(int commDataBits)
Sets number of data bits.

Parameters:
commDataBits - - number of data bits as int

getCommStopBits

public int getCommStopBits()
Reports number of stop bits.

Returns:
number of stop bits as int

setCommStopBits

public void setCommStopBits(int commStopBits)
Sets number of stop bits.

Parameters:
commStopBits - - number of stop bits as int

getCommParity

public int getCommParity()
Reports parity.

Returns:
parity as int

setCommParity

public void setCommParity(int commParity)
Sets parity.

Parameters:
commParity - - parity as int

getCommSerialMode

public int getCommSerialMode()
Reports serial mode (type of flow control).

Returns:
serial mode as int

setCommSerialMode

public void setCommSerialMode(int commSerialMode)
Sets serial mode (type of flow control)

Parameters:
commSerialMode - - serial mode as int

getInOutPollRateFast

public int getInOutPollRateFast()
Reports fast IN/OUT poll rate.

Returns:
fast IN/OUT poll rate in msec as int

setInOutPollRateFast

public void setInOutPollRateFast(int inOutPollRateFast)
Sets fast IN/OUT poll rate.

Parameters:
inOutPollRateFast - - fast IN/OUT poll rate in msec as int

getInOutPollRateSlow

public int getInOutPollRateSlow()
Reports slow IN/OUT poll rate.

Returns:
- slow IN/OUT poll rate in msec as int

setInOutPollRateSlow

public void setInOutPollRateSlow(int inOutPollRateSlow)
Sets slow IN/OUT poll rate.

Parameters:
inOutPollRateSlow - - slow IN/OUT poll rate in msec as int

isInitialCountReset

public boolean isInitialCountReset()
Reports if IN/OUT counters need to be reset on startup.

Returns:
boolean

setInitialCountReset

public void setInitialCountReset(boolean initialCountReset)
Sets InitialCountReset flag

Parameters:
initialCountReset - - StartupCountReset flag as boolean

isInitialCountEnable

public boolean isInitialCountEnable()
Reports if counting needs to be enabled on startup.

Returns:
boolean

setInitialCountEnable

public void setInitialCountEnable(boolean initialCountEnable)
Sets the InitialCountEnable flag.

Parameters:
initialCountEnable - - InitialCountEnable flag as boolean

isInitialDiagnosticsEnable

public boolean isInitialDiagnosticsEnable()
Reports if diagnostics need to be enabled on startup.

Returns:
boolean

setInitialDiagnosticsEnable

public void setInitialDiagnosticsEnable(boolean initialDiagnosticsEnable)
Sets the InitialDiagnosticsEnable flag.

Parameters:
initialDiagnosticsEnable - - InitialDiagnosticsEnable flag as boolean

isInitialSetDateTime

public boolean isInitialSetDateTime()
Reports if system date and time needs to be set at startup.

Returns:
boolean

setInitialSetDateTime

public void setInitialSetDateTime(boolean initialSetDateTime)
Sets the initialSetDateTime flag.

Parameters:
initialSetDateTime - - 'set date and time' flag as boolean

getInput0Function

public int getInput0Function()
Reports input0 function. 0 (OPTOINP_DISABLED_OPCODE) - disabled 1 (OPTOINP_CNT_RESET_OPCODE) - reset IN/OUT counters 2 (OPTOINP_CNT_ENABLE_DISABLE_OPCODE) - enable/disable counters

Returns:
input0 function as int

setInput0Function

public void setInput0Function(int input0Function)
Sets input0 function.

Parameters:
input0Function - - input0 function as int

getInput1Function

public int getInput1Function()
Reports input1 function. 0 (OPTOINP_DISABLED_OPCODE) - disabled 1 (OPTOINP_CNT_RESET_OPCODE) - reset IN/OUT counters 2 (OPTOINP_CNT_ENABLE_DISABLE_OPCODE) - enable/disable counters

Returns:
input0 function as int

setInput1Function

public void setInput1Function(int input1Function)
Sets input1 function.

Parameters:
input1Function - - input1 function as int

getOutput0OpenTime

public int getOutput0OpenTime()
Reports output0 open time in milliseconds.

Returns:
output0 open time as int

setOutput0OpenTime

public void setOutput0OpenTime(int output0OpenTime)
Sets output0 open time. This value must be a multiple of 4 and included in the range between 8 and 1020. If left at its default value of 0, it isn't going to be set. If supplied value isn't multiple of 4, it is set to the nearest low multiple.

Parameters:
output0OpenTime - - output0 open time as int

getOutput1OpenTime

public int getOutput1OpenTime()
Reports output1 open time in milliseconds.

Returns:
output1 open time as int

setOutput1OpenTime

public void setOutput1OpenTime(int output1OpenTime)
Sets output1 open time. This value must be a multiple of 4 and included in the range between 8 and 1020. If left at its default value of 0, it isn't going to be set. If supplied value isn't multiple of 4, it is set to the nearest low multiple.

Parameters:
output1OpenTime - - output1 open time as int

isVerifyFunctionality

public boolean isVerifyFunctionality()
Reports if PCN-1001 functionality needs to be verified with SNP poll.

Returns:
boolean

setVerifyFunctionality

public void setVerifyFunctionality(boolean verifyFunctionality)
Set the 'verify functionality' flag.

Parameters:
verifyFunctionality - - 'verify functionality' flag as boolean

isVerifyReset

public boolean isVerifyReset()
Reports if IN/OUT count reset needs to be verified with 'gcounters' command.

Returns:
boolean

setVerifyReset

public void setVerifyReset(boolean verifyReset)
Sets 'verify reset' flag.

Parameters:
verifyReset - - 'verify reset' flag as boolean


Copyright © 2013. All Rights Reserved.