API Reference | developer.brewmp.com API Reference | developer.brewmp.com


API Reference


Brew Release
Brew MP 1.0.2
See Also

This interface represents an OBEX header list. The header list can be sent optionally along with an OBEX command or OBEX response. When an application needs to send a list of headers to the remote device, it should create an instance of IOBEXHeader using IOBEXCli_CreateHeaderList() for clients, or IOBEXSrvSession_CreateHeaderList() for the server. Headers can be added to the list via the IOBEXHeader_AddString(), IOBEXHeader_AddByteSeq(), IOBEXHeader_AddU32(), and IOBEXHeader_AddByte() APIs. This header list can be sent along with the command, such as IOBEXClient_Put(). The application should call IOBEXHeader_Release() once the header has been sent with a command or response.
Headers received from the remote are encapsulated within the IOBEXHeader object. A pointer to this object may be returned to the application when the application calls IOBEXClient_GetEvent() or IOBEXSrvSession_GetEvent().The headers in the list can be retrieved by calling IOBEXHeader_GetXXX()or IOBEXHeader_GetXXXAtIndex(). After the application has parsed the headers, it should call IOBEXHeader_Release() to free the list.

Usage example:

To create an OBEX header object:
   IOBEXHeader *piHdr;
   int ret;
   ret = IOBEXCli_CreateHeaderList(pMe->pCli, &piHdr);

   if (AEE_SUCCESS == ret)
      IOBEXHeader_AddByteSeq(piHdr, AEEOBEX_HDR_BODY, data, dataLen);
      IOBEXCli_Put(pMe->pCli, piHdr, FALSE);
      // done sending the header list
To fetch OBEX headers received from the remote:
   ret = IOBEXCli_GetEvent(pMe->pCli, &event, &piHdr, &cmdStatus, &flags);

   if (piHdr != NULL)
      // optionally get the list
      IOBEXHeader_GetList(piHdr, pHdrList, 0, hdrListLen, &reqHdrListLen);
      IOBEXHeader_GetByteSeq(piHdr, AEEOBEX_HDR_BODY, &buf, bufLen, &reqBufLen);
      // done with the received header list