hwrmhaptics/hapticspluginmanager/src/hwrmhapticspluginmanager.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Haptics server plugin handler implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <ecom/ecom.h>
       
    20 #include <hwrmhapticscommands.h>
       
    21 #include <hwrmlogicalactuators.h>
       
    22 #include <centralrepository.h>
       
    23 
       
    24 #include "hwrmhapticspluginmanager.h"
       
    25 #include "hwrmhapticsclientserver.h"
       
    26 #include "hwrmhapticsservice.h"
       
    27 #include "hwrmhapticstrace.h"
       
    28 #include "hwrmhapticstransactiondata.h"
       
    29 #include "hwrmhapticsinternalcrkeys.h"
       
    30 #include "hwrmhapticsuid.h"
       
    31 
       
    32 _LIT( KPanicCategory, "HWRMHapticsPluginManager" );
       
    33 
       
    34 // HWRMHaptics uid file
       
    35 _LIT( KHapticsUidFilename, "hwrmhapticsuid.ini" );
       
    36 
       
    37 // ---------------------------------------------------------------------------
       
    38 // Two-phased constructor.
       
    39 // ---------------------------------------------------------------------------
       
    40 //
       
    41 EXPORT_C CHWRMHapticsPluginManager* CHWRMHapticsPluginManager::NewL(
       
    42                                 CHWRMHapticsCommonData& aHapticsCommonData, 
       
    43                                 TInt aRequestTimeout )
       
    44     {
       
    45     COMPONENT_TRACE( ( _L( "CHWRMHapticsPluginManager::NewL()" ) ) );
       
    46     
       
    47     CHWRMHapticsPluginManager* self = 
       
    48         new ( ELeave ) CHWRMHapticsPluginManager( aHapticsCommonData, 
       
    49                                                   aRequestTimeout );
       
    50     CleanupStack::PushL( self );
       
    51     
       
    52     self->ConstructL();
       
    53     
       
    54     CleanupStack::Pop( self );
       
    55 
       
    56     COMPONENT_TRACE( ( _L( "CHWRMHapticsPluginManager::NewL - return 0x%x" ), self ) );
       
    57 
       
    58     return self;
       
    59     }
       
    60 
       
    61 // ---------------------------------------------------------------------------
       
    62 // Destructor
       
    63 // ---------------------------------------------------------------------------
       
    64 //
       
    65 CHWRMHapticsPluginManager::~CHWRMHapticsPluginManager()
       
    66     {
       
    67     COMPONENT_TRACE( ( _L( "CHWRMHapticsPluginManager::~CHWRMHapticsPluginManager()" ) ) );
       
    68     
       
    69     if ( iPlugin )
       
    70         {
       
    71         // Cancel any ongoing requests
       
    72         while ( iTransactionList->FirstItem() )
       
    73             {
       
    74             COMPONENT_TRACE( ( _L( "CHWRMHapticsPluginManager::~CHWRMHapticsPluginManager - Canceling transaction %d" ), iTransactionList->FirstItem()->TransactionId() ) );
       
    75             TRAPD( err, CancelCommandL(
       
    76                         iTransactionList->FirstItem()->TransactionId() ) );
       
    77 
       
    78             if ( err != KErrNone )
       
    79                 {
       
    80                 COMPONENT_TRACE( ( _L( "CHWRMHapticsPluginManager::~CHWRMHapticsPluginManager - Canceling transaction %d failed" ), iTransactionList->FirstItem()->TransactionId() ) );
       
    81                 }
       
    82             }
       
    83 
       
    84         delete iPlugin;
       
    85         iPlugin = NULL;
       
    86         }
       
    87         
       
    88     delete iPluginTimer;
       
    89     // delete transaction list
       
    90     delete iTransactionList;
       
    91 
       
    92     delete iHapticsUid;
       
    93 
       
    94     delete iRepository; 
       
    95 
       
    96     COMPONENT_TRACE( ( _L( "CHWRMHapticsPluginManager::~CHWRMHapticsPluginManager - return " )) );
       
    97     }
       
    98 
       
    99 // ---------------------------------------------------------------------------
       
   100 // Handles plugin requests from sessions. Only one concurrent request 
       
   101 // is supported.
       
   102 // ---------------------------------------------------------------------------
       
   103 //
       
   104 TUint8 CHWRMHapticsPluginManager::ProcessCommandL( 
       
   105                                 TInt aCommandId,
       
   106                                 TDesC8& aData,
       
   107                                 CHWRMHapticsService* aCompletionCallback  )
       
   108     {
       
   109     COMPONENT_TRACE( ( _L( "CHWRMHapticsPluginManager::ProcessCommandL(0x%x, <aData>, 0x%x)" ), aCommandId, aCompletionCallback ) );
       
   110 
       
   111     if ( !iPlugin )
       
   112         {
       
   113         COMPONENT_TRACE( ( _L( "CHWRMHapticsPluginManager::ProcessCommandL - No actuator!" ) ) );
       
   114         User::Leave( KErrBadHandle );
       
   115         }
       
   116 
       
   117     // Generate new transaction ID.
       
   118     iTransIdCounter++; 
       
   119     if ( iTransIdCounter == 0 )
       
   120         {
       
   121         // Counter will overflow back to zero when it hits max.
       
   122         // However, zero indicates completed transaction as return value, so 
       
   123         // increase counter again.
       
   124         iTransIdCounter++; 
       
   125         }
       
   126     
       
   127     // If we run out of transIds, return server is busy.
       
   128     if ( iTransactionList->FindTransaction( iTransIdCounter, EFalse ) )
       
   129         {
       
   130         User::Leave( KErrServerBusy );
       
   131         }
       
   132 
       
   133     // Create transaction data before call in case it leaves
       
   134     TTime obsoletionTime;
       
   135     obsoletionTime.UniversalTime();
       
   136     obsoletionTime += iRequestTimeout;
       
   137     CHWRMHapticsTransactionData* data = 
       
   138         new (ELeave) CHWRMHapticsTransactionData( aCompletionCallback, 
       
   139                                                   iTransIdCounter, 
       
   140                                                   aCommandId, 
       
   141                                                   obsoletionTime );
       
   142 
       
   143     // Push transaction data to cleanup stack so that it will clean 
       
   144     // out if ProcessCommandL leaves.
       
   145     CleanupStack::PushL( data );
       
   146     
       
   147     iPlugin->ProcessCommandL( aCommandId, data->TransactionId(), aData );
       
   148     
       
   149     TUint8 retval( 0 );
       
   150 
       
   151     // data still needed, do not destroy, just pop
       
   152     CleanupStack::Pop( data );
       
   153     
       
   154     // Add data to list
       
   155     iTransactionList->AddTransaction( data );
       
   156 
       
   157     retval = data->TransactionId();
       
   158 
       
   159     // Start  timer if it is not already started
       
   160     if ( !iPluginTimer->IsActive() )
       
   161         {
       
   162         iPluginTimer->Set( iRequestTimeout );
       
   163         }
       
   164         
       
   165     COMPONENT_TRACE( ( _L( "CHWRMHapticsPluginManager::ProcessCommandL - return 0x%x" ), retval ) );         
       
   166     
       
   167     return retval;
       
   168         
       
   169     }
       
   170     
       
   171 // ---------------------------------------------------------------------------
       
   172 // Cancels the currently executing request
       
   173 // ---------------------------------------------------------------------------
       
   174 //
       
   175 void CHWRMHapticsPluginManager::CancelCommandL( TUint8 aTransId )
       
   176     {
       
   177     COMPONENT_TRACE( ( _L( "CHWRMHapticsPluginManager::CancelCommandL()" )) );
       
   178 
       
   179     if ( !iPlugin )
       
   180         {
       
   181         COMPONENT_TRACE( ( _L( "CHWRMHapticsPluginManager::CancelCommandL - No actuator!" ) ) );
       
   182         User::Leave( KErrBadHandle );
       
   183         }
       
   184     
       
   185     // Find correct transaction data and remove it from list
       
   186     CHWRMHapticsTransactionData* data = 
       
   187         static_cast<CHWRMHapticsTransactionData*>(
       
   188             iTransactionList->FindTransaction( aTransId, ETrue ) );
       
   189    
       
   190     // cancel request timer if no more transactions open
       
   191     if ( iTransactionList->Count() == 0 )
       
   192         {
       
   193         iPluginTimer->Cancel();
       
   194         }
       
   195 
       
   196     // If transaction is not open, do nothing
       
   197     // Do not cancel if request has no callback (i.e. final destructor 
       
   198     // state restorings)
       
   199     // (these are canceled by timeout if they do not complete successfully)
       
   200     if ( data && data->CompletionCallback() )
       
   201         {            
       
   202         CleanupStack::PushL( data );
       
   203         
       
   204         iPlugin->CancelCommandL( data->TransactionId(), data->CommandId() );
       
   205         
       
   206         // Destroy the transaction data, since transaction is over.
       
   207         CleanupStack::PopAndDestroy( data );
       
   208         }
       
   209     else
       
   210         {
       
   211         if ( data )
       
   212             {
       
   213             COMPONENT_TRACE( ( _L( "CHWRMHapticsPluginManager::CancelCommandL - Not canceled because no callback" ) ) );
       
   214             
       
   215             // Push data back to list
       
   216             iTransactionList->AddTransaction( data );
       
   217             }
       
   218         else
       
   219             {
       
   220             COMPONENT_TRACE( ( _L( "CHWRMHapticsPluginManager::CancelCommandL - Not canceled because no transaction found" ) ) );
       
   221             }
       
   222         }
       
   223         
       
   224     COMPONENT_TRACE( ( _L( "CHWRMHapticsPluginManager::CancelCommandL - return" ) ) );
       
   225     }
       
   226     
       
   227 // ---------------------------------------------------------------------------
       
   228 // Called by the plugin to inform its state. Sends notification of the state
       
   229 // to all listening clients.
       
   230 // ---------------------------------------------------------------------------
       
   231 //
       
   232 void CHWRMHapticsPluginManager::PluginEnabled( 
       
   233                                     THWRMLogicalActuators aActuator,
       
   234                                     TBool aEnabled )
       
   235     {
       
   236     MHWRMHapticsActuatorObserver::THWRMActuatorEvents event = 
       
   237         MHWRMHapticsActuatorObserver::EHWRMActuatorDisabled;
       
   238     
       
   239     if ( aEnabled )
       
   240         {
       
   241         event = MHWRMHapticsActuatorObserver::EHWRMActuatorEnabled;
       
   242         }
       
   243     
       
   244     iHapticsCommonData.BroadcastActuatorEvent( event, aActuator );
       
   245     }
       
   246 
       
   247 // ---------------------------------------------------------------------------
       
   248 // Routes response from plugin to correct service instance
       
   249 // ---------------------------------------------------------------------------
       
   250 //
       
   251 void CHWRMHapticsPluginManager::ProcessResponseL( TInt aCommandId,
       
   252                                                   TUint8 aTransId,
       
   253                                                   const TDesC8& aData  )
       
   254     {
       
   255     COMPONENT_TRACE( ( _L( "CHWRMHapticsPluginManager::ProcessResponseL(0x%x, 0x%x, <aData> )" ), aCommandId, aTransId ) );
       
   256 
       
   257     // Find and remove correct transaction data and remove it from queue
       
   258     CHWRMHapticsTransactionData* data = 
       
   259         static_cast<CHWRMHapticsTransactionData*>(
       
   260             iTransactionList->FindTransaction( aTransId, ETrue ) );
       
   261     
       
   262     // cancel request timer if no more transactions open
       
   263     if ( iTransactionList->Count() == 0 )
       
   264         {
       
   265         iPluginTimer->Cancel();
       
   266         }
       
   267 
       
   268     // If transaction is not open, response not expected.
       
   269     if ( data )
       
   270         {
       
   271         CleanupStack::PushL( data );
       
   272 
       
   273         // Check that command ID is the expected one        
       
   274         if ( data->CommandId() != aCommandId )
       
   275             {
       
   276             COMPONENT_TRACE( ( _L( "CHWRMHapticsPluginManager::ProcessResponseL - Command ID mismatch, expected: 0x%x, got 0x%x" ), data->CommandId(), aCommandId ) );
       
   277             User::Leave( KErrBadHandle );
       
   278             }
       
   279 
       
   280         // Route data to callback service if one is needed
       
   281         if ( data->CompletionCallback() )
       
   282             {
       
   283             data->CompletionCallback()->ProcessResponseL( aCommandId, 
       
   284                                                          aTransId, 
       
   285                                                          aData );
       
   286             }
       
   287         
       
   288         CleanupStack::PopAndDestroy( data );
       
   289         data = NULL;
       
   290         }
       
   291     else
       
   292         {
       
   293         // There is problem in adaptation, as unexpected transaction was completed.
       
   294         COMPONENT_TRACE( ( _L( "CHWRMHapticsPluginManager::ProcessResponseL - No transaction data found!" ) ) );
       
   295         User::Leave( KErrBadHandle );
       
   296         }
       
   297 
       
   298     COMPONENT_TRACE( ( _L( "CHWRMHapticsPluginManager::ProcessResponseL - return" ) ) );
       
   299     }
       
   300     
       
   301 // ---------------------------------------------------------------------------
       
   302 // Cancels all obsolete transactions. TimerId is irrelevant as only one timer.
       
   303 // ---------------------------------------------------------------------------
       
   304 //
       
   305 void CHWRMHapticsPluginManager::GenericTimerFired( TInt /*aTimerId*/, 
       
   306                                                    TBool /*aCutOff*/ )
       
   307     {
       
   308     COMPONENT_TRACE( ( _L( "CHWRMHapticsPluginManager::GenericTimerFired()" ) ) );
       
   309 
       
   310     __ASSERT_ALWAYS( iPlugin, User::Panic( KPanicCategory, 
       
   311                                            EPanicBadHandle ) );
       
   312 
       
   313     // Since requests are added to end of list always, they are in order 
       
   314     // of obsolescense.
       
   315     // Cancel requests that are obsolete and notify callback service
       
   316     TInt err( KErrNone );
       
   317     TTime now;
       
   318     now.UniversalTime();
       
   319 
       
   320     CHWRMHapticsTransactionData* data = 
       
   321         static_cast<CHWRMHapticsTransactionData*>( 
       
   322             iTransactionList->FirstItem() );
       
   323     
       
   324     while ( data && ( data->TransactionObsoletionTime() < now ) )   
       
   325         {
       
   326         COMPONENT_TRACE( ( _L( "CHWRMHapticsPluginManager::GenericTimerFired - Canceling obsolete transaction 0x%x" ), data->TransactionId() ) );
       
   327 
       
   328         // Cancel transaction. 
       
   329         TUint8 trId( data->TransactionId() );
       
   330         TRAP(err, iPlugin->CancelCommandL( trId, data->CommandId() ) );
       
   331 
       
   332         if ( err != KErrNone )
       
   333             {
       
   334             // Ignore errors as we cannot do anything about it 
       
   335             // anyway. Just trace.
       
   336             COMPONENT_TRACE( ( _L( "CHWRMHapticsPluginManager::GenericTimerFired - Canceling obsolete transaction FAILED (%d)!" ), err ) );
       
   337             }
       
   338 
       
   339         if ( data->CompletionCallback() )
       
   340             {
       
   341             data->CompletionCallback()->CancelRequest( trId );
       
   342             }
       
   343 
       
   344         // Destroy the transaction data, since transaction is over.
       
   345         iTransactionList->RemoveFirstItem();
       
   346         delete data;
       
   347         
       
   348         // get next data to check
       
   349         data = static_cast<CHWRMHapticsTransactionData*>(
       
   350                                     iTransactionList->FirstItem() );
       
   351         }
       
   352 
       
   353     // Restart timer if there is more transactions in list
       
   354     if ( data )
       
   355         {
       
   356         iPluginTimer->Set( iRequestTimeout );
       
   357         }
       
   358 
       
   359     COMPONENT_TRACE( ( _L( "CHWRMHapticsPluginManager::GenericTimerFired - return" ) ) );
       
   360     }
       
   361 
       
   362 // ---------------------------------------------------------------------------
       
   363 // It retrieves the supported actuator information from plugins.
       
   364 // ---------------------------------------------------------------------------
       
   365 //
       
   366 TUint32 CHWRMHapticsPluginManager::GetSupportedActuatorInfo()
       
   367     {
       
   368     return iSupActuators;
       
   369     }
       
   370 
       
   371 // ---------------------------------------------------------------------------
       
   372 // Opens the plugin appropriate for the actuator to be opened.
       
   373 // ---------------------------------------------------------------------------
       
   374 //
       
   375 TBool CHWRMHapticsPluginManager::OpenPluginToActuatorL( 
       
   376                                             THWRMLogicalActuators aActuator )
       
   377     {
       
   378     COMPONENT_TRACE( ( _L( "CHWRMHapticsPluginManager::OpenPluginToActuator - Actuator = %d " ), aActuator) );
       
   379     
       
   380     TBool created = EFalse;
       
   381 
       
   382     // check if actuator type is supported
       
   383     if ( !( aActuator & iSupActuators ) )
       
   384         {
       
   385         // not supported
       
   386         User::Leave( KErrNotSupported );
       
   387         }
       
   388 
       
   389     if ( !iPlugin )
       
   390         {
       
   391         COMPONENT_TRACE( ( _L( "CHWRMHapticsPluginManager::OpenPluginToActuator - Creating plugin instance." ) ) );
       
   392 
       
   393         // map actuator type to type cenrep id
       
   394         TInt adaptationCenrepId(0);
       
   395         switch( aActuator )
       
   396             {
       
   397             case EHWRMLogicalActuatorAny:
       
   398                 {
       
   399                 adaptationCenrepId = KHWRMHapticsPluginAnyAdaptation;
       
   400                 break;
       
   401                 }
       
   402             case EHWRMLogicalActuatorDevice:
       
   403                 {
       
   404                 adaptationCenrepId = KHWRMHapticsPluginDeviceAdaptation;
       
   405                 break;
       
   406                 }
       
   407             case EHWRMLogicalActuatorPrimaryDisplay:
       
   408                 {
       
   409                 adaptationCenrepId = KHWRMHapticsPluginPrimaryDisplayAdaptation;
       
   410                 break;
       
   411                 }
       
   412             case EHWRMLogicalActuatorSecondaryDisplay:
       
   413                 {
       
   414                 adaptationCenrepId = KHWRMHapticsPluginSecondaryDisplayAdaptation;
       
   415                 break;
       
   416                 }
       
   417             case EHWRMLogicalActuatorGame:
       
   418                 {
       
   419                 adaptationCenrepId = KHWRMHapticsPluginGameAdaptation;
       
   420                 break;
       
   421                 }
       
   422             case EHWRMLogicalActuatorGameLeft:
       
   423                 {
       
   424                 adaptationCenrepId = KHWRMHapticsPluginGameLeftAdaptation;
       
   425                 break;
       
   426                 }
       
   427             case EHWRMLogicalActuatorGameRight:
       
   428                 {
       
   429                 adaptationCenrepId = KHWRMHapticsPluginGameRightAdaptation;
       
   430                 break;
       
   431                 }
       
   432             case EHWRMLogicalActuatorExternalVibra:
       
   433                 {
       
   434                 adaptationCenrepId = KHWRMHapticsPluginExternalVibraAdaptation;
       
   435                 break;
       
   436                 }
       
   437             default:
       
   438                 adaptationCenrepId = KHWRMHapticsPluginAnyAdaptation;
       
   439                 break;
       
   440            }
       
   441 
       
   442         TInt adaptationPluginUid( 0 );
       
   443         User::LeaveIfError( iRepository->Get( adaptationCenrepId, 
       
   444                                               adaptationPluginUid ) );
       
   445 
       
   446         // create plugin instance with the given uid
       
   447         TRAPD( err, iPlugin = CHWRMHapticsPluginService::NewL( 
       
   448                                   TUid::Uid( adaptationPluginUid ), this ) );
       
   449 
       
   450         // if the plugin with given uid was not found, the 
       
   451         // actuator type is not supported
       
   452         if ( err == KErrNotFound )
       
   453             {
       
   454             err = KErrNotSupported;
       
   455             }
       
   456         
       
   457         User::LeaveIfError( err );
       
   458         
       
   459         created = ETrue;
       
   460         }
       
   461     
       
   462     return created;
       
   463     }
       
   464 
       
   465 // ---------------------------------------------------------------------------
       
   466 // Checks if automatic license setting is allowed. The actual check is done
       
   467 // in CHWRMHapticsUid helper class.
       
   468 // ---------------------------------------------------------------------------
       
   469 //
       
   470 TBool CHWRMHapticsPluginManager::LicenseAutoSettingAllowed( 
       
   471     const RMessage2& aMessage )
       
   472     {
       
   473     return iHapticsUid->LicenseAutoSetAllowed( aMessage );
       
   474     }
       
   475 
       
   476 // ---------------------------------------------------------------------------
       
   477 // C++ constructor
       
   478 // ---------------------------------------------------------------------------
       
   479 //
       
   480 CHWRMHapticsPluginManager::CHWRMHapticsPluginManager( 
       
   481                                 CHWRMHapticsCommonData& aHapticsCommonData, 
       
   482                                 TInt aRequestTimeout )
       
   483     : iHapticsCommonData( aHapticsCommonData ), 
       
   484       iTransIdCounter( 0 ),
       
   485       iRequestTimeout( aRequestTimeout )
       
   486     {
       
   487     }
       
   488 
       
   489 // ---------------------------------------------------------------------------
       
   490 // 2nd phase constructor.
       
   491 // ---------------------------------------------------------------------------
       
   492 //
       
   493 void CHWRMHapticsPluginManager::ConstructL()
       
   494     {
       
   495     COMPONENT_TRACE( ( _L( "CHWRMHapticsPluginManager::ConstructL(<aMatch>)" )) );
       
   496 
       
   497     // create transaction list and timer
       
   498     iTransactionList = new( ELeave ) CHWRMHapticsPluginTransactionList();
       
   499     iPluginTimer = CHWRMHapticsGenericTimer::NewL( this, iRequestTimeout, 0 );
       
   500 
       
   501     iRepository = CRepository::NewL( KCRUidHWRMHapticsPlugins ); 
       
   502 
       
   503     // get all supported actuator information
       
   504     iSupActuators = FindSupportedActuatorInfoL();
       
   505     
       
   506     // create UID file parser
       
   507     iHapticsUid = CHWRMHapticsUid::NewL( KHapticsUidFilename );
       
   508     
       
   509     COMPONENT_TRACE( ( _L( "CHWRMHapticsPluginManager::ConstructL - return" )) );
       
   510     }
       
   511 
       
   512 // ---------------------------------------------------------------------------
       
   513 // Finds the supported actuator information from plugins.
       
   514 // ---------------------------------------------------------------------------
       
   515 //
       
   516 TUint32 CHWRMHapticsPluginManager::FindSupportedActuatorInfoL()
       
   517     {
       
   518     TUint32 supportedActuators( 0 );
       
   519     
       
   520     // Any
       
   521     AddInfoIfSupportedL( KHWRMHapticsPluginAnyAdaptation, 
       
   522                          EHWRMLogicalActuatorAny, 
       
   523                          supportedActuators );
       
   524 
       
   525     // Device
       
   526     AddInfoIfSupportedL( KHWRMHapticsPluginDeviceAdaptation, 
       
   527                          EHWRMLogicalActuatorDevice, 
       
   528                          supportedActuators );
       
   529 
       
   530     // Primary Display
       
   531     AddInfoIfSupportedL( KHWRMHapticsPluginPrimaryDisplayAdaptation, 
       
   532                          EHWRMLogicalActuatorPrimaryDisplay, 
       
   533                          supportedActuators );
       
   534 
       
   535     // Secondary Display
       
   536     AddInfoIfSupportedL( KHWRMHapticsPluginSecondaryDisplayAdaptation, 
       
   537                          EHWRMLogicalActuatorSecondaryDisplay, 
       
   538                          supportedActuators );
       
   539 
       
   540     // Game
       
   541     AddInfoIfSupportedL( KHWRMHapticsPluginGameAdaptation, 
       
   542                          EHWRMLogicalActuatorGame, 
       
   543                          supportedActuators );
       
   544 
       
   545     // Game Left
       
   546     AddInfoIfSupportedL( KHWRMHapticsPluginGameLeftAdaptation, 
       
   547                          EHWRMLogicalActuatorGameLeft, 
       
   548                          supportedActuators );
       
   549 
       
   550     // Game Right
       
   551     AddInfoIfSupportedL( KHWRMHapticsPluginGameRightAdaptation, 
       
   552                          EHWRMLogicalActuatorGameRight, 
       
   553                          supportedActuators );
       
   554 
       
   555     // External Vibra
       
   556     AddInfoIfSupportedL( KHWRMHapticsPluginExternalVibraAdaptation, 
       
   557                          EHWRMLogicalActuatorExternalVibra, 
       
   558                          supportedActuators );
       
   559 
       
   560     return supportedActuators;
       
   561     }
       
   562 
       
   563 // ---------------------------------------------------------------------------
       
   564 // If given actuator type is found, adds it to the actuator mask integer.
       
   565 // ---------------------------------------------------------------------------
       
   566 //
       
   567 void CHWRMHapticsPluginManager::AddInfoIfSupportedL( TInt aMatch,
       
   568                                                 THWRMLogicalActuators aMask,
       
   569                                                 TUint32& aActuators )
       
   570     {
       
   571     TInt pluginUid( 0 );
       
   572     User::LeaveIfError( iRepository->Get( aMatch, pluginUid ) );
       
   573 
       
   574     // if the adaptation plugin UID is not zero, implementation is found,
       
   575     // i.e. actuator is supported
       
   576     if( pluginUid != 0 ) 
       
   577         {
       
   578         // add actuator to the mask
       
   579         aActuators = aActuators | aMask;
       
   580         }    
       
   581     }
       
   582 
       
   583 //  End of File