lbs/lbstestutils/src/ctlbsasyncwaiter.cpp
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     1 // Copyright (c) 2006-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 the License "Symbian Foundation License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // @file ctlbsasyncwaiter.cpp
       
    15 // 
       
    16 //
       
    17 
       
    18 // User includes
       
    19 #include "ctlbsasyncwaiter.h"
       
    20 
       
    21 
       
    22 /**
       
    23   Function : NewL
       
    24   Description : Creates an object of CT_LbsAsyncWaiter
       
    25   @internalTechnology
       
    26   @param :
       
    27   @return : N/A
       
    28   @precondition : none
       
    29   @postcondition : none
       
    30 */
       
    31 EXPORT_C CT_LbsAsyncWaiter* CT_LbsAsyncWaiter::NewL()
       
    32 	{
       
    33 	CT_LbsAsyncWaiter* self = new(ELeave) CT_LbsAsyncWaiter();
       
    34 	return self;
       
    35 	}
       
    36 
       
    37 	
       
    38 /**
       
    39   Function : CT_LbsAsyncWaiter
       
    40   Description : Constructor
       
    41   @internalTechnology
       
    42   @param :
       
    43   @return : N/A
       
    44   @precondition : none
       
    45   @postcondition : none
       
    46 */
       
    47 CT_LbsAsyncWaiter::CT_LbsAsyncWaiter() : CActive(EPriorityStandard)
       
    48 	{
       
    49 	CActiveScheduler::Add(this);
       
    50 	}	
       
    51 
       
    52 
       
    53 /**
       
    54   Function : CT_LbsAsyncWaiter
       
    55   Description : Destructor
       
    56   @internalTechnology
       
    57   @param :
       
    58   @return : N/A
       
    59   @precondition : none
       
    60   @postcondition : none
       
    61 */
       
    62 CT_LbsAsyncWaiter::~CT_LbsAsyncWaiter()
       
    63 	{
       
    64 	Cancel();
       
    65 	}
       
    66 
       
    67 	
       
    68 /**
       
    69   Function : StartAndWait
       
    70   Description : Starts the Active scheduler
       
    71   @internalTechnology
       
    72   @param :
       
    73   @return : N/A
       
    74   @precondition : none
       
    75   @postcondition : none
       
    76 */
       
    77 EXPORT_C void CT_LbsAsyncWaiter::StartAndWait()
       
    78 	{
       
    79 	SetActive();
       
    80 	iError = iStatus.Int();
       
    81 	CActiveScheduler::Start();
       
    82 	}
       
    83 	
       
    84 	
       
    85 /**
       
    86   Function : Result
       
    87   Description : Gives the error
       
    88   @internalTechnology
       
    89   @param :
       
    90   @return : N/A
       
    91   @precondition : none
       
    92   @postcondition : none
       
    93 */
       
    94 EXPORT_C TInt CT_LbsAsyncWaiter::Result() const
       
    95 	{
       
    96 	return iError;
       
    97 	}
       
    98 	
       
    99 	
       
   100 /**
       
   101   Function : RunL
       
   102   Description : 
       
   103   @internalTechnology
       
   104   @param :
       
   105   @return : N/A
       
   106   @precondition : none
       
   107   @postcondition : none
       
   108 */
       
   109 void CT_LbsAsyncWaiter::RunL()
       
   110 	{
       
   111 	iError = iStatus.Int();
       
   112 	CActiveScheduler::Stop();
       
   113 	}
       
   114 
       
   115 	
       
   116 /**
       
   117   Function : DoCancel
       
   118   Description : 
       
   119   @internalTechnology
       
   120   @param :
       
   121   @return : N/A
       
   122   @precondition : none
       
   123   @postcondition : none
       
   124 */
       
   125 void CT_LbsAsyncWaiter::DoCancel()
       
   126 	{
       
   127 	iError = KErrCancel;
       
   128 	CActiveScheduler::Stop();
       
   129 	}