commonappservices/alarmservertest/TestMultipleAlarmsSuite/src/ProgressCallBack.cpp
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Contains implementation of CProgressCallBack class
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalTechnology 
       
    21 */
       
    22 
       
    23 // User Include
       
    24 #include "ProgressCallBack.h"
       
    25 
       
    26 /**
       
    27 Constructor. Initializes the request status object, and adds itself to 
       
    28 the active scheduler
       
    29 @param aRequestStatus The reference to the request status object, on whom 
       
    30 the caller will wait for completion
       
    31 @internalTechnology
       
    32 @test
       
    33 */
       
    34 CProgressCallBack::CProgressCallBack(TRequestStatus& aRequestStatus)
       
    35 : CActive(EPriorityStandard), iRequestStatus(aRequestStatus)
       
    36 	{
       
    37 	iRequestStatus = KRequestPending;
       
    38 	CActiveScheduler::Add(this);
       
    39 	}
       
    40 
       
    41 /**
       
    42 From MCalProgressCallBack. Does nothing
       
    43 @internalTechnology
       
    44 @test
       
    45 */
       
    46 void CProgressCallBack::Progress(TInt /*aPercentageCompleted*/)
       
    47 	{
       
    48 	}
       
    49 
       
    50 /**
       
    51 From MCalProgressCallBack. Sets this active object to be active and completes
       
    52 the external request status object. which was passed while constructing us.
       
    53 Also completes the iStatus of this active object.
       
    54 @internalTechnology
       
    55 @test
       
    56 */
       
    57 void CProgressCallBack::Completed(TInt aError)
       
    58 	{
       
    59 	SetActive();
       
    60 	
       
    61 	// Complete the external request
       
    62 	TRequestStatus* status = &iRequestStatus;
       
    63 	User::RequestComplete(status, aError);
       
    64 	
       
    65 	// Complete this Active Object
       
    66 	status = &iStatus;
       
    67 	User::RequestComplete(status, KErrNone);
       
    68 	}
       
    69 	
       
    70 /**
       
    71 From MCalProgressCallBack. Does nothing
       
    72 @internalTechnology
       
    73 @test
       
    74 */
       
    75 TBool CProgressCallBack::NotifyProgress()
       
    76 	{
       
    77 	return ETrue;
       
    78 	}
       
    79 	
       
    80 /**
       
    81 From CActive. Stops the current nested loop as we are done
       
    82 @internalTechnology
       
    83 @test
       
    84 */
       
    85 void CProgressCallBack::RunL()	
       
    86 	{
       
    87 	CActiveScheduler::Stop();
       
    88 	}
       
    89 
       
    90 /**
       
    91 From CActive. Completes the external request with a KErrCancel
       
    92 Stops the current nested loop as we are done
       
    93 @internalTechnology
       
    94 @test
       
    95 */
       
    96 void CProgressCallBack::DoCancel()
       
    97 	{
       
    98 	TRequestStatus* status = &iRequestStatus;
       
    99 	User::RequestComplete(status, KErrCancel);
       
   100 	CActiveScheduler::Stop();
       
   101 	}
       
   102