serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertest/src/tprovidertestobserver.cpp
changeset 5 989d2f495d90
child 38 ea43c23d28d2
equal deleted inserted replaced
1:a36b1e19a461 5:989d2f495d90
       
     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 
       
    20 #include <e32const.h>
       
    21 #include "tprovidertestobserver.h"
       
    22 _LIT8(KResponse,"ReturnValue");
       
    23 _LIT8(KErrorCode,"ErrorCode");
       
    24 
       
    25 // -----------------------------------------------------------------------------
       
    26 // CProviderObserver::NewL
       
    27 // Returns the instance of CLauncherObserver.
       
    28 // -----------------------------------------------------------------------------
       
    29 CProviderObserver* CProviderObserver::NewL()
       
    30 	{
       
    31 	CProviderObserver* self = new( ELeave ) CProviderObserver();
       
    32 	return self;
       
    33 	}
       
    34 
       
    35 
       
    36 // ---------------------------------------------------------------------------
       
    37 // call back
       
    38 // ---------------------------------------------------------------------------
       
    39 //
       
    40 TInt CProviderObserver :: HandleNotifyL( TInt /*aCmdId*/, TInt aEventId, CLiwGenericParamList& aEventParamList,const CLiwGenericParamList& /*aInParamList*/)
       
    41 
       
    42     {
       
    43     
       
    44     iCancel = EFalse;
       
    45     if ( aEventId == KLiwEventCanceled  )
       
    46         {
       
    47             iCancel = ETrue;
       
    48             
       
    49         }
       
    50     
       
    51     if ( aEventId == KLiwEventCompleted )   
       
    52         {
       
    53         const TLiwGenericParam* p= NULL;
       
    54         TInt pos = 0;
       
    55             
       
    56         p = aEventParamList.FindFirst(pos, KErrorCode ); // Finding Error Code
       
    57         
       
    58         if(p)
       
    59             {
       
    60             iErrorReturn = p->Value().AsTInt32();
       
    61             }
       
    62         else
       
    63             {
       
    64             iErrorReturn = KErrGeneral; 
       
    65             }
       
    66         if(needtoleave)
       
    67             {
       
    68              if(iWait)
       
    69          		iWait->AsyncStop();
       
    70              User::Leave(KErrGeneral);
       
    71             }
       
    72   
       
    73         }
       
    74       
       
    75       if(iWait)
       
    76          iWait->AsyncStop();
       
    77     }
       
    78 
       
    79 
       
    80 
       
    81 
       
    82 // ---------------------------------------------------------------------------
       
    83 // consturctor
       
    84 // ---------------------------------------------------------------------------
       
    85 //
       
    86 CProviderObserver::CProviderObserver( )
       
    87 	{
       
    88 	iWait= NULL;
       
    89 	needtoleave = EFalse;
       
    90 	}
       
    91 // ---------------------------------------------------------------------------
       
    92 // consturctor
       
    93 // ---------------------------------------------------------------------------
       
    94 //
       
    95 void CProviderObserver::SetWait(CActiveSchedulerWait *aWait )
       
    96 	{
       
    97 	iWait = aWait;
       
    98 	}