com.eurotech.framework.protocol.pcn
Class Pcn1001SnpChannel

java.lang.Object
  extended by com.eurotech.framework.protocol.pcn.Pcn1001SnpChannel
All Implemented Interfaces:
Pcn1001SnpChannelService

public class Pcn1001SnpChannel
extends Object
implements Pcn1001SnpChannelService

Defines SNP channel class for PCN-1001 passenger counter

Author:
ilya.binshtok

Field Summary
static String PROTOCOL_CONNECTION_TYPE_ETHER_TCP
           
static String PROTOCOL_CONNECTION_TYPE_SERIAL
           
 
Fields inherited from interface com.eurotech.framework.protocol.pcn.Pcn1001SnpChannelService
SERVICE_NAME, snpNotification
 
Constructor Summary
Pcn1001SnpChannel(org.osgi.service.io.ConnectionFactory connFactory, Properties connectionConfig, org.osgi.framework.BundleContext bundleContext, Object user)
          Pcn1001SnpChannel constructor.
 
Method Summary
 void addUser(Object user)
          Adds a user to the list of channel users.
 void close()
          Closes PCN-1001 SNP channel
 int getBaudRate()
          Reports baud rate.
 String getDevName()
          Reports name of the serial device.
 String getDevProductID()
          Reports device product ID
 String getDevVendorID()
          Reports device vendor ID
 int getFlowControl()
          Reports flow control mode.
 int getNumberDataBits()
          Reports number of data bits.
 int getNumberStopBits()
          Reports number of stop bits.
 int getParity()
          Reports parity.
 int getUsageCount()
          Reports usage count.
 String[] getUsers()
          Reports list of channel users.
 boolean isDeviceSupported()
          Reports if serial device is supported by this implementation.
 SnpMessage sendCommand(SnpMessage snpCmd, int tout)
          Sends SNP command to the passenger counter
 void setUsageCount(int usageCount)
          Sets usage count.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROTOCOL_CONNECTION_TYPE_SERIAL

public static final String PROTOCOL_CONNECTION_TYPE_SERIAL
See Also:
Constant Field Values

PROTOCOL_CONNECTION_TYPE_ETHER_TCP

public static final String PROTOCOL_CONNECTION_TYPE_ETHER_TCP
See Also:
Constant Field Values
Constructor Detail

Pcn1001SnpChannel

public Pcn1001SnpChannel(org.osgi.service.io.ConnectionFactory connFactory,
                         Properties connectionConfig,
                         org.osgi.framework.BundleContext bundleContext,
                         Object user)
                  throws EsfException
Pcn1001SnpChannel constructor. Opens PCN-1001 SNP channel.

Parameters:
devName - - name of serial device as String
deviceVendorID - - device vendor ID as String
deviceProductID - - device product ID as String
baudrate - - baud rate as int
numDataBits - - number of data bits as int
numStopBits - - number of stop bits as int
parity - - parity as int
flowcontrol - - type of flow control as int
bundleContext - - bundle context as BundleContext
user - - object that is registering with this channel as Object
esfLoggerService - - ESF logger service as IEsfLoggerService
Throws:
EsfException
Method Detail

getDevVendorID

public String getDevVendorID()
Description copied from interface: Pcn1001SnpChannelService
Reports device vendor ID

Specified by:
getDevVendorID in interface Pcn1001SnpChannelService
Returns:
vendor ID as String

getDevProductID

public String getDevProductID()
Description copied from interface: Pcn1001SnpChannelService
Reports device product ID

Specified by:
getDevProductID in interface Pcn1001SnpChannelService
Returns:
pridict ID as String

getUsageCount

public int getUsageCount()
Description copied from interface: Pcn1001SnpChannelService
Reports usage count.

Specified by:
getUsageCount in interface Pcn1001SnpChannelService
Returns:
usage count as int

getUsers

public String[] getUsers()
Description copied from interface: Pcn1001SnpChannelService
Reports list of channel users.

Specified by:
getUsers in interface Pcn1001SnpChannelService
Returns:
list of users as String[]

addUser

public void addUser(Object user)
Description copied from interface: Pcn1001SnpChannelService
Adds a user to the list of channel users.

Specified by:
addUser in interface Pcn1001SnpChannelService
Parameters:
user - - user to add as Object

setUsageCount

public void setUsageCount(int usageCount)
Sets usage count.

Parameters:
usageCount - - usage count as int

getDevName

public String getDevName()
Description copied from interface: Pcn1001SnpChannelService
Reports name of the serial device.

Specified by:
getDevName in interface Pcn1001SnpChannelService
Returns:
serial device name as String

getBaudRate

public int getBaudRate()
Description copied from interface: Pcn1001SnpChannelService
Reports baud rate.

Specified by:
getBaudRate in interface Pcn1001SnpChannelService
Returns:
baud rate as int

getNumberDataBits

public int getNumberDataBits()
Description copied from interface: Pcn1001SnpChannelService
Reports number of data bits.

Specified by:
getNumberDataBits in interface Pcn1001SnpChannelService
Returns:
number of data bits as int

getNumberStopBits

public int getNumberStopBits()
Description copied from interface: Pcn1001SnpChannelService
Reports number of stop bits.

Specified by:
getNumberStopBits in interface Pcn1001SnpChannelService
Returns:
number of stop bits as int

getParity

public int getParity()
Description copied from interface: Pcn1001SnpChannelService
Reports parity.

Specified by:
getParity in interface Pcn1001SnpChannelService
Returns:
parity as int

getFlowControl

public int getFlowControl()
Description copied from interface: Pcn1001SnpChannelService
Reports flow control mode.

Specified by:
getFlowControl in interface Pcn1001SnpChannelService
Returns:
flow control mode as int

sendCommand

public SnpMessage sendCommand(SnpMessage snpCmd,
                              int tout)
                       throws EsfException
Description copied from interface: Pcn1001SnpChannelService
Sends SNP command to the passenger counter

Specified by:
sendCommand in interface Pcn1001SnpChannelService
Parameters:
snpCmd - - SNP command as SnpMessage
Returns:
Throws:
EsfException

isDeviceSupported

public boolean isDeviceSupported()
Description copied from interface: Pcn1001SnpChannelService
Reports if serial device is supported by this implementation.

Specified by:
isDeviceSupported in interface Pcn1001SnpChannelService
Returns:
boolean

close

public void close()
           throws EsfException
Closes PCN-1001 SNP channel

Throws:
EsfException


Copyright © 2013. All Rights Reserved.