How to Send a Data Object to the OBEX Server (Windows CE 5.0)
To copy a file to the OBEX server, send a data object to the server by using the IObexDevice::Put method. The request can contain the Name and Length headers, however, if the target device is so simple that it accepts only one object, the headers may be omitted. If the server is a desktop computer, personal digital assistant (PDA), or any other general-purpose device, headers are highly recommended.
Hardware and Software Assumptions
You have declared pointers to the following interfaces:
- IObex. Used for the OBEX services.
- IHeaderCollection. Used to create header collections.
- IObexDevice. Used to execute common operations.
- IStream. Used to manage data streams between devices.
To track your progress in the following table, select the check box next to each step.
Step | Topic | |
---|---|---|
1. Enable the client to discover an OBEX device by using IConnectionPointContainer and IObexSink interfaces. | Discovering OBEX Devices | |
2. Retrieve the IObexDevice reference. | None. | |
3. Call the appropriate method of the IHeaderCollection interface to add a header.
|
None. | |
4. Call the Connect method on the IObexDevice reference to connect to an OBEX server. | Connecting to an OBEX Server | |
5. Call Put to send the data object to the server. This method returns destination pointer to the IStream interface, which is used to write the data. | Implementing the Put Operation | |
6. Call IStream::Write to write into the stream.
|
Use of Streams | |
7. Close the connection to the OBEX server by calling the Disconnect on the IObexDevice reference. | Disconnecting from an OBEX Server | |
8. Release all interfaces and allocated resources.
|
None. |
See Also
Client Support | How to Request a Data Object from the OBEX Server
Send Feedback on this topic to the authors