telephonyserverplugins/simatktsy/src/CSatNotifySendSs.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
child 42 3adadc800673
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Name        : CSatNotifySendSs.cpp
       
    15 // Part of     : Common SIM ATK TSY / commonsimatktsy
       
    16 // Send Ss notification functionality of Sat Tsy
       
    17 // Version     : 1.0
       
    18 //
       
    19 
       
    20 
       
    21 
       
    22 //INCLUDES
       
    23 #include <satcs.h>                  // Etel SAT IPC definitions
       
    24 #include "CSatTsy.h"                // Tsy class header
       
    25 #include "CSatCCTsy.h"              // Call Control Tsy class header
       
    26 #include "CSatNotifySendSs.h"       // Tsy class header
       
    27 #include "CSatNotificationsTsy.h"   // Class header
       
    28 #include "CBerTlv.h"                // Ber Tlv data handling
       
    29 #include "TTlv.h"					// TTlv class
       
    30 #include "CSatDataPackage.h"        // Parameter packing 
       
    31 #include "TfLogger.h"               // For TFLOGSTRING
       
    32 #include "TSatUtility.h"            // Utilities
       
    33 #include "CSatTsyReqHandleStore.h"  // Request handle class
       
    34 #include "cmmmessagemanagerbase.h"  // Message manager class for forwarding req.
       
    35 #include "msattsy_ipcdefs.h"		// Sat ipc values
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // CSatNotifySendSs::NewL
       
    39 // Two-phased constructor.
       
    40 // -----------------------------------------------------------------------------
       
    41 //  
       
    42 CSatNotifySendSs* CSatNotifySendSs::NewL
       
    43         ( 
       
    44         CSatNotificationsTsy* aNotificationsTsy 
       
    45         )
       
    46     {
       
    47     TFLOGSTRING("CSAT: CSatNotifySendSs::NewL");
       
    48    	CSatNotifySendSs* const satNotifySendSs = 
       
    49         new ( ELeave ) CSatNotifySendSs( aNotificationsTsy );
       
    50     CleanupStack::PushL( satNotifySendSs );
       
    51     satNotifySendSs->ConstructL();
       
    52     CleanupStack::Pop( satNotifySendSs );
       
    53     TFLOGSTRING("CSAT: CSatNotifySendSs::NewL, end of method");
       
    54     return satNotifySendSs;
       
    55     }
       
    56 
       
    57 // -----------------------------------------------------------------------------
       
    58 // CSatNotifySendSs::~CSatNotifySendSs
       
    59 // Destructor
       
    60 // -----------------------------------------------------------------------------
       
    61 //  
       
    62 CSatNotifySendSs::~CSatNotifySendSs
       
    63         ( 
       
    64 		// None
       
    65         )
       
    66     {
       
    67     TFLOGSTRING("CSAT: CSatNotifySendSs::~CSatNotifySendSs");
       
    68     }
       
    69     
       
    70 // -----------------------------------------------------------------------------
       
    71 // CSatNotifySendSs::CSatNotifySendSs
       
    72 // Default C++ constructor
       
    73 // -----------------------------------------------------------------------------
       
    74 //  
       
    75 CSatNotifySendSs::CSatNotifySendSs
       
    76         ( 
       
    77         CSatNotificationsTsy* aNotificationsTsy 
       
    78         ) : iNotificationsTsy ( aNotificationsTsy )
       
    79     {
       
    80     // None
       
    81     }
       
    82 
       
    83 // -----------------------------------------------------------------------------
       
    84 // CSatNotifySendSs::ConstructL
       
    85 // Symbian 2nd phase constructor
       
    86 // -----------------------------------------------------------------------------
       
    87 //  
       
    88 void CSatNotifySendSs::ConstructL
       
    89         (
       
    90         // None
       
    91         )
       
    92     {
       
    93     TFLOGSTRING("CSAT: CSatNotifySendSs::ConstructL");
       
    94     }
       
    95    
       
    96 // -----------------------------------------------------------------------------
       
    97 // CSatNotifySendSs::Notify
       
    98 // This request allows a client to be notified of a Send SS proactive 
       
    99 // command
       
   100 // -----------------------------------------------------------------------------
       
   101 //
       
   102 TInt CSatNotifySendSs::Notify
       
   103         (
       
   104         const TTsyReqHandle aTsyReqHandle,
       
   105         const TDataPackage& aPackage
       
   106         )
       
   107     {
       
   108     TFLOGSTRING("CSAT: CSatNotifySendSs::Notify");
       
   109     // Save data pointer to client side for completion
       
   110     iSendSsV1Pckg = reinterpret_cast<RSat::TSendSsV1Pckg*>( 
       
   111         aPackage.Des1n() );
       
   112     // Save the request handle
       
   113     iNotificationsTsy->iSatTsy->SaveReqHandle( aTsyReqHandle, 
       
   114 		CSatTsy::ESatNotifySendSsPCmdReqType );
       
   115     // Check if requested notification is already pending
       
   116     iNotificationsTsy->NotifySatReadyForNotification( KSendSs );   
       
   117 
       
   118     return KErrNone;
       
   119 
       
   120     }
       
   121 
       
   122 // -----------------------------------------------------------------------------
       
   123 // CSatNotifySendSs::CancelNotification
       
   124 // This method cancels an outstanding asynchronous 
       
   125 // NotifySendSs request.
       
   126 // -----------------------------------------------------------------------------
       
   127 //
       
   128 TInt CSatNotifySendSs::CancelNotification
       
   129         (
       
   130         const TTsyReqHandle aTsyReqHandle 
       
   131         )
       
   132     {
       
   133     TFLOGSTRING("CSAT: CSatNotifySendSs::CancelNotification"); 
       
   134     
       
   135     // Reset the request handle
       
   136     TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore->
       
   137         ResetTsyReqHandle( CSatTsy::ESatNotifySendSsPCmdReqType );
       
   138 	// Reset the data pointer
       
   139 	iSendSsV1Pckg = NULL;
       
   140 	// Complete the request with KErrCancel
       
   141 	iNotificationsTsy->iSatTsy->ReqCompleted( aTsyReqHandle, KErrCancel );
       
   142     return KErrNone;    
       
   143     }
       
   144 
       
   145 
       
   146 
       
   147 // -----------------------------------------------------------------------------
       
   148 // CSatNotifySendSs::CompleteNotifyL
       
   149 // This method completes an outstanding asynchronous 
       
   150 // NotifySendSs request. 
       
   151 // -----------------------------------------------------------------------------
       
   152 //
       
   153 TInt CSatNotifySendSs::CompleteNotifyL
       
   154         (
       
   155         CSatDataPackage* aDataPackage,   
       
   156         TInt aErrorCode                  
       
   157         )
       
   158     {
       
   159     TFLOGSTRING("CSAT: CSatNotifySendSs::CompleteNotifyL");
       
   160 	TInt ret( KErrNone );
       
   161 
       
   162     // Unpack parameters
       
   163     TPtrC8* data;
       
   164     aDataPackage->UnPackData( &data );
       
   165 
       
   166     // Reset req handle. Returns the deleted req handle
       
   167     TTsyReqHandle reqHandle = 
       
   168 		iNotificationsTsy->iSatReqHandleStore->ResetTsyReqHandle( 
       
   169 		CSatTsy::ESatNotifySendSsPCmdReqType );
       
   170 	// Get ber tlv
       
   171 	CBerTlv berTlv;
       
   172 	berTlv.SetData( *data );
       
   173 
       
   174 	// Get command details tlv
       
   175 	CTlv commandDetails;
       
   176 	berTlv.TlvByTagValue( &commandDetails, KTlvCommandDetailsTag );
       
   177 
       
   178 	// Store command details tlv
       
   179 	iNotificationsTsy->iTerminalRespData.iCommandDetails.Copy( 
       
   180 		commandDetails.Data() );	
       
   181 	TUint8 pCmdNumber( commandDetails.GetShortInfo( ETLV_CommandNumber ) );
       
   182 
       
   183 	// In case the request was ongoing, continue..
       
   184     if ( CSatTsy::ESatReqHandleUnknown != reqHandle )
       
   185         {
       
   186         // Complete right away if error has occured, otherwise continue..
       
   187         if ( KErrNone == aErrorCode )
       
   188 			{
       
   189 			// Get ber tlv
       
   190 			CBerTlv berTlv;
       
   191 			berTlv.SetData( *data );
       
   192 
       
   193 			// Get command details tlv
       
   194 			CTlv commandDetails;
       
   195 			berTlv.TlvByTagValue( &commandDetails, KTlvCommandDetailsTag );
       
   196     
       
   197 			// Store command details tlv
       
   198 			iNotificationsTsy->iTerminalRespData.iCommandDetails.Copy( 
       
   199 				commandDetails.Data() );
       
   200 
       
   201 		    // Fill the send ss structure             
       
   202 			RSat::TSendSsV1& sendSsV1 = ( *iSendSsV1Pckg )();
       
   203 
       
   204 			// Store command number
       
   205             sendSsV1.SetPCmdNumber( pCmdNumber );
       
   206 
       
   207 			TPtrC8 sourceString; // Used with conversions
       
   208 
       
   209 			 // Alpha id string (optional)
       
   210 			sendSsV1.iAlphaId.iAlphaId.Zero();
       
   211 			CTlv alphaIdentifier;
       
   212 			// Get alpha id tlv from berTlv
       
   213 			TInt returnValue( berTlv.TlvByTagValue( &alphaIdentifier, 
       
   214                                                 KTlvAlphaIdentifierTag ) );
       
   215 			// Check if alpha id string exist
       
   216 			if ( KErrNone == returnValue ) 
       
   217 				{
       
   218 				if ( alphaIdentifier.GetLength() )
       
   219 					{
       
   220 					// 8-bit string to 16-bit string
       
   221 					sourceString.Set( alphaIdentifier.GetData( 
       
   222 					    ETLV_AlphaIdentifier ) );
       
   223 
       
   224 					// Convert and set the alpha id
       
   225 					TSatUtility::SetAlphaId(
       
   226 						sourceString ,sendSsV1.iAlphaId.iAlphaId ); 
       
   227 					// Set alpha id status
       
   228 					sendSsV1.iAlphaId.iStatus = RSat::EAlphaIdProvided;
       
   229 					}
       
   230 				else
       
   231 					{
       
   232 					TFLOGSTRING("CSAT: CSatNotifySendSs::CompleteNotifyL,\
       
   233 					    Alpha ID is NULL");
       
   234 					sendSsV1.iAlphaId.iStatus = RSat::EAlphaIdNull;
       
   235 					}
       
   236 				}
       
   237 			else
       
   238 				{
       
   239 				TFLOGSTRING("CSAT: CSatNotifySendSs::CompleteNotifyL,\
       
   240 				    Alpha ID not present");
       
   241 				sendSsV1.iAlphaId.iStatus = RSat::EAlphaIdNotPresent;
       
   242 				}
       
   243 
       
   244 			// SS string Tlv
       
   245 			sendSsV1.iSsString.iSsString.Zero(); 
       
   246 			CTlv ssString;
       
   247 			// Get SS string tlv
       
   248 			returnValue = berTlv.TlvByTagValue( &ssString, KTlvSsStringTag );
       
   249 			
       
   250 			if ( KErrNone == returnValue )
       
   251 				{
       
   252 				// Initialize ton and npi
       
   253 				RSat::TTypeOfNumber ton;
       
   254 				RSat::TNumberingPlan npi;
       
   255 
       
   256 				iNotificationsTsy->iSatTsy->SetTonNpi( 
       
   257 				    ssString.GetShortInfo( ETLV_TonAndNpi ) );
       
   258 				            
       
   259 				// Call utility function that maps received TON and NPI 
       
   260 				// to RSat values
       
   261 				TSatUtility::TonAndNpi( 
       
   262 					ssString.GetShortInfo( ETLV_TonAndNpi ), &ton, &npi );
       
   263 
       
   264 				// Set TON and NPI
       
   265 				sendSsV1.iSsString.iTypeOfNumber = ton;
       
   266 				sendSsV1.iSsString.iNumberPlan = npi;
       
   267 				// Check length of SS string.
       
   268 				// BCD format = two digits "packed" in one characher
       
   269 				if ( RSat::KStringMaxSize >= ( ssString.GetLength() * 2 )  )
       
   270 					{
       
   271 					TBuf8<RSat::KStringMaxSize> tempString;
       
   272 					// Set pointer to the BCD SS string
       
   273 					sourceString.Set( ssString.GetData( 
       
   274 					    ETLV_SsOrUssdString ) );
       
   275 					// Semi-octet presentation used
       
   276 					// Converting back to ASCII format
       
   277 					TSatUtility::BCDToAscii( sourceString, tempString );
       
   278 					// Set pointer to the ASCII string.
       
   279 					sourceString.Set( tempString );
       
   280 					sendSsV1.iSsString.iSsString.Append( tempString );
       
   281 
       
   282 					if ( RSat::EInternationalNumber == 
       
   283 						sendSsV1.iSsString.iTypeOfNumber )
       
   284 						{
       
   285 						// Append '+' character if the string is for call forwarding
       
   286 						CheckCallForwarding( sourceString, sendSsV1.iSsString );
       
   287 						}
       
   288 
       
   289 					if ( KErrNone == CheckSsStringValidity( sourceString ) )
       
   290 						{
       
   291 						// Valid SS, report to call control
       
   292 						iNotificationsTsy->iSatTsy->StoreProactiveAddress(&sourceString );
       
   293 						}
       
   294 					else
       
   295 						{
       
   296 						TFLOGSTRING("CSAT: CSatNotifySendSs::CompleteNotifyL,\
       
   297 							Data corrupted");
       
   298 						CreateTerminalRespL( pCmdNumber, RSat::KCmdDataNotUnderstood,
       
   299 								KNullDesC16 );
       
   300 						ret = KErrCorrupt;
       
   301 						}
       
   302 
       
   303 					}
       
   304 				else
       
   305 					{
       
   306 					TFLOGSTRING("CSAT: CSatNotifySendSs::CompleteNotifyL,\
       
   307 						SS String length exceeded");
       
   308 					// SS string is too long
       
   309 					CreateTerminalRespL( pCmdNumber, RSat::KCmdDataNotUnderstood,
       
   310 							KNullDesC16 );
       
   311 					ret = KErrCorrupt;
       
   312 					}
       
   313 				}
       
   314 			else
       
   315 				{
       
   316 				TFLOGSTRING("CSAT: CSatNotifySendSs::CompleteNotifyL,\
       
   317 				    SS String missing");
       
   318 				// Mandatory tlv is missing, returning response immediately
       
   319 				CreateTerminalRespL(
       
   320 					pCmdNumber, RSat::KErrorRequiredValuesMissing, 
       
   321 					KNullDesC16 );
       
   322 				ret = KErrCorrupt;
       
   323 				}
       
   324 				
       
   325 
       
   326 			// Icon (optional)
       
   327 			TSatUtility::FillIconStructure( berTlv, sendSsV1.iIconId );
       
   328 
       
   329 			} // End of if (KErrNone == aErrorCode)
       
   330 		else
       
   331 			{
       
   332 			ret = aErrorCode;
       
   333 			}
       
   334 
       
   335         iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret );
       
   336 
       
   337         } // End of if ( reqHandle != CSatTsy::ESatReqHandleUnknown )
       
   338     else 
       
   339 		{
       
   340         TFLOGSTRING("CSAT: CSatNotifySendSs::CompleteNotifyL,\
       
   341             Request not ongoing");
       
   342         // Request not on, returning response immediately
       
   343 		TBuf<1> additionalInfo;
       
   344 		additionalInfo.Append( RSat::KNoSpecificMeProblem );
       
   345 		CreateTerminalRespL( pCmdNumber, RSat::KMeUnableToProcessCmd,  
       
   346 			additionalInfo );					
       
   347     	}
       
   348 
       
   349     return ret;
       
   350 	}
       
   351 
       
   352 
       
   353 // -----------------------------------------------------------------------------
       
   354 // CSatNotifySendSs::TerminalResponseL
       
   355 // Called by ETel server, passes terminal response to DOS
       
   356 // -----------------------------------------------------------------------------
       
   357 //
       
   358 TInt CSatNotifySendSs::TerminalResponseL
       
   359         ( 
       
   360         TDes8* aRsp
       
   361         )
       
   362     {
       
   363     TFLOGSTRING("CSAT:: CSatNotifySendSs::TerminalResponseL");  
       
   364     TInt ret( KErrNone );
       
   365     // Buffer for additional information
       
   366     TBuf<RSat::KAdditionalInfoMaxSize> additionalInfo;
       
   367     RSat::TSendSsRspV2Pckg* aRspPckg = 
       
   368             reinterpret_cast<RSat::TSendSsRspV2Pckg*>( aRsp );
       
   369     RSat::TSendSsRspV2& rspV2 = ( *aRspPckg ) ();
       
   370     // Get Proactive command number
       
   371     TUint8 pCmdNumber( rspV2.PCmdNumber() );
       
   372 
       
   373     // Check that general result value is valid
       
   374     if ( ( RSat::KSuccess != rspV2.iGeneralResult ) 
       
   375         && ( RSat::KPartialComprehension != rspV2.iGeneralResult )
       
   376         && ( RSat::KMissingInformation != rspV2.iGeneralResult )
       
   377         && ( RSat::KSuccessRequestedIconNotDisplayed != rspV2.iGeneralResult )
       
   378         && ( RSat::KUssdTransactionTerminatedByUser != rspV2.iGeneralResult )
       
   379         && ( RSat::KMeUnableToProcessCmd != rspV2.iGeneralResult )
       
   380         && ( RSat::KNetworkUnableToProcessCmd != rspV2.iGeneralResult )
       
   381         && ( RSat::KInteractionWithCCTemporaryError != rspV2.iGeneralResult )
       
   382         && ( RSat::KCmdBeyondMeCapabilities != rspV2.iGeneralResult )
       
   383         && ( RSat::KCmdTypeNotUnderstood != rspV2.iGeneralResult )
       
   384         && ( RSat::KCmdDataNotUnderstood != rspV2.iGeneralResult )
       
   385         && ( RSat::KCmdNumberNotKnown != rspV2.iGeneralResult )
       
   386         && ( RSat::KSsReturnError != rspV2.iGeneralResult )
       
   387         && ( RSat::KErrorRequiredValuesMissing != rspV2.iGeneralResult )
       
   388         && ( RSat::KInteractionWithCCPermanentError != rspV2.iGeneralResult ) )
       
   389         {
       
   390         TFLOGSTRING("CSAT:: CSatNotifySendSs::TerminalResponseL,\
       
   391             Invalid General Result");
       
   392         // Invalid general result
       
   393         ret = KErrCorrupt;
       
   394         }
       
   395 
       
   396     TBool isValidAddInfo(EFalse); // assume worse
       
   397     // check that additional info is actually present
       
   398     switch (rspV2.iGeneralResult)
       
   399     	{
       
   400     	case RSat::KSsReturnError:
       
   401     	case RSat::KNetworkUnableToProcessCmd:
       
   402         	if ( ( RSat::KSatNetworkErrorInfo == rspV2.iInfoType ) &&
       
   403         		 ( rspV2.iAdditionalInfo.Length() > 0 ) )
       
   404         		{
       
   405     			isValidAddInfo = ETrue;
       
   406                 additionalInfo.Copy( rspV2.iAdditionalInfo );
       
   407         		}
       
   408     		break;
       
   409     	case RSat::KMeUnableToProcessCmd:
       
   410     	case RSat::KInteractionWithCCPermanentError:
       
   411         	if ( ( RSat::KMeProblem == rspV2.iInfoType ) &&
       
   412        		     ( rspV2.iAdditionalInfo.Length() > 0 ) )
       
   413         		{
       
   414     			isValidAddInfo = ETrue;
       
   415                 additionalInfo.Copy( rspV2.iAdditionalInfo );
       
   416         		}
       
   417     		break;
       
   418     	case RSat::KSuccess:
       
   419     	case RSat::KPartialComprehension:
       
   420     	case RSat::KMissingInformation:
       
   421     	case RSat::KSuccessRequestedIconNotDisplayed:
       
   422 		    if ( ( RSat::KSendSsInfo == rspV2.iInfoType ) &&
       
   423   		         ( rspV2.iAdditionalInfo.Length() > 0 ) )
       
   424 	    		{
       
   425 				isValidAddInfo = ETrue;
       
   426 	            additionalInfo.Copy( rspV2.iAdditionalInfo );
       
   427 	            // Remove operation code.
       
   428 	            // SATUI appends iOperationCode to additional info.
       
   429 	            // RMmCustomAPI::TSsAdditionalInfo iAddtionalInfo includes
       
   430 	            // correct SS Return Result Operation code, so fisrt byte of
       
   431 	            // additionalInfo is not needed.
       
   432 	            additionalInfo.Delete( 0, 1 );
       
   433 	    		}
       
   434 		    break;
       
   435     	default:
       
   436     	    if ( RSat::KNoAdditionalInfo == rspV2.iInfoType )
       
   437     	    	{
       
   438     			isValidAddInfo = ETrue;
       
   439     	    	}
       
   440     	    else if ( rspV2.iAdditionalInfo.Length() > 0 )
       
   441 	    		{
       
   442     			isValidAddInfo = ETrue;
       
   443 	    		additionalInfo.Copy( rspV2.iAdditionalInfo );
       
   444 	    		}
       
   445     		break;
       
   446     	}
       
   447     
       
   448 	if ( !isValidAddInfo )
       
   449 		{
       
   450     	TFLOGSTRING("CSAT: CSatNotifyCloseChannel::TerminalResponseL\
       
   451     		Invalid Additional Info");
       
   452     	ret = KErrCorrupt;
       
   453 		}
       
   454         
       
   455     // Report to call control that proactive session is over
       
   456     iNotificationsTsy->iSatTsy->StoreProactiveAddress( NULL );
       
   457 
       
   458 
       
   459 	TInt response = CreateTerminalRespL( pCmdNumber, static_cast<TUint8>( 
       
   460 										rspV2.iGeneralResult ), additionalInfo );
       
   461 	if ( KErrNone == ret )
       
   462 	{
       
   463 		ret = response;
       
   464 	}
       
   465 
       
   466     return ret;
       
   467     }
       
   468 
       
   469 
       
   470 
       
   471 // -----------------------------------------------------------------------------
       
   472 // CSatNotifySendSs::CreateTerminalRespL
       
   473 // Constructs SendSs specific part of terminal response and calls 
       
   474 // DOS to send the actual message.
       
   475 // -----------------------------------------------------------------------------
       
   476 //
       
   477 TInt CSatNotifySendSs::CreateTerminalRespL
       
   478         ( 
       
   479         TUint8 aPCmdNumber,        
       
   480         TUint8 aGeneralResult,      
       
   481         const TDesC16& aAdditionalInfo
       
   482 		)
       
   483     {
       
   484 	TFLOGSTRING("CSAT:: CSatNotifySendSs::CreateTerminalRespL");
       
   485     // Create and append response data
       
   486     TTlv tlvSpecificData;
       
   487     tlvSpecificData.AddTag( KTlvResultTag );    
       
   488 	// Append general result
       
   489     tlvSpecificData.AddByte( aGeneralResult );
       
   490 	for (TInt i = 0; i < aAdditionalInfo.Length(); i++ )
       
   491 		{
       
   492 		tlvSpecificData.AddByte( static_cast<TUint8>( aAdditionalInfo[i] ) );
       
   493 		}
       
   494 		
       
   495     // Prepare data
       
   496     iNotificationsTsy->iTerminalRespData.iPCmdNumber = aPCmdNumber;
       
   497     TPtrC8 data = tlvSpecificData.GetDataWithoutTopLevelTag();
       
   498     // Pack data
       
   499     CSatDataPackage dataPackage;
       
   500 	dataPackage.PackData( &iNotificationsTsy->iTerminalRespData, &data );
       
   501     // Forward request to the DOS
       
   502     return iNotificationsTsy->iSatTsy->MessageManager()->HandleRequestL( 
       
   503 		ESatTerminalRsp, &dataPackage );
       
   504     }
       
   505 
       
   506 
       
   507 // -----------------------------------------------------------------------------
       
   508 // CSatNotifySendSs::CheckCallForwarding
       
   509 // This method Checks SS string if it is for call forwarding. If it is 
       
   510 // append '+' character to pretending international number.
       
   511 // -----------------------------------------------------------------------------
       
   512 //
       
   513 
       
   514 void CSatNotifySendSs::CheckCallForwarding
       
   515 		( 
       
   516     	TPtrC8 aSource,               
       
   517     	RSat::TSsString& aSsString 
       
   518     	)
       
   519     {
       
   520     TFLOGSTRING("CSAT:: CSatNotifySendSs::CheckCallForwarding");
       
   521     _LIT8(KCFU,"*21*");    // Call forwarding unconditional (CFU)
       
   522     _LIT8(KCFB,"*67*");    // Call forwarding on Mobile Subscriber Busy(CFB)
       
   523     _LIT8(KCFNRy, "*61*"); // Call forwarding on No Reply (CFNRy)
       
   524     _LIT8(KCFNRc, "*62*"); // Call forwarding on Mobile Subscriber Not 
       
   525                            // Reachable (CFNRc)    
       
   526     // Try to find call forwarding string
       
   527     TInt pos( aSource.Find( KCFU ) );
       
   528     if ( KErrNotFound == pos )
       
   529         {
       
   530         pos = aSource.Find( KCFB );
       
   531         }
       
   532     if ( KErrNotFound == pos )
       
   533         {
       
   534         pos = aSource.Find( KCFNRy );
       
   535         }
       
   536     if ( KErrNotFound == pos )
       
   537         {
       
   538         pos = aSource.Find( KCFNRc );
       
   539         }
       
   540     if ( KErrNotFound != pos )
       
   541         {
       
   542         TFLOGSTRING("CSAT:: CSatNotifySendSs::CheckCallForwarding,\
       
   543             String is for call forwarding");
       
   544         aSsString.iSsString.Zero();
       
   545         aSsString.iSsString.Append( aSource.Left( pos + 4 ) );
       
   546         aSsString.iSsString.Append( KPlusMarkCharacterCode );
       
   547         aSsString.iSsString.Append( 
       
   548             aSource.Right( aSource.Length() - ( pos + 4) ) );
       
   549         }
       
   550     }
       
   551 
       
   552 // -----------------------------------------------------------------------------
       
   553 // CSatNotifySendSs::CheckSsStringValidity
       
   554 // This method Checks validity of SS string.If string includes undefined SS 
       
   555 // characters or length is zero then return KErrCorrupt.
       
   556 // -----------------------------------------------------------------------------
       
   557 //	
       
   558 
       
   559 TInt CSatNotifySendSs::CheckSsStringValidity
       
   560 		(
       
   561     	TPtrC8 aSsString 
       
   562     	)
       
   563     {
       
   564     TFLOGSTRING("CSAT:: CSatNotifySendSs::CheckSsStringValidity");
       
   565     TInt ret( KErrNone );
       
   566     
       
   567     if ( !aSsString.Length() )
       
   568         {
       
   569         TFLOGSTRING("CSAT:: CSatNotifySendSs::CheckSsStringValidity,\
       
   570             String length is NULL");
       
   571         // If length is zero
       
   572         ret = KErrCorrupt;
       
   573         }
       
   574     
       
   575     _LIT8( KDtmf,            "p");
       
   576     _LIT8( KWild,            "w");
       
   577     _LIT8( KExpansionDigit,  ".");
       
   578 
       
   579     // SS string can contain only digits, star '*' and dash '#' characters.
       
   580     if ( ( KErrNotFound != aSsString.Find( KDtmf ) )
       
   581         || ( KErrNotFound != aSsString.Find( KWild ) )
       
   582         || ( KErrNotFound != aSsString.Find( KExpansionDigit ) ) )
       
   583         {
       
   584         TFLOGSTRING("CSAT:: CSatNotifySendSs::CheckSsStringValidity,\
       
   585             Incompatible character found");
       
   586         ret = KErrCorrupt;
       
   587         }
       
   588     return ret;
       
   589     }
       
   590     
       
   591 // End of file
       
   592