Implementing the GET Operation
Getting a default vCard involves pulling a file from the server. A vCard contains contact information that can be shared between devices. If a server contains an updated version of a global contact list, vCard can be used to update clients with the latest contact information.
To implement this feature, 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::Get method. This collection is used to describe the object you are pulling. Set the Type header to text/x-vCard.
- Call the IObexDevice::Get method. Include the collection of headers that describe the object.
- The IObexDevice::Get method returns a stream. Use the IStream interface to read the stream.
- 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
OBEX Samples | Implementing the PUT Operation
Last updated on Friday, April 09, 2004
© 1992-2003 Microsoft Corporation. All rights reserved.