92 out << log << "\n"; |
85 out << log << "\n"; |
93 file.close(); |
86 file.close(); |
94 #else |
87 #else |
95 Q_UNUSED(log) |
88 Q_UNUSED(log) |
96 #endif |
89 #endif |
97 } |
90 }*/ |
98 |
|
99 |
|
100 SmfServerSymbian::~SmfServerSymbian() |
91 SmfServerSymbian::~SmfServerSymbian() |
101 { |
92 { |
102 |
93 |
103 } |
94 } |
104 |
|
105 SmfServer* SmfServerSymbian::wrapper() |
95 SmfServer* SmfServerSymbian::wrapper() |
106 { |
96 { |
107 return iWrapper; |
97 return iWrapper; |
108 } |
98 } |
109 |
|
110 |
|
111 CSession2* SmfServerSymbian::NewSessionL(const TVersion& aVersion, const RMessage2& /*aMessage*/) const |
99 CSession2* SmfServerSymbian::NewSessionL(const TVersion& aVersion, const RMessage2& /*aMessage*/) const |
112 { |
100 { |
113 |
101 Q_UNUSED(aVersion) |
114 // Check that the version is OK |
102 // Check that the version is OK |
115 // TVersion v( 0, 1, 0 ); |
103 // TVersion v( 0, 1, 0 ); |
116 // if (!User::QueryVersionSupported( v, aVersion )) |
104 // if (!User::QueryVersionSupported( v, aVersion )) |
117 // User::Leave( KErrNotSupported ); |
105 // User::Leave( KErrNotSupported ); |
118 // Create the session. |
106 // Create the session. |
119 Q_UNUSED(aVersion); |
|
120 QString log("New session created"); |
107 QString log("New session created"); |
121 writeLog(log); |
108 qDebug()<<(log); |
122 return new (ELeave) SmfServerSymbianSession( const_cast<SmfServerSymbian*>(this) ); |
109 return new (ELeave) SmfServerSymbianSession( const_cast<SmfServerSymbian*>(this) ); |
123 } |
110 } |
124 |
|
125 SmfServerSymbianSession* SmfServerSymbian::findSession(TInt id) |
111 SmfServerSymbianSession* SmfServerSymbian::findSession(TInt id) |
126 { |
112 { |
127 writeLog("SmfServerSymbian::findSession"); |
113 qDebug()<<("SmfServerSymbian::findSession"); |
128 CSessionStruct* sessionStruct = iMap.Find(id); |
114 CSessionStruct* sessionStruct = iMap.Find(id); |
129 if(sessionStruct) |
115 if(sessionStruct) |
130 { |
116 { |
131 writeLog("Session id found"); |
117 qDebug()<<("Session id found"); |
132 return sessionStruct->iSession; |
118 return sessionStruct->iSession; |
133 } |
119 } |
134 else |
120 else |
135 { |
121 { |
136 writeLog("Session id not found"); |
122 qDebug()<<("Session id not found"); |
137 return NULL; |
123 return NULL; |
138 } |
124 } |
139 } |
125 } |
140 |
|
141 TInt SmfServerSymbian::findAndServiceclient(TInt requestID,QByteArray* parsedData,SmfError error) |
126 TInt SmfServerSymbian::findAndServiceclient(TInt requestID,QByteArray* parsedData,SmfError error) |
142 { |
127 { |
143 writeLog("SmfServerSymbian::findAndServiceclient"); |
128 qDebug()<<("SmfServerSymbian::findAndServiceclient"); |
144 SmfServerSymbianSession* sessionToservice = findSession(requestID); |
129 SmfServerSymbianSession* sessionToservice = findSession(requestID); |
145 if(sessionToservice) |
130 if(sessionToservice) |
146 { |
131 { |
147 sessionToservice->resultsAvailable(parsedData,error); |
132 sessionToservice->resultsAvailable(parsedData,error); |
148 } |
133 } |
149 return 0; |
134 return 0; |
150 } |
135 } |
151 |
|
152 SmfServerSymbianSession::SmfServerSymbianSession(SmfServerSymbian* aServer): |
136 SmfServerSymbianSession::SmfServerSymbianSession(SmfServerSymbian* aServer): |
153 iServer(aServer),iPtrToBuf(NULL,0) ,iIntfNmaeSymbian(NULL,0), iProviderSymbian(NULL,0),iIntfNameSymbian16(NULL,0) |
137 iServer(aServer),iPtrToBuf(NULL,0) , |
|
138 iIntfNmaeSymbian(NULL,0), iProviderSymbian(NULL,0), |
|
139 iIntfNameSymbian16(NULL,0) ,iXtraDataPtr(NULL,0), |
|
140 iPtrToDataForClient(NULL,0) ,iPtrDataForDSM(NULL,0),iPtrDataFromDSM(NULL,0) |
154 { |
141 { |
155 iServer->iSessionCount++; |
142 iServer->iSessionCount++; |
156 } |
143 } |
157 |
|
158 SmfServerSymbianSession::~SmfServerSymbianSession() |
144 SmfServerSymbianSession::~SmfServerSymbianSession() |
159 { |
145 { |
160 //cleanup of client resources |
146 //cleanup of client resources |
161 iServer->iSessionCount--; |
147 iServer->iSessionCount--; |
162 } |
148 } |
163 |
149 |
164 |
150 |
165 void SmfServerSymbianSession::clientAuthorizationFinished(bool success) |
151 void SmfServerSymbianSession::clientathorizationFinished(bool success) |
166 { |
152 { |
167 //Client authorization failed |
153 //Client authorization failed |
168 if(!success) |
154 if(!success) |
169 { |
155 { |
170 //TODO:- Should use smf wide error instead |
156 //TODO:- Should use smf wide error instead |
173 else |
159 else |
174 { |
160 { |
175 HandleClientMessageL(iMessage); |
161 HandleClientMessageL(iMessage); |
176 } |
162 } |
177 } |
163 } |
178 |
|
179 |
|
180 void SmfServerSymbianSession::resultsAvailable(QByteArray* parsedData,SmfError error) |
164 void SmfServerSymbianSession::resultsAvailable(QByteArray* parsedData,SmfError error) |
181 { |
165 { |
182 |
166 |
183 //Note:- The order of serialization of parsedData - Error value followed by the data |
167 //Note:- The order of serialization of parsedData - Error value followed by the data |
184 //parsedData is already serialized by PM |
168 //parsedData is already serialized by PM |
185 iServer->writeLog("SmfServerSymbianSession::resultsAvailable"); |
169 qDebug()<<("SmfServerSymbianSession::resultsAvailable"); |
186 //We should remove the request from the map as soon its no longer outstanding |
170 //We should remove the request from the map as soon its no longer outstanding |
187 iServer->removeFromSessionMap(this,iMessage); |
171 iServer->removeFromSessionMap(this,iMessage); |
188 |
172 |
189 byteArrayToClnt.clear(); |
173 //Note:- Session must take the ownership of the data being passed to the client session |
190 byteArrayToClnt.append(*(parsedData)); |
174 if(iDataForClient) |
191 iPtrToBuf.Copy(reinterpret_cast<TUint8*>(byteArrayToClnt.data()),byteArrayToClnt.length()); |
175 { |
192 |
176 delete iDataForClient; |
193 TInt writeErr = iMessage.Write(2,iPtrToBuf); |
177 iDataForClient = NULL; |
194 |
178 } |
195 iServer->writeLog("Write="); |
179 iDataForClient = HBufC8::NewL(parsedData->size()); |
|
180 iPtrToDataForClient.Set(iDataForClient->Des()); |
|
181 iPtrToDataForClient.Copy(reinterpret_cast<const TText8*>(parsedData->constData()),parsedData->length()); |
|
182 |
|
183 TInt writeErr = iMessage.Write(2,iPtrToDataForClient); |
|
184 qDebug()<<("Write="); |
196 QString wrErr = QString::number(writeErr); |
185 QString wrErr = QString::number(writeErr); |
197 iServer->writeLog(wrErr); |
186 qDebug()<<(wrErr); |
198 |
|
199 //signal completion for the last request |
187 //signal completion for the last request |
200 iMessage.Complete(error); |
188 iMessage.Complete(error); |
201 } |
189 } |
202 |
|
203 |
|
204 void SmfServerSymbianSession::ServiceL(const RMessage2& aMessage) |
190 void SmfServerSymbianSession::ServiceL(const RMessage2& aMessage) |
205 { |
191 { |
206 |
192 |
207 iServer->writeLog("SmfServerSymbianSession::ServiceL="); |
193 qDebug()<<("SmfServerSymbianSession::ServiceL="); |
208 iMessage = aMessage ; |
194 iMessage = aMessage ; |
209 |
|
210 QString log; |
195 QString log; |
211 log = QString::number(iMessage.Function()); |
196 log = QString::number(iMessage.Function()); |
212 iServer->writeLog(log); |
197 qDebug()<<(log); |
213 |
198 //construct the client auth id |
214 SmfClientAuthID clientAuthID; |
199 SmfClientAuthID clientAuthID; |
215 clientAuthID.pid = aMessage.SecureId(); |
200 clientAuthID.pid = aMessage.SecureId(); |
216 clientAuthID.session = this; |
201 clientAuthID.session = this; |
217 //check whether the client is authorized |
202 //TODO:- No client pid checking?No capability? So why symbian client-server? |
218 if(!iServer->wrapper()->isClientAuthorized(clientAuthID)) |
203 HandleClientMessageL(iMessage); |
219 { |
204 |
220 //Client is yet to be authorized |
205 } |
221 //It should start authorization or simply return err value is yet TBD, so the following code may change |
|
222 //start authorization of client, session will be blocked untill its authorized |
|
223 //HandleclientMessageL will be called in that fn |
|
224 iServer->wrapper()->authorizeClient(clientAuthID); |
|
225 } |
|
226 else |
|
227 { |
|
228 //client is authorized, so proceed |
|
229 HandleClientMessageL(iMessage); |
|
230 } |
|
231 } |
|
232 |
|
233 void SmfServerSymbianSession::HandleClientMessageL(const RMessage2& aMessage) |
206 void SmfServerSymbianSession::HandleClientMessageL(const RMessage2& aMessage) |
234 { |
207 { |
235 iServer->writeLog("HandleClientMessageL"); |
208 qDebug()<<("HandleClientMessageL"); |
236 iLastRequest = aMessage.Function(); |
209 iLastRequest = aMessage.Function(); |
237 |
210 |
238 |
211 |
239 /**Note:- Only ESmfGetService needs to be taken care separately as it doesn't involve createrequest for PM |
212 /**Note:- Only ESmfGetService needs to be taken care separately as it doesn't involve createrequest for PM |
240 *See SmfRequestTypeID for list of opcodes |
213 *See SmfRequestTypeID for list of opcodes |
249 */ |
222 */ |
250 if(iLastRequest == SmfGetService) |
223 if(iLastRequest == SmfGetService) |
251 { |
224 { |
252 HandleGetService(aMessage); |
225 HandleGetService(aMessage); |
253 } |
226 } |
|
227 else if(iLastRequest == SmfRelationCreate || |
|
228 iLastRequest == SmfRelationAssociate || |
|
229 iLastRequest == SmfRelationSearchById || |
|
230 iLastRequest == SmfRelationSearchByContact || |
|
231 iLastRequest == SmfRelationCount || |
|
232 iLastRequest == SmfRelationGet || |
|
233 iLastRequest == SmfRelationGetAll || |
|
234 iLastRequest == SmfRelationGetAllRelations |
|
235 ) |
|
236 { |
|
237 HandleDSMServiceL(aMessage); |
|
238 } |
254 else |
239 else |
255 { |
240 { |
256 HandleCommonServiceL(aMessage); |
241 HandleCommonServiceL(aMessage); |
257 } |
242 } |
258 } |
243 } |
259 |
244 void SmfServerSymbianSession::HandleDSMServiceL(const RMessage2 & aMessage) |
|
245 { |
|
246 //TODO:-If DSM takes care of deserialization and formation of User and social |
|
247 //profile from the params then switch case can be removed |
|
248 if(iDataForDSM) |
|
249 { |
|
250 delete iDataForDSM; |
|
251 iDataForDSM = NULL; |
|
252 } |
|
253 |
|
254 switch(iLastRequest) |
|
255 { |
|
256 case SmfRelationCreate: |
|
257 { |
|
258 iDataForDSM = HBufC8::New(maxSmfRelationIdSize); |
|
259 iPtrDataForDSM.Set(iDataForDSM->Des()); |
|
260 TInt readerr0 = aMessage.Read(0,iPtrDataForDSM); |
|
261 |
|
262 } |
|
263 break; |
|
264 case SmfRelationAssociate: |
|
265 { |
|
266 int maxAlloc = 100; |
|
267 iDataForDSM = HBufC8::New(maxAlloc); |
|
268 iPtrDataForDSM.Set(iDataForDSM->Des()); |
|
269 TInt readerr0 = aMessage.Read(0,iPtrDataForDSM); |
|
270 } |
|
271 break; |
|
272 case SmfRelationSearchById: |
|
273 { |
|
274 int maxAlloc = MaxSmfContactSize; |
|
275 iDataForDSM = HBufC8::New(maxAlloc); |
|
276 iPtrDataForDSM.Set(iDataForDSM->Des()); |
|
277 TInt readerr0 = aMessage.Read(0,iPtrDataForDSM); |
|
278 } |
|
279 break; |
|
280 case SmfRelationCount: |
|
281 { |
|
282 int maxAlloc = 100; |
|
283 iDataForDSM = HBufC8::New(maxAlloc); |
|
284 iPtrDataForDSM.Set(iDataForDSM->Des()); |
|
285 TInt readerr0 = aMessage.Read(0,iPtrDataForDSM); |
|
286 } |
|
287 break; |
|
288 case SmfRelationGet: |
|
289 { |
|
290 int maxAlloc = maxSmfRelationItemSize*maxRelationItems; |
|
291 iDataForDSM = HBufC8::New(maxAlloc); |
|
292 iPtrDataForDSM.Set(iDataForDSM->Des()); |
|
293 TInt readerr0 = aMessage.Read(0,iPtrDataForDSM); |
|
294 } |
|
295 break; |
|
296 case SmfRelationGetAll: |
|
297 { |
|
298 int maxAlloc = maxSmfRelationItemSize*maxRelationItems; |
|
299 iDataForDSM = HBufC8::New(maxAlloc); |
|
300 iPtrDataForDSM.Set(iDataForDSM->Des()); |
|
301 TInt readerr0 = aMessage.Read(0,iPtrDataForDSM); |
|
302 } |
|
303 break; |
|
304 default: |
|
305 break; |
|
306 } |
|
307 //Convert into QByteArray |
|
308 QByteArray qtdataForDSM(reinterpret_cast<const char*>(iPtrDataForDSM.Ptr()),iPtrDataForDSM.Length()) ; |
|
309 QByteArray qtdataFromDSM; |
|
310 SmfRequestTypeID opcode = (SmfRequestTypeID)iLastRequest; |
|
311 SmfError dsmErr = iServer->wrapper()->sendToDSM(qtdataForDSM,opcode,qtdataFromDSM); |
|
312 if(dsmErr == SmfNoError) |
|
313 { |
|
314 if(qtdataFromDSM.size()) |
|
315 { |
|
316 if(iDataFromDSM) |
|
317 { |
|
318 delete iDataFromDSM; |
|
319 iDataFromDSM = NULL; |
|
320 } |
|
321 iDataFromDSM = HBufC8::NewL(qtdataFromDSM.size()); |
|
322 iPtrDataFromDSM.Set(iDataFromDSM->Des()); |
|
323 iPtrDataFromDSM.Copy(reinterpret_cast<const TText8*>(qtdataFromDSM.constData()),qtdataFromDSM.length()); |
|
324 TInt writeErr = aMessage.Write(1,iPtrDataFromDSM); |
|
325 } |
|
326 } |
|
327 else |
|
328 { |
|
329 iDSMErr.Zero(); |
|
330 TInt errInt = dsmErr; |
|
331 iDSMErr.AppendNum(errInt); |
|
332 TInt writeErr = aMessage.Write(2,iDSMErr); |
|
333 } |
|
334 } |
260 void SmfServerSymbianSession::HandleGetService(const RMessage2 & aMessage) |
335 void SmfServerSymbianSession::HandleGetService(const RMessage2 & aMessage) |
261 { |
336 { |
262 iServer->writeLog("SmfServerSymbianSession::HandleGetService"); |
337 qDebug()<<("SmfServerSymbianSession::HandleGetService"); |
|
338 |
263 /** |
339 /** |
264 * Note:- client sends message for this opcode in the following format,- |
340 * Note:- client sends message for this opcode in the following format,- |
265 * Slot 0:- Interface Name buffer |
341 * Slot 0:- Interface Name buffer |
266 * Slot 1:- Ptr to data block to be filled with SmfProvideList* serialized into QByteArray |
342 * Slot 1:- Ptr to data block to be filled with SmfProvideList* serialized into QByteArray |
|
343 * Slot 2:- Max data size allocated in the client side |
|
344 * TODO:- What if size of SmfProviderList to be passed to client is greater than |
|
345 * this size??? |
267 */ |
346 */ |
|
347 |
268 iInterfaceNametbuf.Zero(); |
348 iInterfaceNametbuf.Zero(); |
269 |
|
270 TInt readerr = aMessage.Read(0,iInterfaceNametbuf); |
349 TInt readerr = aMessage.Read(0,iInterfaceNametbuf); |
271 |
350 qDebug()<<(QString::number(readerr)); |
272 iServer->writeLog(QString::number(readerr)); |
|
273 |
|
274 QByteArray bytearray(reinterpret_cast<const char*>(iInterfaceNametbuf.Ptr()),iInterfaceNametbuf.Length()) ; |
351 QByteArray bytearray(reinterpret_cast<const char*>(iInterfaceNametbuf.Ptr()),iInterfaceNametbuf.Length()) ; |
275 QDataStream stream3(&bytearray,QIODevice::ReadOnly); |
352 QDataStream stream3(&bytearray,QIODevice::ReadOnly); |
276 stream3>>iInterfaceID; |
353 stream3>>iInterfaceID; |
277 |
354 qDebug()<<("iInterfaceID="); |
278 iServer->writeLog("iInterfaceID="); |
355 qDebug()<<(iInterfaceID); |
279 iServer->writeLog(iInterfaceID); |
356 //Interface names are diff in client and plugin, replacing *.client.* with *.plugin.* |
280 |
357 iInterfaceID.replace(QString(".client"),QString(".plugin")); |
281 iServer->wrapper()->getPlugins(iInterfaceID,iPluginIDMap); |
358 iServer->wrapper()->getPlugins(iInterfaceID,iPluginIDMap); |
282 //form the plugin id list from the map |
359 //form the plugin id list from the map |
283 QMapIterator<SmfPluginID, SmfProvider> iter(iPluginIDMap); |
360 QMapIterator<SmfPluginID, SmfProvider> iter(iPluginIDMap); |
284 iPluginIDList.clear(); |
361 iPluginIDList.clear(); |
285 while (iter.hasNext()) |
362 while (iter.hasNext()) |
286 { |
363 { |
287 iter.next(); |
364 iter.next(); |
288 iPluginIDList<<iter.key(); |
365 iPluginIDList<<iter.key(); |
289 } |
366 } |
290 |
|
291 //iAuthList will be filled by credential manager |
367 //iAuthList will be filled by credential manager |
292 iServer->wrapper()->getAuthorizedPlugins(iPluginIDList,iAuthList); |
368 iServer->wrapper()->getAuthorizedPlugins(iPluginIDList,iAuthList); |
293 |
369 |
294 //iPluginIDMap now contains SmfProvider info to return to the client |
370 //iPluginIDMap now contains SmfProvider info to return to the client |
295 //No need to add this to session map, as we are not requesting PM for this |
371 //No need to add this to session map, as we are not requesting PM for this |
296 QMap<SmfPluginID, SmfProvider> tempMap; |
372 QMap<SmfPluginID, SmfProvider> tempMap; |
297 QMapIterator<SmfPluginID, SmfProvider> i(iPluginIDMap); |
373 QMapIterator<SmfPluginID, SmfProvider> i(iPluginIDMap); |
298 |
|
299 while (i.hasNext()) |
374 while (i.hasNext()) |
300 { |
375 { |
301 i.next(); |
376 i.next(); |
302 if(iAuthList.contains(i.key())) |
377 if(iAuthList.contains(i.key())) |
303 { |
378 { |
304 tempMap.insert(i.key(),i.value()); |
379 tempMap.insert(i.key(),i.value()); |
305 } |
380 } |
306 } |
381 } |
307 |
382 //now tempMapcontains the info to be passed to the client |
308 iPluginIDMap.clear(); |
383 iPluginIDMap.clear(); |
309 iPluginIDMap = tempMap; |
384 iPluginIDMap = tempMap; |
310 |
|
311 //form list of smfprovider from this map,- |
385 //form list of smfprovider from this map,- |
312 QList<SmfProvider> providerList; |
386 QList<SmfProvider> providerList; |
313 i = iPluginIDMap; |
387 i = iPluginIDMap; |
314 while(i.hasNext()) |
388 while(i.hasNext()) |
315 { |
389 { |
316 i.next(); |
390 i.next(); |
317 providerList.append(i.value()); |
391 providerList.append(i.value()); |
318 } |
392 } |
319 |
393 //now serialize this list into bytearray |
320 byteArrayToClnt.clear(); |
394 byteArrayToClnt.clear(); |
321 QDataStream stream(&byteArrayToClnt,QIODevice::WriteOnly); |
395 QDataStream stream(&byteArrayToClnt,QIODevice::WriteOnly); |
322 stream<<providerList; |
396 stream<<providerList; |
323 |
397 qDebug()<<("providerList.count()="); |
324 iPtrToBuf.Copy(reinterpret_cast<TUint8*>(byteArrayToClnt.data()),byteArrayToClnt.length()); |
398 qDebug()<<(QString::number(providerList.count())); |
325 TInt writeErr = aMessage.Write(1,iPtrToBuf); |
399 qDebug()<<("Before providerListSymbian"); |
326 |
400 //now convert it into TPtr8 |
327 iServer->writeLog("Write="); |
401 TPtrC8 providerListSymbian(reinterpret_cast<const TText8*>(byteArrayToClnt.constData()),byteArrayToClnt.length()); |
|
402 qDebug()<<("After providerListSymbian"); |
|
403 TInt writeErr = aMessage.Write(1,providerListSymbian); |
|
404 qDebug()<<("Write="); |
328 QString wrErr = QString::number(writeErr); |
405 QString wrErr = QString::number(writeErr); |
329 iServer->writeLog(wrErr); |
406 qDebug()<<(wrErr); |
330 //signal completion |
407 //signal completion |
331 |
|
332 TInt completion = SmfGetServiceComplete ; |
408 TInt completion = SmfGetServiceComplete ; |
333 aMessage.Complete(completion); |
409 aMessage.Complete(completion); |
334 } |
410 } |
335 |
|
336 void SmfServerSymbianSession::HandleCommonServiceL(const RMessage2& aMessage) |
411 void SmfServerSymbianSession::HandleCommonServiceL(const RMessage2& aMessage) |
337 { |
412 { |
338 /** |
413 /** |
339 * Note:- client sends message in the following format,- |
414 * Note:- client sends message in the following format,- |
340 * Slot 0:- SmfProvider* serialized |
415 * Slot 0:- SmfProvider* serialized+Page info flag+page number+per page (if page info flag)+xtra info flag |
341 * Slot 1:- Interface Name buffer |
416 * Slot 1:- Interface Name buffer |
342 * Slot 2:- Ptr to data block to be filled |
417 * Slot 2:- Ptr to data block to be filled |
|
418 * Slot 3 :- Xtra Data if xtra data flag |
343 */ |
419 */ |
|
420 //TODO:- Use macro instead, shared betn client-server |
|
421 TInt maxProvidersize = 1000; |
|
422 TInt maxOtherInfoSize = 300; |
344 TInt providerSize = aMessage.GetDesLength(0); |
423 TInt providerSize = aMessage.GetDesLength(0); |
345 if(iProviderBuf) |
424 if(iProviderBuf) |
346 { |
425 { |
347 delete iProviderBuf; |
426 delete iProviderBuf; |
348 iProviderBuf = NULL; |
427 iProviderBuf = NULL; |
349 } |
428 } |
350 iProviderBuf = HBufC8::NewL(providerSize); |
429 iProviderBuf = HBufC8::NewL(maxProvidersize + maxOtherInfoSize); |
351 iProviderSymbian.Set(iProviderBuf->Des()); |
430 iProviderSymbian.Set(iProviderBuf->Des()); |
352 |
431 |
353 TInt intfNameSize = aMessage.GetDesLength(1); |
432 TInt intfNameSize = aMessage.GetDesLength(1); |
354 if(iIntfNameBuf) |
433 if(iIntfNameBuf) |
355 { |
434 { |
356 delete iIntfNameBuf; |
435 delete iIntfNameBuf; |
357 iIntfNameBuf = NULL; |
436 iIntfNameBuf = NULL; |
358 } |
437 } |
359 iIntfNameBuf = HBufC8::NewL(intfNameSize*2);//for safeside |
438 iIntfNameBuf = HBufC8::NewL(1000);//for safeside |
360 iIntfNmaeSymbian.Set(iIntfNameBuf->Des()); |
439 iIntfNmaeSymbian.Set(iIntfNameBuf->Des()); |
361 |
440 |
362 |
441 |
363 //read it into iProviderSymbian |
442 //read it into iProviderSymbian |
364 aMessage.ReadL(0,iProviderSymbian); |
443 aMessage.ReadL(0,iProviderSymbian); |
365 //read it into iIntfNmaeSymbian |
444 //read it into iIntfNmaeSymbian |
366 aMessage.ReadL(1,iIntfNmaeSymbian); |
445 aMessage.ReadL(1,iIntfNmaeSymbian); |
367 |
446 |
368 //convert SmfProvider info from Symbian into bytearray |
447 //convert SmfProvider info from Symbian into bytearray |
369 QByteArray providerBufQt(reinterpret_cast<const char*>(iProviderSymbian.Ptr()),iProviderSymbian.Length()); |
448 QByteArray providerBufQt(reinterpret_cast<const char*>(iProviderSymbian.Ptr()),iProviderSymbian.Length()); |
370 iServer->writeLog("After providerBufQt"); |
449 qDebug()<<("providerBufQt.size="); |
|
450 qDebug()<<(QString::number(providerBufQt.size())); |
371 |
451 |
372 //now de-serialize it |
452 //now de-serialize it |
373 QDataStream stream(&providerBufQt,QIODevice::ReadOnly); |
453 QDataStream stream(&providerBufQt,QIODevice::ReadOnly); |
374 SmfProvider provider; |
454 SmfProvider provider; |
375 stream>>provider ; |
455 stream>>provider ; |
|
456 TInt pageinfoFlag=0; |
|
457 stream>>pageinfoFlag; |
|
458 TInt pageNo=-1; |
|
459 TInt perpage=-1; |
|
460 if(pageinfoFlag) |
|
461 { |
|
462 stream>>pageNo; |
|
463 stream>>perpage; |
|
464 qDebug()<<("pageNo="); |
|
465 qDebug()<<(QString::number(pageNo)); |
|
466 qDebug()<<("perpage="); |
|
467 qDebug()<<(QString::number(perpage)); |
|
468 } |
|
469 TInt XtraInfoFlag = 0; |
|
470 TBool isXtraData = EFalse; |
|
471 stream>>XtraInfoFlag; |
|
472 if(XtraInfoFlag) |
|
473 { |
|
474 isXtraData = ETrue; |
|
475 qDebug()<<("XtraInfoFlag="); |
|
476 qDebug()<<(QString::number(XtraInfoFlag)); |
|
477 } |
|
478 qDebug()<<("iIntfNmaeSymbian.Size="); |
|
479 qDebug()<<(QString::number(iIntfNmaeSymbian.Size())); |
376 QByteArray bytearray(reinterpret_cast<const char*>(iIntfNmaeSymbian.Ptr()),iIntfNmaeSymbian.Length()) ; |
480 QByteArray bytearray(reinterpret_cast<const char*>(iIntfNmaeSymbian.Ptr()),iIntfNmaeSymbian.Length()) ; |
377 QDataStream intfNameStream(&bytearray,QIODevice::ReadOnly); |
481 QDataStream intfNameStream(&bytearray,QIODevice::ReadOnly); |
378 iInterfaceID.clear(); |
482 iInterfaceID.clear(); |
379 intfNameStream>>iInterfaceID; |
483 intfNameStream>>iInterfaceID; |
380 |
484 qDebug()<<("After de-serializing into iInterfaceID="); |
381 iServer->writeLog("After de-serializing into iInterfaceID="); |
485 qDebug()<<(iInterfaceID); |
382 iServer->writeLog(iInterfaceID); |
486 //Interface names are diff in client and plugin, replacing *.client.* with *.plugin.* |
383 |
487 iInterfaceID.replace(QString(".client"),QString(".plugin")); |
384 //Get the plugin ID who matches provider info for a given intf name |
488 //Get the plugin ID who matches provider info for a given intf name |
385 SmfPluginID pluginID = iServer->wrapper()->getPlugin(iInterfaceID,provider); |
489 SmfPluginID pluginID = iServer->wrapper()->getPlugin(iInterfaceID,provider); |
386 |
490 qDebug()<<("pluginID from PM="); |
387 iServer->writeLog("pluginID from PM="); |
491 qDebug()<<(pluginID); |
388 iServer->writeLog(pluginID); |
|
389 |
|
390 iPluginIDList.clear(); |
492 iPluginIDList.clear(); |
391 //we need to check only this pluginID is authorized |
493 //we need to check only this pluginID is authorized? |
392 iPluginIDList<<pluginID; |
494 iPluginIDList<<pluginID; |
393 |
|
394 //iAuthList will contain pluginID for a successfull case |
495 //iAuthList will contain pluginID for a successfull case |
395 iAuthList.clear(); |
496 iAuthList.clear(); |
396 iServer->wrapper()->getAuthorizedPlugins(iPluginIDList,iAuthList); |
497 iServer->wrapper()->getAuthorizedPlugins(iPluginIDList,iAuthList); |
397 if(iAuthList.contains(pluginID)) |
498 if(iAuthList.contains(pluginID)) |
398 { |
499 { |
399 //Plugin ID is authorised, service the request |
500 //Plugin ID is authorised, service the request |
400 //Gnerate request id only if the plugin ID is authorised |
501 //Gnerate request id only if the plugin ID is authorised |
401 TInt id = iServer->addToSessionMap(this,aMessage); |
502 TInt id = iServer->addToSessionMap(this,aMessage); |
402 //request PM to get the data |
503 //request PM to get the data |
403 SmfRequestTypeID opcode = (SmfRequestTypeID)iLastRequest; |
504 SmfRequestTypeID opcode = (SmfRequestTypeID)iLastRequest; |
404 iServer->wrapper()->getRequestedData(id,pluginID,iInterfaceID,opcode,providerBufQt); |
505 if(isXtraData) |
|
506 { |
|
507 if(iXtraDataBuf) |
|
508 { |
|
509 delete iXtraDataBuf; |
|
510 iXtraDataBuf = NULL; |
|
511 } |
|
512 iXtraDataBuf = HBufC8::NewL(XtraInfoFlag); |
|
513 iXtraDataPtr.Set(iXtraDataBuf->Des()); |
|
514 QByteArray XtraBufQt(reinterpret_cast<const char*>(iXtraDataPtr.Ptr()),iXtraDataPtr.Length()); |
|
515 qDebug()<<("XtraBufQt size="); |
|
516 qDebug()<<(QString::number(XtraBufQt.size())); |
|
517 iServer->wrapper()->sendToPluginManager(id,pluginID,iInterfaceID,opcode,XtraBufQt); |
|
518 } |
|
519 else |
|
520 { |
|
521 iServer->wrapper()->sendToPluginManager(id,pluginID,iInterfaceID,opcode); |
|
522 } |
405 } |
523 } |
406 else |
524 else |
407 { |
525 { |
408 //TODO:-Plugin ID is not authorized, throw some error |
526 SmfError err = SmfNoAuthorizedPlugin; |
409 } |
527 iErrBuf.Zero(); |
410 } |
528 iErrBuf.AppendNum(err); |
|
529 iMessage.Write(2,iErrBuf); |
|
530 } |
|
531 |
|
532 |
|
533 } |