Share via


Retrieving Last Error Code For OBEX (Windows Embedded CE 6.0)

1/6/2010

During send and receive operations, some applications may need to retrieve the last error code indicated by the OBEX server. The response is an 8-bit code that is defined in the official OBEX specification available at this Official IrDA Web site.

**To retrieve the last error code, call IUnknown::QueryInterface on the IStream object that was used for sending and receiving the raw data by passing IID_IObexResponse in the iid parameter.

QueryInterface returns an IObexResponse:IUnknown object that can be used to retrieve the last response code.

Note

IObexResponse object can only be used for stream operations.

The following code example shows how to retrieve the last response code.

// Assume that pMyStream has already been initialized
IObexResponse *pResp; 
BYTE lastResponse; 

hr = pMyStream->QueryInterface(IID_IObexResponse,(void**)&pResp);
if (FAILED(hr))
         goto cleanup; 

hr = pResp->GetLastResponseCode(&lastResponse); 
if (FAILED(hr)) 
         goto cleanup;

The application can call the IObexResponse::GetLastResponseCode method, to determine the last response code, at any point during a send and receive operation. **

See Also

Concepts

Client Support

Other Resources

OBEX Application Development