1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
66 iLink.iPrev=iLink.iNext=NULL; |
72 iLink.iPrev=iLink.iNext=NULL; |
67 } |
73 } |
68 |
74 |
69 void CReqEntry::CompleteAndDeque(TInt aError) |
75 void CReqEntry::CompleteAndDeque(TInt aError) |
70 { |
76 { |
71 LOGTEXT("CReqEntry::CompleteAndDeque"); |
77 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CREQENTRY_COMPLETEANDDEQUE_1, "CReqEntry::CompleteAndDeque"); |
72 // if client does not interested in this request do not completed |
78 // if client does not interested in this request do not completed |
73 if (iClientInterested) |
79 if (iClientInterested) |
74 { |
80 { |
75 RECORD_COMPLETE_SUB(iMessage.Session(), iTelObject, iMessage.Int3(), iMessage.Function(), aError); |
81 RECORD_COMPLETE_SUB(iMessage.Session(), iTelObject, iMessage.Int3(), iMessage.Function(), aError); |
76 iMessage.Complete(aError); |
82 iMessage.Complete(aError); |
193 { |
199 { |
194 if(++iRead==iNoOfSlots) |
200 if(++iRead==iNoOfSlots) |
195 iRead=0; |
201 iRead=0; |
196 iOverFlow=EFalse; |
202 iOverFlow=EFalse; |
197 iBufferFull=EFalse; |
203 iBufferFull=EFalse; |
198 LOGTEXT2("ETel:\tiRead incremented to %d", iRead); |
204 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBUFFER_INCREAD_1, "ETel:\tiRead incremented to %d", iRead); |
199 } |
205 } |
200 |
206 |
201 void CBuffer::IncWrite() |
207 void CBuffer::IncWrite() |
202 { |
208 { |
203 if(++iWrite==iNoOfSlots) |
209 if(++iWrite==iNoOfSlots) |
347 |
353 |
348 void CTelObject::CreateDummySessionObjectL(CTelSession* aTelSession) |
354 void CTelObject::CreateDummySessionObjectL(CTelSession* aTelSession) |
349 { |
355 { |
350 if (iDestroyDummySubSession==NULL) |
356 if (iDestroyDummySubSession==NULL) |
351 { |
357 { |
352 LOGTEXT("CDestroyDummySubSession object does not already exist and will be created."); |
358 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELOBJECT_CREATEDUMMYSESSIONOBJECTL_1, "CDestroyDummySubSession object does not already exist and will be created."); |
353 iDestroyDummySubSession = CDestroyDummySubSession::NewL(aTelSession->TelServer(),this); |
359 iDestroyDummySubSession = CDestroyDummySubSession::NewL(aTelSession->TelServer(),this); |
354 } |
360 } |
355 else |
361 else |
356 { |
362 { |
357 LOGTEXT("CDestroyDummySubSession object already exists and will not be created"); |
363 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELOBJECT_CREATEDUMMYSESSIONOBJECTL_2, "CDestroyDummySubSession object already exists and will not be created"); |
358 } |
364 } |
359 |
365 |
360 } |
366 } |
361 |
367 |
362 void CTelObject::CreateDummySession(CTelSession* aSession, const TInt aSubSessionHandle, TBool aCreateDummy) |
368 void CTelObject::CreateDummySession(CTelSession* aSession, const TInt aSubSessionHandle, TBool aCreateDummy) |
363 // |
369 // |
364 // So the server has to create a dummy session just to keep session alive until completed |
370 // So the server has to create a dummy session just to keep session alive until completed |
365 // function is called. |
371 // function is called. |
366 // |
372 // |
367 { |
373 { |
368 LOGTEXT2("CreateDummySession() with iDestroyDummySubSession = %x", iDestroyDummySubSession); |
374 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELOBJECT_CREATEDUMMYSESSION_1, "CreateDummySession() with iDestroyDummySubSession = %x", iDestroyDummySubSession); |
369 iCreateDummy=aCreateDummy; |
375 iCreateDummy=aCreateDummy; |
370 |
376 |
371 if (iDestroyDummySubSession->iOpen == EFalse) |
377 if (iDestroyDummySubSession->iOpen == EFalse) |
372 { |
378 { |
373 if ( IsActiveReq(aSession,aSubSessionHandle) || aCreateDummy) |
379 if ( IsActiveReq(aSession,aSubSessionHandle) || aCreateDummy) |
374 { |
380 { |
375 LOGTEXT("About to create dummy session"); |
381 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELOBJECT_CREATEDUMMYSESSION_2, "About to create dummy session"); |
376 __ASSERT_ALWAYS(aSession!=NULL,Fault(EEtelFaultBadTelSessionPointer)); |
382 __ASSERT_ALWAYS(aSession!=NULL,Fault(EEtelFaultBadTelSessionPointer)); |
377 CObject* theObj=this; |
383 CObject* theObj=this; |
378 while(theObj->Owner()) |
384 while(theObj->Owner()) |
379 { |
385 { |
380 theObj->Open(); |
386 theObj->Open(); |
385 |
391 |
386 // incrementing the server's session count to include the dummy session, which |
392 // incrementing the server's session count to include the dummy session, which |
387 // has been previously allocated upon the CTelObject creation (by calling |
393 // has been previously allocated upon the CTelObject creation (by calling |
388 // CreateDummySessionObjectL() ) |
394 // CreateDummySessionObjectL() ) |
389 iTelServer->Inc(); |
395 iTelServer->Inc(); |
390 LOGTEXT2("Added a Dummy Session, producing server's session count of %d", iTelServer->Count()); |
396 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELOBJECT_CREATEDUMMYSESSION_3, "Added a Dummy Session, producing server's session count of %d", iTelServer->Count()); |
391 |
397 |
392 iDestroyDummySubSession->iTelServer = iTelServer; |
398 iDestroyDummySubSession->iTelServer = iTelServer; |
393 iDestroyDummySubSession->iTelObject = this; |
399 iDestroyDummySubSession->iTelObject = this; |
394 iDestroyDummySubSession->iOpen = ETrue; |
400 iDestroyDummySubSession->iOpen = ETrue; |
395 } |
401 } |
444 { |
450 { |
445 iActiveReqCount++; |
451 iActiveReqCount++; |
446 ret=ETrue; |
452 ret=ETrue; |
447 } |
453 } |
448 } |
454 } |
449 LOGTEXT2("IsActiveReq found %d active reqs", iActiveReqCount); |
455 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELOBJECT_ISACTIVEREQ_1, "IsActiveReq found %d active reqs", iActiveReqCount); |
450 return ret; |
456 return ret; |
451 } |
457 } |
452 |
458 |
453 void CTelObject::CancelActiveReq(CTelSession* aSession,const TInt aSubSessionHandle) |
459 void CTelObject::CancelActiveReq(CTelSession* aSession,const TInt aSubSessionHandle) |
454 // |
460 // |
455 // active list - must inform tsy by calling CancelService |
461 // active list - must inform tsy by calling CancelService |
456 // this request will be destroyed when Tsy do an up call ReqCompleted with KErrCancel |
462 // this request will be destroyed when Tsy do an up call ReqCompleted with KErrCancel |
457 // Only go through the list once set the count to zero at start to count number of requests |
463 // Only go through the list once set the count to zero at start to count number of requests |
458 // |
464 // |
459 { |
465 { |
460 LOGTEXT("Entered CancelActiveReq"); |
466 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELOBJECT_CANCELACTIVEREQ_1, "Entered CancelActiveReq"); |
461 CReqEntry* reqEntry=NULL; |
467 CReqEntry* reqEntry=NULL; |
462 TDblQueIter<CReqEntry> iter(PhoneOwner()->ReqActiveList()); |
468 TDblQueIter<CReqEntry> iter(PhoneOwner()->ReqActiveList()); |
463 while(reqEntry=iter++,reqEntry!=NULL) // go through the list from begin to end |
469 while(reqEntry=iter++,reqEntry!=NULL) // go through the list from begin to end |
464 { |
470 { |
465 if (aSession==reqEntry->iSession && aSubSessionHandle==reqEntry->iMessage.Int3() && reqEntry->iClientInterested ) |
471 if (aSession==reqEntry->iSession && aSubSessionHandle==reqEntry->iMessage.Int3() && reqEntry->iClientInterested ) |
468 __ASSERT_ALWAYS(iActiveReqCount>=0,Fault(EEtelFaultNegativeActiveReqCount)); |
474 __ASSERT_ALWAYS(iActiveReqCount>=0,Fault(EEtelFaultNegativeActiveReqCount)); |
469 if (reqEntry->iCancelFnCalled==FALSE) |
475 if (reqEntry->iCancelFnCalled==FALSE) |
470 { |
476 { |
471 if (reqEntry->iPlacedRequest) |
477 if (reqEntry->iPlacedRequest) |
472 { |
478 { |
473 LOGTEXT2("Calling Cancel Service ActiveReq TsyReq=%d", reqEntry->iTsyReqHandle); |
479 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELOBJECT_CANCELACTIVEREQ_2, "Calling Cancel Service ActiveReq TsyReq=%d", reqEntry->iTsyReqHandle); |
474 reqEntry->iCancelFnCalled=ETrue; |
480 reqEntry->iCancelFnCalled=ETrue; |
475 CancelService(reqEntry->iFunction,reqEntry->iTsyReqHandle); |
481 CancelService(reqEntry->iFunction,reqEntry->iTsyReqHandle); |
476 |
482 |
477 // |
483 // |
478 // In calling CancelService() it is possible that a second |
484 // In calling CancelService() it is possible that a second |
949 // request modes for the server, before calling the pure virtual Service in the class to do |
955 // request modes for the server, before calling the pure virtual Service in the class to do |
950 // the actual command. |
956 // the actual command. |
951 // |
957 // |
952 { |
958 { |
953 |
959 |
954 LOGTEXT2("CTelObject::GeneralReq - IPC=%d", aMessage.Function()); |
960 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELOBJECT_GENERALREQ_1, "CTelObject::GeneralReq - IPC=%d", aMessage.Function()); |
955 RECORD_IPC(aMessage,aSession,this,aFromFlowControlResume); |
961 RECORD_IPC(aMessage,aSession,this,aFromFlowControlResume); |
956 if (aFromFlowControlResume && !aFromFlowControlResume){ ; } // avoid compiler warning when ETEL_RECORDER is not defined |
962 if (aFromFlowControlResume && !aFromFlowControlResume){ ; } // avoid compiler warning when ETEL_RECORDER is not defined |
957 |
963 |
958 TInt type=aMessage.Int1(); |
964 TInt type=aMessage.Int1(); |
959 CReqEntry* reqEntry=NULL; |
965 CReqEntry* reqEntry=NULL; |
1119 __ASSERT_ALWAYS(updatedReqEntry!=NULL, Fault(EEtelFaultCompletionReceivedWithNoReqPackage)); |
1125 __ASSERT_ALWAYS(updatedReqEntry!=NULL, Fault(EEtelFaultCompletionReceivedWithNoReqPackage)); |
1120 |
1126 |
1121 TInt error = ResolveError(updatedReqEntry->iSession,aError); // set error as either low or high byte |
1127 TInt error = ResolveError(updatedReqEntry->iSession,aError); // set error as either low or high byte |
1122 |
1128 |
1123 ipc=updatedReqEntry->iFunction; |
1129 ipc=updatedReqEntry->iFunction; |
1124 LOGTEXT4("CTelObject::ReqCompleted, IPC=%d, TsyHandle=%d, Error=%d", ipc, aTsyReqHandle, aError); |
1130 OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CTELOBJECT_REQCOMPLETED_1, "CTelObject::ReqCompleted, IPC=%d, TsyHandle=%d, Error=%d", ipc, aTsyReqHandle, aError); |
1125 |
1131 |
1126 TReqMode reqMode = updatedReqEntry->iReqMode; |
1132 TReqMode reqMode = updatedReqEntry->iReqMode; |
1127 TBool ret=EFalse; |
1133 TBool ret=EFalse; |
1128 if (error!=KErrCancel) |
1134 if (error!=KErrCancel) |
1129 { |
1135 { |
1267 void CTelObject::CheckAndDestroyDummySubSession() |
1273 void CTelObject::CheckAndDestroyDummySubSession() |
1268 { |
1274 { |
1269 if (iActiveReqCount) |
1275 if (iActiveReqCount) |
1270 { |
1276 { |
1271 iActiveReqCount--; |
1277 iActiveReqCount--; |
1272 LOGTEXT2("In CheckAndDestroyDummySubSession(), iActiveReqCount down to %d", iActiveReqCount); |
1278 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELOBJECT_CHECKANDDESTROYDUMMYSUBSESSION_1, "In CheckAndDestroyDummySubSession(), iActiveReqCount down to %d", iActiveReqCount); |
1273 if ((iActiveReqCount==0) && (iCreateDummy==FALSE)) |
1279 if ((iActiveReqCount==0) && (iCreateDummy==FALSE)) |
1274 { |
1280 { |
1275 __ASSERT_ALWAYS(iDestroyDummySubSession!=NULL,Fault(EEtelFaultBadTelSessionPointer)); |
1281 __ASSERT_ALWAYS(iDestroyDummySubSession!=NULL,Fault(EEtelFaultBadTelSessionPointer)); |
1276 if (!(iDestroyDummySubSession->IsActive())) // only set going if not already active! |
1282 if (!(iDestroyDummySubSession->IsActive())) // only set going if not already active! |
1277 { |
1283 { |
1484 // |
1490 // |
1485 // Complete a request entry and write data back to client |
1491 // Complete a request entry and write data back to client |
1486 // |
1492 // |
1487 { |
1493 { |
1488 __ASSERT_ALWAYS(aReqEntry!=NULL,Fault(EEtelFaultCompleteReqWithoutReqEntry)); |
1494 __ASSERT_ALWAYS(aReqEntry!=NULL,Fault(EEtelFaultCompleteReqWithoutReqEntry)); |
1489 LOGTEXT("CTelObject::WriteBackAndCompleteReq"); |
1495 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELOBJECT_WRITEBACKANDCOMPLETEREQ_1, "CTelObject::WriteBackAndCompleteReq"); |
1490 TInt basicMessageType = (aReqEntry->iMessage.Int1() & ~KPriorityClientReq); |
1496 TInt basicMessageType = (aReqEntry->iMessage.Int1() & ~KPriorityClientReq); |
1491 |
1497 |
1492 switch (basicMessageType) |
1498 switch (basicMessageType) |
1493 { |
1499 { |
1494 case EIsaNull: |
1500 case EIsaNull: |
1831 // |
1837 // |
1832 { |
1838 { |
1833 __ASSERT_ALWAYS(aReqEntry!=NULL,Fault(EEtelFaultCallTsyServiceWithoutReqPackage)); |
1839 __ASSERT_ALWAYS(aReqEntry!=NULL,Fault(EEtelFaultCallTsyServiceWithoutReqPackage)); |
1834 TTsyReqHandle tsyReqHandle=aReqEntry->iTsyReqHandle; |
1840 TTsyReqHandle tsyReqHandle=aReqEntry->iTsyReqHandle; |
1835 |
1841 |
1836 LOGTEXT2("Entered ServiceExtFunc with TSY handle %d", tsyReqHandle); |
1842 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSUBSESSIONEXTBASE_SERVICEEXTFUNC_1, "Entered ServiceExtFunc with TSY handle %d", tsyReqHandle); |
1837 TInt ret=KErrNone; |
1843 TInt ret=KErrNone; |
1838 |
1844 |
1839 TInt basicMessageType = aMessage.Int1() & ~(KPriorityClientReq); |
1845 TInt basicMessageType = aMessage.Int1() & ~(KPriorityClientReq); |
1840 switch (basicMessageType) |
1846 switch (basicMessageType) |
1841 { |
1847 { |