telephonyserverplugins/common_tsy/commontsy/src/mmsms/cmmsmstsy.cpp
branchRCL_3
changeset 20 07a122eea281
parent 19 630d2f34d719
equal deleted inserted replaced
19:630d2f34d719 20:07a122eea281
     1 // Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2006-2009 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".
    14 //
    14 //
    15 
    15 
    16 
    16 
    17 
    17 
    18 // INCLUDE FILES
    18 // INCLUDE FILES
    19 
       
    20 #include "OstTraceDefinitions.h"
       
    21 #ifdef OST_TRACE_COMPILER_IN_USE
       
    22 #include "cmmsmstsyTraces.h"
       
    23 #endif
       
    24 
       
    25 #include "cmmsmstsy.h"
    19 #include "cmmsmstsy.h"
    26 #include "cmmphonetsy.h"
    20 #include "cmmphonetsy.h"
    27 #include "cmmsmsstoragetsy.h"
    21 #include "cmmsmsstoragetsy.h"
    28 #include "cmmsmsgsmext.h"
    22 #include "cmmsmsgsmext.h"
    29 #include "cmmtsyreqhandlestore.h"
    23 #include "cmmtsyreqhandlestore.h"
    41 // ======== MEMBER FUNCTIONS ========
    35 // ======== MEMBER FUNCTIONS ========
    42 
    36 
    43 CMmSmsTsy::CMmSmsTsy():
    37 CMmSmsTsy::CMmSmsTsy():
    44     iReqHandleType(EMultimodeSmsReqHandleUnknown)
    38     iReqHandleType(EMultimodeSmsReqHandleUnknown)
    45     {
    39     {
    46 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_CTOR_1, "TSY: CMmSmsTsy::CMmSmsTsy: constructor");
    40 TFLOGSTRING("TSY: CMmSmsTsy::CMmSmsTsy: constructor");
    47     }
    41     }
    48 
    42 
    49 void CMmSmsTsy::ConstructL()
    43 void CMmSmsTsy::ConstructL()
    50     {
    44     {
    51 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_CONSTRUCTL_1, "TSY: CMmSmsTsy::ConstructL");
    45 TFLOGSTRING("TSY: CMmSmsTsy::ConstructL");
    52 #ifdef REQHANDLE_TIMER   
    46 #ifdef REQHANDLE_TIMER   
    53     //create req handle store
    47     //create req handle store
    54     iTsyReqHandleStore = CMmTsyReqHandleStore::NewL( this, iMmPhone, 
    48     iTsyReqHandleStore = CMmTsyReqHandleStore::NewL( this, iMmPhone, 
    55         EMultimodeSmsMaxNumOfRequests, iSmsReqHandles );
    49         EMultimodeSmsMaxNumOfRequests, iSmsReqHandles );
    56 #else
    50 #else
    86         }
    80         }
    87     else
    81     else
    88         {
    82         {
    89         iIsOffline = EFalse;
    83         iIsOffline = EFalse;
    90         }
    84         }
    91 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_CONSTRUCTL_2, "TSY: CMmSmsTsy::ConstructL: iIsOffline has been initialised to %d", iIsOffline);
    85 TFLOGSTRING2("TSY: CMmSmsTsy::ConstructL: iIsOffline has been initialised to %d", iIsOffline);
    92 
    86 
    93     // there's no pending ResumeSmsReception request at startup
    87     // there's no pending ResumeSmsReception request at startup
    94     iResumeSmsReceptionPending = EFalse;
    88     iResumeSmsReceptionPending = EFalse;
    95   
    89   
    96     // Initialization for sms NoFdnCheck
    90     // Initialization for sms NoFdnCheck
   112     return aMmSmsTsy;
   106     return aMmSmsTsy;
   113     }
   107     }
   114 
   108 
   115 CMmSmsTsy::~CMmSmsTsy()
   109 CMmSmsTsy::~CMmSmsTsy()
   116     {
   110     {
   117 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_DTOR_1, "TSY: CMmSmsTsy::~CMmSmsTsy");
   111 TFLOGSTRING("TSY: CMmSmsTsy::~CMmSmsTsy");
   118     if ( iMmPhone )
   112     if ( iMmPhone )
   119         {
   113         {
   120         // deregister tsy object from message manager
   114         // deregister tsy object from message manager
   121         iMmPhone->MessageManager()->DeregisterTsyObject(this);
   115         iMmPhone->MessageManager()->DeregisterTsyObject(this);
   122 
   116 
   253     // before processing further the request, check if offline mode status
   247     // before processing further the request, check if offline mode status
   254     // is enabled and if the given request can be perfomed in that case.
   248     // is enabled and if the given request can be perfomed in that case.
   255     if ( ERfsStateInfoInactive == iMmPhone->GetRfStateInfo() &&
   249     if ( ERfsStateInfoInactive == iMmPhone->GetRfStateInfo() &&
   256         !IsRequestPossibleInOffline( aIpc ) )  
   250         !IsRequestPossibleInOffline( aIpc ) )  
   257         {
   251         {
   258 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_EXTFUNC_1, "TSY: Offline mode ON, request is not allowed: %d", aIpc );
   252 TFLOGSTRING2 ("TSY: Offline mode ON, request is not allowed: %d", aIpc );
   259         TInt error = CMmCommonStaticUtility::EpocErrorCode( KErrGeneral, 
   253         TInt error = CMmCommonStaticUtility::EpocErrorCode( KErrGeneral, 
   260                 KErrGsmOfflineOpNotAllowed );
   254                 KErrGsmOfflineOpNotAllowed );
   261 
   255 
   262         // Complete the request with appropiate error
   256         // Complete the request with appropiate error
   263         ReqCompleted ( aTsyReqHandle, error ); 
   257         ReqCompleted ( aTsyReqHandle, error ); 
   304                 TRAP( leaveCode, ret = DoExtFuncL( aTsyReqHandle, aIpc, 
   298                 TRAP( leaveCode, ret = DoExtFuncL( aTsyReqHandle, aIpc, 
   305                     aPackage ); );
   299                     aPackage ); );
   306 
   300 
   307                 if ( KErrNone != leaveCode )
   301                 if ( KErrNone != leaveCode )
   308                     {
   302                     {
   309 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_EXTFUNC_2, "CMmSmsTsy: Leave trapped!, IPC=%d, error value:%d", aIpc, leaveCode );
   303 TFLOGSTRING3("CMmSmsTsy: Leave trapped!, IPC=%d, error value:%d", aIpc, leaveCode );
   310                     ReqCompleted( aTsyReqHandle, leaveCode );
   304                     ReqCompleted( aTsyReqHandle, leaveCode );
   311                     }
   305                     }
   312 
   306 
   313                 //save request handle
   307                 //save request handle
   314                 if ( EMultimodeSmsReqHandleUnknown != iReqHandleType )
   308                 if ( EMultimodeSmsReqHandleUnknown != iReqHandleType )
   772 TInt CMmSmsTsy::ReceiveMessageL( 
   766 TInt CMmSmsTsy::ReceiveMessageL( 
   773     const TTsyReqHandle aTsyReqHandle, 
   767     const TTsyReqHandle aTsyReqHandle, 
   774     TDes8* aMsgData, 
   768     TDes8* aMsgData, 
   775     TDes8* aMsgAttributes )
   769     TDes8* aMsgAttributes )
   776     {
   770     {
   777 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_RECEIVEMESSAGEL_1, "TSY: CMmSmsTsy::ReceiveMessageL\n");
   771 TFLOGSTRING("TSY: CMmSmsTsy::ReceiveMessageL\n");
   778 	
   772 	
   779 	if(sizeof(RMobileSmsMessaging::TMobileSmsReceiveAttributesV1) > aMsgAttributes->Size())
   773 	if(sizeof(RMobileSmsMessaging::TMobileSmsReceiveAttributesV1) > aMsgAttributes->Size())
   780 		{
   774 		{
   781 		return KErrArgument;
   775 		return KErrArgument;
   782 		}
   776 		}
   857 	aDataPackage->UnPackData( aSmsRoutingStatus ) ;
   851 	aDataPackage->UnPackData( aSmsRoutingStatus ) ;
   858 
   852 
   859     if ( ( KErrNone == aError ) && 
   853     if ( ( KErrNone == aError ) && 
   860         ( KSmsRoutingActivated == aSmsRoutingStatus ) )
   854         ( KSmsRoutingActivated == aSmsRoutingStatus ) )
   861         {
   855         {
   862 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_COMPLETEACTIVATESMSROUTING_1, "TSY: CMmSmsTsy::CompleteActivateSmsRouting SMS routing activated");
   856 TFLOGSTRING("TSY: CMmSmsTsy::CompleteActivateSmsRouting SMS routing activated");
   863         iServerRoutingActivity = ERoutingActivated;
   857         iServerRoutingActivity = ERoutingActivated;
   864         }
   858         }
   865 	else if ( ( KErrNone == aError ) && 
   859 	else if ( ( KErrNone == aError ) && 
   866 	    ( KSmsRoutingDeactivated == aSmsRoutingStatus ) )
   860 	    ( KSmsRoutingDeactivated == aSmsRoutingStatus ) )
   867 		{
   861 		{
   868 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_COMPLETEACTIVATESMSROUTING_2, "TSY: CMmSmsTsy::CompleteActivateSmsRouting SMS routing not activated");
   862 TFLOGSTRING("TSY: CMmSmsTsy::CompleteActivateSmsRouting SMS routing not activated");
   869         iServerRoutingActivity = ERoutingNotActivated;
   863         iServerRoutingActivity = ERoutingNotActivated;
   870 		}     
   864 		}     
   871     else
   865     else
   872         {
   866         {
   873 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_COMPLETEACTIVATESMSROUTING_3, "TSY: CMmSmsTsy::CompleteActivateSmsRouting SMS routing activation failed");
   867 TFLOGSTRING("TSY: CMmSmsTsy::CompleteActivateSmsRouting SMS routing activation failed");
   874         iServerRoutingActivity = ERoutingNotActivated;
   868         iServerRoutingActivity = ERoutingNotActivated;
   875 
   869 
   876         TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( 
   870         TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( 
   877             EMultimodeSmsReceiveMessage );
   871             EMultimodeSmsReceiveMessage );
   878 
   872 
   898     TSmsMsg* smsMsg;
   892     TSmsMsg* smsMsg;
   899 
   893 
   900     TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle( 
   894     TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle( 
   901         EMultimodeSmsReceiveMessage );
   895         EMultimodeSmsReceiveMessage );
   902 
   896 
   903 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_COMPLETERECEIVEMESSAGE_1, "TSY: CMmSmsTsy::CompleteReceiveMessage. iClientStorageFull: %d", iClientStorageFull );
   897 TFLOGSTRING2("TSY: CMmSmsTsy::CompleteReceiveMessage. iClientStorageFull: %d", iClientStorageFull );
   904 
   898 
   905     // SMS successfully received
   899     // SMS successfully received
   906     if ( KErrNone == aError )
   900     if ( KErrNone == aError )
   907         {
   901         {
   908         //unpack received data 
   902         //unpack received data 
   913         
   907         
   914 		 // if store is not full, receive new class2 message and get 
   908 		 // if store is not full, receive new class2 message and get 
   915          // notification
   909          // notification
   916 		 if ( smsClass2 && ( 0 != smsMsg->iLocation ) && iMmSmsStorageTsy ) 
   910 		 if ( smsClass2 && ( 0 != smsMsg->iLocation ) && iMmSmsStorageTsy ) 
   917     		{
   911     		{
   918 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_COMPLETERECEIVEMESSAGE_2, "TSY: CMmSmsTsy::CompleteReceiveMessage. CompleteNotifyStoreEvent happens");
   912 TFLOGSTRING("TSY: CMmSmsTsy::CompleteReceiveMessage. CompleteNotifyStoreEvent happens");
   919 			iMmSmsStorageTsy->CMmSmsStorageTsy::CompleteNotifyStoreEvent(
   913 			iMmSmsStorageTsy->CMmSmsStorageTsy::CompleteNotifyStoreEvent(
   920 			smsMsg->iLocation, RMobilePhoneStore::KStoreEntryAdded	);
   914 			smsMsg->iLocation, RMobilePhoneStore::KStoreEntryAdded	);
   921     		}
   915     		}
   922 
   916 
   923         // if SMS is a Class2 and SMS Memories are full and SIM SMS Memory 
   917         // if SMS is a Class2 and SMS Memories are full and SIM SMS Memory 
   990                   	}
   984                   	}
   991                 
   985                 
   992                 iTsyReqHandleStore->ResetTsyReqHandle( 
   986                 iTsyReqHandleStore->ResetTsyReqHandle( 
   993                     EMultimodeSmsReceiveMessage );
   987                     EMultimodeSmsReceiveMessage );
   994 
   988 
   995 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_COMPLETERECEIVEMESSAGE_3, "TSY: CMmSmsTsy::CompleteReceiveMessage. Deliver SMS to the SMS stack");
   989 TFLOGSTRING("TSY: CMmSmsTsy::CompleteReceiveMessage. Deliver SMS to the SMS stack");
   996                 ReqCompleted( reqHandle, ret ); 
   990                 ReqCompleted( reqHandle, ret ); 
   997                 
   991                 
   998                 // increase the count of expected acknowledgements
   992                 // increase the count of expected acknowledgements
   999                 if(ret == KErrNone)
   993                 if(ret == KErrNone)
  1000 					{
   994 					{
  1059 					EMobileSmsMessagingNackSmsStored, &package ); );
  1053 					EMobileSmsMessagingNackSmsStored, &package ); );
  1060 				if (  KErrNone != trapError )
  1054 				if (  KErrNone != trapError )
  1061 					{
  1055 					{
  1062 					ret = trapError;
  1056 					ret = trapError;
  1063 					}
  1057 					}
  1064 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_COMPLETERECEIVEMESSAGE_4, "TSY: CMmSmsTsy::CompleteReceiveMessage.KErrGsmSMSUnspecifiedProtocolError ");
  1058 TFLOGSTRING("TSY: CMmSmsTsy::CompleteReceiveMessage.KErrGsmSMSUnspecifiedProtocolError ");
  1065                 }
  1059                 }
  1066             else // SMS Memory is full
  1060             else // SMS Memory is full
  1067                 {
  1061                 {
  1068                 CMmDataPackage package;
  1062                 CMmDataPackage package;
  1069                 TSmsMsg* nullSms = NULL;
  1063                 TSmsMsg* nullSms = NULL;
  1095 				);
  1089 				);
  1096 			if (  KErrNone != trapError )
  1090 			if (  KErrNone != trapError )
  1097 				{
  1091 				{
  1098 				ret = trapError;
  1092 				ret = trapError;
  1099 				}
  1093 				}
  1100 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_COMPLETERECEIVEMESSAGE_5, "TSY: CMmSmsTsy::CompleteReceiveMessage.KErrGsmSMSMemoryCapacityExceeded ");
  1094 TFLOGSTRING("TSY: CMmSmsTsy::CompleteReceiveMessage.KErrGsmSMSMemoryCapacityExceeded ");
  1101             }
  1095             }
  1102         else if ( !reqHandle )
  1096         else if ( !reqHandle )
  1103             {
  1097             {
  1104             // Routing is activated, but SMS stack hasn't called 
  1098             // Routing is activated, but SMS stack hasn't called 
  1105             // ReceiveMessage. Nack received message internally with cause 
  1099             // ReceiveMessage. Nack received message internally with cause 
  1202         {
  1196         {
  1203         for ( TInt i = 0; i < iSmsMsgArray->Count(); i++ )
  1197         for ( TInt i = 0; i < iSmsMsgArray->Count(); i++ )
  1204             {
  1198             {
  1205             if ( EFalse == iSmsMsgArray->At( i )->iDeleteAfterClientAck )
  1199             if ( EFalse == iSmsMsgArray->At( i )->iDeleteAfterClientAck )
  1206                 {
  1200                 {
  1207 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_DELIVERCLASS2TOSMSSTACK_1, "TSY: CMmSmsTsy::DeliverClass2ToSmsStack. Deliver SMS to the SMS stack. Array count: %d", iSmsMsgArray->Count());
  1201 TFLOGSTRING2("TSY: CMmSmsTsy::DeliverClass2ToSmsStack. Deliver SMS to the SMS stack. Array count: %d", iSmsMsgArray->Count());
  1208 				// TSY can now delete the message if SMS stack ack message
  1202 				// TSY can now delete the message if SMS stack ack message
  1209                 // successfully
  1203                 // successfully
  1210                 iSmsMsgArray->At( i )->iDeleteAfterClientAck = ETrue;
  1204                 iSmsMsgArray->At( i )->iDeleteAfterClientAck = ETrue;
  1211 
  1205 
  1212                 TInt ret = iMmSmsExtInterface->CompleteReceiveMessage( 
  1206                 TInt ret = iMmSmsExtInterface->CompleteReceiveMessage( 
  1239 TInt CMmSmsTsy::AckSmsStoredL( 
  1233 TInt CMmSmsTsy::AckSmsStoredL( 
  1240     const TTsyReqHandle aTsyReqHandle, 
  1234     const TTsyReqHandle aTsyReqHandle, 
  1241     const TDesC8* aMsgData, 
  1235     const TDesC8* aMsgData, 
  1242     TBool const * aMemoryFull )
  1236     TBool const * aMemoryFull )
  1243     {
  1237     {
  1244 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_ACKSMSSTOREDL_1, "TSY: CMmSmsTsy::AckSmsStored. aMemoryFull: %d",*aMemoryFull);
  1238 TFLOGSTRING2("TSY: CMmSmsTsy::AckSmsStored. aMemoryFull: %d",*aMemoryFull);
  1245     TTsyReqHandle getAckStoredMessageHandle = 
  1239     TTsyReqHandle getAckStoredMessageHandle = 
  1246        iTsyReqHandleStore->GetTsyReqHandle( EMultimodeSmsAckStored );
  1240        iTsyReqHandleStore->GetTsyReqHandle( EMultimodeSmsAckStored );
  1247 
  1241 
  1248     if ( EMultimodeSmsReqHandleUnknown < getAckStoredMessageHandle )
  1242     if ( EMultimodeSmsReqHandleUnknown < getAckStoredMessageHandle )
  1249         {
  1243         {
  1251         ReqCompleted( aTsyReqHandle, KErrServerBusy );
  1245         ReqCompleted( aTsyReqHandle, KErrServerBusy );
  1252         }
  1246         }
  1253     else
  1247     else
  1254     if ( iExpectAckOrNack <= 0 )
  1248     if ( iExpectAckOrNack <= 0 )
  1255         {
  1249         {
  1256 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_ACKSMSSTOREDL_2, "TSY: CMmSmsTsy::AckSmsStoredL. -> ReceiveMessage not requested - error returned ");
  1250 TFLOGSTRING("TSY: CMmSmsTsy::AckSmsStoredL. -> ReceiveMessage not requested - error returned ");        
  1257         ReqCompleted( aTsyReqHandle, KErrNotReady );
  1251         ReqCompleted( aTsyReqHandle, KErrNotReady );
  1258         return KErrNone; 
  1252         return KErrNone; 
  1259         }
  1253         }
  1260     else
  1254     else
  1261         {
  1255         {
  1269             {
  1263             {
  1270             if ( EFalse != iSmsMsgArray->At( i )->iDeleteAfterClientAck && 
  1264             if ( EFalse != iSmsMsgArray->At( i )->iDeleteAfterClientAck && 
  1271                  KErrNone == aMsgData->CompareF( 
  1265                  KErrNone == aMsgData->CompareF( 
  1272                  iSmsMsgArray->At( i )->iSmsMsg ) )
  1266                  iSmsMsgArray->At( i )->iSmsMsg ) )
  1273                 {
  1267                 {
  1274 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_ACKSMSSTOREDL_3, "TSY: CMmSmsTsy::AckSmsStored. Delete SMS: %d, Array count: %d",i,iSmsMsgArray->Count());
  1268 TFLOGSTRING3("TSY: CMmSmsTsy::AckSmsStored. Delete SMS: %d, Array count: %d",i,iSmsMsgArray->Count());
  1275                 delete iSmsMsgArray->At( i ); // Delete object from memory
  1269                 delete iSmsMsgArray->At( i ); // Delete object from memory
  1276                 iSmsMsgArray->Delete( i );    // Delete pointer from array
  1270                 iSmsMsgArray->Delete( i );    // Delete pointer from array
  1277                 iSmsMsgArray->Compress(); 
  1271                 iSmsMsgArray->Compress(); 
  1278 
  1272 
  1279                 // Class 2 message is already acknowledged to the network 
  1273                 // Class 2 message is already acknowledged to the network 
  1364 TInt CMmSmsTsy::NackSmsStoredL( 
  1358 TInt CMmSmsTsy::NackSmsStoredL( 
  1365     const TTsyReqHandle aTsyReqHandle, 
  1359     const TTsyReqHandle aTsyReqHandle, 
  1366     const TDesC8* aMsgData, 
  1360     const TDesC8* aMsgData, 
  1367     TInt* aRpCause )
  1361     TInt* aRpCause )
  1368     {
  1362     {
  1369 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_NACKSMSSTOREDL_1, "TSY: CMmSmsTsy::NackSmsStored. aRpCause: %d",*aRpCause);
  1363 TFLOGSTRING2("TSY: CMmSmsTsy::NackSmsStored. aRpCause: %d",*aRpCause);
  1370     TTsyReqHandle nackHandle = 
  1364     TTsyReqHandle nackHandle = 
  1371         iTsyReqHandleStore->GetTsyReqHandle( EMultimodeSmsNackStored );
  1365         iTsyReqHandleStore->GetTsyReqHandle( EMultimodeSmsNackStored );
  1372 
  1366 
  1373     if ( 0 < nackHandle )
  1367     if ( 0 < nackHandle )
  1374         {
  1368         {
  1378         ReqCompleted( aTsyReqHandle, KErrServerBusy );
  1372         ReqCompleted( aTsyReqHandle, KErrServerBusy );
  1379         }
  1373         }
  1380     else
  1374     else
  1381     if ( iExpectAckOrNack <= 0 )
  1375     if ( iExpectAckOrNack <= 0 )
  1382         {
  1376         {
  1383 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_NACKSMSSTOREDL_2, "TSY: CMmSmsTsy::AckSmsStoredL. -> ReceiveMessage not requested - error returned ");
  1377 TFLOGSTRING("TSY: CMmSmsTsy::AckSmsStoredL. -> ReceiveMessage not requested - error returned ");        
  1384         ReqCompleted( aTsyReqHandle, KErrNotReady );
  1378         ReqCompleted( aTsyReqHandle, KErrNotReady );
  1385         return KErrNone; 
  1379         return KErrNone; 
  1386         }
  1380         }
  1387     else
  1381     else
  1388         {
  1382         {
  1509 // --------------------------------------------------------------------------- 
  1503 // --------------------------------------------------------------------------- 
  1510 //
  1504 //
  1511 TInt CMmSmsTsy::ResumeSmsReceptionL( 
  1505 TInt CMmSmsTsy::ResumeSmsReceptionL( 
  1512     const TTsyReqHandle aTsyReqHandle )
  1506     const TTsyReqHandle aTsyReqHandle )
  1513     {
  1507     {
  1514 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_RESUMESMSRECEPTIONL_1, "TSY: CMmSmsTsy::ResumeSmsReceptionL");
  1508 TFLOGSTRING("TSY: CMmSmsTsy::ResumeSmsReceptionL");
  1515     TTsyReqHandle resumeHandle = 
  1509     TTsyReqHandle resumeHandle = 
  1516         iTsyReqHandleStore->GetTsyReqHandle( EMultimodeSmsResumeReception );
  1510         iTsyReqHandleStore->GetTsyReqHandle( EMultimodeSmsResumeReception );
  1517 
  1511 
  1518     if ( 0 < resumeHandle )
  1512     if ( 0 < resumeHandle )
  1519         {
  1513         {
  1585 // --------------------------------------------------------------------------- 
  1579 // --------------------------------------------------------------------------- 
  1586 //
  1580 //
  1587 void CMmSmsTsy::SetOffline( 
  1581 void CMmSmsTsy::SetOffline( 
  1588     TBool aIsOffline )
  1582     TBool aIsOffline )
  1589     {
  1583     {
  1590 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_SETOFFLINE_1, "TSY: CMmSmsTsy::SetOffline has been called with %d", aIsOffline);
  1584 TFLOGSTRING2("TSY: CMmSmsTsy::SetOffline has been called with %d", aIsOffline);
  1591 
  1585 
  1592     if ( !aIsOffline && iIsOffline )
  1586     if ( !aIsOffline && iIsOffline )
  1593         {
  1587         {
  1594         // changing from off-line to on-line
  1588         // changing from off-line to on-line
  1595         if ( iResumeSmsReceptionPending ) 
  1589         if ( iResumeSmsReceptionPending ) 
  1630 //
  1624 //
  1631 TInt CMmSmsTsy::SetMoSmsBearer( 
  1625 TInt CMmSmsTsy::SetMoSmsBearer( 
  1632     const TTsyReqHandle aTsyReqHandle, 
  1626     const TTsyReqHandle aTsyReqHandle, 
  1633     RMobileSmsMessaging::TMobileSmsBearer* aBearer )
  1627     RMobileSmsMessaging::TMobileSmsBearer* aBearer )
  1634     {
  1628     {
  1635 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_SETMOSMSBEARER_1, "TSY: CMmSmsTsy::SetMoSmsBearer called");
  1629 TFLOGSTRING("TSY: CMmSmsTsy::SetMoSmsBearer called");
  1636     
  1630     
  1637     TTsyReqHandle setMoSmsBearerHandle = 
  1631     TTsyReqHandle setMoSmsBearerHandle = 
  1638         iTsyReqHandleStore->GetTsyReqHandle( EMultimodeSmsSetMoSmsBearer );
  1632         iTsyReqHandleStore->GetTsyReqHandle( EMultimodeSmsSetMoSmsBearer );
  1639     
  1633     
  1640     if ( 0 < setMoSmsBearerHandle )
  1634     if ( 0 < setMoSmsBearerHandle )
  1820         CSmsSendRequest* smsSendReq = new (ELeave) CSmsSendRequest();
  1814         CSmsSendRequest* smsSendReq = new (ELeave) CSmsSendRequest();
  1821         smsSendReq->SetSmsDataAndAttributes( sendData );
  1815         smsSendReq->SetSmsDataAndAttributes( sendData );
  1822 
  1816 
  1823         // save send request
  1817         // save send request
  1824         iSmsSendReq = smsSendReq;
  1818         iSmsSendReq = smsSendReq;
  1825 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_SENDMESSAGEL_1, "TSY: CMmSmsTsy::SendMessageL: Send request saved");
  1819 TFLOGSTRING("TSY: CMmSmsTsy::SendMessageL: Send request saved");
  1826 
  1820 
  1827         // send request to DOS
  1821         // send request to DOS
  1828         // packed parameter: TSendSmsDataAndAttributes
  1822         // packed parameter: TSendSmsDataAndAttributes
  1829         if ( iSmsNoFdnCheckFlag == ESmsNoFdnCheckUsed )
  1823         if ( iSmsNoFdnCheckFlag == ESmsNoFdnCheckUsed )
  1830             {
  1824             {
  1872 // CMmSmsTsy::IsRPError
  1866 // CMmSmsTsy::IsRPError
  1873 // Checks if error code is a relay protocol error
  1867 // Checks if error code is a relay protocol error
  1874 // --------------------------------------------------------------------------- 
  1868 // --------------------------------------------------------------------------- 
  1875 TBool CMmSmsTsy::IsRPError(TInt aError)
  1869 TBool CMmSmsTsy::IsRPError(TInt aError)
  1876     {
  1870     {
  1877     OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_ISRPERROR_1, "CMmSmsTsy::IsRPError(): %d", aError);
  1871     TFLOGSTRING2("CMmSmsTsy::IsRPError(): %d", aError);
  1878     
  1872     
  1879     TBool  isRPError = EFalse;
  1873     TBool  isRPError = EFalse;
  1880     switch (aError)
  1874     switch (aError)
  1881         {
  1875         {
  1882         case KErrGsmSMSShortMessageTransferRejected:
  1876         case KErrGsmSMSShortMessageTransferRejected:
  1957             iSmsSendReq->GetSendCounter() ) ) 
  1951             iSmsSendReq->GetSendCounter() ) ) 
  1958         {
  1952         {
  1959         // DOS returned error to send request. Message might be tried to be 
  1953         // DOS returned error to send request. Message might be tried to be 
  1960 		// resent (see method ResendSms).
  1954 		// resent (see method ResendSms).
  1961         // Timeout mechanism cannot access this part of code, ever.
  1955         // Timeout mechanism cannot access this part of code, ever.
  1962 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_COMPLETESENDMESSAGE_1, "TSY: CMmSmsTsy::CompleteSendMessage. Resend counter: %d", iSmsSendReq->GetSendCounter());
  1956 TFLOGSTRING2("TSY: CMmSmsTsy::CompleteSendMessage. Resend counter: %d", iSmsSendReq->GetSendCounter());
  1963         }
  1957         }
  1964     else
  1958     else
  1965         {
  1959         {
  1966         // This is executed
  1960         // This is executed
  1967 		// - if sending was successful
  1961 		// - if sending was successful
  2094 // --------------------------------------------------------------------------- 
  2088 // --------------------------------------------------------------------------- 
  2095 //
  2089 //
  2096 void CMmSmsTsy::CompleteSendSatMessage( 
  2090 void CMmSmsTsy::CompleteSendSatMessage( 
  2097     TInt aError )
  2091     TInt aError )
  2098     {
  2092     {
  2099 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_COMPLETESENDSATMESSAGE_1, "TSY: CMmSmsTsy::CompleteSendSatMessage. Complete SAT SMS send Error: %d", aError);
  2093 TFLOGSTRING2("TSY: CMmSmsTsy::CompleteSendSatMessage. Complete SAT SMS send Error: %d", aError);
  2100     iTsyReqHandleStore->ResetTsyReqHandle( EMultimodeSmsSendSatMessage );
  2094     iTsyReqHandleStore->ResetTsyReqHandle( EMultimodeSmsSendSatMessage );
  2101     
  2095     
  2102     if ( iTsySatMessaging )
  2096     if ( iTsySatMessaging )
  2103         {
  2097         {
  2104         iTsySatMessaging->CompleteSendSmsMessage( aError );
  2098         iTsySatMessaging->CompleteSendSmsMessage( aError );
  2248 TInt CMmSmsTsy::ReadSmspListPhase1L(
  2242 TInt CMmSmsTsy::ReadSmspListPhase1L(
  2249     const TTsyReqHandle aTsyReqHandle, 
  2243     const TTsyReqHandle aTsyReqHandle, 
  2250     RMobilePhone::TClientId const* aId, 
  2244     RMobilePhone::TClientId const* aId, 
  2251     TInt* aBufSize )
  2245     TInt* aBufSize )
  2252     {
  2246     {
  2253 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_READSMSPLISTPHASE1L_1, "TSY: CMmSmsTsy::ReadSmspListPhase1L");
  2247 TFLOGSTRING("TSY: CMmSmsTsy::ReadSmspListPhase1L");
  2254 
  2248 
  2255     TTsyReqHandle readSmspHandle = iTsyReqHandleStore->GetTsyReqHandle( 
  2249     TTsyReqHandle readSmspHandle = iTsyReqHandleStore->GetTsyReqHandle( 
  2256         EMultimodeSmsReadSmspListPhase1 );
  2250         EMultimodeSmsReadSmspListPhase1 );
  2257 
  2251 
  2258     if ( 0 < readSmspHandle )
  2252     if ( 0 < readSmspHandle )
  2463     CArrayPtrFlat<TSmsParameters>* smsParams;
  2457     CArrayPtrFlat<TSmsParameters>* smsParams;
  2464 
  2458 
  2465     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( 
  2459     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( 
  2466         EMultimodeSmsReadSmspListPhase1 );
  2460         EMultimodeSmsReadSmspListPhase1 );
  2467     
  2461     
  2468 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_COMPLETEREADALLSMSPPHASE1_1, "TSY: CMmSmsTsy::CompleteReadAllSmspPhase1 Complete read first phase error: %d",aError);
  2462 TFLOGSTRING2("TSY: CMmSmsTsy::CompleteReadAllSmspPhase1 Complete read first phase error: %d",aError);
  2469     if ( KErrNone == aError )
  2463     if ( KErrNone == aError )
  2470         {
  2464         {
  2471         aDataPackage->UnPackData( &smsParams );
  2465         aDataPackage->UnPackData( &smsParams );
  2472         if ( reqHandle )
  2466         if ( reqHandle )
  2473             {
  2467             {
  2483                 }
  2477                 }
  2484            
  2478            
  2485             if ( KErrNone == trapError )
  2479             if ( KErrNone == trapError )
  2486                 {
  2480                 {
  2487                 *iRetSMSPSize = iSMSPList->Size();
  2481                 *iRetSMSPSize = iSMSPList->Size();
  2488 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_COMPLETEREADALLSMSPPHASE1_2, "TSY: CMmSmsTsy::CompleteReadAllSmspPhase1: Phase 1 OK.");
  2482 TFLOGSTRING("TSY: CMmSmsTsy::CompleteReadAllSmspPhase1: Phase 1 OK.");
  2489                 // Complete first phase of read all SMSP sets
  2483                 // Complete first phase of read all SMSP sets
  2490                 ReqCompleted( reqHandle, KErrNone );
  2484                 ReqCompleted( reqHandle, KErrNone );
  2491                 }
  2485                 }
  2492             else
  2486             else
  2493                 {   
  2487                 {   
  2494 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_COMPLETEREADALLSMSPPHASE1_3, "TSY: CMmSmsTsy::CompleteReadAllSmspPhase1: Could not create SMSP list, trapError=%d",trapError);
  2488 TFLOGSTRING2("TSY: CMmSmsTsy::CompleteReadAllSmspPhase1: Could not create SMSP list, trapError=%d",trapError);
  2495                 // Complete with error
  2489                 // Complete with error
  2496                 ReqCompleted( reqHandle, trapError );
  2490                 ReqCompleted( reqHandle, trapError );
  2497                 }
  2491                 }
  2498             }
  2492             }
  2499         }
  2493         }
  3088             // Response for send SMS NoFdnCheck request
  3082             // Response for send SMS NoFdnCheck request
  3089             else if ( EMobileSmsMessagingSendMessageNoFdnCheck == 
  3083             else if ( EMobileSmsMessagingSendMessageNoFdnCheck == 
  3090                 sendData.iIpc )                
  3084                 sendData.iIpc )                
  3091                 {
  3085                 {
  3092                 iSmsNoFdnCheckFlag = ESmsNoFdnCheckUsed;
  3086                 iSmsNoFdnCheckFlag = ESmsNoFdnCheckUsed;
  3093 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_RESENDSMS_1, "TSY: CMmSmsTsy::ResendSms. EMobileSmsMessagingSendMessageNoFdnCheck: %d", sendData.iIpc);
  3087 TFLOGSTRING2("TSY: CMmSmsTsy::ResendSms. EMobileSmsMessagingSendMessageNoFdnCheck: %d", sendData.iIpc);                
  3094                 CompleteSendMessageNoFdnCheck( KErrGeneral, NULL );
  3088                 CompleteSendMessageNoFdnCheck( KErrGeneral, NULL );
  3095                 }
  3089                 }
  3096             }
  3090             }
  3097         else
  3091         else
  3098             {
  3092             {
  3145 // ---------------------------------------------------------------------------
  3139 // ---------------------------------------------------------------------------
  3146 //    
  3140 //    
  3147 TInt CMmSmsTsy::SendMessageNoFdnCheckCancel( 
  3141 TInt CMmSmsTsy::SendMessageNoFdnCheckCancel( 
  3148     const TTsyReqHandle aTsyReqHandle )
  3142     const TTsyReqHandle aTsyReqHandle )
  3149     {
  3143     {
  3150 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_SENDMESSAGENOFDNCHECKCANCEL_1, "TSY: CMmSmsTsy::SendMessageNoFdnCheckCancel" );
  3144 TFLOGSTRING("TSY: CMmSmsTsy::SendMessageNoFdnCheckCancel" ); 
  3151     // Reset req handle. Returns the deleted req handle
  3145     // Reset req handle. Returns the deleted req handle
  3152     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( 
  3146     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( 
  3153         EMultimodeSmsSendMessageNoFdnCheck );
  3147         EMultimodeSmsSendMessageNoFdnCheck );
  3154     
  3148     
  3155     if ( EMultimodeSmsReqHandleUnknown < reqHandle ) 
  3149     if ( EMultimodeSmsReqHandleUnknown < reqHandle ) 
  3186             iSmsSendReq->GetSendCounter() ) ) 
  3180             iSmsSendReq->GetSendCounter() ) ) 
  3187         {
  3181         {
  3188         // DOS returned error to send request. Message might be tried to be 
  3182         // DOS returned error to send request. Message might be tried to be 
  3189 		// resent (see method ResendSms).
  3183 		// resent (see method ResendSms).
  3190         // Timeout mechanism cannot access this part of code, ever.
  3184         // Timeout mechanism cannot access this part of code, ever.
  3191 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSMSTSY_COMPLETESENDMESSAGENOFDNCHECK_1, "TSY: CMmSmsTsy::CompleteSendMessageNoFdnCheck. Resend counter: %d", iSmsSendReq->GetSendCounter());
  3185 TFLOGSTRING2("TSY: CMmSmsTsy::CompleteSendMessageNoFdnCheck. Resend counter: %d", iSmsSendReq->GetSendCounter());
  3192         }
  3186         }
  3193     else
  3187     else
  3194         {
  3188         {
  3195         // This is executed
  3189         // This is executed
  3196 		// - if sending was successful
  3190 		// - if sending was successful