|
1 /* |
|
2 * Copyright (c) 2005 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 "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: Active help object for running an internal operation. |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <EPos_LandmarksErrors.h> |
|
22 #include "EPos_CPosLmOperation.h" |
|
23 #include "EPos_CPosLmLocalInternalOpActive.h" |
|
24 #include "EPos_MPosLmLocalInternalOpExecutor.h" |
|
25 |
|
26 // CONSTANTS |
|
27 |
|
28 // ============================ MEMBER FUNCTIONS =============================== |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // CPosLmLocalInternalOpActive::CPosLmLocalInternalOpActive |
|
32 // C++ default constructor can NOT contain any code, that |
|
33 // might leave. |
|
34 // ----------------------------------------------------------------------------- |
|
35 // |
|
36 CPosLmLocalInternalOpActive::CPosLmLocalInternalOpActive( |
|
37 MPosLmLocalInternalOpExecutor& aExecutor, |
|
38 CPosLmOperation* aOp) : |
|
39 CActive(EPriorityNormal), |
|
40 iExecutor(&aExecutor), |
|
41 iOp(aOp) |
|
42 { |
|
43 } |
|
44 |
|
45 // ----------------------------------------------------------------------------- |
|
46 // CPosLmLocalInternalOpActive::NewL |
|
47 // Two-phased constructor. |
|
48 // ----------------------------------------------------------------------------- |
|
49 // |
|
50 CPosLmLocalInternalOpActive* CPosLmLocalInternalOpActive::NewL( |
|
51 MPosLmLocalInternalOpExecutor& aExecutor, |
|
52 CPosLmOperation* aOp) |
|
53 { |
|
54 CPosLmLocalInternalOpActive* self = new(ELeave) CPosLmLocalInternalOpActive( |
|
55 aExecutor, aOp); |
|
56 return self; |
|
57 } |
|
58 |
|
59 // Destructor |
|
60 CPosLmLocalInternalOpActive::~CPosLmLocalInternalOpActive() |
|
61 { |
|
62 Cancel(); |
|
63 |
|
64 delete iOp; |
|
65 } |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // CPosLmLocalInternalOpActive::DoNext |
|
69 // |
|
70 // (other items were commented in a header). |
|
71 // ----------------------------------------------------------------------------- |
|
72 // |
|
73 void CPosLmLocalInternalOpActive::DoNext( |
|
74 TRequestStatus& aClientStatus, |
|
75 TReal32& aClientProgress) |
|
76 { |
|
77 __ASSERT_ALWAYS(!IsActive(), |
|
78 Panic(KPosLandmarksClientPanic, EPosInvalidOperationMode)); |
|
79 |
|
80 iClientStatus = &aClientStatus; |
|
81 iClientProgress = &aClientProgress; |
|
82 |
|
83 if (!IsAdded()) |
|
84 { |
|
85 CActiveScheduler::Add(this); |
|
86 } |
|
87 |
|
88 InternalOpNextStep(iStatus, iProgress); |
|
89 SetActive(); |
|
90 } |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // CPosLmLocalInternalOpActive::InternalOpNextStep |
|
94 // |
|
95 // (other items were commented in a header). |
|
96 // ----------------------------------------------------------------------------- |
|
97 // |
|
98 void CPosLmLocalInternalOpActive::InternalOpNextStep( |
|
99 TRequestStatus& aStatus, |
|
100 TReal32& aProgress) |
|
101 { |
|
102 iOp->NextStep(aStatus, aProgress); |
|
103 } |
|
104 |
|
105 // ----------------------------------------------------------------------------- |
|
106 // CPosLmLocalInternalOpActive::DoCancel |
|
107 // |
|
108 // (other items were commented in a header). |
|
109 // ----------------------------------------------------------------------------- |
|
110 // |
|
111 void CPosLmLocalInternalOpActive::DoCancel() |
|
112 { |
|
113 delete iOp; // Cancels outstanding request |
|
114 iOp = NULL; |
|
115 |
|
116 if (iClientStatus) |
|
117 { |
|
118 User::RequestComplete(iClientStatus, KErrCancel); |
|
119 } |
|
120 } |
|
121 |
|
122 // ----------------------------------------------------------------------------- |
|
123 // CPosLmLocalInternalOpActive::RunL |
|
124 // |
|
125 // (other items were commented in a header). |
|
126 // ----------------------------------------------------------------------------- |
|
127 // |
|
128 void CPosLmLocalInternalOpActive::RunL() |
|
129 { |
|
130 iExecutor->InternalOpCompleted(iStatus.Int(), iProgress, *iClientStatus, |
|
131 *iClientProgress); |
|
132 } |
|
133 |
|
134 // End of File |