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:

  1. Create an instance of the following interfaces:
  2. Initialize the IObex interface by calling the IObex::Initialize method.
  3. 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.
  4. Using the IHeaderCollection interface, build the collection of headers that you would like to pass into the IObexDevice::Connect method.
  5. Using the information from IObex::EnumDevices, connect to the desired device with the IOBexDevice::Connect method.
  6. 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.
  7. Call the IObexDevice::Get method. Include the collection of headers that describe the object.
  8. The IObexDevice::Get method returns a stream. Use the IStream interface to read the stream.
  9. When finished, release the stream.
  10. To release the connection, call the IObexDevice::Disconnect method.
  11. To release the IObex interface and allocated resources, call the IObex::Shutdown method.
  12. 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.