Brecham.Obex — An OBEX library for the .NET Framework

ObexPduFactory.CreateResponse Method (Boolean, Byte[], ObexResponseCode, ObexHeaderCollection, Stream)

[This is preliminary documentation and subject to change.]

Create a response PDU, optionally as a response to a Connect PDU, and validity checks the resultant PDU.

[Visual Basic]
Overloads Public Function CreateResponse( _
   ByVal isResponseToConnect As Boolean, _
   ByVal buffer As Byte(), _
   ByVal responseCode As ObexResponseCode, _
   ByVal headers As ObexHeaderCollection, _
   ByVal bodyStream As Stream _
) As ObexCreatedPdu
[C#]
public ObexCreatedPdu CreateResponse(
   bool isResponseToConnect,
   byte[] buffer,
   ObexResponseCode responseCode,
   ObexHeaderCollection headers,
   Stream bodyStream
);

Parameters

isResponseToConnect
This response is to a Connect PDU, so the extra Connect bytes will be added.
buffer
See Create.
responseCode
The Response code to include in the PDU, as an ObexResponseCode.
headers
See Create.
bodyStream
See Create.

Return Value

See Create.

Remarks

If creating a response to a Connect PDU the extra Connect bytes will be added, they define the protocol version in use and the maximum packet size. The latter is as set at initialisation with bufferSize, or subsequently with LocalMru.

The response code is checked for validity, for instance throwing ProtocolViolationException if the ‘final’ bit is clear. See OBEX13.pdf sections 3.2 and 3.2.1.

Exceptions

Exception TypeCondition
ProtocolViolationException If the response code in invalid, see above.
For other possible exceptions see Create.

See Also

ObexPduFactory Class | Brecham.Obex.Pdus Namespace | ObexPduFactory.CreateResponse Overload List