hwrmhaptics/hapticsclient/src/hwrmhapticsivtdatacacheao.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:  Implementation of haptics client's IVT-data cache's internal
       
    15 *                Active Object.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #include "hwrmhapticsivtdatacache.h"
       
    21 #include "hwrmhapticsivtdatacacheao.h"
       
    22 #include "hwrmhapticssession.h"
       
    23 #include "hwrmhapticsclientserver.h"
       
    24 
       
    25 // ---------------------------------------------------------------------------
       
    26 // Two-phase constructor.
       
    27 // ---------------------------------------------------------------------------
       
    28 //
       
    29 CHWRMHapticsIVTDataCacheAO* CHWRMHapticsIVTDataCacheAO::NewL(
       
    30         TInt aFileHandle, 
       
    31         CHWRMHapticsIVTDataCache* aCache,
       
    32         TRequestStatus& aStatus )
       
    33     {        
       
    34     CHWRMHapticsIVTDataCacheAO* self =
       
    35         CHWRMHapticsIVTDataCacheAO::NewLC( aFileHandle, aCache, aStatus );
       
    36     CleanupStack::Pop( self );
       
    37 
       
    38     return self;      
       
    39     }
       
    40     
       
    41 // ---------------------------------------------------------------------------
       
    42 // Two-phase asynchronous constructor.
       
    43 // ---------------------------------------------------------------------------
       
    44 //
       
    45 CHWRMHapticsIVTDataCacheAO* CHWRMHapticsIVTDataCacheAO::NewLC(
       
    46         TInt aFileHandle, 
       
    47         CHWRMHapticsIVTDataCache* aCache,
       
    48         TRequestStatus& aStatus )
       
    49     {
       
    50     CHWRMHapticsIVTDataCacheAO* self = 
       
    51         new ( ELeave ) CHWRMHapticsIVTDataCacheAO( 
       
    52             aFileHandle, aCache, aStatus );
       
    53     CleanupStack::PushL( self );
       
    54     
       
    55     self->ConstructL();
       
    56 
       
    57     return self;
       
    58     }
       
    59 
       
    60 // ---------------------------------------------------------------------------
       
    61 // Destructor.
       
    62 // ---------------------------------------------------------------------------
       
    63 //
       
    64 CHWRMHapticsIVTDataCacheAO::~CHWRMHapticsIVTDataCacheAO()
       
    65     {
       
    66     Cancel();
       
    67     }
       
    68 
       
    69 // ---------------------------------------------------------------------------
       
    70 // Makes the async play call using this AO's own status
       
    71 // ---------------------------------------------------------------------------
       
    72 //
       
    73 void CHWRMHapticsIVTDataCacheAO::PlayEffectAsynch( 
       
    74         RHWRMHapticsSession* aClientSession,
       
    75         const TIpcArgs& aArgs )
       
    76     {
       
    77     aClientSession->ExecuteAsyncOperation( EHWRMHapticsPlayEffect,
       
    78                                            aArgs,
       
    79                                            iStatus );
       
    80     SetActive();                                       
       
    81     }
       
    82 
       
    83 // ---------------------------------------------------------------------------
       
    84 // RunL for this active object.
       
    85 // ---------------------------------------------------------------------------
       
    86 //
       
    87 void CHWRMHapticsIVTDataCacheAO::RunL()
       
    88     {
       
    89     TInt status( iStatus.Int() );
       
    90     if ( KErrNone == status )
       
    91         {
       
    92         iCache->UpdateCacheItem( iFileHandle, ETrue );
       
    93         }
       
    94 
       
    95     User::RequestComplete( iClientStatus, status );
       
    96     
       
    97     iCache->RequestGarbageCollection();
       
    98     }
       
    99     
       
   100 // ---------------------------------------------------------------------------
       
   101 // DoCancel for this active object.
       
   102 // ---------------------------------------------------------------------------
       
   103 //
       
   104 void CHWRMHapticsIVTDataCacheAO::DoCancel()
       
   105     {
       
   106     }
       
   107 
       
   108 // ---------------------------------------------------------------------------
       
   109 // DoCancel for this active object.
       
   110 // ---------------------------------------------------------------------------
       
   111 //
       
   112 TInt CHWRMHapticsIVTDataCacheAO::RunError( TInt /* aError */ )
       
   113     {   
       
   114     return KErrNone;
       
   115     }
       
   116 
       
   117 // ---------------------------------------------------------------------------
       
   118 // C++ constructor.
       
   119 // ---------------------------------------------------------------------------
       
   120 //
       
   121 CHWRMHapticsIVTDataCacheAO::CHWRMHapticsIVTDataCacheAO(
       
   122         TInt aFileHandle, 
       
   123         CHWRMHapticsIVTDataCache* aCache, 
       
   124         TRequestStatus& aStatus )
       
   125     : CActive( EPriorityStandard ), 
       
   126       iFileHandle( aFileHandle ),
       
   127       iCache( aCache ), 
       
   128       iClientStatus( &aStatus )
       
   129     {
       
   130     aStatus = KRequestPending;
       
   131     CActiveScheduler::Add( this );
       
   132     }
       
   133 
       
   134 // ---------------------------------------------------------------------------
       
   135 // Second phase construction.
       
   136 // ---------------------------------------------------------------------------
       
   137 //
       
   138 void CHWRMHapticsIVTDataCacheAO::ConstructL()
       
   139     {
       
   140     }
       
   141 
       
   142 //  End of File