AIW Generic Parameters API
Article Metadata
Code Example
Article
The AIW Generic Parameter API can be used to provide the means for handling AIW generic parameters to the AIW consumer applications. The generic parameters are used for transferring data between AIW consumers and providers.
Use cases
The main uses of AIW Generic parameter API are the following:
Creating a generic parameter list with basic types
Creating a generic parameter list with provider specific objects.
Example code
Creating a generic parameter list with basic types
The example code here demonstrates how to create a generic parameter list and fill it with file name (descriptor) and error code (integer) items. This is the way how to pass the most common types of parameters to the AIW providers that do not need provider specific objects.
Header files
#include <AiwGenericParam.h>// Create a list and put it into the cleanup stack.
CAiwGenericParamList* list = CAiwGenericParamList::NewLC();
// Set up and append file name parameter.
_LIT(KMyFileName, "c:\\data\\testfile.txt");
TFileName filename(KMyFileName);
TAiwGenericParam param(EGenericParamFile);
param.Value().Set(filename);
list->AppendL(param);
// Set up and append error code parameter.
param.Reset();
param.SetSemanticId(EGenericParamError);
param.Value().Set(KErrNotFound);
list->AppendL(param);
// The list can now be passed e.g. by calling Service Handler's
// ExecuteMenuCmdL() or ExecuteServiceCmdL().
// Pop and destroy the list when it is not needed anymore.
CleanupStack::PopAndDestroy(list);
There may be as many items as required on the list with the same semantic id. The receiving application uses iterator methods in the CAiwGenericParamList class for accessing data items on the list.
The AIW framework contains convenience methods for creating input and output lists. By using the lists, the consumer application does not have to take care of allocating the list from a heap or deleting it afterwards. The only limitation is that only one input and one output list can be requested simultaneously. If more are required, the consumer application must create and delete them by itself. The methods for creating input and output lists are defined as follows:
CAiwGenericParamList& CAiwServiceHandler::InParamListL();
CAiwGenericParamList& CaiwServiceHandler::OutParamListL();
Creating a generic parameter list with provider specific objects
If a provider specific class or struct needs to be transferred between a consumer and a provider, it needs to be serialized by using e.g. a TPtrC8 or TPckg type before adding it to a generic parameter list. The variant type id EVariantTypeDesC8 should be used for these kind of parameters. It should also be noted that the AIW framework does not support passing pointers. See Map and Navigation AIW provider documentation for an example.

