Package it.polito.appeal.traci.protocol
Class ResponseMessage
java.lang.Object
it.polito.appeal.traci.protocol.ResponseMessage
Represents a message sent from the server. A response message is made of an
ordered collection of status responses, response commands and/or sub-responses.
- Author:
- Enrico Gueli <enrico.gueli@polito.it>
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int[]
The list of IDs of responses that have no response commands. -
Constructor Summary
ConstructorDescriptionConstructor that unpacks all the data from aDataInputStream
, populating the list ofResponseContainer
s. -
Method Summary
-
Field Details
-
STATUS_ONLY_RESPONSES
public static final int[] STATUS_ONLY_RESPONSESThe list of IDs of responses that have no response commands.
-
-
Constructor Details
-
ResponseMessage
Constructor that unpacks all the data from aDataInputStream
, populating the list ofResponseContainer
s.A response message is made of individual packets. It is assumed that the first packet is always a status response. According to the status response, different data are expected next:
- if the status response is not
Constants.RTYPE_OK
, another status response or the end of the stream are expected. - if the status ID is equal to
Constants.CMD_SIMSTEP
, it is expected an integer representing N and N following sub-responses; - if the status ID matches one of the commands in
STATUS_ONLY_RESPONSES
, it is expected another status response; - if the status ID doesn't match any of the above, it is expected a response command.
ResponseMessage
, collecting all the data that belong to the same request, is built and appended to an internal list.- Parameters:
dis
- dis- Throws:
IOException
- Exception
- if the status response is not
-
-
Method Details
-
responses
-