public class AwidSession extends AbstractPubSubIPSensorSession
Constructor and Description |
---|
AwidSession(AbstractSensor<?> sensor,
java.lang.String ID,
java.lang.String host,
int port,
int reconnectionInterval,
int maxConAttempts,
java.util.Set<AbstractCommandConfiguration<?>> commandConfigurations,
NotifierService notifierSerivce,
boolean is3014)
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.
|
AwidEndpoint |
getEndpoint() |
AwidGPIOSession |
getGPIOSession() |
MessageParsingStrategyFactory |
getMessageParsingStrategyFactory()
Get a factory for MessageParsingStrategy objects
|
boolean |
is3014()
Is the reader a 3014?
|
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(AbstractAwidCommand command)
Clients of the session should use this method to send commands to the
awid reader
|
java.lang.Integer |
submit(java.lang.String commandID,
long interval,
java.util.concurrent.TimeUnit unit)
Submit a command to a reader session for execution.
|
java.lang.String |
toString() |
subscribe, unsubscribe
getHost, getPort
getCommandInstance, getStatus, submit, submit, submitAndBlock, suspendCommand
getCommands, getDTO, getID, getSensor, getTimeout, handleTimeout, killAllCommands, restoreCommands
public AwidSession(AbstractSensor<?> sensor, java.lang.String ID, java.lang.String host, int port, int reconnectionInterval, int maxConAttempts, java.util.Set<AbstractCommandConfiguration<?>> commandConfigurations, NotifierService notifierSerivce, boolean is3014)
sensor
- The sensor that produced this sessionID
- The ID of this sessionhost
- The IP address of the awidport
- The port of the awidreconnectionInterval
- The time inbetween successive reconnection attemptsmaxConAttempts
- The maxiumum number of attempts to make to recoonecttemplate
- Helper object for sending out JMS messagescommandConfigurations
- The Commands available.notifierSerivce
- Helper object to send out notifications about the statepublic 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 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 killComand(java.lang.Integer id)
SensorSession
killComand
in class AbstractSensorSession
id
- The ID of the command to killpublic AwidGPIOSession getGPIOSession()
public AwidEndpoint getEndpoint()
public void sendMessage(AbstractAwidCommand command) throws java.io.IOException
command
- The command to sendjava.io.IOException
public void disconnect()
SensorSession
disconnect
in class AbstractIPSensorSession
public boolean is3014()
public java.lang.String toString()
toString
in class AbstractIPSensorSession