|
1 /* |
|
2 * Copyright (c) 2007-2007 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: Observer for Phonebook AIW services. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef TPHCNTAIWSERVICEOBSERVER_H |
|
20 #define TPHCNTAIWSERVICEOBSERVER_H |
|
21 |
|
22 #include <e32std.h> |
|
23 |
|
24 #include <AiwCommon.h> |
|
25 |
|
26 class MPhCntServiceResult; |
|
27 class MPhCntAiwServiceCompleteObserver; |
|
28 class MPhCntServiceRequestParam; |
|
29 |
|
30 /** |
|
31 * Callback to indicate when phonebook's AIW service request |
|
32 * is complete. |
|
33 * |
|
34 * @lib PhoneCngFinder.lib |
|
35 * @since S60 3.2 |
|
36 */ |
|
37 NONSHARABLE_CLASS( MPhCntAiwServiceCompleteObserver ) |
|
38 { |
|
39 public: |
|
40 |
|
41 /** |
|
42 * Called when Phonebook's AIW service request is complete. |
|
43 * @param aError Error code. |
|
44 */ |
|
45 virtual void ServiceRequestComplete( TInt aError ) = 0; |
|
46 |
|
47 }; |
|
48 |
|
49 /** |
|
50 * Observes Phonebook AIW services. |
|
51 * |
|
52 * @lib PhoneCntFinder.lib |
|
53 * @since S60 3.2 |
|
54 */ |
|
55 NONSHARABLE_CLASS( TPhCntAiwServiceObserver ) : public MAiwNotifyCallback |
|
56 { |
|
57 public: |
|
58 |
|
59 /** |
|
60 * Constructor. |
|
61 * @param aObserver Callback to indicate when Phonebook's AIW service |
|
62 * request is complete. |
|
63 */ |
|
64 TPhCntAiwServiceObserver(MPhCntAiwServiceCompleteObserver& aObserver); |
|
65 |
|
66 /** |
|
67 * Activates observing. When Phonebook AIW service request is complete, |
|
68 * aResult will be notfied that request is done and |
|
69 * MPhCntAiwServiceCompleteObserver is notified. |
|
70 * |
|
71 * @param aParams The requests parameters that this class is set to |
|
72 * observ. |
|
73 * @aResult Result handler. |
|
74 */ |
|
75 void SetRequestAndResult( |
|
76 MPhCntServiceRequestParam* aParams, |
|
77 MPhCntServiceResult* aResult |
|
78 ); |
|
79 |
|
80 // from base class MAiwNotifyCallback |
|
81 |
|
82 /** |
|
83 * From MAiwNotifyCallback |
|
84 * |
|
85 * @since S60 v3.1 |
|
86 * @see MAiwNotifyCallback |
|
87 */ |
|
88 TInt HandleNotifyL( |
|
89 TInt aCmdId, |
|
90 TInt aEventId, |
|
91 CAiwGenericParamList& aEventParamList, |
|
92 const CAiwGenericParamList& aInParamList); |
|
93 |
|
94 private: |
|
95 |
|
96 /** |
|
97 * Parses error value from paramlist when KAiwEventError comes |
|
98 * from service provider. |
|
99 * |
|
100 * @since S60 v3.1 |
|
101 * @parma aEventParamList Event parameters. |
|
102 */ |
|
103 TInt ParseErrorCode( const CAiwGenericParamList& aEventParamList ); |
|
104 |
|
105 /** |
|
106 * Finds first TInt value from param list. |
|
107 * |
|
108 * @since S60 v3.1 |
|
109 * @Returns KErrNotFound if paramter with aParameterId not found. |
|
110 */ |
|
111 TInt FindFirstTInt32Value( |
|
112 const CAiwGenericParamList& aEventParamList, |
|
113 TGenericParamId aParameterId, |
|
114 TInt& aValue ) const; |
|
115 |
|
116 /** |
|
117 * Indication that response for request has arrived. |
|
118 * @param aError Possible error code. |
|
119 */ |
|
120 void ResponseReceived( TInt aError ); |
|
121 |
|
122 /** |
|
123 * Checks if current process is Phone application process. |
|
124 * @since S60 v3.1 |
|
125 * @return ETrue - Running in phone app process. |
|
126 */ |
|
127 TBool RunningInPhoneAppProcess() const; |
|
128 |
|
129 private: |
|
130 |
|
131 /** |
|
132 * Result of the request. |
|
133 * Now own. |
|
134 */ |
|
135 MPhCntServiceResult* iResult; |
|
136 |
|
137 /** |
|
138 * Request params. |
|
139 * Not own. |
|
140 */ |
|
141 MPhCntServiceRequestParam* iParams; |
|
142 |
|
143 /** |
|
144 * Service request observer. |
|
145 * Not own. |
|
146 */ |
|
147 MPhCntAiwServiceCompleteObserver& iObserver; |
|
148 |
|
149 /** |
|
150 * State variable indicating that AIW service is shutting down, because |
|
151 * user has pressed end key. |
|
152 */ |
|
153 TBool iAiwServiceShuttingDown; |
|
154 |
|
155 }; |
|
156 |
|
157 |
|
158 #endif // TPHCNTAIWSERVICEOBSERVER_H |