[This is preliminary documentation and subject to change.]
Create a request PDU, and validity checks the resultant PDU.
See Create.
The response code specified can be any valid code; either Final (the ‘final’ bit set), or non-Final if the code is valid as non-final, but see below.
If creating 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.
If the all headers do no fit within the maximum PDU size then as with Create any unincluded headers remain if the header collection. In that case we also assume that the remaining headers will be sent in the folowing PDU and thus we clear the final bit in the opcode. That also is done if a body header type was added with content from the bodyStream.
The PDU and its opcode are then checked for validity. Only certain opcodes can be non-final ie PUT and GET. CONNECT for instance cannot. See OBEX13.pdf sections 3.3 and 3.1. If the opcode is invalid then ProtocolViolationException is thrown.
If sending a PDU that cannot have its headers split across PDUs then the caller should handle that case externally, as it can know what to do in that case. For instance when sending an Abort or Disconnect, ObexClientSession will at first attempt to include the reason text string but if that fails then it tries again but without the string header. There are thus two exceptions that can occur on the headers being too long: ProtocolViolationException as described here, and ObexCreateTooLongException is even the first header would not fit, see Create. aaaa Create.
| Exception Type | Condition |
|---|---|
| ProtocolViolationException | If the response code in invalid, see above. |
| For other possible exceptions see Create. |
ObexPduFactory Class | Brecham.Obex.Pdus Namespace | ObexPduFactory.CreateRequest Overload List