Пример #1
0
        /// <summary>
        /// Executes this Request and waits for the response (if this request awaits response)
        /// </summary>
        public virtual SubsystemResponse Execute()
        {
            if (ResponseType == null || ResponseType == typeof(NoResponse))
            {
                _ctx.PacketTransmitter.TransmitWithoutResponse(ConvertToDataPacket());
                return(null);
            }
            else
            {
                DataPacket responseDataPacket = _ctx.PacketTransmitter.TransmitWithResponse(ConvertToDataPacket());
                if (responseDataPacket.IsResponse == false)
                {
                    throw new NotSupportedException("Received response packet with isResponse==false, something went wrong");
                }

                using (ByteStream src = new ByteStream(responseDataPacket.Payload))
                {
                    //Reads the RequestIdentifier, but this is not needed for response packets
                    StreamHelper.ReadUInt16(src);

                    SubsystemResponse response = CreateResponse();
                    response.Read(src);
                    return(response);
                }
            }
        }
 public SubsystemResponseException(SubsystemResponse response, int errorCode, string message)
     : base(message)
 {
     _response  = response;
     _errorCode = errorCode;
 }
Пример #3
0
 public SubsystemResponseException(SubsystemResponse response, int errorCode, string message)
     : base(message)
 {
     _response = response;
     _errorCode = errorCode;
 }