16 */ |
16 */ |
17 |
17 |
18 #include "contactresolversession.h" |
18 #include "contactresolversession.h" |
19 #include "locprivacyinternal.h" |
19 #include "locprivacyinternal.h" |
20 #include "locprivacycommon.h" |
20 #include "locprivacycommon.h" |
|
21 #include "locutilsdebug.h" |
21 |
22 |
22 #include <lbs/epos_cposrequestor.h> |
23 #include <lbs/epos_cposrequestor.h> |
23 #include <lbs/EPos_RPosRequestorStack.h> |
24 #include <lbs/EPos_RPosRequestorStack.h> |
24 #include <e32cmn.h> |
25 #include <e32cmn.h> |
25 #include <s32strm.h> |
26 #include <s32strm.h> |
26 #include <s32mem.h> |
27 #include <s32mem.h> |
27 |
28 |
28 |
29 //This determines the number of outstanding requests the client may have with the server at any one time. |
|
30 //The maximum number of slots is 255. |
29 TInt KDefaultMessageSlots = 255; |
31 TInt KDefaultMessageSlots = 255; |
30 const TUid KServerUid3 = |
32 const TUid KServerUid3 = |
31 { |
33 { |
32 0x101f7a86 |
34 0x101f7a86 |
33 }; |
35 }; |
51 // |
53 // |
52 EXPORT_C void RContactResolverSession::ResolveRequestorsL(RPointerArray< |
54 EXPORT_C void RContactResolverSession::ResolveRequestorsL(RPointerArray< |
53 CPosRequestor>& aRequestors) |
55 CPosRequestor>& aRequestors) |
54 { |
56 { |
55 |
57 |
|
58 LOCUTILSDEBUG( "+RContactResolverSession::ResolveRequestorsL" ) |
|
59 |
56 RPosRequestorStack* requestors = new (ELeave) RPosRequestorStack; |
60 RPosRequestorStack* requestors = new (ELeave) RPosRequestorStack; |
57 CleanupStack::PushL(requestors); |
61 CleanupStack::PushL(requestors); |
58 |
62 |
59 //------------------------------------------------------------- |
63 //------------------------------------------------------------- |
60 // getting size from the server in first IPC |
64 // getting size from the server in first IPC |
120 } |
124 } |
121 CleanupStack::PopAndDestroy(requestors2); |
125 CleanupStack::PopAndDestroy(requestors2); |
122 CleanupStack::PopAndDestroy(&readStream); |
126 CleanupStack::PopAndDestroy(&readStream); |
123 CleanupStack::PopAndDestroy(buffer1); |
127 CleanupStack::PopAndDestroy(buffer1); |
124 |
128 |
|
129 LOCUTILSDEBUG( "-RContactResolverSession::ResolveRequestorsL" ) |
125 } |
130 } |
126 |
131 |
127 // ----------------------------------------------------------------------------- |
132 // ----------------------------------------------------------------------------- |
128 // RContactResolverSession::Connect() |
133 // RContactResolverSession::Connect() |
129 // Connects to the server and create a session. |
134 // Connects to the server and create a session. |
130 // ----------------------------------------------------------------------------- |
135 // ----------------------------------------------------------------------------- |
131 |
136 |
132 EXPORT_C TInt RContactResolverSession::Connect() |
137 EXPORT_C TInt RContactResolverSession::Connect() |
133 { |
138 { |
|
139 LOCUTILSDEBUG( "+RContactResolverSession::Connect" ) |
|
140 |
134 TInt error = StartServer(); |
141 TInt error = StartServer(); |
135 |
142 |
136 if (KErrNone == error) |
143 if (KErrNone == error) |
137 { |
144 { |
138 error = CreateSession(KLocPrivacyServerName, Version(), |
145 error = CreateSession(KLocPrivacyServerName, Version(), |
139 KDefaultMessageSlots); |
146 KDefaultMessageSlots); |
140 } |
147 } |
|
148 LOCUTILSDEBUG( "-RContactResolverSession::Connect" ) |
141 return error; |
149 return error; |
142 } |
150 } |
143 |
151 |
144 // ----------------------------------------------------------------------------- |
152 // ----------------------------------------------------------------------------- |
145 // StartServer() |
153 // StartServer() |
146 // Starts the server if it is not already running |
154 // Starts the server if it is not already running |
147 // ----------------------------------------------------------------------------- |
155 // ----------------------------------------------------------------------------- |
148 // |
156 // |
149 TInt RContactResolverSession::StartServer() |
157 TInt RContactResolverSession::StartServer() |
150 { |
158 { |
|
159 LOCUTILSDEBUG( "+RContactResolverSession::StartServer" ) |
|
160 |
151 TInt result; |
161 TInt result; |
152 |
162 |
153 TFindServer findServer(KLocPrivacyServerName); |
163 TFindServer findServer(KLocPrivacyServerName); |
154 TFullName name; |
164 TFullName name; |
155 |
165 |
163 result = CreateServerProcess(); |
173 result = CreateServerProcess(); |
164 if (result != KErrNone) |
174 if (result != KErrNone) |
165 { |
175 { |
166 return result; |
176 return result; |
167 } |
177 } |
168 |
178 LOCUTILSDEBUG( "-RContactResolverSession::StartServer" ) |
|
179 |
169 return KErrNone; |
180 return KErrNone; |
170 } |
181 } |
171 |
182 |
172 // ----------------------------------------------------------------------------- |
183 // ----------------------------------------------------------------------------- |
173 // CreateServerProcess() |
184 // CreateServerProcess() |
174 // Creates a server process |
185 // Creates a server process |
175 // ----------------------------------------------------------------------------- |
186 // ----------------------------------------------------------------------------- |
176 // |
187 // |
177 TInt RContactResolverSession::CreateServerProcess() |
188 TInt RContactResolverSession::CreateServerProcess() |
178 { |
189 { |
|
190 LOCUTILSDEBUG( "+RContactResolverSession::CreateServerProcess" ) |
|
191 |
179 TInt result; |
192 TInt result; |
180 |
193 |
181 const TUidType serverUid(KNullUid, KNullUid, KServerUid3); |
194 const TUidType serverUid(KNullUid, KNullUid, KServerUid3); |
182 |
195 |
183 RProcess server; |
196 RProcess server; |
210 if (status != KErrNone) |
223 if (status != KErrNone) |
211 { |
224 { |
212 return (status.Int()); |
225 return (status.Int()); |
213 } |
226 } |
214 |
227 |
|
228 LOCUTILSDEBUG( "-RContactResolverSession::CreateServerProcess" ) |
|
229 |
215 return KErrNone; |
230 return KErrNone; |
216 } |
231 } |
217 |
232 |
218 TVersion RContactResolverSession::Version() const |
233 TVersion RContactResolverSession::Version() const |
219 { |
234 { |
|
235 LOCUTILSDEBUG( "RContactResolverSession::Version" ) |
|
236 |
220 return TVersion(KLocPrivacyServerMajorVersionNumber, |
237 return TVersion(KLocPrivacyServerMajorVersionNumber, |
221 KLocPrivacyServerMinorVersionNumber, |
238 KLocPrivacyServerMinorVersionNumber, |
222 KLocPrivacyServerBuildVersionNumber); |
239 KLocPrivacyServerBuildVersionNumber); |
223 } |
240 } |
224 |
241 |
225 EXPORT_C void RContactResolverSession::Close() |
242 EXPORT_C void RContactResolverSession::Close() |
226 { |
243 { |
|
244 LOCUTILSDEBUG( "+RContactResolverSession::Close" ) |
|
245 |
227 RSessionBase::Close(); |
246 RSessionBase::Close(); |
228 } |
247 |
|
248 LOCUTILSDEBUG( "-RContactResolverSession::Close" ) |
|
249 } |