telephonyserverplugins/simatktsy/src/CSatNotifyLaunchBrowser.cpp
changeset 0 3553901f7fa8
child 19 630d2f34d719
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2005-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        : CSatNotifyLaunchBrowser.cpp
       
    15 // Part of     : Common SIM ATK TSY / commonsimatktsy
       
    16 // LaunchBrowser 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 "CSatNotifyLaunchBrowser.h"// Tsy class header
       
    26 #include "CSatNotificationsTsy.h"   // Class header
       
    27 #include "CBerTlv.h"                // Ber Tlv data handling
       
    28 #include "TTlv.h"					// TTlv class
       
    29 #include "CSatDataPackage.h"        // Parameter packing 
       
    30 #include "TfLogger.h"               // For TFLOGSTRING
       
    31 #include "TSatUtility.h"            // Utilities
       
    32 #include "CSatTsyReqHandleStore.h"  // Request handle class
       
    33 #include "cmmmessagemanagerbase.h"  // Message manager class for forwarding req.
       
    34 
       
    35 // -----------------------------------------------------------------------------
       
    36 // CSatNotifyLaunchBrowser::NewL
       
    37 // Two-phased constructor.
       
    38 // -----------------------------------------------------------------------------
       
    39 //  
       
    40 CSatNotifyLaunchBrowser* CSatNotifyLaunchBrowser::NewL
       
    41         ( 
       
    42         CSatNotificationsTsy* aNotificationsTsy 
       
    43         )
       
    44     {
       
    45     TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::NewL");
       
    46    	CSatNotifyLaunchBrowser* const satNotifyLaunchBrowser = 
       
    47         new ( ELeave ) CSatNotifyLaunchBrowser( aNotificationsTsy );
       
    48     CleanupStack::PushL( satNotifyLaunchBrowser );
       
    49     satNotifyLaunchBrowser->ConstructL();
       
    50     CleanupStack::Pop( satNotifyLaunchBrowser );
       
    51     TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::NewL, end of method");
       
    52     return satNotifyLaunchBrowser;
       
    53     }
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // CSatNotifyLaunchBrowser::~CSatNotifyLaunchBrowser
       
    57 // Destructor
       
    58 // -----------------------------------------------------------------------------
       
    59 //  
       
    60 CSatNotifyLaunchBrowser::~CSatNotifyLaunchBrowser
       
    61         ( 
       
    62 		// None
       
    63         )
       
    64     {
       
    65     TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::~CSatNotifyLaunchBrowser");
       
    66     }
       
    67     
       
    68 // -----------------------------------------------------------------------------
       
    69 // CSatNotifyLaunchBrowser::CSatNotifyLaunchBrowser
       
    70 // Default C++ constructor
       
    71 // -----------------------------------------------------------------------------
       
    72 //  
       
    73 CSatNotifyLaunchBrowser::CSatNotifyLaunchBrowser
       
    74         ( 
       
    75         CSatNotificationsTsy* aNotificationsTsy 
       
    76         ) : iNotificationsTsy ( aNotificationsTsy )
       
    77     {
       
    78     // None
       
    79     }
       
    80 
       
    81 // -----------------------------------------------------------------------------
       
    82 // CSatNotifyLaunchBrowser::ConstructL
       
    83 // Symbian 2nd phase constructor
       
    84 // -----------------------------------------------------------------------------
       
    85 //  
       
    86 void CSatNotifyLaunchBrowser::ConstructL
       
    87         (
       
    88         // None
       
    89         )
       
    90     {
       
    91     TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::ConstructL");
       
    92     iSsStatus = CSatNotificationsTsy::ENotBusy;
       
    93     }
       
    94     
       
    95 // -----------------------------------------------------------------------------
       
    96 // CSatNotifyLaunchBrowser::Notify
       
    97 // This request allows a client to be notified of a Launch Browser proactive 
       
    98 // command
       
    99 // -----------------------------------------------------------------------------
       
   100 //
       
   101 TInt CSatNotifyLaunchBrowser::Notify
       
   102         (
       
   103         const TTsyReqHandle aTsyReqHandle,
       
   104         const TDataPackage& aPackage   
       
   105         )
       
   106     {
       
   107     TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::Notify");
       
   108     // Save data pointer to client side for completion
       
   109     iLaunchBrowserV2Pckg = reinterpret_cast<RSat::TLaunchBrowserV2Pckg*>( 
       
   110         aPackage.Des1n() );
       
   111     // Save the request handle
       
   112     iNotificationsTsy->iSatTsy->SaveReqHandle( aTsyReqHandle, 
       
   113 		CSatTsy::ESatNotifyLaunchBrowserPCmdReqType );
       
   114     // Check if requested notification is already pending
       
   115     iNotificationsTsy->NotifySatReadyForNotification( KLaunchBrowser );   
       
   116 
       
   117     return KErrNone;
       
   118     }
       
   119 
       
   120 // -----------------------------------------------------------------------------
       
   121 // CSatNotifyLaunchBrowser::CancelNotification
       
   122 // This method cancels an outstanding asynchronous 
       
   123 // NotifyLaunchBrowser request.
       
   124 // -----------------------------------------------------------------------------
       
   125 //
       
   126 TInt CSatNotifyLaunchBrowser::CancelNotification
       
   127         (
       
   128         const TTsyReqHandle aTsyReqHandle
       
   129         )
       
   130     {
       
   131     TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::CancelNotification");
       
   132     
       
   133     // Reset the request handle
       
   134     TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore->
       
   135         ResetTsyReqHandle( CSatTsy::ESatNotifyLaunchBrowserPCmdReqType );
       
   136 	// Reset the data pointer
       
   137 	iLaunchBrowserV2Pckg = NULL;
       
   138 	// Complete the request with KErrCancel
       
   139 	iNotificationsTsy->iSatTsy->ReqCompleted( aTsyReqHandle, KErrCancel );
       
   140 
       
   141     return KErrNone;    
       
   142     }
       
   143 
       
   144 
       
   145 
       
   146 // -----------------------------------------------------------------------------
       
   147 // CSatNotifyLaunchBrowser::CompleteNotifyL
       
   148 // This method completes an outstanding asynchronous 
       
   149 // NotifyLaunchBrowser request. 
       
   150 // -----------------------------------------------------------------------------
       
   151 //
       
   152 TInt CSatNotifyLaunchBrowser::CompleteNotifyL
       
   153         (
       
   154         CSatDataPackage* aDataPackage,  
       
   155         TInt aErrorCode
       
   156         )
       
   157     {  
       
   158 	TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::CompleteNotifyL");
       
   159 	TInt ret( KErrNone );
       
   160 	TInt returnValue( KErrNone );		
       
   161     // Unpack parameters
       
   162     TPtrC8* data;
       
   163     aDataPackage->UnPackData( &data );
       
   164 
       
   165     // Reset req handle. Returns the deleted req handle
       
   166     TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore->ResetTsyReqHandle( 
       
   167         CSatTsy::ESatNotifyLaunchBrowserPCmdReqType );
       
   168     // Get ber tlv 
       
   169 	CBerTlv berTlv;
       
   170     berTlv.SetData( *data );
       
   171 	// Get command details tlv
       
   172 	CTlv commandDetails;
       
   173 	berTlv.TlvByTagValue( &commandDetails, KTlvCommandDetailsTag );	
       
   174     // Store command details tlv
       
   175 	iNotificationsTsy->iTerminalRespData.iCommandDetails.Copy( commandDetails.Data() );	
       
   176 	// Get command qualifier
       
   177 	TUint8 cmdQualifier( commandDetails.GetShortInfo( ETLV_CommandQualifier ) );			
       
   178 	TUint8 pCmdNumber( commandDetails.GetShortInfo( ETLV_CommandNumber ) );
       
   179 	
       
   180 	// In case the request was ongoing, continue..
       
   181     if ( CSatTsy::ESatReqHandleUnknown != reqHandle )
       
   182         {		
       
   183 		// Check if busy 
       
   184     	if ( CSatNotificationsTsy::ENotBusy != iSsStatus )
       
   185     		{
       
   186     		TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::CompleteNotifyL, \
       
   187     			iSsStatus is busy");
       
   188 
       
   189         	if( CSatNotificationsTsy::EUssdBusy == iSsStatus)
       
   190     			{
       
   191     			// Ussd transaction ongoing
       
   192     			CreateTerminalRespL( pCmdNumber, RSat::KMeUnableToProcessCmd, 
       
   193 			        RSat::KMeBusyOnUssd );	
       
   194     			}
       
   195     		else
       
   196     			{
       
   197     			// Ss transaction ongoing
       
   198     			CreateTerminalRespL( pCmdNumber, RSat::KMeUnableToProcessCmd, 
       
   199 			        RSat::KMeBusyOnSs );		
       
   200     			}		
       
   201     		}
       
   202     	else
       
   203     		{	    
       
   204 			TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::CompleteNotifyL \
       
   205 				No SS Transaction ongoing");
       
   206 			// Complete right away if error has occured, otherwise continue..
       
   207 	        if ( KErrNone == aErrorCode )
       
   208 	            {			
       
   209 				// Launch browser structure
       
   210 				RSat::TLaunchBrowserV2& launchBrowserV2 = 
       
   211 					( *iLaunchBrowserV2Pckg )();
       
   212 				
       
   213 				// Store command number
       
   214                 launchBrowserV2.SetPCmdNumber( pCmdNumber );
       
   215 
       
   216             	switch ( cmdQualifier )
       
   217             		{        
       
   218             		case KLaunchBrowserIfNotYetLaunched:
       
   219             			{
       
   220             			launchBrowserV2.iBrowserSel = 
       
   221             				RSat::ELaunchBrowserIfNotAlreadyLaunched;
       
   222             			}
       
   223             			break;
       
   224             		case KUseExistingBrowser:
       
   225             			{
       
   226             			launchBrowserV2.iBrowserSel = 
       
   227             			    RSat::EUseExistingBrowser;
       
   228             			break;
       
   229             			}
       
   230             		case KCloseAndLaunchNewBrowser:
       
   231             			{
       
   232             			launchBrowserV2.iBrowserSel = 
       
   233             				RSat::ECloseExistingLaunchNewBrowserSession;
       
   234             			break;
       
   235             			}
       
   236             		case KLaunchBrowserCmdQualifierNotUsed:
       
   237             		case KLaunchBrowserCmdQualifierReserved:
       
   238             			{
       
   239             			TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::\
       
   240             			    CompleteNotifyL, Command Type not understood");
       
   241             			CreateTerminalRespL( pCmdNumber, 
       
   242             			    RSat::KCmdTypeNotUnderstood, KNoCause );
       
   243                         ret = KErrCorrupt;
       
   244             			break;
       
   245             			}
       
   246             		default: 
       
   247             			{
       
   248             			launchBrowserV2.iBrowserSel = 
       
   249             				RSat::EBrowserSelectionNotSet;
       
   250             			break;
       
   251             			}
       
   252             		}
       
   253 	    
       
   254 				if ( KErrNone == ret )
       
   255 					{
       
   256 					ret = ParseBrowserIdL( pCmdNumber, berTlv, 
       
   257 					    launchBrowserV2 );
       
   258 					}
       
   259 
       
   260 				if ( KErrNone == ret )
       
   261 					{
       
   262 					ret = ParseUrlL( pCmdNumber, berTlv, launchBrowserV2 );
       
   263 					}
       
   264 
       
   265 				if ( KErrNone == ret )
       
   266 					{
       
   267 					ret = ParseProvisioningFileListL( pCmdNumber, berTlv, 
       
   268 					    launchBrowserV2 );
       
   269 					}
       
   270 					
       
   271 				if ( KErrNone == ret )
       
   272 					{
       
   273 					ret = ParseBearerListL( pCmdNumber, berTlv, 
       
   274 					    launchBrowserV2 );
       
   275 					}
       
   276 
       
   277 				if ( KErrNone == ret )
       
   278 					{
       
   279 					// Text string (Gateway/Proxy) 
       
   280 					CTlv textString;
       
   281 					returnValue = berTlv.TlvByTagValue( &textString, 
       
   282 					    KTlvTextStringTag );
       
   283 					if ( KErrNone == returnValue )
       
   284 						{
       
   285 						TSatUtility::SetText( textString, 
       
   286 						    launchBrowserV2.iText );
       
   287 						}
       
   288 					}
       
   289 	        
       
   290 				if ( KErrNone == ret )
       
   291 					{
       
   292 					// Alpha ID string (optional) for user confirmation phase
       
   293 					CTlv alphaIdentifier;
       
   294 					returnValue = berTlv.TlvByTagValue( &alphaIdentifier, 
       
   295 						KTlvAlphaIdentifierTag );
       
   296 					launchBrowserV2.iAlphaId.iStatus = 
       
   297 					    RSat::EAlphaIdNotPresent;
       
   298 					
       
   299 					if ( KErrNotFound != returnValue )
       
   300 						{
       
   301 						TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::\
       
   302 					        CompleteNotifyL, Alpha ID present");
       
   303 						TUint8 alphaIdLength( alphaIdentifier.GetLength() );
       
   304 						if ( alphaIdLength )
       
   305 							{
       
   306 							TPtrC8 sourceString;
       
   307 
       
   308 							// Get the alpha id
       
   309 							sourceString.Set( alphaIdentifier.GetData( 
       
   310 							    ETLV_AlphaIdentifier ) );
       
   311 	        
       
   312 							// Convert and set the alpha id
       
   313 							TSatUtility::SetAlphaId( sourceString , 
       
   314 								launchBrowserV2.iAlphaId.iAlphaId ); 
       
   315 
       
   316 							launchBrowserV2.iAlphaId.iStatus = 
       
   317 							    RSat::EAlphaIdProvided;
       
   318 							}
       
   319 						else
       
   320 							{
       
   321 							TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::\
       
   322 							    CompleteNotifyL, Alpha ID is NULL");
       
   323 							launchBrowserV2.iAlphaId.iStatus = 
       
   324 							    RSat::EAlphaIdNull;
       
   325 							}
       
   326 						}
       
   327 	        
       
   328             		// Iconid 
       
   329             		TSatUtility::FillIconStructure( berTlv, 
       
   330             			launchBrowserV2.iIconId );
       
   331             		}
       
   332 			
       
   333 			    } // End of if (KErrNone == aErrorCode)
       
   334 	        else
       
   335 	        	{
       
   336 	        	ret = aErrorCode;
       
   337 	        	}
       
   338 
       
   339 	        iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret );
       
   340 	        }
       
   341         }// End of if ( reqHandle != CSatTsy::ESatReqHandleUnknown ) 
       
   342 	else 
       
   343         {
       
   344         TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::CompleteNotifyL, \
       
   345             Request not ongoing");  
       
   346         // Request not on, returning response immediately
       
   347 		CreateTerminalRespL( pCmdNumber, RSat::KMeUnableToProcessCmd, 
       
   348 			KNoCause );
       
   349 		}    
       
   350 
       
   351 	return ret;
       
   352 	}
       
   353 
       
   354 
       
   355 
       
   356 // -----------------------------------------------------------------------------
       
   357 // CSatNotifyLaunchBrowser::TerminalResponseL
       
   358 // Called by ETel server, passes terminal response to DOS
       
   359 // -----------------------------------------------------------------------------
       
   360 //
       
   361 TInt CSatNotifyLaunchBrowser::TerminalResponseL
       
   362         ( 
       
   363         TDes8* aRsp
       
   364         )
       
   365     {
       
   366     TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::TerminalResponseL");
       
   367 	TInt   ret( KErrNone );
       
   368     TUint8 additionalInfo( KNoCause );
       
   369     RSat::TLaunchBrowserRspV2Pckg* aRspPckg = 
       
   370             reinterpret_cast<RSat::TLaunchBrowserRspV2Pckg*>( aRsp );
       
   371     RSat::TLaunchBrowserRspV2& rspV2 = ( *aRspPckg ) ();
       
   372     // Get Proactive command number
       
   373     TUint8 pCmdNumber( rspV2.PCmdNumber() );
       
   374     
       
   375     // Check that general result value is valid
       
   376     if ( ( RSat::KSuccess != rspV2.iGeneralResult ) && 
       
   377          ( RSat::KPSessionTerminatedByUser  != rspV2.iGeneralResult ) && 
       
   378          ( RSat::KBackwardModeRequestedByUser != rspV2.iGeneralResult ) && 
       
   379          ( RSat::KNoResponseFromUser != rspV2.iGeneralResult ) && 
       
   380          ( RSat::KMeUnableToProcessCmd != rspV2.iGeneralResult ) && 
       
   381          ( RSat::KCmdBeyondMeCapabilities != rspV2.iGeneralResult ) && 
       
   382          ( RSat::KCmdDataNotUnderstood != rspV2.iGeneralResult ) && 
       
   383          ( RSat::KLaunchBrowserError != rspV2.iGeneralResult ) && 
       
   384          ( RSat::KPCmdNotAcceptedByUser != rspV2.iGeneralResult ) &&
       
   385          ( RSat::KCmdTypeNotUnderstood != rspV2.iGeneralResult ) &&
       
   386          ( RSat::KPartialComprehension != rspV2.iGeneralResult ) &&
       
   387          ( RSat::KMissingInformation != rspV2.iGeneralResult ) &&
       
   388          ( RSat::KNetworkUnableToProcessCmd != rspV2.iGeneralResult ) &&
       
   389          ( RSat::KCmdNumberNotKnown != rspV2.iGeneralResult ) )
       
   390         {
       
   391         TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::TerminalResponseL, \
       
   392             Invalid General Result");
       
   393         // Invalid general result
       
   394         ret = KErrCorrupt;
       
   395         }
       
   396 
       
   397     // Check that infotype is valid: from enum TBrowserError in etelsat.h
       
   398     if ( ( RSat::KMeProblem != rspV2.iInfoType ) && 
       
   399          ( RSat::KNoAdditionalInfo != rspV2.iInfoType ) && 
       
   400          ( RSat::KBearerUnvailable != rspV2.iInfoType ) && 
       
   401          ( RSat::KBrowserUnavailable != rspV2.iInfoType ) && 
       
   402          ( RSat::KMeUnableToReadProvisioningData != rspV2.iInfoType ) && 
       
   403          ( RSat::KNoSpecificBrowserError != rspV2.iInfoType ) )
       
   404         {
       
   405         TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::TerminalResponseL, \
       
   406             Invalid Info Type");
       
   407         ret = KErrCorrupt;
       
   408         }
       
   409 
       
   410     // If there is Me (Mobile Equipment) error, additional info is needed
       
   411     if ( ( RSat::KMeProblem == rspV2.iInfoType ) )
       
   412         {
       
   413         // Check the length of additional info
       
   414         if ( 0 != rspV2.iAdditionalInfo.Length() )
       
   415             {
       
   416             additionalInfo = rspV2.iAdditionalInfo[0];
       
   417 			}
       
   418         else
       
   419             {
       
   420             TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::TerminalResponseL, \
       
   421                 Invalid Additional Info");
       
   422             // Invalid additional info field
       
   423             ret = KErrCorrupt;
       
   424             }
       
   425         }
       
   426 
       
   427     CreateTerminalRespL( pCmdNumber, static_cast<TUint8>( 
       
   428         rspV2.iGeneralResult ), additionalInfo );                            
       
   429 	
       
   430 	return ret;
       
   431     }
       
   432     
       
   433 // -----------------------------------------------------------------------------
       
   434 // CSatNotifyLaunchBrowser::SetSatTsySsStatus
       
   435 // Stores Ss status information.
       
   436 // -----------------------------------------------------------------------------
       
   437 //
       
   438 void CSatNotifyLaunchBrowser::SetSsStatus
       
   439 		(
       
   440 		CSatDataPackage* aDataPackage
       
   441 		)
       
   442 	{
       
   443 	// Unpack parameters
       
   444 	aDataPackage->UnPackData( iSsStatus );
       
   445 	TFLOGSTRING2("CSAT: CSatNotifyLaunchBrowser::SetSatTsySsStatus, status: %d", 
       
   446 		iSsStatus );
       
   447 	}
       
   448     
       
   449 // -----------------------------------------------------------------------------
       
   450 // CSatNotifyLaunchBrowser::ParseBrowserIdL
       
   451 // Help method for CompleteNotify, sets the Browser ID
       
   452 // -----------------------------------------------------------------------------
       
   453 //
       
   454 TInt CSatNotifyLaunchBrowser::ParseBrowserIdL
       
   455         ( 
       
   456         TUint8 aPCmdNumber,
       
   457         CBerTlv& aBerTlv,
       
   458         RSat::TLaunchBrowserV2& aLaunchBrowserV2
       
   459         )
       
   460     {
       
   461     TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::ParseBrowserId");
       
   462     TInt ret( KErrNone );
       
   463     CTlv browserId; // optional
       
   464 	TInt returnValue = aBerTlv.TlvByTagValue( &browserId, 
       
   465 		KTlvBrowserIdentityTag );
       
   466 		
       
   467 	if ( KErrNotFound != returnValue )
       
   468 		{
       
   469 		// Browser id 0x00 allowed, other values are RFU
       
   470 		if ( 0x00 != browserId.GetShortInfo( ETLV_BrowserIdentity ) )
       
   471 			{				
       
   472 			CreateTerminalRespL( aPCmdNumber, RSat::KCmdDataNotUnderstood, 
       
   473 			    KNoCause );
       
   474 			ret = KErrCorrupt;
       
   475 			}
       
   476 		else
       
   477 			{
       
   478 			aLaunchBrowserV2.iBrowserId = ( RSat::TBrowserIdentity )
       
   479 				browserId.GetShortInfo( ETLV_BrowserIdentity );
       
   480 			}
       
   481 		}
       
   482 	else
       
   483 		{
       
   484 		TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::ParseBrowserId, \
       
   485             Browser ID not set");
       
   486 		aLaunchBrowserV2.iBrowserId = RSat::EBrowserIdNotSet;
       
   487 		}
       
   488 	return ret;
       
   489     }
       
   490     
       
   491 // -----------------------------------------------------------------------------
       
   492 // CSatNotifyLaunchBrowser::ParseUrlL
       
   493 // Help method for CompleteNotify, sets the URL
       
   494 // -----------------------------------------------------------------------------
       
   495 //
       
   496 TInt CSatNotifyLaunchBrowser::ParseUrlL
       
   497         ( 
       
   498         TUint8 aPCmdNumber,
       
   499         CBerTlv& aBerTlv,
       
   500         RSat::TLaunchBrowserV2& aLaunchBrowserV2
       
   501         )
       
   502     {
       
   503     TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::ParseUrl");
       
   504     TInt ret( KErrNone );
       
   505     CTlv url; // mandatory
       
   506 	TInt returnValue = aBerTlv.TlvByTagValue( &url, KTlvUrlTag );
       
   507 	
       
   508 	if ( KErrNotFound != returnValue )
       
   509 		{
       
   510 		if ( RSat::KUrlMaxSize < url.GetLength() )
       
   511 			{
       
   512 			TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::ParseUrl, \
       
   513 			    False URL length");				
       
   514 			CreateTerminalRespL( aPCmdNumber, RSat::KMeUnableToProcessCmd, 
       
   515 			    KNoCause );
       
   516 			ret = KErrCorrupt;
       
   517 			}
       
   518 		else
       
   519 			{
       
   520 			aLaunchBrowserV2.iUrl.Copy( url.GetData( ETLV_Url ) );
       
   521 			}
       
   522 		}
       
   523 	else
       
   524 		{
       
   525 		TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::ParseUrl, \
       
   526             Required values missing");								
       
   527 		CreateTerminalRespL( aPCmdNumber, RSat::KErrorRequiredValuesMissing, 
       
   528 	        KNoCause );
       
   529 		ret = KErrCorrupt;
       
   530 		}
       
   531 	return ret;
       
   532     }
       
   533  
       
   534 // -----------------------------------------------------------------------------
       
   535 // CSatNotifyLaunchBrowser::ParseProvisioningFileListL
       
   536 // Help method for CompleteNotify, sets the Provisioning File List
       
   537 // -----------------------------------------------------------------------------
       
   538 //
       
   539 TInt CSatNotifyLaunchBrowser::ParseProvisioningFileListL
       
   540         ( 
       
   541         TUint8 aPCmdNumber,
       
   542         CBerTlv& aBerTlv,
       
   543         RSat::TLaunchBrowserV2& aLaunchBrowserV2
       
   544         )
       
   545     {
       
   546     TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::ParseProvisioningFileList");
       
   547     TInt ret( KErrNone );
       
   548     
       
   549     CTlv provisioningFileList; // optional
       
   550 	TInt returnValue = aBerTlv.TlvByTagValueMulti( &provisioningFileList, 
       
   551 		KTlvProvisioningReferenceFileTag );
       
   552 
       
   553 	TPtrC8 fileRefData = provisioningFileList.Data();
       
   554 	TUint8 numberOfFileRefData( 0 );
       
   555 	TInt ind( 0 );
       
   556 	TInt tlvLength( 0 );
       
   557 	TInt currentTlv( 0 );
       
   558 
       
   559 	if ( KErrNotFound != returnValue )
       
   560 		{
       
   561 		// Search for number of file references
       
   562 		TInt i( 0 );
       
   563 		for ( i = 0; i < fileRefData.Length(); i += tlvLength )
       
   564 			{
       
   565 			// First determine if the TLV length is coded with 1 or 2 bytes.
       
   566 			if ( KTwoByteLengthCoding == fileRefData[ind+1] )
       
   567 				{
       
   568 				// Length is coded with 2 bytes -> 1 extra byte required to be 
       
   569 				// added to total length. Also TLV header bytes (2) must be 
       
   570 				// added to total length
       
   571 				tlvLength = fileRefData[ind+2] + KTlvHeaderLength + 1;
       
   572 				}        
       
   573 			else
       
   574 				{
       
   575 				// TLV header bytes (2) must be added to total length
       
   576 				tlvLength = fileRefData[ind+1]  + KTlvHeaderLength;
       
   577 				}
       
   578 
       
   579 			currentTlv = fileRefData[ind];
       
   580 			if ( KTlvProvisioningReferenceFileTag == currentTlv )
       
   581 				{
       
   582 				numberOfFileRefData++;   
       
   583 				}
       
   584     
       
   585 			ind += tlvLength;
       
   586 			}
       
   587 
       
   588 		RSat::TProvisioningFileRef newFileRef;
       
   589 		// Set string length and pos
       
   590 		TUint8 stringLength( 0 );
       
   591 		TUint  pos( 2 );
       
   592     
       
   593 		// Add FileReferences to the structure launchBrowserV2
       
   594 		for ( i = 0; ( i < numberOfFileRefData ) && ( KErrNone == ret ); i++ )
       
   595 			{
       
   596 			// Fill the newfileref
       
   597 			stringLength = ( TUint8 ) fileRefData[pos - 1];
       
   598 			// Test whether the text contains more than "MF"
       
   599 			if ( ( RSat::KFileRefMaxSize < stringLength ) || 
       
   600 			     ( 4 > stringLength ) )
       
   601 				{
       
   602 				TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::\
       
   603 				    ParseProvisioningFileList, False string length");				
       
   604 			    CreateTerminalRespL( aPCmdNumber, RSat::KLaunchBrowserError, 
       
   605 				    RSat::KMeUnableToReadProvisioningData );
       
   606 				ret = KErrCorrupt;
       
   607 				break;
       
   608 				}
       
   609 			
       
   610 			newFileRef.Zero();
       
   611 			TUint8 x( 0 );
       
   612 			
       
   613 			for ( x = 0; x < stringLength; x++ )
       
   614 				{
       
   615 				newFileRef.Append( fileRefData[pos+x] );
       
   616 				}
       
   617 				
       
   618 			 // Adding the new fileref
       
   619 			if ( KErrNoMemory == aLaunchBrowserV2.AddFileRef( newFileRef ) )
       
   620 				{
       
   621 				TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::\
       
   622 				    ParseProvisioningFileList, Menu items corrupted");
       
   623 				// Too many or long menuitems				
       
   624 			    CreateTerminalRespL( aPCmdNumber, RSat::KLaunchBrowserError, 
       
   625 				    RSat::KMeUnableToReadProvisioningData );
       
   626 				ret = KErrCorrupt;
       
   627 				}
       
   628 				
       
   629 			// Calculating the new position
       
   630 			pos = TUint( pos + fileRefData[pos - 1] + 2 );
       
   631 			}
       
   632 		}
       
   633 	return ret;
       
   634     }
       
   635     
       
   636 // -----------------------------------------------------------------------------
       
   637 // CSatNotifyLaunchBrowser::ParseBearerListL
       
   638 // Help method for CompleteNotify, sets the Bearer List
       
   639 // -----------------------------------------------------------------------------
       
   640 //
       
   641 TInt CSatNotifyLaunchBrowser::ParseBearerListL
       
   642         ( 
       
   643         TUint8 aPCmdNumber,
       
   644         CBerTlv& aBerTlv,
       
   645         RSat::TLaunchBrowserV2& aLaunchBrowserV2
       
   646         )
       
   647     {
       
   648     TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::ParseBearerList");
       
   649     TInt ret( KErrNone );
       
   650     // Bearers (optional)
       
   651 	CTlv bearerList;
       
   652 	TInt returnValue = aBerTlv.TlvByTagValue( &bearerList, KTlvBearerTag );
       
   653 	    
       
   654 	if ( KErrNotFound != returnValue )
       
   655 		{
       
   656 		if ( RSat::KBearerListMaxSize >= bearerList.GetLength() )
       
   657 			{
       
   658 			TBuf8<RSat::KBearerListMaxSize> brList = bearerList.GetData( 
       
   659 			    ETLV_ListOfBearers );
       
   660 			    
       
   661 			// SMS or USSD are not available bearers.
       
   662 			TInt i( 0 );
       
   663 			for ( i = 0; i < brList.Length() ; i++)
       
   664 				{
       
   665 				if ( KCsdBearer  == brList[i] || KGprsBearer == brList[i] )
       
   666 					{
       
   667 					aLaunchBrowserV2.iBearerList.Append( brList[i] );
       
   668 					}
       
   669 				}
       
   670 				
       
   671 			if ( 0x00 == aLaunchBrowserV2.iBearerList.Length() )
       
   672 				{
       
   673 				TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::ParseBearerList,\
       
   674 				    Bearer unvailable");
       
   675 				CreateTerminalRespL( aPCmdNumber, RSat::KLaunchBrowserError, 
       
   676 				    RSat::KBearerUnvailable );
       
   677 				ret = KErrCorrupt;
       
   678 				}       
       
   679 			}
       
   680 		else
       
   681 			{
       
   682 			TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::ParseBearerList,\
       
   683 			    Bearer List length exceeded");
       
   684 			CreateTerminalRespL( aPCmdNumber, RSat::KCmdDataNotUnderstood, 
       
   685 			    RSat::KCmdDataNotUnderstood );
       
   686 			ret = KErrCorrupt;
       
   687 			}
       
   688 		}
       
   689 	return ret;
       
   690     }
       
   691     
       
   692 // -----------------------------------------------------------------------------
       
   693 // CSatNotifyLaunchBrowser::CreateTerminalRespL
       
   694 // Constructs LaunchBrowser specific part of terminal response and calls 
       
   695 // DOS to send the actual message.
       
   696 // -----------------------------------------------------------------------------
       
   697 //
       
   698 TInt CSatNotifyLaunchBrowser::CreateTerminalRespL
       
   699         ( 
       
   700         TUint8 aPCmdNumber,         
       
   701         TUint8 aGeneralResult,      
       
   702         TUint8 aAdditionalInfo		
       
   703 		)
       
   704     {
       
   705 	TFLOGSTRING("CSAT: CSatNotifyLaunchBrowser::CreateTerminalRespL");
       
   706     TTlv tlvSpecificData;
       
   707     tlvSpecificData.AddTag( KTlvResultTag );
       
   708     // Create General Result TLV here
       
   709     tlvSpecificData.AddByte( aGeneralResult );
       
   710     
       
   711     if ( !( iNotificationsTsy->CommandPerformedSuccessfully( aGeneralResult ) ) )
       
   712         {
       
   713         if ( RSat::KCmdTypeNotUnderstood != aGeneralResult && 
       
   714              RSat::KCmdDataNotUnderstood != aGeneralResult && 
       
   715              RSat::KErrorRequiredValuesMissing != aGeneralResult )
       
   716             {
       
   717             // additional info
       
   718             tlvSpecificData.AddByte( aAdditionalInfo );
       
   719 			}
       
   720         }
       
   721 
       
   722     // Prepare data
       
   723     iNotificationsTsy->iTerminalRespData.iPCmdNumber = aPCmdNumber;
       
   724     TPtrC8 data = tlvSpecificData.GetDataWithoutTopLevelTag();
       
   725     // Pack data
       
   726     CSatDataPackage dataPackage;
       
   727 	dataPackage.PackData( &iNotificationsTsy->iTerminalRespData, &data );
       
   728     // Forward request to the DOS
       
   729     return iNotificationsTsy->iSatTsy->MessageManager()->HandleRequestL( 
       
   730 		ESatTerminalRsp, &dataPackage );
       
   731     }
       
   732    		
       
   733 
       
   734 // End of File