Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Responsibilities of Asynchronous Service Provider in Active Objects

From Wiki
Jump to: navigation, search
Article Metadata
Created: wantrahul (25 Feb 2010)
Last edited: hamishwillee (26 Jul 2012)

Asynchronous Service Provider provides asynchronous services using request functions and cancel functions. In general, Symbian Active Objects encapsulate Asynchronous Service Providers and their request, cancel functions and the function which handles completion of requests.

An asynchronous service provider must interact in the following ways with its clients:

  • Before initiating a request, a request function must set the value of the passed TRequestStatus to KRequestPending, which indicates that a request has been issued but not completed.
  • Requests must be completed by signaling the requesting thread’s request semaphore by calling RThread::RequestComplete() with the TRequestStatus as the first parameter and the completion code as the second parameter (which is placed in the TRequestStatus).
  • There must be a cancel function which can cancel an outstanding request. In some cases, calling the cancel function does not cancel the operation because the request is already complete. In all cases, the request must be complete before the return of the Cancel() function.
  • If an asynchronous request is made, it must complete precisely once, whether normally, abnormally, or through cancellation.
  • A TRequestStatus code of KErrCancel often indicates completion through cancellation.
This page was last modified on 26 July 2012, at 05:03.
30 page views in the last 30 days.