Implementing the Put Operation (Windows CE 5.0)
A client-side push is the most common application of OBEX. It enables clients to transfer files to a server. A common scenario for this functionality would be a user transferring a calendar schedule to a PDA.
To implement this functionality, the following steps are required:
- Create an instance of 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.
- Initialize the IObex interface by calling the IObex::Initialize method.
- To obtain a list of available devices, call the IObex::EnumDevices method. Alternatively, you can also call the IObexSink::Notify method to obtain a list of available Bluetooth devices.
- Using the IHeaderCollection interface, build the collection of headers that you would like to pass into the IObexDevice::Connect method.
- Using the information from IObex::EnumDevices, connect to the desired device with the IOBexDevice::Connect method.
- Using the IHeaderCollection interface, build the collection of headers that you would like to pass into the IObexDevice::Put method. This collection is used to describe the object you are pushing.
- Call the IObexDevice::Put method. Include the collection of headers that describe the object.
- The IObexDevice::Put method returns a stream. Use the IStream interface to write the stream to the server.
- When finished, release the stream.
- To release the connection, call the IObexDevice::Disconnect method.
- To release the IObex interface and allocated resources, call the IObex::Shutdown method.
- Release all other interfaces.
See Also
OBEXTool | OBEX Samples | Implementing the Get Operation
Send Feedback on this topic to the authors