|
1 /* |
|
2 * Copyright (c) 2006-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 the License "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: Provides interface between the AIW FrameWork and Service Provider. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef C_CCONTACTINTERFACE_H |
|
19 #define C_CCONTACTINTERFACE_H |
|
20 |
|
21 //System includes |
|
22 #include <LiwVariant.h> |
|
23 |
|
24 // User Includes |
|
25 #include "contactinterface.hrh" |
|
26 #include "singlecontact.h" |
|
27 #include "contactcallbackmap.h" |
|
28 // Forward Declarations |
|
29 class CContactService; |
|
30 class CContactInterfaceCallback; |
|
31 |
|
32 /** |
|
33 * CContactInterface - Provides interface between the AIW FrameWork |
|
34 * and Service Provider. |
|
35 */ |
|
36 class CContactInterface : public CBase, public MLiwInterface |
|
37 { |
|
38 public:// Construction and destruction |
|
39 /** |
|
40 * Two-phased constructor. |
|
41 * @return CCntactInterface* |
|
42 */ |
|
43 IMPORT_C static CContactInterface* NewL(); |
|
44 /** |
|
45 * Destructor |
|
46 */ |
|
47 virtual ~CContactInterface(); |
|
48 /** |
|
49 * Gets the max length of the field |
|
50 * @return TInt Max Length for the field. |
|
51 */ |
|
52 static TInt GetFieldMaxLength( TInt aFieldKeyID, TDesC& aDbUri ); |
|
53 |
|
54 private: |
|
55 /** |
|
56 * Default constructor. |
|
57 */ |
|
58 CContactInterface(); |
|
59 /** |
|
60 * Symbian OS constructor. |
|
61 * @return void |
|
62 */ |
|
63 void ConstructL(); |
|
64 |
|
65 public: |
|
66 /** |
|
67 * provides a concrete implementation for the supported service |
|
68 * command aCmdName. |
|
69 * |
|
70 * @param aCmdName the name of the service command which the consumer wants to invoke |
|
71 * @param aInParamList the input parameter list, can be empty list |
|
72 * @param [in,out] aOutParamList the output parameter list.Return Code is |
|
73 * passed through this list |
|
74 * @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh. |
|
75 * @param aCallback callback to be registered by consumer application |
|
76 * |
|
77 * |
|
78 * |
|
79 * @see TLiwServiceCmdOptions |
|
80 * @see CLiwGenericParamList |
|
81 * @see MLiwNotifyCallback |
|
82 * @return void |
|
83 */ |
|
84 virtual void ExecuteCmdL(const TDesC8& aCmdName, |
|
85 const CLiwGenericParamList& aInParamList, |
|
86 CLiwGenericParamList& aOutParamList, |
|
87 TUint aCmdOptions = 0, |
|
88 MLiwNotifyCallback* aCallback = 0); |
|
89 /** |
|
90 * provides a concrete implementation |
|
91 * for this method.Deletes the interface handle. |
|
92 * The consumer application should call this method if there |
|
93 * are no more service commands to be executed on the interface. |
|
94 * @return void |
|
95 */ |
|
96 virtual void Close(); |
|
97 |
|
98 /** |
|
99 * SapiError |
|
100 * This function maps sapi error. |
|
101 * @param aSymbianErr symbian error code. |
|
102 * @return integer error code. |
|
103 */ |
|
104 static TInt SapiError(TInt aSymbianErr); |
|
105 |
|
106 private: |
|
107 |
|
108 /** |
|
109 * ContactIDUTFToStream :Converts the UTF ID back to stream |
|
110 * @param aContactIDUTF the id to be converted. |
|
111 */ |
|
112 HBufC8* ContactIDUTFToStreamL(TDesC& aContactIDUTF); |
|
113 /** |
|
114 * ProcessAddDataL : This function retrieves the data from the map and |
|
115 * constructs singleContact |
|
116 * @param aMap a map containing the contact data to be added. |
|
117 * @param aContact a CSingleContact class pointer which is to be constructed. |
|
118 */ |
|
119 void ProcessAddDataL(const CLiwMap* aMap, |
|
120 CSingleContact* aContact, |
|
121 CLiwGenericParamList& aOutParamList); |
|
122 /** |
|
123 * Processes the command and calls the corresponding service command. |
|
124 * |
|
125 * @param aCmdName the name of the service command which the consumer wants to invoke |
|
126 * @param aInParamList the input parameter list, can be empty list |
|
127 * @param [in,out] aOutParamList the output parameter list.Return Code is |
|
128 * passed through this list |
|
129 * @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh. |
|
130 * @param aCallback callback to be registered by consumer application |
|
131 * @return void |
|
132 */ |
|
133 void ProcessCmdL(const TDesC8& aCmdName, |
|
134 const CLiwGenericParamList& aInParamList, |
|
135 CLiwGenericParamList& aOutParamList, |
|
136 TUint aCmdOptions, |
|
137 MLiwNotifyCallback* aCallback); |
|
138 |
|
139 /** |
|
140 * Parses the input list and calls the Cancel on the given transaction id |
|
141 * |
|
142 * @param aInParamList the input parameter list, can be empty list |
|
143 * @param [in,out] aOutParamList the output parameter list.Return Code is |
|
144 * passed through this list |
|
145 * @param aCallback callback to be registered by consumer application. |
|
146 * @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh. |
|
147 * @param aTransId the transaction id for this call. |
|
148 * @return void. |
|
149 */ |
|
150 TInt CancelCommandL(const CLiwGenericParamList& aInParamList, |
|
151 CLiwGenericParamList& aOutParamList); |
|
152 |
|
153 /** |
|
154 * Parses the input list and calls the Getlist API. |
|
155 * |
|
156 * @param aInParamList the input parameter list, can be empty list |
|
157 * @param [in,out] aOutParamList the output parameter list.Return Code is |
|
158 * passed through this list |
|
159 * @param aCallback callback to be registered by consumer application. |
|
160 * @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh. |
|
161 * @param aTransId the transaction id for this call. |
|
162 * @return void. |
|
163 */ |
|
164 void GetListCommandL(const CLiwGenericParamList& aInParamList, |
|
165 CLiwGenericParamList& aOutParamList, |
|
166 MLiwNotifyCallback* aCallback, |
|
167 TUint aCmdOptions, |
|
168 TInt aTransId); |
|
169 /** |
|
170 * Parses the input list and calls the Add API. |
|
171 * |
|
172 * @param aInParamList the input parameter list, can be empty list |
|
173 * passed through this list |
|
174 * @param aCallback callback to be registered by consumer application. |
|
175 * @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh. |
|
176 * @param aTransId the transaction id for this call. |
|
177 * @return integer error code. |
|
178 */ |
|
179 void AddCommandL(const CLiwGenericParamList& aInParamList, |
|
180 CLiwGenericParamList& aOutParamList, |
|
181 MLiwNotifyCallback* aCallback, |
|
182 TUint aCmdOptions, |
|
183 TInt aTransId); |
|
184 /** |
|
185 * Parses the input list and calls the Import API. |
|
186 * |
|
187 * @param aInParamList the input parameter list, can be empty list. |
|
188 * @param aCallback callback to be registered by consumer application. |
|
189 * @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh. |
|
190 * @param aTransId the transaction id for this call. |
|
191 * @return integer error code. |
|
192 */ |
|
193 void ImportCommandL(const CLiwGenericParamList& aInParamList, |
|
194 CLiwGenericParamList& aOutParamList, |
|
195 MLiwNotifyCallback* aCallback, |
|
196 TUint aCmdOptions, |
|
197 TInt aTransId); |
|
198 /** |
|
199 * Parses the input list and calls the Export API. |
|
200 * |
|
201 * @param aInParamList the input parameter list, can be empty list. |
|
202 * @param aCallback callback to be registered by consumer application. |
|
203 * @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh. |
|
204 * @param aTransId the transaction id for this call. |
|
205 * @return integer error code. |
|
206 */ |
|
207 void ExportCommandL(const CLiwGenericParamList& aInParamList, |
|
208 CLiwGenericParamList& aOutParamList, |
|
209 MLiwNotifyCallback* aCallback, |
|
210 TUint aCmdOptions, |
|
211 TInt aTransId); |
|
212 |
|
213 /** |
|
214 * Parses the input list and calls the Organise API. |
|
215 * |
|
216 * @param aInParamList the input parameter list, can be empty list. |
|
217 * @param aCallback callback to be registered by consumer application. |
|
218 * @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh. |
|
219 * @param aTransId the transaction id for this call. |
|
220 * @return integer error code. |
|
221 */ |
|
222 void OrganiseGroupCommandL(const CLiwGenericParamList& aInParamList, |
|
223 CLiwGenericParamList& aOutParamList, |
|
224 MLiwNotifyCallback* aCallback, |
|
225 TUint aCmdOptions, |
|
226 TInt aTransId); |
|
227 /** |
|
228 * Parses the input list and calls the Delete API. |
|
229 * |
|
230 * @param aInParamList the input parameter list, can be empty list |
|
231 * @param aCallback callback to be registered by consumer application. |
|
232 * @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh. |
|
233 * @param aTransId the transaction id for this call. |
|
234 * @return integer error code. |
|
235 */ |
|
236 void DeleteCommandL(const CLiwGenericParamList& aInParamList, |
|
237 CLiwGenericParamList& aOutParamList, |
|
238 MLiwNotifyCallback* aCallback, |
|
239 TUint aCmdOptions, |
|
240 TInt aTransId); |
|
241 |
|
242 MLiwNotifyCallback* Callback( TInt32 aTransactionId ); |
|
243 private: |
|
244 // POINTER MEMBER |
|
245 /** |
|
246 * contact service implementation object. |
|
247 * OWN. |
|
248 */ |
|
249 CContactService* iContactService; |
|
250 |
|
251 /** |
|
252 * iCallbackMap |
|
253 * Array of objects. |
|
254 */ |
|
255 RPointerArray<CContactCallbackMap> iCallbackMap; |
|
256 |
|
257 HBufC* iErrorMess; |
|
258 //this is used only for add api due to reset problem with TLiwVariant |
|
259 HBufC* iDburi; |
|
260 |
|
261 }; |
|
262 |
|
263 #endif // C_CCONTACTINTERFACE_H |