telephonyserverplugins/simatktsy/src/CSatNotifySendSm.cpp
branchRCL_3
changeset 66 07a122eea281
parent 65 630d2f34d719
equal deleted inserted replaced
65:630d2f34d719 66:07a122eea281
     1 // Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2005-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".
    18 //
    18 //
    19 
    19 
    20 
    20 
    21 
    21 
    22 //INCLUDES
    22 //INCLUDES
    23 
       
    24 #include "OstTraceDefinitions.h"
       
    25 #ifdef OST_TRACE_COMPILER_IN_USE
       
    26 #include "CSatNotifySendSmTraces.h"
       
    27 #endif
       
    28 
       
    29 #include <satcs.h>                  // Etel SAT IPC definitions
    23 #include <satcs.h>                  // Etel SAT IPC definitions
    30 #include "CSatTsy.h"                // Tsy class header
    24 #include "CSatTsy.h"                // Tsy class header
    31 #include "CSatNotifySendSm.h"       // Tsy class header
    25 #include "CSatNotifySendSm.h"       // Tsy class header
    32 #include "CSatNotificationsTsy.h"   // Class header
    26 #include "CSatNotificationsTsy.h"   // Class header
    33 #include "CBerTlv.h"                // Ber Tlv data handling
    27 #include "CBerTlv.h"                // Ber Tlv data handling
    34 #include "TTlv.h"					// TTlv class
    28 #include "TTlv.h"					// TTlv class
    35 #include "CSatDataPackage.h"        // Parameter packing 
    29 #include "CSatDataPackage.h"        // Parameter packing 
       
    30 #include "TfLogger.h"               // For TFLOGSTRING
    36 #include "TSatUtility.h"            // Utilities
    31 #include "TSatUtility.h"            // Utilities
    37 #include "CSatTsyReqHandleStore.h"  // Request handle class
    32 #include "CSatTsyReqHandleStore.h"  // Request handle class
    38 #include "cmmmessagemanagerbase.h"  // Message manager class for forwarding req.
    33 #include "cmmmessagemanagerbase.h"  // Message manager class for forwarding req.
    39 
    34 
    40 // -----------------------------------------------------------------------------
    35 // -----------------------------------------------------------------------------
    45 CSatNotifySendSm* CSatNotifySendSm::NewL
    40 CSatNotifySendSm* CSatNotifySendSm::NewL
    46         ( 
    41         ( 
    47         CSatNotificationsTsy* aNotificationsTsy 
    42         CSatNotificationsTsy* aNotificationsTsy 
    48         )
    43         )
    49     {
    44     {
    50     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_NEWL_1, "CSAT: CSatNotifySendSm::NewL");
    45     TFLOGSTRING("CSAT: CSatNotifySendSm::NewL");
    51    	CSatNotifySendSm* const satNotifySendSm = 
    46    	CSatNotifySendSm* const satNotifySendSm = 
    52         new ( ELeave ) CSatNotifySendSm( aNotificationsTsy );
    47         new ( ELeave ) CSatNotifySendSm( aNotificationsTsy );
    53     CleanupStack::PushL( satNotifySendSm );
    48     CleanupStack::PushL( satNotifySendSm );
    54     satNotifySendSm->ConstructL();
    49     satNotifySendSm->ConstructL();
    55     CleanupStack::Pop( satNotifySendSm );
    50     CleanupStack::Pop( satNotifySendSm );
    56     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_NEWL_2, "CSAT: CSatNotifySendSm::NewL, end of method");
    51     TFLOGSTRING("CSAT: CSatNotifySendSm::NewL, end of method");
    57     return satNotifySendSm;
    52     return satNotifySendSm;
    58     }
    53     }
    59 
    54 
    60 // -----------------------------------------------------------------------------
    55 // -----------------------------------------------------------------------------
    61 // CSatNotifySendSm::~CSatNotifySendSm
    56 // CSatNotifySendSm::~CSatNotifySendSm
    65 CSatNotifySendSm::~CSatNotifySendSm
    60 CSatNotifySendSm::~CSatNotifySendSm
    66         ( 
    61         ( 
    67 		// None
    62 		// None
    68         )
    63         )
    69     {
    64     {
    70     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_DTOR_1, "CSAT: CSatNotifySendSm::~CSatNotifySendSm");
    65     TFLOGSTRING("CSAT: CSatNotifySendSm::~CSatNotifySendSm");
    71     }
    66     }
    72     
    67     
    73 // -----------------------------------------------------------------------------
    68 // -----------------------------------------------------------------------------
    74 // CSatNotifySendSm::CSatNotifySendSm
    69 // CSatNotifySendSm::CSatNotifySendSm
    75 // Default C++ constructor
    70 // Default C++ constructor
    91 void CSatNotifySendSm::ConstructL
    86 void CSatNotifySendSm::ConstructL
    92         (
    87         (
    93         // None
    88         // None
    94         )
    89         )
    95     {
    90     {
    96     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_CONSTRUCTL_1, "CSAT: CSatNotifySendSm::ConstructL, does nothing");
    91     TFLOGSTRING("CSAT: CSatNotifySendSm::ConstructL, does nothing");
    97     }
    92     }
    98     
    93     
    99 // -----------------------------------------------------------------------------
    94 // -----------------------------------------------------------------------------
   100 // CSatNotifySendSm::Notify
    95 // CSatNotifySendSm::Notify
   101 // This request allows a client to be notified of a Send Sm proactive command.
    96 // This request allows a client to be notified of a Send Sm proactive command.
   105         (
   100         (
   106         const TTsyReqHandle aTsyReqHandle,
   101         const TTsyReqHandle aTsyReqHandle,
   107         const TDataPackage& aPackage
   102         const TDataPackage& aPackage
   108         )
   103         )
   109     {
   104     {
   110     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_NOTIFY_1, "CSAT: CSatNotifySendSm::Notify");
   105     TFLOGSTRING("CSAT: CSatNotifySendSm::Notify");
   111     // Save data pointer to client side for completion
   106     // Save data pointer to client side for completion
   112     iSendSmV1Pckg = reinterpret_cast<RSat::TSendSmV1Pckg*>( 
   107     iSendSmV1Pckg = reinterpret_cast<RSat::TSendSmV1Pckg*>( 
   113         aPackage.Des1n() );
   108         aPackage.Des1n() );
   114     // Save the request handle
   109     // Save the request handle
   115     iNotificationsTsy->iSatTsy->SaveReqHandle( aTsyReqHandle, 
   110     iNotificationsTsy->iSatTsy->SaveReqHandle( aTsyReqHandle, 
   127 TInt CSatNotifySendSm::CancelNotification
   122 TInt CSatNotifySendSm::CancelNotification
   128         (
   123         (
   129         const TTsyReqHandle aTsyReqHandle 
   124         const TTsyReqHandle aTsyReqHandle 
   130         )
   125         )
   131     {
   126     {
   132     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_CANCELNOTIFICATION_1, "CSAT: CSatNotifySendSm::CancelNotification");
   127     TFLOGSTRING("CSAT: CSatNotifySendSm::CancelNotification");   
   133     // Reset the request handle
   128     // Reset the request handle
   134     TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore->
   129     TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore->
   135         ResetTsyReqHandle( CSatTsy::ESatNotifySendSmPCmdReqType );
   130         ResetTsyReqHandle( CSatTsy::ESatNotifySendSmPCmdReqType );
   136 	// Reset the data pointer
   131 	// Reset the data pointer
   137 	iSendSmV1Pckg = NULL;
   132 	iSendSmV1Pckg = NULL;
   150         (
   145         (
   151         CSatDataPackage* aDataPackage,  
   146         CSatDataPackage* aDataPackage,  
   152         TInt aErrorCode                 
   147         TInt aErrorCode                 
   153         )
   148         )
   154     {
   149     {
   155     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_COMPLETENOTIFYL_1, "CSAT: CSatNotifySendSm::CompleteNotifyL");
   150     TFLOGSTRING("CSAT: CSatNotifySendSm::CompleteNotifyL");
   156     TInt ret( KErrNone );
   151     TInt ret( KErrNone );
   157 	TBuf<1> additionalInfo;
   152 	TBuf<1> additionalInfo;
   158 	// Unpack parameters
   153 	// Unpack parameters
   159     TPtrC8* data;
   154     TPtrC8* data;
   160     aDataPackage->UnPackData( &data );
   155     aDataPackage->UnPackData( &data );
   198 				// Check that TP-UDL is valid
   193 				// Check that TP-UDL is valid
   199 				ret = CheckTpdu( smsTpdu );
   194 				ret = CheckTpdu( smsTpdu );
   200 				
   195 				
   201 				if ( KErrCorrupt == ret )
   196 				if ( KErrCorrupt == ret )
   202 					{
   197 					{
   203 					OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_COMPLETENOTIFYL_2, "CSAT: CSatNotifySendSm::CompleteNotifyL, Invalid data");
   198 					TFLOGSTRING("CSAT: CSatNotifySendSm::CompleteNotifyL,\
       
   199 					    Invalid data");
   204 					additionalInfo.Zero();
   200 					additionalInfo.Zero();
   205                     additionalInfo.Append( KNoCause );
   201                     additionalInfo.Append( KNoCause );
   206 					CreateTerminalRespL( pCmdNumber, 
   202 					CreateTerminalRespL( pCmdNumber, 
   207 					    RSat::KCmdDataNotUnderstood, additionalInfo );                            
   203 					    RSat::KCmdDataNotUnderstood, additionalInfo );                            
   208                     }
   204                     }
   223 						{
   219 						{
   224 						// Call method to pack sms
   220 						// Call method to pack sms
   225 						ret = PackSms( smsTpdu, sendSmV1.iSmsTpdu );
   221 						ret = PackSms( smsTpdu, sendSmV1.iSmsTpdu );
   226 						if ( KErrNone != ret )
   222 						if ( KErrNone != ret )
   227 							{
   223 							{
   228 							OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_COMPLETENOTIFYL_3, "CSAT: CSatNotifySendSm::CompleteNotifyL, Invalid TPDU");
   224 							TFLOGSTRING("CSAT: CSatNotifySendSm::\
       
   225 							    CompleteNotifyL, Invalid TPDU");
   229 							// TPDU is invalid or packing cannot be requested 
   226 							// TPDU is invalid or packing cannot be requested 
   230 							// if tpdu is something else than SMS-SUBMIT
   227 							// if tpdu is something else than SMS-SUBMIT
   231 							additionalInfo.Zero();
   228 							additionalInfo.Zero();
   232                             additionalInfo.Append( KNoCause );
   229                             additionalInfo.Append( KNoCause );
   233 							CreateTerminalRespL( pCmdNumber,                  
   230 							CreateTerminalRespL( pCmdNumber,                  
   239 							// Do nothing
   236 							// Do nothing
   240 							}					
   237 							}					
   241 						}
   238 						}
   242 					else
   239 					else
   243 						{
   240 						{
   244 						OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_COMPLETENOTIFYL_4, "CSAT: CSatNotifySendSm::CompleteNotifyL, Packing not required");
   241 						TFLOGSTRING("CSAT: CSatNotifySendSm::CompleteNotifyL,\
       
   242 						    Packing not required");
   245 						}
   243 						}
   246 					}
   244 					}
   247 				else
   245 				else
   248 					{
   246 					{
   249 					// Do nothing
   247 					// Do nothing
   250 					}
   248 					}
   251 				}
   249 				}
   252 			else
   250 			else
   253 				{
   251 				{
   254 				OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_COMPLETENOTIFYL_5, "CSAT: CSatNotifySendSm::CompleteNotifyL, Missing TPDU");
   252 				TFLOGSTRING("CSAT: CSatNotifySendSm::CompleteNotifyL,\
       
   253 				    Missing TPDU");
   255 				// TPdu is missing, returning response immediately
   254 				// TPdu is missing, returning response immediately
   256 				additionalInfo.Zero();
   255 				additionalInfo.Zero();
   257                 additionalInfo.Append( KNoCause );
   256                 additionalInfo.Append( KNoCause );
   258 				CreateTerminalRespL( pCmdNumber, 
   257 				CreateTerminalRespL( pCmdNumber, 
   259 				    RSat::KErrorRequiredValuesMissing, additionalInfo );
   258 				    RSat::KErrorRequiredValuesMissing, additionalInfo );
   276         iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret );   
   275         iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret );   
   277         	
   276         	
   278         } // End of if ( CSatTsy::ESatReqHandleUnknown != reqHandle )
   277         } // End of if ( CSatTsy::ESatReqHandleUnknown != reqHandle )
   279 	else
   278 	else
   280 		{
   279 		{
   281 		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_COMPLETENOTIFYL_6, "CSAT: CSatNotifySendSm::CompleteNotifyL, Request not ongoing");
   280 		TFLOGSTRING("CSAT: CSatNotifySendSm::CompleteNotifyL,\
       
   281 		    Request not ongoing");
   282 		// Request not on, returning response immediately
   282 		// Request not on, returning response immediately
   283 		additionalInfo.Zero();
   283 		additionalInfo.Zero();
   284         additionalInfo.Append( KNoCause );       
   284         additionalInfo.Append( KNoCause );       
   285 		CreateTerminalRespL( pCmdNumber, RSat::KMeUnableToProcessCmd, 
   285 		CreateTerminalRespL( pCmdNumber, RSat::KMeUnableToProcessCmd, 
   286 			additionalInfo );					 
   286 			additionalInfo );					 
   296 TInt CSatNotifySendSm::TerminalResponseL
   296 TInt CSatNotifySendSm::TerminalResponseL
   297         (
   297         (
   298         TDes8* aRsp 
   298         TDes8* aRsp 
   299         )
   299         )
   300     {  
   300     {  
   301     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_TERMINALRESPONSEL_1,  "CSAT::CSatNotifySendSm::TerminalResponseL" );
   301     TFLOGSTRING( "CSAT::CSatNotifySendSm::TerminalResponseL" );
   302     
   302     
   303     TInt ret( KErrNone );
   303     TInt ret( KErrNone );
   304     TBuf<1> additionalInfo;
   304     TBuf<1> additionalInfo;
   305     RSat::TSendSmRspV1Pckg* aRspPckg = 
   305     RSat::TSendSmRspV1Pckg* aRspPckg = 
   306         reinterpret_cast<RSat::TSendSmRspV1Pckg*>( aRsp );
   306         reinterpret_cast<RSat::TSendSmRspV1Pckg*>( aRsp );
   307     RSat::TSendSmRspV1& rspV1 = ( *aRspPckg ) ();
   307     RSat::TSendSmRspV1& rspV1 = ( *aRspPckg ) ();
   308     // Get Proactive command number
   308     // Get Proactive command number
   309     TUint8 pCmdNumber( rspV1.PCmdNumber() );
   309     TUint8 pCmdNumber( rspV1.PCmdNumber() );
   310     OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_TERMINALRESPONSEL_2,  "CSAT::CSatNotifySendSm::TerminalResponseL: GeneralResult: %d", static_cast<TUint8>( rspV1.iGeneralResult ) );
   310     TFLOGSTRING2( "CSAT::CSatNotifySendSm::TerminalResponseL: GeneralResult: \
       
   311         %d", static_cast<TUint8>( rspV1.iGeneralResult ) );
   311 
   312 
   312     // Check that general result value is valid
   313     // Check that general result value is valid
   313     if ( ( RSat::KSuccess != rspV1.iGeneralResult ) && 
   314     if ( ( RSat::KSuccess != rspV1.iGeneralResult ) && 
   314          ( RSat::KMeUnableToProcessCmd  != rspV1.iGeneralResult ) && 
   315          ( RSat::KMeUnableToProcessCmd  != rspV1.iGeneralResult ) && 
   315          ( RSat::KCmdBeyondMeCapabilities != rspV1.iGeneralResult )&& 
   316          ( RSat::KCmdBeyondMeCapabilities != rspV1.iGeneralResult )&& 
   316          ( RSat::KSmsRpError != rspV1.iGeneralResult ) && 
   317          ( RSat::KSmsRpError != rspV1.iGeneralResult ) && 
   317          ( RSat::KInteractionWithCCPermanentError != rspV1.iGeneralResult ) && 
   318          ( RSat::KInteractionWithCCPermanentError != rspV1.iGeneralResult ) && 
   318          ( RSat::KModifiedByCallControl != rspV1.iGeneralResult ) && 
   319          ( RSat::KModifiedByCallControl != rspV1.iGeneralResult ) && 
   319          ( RSat::KSuccessRequestedIconNotDisplayed != rspV1.iGeneralResult ) )        
   320          ( RSat::KSuccessRequestedIconNotDisplayed != rspV1.iGeneralResult ) )        
   320         {
   321         {
   321         OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_TERMINALRESPONSEL_3,  "CSAT::CSatNotifySendSm::TerminalResponseL, Invalid General result" );
   322         TFLOGSTRING( "CSAT::CSatNotifySendSm::TerminalResponseL,\
       
   323             Invalid General result" );
   322         // Invalid general result
   324         // Invalid general result
   323         ret = KErrCorrupt;
   325         ret = KErrCorrupt;
   324         }
   326         }
   325 
   327 
   326     // If there is ME (Mobile Entity) error or network error, additional info
   328     // If there is ME (Mobile Entity) error or network error, additional info
   330          ( RSat::KControlInteraction == rspV1.iInfoType ) )        
   332          ( RSat::KControlInteraction == rspV1.iInfoType ) )        
   331         {
   333         {
   332         // Check the length of additional info
   334         // Check the length of additional info
   333         if ( 0 == rspV1.iAdditionalInfo.Length() )
   335         if ( 0 == rspV1.iAdditionalInfo.Length() )
   334             {
   336             {
   335             OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_TERMINALRESPONSEL_4,  "CSAT::CSatNotifySendSm::TerminalResponseL, Invalid Additional Info" );
   337             TFLOGSTRING( "CSAT::CSatNotifySendSm::TerminalResponseL,\
       
   338                 Invalid Additional Info" );
   336             // No info
   339             // No info
   337             ret = KErrCorrupt;
   340             ret = KErrCorrupt;
   338             }
   341             }
   339         else
   342         else
   340             {
   343             {
   366         TUint8 aPCmdNumber,        
   369         TUint8 aPCmdNumber,        
   367         TUint8 aGeneralResult,      
   370         TUint8 aGeneralResult,      
   368         TDesC16& aAdditionalInfo		
   371         TDesC16& aAdditionalInfo		
   369 		)
   372 		)
   370     {
   373     {
   371     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_CREATETERMINALRESPL_1,  "CSAT::CSatNotifySendSm::CreateTerminalRespL" );
   374     TFLOGSTRING( "CSAT::CSatNotifySendSm::CreateTerminalRespL" );
   372     // Create and append response data
   375     // Create and append response data
   373     TTlv tlvSpecificData;
   376     TTlv tlvSpecificData;
   374     // Create General Result TLV here
   377     // Create General Result TLV here
   375     tlvSpecificData.AddTag( KTlvResultTag );
   378     tlvSpecificData.AddTag( KTlvResultTag );
   376     // General result
   379     // General result
   381          ( RSat::KSmsRpError == aGeneralResult ) ||
   384          ( RSat::KSmsRpError == aGeneralResult ) ||
   382          ( RSat::KInteractionWithCCPermanentError == aGeneralResult ) )
   385          ( RSat::KInteractionWithCCPermanentError == aGeneralResult ) )
   383         {
   386         {
   384 		if( aAdditionalInfo.Length() > 0 )
   387 		if( aAdditionalInfo.Length() > 0 )
   385 	        {
   388 	        {
   386 	        OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_CREATETERMINALRESPL_2,  "CSAT::CSatNotifySendSm::CreateTerminalRespL, Unsuccessful result" );
   389 	        TFLOGSTRING( "CSAT::CSatNotifySendSm::CreateTerminalRespL,\
       
   390 	            Unsuccessful result" );
   387 	        // If there is ME, Network or SMS error, append additional info
   391 	        // If there is ME, Network or SMS error, append additional info
   388 	        tlvSpecificData.AddByte( static_cast<TUint8>( aAdditionalInfo[0] ) );
   392 	        tlvSpecificData.AddByte( static_cast<TUint8>( aAdditionalInfo[0] ) );
   389 	        }
   393 	        }
   390 		}
   394 		}
   391     else
   395     else
   413 		(
   417 		(
   414 		CBerTlv* aBerTlv,
   418 		CBerTlv* aBerTlv,
   415 		RSat::TSendSmV1& aSendSmV1
   419 		RSat::TSendSmV1& aSendSmV1
   416 		)
   420 		)
   417 	{
   421 	{
   418 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_SETALPHAIDANDADDRESSDATA_1,  "CSAT::CSatNotifySendSm::SetAlphaIdAndAddressData" );
   422 	TFLOGSTRING( "CSAT::CSatNotifySendSm::SetAlphaIdAndAddressData" );
   419 	TInt returnValue;
   423 	TInt returnValue;
   420 	TPtrC8 sourceString; // Used in unicode conversions
   424 	TPtrC8 sourceString; // Used in unicode conversions
   421 	// Alpha id string (optional)
   425 	// Alpha id string (optional)
   422 	aSendSmV1.iAlphaId.iAlphaId.Zero();
   426 	aSendSmV1.iAlphaId.iAlphaId.Zero();
   423 	CTlv alphaIdTlv;
   427 	CTlv alphaIdTlv;
   441 			{
   445 			{
   442 			aSendSmV1.iAlphaId.iStatus = RSat::EAlphaIdProvided;
   446 			aSendSmV1.iAlphaId.iStatus = RSat::EAlphaIdProvided;
   443 			}
   447 			}
   444 		else
   448 		else
   445 			{
   449 			{
   446 			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_SETALPHAIDANDADDRESSDATA_2,  "CSAT::CSatNotifySendSm::SetAlphaIdAndAddressData, Alpha ID is NULL" );
   450 			TFLOGSTRING( "CSAT::CSatNotifySendSm::SetAlphaIdAndAddressData,\
       
   451 			    Alpha ID is NULL" );
   447 			aSendSmV1.iAlphaId.iStatus = RSat::EAlphaIdNull;
   452 			aSendSmV1.iAlphaId.iStatus = RSat::EAlphaIdNull;
   448 			}
   453 			}
   449 		}
   454 		}
   450 	else 
   455 	else 
   451 		{
   456 		{
   452 		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_SETALPHAIDANDADDRESSDATA_3,  "CSAT::CSatNotifySendSm::SetAlphaIdAndAddressData, Alpha ID not present" );
   457 		TFLOGSTRING( "CSAT::CSatNotifySendSm::SetAlphaIdAndAddressData,\
       
   458 		    Alpha ID not present" );
   453 		aSendSmV1.iAlphaId.iStatus = RSat::EAlphaIdNotPresent;
   459 		aSendSmV1.iAlphaId.iStatus = RSat::EAlphaIdNotPresent;
   454 		}
   460 		}
   455 	// The address data object holds the RP_Destination_Address of the Service 
   461 	// The address data object holds the RP_Destination_Address of the Service 
   456 	// Centre. If no RP_Destination_Address is transferred, then the ME shall 
   462 	// Centre. If no RP_Destination_Address is transferred, then the ME shall 
   457 	// insert the default Service Centre address (below).
   463 	// insert the default Service Centre address (below).
   483 				{
   489 				{
   484 				// Semi-octet presentation used
   490 				// Semi-octet presentation used
   485 				// Converting back to ASCII format
   491 				// Converting back to ASCII format
   486 				TSatUtility::BCDToAscii( sourceString, tempScaNumber );
   492 				TSatUtility::BCDToAscii( sourceString, tempScaNumber );
   487 				aSendSmV1.iAddress.iTelNumber.Copy( tempScaNumber );
   493 				aSendSmV1.iAddress.iTelNumber.Copy( tempScaNumber );
   488 				OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_SETALPHAIDANDADDRESSDATA_4, "CSAT: SendSm, SCA number: %S", aSendSmV1.iAddress.iTelNumber );
   494 				TFLOGSTRING2("CSAT: SendSm, SCA number: %S", 
       
   495 					&aSendSmV1.iAddress.iTelNumber );
   489 				}
   496 				}
   490        		else
   497        		else
   491       			{
   498       			{
   492       			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_SETALPHAIDANDADDRESSDATA_5,  "CSAT::CSatNotifySendSm::SetAlphaIdAndAddressData Address TLV found, TON/NPI present, but number epmpty" );
   499       			TFLOGSTRING( "CSAT::CSatNotifySendSm::SetAlphaIdAndAddressData\
       
   500       			    Address TLV found, TON/NPI present, but number epmpty" );
   493         		// Address TLV found, TON/NPI present, but number epmpty.
   501         		// Address TLV found, TON/NPI present, but number epmpty.
   494        			aSendSmV1.iAddress.iTypeOfNumber = RSat::EUnknownNumber;
   502        			aSendSmV1.iAddress.iTypeOfNumber = RSat::EUnknownNumber;
   495         		aSendSmV1.iAddress.iNumberPlan = RSat::EUnknownNumberingPlan;
   503         		aSendSmV1.iAddress.iNumberPlan = RSat::EUnknownNumberingPlan;
   496       			}
   504       			}
   497 		    }
   505 		    }
   498 		else
   506 		else
   499 		    {
   507 		    {
   500 		    OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_SETALPHAIDANDADDRESSDATA_6,  "CSAT::CSatNotifySendSm::SetAlphaIdAndAddressData Address TLV found, but the Value part doesn't exist");
   508 		    TFLOGSTRING( "CSAT::CSatNotifySendSm::SetAlphaIdAndAddressData\
       
   509 		        Address TLV found, but the Value part doesn't exist");
   501 		    // Address TLV found, but the Value part doesn't exist
   510 		    // Address TLV found, but the Value part doesn't exist
   502 		    aSendSmV1.iAddress.iTypeOfNumber = RSat::EUnknownNumber;
   511 		    aSendSmV1.iAddress.iTypeOfNumber = RSat::EUnknownNumber;
   503 		    aSendSmV1.iAddress.iNumberPlan = RSat::EUnknownNumberingPlan;
   512 		    aSendSmV1.iAddress.iNumberPlan = RSat::EUnknownNumberingPlan;
   504 		    }
   513 		    }
   505 		}
   514 		}
   506 	else
   515 	else
   507 	    {
   516 	    {
   508 	    OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_SETALPHAIDANDADDRESSDATA_7,  "CSAT::CSatNotifySendSm::SetAlphaIdAndAddressData Address TLV not found");
   517 	    TFLOGSTRING( "CSAT::CSatNotifySendSm::SetAlphaIdAndAddressData\
       
   518 	        Address TLV not found");
   509 	    // Address TLV not found
   519 	    // Address TLV not found
   510 	    aSendSmV1.iAddress.iTypeOfNumber = RSat::ETypeOfNumberNotSet;
   520 	    aSendSmV1.iAddress.iTypeOfNumber = RSat::ETypeOfNumberNotSet;
   511 	    aSendSmV1.iAddress.iNumberPlan = RSat::ENumberingPlanNotSet;  
   521 	    aSendSmV1.iAddress.iNumberPlan = RSat::ENumberingPlanNotSet;  
   512 	    }	
   522 	    }	
   513 	}
   523 	}
   520 TInt CSatNotifySendSm::CheckTpdu
   530 TInt CSatNotifySendSm::CheckTpdu
   521 	    (
   531 	    (
   522 	    TPtrC8 aTpdu    
   532 	    TPtrC8 aTpdu    
   523 	    )
   533 	    )
   524     {
   534     {
   525     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_CHECKTPDU_1,  "CSAT::CSatNotifySendSm::CheckTpdu");
   535     TFLOGSTRING( "CSAT::CSatNotifySendSm::CheckTpdu");
   526     TInt ret( KErrNone );
   536     TInt ret( KErrNone );
   527 
   537 
   528     if ( KSATSmsMTISubmitOrSubmitReport == ( aTpdu[0] & KMask3 ) ) 
   538     if ( KSATSmsMTISubmitOrSubmitReport == ( aTpdu[0] & KMask3 ) ) 
   529         {
   539         {
   530         // SMS-SUBMIT
   540         // SMS-SUBMIT
   533         TUint8 dcs( GetTpDcs( aTpdu ) );
   543         TUint8 dcs( GetTpDcs( aTpdu ) );
   534         dcs &= KDCSAlphabetMask;
   544         dcs &= KDCSAlphabetMask;
   535         
   545         
   536         if ( !dcs && KSmsMaxSize < tpUdl )
   546         if ( !dcs && KSmsMaxSize < tpUdl )
   537             {
   547             {
   538             OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_CHECKTPDU_2,  "CSAT::CSatNotifySendSm::CheckTpdu, False DCS Length");
   548             TFLOGSTRING( "CSAT::CSatNotifySendSm::CheckTpdu,\
       
   549                 False DCS Length");
   539             // DCS is 7-bit and message is over 160 bytes, set ret to corrupt
   550             // DCS is 7-bit and message is over 160 bytes, set ret to corrupt
   540             ret = KErrCorrupt;
   551             ret = KErrCorrupt;
   541             }
   552             }
   542         else if ( ( !( KSmsPackingRequiredMask & iNotificationsTsy->
   553         else if ( ( !( KSmsPackingRequiredMask & iNotificationsTsy->
   543         	iTerminalRespData.iCommandDetails[KCommandQualifier] ) )
   554         	iTerminalRespData.iCommandDetails[KCommandQualifier] ) )
   544             && ( KSmsMaxSizeWithoutPacking < tpUdl && dcs ) )
   555             && ( KSmsMaxSizeWithoutPacking < tpUdl && dcs ) )
   545             {
   556             {
   546             OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_CHECKTPDU_3,  "CSAT::CSatNotifySendSm::CheckTpdu, TP-UD Too long without packing");
   557             TFLOGSTRING( "CSAT::CSatNotifySendSm::CheckTpdu,\
       
   558                 TP-UD Too long without packing");
   547             // TP-UD is too long without packing
   559             // TP-UD is too long without packing
   548             ret = KErrCorrupt;
   560             ret = KErrCorrupt;
   549             }
   561             }
   550         else if ( ( KSmsMaxSize < tpUdl ) && dcs )
   562         else if ( ( KSmsMaxSize < tpUdl ) && dcs )
   551             {
   563             {
   552             OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_CHECKTPDU_4,  "CSAT::CSatNotifySendSm::CheckTpdu, TP-UD is too long even with packing");
   564             TFLOGSTRING( "CSAT::CSatNotifySendSm::CheckTpdu,\
       
   565                 TP-UD is too long even with packing");
   553             // TP-UD is too long even with packing
   566             // TP-UD is too long even with packing
   554             ret = KErrCorrupt;
   567             ret = KErrCorrupt;
   555             }
   568             }
   556         else
   569         else
   557         	{
   570         	{
   561     else
   574     else
   562         {
   575         {
   563         // SMS-COMMAND
   576         // SMS-COMMAND
   564         if ( KSMSCommandMaxSize < GetTpUdl( aTpdu ) )
   577         if ( KSMSCommandMaxSize < GetTpUdl( aTpdu ) )
   565             {
   578             {
   566             OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_CHECKTPDU_5,  "CSAT::CSatNotifySendSm::CheckTpdu, False SMS Command length");
   579             TFLOGSTRING( "CSAT::CSatNotifySendSm::CheckTpdu,\
       
   580                 False SMS Command length");
   567             ret = KErrCorrupt;
   581             ret = KErrCorrupt;
   568             }
   582             }
   569 		else
   583 		else
   570 			{
   584 			{
   571 			// Do nothing
   585 			// Do nothing
   584 TUint8 CSatNotifySendSm::GetTpUdl
   598 TUint8 CSatNotifySendSm::GetTpUdl
   585 	    ( 
   599 	    ( 
   586 	    TPtrC8 aTpdu  
   600 	    TPtrC8 aTpdu  
   587 	    )
   601 	    )
   588     {
   602     {
   589     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_GETTPUDL_1,  "CSAT::CSatNotifySendSm::GetTpUdl");
   603     TFLOGSTRING( "CSAT::CSatNotifySendSm::GetTpUdl");
   590     TUint8 ret( 0 );
   604     TUint8 ret( 0 );
   591     if ( KSATSmsMTISubmitOrSubmitReport == ( aTpdu[0] & KMask3 ) )
   605     if ( KSATSmsMTISubmitOrSubmitReport == ( aTpdu[0] & KMask3 ) )
   592         {
   606         {
   593         // SMS-SUBMIT
   607         // SMS-SUBMIT
   594         // Calculate the startpos of TP-UD field,
   608         // Calculate the startpos of TP-UD field,
   659 TUint8 CSatNotifySendSm::GetTpDcs
   673 TUint8 CSatNotifySendSm::GetTpDcs
   660 	    ( 
   674 	    ( 
   661 	    TPtrC8 aTpdu 
   675 	    TPtrC8 aTpdu 
   662 	    )
   676 	    )
   663     {
   677     {
   664     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_GETTPDCS_1,  "CSAT::CSatNotifySendSm::GetTpDcs");
   678     TFLOGSTRING( "CSAT::CSatNotifySendSm::GetTpDcs");
   665     TUint8 retValue( NULL );
   679     TUint8 retValue( NULL );
   666     if ( KSATSmsMTISubmitOrSubmitReport == ( aTpdu[0] & KMask3 ) )
   680     if ( KSATSmsMTISubmitOrSubmitReport == ( aTpdu[0] & KMask3 ) )
   667         {
   681         {
   668         // SMS-SUBMIT
   682         // SMS-SUBMIT
   669         TUint8 posDCS( 0 );
   683         TUint8 posDCS( 0 );
   695 	    (
   709 	    (
   696 	    TPtrC8 aTpdu,   
   710 	    TPtrC8 aTpdu,   
   697 	    TTpdu& aSendSm  
   711 	    TTpdu& aSendSm  
   698 	    )
   712 	    )
   699     {
   713     {
   700     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_PACKSMS_1,  "CSAT::CSatNotifySendSm::PackSms");
   714     TFLOGSTRING( "CSAT::CSatNotifySendSm::PackSms");
   701     // See 3GPP TS 23.040 and TS 23.038: 
   715     // See 3GPP TS 23.040 and TS 23.038: 
   702     // Packing of Basic elements of the SMS SUBMIT type
   716     // Packing of Basic elements of the SMS SUBMIT type
   703     TInt ret( KErrNone );
   717     TInt ret( KErrNone );
   704     
   718     
   705     // Message is a SMS-SUBMIT message
   719     // Message is a SMS-SUBMIT message
   781             static_cast<TUint8>( ( aTpdu[startPos + 1] * 8 / 7 ) 
   795             static_cast<TUint8>( ( aTpdu[startPos + 1] * 8 / 7 ) 
   782                 + ( aTpdu[startPos] - aTpdu[startPos + 1] ) );
   796                 + ( aTpdu[startPos] - aTpdu[startPos + 1] ) );
   783             }
   797             }
   784         else
   798         else
   785             {
   799             {
   786             OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_PACKSMS_2,  "CSAT::CSatNotifySendSm::PackSms, No headers");
   800             TFLOGSTRING( "CSAT::CSatNotifySendSm::PackSms, No headers");
   787             // No headers, lets pack all the characters in SMS message
   801             // No headers, lets pack all the characters in SMS message
   788             TBool endOfTPDU( EFalse );
   802             TBool endOfTPDU( EFalse );
   789             TUint8 move( 0 );
   803             TUint8 move( 0 );
   790 
   804 
   791             for ( i = startPos; i < aTpdu[startPos] + startPos; i++ )
   805             for ( i = startPos; i < aTpdu[startPos] + startPos; i++ )
   827                         move++;
   841                         move++;
   828                         }
   842                         }
   829                     }
   843                     }
   830                 else
   844                 else
   831                     {
   845                     {
   832                     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSM_PACKSMS_3,  "CSAT::CSatNotifySendSm::PackSms, Corrupted");
   846                     TFLOGSTRING( "CSAT::CSatNotifySendSm::PackSms, Corrupted");
   833                     ret = KErrCorrupt;
   847                     ret = KErrCorrupt;
   834                     break;
   848                     break;
   835                     }    
   849                     }    
   836                 }
   850                 }
   837             }
   851             }