sapi_applicationmanager/tsrc/testing/tappmgrprovider/src/testappobserver.cpp
changeset 0 14df0fbfcc4e
equal deleted inserted replaced
-1:000000000000 0:14df0fbfcc4e
       
     1 /*
       
     2 * Copyright (c) 2007-2007 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 the License "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:  This Class is observer for the Launching Application
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32const.h>
       
    20 #include "testappobserver.h"
       
    21 _LIT8(KResponse,"ReturnValue");
       
    22 _LIT8(KErrorCode,"ErrorCode");
       
    23 
       
    24 // -----------------------------------------------------------------------------
       
    25 // CAppObserver::NewL
       
    26 // Returns the instance of CLauncherObserver.
       
    27 // -----------------------------------------------------------------------------
       
    28 CAppObserver* CAppObserver::NewL(CActiveSchedulerWait * aWait)
       
    29 	{
       
    30 	CAppObserver* self = new( ELeave ) CAppObserver(aWait);
       
    31 	return self;
       
    32 	}
       
    33 
       
    34 
       
    35 // ---------------------------------------------------------------------------
       
    36 // call back
       
    37 // ---------------------------------------------------------------------------
       
    38 //
       
    39 TInt CAppObserver :: HandleNotifyL( TInt /*aCmdId*/, TInt aEventId, CLiwGenericParamList& aEventParamList,const CLiwGenericParamList& /*aInParamList*/)
       
    40 
       
    41     {
       
    42     iCancel = EFalse;
       
    43     if ( aEventId == KLiwEventCanceled  )
       
    44         {
       
    45             iCancel = ETrue;
       
    46             
       
    47         }
       
    48     
       
    49     if ( aEventId == KLiwEventCompleted )   
       
    50         {
       
    51         const TLiwGenericParam* p= NULL;
       
    52         TInt pos = 0;
       
    53             
       
    54         p = aEventParamList.FindFirst(pos, KErrorCode ); // Finding Error Code
       
    55         
       
    56         if(p)
       
    57             {
       
    58             iErrorReturn = p->Value().AsTInt32();
       
    59             }
       
    60         else
       
    61             {
       
    62             iErrorReturn = KErrGeneral; 
       
    63             }
       
    64         
       
    65         
       
    66         
       
    67         pos = 0;
       
    68         p = aEventParamList.FindFirst(pos, KResponse ); // Finding Error Code
       
    69         
       
    70         if( p )
       
    71             {
       
    72             iReason = p->Value().AsTInt32();
       
    73             }
       
    74        		  iWait->AsyncStop();
       
    75         }
       
    76     
       
    77      
       
    78   
       
    79     }
       
    80 
       
    81 
       
    82 
       
    83 
       
    84 // ---------------------------------------------------------------------------
       
    85 // consturctor
       
    86 // ---------------------------------------------------------------------------
       
    87 //
       
    88 CAppObserver::CAppObserver(CActiveSchedulerWait * aWait )
       
    89 	{
       
    90 	 iWait = aWait;
       
    91 	 iReason = 10 ; //Reason of failure can be either 0 or some negative valuw which incater 
       
    92 	 //error but it cant be greater than 0 
       
    93 	}