1227 updatedReqEntry->iMessage.Int3(),ipc,updatedReqEntry->iBuffer->Size(),this); |
1227 updatedReqEntry->iMessage.Int3(),ipc,updatedReqEntry->iBuffer->Size(),this); |
1228 } |
1228 } |
1229 |
1229 |
1230 if (!nextPostedReqEntry) |
1230 if (!nextPostedReqEntry) |
1231 // then we don't want to post any other client's requests in place of this one |
1231 // then we don't want to post any other client's requests in place of this one |
1232 { |
1232 { |
1233 nextPostedReqEntry = PhoneOwner()->FindNonCancelledClientReq(updatedReqEntry->iSession,updatedReqEntry->iMessage.Int3(),ipc); |
1233 nextPostedReqEntry = PhoneOwner()->FindNonCancelledClientReq(updatedReqEntry->iSession,updatedReqEntry->iMessage.Int3(),ipc); |
1234 __ASSERT_DEBUG(updatedReqEntry!=nextPostedReqEntry, Fault(EEtelFaultCancelErrorWithoutCancelled)); |
1234 __ASSERT_DEBUG(updatedReqEntry!=nextPostedReqEntry, Fault(EEtelFaultCancelErrorWithoutCancelled)); |
1235 if (nextPostedReqEntry==NULL && reqMode&KReqModeRePostImmediately) |
1235 if (nextPostedReqEntry==NULL && reqMode&KReqModeRePostImmediately) |
1236 { |
1236 { |
1237 TInt ret = DeregisterNotification(ipc); // no more clients are interested so |
1237 TInt ret = DeregisterNotification(ipc); // no more clients are interested so |
1297 if (iDeliveryObject->DeliveryInProgress()) |
1302 if (iDeliveryObject->DeliveryInProgress()) |
1298 { |
1303 { |
1299 // Session in progress. |
1304 // Session in progress. |
1300 return KErrPermissionDenied; |
1305 return KErrPermissionDenied; |
1301 } |
1306 } |
1302 |
|
1303 return iDeliveryObject->DeliverReqL(PhoneOwner()->ReqActiveList(), aUpdatedReqEntry, aReqMode, aIpc, aError); |
1307 return iDeliveryObject->DeliverReqL(PhoneOwner()->ReqActiveList(), aUpdatedReqEntry, aReqMode, aIpc, aError); |
1304 } |
1308 } |
1305 |
1309 |
1306 void CTelObject::FindReq(CReqEntry* aUpdatedReqEntry,const TReqMode aReqMode,const TInt aIpc,const TInt aError) |
1310 void CTelObject::FindReq(CReqEntry* aUpdatedReqEntry,const TReqMode aReqMode,const TInt aIpc,const TInt aError) |
1307 { |
1311 { |
1308 CReqEntry* reqEntry; |
1312 CReqEntry* reqEntry; |
1309 TDblQueIter<CReqEntry> iter(PhoneOwner()->ReqActiveList()); |
1313 TDblQueIter<CReqEntry> iter(PhoneOwner()->ReqActiveList()); |
1310 while(reqEntry = iter++, reqEntry!=NULL) |
1314 if(!IsSessionReserved())//network initiated dialogue |
1311 { |
1315 { |
1312 if(reqEntry->iFunction==aIpc |
1316 while(reqEntry = iter++, reqEntry!=NULL) |
1313 && reqEntry->iTelObject==aUpdatedReqEntry->iTelObject |
1317 { |
1314 && reqEntry->iBuffer->Size()==aUpdatedReqEntry->iBuffer->Size() |
1318 //loop through all interested clients which are not session owners |
1315 /*&& IsSessionOwner(reqEntry)*/) |
1319 if(reqEntry->iFunction==aIpc |
1316 { |
1320 && reqEntry->iTelObject==aUpdatedReqEntry->iTelObject |
1317 if (aUpdatedReqEntry != reqEntry) |
1321 && reqEntry->iBuffer->Size()==aUpdatedReqEntry->iBuffer->Size() |
1318 { |
1322 /*&& IsSessionOwner(reqEntry)*/) |
1319 // Copy data from the 'placed' request to the one |
1323 { |
1320 // that is owned by the client. |
1324 if (aUpdatedReqEntry != reqEntry) |
1321 PhoneOwner()->UpdateBuffer(aUpdatedReqEntry,reqEntry); |
1325 { |
1322 } |
1326 // Copy data from the 'placed' request to the one |
1323 OfferToClient(reqEntry, aUpdatedReqEntry, aReqMode, aError); |
1327 // that is owned by the client. |
1324 RepostRequest(aUpdatedReqEntry, aError); |
1328 PhoneOwner()->UpdateBuffer(aUpdatedReqEntry,reqEntry); |
1325 } |
1329 } |
1326 } |
1330 OfferToClient(reqEntry, aUpdatedReqEntry, aReqMode, aError); |
|
1331 RepostRequest(aUpdatedReqEntry, aError); |
|
1332 } |
|
1333 } |
|
1334 } |
|
1335 else//mobile originated dialogue -> the session is reserved and message must be passed |
|
1336 //only to the session owner |
|
1337 { |
|
1338 while(reqEntry = iter++, reqEntry!=NULL) |
|
1339 { |
|
1340 if(reqEntry->iFunction==aIpc |
|
1341 && reqEntry->iTelObject==aUpdatedReqEntry->iTelObject |
|
1342 && reqEntry->iBuffer->Size()==aUpdatedReqEntry->iBuffer->Size() |
|
1343 && IsSessionOwner(reqEntry)) |
|
1344 //TODO uncommented IsSessionOwner(reqEntry) to make sure |
|
1345 //request is delievered to the session owner(sometimes the default handler) |
|
1346 { |
|
1347 if (aUpdatedReqEntry != reqEntry) |
|
1348 { |
|
1349 // Copy data from the 'placed' request to the one |
|
1350 // that is owned by the client. |
|
1351 PhoneOwner()->UpdateBuffer(aUpdatedReqEntry,reqEntry); |
|
1352 } |
|
1353 OfferToClient(reqEntry, aUpdatedReqEntry, aReqMode, aError); |
|
1354 RepostRequest(aUpdatedReqEntry, aError); |
|
1355 } |
|
1356 } |
|
1357 } |
1327 } |
1358 } |
1328 |
1359 |
1329 void CTelObject::OfferToClient(CReqEntry* aReqEntry,CReqEntry* aUpdatedReqEntry,const TReqMode aReqMode,const TInt aError) |
1360 void CTelObject::OfferToClient(CReqEntry* aReqEntry,CReqEntry* aUpdatedReqEntry,const TReqMode aReqMode,const TInt aError) |
1330 { |
1361 { |
1331 if (aReqEntry == aUpdatedReqEntry) |
1362 if (aReqEntry == aUpdatedReqEntry) |
1395 // For each request the CTSY is given a TsyReqHandle and and IPC so this is a sensible thing |
1426 // For each request the CTSY is given a TsyReqHandle and and IPC so this is a sensible thing |
1396 // for it to be dealing with. |
1427 // for it to be dealing with. |
1397 // Note that once a session has an owner the reserved state is irrelevant. |
1428 // Note that once a session has an owner the reserved state is irrelevant. |
1398 EXPORT_C void CTelObject::SetSessionOwnerByTsyHandleAndIpc(const TTsyReqHandle aTsyReqHandle, TInt aIpc) |
1429 EXPORT_C void CTelObject::SetSessionOwnerByTsyHandleAndIpc(const TTsyReqHandle aTsyReqHandle, TInt aIpc) |
1399 { |
1430 { |
1400 |
1431 //these are used to fall back to original client if the default handler was not found |
1401 TInt owningsession = PhoneOwner()->FindSessionByTsyHandle( aTsyReqHandle ); |
1432 TInt owningsession = PhoneOwner()->FindSessionByTsyHandle( aTsyReqHandle ); |
1402 TInt owningsubsession = PhoneOwner()->FindSubSessionByTsyHandle( aTsyReqHandle ); |
1433 TInt owningsubsession = PhoneOwner()->FindSubSessionByTsyHandle( aTsyReqHandle ); |
1403 |
|
1404 |
1434 |
1405 if((NULL != aIpc) && |
1435 if((NULL != aIpc)) |
1406 (iDeliveryObject->GetReqMode() == (KReqModeSessionBased | KReqModeTransferToDefaultHandler))) |
|
1407 // transfer to default handler |
1436 // transfer to default handler |
1408 { |
1437 { |
1409 CReqEntry* reqEntry = PhoneOwner()->FindByIpcAndSecureId(aIpc, KUssdDefaultClientSid); |
1438 CReqEntry* reqEntry = PhoneOwner()->FindByIpcAndSecureId(aIpc, KUssdDefaultClientSid); |
1410 if(NULL != reqEntry) |
1439 if(NULL != reqEntry) |
1411 { |
1440 { |
1412 owningsession = reinterpret_cast<TInt>(reqEntry->iSession); |
1441 owningsession = reinterpret_cast<TInt>(reqEntry->iSession); |
1413 owningsubsession = reqEntry->iMessage.Int3(); |
1442 owningsubsession = reqEntry->iMessage.Int3(); |
1414 } |
1443 } |
1415 } |
1444 } |
1416 iDeliveryObject->iSessionOwner = TPhoneClientId(owningsession, owningsubsession); |
1445 iDeliveryObject->iSessionOwner = TPhoneClientId(owningsession, owningsubsession); |
1417 } |
1446 } |
1418 |
1447 |
1419 // Can be used by the TSY to set the session owner to the current request. |
1448 // Can be used by the TSY to set the session owner to the current request. |
1420 // For each request the CTSY is given a TsyReqHandle so this is a sensible thing |
1449 // For each request the CTSY is given a TsyReqHandle so this is a sensible thing |
1421 // for it to be dealing with. |
1450 // for it to be dealing with. |