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 over the next few weeks. Thanks for all your past and future contributions.

Revision as of 04:31, 30 May 2013 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

AIW Service Handler API

From Wiki
Jump to: navigation, search
Article Metadata
Code ExampleCompatibility
Created: ltomuta (16 Jun 2007)
Last edited: hamishwillee (30 May 2013)

Note.pngNote: :This API is not part of the public SDK. It can be found in the SDK API Plug-in.

The purpose of the AIW Service Handler API is to offer the core functionality of the Application Interworking framework to the AIW consumer applications. This is done by using a Service Handler object, which is the core of the AIW framework.

Use cases

The most important use cases of AIW Service Handler API are the following:

Creating a Service Handler instance

Attaching interests

Base services 
Menu services 

Initializing menu pane

Executing service commands

Base service commands

Menu service commands

Deleting the Service Handler instance

Example code

Creating a Service Handler instance For using AIW Service Handler API, the consumer application needs first to create a Service Handler instance.

// Create a service handler instance.
iServiceHandler = CAiwServiceHandler::NewL();

Attaching interests

When the Service Handler instance exists, the consumer application's interest must be attached to it before AIW service commands can be executed. Attach needs usually be done only once, and a good place for it is the consumer application's ConstructL() method.

Base services

Base service interests can be attached by using CAiwServiceHandler::AttachL().

// Attach base service interests. 

The interest is defined in a resource file, see AIW Criteria API for details.

Menu services

Menu service interests can be attached by using CAiwServiceHandler::AttachMenuL().


A menu pane and an interest containing menu related criteria items need to be defined in a resource file, see AIW Criteria API for details.

Initializing Menu pane

Menu pane containing AIW menu items needs to be initialized. This is done in consumer application's DynInitMenuPaneL() method. See example below:

void CAIWExampleAppUi::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane *aMenuPane )
// First, offer menu pane to AIW framework. It might be the case, that the
// user is opening an AIW submenu. In this case, the AIW handles the menu.
if ( iServiceHandler->HandleSubmenuL( *aMenuPane ) )
// Add your normal (non-AIW) menu initialisation code here...
// Let AIW provider add its menu items to the menu.

In this case, the menu may contain an AIW submenu (i.e. a submenu containing only AIW menu items). The submenu is handled by the AIW framework, so if CAiwServiceHandler::HandleSubmenuL() returns ETrue, nothing needs to be done.

The actual menu pane initialization is done by CAiwServiceHandler::InitializeMenuPaneL(). Note that the EAIWExampleCmdLast should be defined as the last enumeration value, the Service Handler uses it as the basis of the menu command ids it generates.

Executing service commands

AIW service commands can be executed by calling CAiwServiceHandler::ExecuteServiceCmdL() for base services, and CAiwServiceHandler::ExecuteMenuCmdL() for menu services. The methods are blocking by default. However, it is also possible that a provider works asynchronously. In that case, the consumer can implement a callback method, which is called when the provider finishes, for example. See AIW Criteria API for more details of asynchronous service calls.

Base service commands

Base service commands can be executed by calling CAiwServiceHandler::ExecuteServiceCmdL(). An example is shown below (see AIW Generic Parameter API for how to set up input parameters):

KAiwCmdMnShowMap, // The service command.
inParamList, // Input parameter list.
iServiceHandler->OutParamListL(), // No output parameters used.
0, // No options used.
NULL); // No need for callback

Menu service commands

The consumer application's "AppUI" class has a callback method HandleCommandL(TInt aCommand). When it is called, the consumer application should first try to identify if the command is a normal menu command. If the command is not recognized, it should be forwarded to the AIW framework. This is usually done in the default branch of the switch statement.

void CAIWExampleAppUi::HandleCommandL(TInt aCommand)
case ESomeNonAIWCommand:
// Execute command.
// ...
case EEikCmdExit:
// Forward the command id to AIW, i.e. execute AIW menu
// service command.
iServiceHandler->InParamListL() // No input parameters
iServiceHandler->OutParamListL(), // No output parameters
0, // No options used.
NULL); // No need for callback

Deleting the Service Handler instance

The Service Handler instance needs to be deleted when it is not used anymore. Usually this is done in the destructor of the consumer application.

// Delete the service handler instance.
delete iServiceHandler;

Example project


This page was last modified on 30 May 2013, at 04:31.
70 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.