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.
A version of this page is also available for

During send and receive operations, some applications may need to access the OBEX headers sent by the server that are not directly available from the IStreaminterface. Windows Mobile provides a mechanism for retrieving headers for multiple-packet responses. OBEX clients can now access various custom headers in the OBEX stream. This enables OEMs to integrate their custom Basic Imaging Profile (BIP) over the Windows Embedded CE Bluetooth stack.

BIP is not supported by Windows Mobile. It provides the additional capabilities required by OBEX to support BIP. OEMs will need to implement their own BIP functionality.

To determine the OBEX headers that have been set by a server, call IUnknown::QueryInterfaceon the IStreamobject that was used for sending and receiving the raw data by passing the UUID, IID_IHeaderEnum in the iidparameter.

QueryInterfacereturns an IHeaderEnum:IUnknownobject that can be used to enumerate the headers that the server returned.

The header values cannot be queried at any point during an IStreamoperation. When the application retrieves data from the OBEX server by using the IStream::Readmethod, the server also returns the set of OBEX headers. However, querying for IHeaderEnumat any point during the operation always returns the headers from the initial response packet. The IStreamobject does not store headers that the OBEX server sends after the first packet. If QueryInterfaceis called before the first operation, the call fails with an E_FAIL code. For sending data to an OBEX server by using the IStream::Writemethod, only the headers in the last packet that the server returns are available. Typically, when the client application calls the IStream::Commitmethod, the OBEX server sends a notification to the caller indicating that the last packet has been sent. After this notification is sent, the IStreamobject stores the headers for future retrieval. If an application attempts to retrieve the packet information before the server has sent its last packet, the IHeaderEnumcall fails with an E_FAIL code.

The following code example shows an application retrieving header information sent by the OBEX server:

Copy Code
// Assume that pMyStream has already been initialized
IStream *pMyStream;
ULONG ulHeadersFetched;
IHeaderEnum *pHeaderEnum = NULL;
while (someCondition == TRUE) 
  // Send data to the server
  CHAR szBuf[100];
  DWORD dwBufLen;
  DWORD dwWritten;
  hr = pMyStream->Write(szBuf, dwBufLen, &dwWritten);
  if (FAILED(hr))
	goto cleanup;
// Commit indicates last packet being sent from client
hr = pMyStream->Commit(0);
if (FAILED(hr))
  goto cleanup;
// Only after Commit, attempt to get data.
if ( FAILED (hr =
  goto cleanup;
// Query for the Obex headers

  wprintf(L"Retrieved an obex header...\r\n");
// perform cleanup as required

See Also


Client Support

Other Resources

OBEX Application Development