|
1 /* |
|
2 * Copyright (c) 2007, 2008 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 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef __CMSCONTACT_H__ |
|
21 #define __CMSCONTACT_H__ |
|
22 |
|
23 // INCLUDES |
|
24 #include "cmscontactfielditem.h" |
|
25 #include <VPbkFieldTypeSelectorFactory.h> |
|
26 |
|
27 //FORWARD DECLARATIONS |
|
28 class RCmsSession; |
|
29 class CCmsContactBase; |
|
30 class CCmsContactField; |
|
31 class CCmsContactFieldInfo; |
|
32 class CCmsContactNotifier; |
|
33 class MCmsNotificationHandlerAPI; |
|
34 |
|
35 |
|
36 /** |
|
37 * Store information. |
|
38 */ |
|
39 enum TCmsContactStore |
|
40 { |
|
41 ECmsContactStorePbk = 0, |
|
42 ECmsContactStoreSim, |
|
43 ECmsContactStoreSdn, |
|
44 ECmsContactStoreXsp |
|
45 }; |
|
46 |
|
47 |
|
48 //CLASS DECLARATION |
|
49 class RCmsContact : public RSubSessionBase |
|
50 { |
|
51 public: // New functions |
|
52 |
|
53 /** |
|
54 * C++ Constructor. |
|
55 */ |
|
56 IMPORT_C RCmsContact(); |
|
57 |
|
58 /** |
|
59 * Open a contact |
|
60 * |
|
61 * @param RCmsSession& Session handle |
|
62 * @param TInt Contact ID |
|
63 * @return TInt Error code |
|
64 */ |
|
65 IMPORT_C TInt Open( RCmsSession& aSession, |
|
66 TInt32 aContactId ); |
|
67 |
|
68 /** |
|
69 * Open a contact |
|
70 * |
|
71 * @param RCmsSession& Session handle |
|
72 * @param TDesC8 Contact link |
|
73 * @return TInt Error code |
|
74 */ |
|
75 IMPORT_C TInt Open( RCmsSession& aSession, |
|
76 const TDesC8& aPackedLink ); |
|
77 |
|
78 /** |
|
79 * Open a contact |
|
80 * |
|
81 * @param RCmsSession& Session handle |
|
82 * @param TDesC& Phone number |
|
83 * @return TInt Error code |
|
84 */ |
|
85 IMPORT_C TInt Open( RCmsSession& aSession, |
|
86 const TDesC& aPhoneNbr ); |
|
87 |
|
88 /** |
|
89 * Get data for a contact field |
|
90 * |
|
91 * @param TRequestStatus& Request status of the client |
|
92 * @param CCmsContactField::TCmsContactField Type of the field |
|
93 * @return CCmsContactField* On completion, contains the data |
|
94 * |
|
95 */ |
|
96 IMPORT_C CCmsContactField* FieldDataL( TRequestStatus& aStatus, |
|
97 CCmsContactFieldItem::TCmsContactField aFieldType ); |
|
98 |
|
99 /** |
|
100 * Get the enabled fields of this contact |
|
101 * |
|
102 * @param TRequestStatus& Request status of the caller |
|
103 * @return CCmsContactFieldInfo* Contact field information |
|
104 */ |
|
105 IMPORT_C CCmsContactFieldInfo* EnabledFieldsL( TRequestStatus& aStatus ); |
|
106 |
|
107 /** |
|
108 * See if this contact has links to external stores |
|
109 * |
|
110 * If the client wants to get ALL data for a contact, including the data |
|
111 * in external (XSP) stores, it must call this method before asking data. |
|
112 * On startup, the CMS server reads from Service Provider Settings the URIs |
|
113 * of the XSP stores that have been installed on the device. When this method |
|
114 * is called, the server goes through the XSP stores (in case there are any) |
|
115 * and tries to find a matching XSP ID from the contacts in the stores. Once |
|
116 * the method has returned, all data fetching methods also return the data |
|
117 * in the possible matching XSP contacts. |
|
118 * |
|
119 * @return void |
|
120 */ |
|
121 IMPORT_C void FindExternalContact( TRequestStatus& aStatus ) const; |
|
122 |
|
123 /** |
|
124 * Cancel a search for an external contact |
|
125 * |
|
126 * @return void |
|
127 */ |
|
128 IMPORT_C void CancelExternalContactFind() const; |
|
129 |
|
130 /** |
|
131 * Returns a selected contact identifier as descriptor. |
|
132 * Contact must be opened with Open() before using this function. |
|
133 * |
|
134 * Supported identifiers: |
|
135 * MVPbkContactLinkArray (only one contactlink on array) |
|
136 * |
|
137 * Leaves with KErrArgument |
|
138 * HBufC8 ownership transferred. |
|
139 * @see TCmsContactIdentifierType |
|
140 * @see RCmsContact::Open |
|
141 * @see MVPbkContactLinkArray from VrtPhbk |
|
142 * @return HBufC8* packed MVPbkContactLinkArray. |
|
143 */ |
|
144 IMPORT_C HBufC8* GetContactIdentifierL(); |
|
145 |
|
146 /** |
|
147 * Check whether a service is available |
|
148 * |
|
149 * @param CCmsContactBase& The object that has a request pending |
|
150 * @return void |
|
151 */ |
|
152 IMPORT_C TInt IsServiceAvailable( VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aServiceType ) const; |
|
153 |
|
154 /** |
|
155 * Check from which store this contact is from |
|
156 * |
|
157 * @return TCmsContactStore Parent store |
|
158 */ |
|
159 IMPORT_C TCmsContactStore ContactStore() const; |
|
160 |
|
161 /** |
|
162 * Cancel an asynchronous operation |
|
163 * |
|
164 * @param CCmsContactBase& The object that has a request pending |
|
165 * @return void |
|
166 */ |
|
167 IMPORT_C void Cancel( CCmsContactBase& aContactBase ); |
|
168 |
|
169 /** |
|
170 * Close this subsession |
|
171 * |
|
172 * @return void |
|
173 */ |
|
174 IMPORT_C void Close(); |
|
175 |
|
176 /** |
|
177 * Destructor |
|
178 */ |
|
179 IMPORT_C ~RCmsContact(); |
|
180 |
|
181 /** |
|
182 * Order change notifications for a contact field |
|
183 * |
|
184 * @param aHandler callback observer for subscription notifications |
|
185 * @param aNotificationType type of subscritpion |
|
186 * @return subscription-id |
|
187 * |
|
188 */ |
|
189 IMPORT_C void OrderNotificationsL( |
|
190 MCmsNotificationHandlerAPI* aHandler, |
|
191 CCmsContactFieldItem::TCmsContactNotification aNotificationType ); |
|
192 |
|
193 /** |
|
194 * Cancel notifications for a contact field |
|
195 * |
|
196 * @param aSubscriptionType type of subscritpion |
|
197 * |
|
198 */ |
|
199 IMPORT_C void CancelNotifications( |
|
200 CCmsContactFieldItem::TCmsContactNotification aNotificationType ); |
|
201 |
|
202 /** |
|
203 * Returns number of active fields which are mapped to contact action. |
|
204 * |
|
205 * @param aContactAction contact action requested |
|
206 */ |
|
207 IMPORT_C TInt GetContactActionFieldCount( |
|
208 VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aContactAction); |
|
209 |
|
210 /** |
|
211 * Checks whether the Current contact is top contact. |
|
212 * |
|
213 * @return ETrue if Contact is a top contact, otherwise EFalse |
|
214 */ |
|
215 IMPORT_C TBool IsTopContact(); |
|
216 |
|
217 /** |
|
218 * Set default attribute for voice call |
|
219 * |
|
220 * @param aStatus TRequestStatus& aStatus |
|
221 */ |
|
222 IMPORT_C void SetVoiceCallDefault( TRequestStatus& aStatus ) const; |
|
223 |
|
224 public: |
|
225 |
|
226 /** |
|
227 * Send a message |
|
228 * |
|
229 * @param CCmsContactBase& The contact object |
|
230 * @param CCmsContactFieldItem::TCmsContactField Contact field type |
|
231 * @return void |
|
232 */ |
|
233 void SendMessage( TInt aServerMessage, |
|
234 CCmsContactBase& aContactField, |
|
235 CCmsContactFieldItem::TCmsContactField aFieldType ); |
|
236 |
|
237 /** |
|
238 * Send a message |
|
239 * |
|
240 * @param CCmsContactBase& The contact object |
|
241 * @param CCmsContactFieldItem::TCmsContactFieldGroup Contact field type |
|
242 * @return void |
|
243 */ |
|
244 void SendMessage( TInt aServerMessage, |
|
245 CCmsContactBase& aContactField, |
|
246 CCmsContactFieldItem::TCmsContactFieldGroup aFieldGroup ); |
|
247 |
|
248 /** |
|
249 * Send a message |
|
250 * |
|
251 * @param TInt Server message |
|
252 * @param TRequestStatus Request status |
|
253 * @return TDesC& Stream descriptor |
|
254 */ |
|
255 void SendMessage( TInt aServerMessage, TIpcArgs& aArguments ); |
|
256 |
|
257 /** |
|
258 * Send a message |
|
259 * |
|
260 * @param TInt Server message |
|
261 * @param TRequestStatus Request status |
|
262 * @return TDesC& Stream descriptor |
|
263 */ |
|
264 void SendMessage( TInt aServerMessage, TIpcArgs& aArguments, TRequestStatus& aStatus ); |
|
265 |
|
266 |
|
267 /** |
|
268 * Resend a message |
|
269 * |
|
270 * @param TInt The operation ID |
|
271 * @return void |
|
272 */ |
|
273 void ResendReceive( TInt aOperation ); |
|
274 |
|
275 /** |
|
276 * Resend a message |
|
277 * |
|
278 * @param TInt The operation ID |
|
279 * @param TRequestStatus& Request status |
|
280 * @param const TIpcArgs& IPC arguments |
|
281 * @return void |
|
282 */ |
|
283 void ResendReceive( TInt aOperation, |
|
284 TRequestStatus& aStatus, |
|
285 const TIpcArgs& aArguments ); |
|
286 |
|
287 /** |
|
288 * Delete notification handler |
|
289 * |
|
290 * @param aNotificationType notification type |
|
291 */ |
|
292 void DeleteNotifier( |
|
293 CCmsContactFieldItem::TCmsContactNotification aNotificationType ); |
|
294 |
|
295 private: |
|
296 |
|
297 /** |
|
298 * Resend a message |
|
299 * |
|
300 * @param TInt The operation ID |
|
301 * @param TRequestStatus& Request status |
|
302 * @param const TIpcArgs& IPC arguments |
|
303 * @return void |
|
304 */ |
|
305 void CreateFieldGroupL( TRequestStatus& aStatus, |
|
306 RPointerArray<CCmsContactField>& aResultArray, |
|
307 CCmsContactFieldItem::TCmsContactFieldGroup aFieldGroup ); |
|
308 |
|
309 /** |
|
310 * Create notification handler |
|
311 * |
|
312 * @param aStatus aHandler client handler observer |
|
313 * @param aNotificationType notification type |
|
314 * @return notification handler |
|
315 */ |
|
316 CCmsContactNotifier* CreateNotifierL( |
|
317 MCmsNotificationHandlerAPI* aHandler, |
|
318 CCmsContactFieldItem::TCmsContactNotification aNotificationType ); |
|
319 |
|
320 /** |
|
321 * Search notification handler |
|
322 * |
|
323 * @param aNotificationType notification type |
|
324 * @return notification handler |
|
325 */ |
|
326 CCmsContactNotifier* SearchNotifier( |
|
327 CCmsContactFieldItem::TCmsContactNotification aNotificationType ); |
|
328 |
|
329 private: |
|
330 |
|
331 TPtr8 iContactIdentifierPtr; |
|
332 RPointerArray<CCmsContactNotifier> iNotifiers; |
|
333 }; |
|
334 |
|
335 |
|
336 #endif //__CMSCONTACT_H__ |
|
337 |
|
338 |
|
339 |