Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
The OBEX protocol enables asynchronous device discovery.
-
Instantiate an IObex:IUnknownobject.
-
Instantiate and implement an IObexSink:IUnknownobject.
-
Provide a pointer to the IObexSinkobject to inform the IObexobject, as follows:
- Query for the Windows Embedded CE
IConnectionPointContainerinterface.
- Call the
IConnectionPointContainer::FindConnectionPointmethod.
- Use the returned
IConnectionvalue to create the pointer.
- Query for the Windows Embedded CE
IConnectionPointContainerinterface.
-
Use the IObex::StartDeviceEnummethod to begin device enumeration. The IObexSink:IUnknownobject receives a notification for each device arrival, departure, and update.
When a remote device that supports OBEXenters the range of the local device, the IObexSink::Notifymethod is called. The method notifies the local device (local IObex:IUnknownobject) of the arrival of the new device.
The IObexSink::Notifymethod specifies one of the following values for the Eventparameter.
Value Description OE_DEVICE_ARRIVAL
A new remote device has arrived within range of the local device.
OE_DEVICE_DEPARTURE
A previously listed remote device has left the range of the local device.
The local device should release its pointer to the remote device and notify the user through the user interface that the remote device is no longer available.
OE_DEVICE_UPDATE
A remote device was initially located but did not provide complete information about itself.
-
Do one of the following based on the value specified for the Eventparameter:
-
OE_DEVICE_ARRIVAL Query for the remote
device
IPropertyBagto retrieve information about the device, such
as the class ID of the transport and the name of the remote device.
IPropertyBagis provided by the
pUnk1parameter for the
IObexSink::Notifymethod.
To bind the local device to the remote device, call the IObex::BindToDevicemethod and pass the property bag of the remote device to this method. IObex::BindToDevicereturns a pointer, in the form of an IObexDevice:IUnknowninterface, to the remote device. Call the IObexDevice::Connectmethod to connect to the remote device. -
OE_DEVICE_UPDATE To retrieve information
about the device, query for the remote device
IPropertyBag.
-
OE_DEVICE_ARRIVAL Query for the remote
device
IPropertyBagto retrieve information about the device, such
as the class ID of the transport and the name of the remote device.
IPropertyBagis provided by the
pUnk1parameter for the
IObexSink::Notifymethod.
-
Call the IObex::StopDeviceEnummethod to stop the device enumeration process at any point.
-
Release the IObexSink::Notifyobject when the enumeration process is finished so that this object is unadvised to the IObex:IUnknownobject.