public class TacticalConnection extends Object
Constructor and Description |
---|
TacticalConnection()
Creates a new instance of TacticalConnection
This constructor should be used for a Tactical/Strategic connection
|
TacticalConnection(Execution execution)
Creates a new instance of TacticalConnection
This constructor should be used for a Tactical/Execution connection
where the execution level is to be accessed as a thread on this JVM
|
TacticalConnection(int port,
VehicleCharacteristics vChars)
Creates a new instance of TacticalConnection
This constructor should be used for a Tactical/Execution connection or
Strategic/Tactical connection where the communications are via network
|
TacticalConnection(VehicleCharacteristics vChars)
Creates a new instance of TacticalConnection
This constructor should be used for a Tactical/Strategic connection
|
Modifier and Type | Method and Description |
---|---|
void |
connectViaNetwork()
Sets up the server socket to wait for a connection
|
void |
disconnectNetwork()
Closes sockets and streams to disconnect from the network
|
int |
getReturnedCommandIndex()
Returns the index of the command currently being executed
(i.e. the sequential number of the current command)
|
boolean |
isNetworked() |
List<JAXBElement<?>> |
readCommandElementListToTactical()
Checks for a new command from the tactical level, returns null if none is present
|
String |
readMessageFromTactical(String readerName)
Checks for a message from the tactical level, either to the execution or strategic level
|
String |
readMessageToTactical()
Checks for a message sent from the execution or strategic to the tactical level
|
JAXBElement<?> |
readNextCommandFromTactical()
Checks for a new command from the tactical level, returns null if none is present
|
void |
sendCommandElementListToTactical(List<JAXBElement<?>> cmdElementList)
Sends a List of AVCL commands to the tactical level for execution
|
boolean |
sendCommandFromTactical(List<JAXBElement<?>> cmdElementList)
Sends a new command for the execution level to execute
|
void |
sendMessageFromTactical(String msg)
Sends a message from the tactical level, either to the execution or strategic level
|
void |
sendMessageToTactical(String msg)
Sends a message from the strategic level to the tactical level
|
void |
updateFromTacticalMessageQueue()
Checks all of the connections to see if any messages are pending
|
void |
updateToTacticalMessageQueue()
Checks all of the connections to see if any messages have been sent
|
public TacticalConnection()
public TacticalConnection(VehicleCharacteristics vChars)
vChars
- reference to the vehicle characteristics object defining what XSLT
to use when sending commands over the networkpublic TacticalConnection(int port, VehicleCharacteristics vChars)
port
- local port to use to wait for the network connection to be establishedvChars
- reference to the vehicle characteristics object defining what XSLT
to use when sending commands over the networkpublic TacticalConnection(Execution execution)
execution
- reference to the execution level of the vehicle to which connection appliespublic void connectViaNetwork()
public void disconnectNetwork()
public boolean isNetworked()
public boolean sendCommandFromTactical(List<JAXBElement<?>> cmdElementList)
cmdElementList
- JAXB object containing an AVCL task-level command to be executedpublic JAXBElement<?> readNextCommandFromTactical()
public void sendCommandElementListToTactical(List<JAXBElement<?>> cmdElementList)
cmdElementList
- List of AVCL (JAXB) commands to be executedpublic List<JAXBElement<?>> readCommandElementListToTactical()
public void sendMessageFromTactical(String msg)
msg
- message from tactical to execution levelpublic void updateFromTacticalMessageQueue()
public String readMessageFromTactical(String readerName)
public void sendMessageToTactical(String msg)
msg
- message from execution to tactical levelpublic void updateToTacticalMessageQueue()
public String readMessageToTactical()
public int getReturnedCommandIndex()