protected ResponseMessage queryAndVerify(RequestMessage paramRequestMessage) { paramRequestMessage.writeTo(getOutStream()); ResponseMessage localResponseMessage = new ResponseMessage(this.inStream); List <Command> localList1 = paramRequestMessage.Commands(); List <ResponseContainer> localList2 = localResponseMessage.responses(); if (localList1.Count > localList2.Count) { throw new TraCIException("not enough responses received"); } for (int i = 0; i < localList1.Count; i++) { Command localCommand = (Command)localList1[i]; ResponseContainer localResponseContainer = (ResponseContainer)localList2[i]; StatusResponse localStatusResponse = localResponseContainer.getStatus(); verify("command and status IDs match", Convert.ToInt32(localCommand.Id()), Convert.ToInt32(localStatusResponse.Id())); if (localStatusResponse.Result() != 0) { throw new TraCIException("SUMO error for command " + localStatusResponse.Id() + ": " + localStatusResponse.Description()); } } return(localResponseMessage); }
protected virtual ResponseMessage QueryAndVerify(RequestMessage reqMsg) { reqMsg.WriteTo(GetOutStream()); ResponseMessage respMsg = new ResponseMessage(inStream); List <Command> commands = reqMsg.Commands(); List <ResponseContainer> responses = respMsg.Responses(); if (commands.Count() > responses.Count()) { throw new TraCIException("not enough responses received"); } for (int i = 0; i < commands.Count(); i++) { Command cmd = commands[i]; ResponseContainer responsePair = responses[i]; StatusResponse statusResp = responsePair.GetStatus(); Verify("command and status IDs match", cmd.Id(), statusResp.Id()); if (statusResp.Result() != Constants.RTYPE_OK) { throw new TraCIException("SUMO error for command " + statusResp.Id() + ": " + statusResp.Description()); } } return(respMsg); }