public class Alien9800ReaderSession extends AbstractPollIPSensorSession implements AlienCommandConstants
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NEWLINE
Each command needs to be terminated with a newline.
|
static java.lang.String |
WELCOME
Welcome string.
|
ANTENNA_SEQUENCE_COMMAND, COMMAND_ANTENNA_SEQUENCE, COMMAND_DHCP, COMMAND_DNS, COMMAND_EXTERNAL_INPUT, COMMAND_EXTERNAL_OUTPUT, COMMAND_GATEWAY, COMMAND_HEARTBEAT_ADDRESS, COMMAND_HEARTBEAT_COUNT, COMMAND_HEARTBEAT_PORT, COMMAND_HEARTBEAT_TIME, COMMAND_INVERT_EXTERNAL_INPUT, COMMAND_INVERT_EXTERNAL_OUTPUT, COMMAND_IPADDRESS, COMMAND_MAC_ADDRESS, COMMAND_MAX_ANTENNA, COMMAND_NETMASK, COMMAND_NETWORK_TIMEOUT, COMMAND_PASSWORD, COMMAND_PERSIST_TIME, COMMAND_READER_TYPE, COMMAND_READER_VERSION, COMMAND_READERNAME, COMMAND_READERNUMBER, COMMAND_RF_ATTENUATION, COMMAND_TAG_LIST, COMMAND_TAG_LIST_CUSTOM_FORMAT, COMMAND_TAG_LIST_FORMAT, COMMAND_TAG_TYPE, COMMAND_TIME, COMMAND_TIME_SERVER, COMMAND_TIME_ZONE, COMMAND_UPTIME, COMMAND_USERNAME, COOMMAND_COMMAND_PORT, PROMPT_SUPPRESS
Constructor and Description |
---|
Alien9800ReaderSession(AbstractSensor<?> sensor,
java.lang.String id,
java.lang.String host,
int port,
int notifyPort,
int ioStreamPort,
int reconnectionInterval,
int maxConAttempts,
java.lang.String username,
java.lang.String password,
NotifierService notifierService,
java.lang.String readerID,
java.util.Set<AbstractCommandConfiguration<?>> commands)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
connect()
Open the connection to the Sensor.
|
void |
disconnect()
Close the connection and stop processing of commands.
|
void |
flashOutput(java.util.BitSet ports,
java.util.BitSet finalPorts,
int timeOn,
int timeOff,
int repeat)
This method flashes the given output ports high for a given amount of
time.
|
int |
getExternalInput()
helper method that sends a 'get externalInput' command to the reader.
|
MessageParsingStrategyFactory |
getMessageParsingStrategyFactory()
Get a factory for MessageParsingStrategy objects
|
void |
killComand(java.lang.Integer id)
This method deletes a command from the session, including the DTO.
|
boolean |
onConnect()
Called after the initial socket connection got established.
|
void |
sendMessage(ByteMessage message)
Send a message over the line.
|
void |
setOutputPort(java.util.BitSet ports)
This method sets the External Output high for the given ports
|
java.lang.Integer |
submit(java.lang.String commandID,
long interval,
java.util.concurrent.TimeUnit unit)
Submit a command to a reader session for execution.
|
boolean |
testInputPort(int port)
This method tests if a given input port is high
|
java.lang.String |
toString() |
getMessageProcessingStrategyFactory, isMessageAvailable, receiveMessage, receiveMessage
getHost, getPort
getCommandInstance, getStatus, submit, submit, submitAndBlock, suspendCommand
getCommands, getDTO, getID, getSensor, getTimeout, handleTimeout, killAllCommands, restoreCommands
public static final java.lang.String NEWLINE
public static final java.lang.String WELCOME
public Alien9800ReaderSession(AbstractSensor<?> sensor, java.lang.String id, java.lang.String host, int port, int notifyPort, int ioStreamPort, int reconnectionInterval, int maxConAttempts, java.lang.String username, java.lang.String password, NotifierService notifierService, java.lang.String readerID, java.util.Set<AbstractCommandConfiguration<?>> commands)
sensor
- id
- The FACTORY_ID of the sessionhost
- The IP to connect toport
- The port to connect tonotifyPort
- The port to use as a autonomous notify portreconnectionInterval
- The wait time between reconnect attemptsmaxConAttempts
- The maximum number of times to try to connectusername
- The Alien usernamepassword
- The Alien passworddestination
- The JMS destination for tagstemplate
- The JSM template for tagsnotifierService
- The service for sending client notificationsreaderID
- The FACTORY_ID of the reader that created this sessioncommands
- A thread safe set containing all available commandspublic MessageParsingStrategyFactory getMessageParsingStrategyFactory()
AbstractIPSensorSession
public void connect() throws java.io.IOException
SensorSession
connect
in class SensorSession
java.io.IOException
- if the connection failspublic boolean onConnect() throws java.io.IOException
AbstractIPSensorSession
java.io.IOException
- if a connection problem occurspublic void disconnect()
SensorSession
disconnect
in class AbstractIPSensorSession
public void sendMessage(ByteMessage message) throws java.io.IOException
AbstractIPSensorSession
java.io.IOException
public void killComand(java.lang.Integer id)
SensorSession
killComand
in class AbstractSensorSession
id
- The ID of the command to killpublic java.lang.Integer submit(java.lang.String commandID, long interval, java.util.concurrent.TimeUnit unit)
SensorSession
submit
in class AbstractSensorSession
commandID
- The command to executeinterval
- The interval between executionsunit
- The Unit of time to measure the intervalpublic void setOutputPort(java.util.BitSet ports)
ports
- The ports to set highpublic boolean testInputPort(int port) throws CannotExecuteException
port
- CannotExecuteException
public int getExternalInput() throws CannotExecuteException
CannotExecuteException
public void flashOutput(java.util.BitSet ports, java.util.BitSet finalPorts, int timeOn, int timeOff, int repeat) throws CannotExecuteException
ports
- The ports to set to highfinalPorts
- The configuration of the ports after the flashes are donetimeOn
- The time in seconds to set the ports hightimeOff
- The time in seconds to set the port lowrepeat
- The number of times to reapeat the flashes.CannotExecuteException
public java.lang.String toString()
toString
in class AbstractIPSensorSession