com.eurotech.framework.protocol.pcn
Class Pcn1001

java.lang.Object
  extended by com.eurotech.framework.protocol.pcn.Pcn1001
All Implemented Interfaces:
Pcn1001AddressInfoService, Pcn1001CountInfoService, Pcn1001DateAndTimeService, Pcn1001InfoService, Pcn1001InputLineInfoService, Pcn1001Service, Pcn1001VersionInfoService

public class Pcn1001
extends Object
implements Pcn1001Service

Defines Pcn1001 - passenger counter class.

Author:
ilya.binshtok

Field Summary
 
Fields inherited from interface com.eurotech.framework.protocol.pcn.Pcn1001Service
DFLT_NUM_RETRIES, DFLT_SNP_CMD_TOUT, DFLT_SNP_POLL_TOUT, DISABLE_AUTOLED_OPCODE, DISABLE_COUNTING_OPCODE, DISABLE_DIAGNOSTICS_OPCODE, ENABLE_AUTOLED_OPCODE, ENABLE_COUNTING_OPCODE, ENABLE_DIAGNOSTICS_OPCODE, htCommSerialMode, htEnableDisableAutoLed, htEnableDisableCounting, htEnableDisableDiagnostics, htOptInFunction, OPTINP_CNT_ENABLE_DISABLE_OPCODE, OPTINP_CNT_RESET_OPCODE, OPTINP_DISABLED_OPCODE, OPTINP0, OPTINP1, OPTOUT_MAX_VALUE, OPTOUT_MIN_VALUE, OPTOUT0, OPTOUT1, SERVICE_NAME
 
Constructor Summary
Pcn1001(int snpAddress, Pcn1001SnpChannelService snpChannelService)
          Pcn1001 constructor
Pcn1001(Pcn1001AddressInfoService addressInfoService)
          Pcn1001 - copy constructor.
Pcn1001(Pcn1001CountInfoService countInfoService)
          Pcn1001 - copy constructor.
Pcn1001(Pcn1001InfoService infoService)
          Pcn1001 - copy constructor.
Pcn1001(Pcn1001VersionInfoService versionInfoService)
          Pcn1001 - copy constructor.
 
Method Summary
 void clearReplyErrors()
          Clears the number of reply errors and communication errors
 void enableDisableAutoLed(byte opcode)
           
 void enableDisableCounting(byte opcode)
          Enables/disables counting.
 void enableDisableDiagnostics(byte opcode)
          Enables/disables diagnostics.
 long getCommunicationErrors()
          Reports the number of communication errors.
 Calendar getDateAndTime()
          Reports date and time
 int getDiagnosticStatus()
          Reports the diagnostic status.
 String getFpgaFirmwareVersion()
          Reports PCN-1001 FPGA firmware version.
 String getImgServerVersion()
          Reports PCN-1001 counting software version.
 int getInCount()
          Reports current value of IN counter.
 String getKernelVersion()
          Reports PCN-1001 kernel version.
 String getOsVersion()
          Reports PCN-1001 operating system version.
 int getOutCount()
          Reports current value of OUT counter.
 long getReplyErrors()
          Reports the number of reply errors.
 int getSnpAddress()
          Reports SNP address assigned to the counter.
 int getSnpCmdTimeout()
          Reports SNP command timeout in milliseconds.
 int getSnpNumRetries()
           
 int getSnpPollTimeout()
          Reports SNP poll timeout in milliseconds.
 boolean isAutoLedEnabled()
          Reports if 'autoled' functionality is enabled.
 boolean isCountingEnabled()
          Reports if counting is enabled.
 boolean isDiagnosticsEnabled()
          Reports if diagnostics is enabled.
 boolean isFunctional()
          Reports if passenger counter is accessible via SNP protocol by sending a poll to it and obtaining a reply.
 boolean isInput0Level()
          Reports the status of input0 line
 boolean isInput1Level()
          Reports the status of input1 line
 boolean isSnpDisabled()
          Reports the status of SNP communication
 void obtainDateAndTime()
          Obtains date and time information.
 void obtainDiagnosticStatus()
          Obtains diagnostic status.
 void obtainFpgaFirmwareVersion()
          Obtains PCN-1001 FPGA firmware version.
 void obtainImgServerVersion()
          Obtains PCN-1001 counting software version.
 void obtainInOutCounters()
          Obtains IN/OUT counters.
 void obtainInputLineLevel(int line)
          Obtains level of specified Input Line.
 void obtainKernelVersion()
          Obtains kernel version from passenger counter
 void obtainOsVersion()
          Obtains PCN-1001 operating system version.
 void resetInOutCounters(boolean verifyReset)
          Resets IN/OUT counters.
 void setDateAndTime(Calendar calendar)
          Sets date and time information.
 void setInCount(int inCount)
          Sets IN count.
 void setInputLine(int line, short function)
          Sets function of digital input line specified.
 void setIpAddress(String ipAddress)
          Sets IP address.
 void setLedLightIntensity(int lightIntensity)
          Sets LED light intensity.
 void setOutCount(int outCount)
          Sets OUT count.
 void setOutputOpenTime(int line, short openTime)
          Sets open time for specified optocoupled output
 void setSnpCmdTimeout(int snpCmdTimeout)
          Sets SNP command timeout in milliseconds.
 void setSnpNumRetries(int snpNumRetries)
          Sets SNP number of retries before disabling
 void setSnpPollTimeout(int snpPollTimeout)
          Sets SNP poll timeout in milliseconds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pcn1001

public Pcn1001(int snpAddress,
               Pcn1001SnpChannelService snpChannelService)
Pcn1001 constructor

Parameters:
snpAddress - - SNP address of the counter as int
snpChannelService - - SNP channel service as IPcn1001SnpChannelService
bootstrapService - - bootstrap service as IBootstrapService
esfLoggerService - - ESF logger service as IEsfLoggerService

Pcn1001

public Pcn1001(Pcn1001InfoService infoService)
Pcn1001 - copy constructor. Copies PCN-1001 information.

Parameters:
infoService - PCN-1001 info service as IPcn1001InfoService

Pcn1001

public Pcn1001(Pcn1001CountInfoService countInfoService)
Pcn1001 - copy constructor. Copies IN/OUT count information.

Parameters:
countInfoService - - PCN-1001 IN/OUT count information as IPcn1001CountInfoService

Pcn1001

public Pcn1001(Pcn1001VersionInfoService versionInfoService)
Pcn1001 - copy constructor. Copies version information.

Parameters:
versionInfoService - - PCN-1001 version service as IPcn1001VersionInfoService

Pcn1001

public Pcn1001(Pcn1001AddressInfoService addressInfoService)
Pcn1001 - copy constructor. Copies SNP address information.

Parameters:
addressInfoService - - PCN-1001 address info service as IPcn1001AddressInfoService
Method Detail

getSnpPollTimeout

public int getSnpPollTimeout()
Description copied from interface: Pcn1001Service
Reports SNP poll timeout in milliseconds.

Specified by:
getSnpPollTimeout in interface Pcn1001Service
Returns:
SNP poll timeout as int

setSnpPollTimeout

public void setSnpPollTimeout(int snpPollTimeout)
Description copied from interface: Pcn1001Service
Sets SNP poll timeout in milliseconds.

Specified by:
setSnpPollTimeout in interface Pcn1001Service
Parameters:
snpPollTimeout - - SNP poll timeout as int

getSnpCmdTimeout

public int getSnpCmdTimeout()
Description copied from interface: Pcn1001Service
Reports SNP command timeout in milliseconds.

Specified by:
getSnpCmdTimeout in interface Pcn1001Service
Returns:
SNP command timeout as int

setSnpCmdTimeout

public void setSnpCmdTimeout(int snpCmdTimeout)
Description copied from interface: Pcn1001Service
Sets SNP command timeout in milliseconds.

Specified by:
setSnpCmdTimeout in interface Pcn1001Service
Parameters:
snpCmdTimeout - - SNP command timeout as int

getSnpAddress

public int getSnpAddress()
Description copied from interface: Pcn1001AddressInfoService
Reports SNP address assigned to the counter.

Specified by:
getSnpAddress in interface Pcn1001AddressInfoService
Specified by:
getSnpAddress in interface Pcn1001CountInfoService
Returns:
counter's SNP address as int

getKernelVersion

public String getKernelVersion()
Description copied from interface: Pcn1001VersionInfoService
Reports PCN-1001 kernel version.

Specified by:
getKernelVersion in interface Pcn1001VersionInfoService
Returns:
kernel version as String

getOsVersion

public String getOsVersion()
Description copied from interface: Pcn1001VersionInfoService
Reports PCN-1001 operating system version.

Specified by:
getOsVersion in interface Pcn1001VersionInfoService
Returns:
OS version as String

getFpgaFirmwareVersion

public String getFpgaFirmwareVersion()
Description copied from interface: Pcn1001VersionInfoService
Reports PCN-1001 FPGA firmware version.

Specified by:
getFpgaFirmwareVersion in interface Pcn1001VersionInfoService
Returns:
FPGA firmware version as String

getImgServerVersion

public String getImgServerVersion()
Description copied from interface: Pcn1001VersionInfoService
Reports PCN-1001 counting software version.

Specified by:
getImgServerVersion in interface Pcn1001VersionInfoService
Returns:
Img.Server version as String

getInCount

public int getInCount()
Description copied from interface: Pcn1001CountInfoService
Reports current value of IN counter.

Specified by:
getInCount in interface Pcn1001CountInfoService
Returns:
value of IN counter as int

setInCount

public void setInCount(int inCount)
Description copied from interface: Pcn1001CountInfoService
Sets IN count.

Specified by:
setInCount in interface Pcn1001CountInfoService
Parameters:
inCount - - IN count as int

getDateAndTime

public Calendar getDateAndTime()
Description copied from interface: Pcn1001DateAndTimeService
Reports date and time

Specified by:
getDateAndTime in interface Pcn1001DateAndTimeService
Returns:
date and time as Calendar

isInput0Level

public boolean isInput0Level()
Description copied from interface: Pcn1001InputLineInfoService
Reports the status of input0 line

Specified by:
isInput0Level in interface Pcn1001InputLineInfoService
Returns:
status of input0 line as boolean

isInput1Level

public boolean isInput1Level()
Description copied from interface: Pcn1001InputLineInfoService
Reports the status of input1 line

Specified by:
isInput1Level in interface Pcn1001InputLineInfoService
Returns:
status of input1 line as boolean

getOutCount

public int getOutCount()
Description copied from interface: Pcn1001CountInfoService
Reports current value of OUT counter.

Specified by:
getOutCount in interface Pcn1001CountInfoService
Returns:
value of OUT counter as int

setOutCount

public void setOutCount(int outCount)
Description copied from interface: Pcn1001CountInfoService
Sets OUT count.

Specified by:
setOutCount in interface Pcn1001CountInfoService
Parameters:
outCount - - OUT count as int

isCountingEnabled

public boolean isCountingEnabled()
Description copied from interface: Pcn1001CountInfoService
Reports if counting is enabled.

Specified by:
isCountingEnabled in interface Pcn1001CountInfoService
Returns:
boolean

isAutoLedEnabled

public boolean isAutoLedEnabled()
Description copied from interface: Pcn1001CountInfoService
Reports if 'autoled' functionality is enabled.

Specified by:
isAutoLedEnabled in interface Pcn1001CountInfoService
Returns:
boolean

isDiagnosticsEnabled

public boolean isDiagnosticsEnabled()
Description copied from interface: Pcn1001CountInfoService
Reports if diagnostics is enabled.

Specified by:
isDiagnosticsEnabled in interface Pcn1001CountInfoService
Returns:
boolean

getReplyErrors

public long getReplyErrors()
Description copied from interface: Pcn1001CountInfoService
Reports the number of reply errors.

Specified by:
getReplyErrors in interface Pcn1001CountInfoService
Returns:
long

getCommunicationErrors

public long getCommunicationErrors()
Description copied from interface: Pcn1001CountInfoService
Reports the number of communication errors.

Specified by:
getCommunicationErrors in interface Pcn1001CountInfoService
Returns:
long

isSnpDisabled

public boolean isSnpDisabled()
Description copied from interface: Pcn1001CountInfoService
Reports the status of SNP communication

Specified by:
isSnpDisabled in interface Pcn1001CountInfoService
Returns:
boolean

clearReplyErrors

public void clearReplyErrors()
Description copied from interface: Pcn1001Service
Clears the number of reply errors and communication errors

Specified by:
clearReplyErrors in interface Pcn1001Service

getDiagnosticStatus

public int getDiagnosticStatus()
Description copied from interface: Pcn1001CountInfoService
Reports the diagnostic status.

Specified by:
getDiagnosticStatus in interface Pcn1001CountInfoService
Returns:
int

isFunctional

public boolean isFunctional()
                     throws EsfException
Description copied from interface: Pcn1001Service
Reports if passenger counter is accessible via SNP protocol by sending a poll to it and obtaining a reply.

Specified by:
isFunctional in interface Pcn1001Service
Returns:
boolean
Throws:
EsfException

obtainKernelVersion

public void obtainKernelVersion()
                         throws EsfException
Description copied from interface: Pcn1001Service
Obtains kernel version from passenger counter

Specified by:
obtainKernelVersion in interface Pcn1001Service
Throws:
EsfException

obtainOsVersion

public void obtainOsVersion()
                     throws EsfException
Description copied from interface: Pcn1001Service
Obtains PCN-1001 operating system version.

Specified by:
obtainOsVersion in interface Pcn1001Service
Throws:
EsfException

obtainFpgaFirmwareVersion

public void obtainFpgaFirmwareVersion()
                               throws EsfException
Description copied from interface: Pcn1001Service
Obtains PCN-1001 FPGA firmware version.

Specified by:
obtainFpgaFirmwareVersion in interface Pcn1001Service
Throws:
EsfException

obtainImgServerVersion

public void obtainImgServerVersion()
                            throws EsfException
Description copied from interface: Pcn1001Service
Obtains PCN-1001 counting software version.

Specified by:
obtainImgServerVersion in interface Pcn1001Service
Throws:
EsfException

obtainInOutCounters

public void obtainInOutCounters()
                         throws EsfException
Description copied from interface: Pcn1001Service
Obtains IN/OUT counters.

Specified by:
obtainInOutCounters in interface Pcn1001Service
Throws:
EsfException

resetInOutCounters

public void resetInOutCounters(boolean verifyReset)
                        throws EsfException
Description copied from interface: Pcn1001Service
Resets IN/OUT counters.

Specified by:
resetInOutCounters in interface Pcn1001Service
Parameters:
verifyReset - - verify reset with 'gcounters' command as boolean
Throws:
EsfException

enableDisableCounting

public void enableDisableCounting(byte opcode)
                           throws EsfException
Description copied from interface: Pcn1001Service
Enables/disables counting.

Specified by:
enableDisableCounting in interface Pcn1001Service
Parameters:
opcode - - enable/disable opcode as byte
Throws:
EsfException

enableDisableAutoLed

public void enableDisableAutoLed(byte opcode)
                          throws EsfException
Specified by:
enableDisableAutoLed in interface Pcn1001Service
Throws:
EsfException

setLedLightIntensity

public void setLedLightIntensity(int lightIntensity)
                          throws EsfException
Description copied from interface: Pcn1001Service
Sets LED light intensity.

Specified by:
setLedLightIntensity in interface Pcn1001Service
Parameters:
lightIntensity - - LED light intensity (from 0 to 255) as int
Throws:
EsfException

setIpAddress

public void setIpAddress(String ipAddress)
                  throws EsfException
Description copied from interface: Pcn1001Service
Sets IP address.

Specified by:
setIpAddress in interface Pcn1001Service
Parameters:
ipAddress - - IP address as String
Throws:
EsfException

setInputLine

public void setInputLine(int line,
                         short function)
                  throws EsfException
Description copied from interface: Pcn1001Service
Sets function of digital input line specified.

Specified by:
setInputLine in interface Pcn1001Service
Parameters:
line - - digital input line as int
function - - function of digital input line as int
Throws:
EsfException

setOutputOpenTime

public void setOutputOpenTime(int line,
                              short openTime)
                       throws EsfException
Description copied from interface: Pcn1001Service
Sets open time for specified optocoupled output

Specified by:
setOutputOpenTime in interface Pcn1001Service
Parameters:
line - - digital output line as int
openTime - - open time (range 8~1020, must be multiple of 4) as short
Throws:
EsfException

obtainDateAndTime

public void obtainDateAndTime()
                       throws EsfException
Description copied from interface: Pcn1001Service
Obtains date and time information.

Specified by:
obtainDateAndTime in interface Pcn1001Service
Throws:
EsfException

setDateAndTime

public void setDateAndTime(Calendar calendar)
                    throws EsfException
Description copied from interface: Pcn1001Service
Sets date and time information.

Specified by:
setDateAndTime in interface Pcn1001Service
Parameters:
calendar - - date and time information as Calendar
Throws:
EsfException

obtainInputLineLevel

public void obtainInputLineLevel(int line)
                          throws EsfException
Description copied from interface: Pcn1001Service
Obtains level of specified Input Line.

Specified by:
obtainInputLineLevel in interface Pcn1001Service
Parameters:
line - - digital input line as int
Throws:
EsfException

enableDisableDiagnostics

public void enableDisableDiagnostics(byte opcode)
                              throws EsfException
Description copied from interface: Pcn1001Service
Enables/disables diagnostics.

Specified by:
enableDisableDiagnostics in interface Pcn1001Service
Throws:
EsfException

obtainDiagnosticStatus

public void obtainDiagnosticStatus()
                            throws EsfException
Description copied from interface: Pcn1001Service
Obtains diagnostic status.

Specified by:
obtainDiagnosticStatus in interface Pcn1001Service
Throws:
EsfException

getSnpNumRetries

public int getSnpNumRetries()
Specified by:
getSnpNumRetries in interface Pcn1001Service

setSnpNumRetries

public void setSnpNumRetries(int snpNumRetries)
Description copied from interface: Pcn1001Service
Sets SNP number of retries before disabling

Specified by:
setSnpNumRetries in interface Pcn1001Service
Parameters:
snpNumRetries - - SNP number of retries as int


Copyright © 2013. All Rights Reserved.