Aborting a Request (Windows Embedded CE 6.0)

1/6/2010

The IObexDevice::Abort method is used to terminate a multi-packet IObexDevice::Put or IObexDevice::Get request. Abort passes the service header to the server.

The following code example, which shows how to abort a request, is an excerpt from the sample function, FetchFile, that is defined in filebrowser.h.

For Windows Embedded CE, the filebrowser.h file is at %_WINCEROOT%\Public\Servers\SDK\Samples\OBEX\OBEXTOOL.

Ee495248.note(en-US,WinEmbedded.60).gifNote:
To make the following code example easier to read, error checking is not included. This code example should not be used in a release configuration unless it has been modified to include secure error handling.
IHeaderCollection *pAbortHeaderCollection = NULL;
IObexDevice *pObexDevice = NULL;
If(SUCCEEDED(CoCreateInstance(CLSID_HeaderCollection, 
                   NULL, 
                   CLSCTX_INPROC_SERVER, 
                   IID_IHeaderCollection,
                   (void**)&pAbortHeaderCollection)) 
                   && NULL !=pAbortHeaderCollection)
{
  pObexDevice->Abort(pAbortHeaderCollection);
  pAbortHeaderCollection->Release();
}

Because additional headers are not used with the Abort request packet, the packet length should always be three.

The Abort request and response each fit in one OBEX packet, and have the final bit set.

If the Abort request is successful, the response code is 0xA0 and the server is resynchronized with the client. If any other response is returned, the client should disconnect.

Community Additions

ADD
Show: