telephonyserverplugins/simatktsy/src/CSatNotifySetUpMenu.cpp
changeset 0 3553901f7fa8
child 19 630d2f34d719
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        : CSatNotifySetUpMenu.cpp
       
    15 // Part of     : Common SIM ATK TSY / commonsimatktsy
       
    16 // SetUpMenu 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 "CSatNotifySetUpMenu.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 // CSatNotifySetUpMenu::NewL
       
    37 // Two-phased constructor.
       
    38 // -----------------------------------------------------------------------------
       
    39 //  
       
    40 CSatNotifySetUpMenu* CSatNotifySetUpMenu::NewL
       
    41         ( 
       
    42         CSatNotificationsTsy* aNotificationsTsy 
       
    43         )
       
    44     {
       
    45     TFLOGSTRING("CSAT: CSatNotifySetUpMenu::NewL");
       
    46    	CSatNotifySetUpMenu* const satNotifySetUpMenu = 
       
    47         new ( ELeave ) CSatNotifySetUpMenu( aNotificationsTsy );
       
    48     CleanupStack::PushL( satNotifySetUpMenu );
       
    49     satNotifySetUpMenu->ConstructL();
       
    50     CleanupStack::Pop( satNotifySetUpMenu );
       
    51     TFLOGSTRING("CSAT: CSatNotifySetUpMenu::NewL");
       
    52     return satNotifySetUpMenu;
       
    53     }
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // CSatNotifySetUpMenu::~CSatNotifySetUpMenu
       
    57 // Destructor
       
    58 // -----------------------------------------------------------------------------
       
    59 //  
       
    60 CSatNotifySetUpMenu::~CSatNotifySetUpMenu
       
    61         ( 
       
    62 		// None
       
    63         )
       
    64     {
       
    65     TFLOGSTRING("CSAT: CSatNotifySetUpMenu::~CSatNotifySetUpMenu");
       
    66     }
       
    67     
       
    68 // -----------------------------------------------------------------------------
       
    69 // CSatNotifySetUpMenu::CSatNotifySetUpMenu
       
    70 // Default C++ constructor
       
    71 // -----------------------------------------------------------------------------
       
    72 //  
       
    73 CSatNotifySetUpMenu::CSatNotifySetUpMenu
       
    74         ( 
       
    75         CSatNotificationsTsy* aNotificationsTsy 
       
    76         ) : iNotificationsTsy ( aNotificationsTsy )
       
    77     {
       
    78     // None
       
    79     }
       
    80 
       
    81 // -----------------------------------------------------------------------------
       
    82 // CSatNotifySetUpMenu::ConstructL
       
    83 // Symbian 2nd phase constructor
       
    84 // -----------------------------------------------------------------------------
       
    85 //  
       
    86 void CSatNotifySetUpMenu::ConstructL
       
    87         (
       
    88         // None
       
    89         )
       
    90     {
       
    91     TFLOGSTRING("CSAT: CSatNotifySetUpMenu::ConstructL");
       
    92     iItemsNextIndicatorRemoved = EFalse;
       
    93     }
       
    94 
       
    95 // -----------------------------------------------------------------------------
       
    96 // CSatNotifySetUpMenu::Notify
       
    97 // This request allows a client to be notified of a SET UP MENU proactive 
       
    98 // command
       
    99 // -----------------------------------------------------------------------------
       
   100 //
       
   101 TInt CSatNotifySetUpMenu::Notify
       
   102         (
       
   103         const TTsyReqHandle aTsyReqHandle,
       
   104         const TDataPackage& aPackage    
       
   105         )
       
   106     {
       
   107     TFLOGSTRING("CSAT: CSatNotifySetUpMenu::Notify");
       
   108     // Save data pointer to client side for completion
       
   109     iSetUpMenuV2Pckg = reinterpret_cast<RSat::TSetUpMenuV2Pckg*>( 
       
   110         aPackage.Des1n() );
       
   111     // Save the request handle
       
   112     iNotificationsTsy->iSatTsy->SaveReqHandle( aTsyReqHandle, 
       
   113 		CSatTsy::ESatNotifySetUpMenuPCmdReqType );
       
   114     // Check if requested notification is already pending
       
   115     iNotificationsTsy->NotifySatReadyForNotification( KSetUpMenu );   
       
   116     return KErrNone;
       
   117     }
       
   118 
       
   119 
       
   120 // -----------------------------------------------------------------------------
       
   121 // CSatNotifySetUpMenu::CancelNotification
       
   122 // This method cancels an outstanding asynchronous 
       
   123 // NotifySetUpMenu request.
       
   124 // -----------------------------------------------------------------------------
       
   125 //
       
   126 TInt CSatNotifySetUpMenu::CancelNotification
       
   127         (
       
   128         const TTsyReqHandle aTsyReqHandle		
       
   129         )
       
   130     {
       
   131     TFLOGSTRING("CSAT: CSatNotifySetUpMenu::CancelNotification");
       
   132     // Reset the request handle
       
   133     TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore->
       
   134         ResetTsyReqHandle( CSatTsy::ESatNotifySetUpMenuPCmdReqType );
       
   135 	// Reset the data pointer
       
   136 	iSetUpMenuV2Pckg = NULL;
       
   137 	// Complete the request with KErrCancel
       
   138 	iNotificationsTsy->iSatTsy->ReqCompleted( aTsyReqHandle, KErrCancel );
       
   139     return KErrNone;    
       
   140     }
       
   141 
       
   142 // -----------------------------------------------------------------------------
       
   143 // CSatNotifySetUpMenu::CompleteNotifyL
       
   144 // Complete Set Up Menu notification to the client
       
   145 // -----------------------------------------------------------------------------
       
   146 // 
       
   147 TInt CSatNotifySetUpMenu::CompleteNotifyL
       
   148 		(
       
   149         CSatDataPackage* aDataPackage,   
       
   150         TInt aErrorCode                  
       
   151         )
       
   152     {
       
   153     TFLOGSTRING("CSAT: CSatNotifySetUpMenu::CompleteNotifyL");
       
   154     TInt ret( KErrNone );
       
   155 	TInt returnValue( KErrNone );
       
   156 	// Unpack parameters
       
   157     TPtrC8* data;
       
   158     aDataPackage->UnPackData( &data );
       
   159 
       
   160 	// Reset req handle. Returns the deleted req handle
       
   161     TTsyReqHandle reqHandle = 
       
   162         iNotificationsTsy->iSatReqHandleStore->ResetTsyReqHandle(
       
   163 		CSatTsy::ESatNotifySetUpMenuPCmdReqType );
       
   164 		
       
   165 	TFLOGSTRING2("CSAT: CSatNotifySetUpMenu::CompleteNotifyL reqHandle is :%d", 
       
   166         reqHandle );
       
   167 					
       
   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( 
       
   176         commandDetails.Data() );
       
   177 	// Get command qualifier
       
   178 	TUint8 cmdQualifier( commandDetails.GetShortInfo(
       
   179 		ETLV_CommandQualifier ) );
       
   180 		
       
   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 			RSat::TSetUpMenuV2 menu;
       
   190 
       
   191 			// Store transaction id
       
   192 			menu.SetPCmdNumber( pCmdNumber );
       
   193     
       
   194 			// Selection preference
       
   195 			menu.iPreference = RSat::ESelectionPreferenceNotSet;
       
   196 			if ( cmdQualifier & KSelectionUsingSoftKey )
       
   197 				{
       
   198 				menu.iPreference = RSat::ESoftKeyPreferred;
       
   199 				}
       
   200 			else
       
   201 				{
       
   202 				menu.iPreference = RSat::ENoSelectionPreference;
       
   203 				}
       
   204 
       
   205 			// Alpha Id string (optional)
       
   206 			menu.iAlphaId.iAlphaId.Zero();
       
   207 			// Get alpha identifier tlv
       
   208 			CTlv alphaIdentifier;
       
   209 			returnValue = berTlv.TlvByTagValue( &alphaIdentifier, 
       
   210 			    KTlvAlphaIdentifierTag );
       
   211 
       
   212 			if ( KErrNone != returnValue )
       
   213 				{
       
   214 				CreateTerminalRespL( pCmdNumber,
       
   215 					RSat::KErrorRequiredValuesMissing, KNullDesC16 );
       
   216 
       
   217 				ret = KErrCorrupt;
       
   218 				}
       
   219 			else
       
   220 				{
       
   221     
       
   222 				TUint16 alphaIdLength = alphaIdentifier.GetLength();
       
   223 
       
   224 				TFLOGSTRING2("CSAT: Alpha ID length:%d", alphaIdLength );
       
   225 
       
   226 				if ( RSat::KAlphaIdMaxSize < alphaIdLength )
       
   227 					{
       
   228 					// String too long
       
   229 					ret = KErrCorrupt;
       
   230 					}
       
   231 				else if ( alphaIdLength )
       
   232 					{
       
   233 					TPtrC8 temp;
       
   234 					// Get the alpha id
       
   235 					temp.Set( alphaIdentifier.GetData( ETLV_AlphaIdentifier ) );
       
   236 					// Convert and set the alpha id
       
   237 					TSatUtility::SetAlphaId( temp , menu.iAlphaId.iAlphaId ); 
       
   238 
       
   239 					// Set SAT toolikit name, send SAT SMS logging purpose
       
   240 					iToolKitName.Copy( menu.iAlphaId.iAlphaId );
       
   241 
       
   242 					TFLOGSTRING2("CSAT: CSatNotifySetUpMenu::CompleteNotifyL, \
       
   243                         iToolKitName:%S", &iToolKitName );
       
   244 					}
       
   245 				else
       
   246 					{
       
   247 					TFLOGSTRING("CSAT: CSatNotifySetUpMenu::CompleteNotifyL,\
       
   248         				Wrong length of alpha id.");
       
   249 					}
       
   250 
       
   251 				// Alpha Id status
       
   252 				if ( menu.iAlphaId.iAlphaId.Length() )
       
   253 					{
       
   254 					menu.iAlphaId.iStatus = RSat::EAlphaIdProvided;
       
   255 					}
       
   256 				else
       
   257 					{
       
   258 					TFLOGSTRING("CSAT: CSatNotifySetUpMenu::CompleteNotifyL,\
       
   259 					    Alpha ID is NULL");
       
   260 					menu.iAlphaId.iStatus = RSat::EAlphaIdNull;
       
   261 					}
       
   262 
       
   263 				// Help information.
       
   264 				if ( commandDetails.GetShortInfo( ETLV_CommandQualifier ) 
       
   265 					& KHelpAvailabilityMask )
       
   266 					{
       
   267 					// Help information available
       
   268 					menu.iHelp = RSat::EHelpAvailable;
       
   269 					}
       
   270 				else
       
   271 					{
       
   272 					TFLOGSTRING("CSAT: CSatNotifySetUpMenu::CompleteNotifyL,\
       
   273 					    No Help available");
       
   274 					// No help
       
   275 					menu.iHelp = RSat::ENoHelpAvailable;
       
   276 					}
       
   277 
       
   278 				// Icon identifier
       
   279 				TSatUtility::FillIconStructure( berTlv, menu.iIconId );      
       
   280 				}
       
   281 
       
   282             // Item Icon identifier list
       
   283             CTlv itemsIconIdentifierList;
       
   284             TInt retValue = berTlv.TlvByTagValue( &itemsIconIdentifierList, 
       
   285                 KTlvItemIconIdentifierListTag );
       
   286 
       
   287             TPtrC8 iconIdList;
       
   288 
       
   289             menu.iIconListQualifier = RSat::EIconQualifierNotSet;
       
   290 
       
   291             if ( KErrNone == retValue )
       
   292                 {
       
   293                 TUint8 iIconListQualifier( itemsIconIdentifierList.GetShortInfo( 
       
   294                     ETLV_IconListQualifier ) );
       
   295                 iconIdList.Set( itemsIconIdentifierList.GetData( 
       
   296                     ETLV_IconIdentifierList ));
       
   297 
       
   298                 if( iIconListQualifier )
       
   299                     {
       
   300                     menu.iIconListQualifier = RSat::ENotSelfExplanatory;
       
   301                     }
       
   302                 else
       
   303                     {
       
   304                     menu.iIconListQualifier = RSat::ESelfExplanatory;
       
   305                     }
       
   306 
       
   307                 }
       
   308             else if ( KErrNotFound == retValue )
       
   309                 {
       
   310                 TFLOGSTRING("CSAT: CSatNotifySetUpMenu::CompleteNotifyL,\
       
   311                     No Icon ID");
       
   312                 menu.iIconListQualifier = RSat::ENoIconId;
       
   313                 }
       
   314             else
       
   315             	{
       
   316 	            TFLOGSTRING("CSAT: CSatNotifySetUpMenu::CompleteNotifyL, \
       
   317         			Wrong return value of icon identifier list.");	
       
   318            		}	
       
   319            	
       
   320 	        //Items Data
       
   321 	        TInt itemNbr( 0 );
       
   322 	        CTlv itemsData;
       
   323 	        returnValue = berTlv.TlvByTagValue( 
       
   324 	        	&itemsData, KTlvItemTag, itemNbr );
       
   325 	        TUint8 numberOfItemData( 0 );                          
       
   326 	        TUint16 stringLength( 0 );
       
   327 	        
       
   328 	        if( !returnValue )
       
   329 	            {
       
   330 	            CTlv itemsDataTemp;
       
   331 	        	stringLength = ( itemsData.GetLength());
       
   332 	            TInt ret( KErrNone );
       
   333 	            // Set numberOfItemData                        
       
   334 		        while ( KErrNone == ret )
       
   335 		        	{
       
   336 		        	numberOfItemData++; 
       
   337 		        	ret = berTlv.TlvByTagValue( &itemsDataTemp, KTlvItemTag,
       
   338 		        		numberOfItemData ); 
       
   339 		        	}
       
   340 	            }
       
   341 
       
   342             // Item Next Action Indicator
       
   343             CTlv itemNextActionIndicator;
       
   344             retValue = berTlv.TlvByTagValue( &itemNextActionIndicator, 
       
   345                                              KTlvItemsNextActionIndicatorTag );
       
   346             TPtrC8 itemNextIndicator;
       
   347 
       
   348             if ( KErrNone == retValue )
       
   349                 {
       
   350 	            TPtrC8 itemNextIndicatorTemp;
       
   351 	            itemNextIndicatorTemp.Set( itemNextActionIndicator.GetData( 
       
   352 	            	ETLV_ItemsNextActionIndicator ) );
       
   353 	            
       
   354 	            // In case the number of items in this list does not match the 
       
   355 	            // number of items in the menu the Items Next Action Indicator 
       
   356 	            // list is ignored by ME
       
   357 	            if( itemNextIndicatorTemp.Length() != numberOfItemData )
       
   358 	            	{
       
   359 	            	iItemsNextIndicatorRemoved = ETrue;
       
   360 	            	}
       
   361 	            else
       
   362 	           		{
       
   363 	            	itemNextIndicator.Set( itemNextIndicatorTemp );	
       
   364 	           		}
       
   365 	            }
       
   366 
       
   367             // If first item is NULL -> remove existing menu
       
   368             if ( stringLength != 0 )
       
   369                 {
       
   370                 for ( TUint8 i = 0; ( KErrNone == ret ) 
       
   371                     && ( KErrNone == returnValue ) ; i++ )
       
   372                     {
       
   373                     // Filling up the menu items
       
   374                     RSat::TItem newItem;
       
   375                                      
       
   376                     // Suffle through all the menu items
       
   377                     stringLength = 0;
       
   378 
       
   379                     TFLOGSTRING2("CSAT: CSatNotifySetUpMenu::CompleteNotifyL, \
       
   380                         item number:%d", i );
       
   381                     
       
   382                     // Fill the new item
       
   383                     newItem.iItemId = itemsData.GetShortInfo( 
       
   384                         ETLV_IdentifierOfItem );
       
   385                     stringLength = itemsData.GetLength();
       
   386                     stringLength--;
       
   387 
       
   388                     TPtrC8 itemData = itemsData.GetData( 
       
   389                         ETLV_TextStringOfItem );
       
   390 
       
   391                     // Menu item string, coded as EFadn (3gpp 11.11)
       
   392                     newItem.iItemString.Zero();
       
   393 
       
   394                     if ( ( KUCS2ArabicCoding == itemData[0] )
       
   395                         || ( KUCS2GreekCoding == itemData[0] )
       
   396                         || ( KUCS2TurkishCoding == itemData[0] ) )
       
   397                         {
       
   398                         TSatUtility::ConvertAlphaFieldsToUnicode( itemData, 
       
   399                             newItem.iItemString );
       
   400                         }
       
   401                     else
       
   402                         {
       
   403                         TSatUtility::Convert7BitToUnicode16( itemData,
       
   404                             newItem.iItemString );
       
   405                         }
       
   406             
       
   407                     TFLOGSTRING2("CSAT: CSatNotifySetUpMenu::CompleteNotifyL \
       
   408                         newItem.iItemString:%S", &newItem.iItemString );
       
   409 
       
   410 	                // Adding the new menuitem
       
   411 	                if( NULL != iconIdList.Size()  && ( i < iconIdList.Length() ) )
       
   412 	                    {
       
   413 	                    TFLOGSTRING("CSAT: CSatNotifySetUpMenu::CompleteNotifyL \
       
   414 	                            Icons on the list" );
       
   415 	                    if( ( NULL != itemNextIndicator.Size() ) 
       
   416 	                        && ( i < itemNextIndicator.Length() ) )
       
   417 	                        {
       
   418 	                        // Menu item with item next idicator and icon identifier
       
   419 	                        if ( KErrNoMemory == menu.AddItem( newItem, 
       
   420 	                             itemNextIndicator[i], iconIdList[i] ) )
       
   421 	                            {
       
   422 	                            TFLOGSTRING("CSAT: CSatNotifySetUpMenu::\
       
   423 	                                CompleteNotifyL, Menu item length exceeded");
       
   424 	                            // Too many or long menu items
       
   425 	                            ret = KErrCorrupt;
       
   426 	                            }
       
   427 	                        }
       
   428 	                    // Menu item with icon identifier
       
   429 	                    else if ( KErrNoMemory == menu.AddItemIcon( newItem, 
       
   430 	                        iconIdList[i] ) )
       
   431 	                        {
       
   432 	                        TFLOGSTRING("CSAT: CSatNotifySetUpMenu::\
       
   433 	                            CompleteNotifyL, Menu item length exceeded");
       
   434 	                        // Too many or long menu items
       
   435 	                        ret = KErrCorrupt;
       
   436 	                        }
       
   437 	                    }
       
   438 	                // No icon on the list    
       
   439 	                else 
       
   440 	                    {
       
   441 	                    if( ( NULL != itemNextIndicator.Size() ) 
       
   442 	                        && ( i < itemNextIndicator.Length() ) )
       
   443 	                        {
       
   444 	                        // Menu item with item next indicator
       
   445 	                        if ( KErrNoMemory == menu.AddItem( newItem, 
       
   446 	                            itemNextIndicator[i] ) )
       
   447 	                            {
       
   448 	                            TFLOGSTRING("CSAT: CSatNotifySetUpMenu::\
       
   449 	                                CompleteNotifyL, Menu item length exceeded");
       
   450 	                            // Too many or long menu items
       
   451 	                            ret = KErrCorrupt;
       
   452 	                            }
       
   453 	                        }
       
   454 	                    // Menu item
       
   455 	                    else 
       
   456 	                        {
       
   457 	                        TInt retAdd = menu.AddItem( newItem );
       
   458 	                        if ( KErrNoMemory == retAdd )
       
   459 	                            {
       
   460 	                            TFLOGSTRING("CSAT: CSatNotifySetUpMenu::\
       
   461 	                                CompleteNotifyL, Menu item length exceeded");
       
   462 	                            // Too many or long menu items
       
   463 	                            // If there is not enough space left in the buffer used 
       
   464 	                            // by the menu KErrNoMemory is returned.
       
   465 	                            ret = KErrCorrupt;
       
   466 	                            // Send terminal response
       
   467 	                            CreateTerminalRespL( pCmdNumber,
       
   468 	                                    RSat::KCmdDataNotUnderstood, 
       
   469 	                                    KNullDesC16 );
       
   470 	                            }
       
   471 	                        }
       
   472 	                    }
       
   473 
       
   474                     itemNbr++;
       
   475                     returnValue = berTlv.TlvByTagValue( &itemsData, 
       
   476                         KTlvItemTag, itemNbr );
       
   477                     } // End of for
       
   478                 }
       
   479 
       
   480             // Set the data for the client
       
   481             RSat::TSetUpMenuV2& setUpMenuV2 = ( *iSetUpMenuV2Pckg )();
       
   482             setUpMenuV2 = menu;
       
   483 			} // End of if (KErrNone == aErrorCode)
       
   484         else
       
   485         	{
       
   486         	ret = aErrorCode;
       
   487         	}
       
   488         
       
   489 		// Complete to the client side
       
   490 		TFLOGSTRING2("CSAT: Completing CSatNotifySetUpMenu: error %d",
       
   491 			aErrorCode );
       
   492 		iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret );
       
   493 		} 
       
   494     else 
       
   495         {
       
   496         TFLOGSTRING("CSAT: CSatNotifySetUpMenu::CompleteNotifyL, \
       
   497             Request not ongoing");
       
   498 		TBuf16<1>additionalInfo;
       
   499         additionalInfo.Append ( RSat::KNoSpecificMeProblem );
       
   500 		CreateTerminalRespL( pCmdNumber,                         
       
   501 			RSat::KMeUnableToProcessCmd, additionalInfo );		
       
   502         }
       
   503 	
       
   504     return ret;
       
   505 	}
       
   506 // -----------------------------------------------------------------------------
       
   507 // CSatNotifySetUpMenu::TerminalResponseL
       
   508 // Called by ETel server, passes terminal response to DOS
       
   509 // -----------------------------------------------------------------------------
       
   510 //
       
   511 TInt CSatNotifySetUpMenu::TerminalResponseL
       
   512         ( 
       
   513         TDes8* aRsp
       
   514         )
       
   515     {
       
   516     TFLOGSTRING("CSAT: CSatNotifySetUpMenu::TerminalResponseL");
       
   517 
       
   518     TInt ret( KErrNone );
       
   519     TBuf16<1> additionalInfo;
       
   520     RSat::TSetUpMenuRspV1Pckg* aRspPckg = 
       
   521             reinterpret_cast<RSat::TSetUpMenuRspV1Pckg*> ( aRsp );
       
   522     RSat::TSetUpMenuRspV1& rspV1 = ( *aRspPckg ) ();
       
   523     TUint8 pCmdNumber( rspV1.PCmdNumber() );
       
   524 
       
   525     // Check that general result value is valid
       
   526     if ( ( RSat::KSuccess != rspV1.iGeneralResult ) 
       
   527         && ( RSat::KMeUnableToProcessCmd != rspV1.iGeneralResult )
       
   528         && ( RSat::KCmdBeyondMeCapabilities != rspV1.iGeneralResult ) 
       
   529         && ( RSat::KCmdDataNotUnderstood != rspV1.iGeneralResult )
       
   530         && ( RSat::KErrorRequiredValuesMissing != rspV1.iGeneralResult)
       
   531         && ( RSat::KSuccessRequestedIconNotDisplayed != 
       
   532         	rspV1.iGeneralResult ) )
       
   533         {
       
   534         // Invalid general result
       
   535         ret = KErrCorrupt;
       
   536         }
       
   537 
       
   538     // If there is Me (Mobile Entity) error, additional info is needed
       
   539     if ( RSat::KMeProblem == rspV1.iInfoType )
       
   540         {
       
   541         // Check the length of additional info
       
   542         if ( rspV1.iAdditionalInfo.Length() != 0 )
       
   543             {
       
   544             additionalInfo.Append( rspV1.iAdditionalInfo[0] );
       
   545 			}
       
   546         else
       
   547             {
       
   548             // Invalid additional info field
       
   549             ret = KErrCorrupt;
       
   550             }
       
   551         }
       
   552         
       
   553     if( RSat::KSuccess == rspV1.iGeneralResult && iItemsNextIndicatorRemoved )
       
   554 		{
       
   555 		TFLOGSTRING("CSatNotifySetUpMenu::TerminalResponseL, \
       
   556 			iItemsNextIndicatorRemoved");
       
   557 		rspV1.iGeneralResult = RSat::KPartialComprehension;
       
   558 		}
       
   559 		
       
   560     iItemsNextIndicatorRemoved = EFalse;
       
   561 
       
   562 	CreateTerminalRespL( pCmdNumber, static_cast<TUint8>( 
       
   563 		rspV1.iGeneralResult ), additionalInfo );                            
       
   564                          
       
   565     return ret;
       
   566     }
       
   567 
       
   568 // ------------------------------------------------------------------
       
   569 // CSatNotifySetUpMenu::CreateTerminalRespL
       
   570 // Constructs SetUpMenu specific part of terminal response and calls 
       
   571 // DOS to send the actual message.
       
   572 // ------------------------------------------------------------------
       
   573 //
       
   574 TInt CSatNotifySetUpMenu::CreateTerminalRespL
       
   575         ( 
       
   576         TUint8 aPCmdNumber,         
       
   577         TUint8 aGeneralResult,     
       
   578         const TDesC16& aAdditionalInfo		
       
   579 		)
       
   580 	{
       
   581 	TFLOGSTRING("CSAT: CSatNotifySetUpMenu::CreateTerminalRespL");	
       
   582     // Create and append response data
       
   583     TTlv tlvSpecificData;
       
   584     // Create General Result TLV here
       
   585     tlvSpecificData.AddTag( KTlvResultTag );
       
   586     // General result
       
   587     tlvSpecificData.AddByte( aGeneralResult ); 
       
   588 	
       
   589 	if ( RSat::KMeUnableToProcessCmd == aGeneralResult )
       
   590         {
       
   591         if ( aAdditionalInfo.Length() > 0 )
       
   592         	{
       
   593         	tlvSpecificData.AddByte( static_cast<TUint8>( aAdditionalInfo[0] ) );
       
   594         	}
       
   595 		}
       
   596 
       
   597     // Prepare data
       
   598     iNotificationsTsy->iTerminalRespData.iPCmdNumber = aPCmdNumber;
       
   599     TPtrC8 data = tlvSpecificData.GetDataWithoutTopLevelTag();
       
   600 	// Pack data
       
   601     CSatDataPackage dataPackage;
       
   602 	dataPackage.PackData( &iNotificationsTsy->iTerminalRespData, &data );
       
   603     // Forward request to the DOS
       
   604     return iNotificationsTsy->iSatTsy->MessageManager()->HandleRequestL( 
       
   605 		ESatTerminalRsp, &dataPackage );
       
   606     }
       
   607     
       
   608 // End of file
       
   609