|
1 /* |
|
2 * Copyright (c) 2006 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: |
|
15 * Virtual base class for the scanner classes. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // USER INCLUDES |
|
22 #include "msengscannerbase.h" |
|
23 |
|
24 |
|
25 // ========================= MEMBER FUNCTIONS ================================ |
|
26 |
|
27 // --------------------------------------------------------------------------- |
|
28 // CMsengScannerBase::CMsengScannerBase() |
|
29 // |
|
30 // C++ default constructor. Can NOT contain any code, that might leave. |
|
31 // --------------------------------------------------------------------------- |
|
32 CMsengScannerBase::CMsengScannerBase(MMsengScannerObserver& aObserver, |
|
33 CMsengInfoArray& aInfoArray, |
|
34 RFs& aFsSession |
|
35 ) |
|
36 : CActive(CActive::EPriorityStandard), iObserver(aObserver), |
|
37 iInfoArray(aInfoArray), iFsSession(aFsSession) |
|
38 { |
|
39 CActiveScheduler::Add(this); |
|
40 } |
|
41 |
|
42 // --------------------------------------------------------------------------- |
|
43 // CMsengScannerBase::~CMsengScannerBase() |
|
44 // |
|
45 // Destructor |
|
46 // --------------------------------------------------------------------------- |
|
47 CMsengScannerBase::~CMsengScannerBase() |
|
48 { |
|
49 Cancel(); |
|
50 } |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 // --------------------------------------------------------------------------- |
|
56 // CMsengScannerBase::CompleteRequest() |
|
57 // |
|
58 // |
|
59 // --------------------------------------------------------------------------- |
|
60 void CMsengScannerBase::CompleteRequest(TInt aCode) |
|
61 { |
|
62 if (!IsActive()) |
|
63 { |
|
64 TRequestStatus* status = &iStatus; |
|
65 User::RequestComplete(status, aCode); |
|
66 SetActive(); |
|
67 } |
|
68 } |
|
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // CMsengScannerBase::RunL() |
|
72 // |
|
73 // |
|
74 // --------------------------------------------------------------------------- |
|
75 void CMsengScannerBase::RunL() |
|
76 { |
|
77 // Do one scanning step |
|
78 const TStepResult result = PerformStepL(); |
|
79 |
|
80 switch(result) |
|
81 { |
|
82 case ECompleteRequest: |
|
83 { |
|
84 CompleteRequest(); |
|
85 break; |
|
86 } |
|
87 |
|
88 case EScanComplete: |
|
89 { |
|
90 iObserver.HandleScannerEventL( |
|
91 MMsengScannerObserver::EScannerEventScanComplete, *this); |
|
92 break; |
|
93 } |
|
94 |
|
95 case ERequestIssuedInternally: |
|
96 default: |
|
97 { |
|
98 // Not used, but maybe needed for messaging if some asynchronous |
|
99 // service is used which completes iStatus by itself. |
|
100 break; |
|
101 } |
|
102 } |
|
103 } |
|
104 |
|
105 // --------------------------------------------------------------------------- |
|
106 // CMsengScannerBase::DoCancel() |
|
107 // |
|
108 // |
|
109 // --------------------------------------------------------------------------- |
|
110 void CMsengScannerBase::DoCancel() |
|
111 { |
|
112 // Nothing to do here |
|
113 } |
|
114 |
|
115 |
|
116 // --------------------------------------------------------------------------- |
|
117 // CMsengScannerBase::RunError() |
|
118 // |
|
119 // |
|
120 // --------------------------------------------------------------------------- |
|
121 TInt CMsengScannerBase::RunError(TInt aError) |
|
122 { |
|
123 // Implementation for EScannerEventScanError cannot leave at the moment, |
|
124 // but lets trap if implementation changes |
|
125 TRAP_IGNORE(iObserver.HandleScannerEventL( |
|
126 MMsengScannerObserver::EScannerEventScanError, *this, aError)); |
|
127 return KErrNone; |
|
128 } |
|
129 |
|
130 |
|
131 // End of File |