|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // EngineRequest.h |
|
15 // Header file for the Engine Request class. |
|
16 // |
|
17 // |
|
18 |
|
19 /** |
|
20 @file |
|
21 @internalComponent |
|
22 */ |
|
23 |
|
24 #ifndef __SYNCENGINEREQUEST_H__ |
|
25 #define __SYNCENGINEREQUEST_H__ |
|
26 |
|
27 #include "phbksyncsvr.h" |
|
28 |
|
29 |
|
30 |
|
31 /** |
|
32 * This class is responsible for montioring request against the Background Sync |
|
33 * Engine. |
|
34 */ |
|
35 class CSyncEngineRequest : public CActive |
|
36 { |
|
37 public: |
|
38 static CSyncEngineRequest* NewL(CPhoneBookServer& aServer, |
|
39 RSyncEngineSession& aSyncEngine, |
|
40 TPhonebookSyncRequest aPhonebookSyncRequest, |
|
41 TUid aPhonebookUid, |
|
42 TContactItemId aContactId, |
|
43 CPhoneBookSession* aClientSession, |
|
44 const RMessage2& aClientMessage); |
|
45 ~CSyncEngineRequest(); |
|
46 |
|
47 void StartRequest(); |
|
48 void CompleteClientRequestL(); |
|
49 |
|
50 inline TPhonebookSyncRequest PhonebookSyncRequest() const; |
|
51 inline TUid PhonebookUid() const; |
|
52 inline TContactItemId ContactId() const; |
|
53 inline CPhoneBookSession* ClientSession() const; |
|
54 inline const RMessage2& ClientMessage() const; |
|
55 |
|
56 void DoCancel(); |
|
57 |
|
58 protected: |
|
59 TInt RunError(TInt aError); |
|
60 |
|
61 private: |
|
62 CSyncEngineRequest(CPhoneBookServer& aServer, |
|
63 RSyncEngineSession& aSyncEngine, |
|
64 TPhonebookSyncRequest aPhonebookSyncRequest, |
|
65 TUid aPhonebookUid, |
|
66 TContactItemId aContactId, |
|
67 CPhoneBookSession* aClientSession, |
|
68 const RMessage2& aClientMessage); |
|
69 |
|
70 void ConstructL(); |
|
71 void RunL(); |
|
72 |
|
73 private: |
|
74 CPhoneBookServer& iServer; |
|
75 RSyncEngineSession& iSyncEngine; |
|
76 TPhonebookSyncRequest iPhonebookSyncRequest; |
|
77 TUid iPhonebookUid; |
|
78 TContactItemId iContactId; |
|
79 CPhoneBookSession* iClientSession; |
|
80 RMessage2 iClientMessage; |
|
81 |
|
82 // |
|
83 // The following fields are all used to store data for WriteContact |
|
84 // for use by the engine. |
|
85 // |
|
86 TInt iWriteContactSlotNumber; |
|
87 RPhoneBookSession::TTemplateAndBufferSize iWriteContactTemplateIdAndBufferSize; |
|
88 CBufFlat* iWriteContactICCEntryBuf; |
|
89 TPtrC8 iWriteContactTemplateIdAndBufferSizePtr; |
|
90 TPtr8 iWriteContactSlotNumberPtr; |
|
91 TPtr8 iWriteContactPhoneBookIDPtr; |
|
92 TPtr8 iWriteContactICCEntryBufPtr; |
|
93 }; |
|
94 |
|
95 |
|
96 /** |
|
97 * Return the sync request type. |
|
98 * |
|
99 * @return The type of sync request used by this engine request. |
|
100 */ |
|
101 inline TPhonebookSyncRequest CSyncEngineRequest::PhonebookSyncRequest() const |
|
102 { |
|
103 return iPhonebookSyncRequest; |
|
104 } // CSyncEngineRequest::iPhonebookSyncRequest |
|
105 |
|
106 |
|
107 /** |
|
108 * Return the ICC phonebook UID. |
|
109 * |
|
110 * @return The UID of the phonebook being used by this engine request. |
|
111 */ |
|
112 inline TUid CSyncEngineRequest::PhonebookUid() const |
|
113 { |
|
114 return iPhonebookUid; |
|
115 } // CSyncEngineRequest::PhonebookUid |
|
116 |
|
117 |
|
118 /** |
|
119 * Return the Contact ID. |
|
120 * |
|
121 * @return The Contact ID of the entry being used by this engine request. |
|
122 */ |
|
123 inline TContactItemId CSyncEngineRequest::ContactId() const |
|
124 { |
|
125 return iContactId; |
|
126 } // CSyncEngineRequest::ContactId |
|
127 |
|
128 |
|
129 /** |
|
130 * Return the client session for this engine request. |
|
131 * |
|
132 * @return The client session pointer. |
|
133 */ |
|
134 inline CPhoneBookSession* CSyncEngineRequest::ClientSession() const |
|
135 { |
|
136 return iClientSession; |
|
137 } // CSyncEngineRequest::ClientSession |
|
138 |
|
139 |
|
140 /** |
|
141 * Return the client message handle. |
|
142 * |
|
143 * @return A reference to the client message request being used by this |
|
144 * engine request. |
|
145 */ |
|
146 inline const RMessage2& CSyncEngineRequest::ClientMessage() const |
|
147 { |
|
148 return iClientMessage; |
|
149 } // CSyncEngineRequest::ClientMessage |
|
150 |
|
151 |
|
152 #endif // __SYNCENGINEREQUEST_H__ |