|
S60 3rd Edition SDK for Symbian OS Example Applications Guide |
00001 /* 00002 * ============================================================================== 00003 * Name : LandmarksLmOpWrapper.cpp 00004 * Part of : Landmark Reference Application 00005 * Interface : - 00006 * Description : Implements the CLandmarksLmOpWrapper class 00007 * Version : 1.0 00008 * 00009 * Copyright (c) 2004-2006 Nokia Corporation. 00010 * This material, including documentation and any related 00011 * computer programs, is protected by copyright controlled by 00012 * Nokia Corporation. 00013 * ============================================================================== 00014 */ 00015 00016 // INCLUDE FILES 00017 #include <EPos_Landmarks.h> 00018 #include <Epos_CPosLmOperation.h> 00019 00020 #include "LandmarksLmOpWrapper.h" 00021 00022 // ============================ MEMBER FUNCTIONS =============================== 00023 00024 // ----------------------------------------------------------------------------- 00025 // CLandmarksLmOpWrapper::CLandmarksLmOpWrapper 00026 // C++ default constructor can NOT contain any code, that 00027 // might leave. 00028 // ----------------------------------------------------------------------------- 00029 // 00030 CLandmarksLmOpWrapper::CLandmarksLmOpWrapper() 00031 : CActive(CActive::EPriorityStandard) 00032 { 00033 CActiveScheduler::Add(this); 00034 } 00035 00036 // Destructor 00037 CLandmarksLmOpWrapper::~CLandmarksLmOpWrapper() 00038 { 00039 Cancel(); 00040 delete iLmOperation; 00041 iLmOperation = NULL; 00042 } 00043 00044 // ----------------------------------------------------------------------------- 00045 // CLandmarksLmOpWrapper::StartOperation 00046 // 00047 // (other items were commented in a header). 00048 // ----------------------------------------------------------------------------- 00049 // 00050 void CLandmarksLmOpWrapper::StartOperation( 00051 CPosLmOperation* aLmOperation, 00052 TRequestStatus& aStatus, 00053 TBool aReportProgress) 00054 { 00055 delete iLmOperation; 00056 iLmOperation = aLmOperation; 00057 iCallerStatus = &aStatus; 00058 iReportProgress = aReportProgress; 00059 iProgress = 0; 00060 00061 ExecuteNextStep(); 00062 } 00063 00064 // ----------------------------------------------------------------------------- 00065 // CLandmarksLmOpWrapper::LmOperationPtr 00066 // 00067 // (other items were commented in a header). 00068 // ----------------------------------------------------------------------------- 00069 // 00070 CPosLmOperation* CLandmarksLmOpWrapper::LmOperationPtr() 00071 { 00072 return iLmOperation; 00073 } 00074 00075 // ----------------------------------------------------------------------------- 00076 // CLandmarksLmOpWrapper::ExecuteNextStep 00077 // 00078 // (other items were commented in a header). 00079 // ----------------------------------------------------------------------------- 00080 // 00081 void CLandmarksLmOpWrapper::ExecuteNextStep(TRequestStatus& aStatus) 00082 { 00083 iCallerStatus = &aStatus; 00084 ExecuteNextStep(); 00085 } 00086 00087 // ----------------------------------------------------------------------------- 00088 // CLandmarksLmOpWrapper::Progress 00089 // 00090 // (other items were commented in a header). 00091 // ----------------------------------------------------------------------------- 00092 // 00093 TInt CLandmarksLmOpWrapper::Progress() 00094 { 00095 return (TInt) (iProgress * 100); 00096 } 00097 00098 // ----------------------------------------------------------------------------- 00099 // CLandmarksLmOpWrapper::DoCancel 00100 // 00101 // (other items were commented in a header). 00102 // ----------------------------------------------------------------------------- 00103 // 00104 void CLandmarksLmOpWrapper::DoCancel() 00105 { 00106 delete iLmOperation; 00107 iLmOperation = NULL; 00108 User::RequestComplete(iCallerStatus, KErrCancel); 00109 } 00110 00111 // ----------------------------------------------------------------------------- 00112 // CLandmarksLmOpWrapper::RunL 00113 // 00114 // (other items were commented in a header). 00115 // ----------------------------------------------------------------------------- 00116 // 00117 void CLandmarksLmOpWrapper::RunL() 00118 { 00119 if (iStatus == KErrNone) 00120 { 00121 // Operation finished. 00122 User::RequestComplete(iCallerStatus, KErrNone); 00123 } 00124 else if (iStatus == KPosLmOperationNotComplete) 00125 { 00126 if (iReportProgress) 00127 { 00128 User::RequestComplete(iCallerStatus, KPosLmOperationNotComplete); 00129 } 00130 else 00131 { 00132 ExecuteNextStep(); 00133 } 00134 } 00135 } 00136 00137 // ----------------------------------------------------------------------------- 00138 // CLandmarksLmOpWrapper::ExecuteNextStep 00139 // 00140 // (other items were commented in a header). 00141 // ----------------------------------------------------------------------------- 00142 // 00143 void CLandmarksLmOpWrapper::ExecuteNextStep() 00144 { 00145 iStatus = KRequestPending; 00146 iLmOperation->NextStep(iStatus, iProgress); 00147 SetActive(); 00148 } 00149 00150 // End of File 00151
|
© Nokia 2006 |