private LytroRequest(ulong commandParams, ulong additionalParams, byte[] content) { _message = new LytroRawMessage(); _message.CommandAndParameters = commandParams; _message.AdditionalParameters = additionalParams; _message.Content = content; }
internal LytroResponse(LytroRawMessage message) { if (message == null) { throw new ArgumentNullException("message"); } _message = message; }
/// <summary> /// Returns a response to this request. /// </summary> /// <param name="stream">The <see cref="Stream" /> to send the request and receive the response over.</param> /// <param name="bufferLength">For requests without content, the number of bytes expected in the response.</param> /// <returns>a <see cref="LytroResponse"/> that contains the response to this request.</returns> /// <remarks> /// If a request <see cref="Content"/> is set, the <paramref name="bufferLength"/> parameter is ignored and <see cref="LytroRawMessage.Length"/> is set to the size of the content before sending the request. /// If <see cref="Content"/> is null, the <see cref="LytroRawMessage.Length"/> is set to <paramref name="bufferLength"/> value and <see cref="LytroRawMessage.NoContent"/> flag is set before sending the request. /// </remarks> public LytroResponse GetResponse(Stream stream, int bufferLength = 0) { if (_message.Content != null) { _message.Length = _message.Content.Length; } else { _message.Flags |= LytroRawMessage.NoContent; _message.Length = bufferLength; } _message.WriteTo(stream); LytroRawMessage responseMessage = LytroRawMessage.ReadFrom(stream); return(new LytroResponse(responseMessage)); }