telephonyserverplugins/simatktsy/src/csatnotificationstsy.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        : CSatNotificationsTsy.cpp
       
    15 // Part of     : Common SIM ATK TSY / commonsimatktsy
       
    16 // Notifications-related functionality of Sat Tsy
       
    17 // Version     : 1.0
       
    18 //
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 //INCLUDES
       
    24 #include <satcs.h>                  // Etel SAT IPC definitions
       
    25 #include "CSatDataPackage.h"        // Parameter packing 
       
    26 #include "CSatTsy.h"                // Sat Tsy class
       
    27 #include "CSatCCTsy.h"              // Sat Call Contol Tsy class
       
    28 #include "cmmmessagemanagerbase.h"  // Message manager class for forwarding req
       
    29 #include "CSatNotificationsTsy.h"   // Class header
       
    30 #include "CSatNotifyDisplayText.h"  // Display text specific notify class
       
    31 #include "CSatNotifyGetInkey.h"     // Get inkey specific notify class
       
    32 #include "CSatNotifySimSessionEnd.h"// Sim session end specific notify class
       
    33 #include "CSatNotifyGetInput.h"		// Get input specific notify class
       
    34 #include "CSatNotifyPlayTone.h"		// Play tone specific notify class
       
    35 #include "CSatNotifySetUpMenu.h"	// Set-up menu specific notify class
       
    36 #include "CSatNotifySelectItem.h"	// Select item specific notify class
       
    37 #include "CSatNotifySendSm.h"		// Send SMS specific notify class
       
    38 #include "CSatNotifySendUssd.h"		// Send USSD specific notify class
       
    39 #include "CSatNotifySendSs.h"		// Send SS specific notify class
       
    40 #include "CSatNotifySetUpIdleModeText.h"// Set up idle mode notify class
       
    41 #include "CSatNotifyLaunchBrowser.h"// Launch browser specific notify class
       
    42 #include "CSatNotifyCallControlRequest.h"// Call control notify class
       
    43 #include "CSatNotifySetUpCall.h"    // Set up call specific notify class
       
    44 #include "CSatNotifySetUpEventList.h"    // Set up event list notify class
       
    45 #include "CSatNotifyTimerMgmt.h"    // Timer management specific notify class
       
    46 #include "CSatNotifyLanguageNotification.h"// Language notification notify class
       
    47 #include "CSatNotifySendDtmf.h"     // Send Dtmf notification  notify class
       
    48 #include "CSatNotifyRefresh.h"      // Refresh notification  notify class
       
    49 #include "CSatNotifyPollingOff.h"   // Polling off notification  notify class
       
    50 #include "CSatNotifyPollInterval.h" // Poll interval notification  notify class
       
    51 #include "CSatNotifyLocalInfo.h"    // Local info notification  notify class
       
    52 #include "CSatNotifyRefresh.h"      // Refresh notification  notify class
       
    53 #include "CSatNotifyOpenChannel.h"	// Open channel notification  notify class
       
    54 #include "CSatNotifyGetChannelStatus.h"// Get channel status notify notify class
       
    55 #include "CSatNotifyMoSmControlRequest.h"// MO SM Control notify class      
       
    56 #include "CSatNotifyCloseChannel.h"	// Close channel notification  notify class
       
    57 #include "CSatNotifySendData.h"		// Send Data notification  notify class
       
    58 #include "CSatNotifyReceiveData.h"  // Receive data notification  notify class
       
    59 #include "CSatNotifyMoreTime.h"		// More time notification  notify class
       
    60 #include "CSatTsyReqHandleStore.h"  // Request handle class
       
    61 #include "TfLogger.h"               // For TFLOGSTRING
       
    62 #include "CBerTlv.h"                // Ber Tlv
       
    63 #include "TTlv.h"					// TTlv class
       
    64 #include "msattsy_ipcdefs.h"		// Sat Tsy specific request types
       
    65 #include "TSatUtility.h"            // Utilities
       
    66 
       
    67 
       
    68 // -----------------------------------------------------------------------------
       
    69 // CSatNotificationsTsy::NewL
       
    70 // Two-phased constructor.
       
    71 // -----------------------------------------------------------------------------
       
    72 //
       
    73 CSatNotificationsTsy* CSatNotificationsTsy::NewL
       
    74         (    
       
    75         CSatTsy* aSatTsy,
       
    76 		CSatTsyReqHandleStore* aSatReqHandleStore
       
    77         )
       
    78     {
       
    79     TFLOGSTRING("CSAT: CSatNotificationsTsy::NewL");
       
    80     CSatNotificationsTsy* const satNotificationsTsy = 
       
    81         new ( ELeave ) CSatNotificationsTsy( aSatTsy, aSatReqHandleStore );
       
    82 
       
    83     CleanupStack::PushL( satNotificationsTsy );
       
    84     satNotificationsTsy->ConstructL();
       
    85     CleanupStack::Pop();
       
    86     
       
    87 	TFLOGSTRING("CSAT: CSatNotificationsTsy::NewL, end of method");
       
    88     return satNotificationsTsy;
       
    89     }
       
    90 
       
    91 // -----------------------------------------------------------------------------
       
    92 // CSatNotificationsTsy::~CSatNotificationsTsy
       
    93 // Destructor
       
    94 // -----------------------------------------------------------------------------
       
    95 //    
       
    96 CSatNotificationsTsy::~CSatNotificationsTsy
       
    97         (    
       
    98         void   
       
    99         )
       
   100     {
       
   101     TFLOGSTRING("CSAT: CSatNotificationsTsy::~CSatNotificationsTsy");
       
   102     
       
   103     delete iSatTimer;
       
   104 
       
   105     // Specific notification objects
       
   106     delete iNotifyDisplayText;
       
   107     delete iNotifyGetInkey;
       
   108 	delete iNotifyGetInput;
       
   109     delete iNotifyPlayTone;
       
   110 	delete iNotifySetUpMenu;
       
   111     delete iNotifySelectItem;
       
   112 	delete iNotifySendSm;
       
   113 	delete iNotifySendSs;
       
   114 	delete iNotifySendUssd;
       
   115 	delete iNotifySetUpIdleModeText;
       
   116     delete iNotifyLaunchBrowser; 
       
   117     delete iNotifyCallControlRequest; 
       
   118     delete iNotifySimSessionEnd;
       
   119     delete iNotifySetUpCall;
       
   120     delete iNotifySetUpEventList;
       
   121     delete iNotifySendDtmf;
       
   122     delete iNotifyPollingOff;
       
   123     delete iNotifyPollInterval;
       
   124     delete iNotifyLanguageNotification;
       
   125     delete iNotifyLocalInfo;
       
   126     delete iNotifyTimerMgmt;
       
   127     delete iNotifyRefresh;
       
   128 	delete iNotifyOpenChannel;
       
   129 	delete iNotifyGetChannelStatus;
       
   130     delete iNotifyMoSmControlRequest;
       
   131 	delete iNotifyCloseChannel;
       
   132 	delete iNotifySendData;
       
   133 	delete iNotifyReceiveData;
       
   134 	delete iNotifyMoreTime;
       
   135 
       
   136     // Unregister.
       
   137     iSatTsy->MessageManager()->RegisterTsyObject(
       
   138 		CMmMessageManagerBase::ESatNotificationsTsyObjType, NULL );
       
   139 	TFLOGSTRING("CSAT: CSatNotificationsTsy::~CSatNotificationsTsy, \
       
   140 		end of method");
       
   141     }
       
   142     
       
   143 // -----------------------------------------------------------------------------
       
   144 // CSatNotificationsTsy::CSatNotificationsTsy
       
   145 // C++ constructor
       
   146 // -----------------------------------------------------------------------------
       
   147 //
       
   148 CSatNotificationsTsy::CSatNotificationsTsy
       
   149         (    
       
   150         CSatTsy* aSatTsy,
       
   151 		CSatTsyReqHandleStore* aSatReqHandleStore
       
   152         ): iSatTsy( aSatTsy ), iSatReqHandleStore( aSatReqHandleStore )
       
   153 
       
   154     {
       
   155     // None
       
   156     }
       
   157 
       
   158 // -----------------------------------------------------------------------------
       
   159 // CSatNotificationsTsy::ConstructL
       
   160 // Symbian 2nd phase constructor. Initialises internal attributes.
       
   161 // -----------------------------------------------------------------------------
       
   162 //
       
   163 void CSatNotificationsTsy::ConstructL
       
   164         (    
       
   165         void
       
   166         )
       
   167     {
       
   168     TFLOGSTRING("CSAT: CSatNotificationsTsy::ConstructL\n" );
       
   169 
       
   170     // Register
       
   171     iSatTsy->MessageManager()->RegisterTsyObject(
       
   172 		CMmMessageManagerBase::ESatNotificationsTsyObjType, this );
       
   173 
       
   174     // Initialize SAT Notifications objects
       
   175     iNotifyDisplayText = CSatNotifyDisplayText::NewL( this );
       
   176 	iSatTsy->MessageManager()->RegisterTsyObject(
       
   177 		CMmMessageManagerBase::ESatNotifyDisplayTextObjType, iNotifyDisplayText );
       
   178     
       
   179 	iNotifyGetInkey = CSatNotifyGetInkey::NewL( this );
       
   180     iSatTsy->MessageManager()->RegisterTsyObject(
       
   181 		CMmMessageManagerBase::ESatNotifyGetInkeyObjType, iNotifyGetInkey );
       
   182 	
       
   183 	iNotifyGetInput = CSatNotifyGetInput::NewL( this );
       
   184     iSatTsy->MessageManager()->RegisterTsyObject(
       
   185 		CMmMessageManagerBase::ESatNotifyGetInputObjType, iNotifyGetInput );
       
   186 	
       
   187 	iNotifyPlayTone = CSatNotifyPlayTone::NewL( this );
       
   188     iSatTsy->MessageManager()->RegisterTsyObject(
       
   189 		CMmMessageManagerBase::ESatNotifyPlayToneObjType, iNotifyPlayTone );
       
   190 
       
   191 	iNotifySetUpMenu = CSatNotifySetUpMenu::NewL( this );
       
   192     iSatTsy->MessageManager()->RegisterTsyObject(
       
   193 		CMmMessageManagerBase::ESatNotifySetUpMenuObjType, iNotifySetUpMenu );
       
   194 
       
   195 	iNotifySelectItem = CSatNotifySelectItem::NewL( this );
       
   196     iSatTsy->MessageManager()->RegisterTsyObject(
       
   197 		CMmMessageManagerBase::ESatNotifySelectItemObjType, iNotifySelectItem );
       
   198 
       
   199 	iNotifySendSm = CSatNotifySendSm::NewL( this );
       
   200     iSatTsy->MessageManager()->RegisterTsyObject(
       
   201 		CMmMessageManagerBase::ESatNotifySendSmsObjType, iNotifySendSm );
       
   202 
       
   203 	iNotifySendSs = CSatNotifySendSs::NewL( this );
       
   204     iSatTsy->MessageManager()->RegisterTsyObject(
       
   205 		CMmMessageManagerBase::ESatNotifySendSsObjType, iNotifySendSs );
       
   206 
       
   207 	iNotifySendUssd = CSatNotifySendUssd::NewL( this );
       
   208     iSatTsy->MessageManager()->RegisterTsyObject(
       
   209 		CMmMessageManagerBase::ESatNotifySendUssdObjType, iNotifySendUssd );
       
   210 
       
   211 	iNotifySetUpIdleModeText = CSatNotifySetUpIdleModeText::NewL( this );
       
   212 	iSatTsy->MessageManager()->RegisterTsyObject(
       
   213 		CMmMessageManagerBase::ESatNotifySetUpIdleModeTextObjType, 
       
   214 		iNotifySetUpIdleModeText );
       
   215 
       
   216 	iNotifyLaunchBrowser = CSatNotifyLaunchBrowser::NewL( this );
       
   217 	iSatTsy->MessageManager()->RegisterTsyObject(
       
   218 		CMmMessageManagerBase::ESatNotifyLaunchBrowserObjType, 
       
   219 		iNotifyLaunchBrowser );
       
   220 
       
   221 	iNotifyCallControlRequest = CSatNotifyCallControlRequest::NewL( this );
       
   222 	iSatTsy->MessageManager()->RegisterTsyObject(
       
   223 		CMmMessageManagerBase::ESatNotifyCallControlRequestObjType, 
       
   224 		iNotifyCallControlRequest );
       
   225 
       
   226 	iNotifySimSessionEnd = CSatNotifySimSessionEnd::NewL( this );
       
   227     iSatTsy->MessageManager()->RegisterTsyObject(
       
   228 		CMmMessageManagerBase::ESatNotifySimSessionEndObjType, 
       
   229 		iNotifySimSessionEnd );
       
   230 
       
   231     iNotifySetUpCall = CSatNotifySetUpCall::NewL( this );
       
   232     iSatTsy->MessageManager()->RegisterTsyObject(
       
   233 		CMmMessageManagerBase::ESatNotifySetUpCallObjType, iNotifySetUpCall );
       
   234 
       
   235     iNotifyRefresh = CSatNotifyRefresh::NewL( this );
       
   236     iSatTsy->MessageManager()->RegisterTsyObject(
       
   237 		CMmMessageManagerBase::ESatNotifyRefreshObjType, iNotifyRefresh );
       
   238 
       
   239     iNotifyPollInterval = CSatNotifyPollInterval::NewL( this );
       
   240     iSatTsy->MessageManager()->RegisterTsyObject(
       
   241 		CMmMessageManagerBase::ESatNotifyPollIntervalObjType, 
       
   242 		iNotifyPollInterval );
       
   243 
       
   244     iNotifySendDtmf = CSatNotifySendDtmf::NewL( this );
       
   245     iSatTsy->MessageManager()->RegisterTsyObject(
       
   246 		CMmMessageManagerBase::ESatNotifySendDtmfObjType, iNotifySendDtmf );
       
   247 
       
   248     iNotifySetUpEventList = CSatNotifySetUpEventList::NewL( this );
       
   249     iSatTsy->MessageManager()->RegisterTsyObject(
       
   250 		CMmMessageManagerBase::ESatNotifySetUpEventListObjType, 
       
   251 		iNotifySetUpEventList );
       
   252 
       
   253     iNotifyPollingOff = CSatNotifyPollingOff::NewL( this );
       
   254     iSatTsy->MessageManager()->RegisterTsyObject(
       
   255 		CMmMessageManagerBase::ESatNotifyPollingOffObjType, iNotifyPollingOff );
       
   256 
       
   257     iNotifyLocalInfo = CSatNotifyLocalInfo::NewL( this );
       
   258     iSatTsy->MessageManager()->RegisterTsyObject(
       
   259 		CMmMessageManagerBase::ESatNotifyLocalInfoObjType, iNotifyLocalInfo );
       
   260 
       
   261     iNotifyTimerMgmt = CSatNotifyTimerMgmt::NewL( this );
       
   262     iSatTsy->MessageManager()->RegisterTsyObject(
       
   263 		CMmMessageManagerBase::ESatNotifyTimerMgmtObjType, iNotifyTimerMgmt );
       
   264 
       
   265     iNotifyLanguageNotification = CSatNotifyLanguageNotification::NewL( this );
       
   266     iSatTsy->MessageManager()->RegisterTsyObject(
       
   267 		CMmMessageManagerBase::ESatNotifyLanguageNotificationObjType, 
       
   268 		iNotifyLanguageNotification );
       
   269 
       
   270 	iNotifyOpenChannel = CSatNotifyOpenChannel::NewL( this );
       
   271     iSatTsy->MessageManager()->RegisterTsyObject(
       
   272 		CMmMessageManagerBase::ESatNotifyOpenChannelObjType, 
       
   273 			iNotifyOpenChannel );	
       
   274     
       
   275     iNotifyMoSmControlRequest = CSatNotifyMoSmControlRequest::NewL( this );
       
   276     iSatTsy->MessageManager()->RegisterTsyObject(
       
   277 		CMmMessageManagerBase::ESatNotifyMoSmControlRequestObjType, 
       
   278 			iNotifyMoSmControlRequest );   
       
   279 	
       
   280 	iNotifyGetChannelStatus = CSatNotifyGetChannelStatus::NewL( this );
       
   281     iSatTsy->MessageManager()->RegisterTsyObject(
       
   282 		CMmMessageManagerBase::ESatNotifyGetChannelStatusObjType, 
       
   283 			iNotifyGetChannelStatus );
       
   284 	
       
   285 	iNotifyCloseChannel = CSatNotifyCloseChannel::NewL( this );
       
   286     iSatTsy->MessageManager()->RegisterTsyObject(
       
   287 		CMmMessageManagerBase::ESatNotifyCloseChannelObjType, 
       
   288 			iNotifyCloseChannel );
       
   289 	
       
   290 	iNotifySendData = CSatNotifySendData::NewL( this );
       
   291     iSatTsy->MessageManager()->RegisterTsyObject(
       
   292 		CMmMessageManagerBase::ESatNotifySendDataObjType, iNotifySendData );
       
   293 	
       
   294 	iNotifyReceiveData = CSatNotifyReceiveData::NewL( this );
       
   295     iSatTsy->MessageManager()->RegisterTsyObject(
       
   296 		CMmMessageManagerBase::ESatNotifyReceiveDataObjType, 
       
   297 			iNotifyReceiveData );					
       
   298     
       
   299     iNotifyMoreTime = CSatNotifyMoreTime::NewL( this );
       
   300    	iSatTsy->MessageManager()->RegisterTsyObject(
       
   301 		CMmMessageManagerBase::ESatNotifyMoreTimeObjType, iNotifyMoreTime );
       
   302 
       
   303     // Initialize timer, this is used for implementing timer management
       
   304     iSatTimer = CSatTimer::NewL( this );
       
   305     		
       
   306     // Initalize flag, this is used to check if proactiveCommand is ongoing
       
   307     iSatTimer->SetProactiveCommandOnGoingStatus( EFalse );
       
   308 
       
   309 	// Set polling status to the use of the default value ( 25 sec. )
       
   310     iPollingOff = ETrue;
       
   311     
       
   312     // No long poll interval requests yet
       
   313     iLongPollIntervalReq = EFalse;
       
   314 
       
   315     // Buffering for Proactive commands that are not notified by SatServer
       
   316     NotifySatReadyForNotification( KPollInterval );
       
   317     NotifySatReadyForNotification( KPollingOff );
       
   318     NotifySatReadyForNotification( KMoreTime );
       
   319     NotifySatReadyForNotification( KTimerManagement );
       
   320 
       
   321     // Request IMEI code. Needed in provide local info proactive command.
       
   322     iSatTsy->MessageManager()->HandleRequestL( ESatTsyGetIMEI );
       
   323     
       
   324     // Checks if MO-SMS control should be activated
       
   325     //unnecassary IPC request as this is already called in CSatNotifyMoSmControlRequest::ConstructL 
       
   326     //iSatTsy->MessageManager()->HandleRequestL( ESatTsyQueryMoSmsControlActivated );
       
   327 	TFLOGSTRING("CSAT: CSatNotificationsTsy::ConstructL, end of method" );
       
   328     }
       
   329 
       
   330 // -----------------------------------------------------------------------------
       
   331 // CSatNotificationsTsy::DoExtFunc
       
   332 // Notifications-specific functionality of CSatTsy::DoExtFuncL
       
   333 // -----------------------------------------------------------------------------
       
   334 //
       
   335 TInt CSatNotificationsTsy::DoExtFuncL
       
   336         ( 
       
   337         const TTsyReqHandle aTsyReqHandle, 
       
   338         const TInt aIpc,                   
       
   339         const TDataPackage& aPackage      
       
   340         )
       
   341     {
       
   342     TFLOGSTRING3("CSAT: CSatNotificationsTsy::DoExtFuncL\t IPC:%d,\t Handle:%d",
       
   343                aIpc, aTsyReqHandle);
       
   344 
       
   345     TInt ret ( KErrNone );
       
   346 
       
   347     TAny* dataPtr = aPackage.Ptr1();
       
   348 
       
   349     switch ( aIpc )
       
   350         {
       
   351 	    case ESatTerminalRsp:
       
   352             {
       
   353 			TerminalResponseL( reinterpret_cast< RSat::TPCmd* >( dataPtr ),
       
   354                  aPackage.Des2n(), aTsyReqHandle );
       
   355 			break;
       
   356             }
       
   357         case ESatNotifyDisplayTextPCmd:
       
   358             {
       
   359             iNotifyDisplayText->Notify( aTsyReqHandle, aPackage );
       
   360             break;                  
       
   361             }
       
   362         case ESatNotifySelectItemPCmd:
       
   363             {
       
   364             iNotifySelectItem->Notify( aTsyReqHandle, aPackage );
       
   365             break;                  
       
   366             }
       
   367         case ESatNotifyGetInkeyPCmd:
       
   368             {
       
   369             iNotifyGetInkey->Notify( aTsyReqHandle, aPackage );
       
   370             break;                  
       
   371             }
       
   372         case ESatNotifyGetInputPCmd:
       
   373             {
       
   374             iNotifyGetInput->Notify( aTsyReqHandle, aPackage );
       
   375             break;                  
       
   376             }
       
   377         case ESatNotifyPlayTonePCmd:
       
   378             {
       
   379             iNotifyPlayTone->Notify( aTsyReqHandle, aPackage );
       
   380             break;                  
       
   381             }
       
   382         case ESatNotifySetUpMenuPCmd:
       
   383             {
       
   384             iNotifySetUpMenu->Notify( aTsyReqHandle, aPackage );
       
   385             break;                
       
   386             }
       
   387         case ESatNotifySendSmPCmd:
       
   388             {
       
   389             iNotifySendSm->Notify( aTsyReqHandle, aPackage );
       
   390             break;                  
       
   391             }
       
   392         case ESatNotifySendSsPCmd:
       
   393             {
       
   394             iNotifySendSs->Notify( aTsyReqHandle, aPackage );
       
   395             break;                  
       
   396             }
       
   397 		case ESatNotifySendUssdPCmd:
       
   398             {
       
   399             iNotifySendUssd->Notify( aTsyReqHandle, aPackage );
       
   400             break;     
       
   401             }
       
   402 		case ESatNotifyProactiveSimSessionEnd:
       
   403             {
       
   404             iNotifySimSessionEnd->Notify( aTsyReqHandle, aPackage );
       
   405             break;
       
   406             }
       
   407         case ESatNotifySetUpIdleModeTextPCmd:
       
   408             {
       
   409             iNotifySetUpIdleModeText->Notify( aTsyReqHandle, aPackage );
       
   410             break;
       
   411             }
       
   412         case ESatNotifyLaunchBrowserPCmd:
       
   413             {
       
   414             iNotifyLaunchBrowser->Notify( aTsyReqHandle, aPackage );
       
   415             break;                  
       
   416             }
       
   417         case ESatNotifyCallControlRequest:
       
   418             {
       
   419             iNotifyCallControlRequest->Notify( aTsyReqHandle, aPackage );
       
   420             break;                  
       
   421             }
       
   422         case ESatNotifySendDtmfPCmd:
       
   423             {
       
   424             iNotifySendDtmf->Notify( aTsyReqHandle, aPackage );
       
   425             break;
       
   426             }
       
   427 		case ESatNotifySetUpEventListPCmd:
       
   428             {
       
   429             iNotifySetUpEventList->Notify( aTsyReqHandle, aPackage );
       
   430             break;
       
   431             }
       
   432         case ESatNotifySetUpCallPCmd:
       
   433             {
       
   434             iNotifySetUpCall->Notify( aTsyReqHandle, aPackage );
       
   435             break;  
       
   436             }
       
   437         case ESatNotifyRefreshPCmd:
       
   438             {
       
   439             iNotifyRefresh->Notify( aTsyReqHandle, aPackage );
       
   440             break;                  
       
   441             }
       
   442         case ESatNotifyRefreshRequiredParam:
       
   443         	{
       
   444             iNotifyRefresh->NotifyRefreshRequired( aTsyReqHandle, aPackage );
       
   445             break;            
       
   446         	}
       
   447         case ESatRefreshAllowed:
       
   448         	{
       
   449             iSatTsy->ReqCompleted( aTsyReqHandle, 
       
   450                 iNotifyRefresh->RefreshAllowedL( aPackage ) );
       
   451             break;
       
   452         	}          
       
   453         case ESatNotifyCbDownload:
       
   454             {
       
   455             NotifyCbDownload( aTsyReqHandle );
       
   456             break;
       
   457             }
       
   458         case ESatNotifySmsPpDownload:
       
   459             {
       
   460             NotifySmsPpDownload( aTsyReqHandle );
       
   461             break;
       
   462             }
       
   463         case ESatNotifyLanguageNotificationPCmd:
       
   464             {
       
   465             iNotifyLanguageNotification->Notify( aTsyReqHandle, aPackage );
       
   466             break;
       
   467             }
       
   468         case ESatNotifyLocalInfoPCmd:
       
   469             {
       
   470             iNotifyLocalInfo->Notify( aTsyReqHandle, aPackage );
       
   471             break;
       
   472             }
       
   473        case ESatNotifyOpenChannelPCmd:
       
   474             {
       
   475             iNotifyOpenChannel->Notify( aTsyReqHandle, aPackage );
       
   476             break;
       
   477             }
       
   478        	case ESatNotifyGetChannelStatusPCmd:
       
   479        		{
       
   480        		iNotifyGetChannelStatus->Notify( aTsyReqHandle, aPackage );
       
   481        		break;	
       
   482        		}
       
   483         case ESatNotifyMoSmControlRequest:
       
   484             {
       
   485             iNotifyMoSmControlRequest->Notify( aTsyReqHandle, aPackage );
       
   486             break;
       
   487             }
       
   488         case ESatNotifyCloseChannelPCmd:
       
   489         	{
       
   490        		iNotifyCloseChannel->Notify( aTsyReqHandle, aPackage );
       
   491         	break;
       
   492         	}
       
   493        	case ESatNotifySendDataPCmd:
       
   494        		{
       
   495        		iNotifySendData->Notify( aTsyReqHandle, aPackage );
       
   496        		break;	
       
   497        		}
       
   498         case ESatNotifyReceiveDataPCmd:
       
   499         	{
       
   500         	iNotifyReceiveData->Notify( aTsyReqHandle, aPackage );
       
   501         	break;	
       
   502         	} 
       
   503         default:
       
   504         	{
       
   505         	TFLOGSTRING("CSAT: CSatNotificationsTsy::DoExtFuncL, \
       
   506         		IPC not supported");
       
   507             ret = KErrNotSupported;
       
   508             break;
       
   509         	}
       
   510         }
       
   511     return ret;
       
   512     }
       
   513 
       
   514 // -----------------------------------------------------------------------------
       
   515 // CSatNotificationsTsy::CancelService
       
   516 // Cancels Notifications requests
       
   517 // -----------------------------------------------------------------------------
       
   518 //
       
   519 TInt CSatNotificationsTsy::CancelService
       
   520         (    
       
   521         const TInt aIpc,               
       
   522         const TTsyReqHandle aTsyReqHandle  
       
   523         )
       
   524     {
       
   525     TFLOGSTRING2("CSAT: CSatNotificationsTsy::CancelService.\
       
   526     	\n\t\t\t Handle:%d\n\t\t\t", aTsyReqHandle );
       
   527 
       
   528     TInt ret ( KErrNotSupported );
       
   529     
       
   530     // When the clients close their sub-sessions (eg. by calling RLine::Close), 
       
   531     // they may not have cancelled all their outstanding asynchronous requests 
       
   532     // before closing.  It is up to the ETel server to clean up in this 
       
   533     // situation, so the server will find the list of outstanding requests 
       
   534     // related to that sub-session object and pass these outstanding IPC 
       
   535     // request numbers, one at a time, to the CancelService method in the TSY.
       
   536 
       
   537     switch ( aIpc )
       
   538         {
       
   539         case ESatNotifyCallControlRequest:
       
   540             {
       
   541             ret = iNotifyCallControlRequest->CancelNotification( 
       
   542                 aTsyReqHandle );
       
   543             break;
       
   544             }
       
   545         case ESatNotifyDisplayTextPCmd:
       
   546             {
       
   547             ret = iNotifyDisplayText->CancelNotification( aTsyReqHandle );
       
   548             break;
       
   549             }
       
   550         case ESatNotifyGetInkeyPCmd:
       
   551             {
       
   552             ret = iNotifyGetInkey->CancelNotification( aTsyReqHandle );
       
   553             break;        
       
   554             }
       
   555         case ESatNotifyGetInputPCmd:
       
   556             {
       
   557             ret = iNotifyGetInput->CancelNotification( aTsyReqHandle );
       
   558             break;        
       
   559             }
       
   560         case ESatNotifyPlayTonePCmd:
       
   561             {
       
   562             ret = iNotifyPlayTone->CancelNotification( aTsyReqHandle );
       
   563             break;        
       
   564             }
       
   565         case ESatNotifySetUpMenuPCmd:
       
   566             {
       
   567             ret =  iNotifySetUpMenu->CancelNotification( aTsyReqHandle );
       
   568             break;        
       
   569             }
       
   570         case ESatNotifySelectItemPCmd:
       
   571             {
       
   572             ret = iNotifySelectItem->CancelNotification( aTsyReqHandle );
       
   573             break;        
       
   574             }
       
   575         case ESatNotifySendSmPCmd:
       
   576             {
       
   577             ret = iNotifySendSm->CancelNotification( aTsyReqHandle );
       
   578             break;        
       
   579             }
       
   580         case ESatNotifySendSsPCmd:
       
   581             {
       
   582             ret = iNotifySendSs->CancelNotification( aTsyReqHandle );
       
   583             break;        
       
   584             }
       
   585         case ESatNotifySetUpEventListPCmd:
       
   586             {
       
   587             ret = iNotifySetUpEventList->CancelNotification( aTsyReqHandle );
       
   588 			break;
       
   589             }
       
   590 		case ESatNotifySendUssdPCmd:
       
   591             {
       
   592             ret = iNotifySendUssd->CancelNotification( aTsyReqHandle );
       
   593             break;        
       
   594             }
       
   595         case ESatNotifySetUpIdleModeTextPCmd:
       
   596             {
       
   597             ret = iNotifySetUpIdleModeText->CancelNotification( aTsyReqHandle );
       
   598             break;
       
   599             }
       
   600         case ESatNotifySetUpCallPCmd:
       
   601             {
       
   602             ret = iNotifySetUpCall->CancelNotification( aTsyReqHandle );
       
   603             break;
       
   604             }
       
   605         case ESatNotifyRefreshPCmd:
       
   606             {
       
   607             ret = iNotifyRefresh->CancelNotification( aTsyReqHandle );
       
   608             break;
       
   609             }
       
   610         case ESatNotifyRefreshRequiredParam:
       
   611         	{
       
   612             ret = iNotifyRefresh->CancelRefreshRequiredNotification( 
       
   613             	aTsyReqHandle );
       
   614             break;            
       
   615         	}
       
   616         case ESatNotifySendDtmfPCmd:
       
   617             {
       
   618             ret = iNotifySendDtmf->CancelNotification( aTsyReqHandle );
       
   619             break;
       
   620             }
       
   621         case ESatNotifyLanguageNotificationPCmd:
       
   622             {
       
   623             ret = iNotifyLanguageNotification->CancelNotification(
       
   624                   	aTsyReqHandle );
       
   625             break;
       
   626             }
       
   627         case ESatNotifyLaunchBrowserPCmd:
       
   628             {
       
   629             ret = iNotifyLaunchBrowser->CancelNotification( aTsyReqHandle );
       
   630             break;
       
   631             }
       
   632         case ESatNotifyLocalInfoPCmd:
       
   633             {
       
   634             ret = iNotifyLocalInfo->CancelNotification( aTsyReqHandle );
       
   635             break;
       
   636             }
       
   637         case ESatNotifyProactiveSimSessionEnd:
       
   638             {
       
   639             ret = iNotifySimSessionEnd->CancelNotification( aTsyReqHandle );
       
   640             break;
       
   641             }
       
   642         case ESatNotifyOpenChannelPCmd:
       
   643             {
       
   644             ret = iNotifyOpenChannel->CancelNotification( aTsyReqHandle );
       
   645             break;
       
   646             }
       
   647         case ESatNotifyGetChannelStatusPCmd:
       
   648        		{
       
   649        		ret = iNotifyGetChannelStatus->CancelNotification( aTsyReqHandle );
       
   650        		break;	
       
   651        		}
       
   652         case ESatNotifyCloseChannelPCmd:
       
   653         	{
       
   654        		ret = iNotifyCloseChannel->CancelNotification( aTsyReqHandle );
       
   655         	break;
       
   656         	}
       
   657        	case ESatNotifySendDataPCmd:
       
   658        		{
       
   659        		ret = iNotifySendData->CancelNotification( aTsyReqHandle );
       
   660        		break;	
       
   661        		}
       
   662        	case ESatNotifyReceiveDataPCmd:
       
   663         	{
       
   664         	ret = iNotifyReceiveData->CancelNotification( aTsyReqHandle );
       
   665         	break;	
       
   666         	} 	        			                     
       
   667         case ESatNotifyMoSmControlRequest:
       
   668             {
       
   669             ret = iNotifyMoSmControlRequest->CancelNotification( 
       
   670                 	aTsyReqHandle );
       
   671             break;
       
   672             }
       
   673         default:
       
   674         	{        	
       
   675             ret = KErrNone; 
       
   676             break;
       
   677         	}
       
   678         }
       
   679     return ret;
       
   680     }
       
   681 
       
   682 // -----------------------------------------------------------------------------
       
   683 // CSatNotificationsTsy::SetPollingResultL
       
   684 // Sends terminal response according to the response coming from DOS.
       
   685 // This method handles both PollingInterval and PollingOff proactive commands.
       
   686 // -----------------------------------------------------------------------------
       
   687 //
       
   688 void CSatNotificationsTsy::SetPollingResultL
       
   689         ( 
       
   690         CSatDataPackage* aDataPackage,
       
   691         TInt aErrorCode
       
   692         )
       
   693     {
       
   694     TFLOGSTRING("CSAT: CSatNotificationsTsy::SetPollingResultL");
       
   695     TUint8 pCmdNumber;
       
   696     TUint8 interval;
       
   697     TBuf<RSat::KAdditionalInfoMaxSize> additionalInfo;
       
   698     aDataPackage->UnPackData( pCmdNumber, interval );
       
   699     
       
   700     // NAA status OK 
       
   701     if ( KErrNone == aErrorCode ) 
       
   702         {
       
   703         if ( iPollingOff )
       
   704             {
       
   705             TFLOGSTRING("CSAT: CSatNotificationsTsy::SetPollingResultL, \
       
   706                 Polling Off");
       
   707             additionalInfo.Zero();
       
   708             additionalInfo.Append( RSat::KNoAdditionalInfo );
       
   709             iNotifyPollingOff->CreateTerminalRespL( pCmdNumber,
       
   710                 RSat::KSuccess, additionalInfo );
       
   711             }
       
   712         else
       
   713             {
       
   714             iNotifyPollInterval->CreateTerminalRespL( pCmdNumber, 
       
   715             	RSat::KSuccess, RSat::KNoAdditionalInfo, interval );
       
   716             }
       
   717         }    
       
   718     // NAA status not OK
       
   719 	else
       
   720         {
       
   721         TFLOGSTRING("CSAT: CSatNotificationsTsy::SetPollingResultL, \
       
   722         	NAA Status Not OK, means that value in request is out of range\
       
   723         	and default value is used.");
       
   724         if ( iPollingOff )
       
   725             {
       
   726             iPollingOff = EFalse;
       
   727             additionalInfo.Zero();
       
   728             additionalInfo.Append( RSat::KNoSpecificMeProblem );
       
   729             iNotifyPollingOff->CreateTerminalRespL( pCmdNumber,
       
   730                     RSat::KMeUnableToProcessCmd, additionalInfo );
       
   731             }
       
   732         else
       
   733             {
       
   734             // If last request rejected (request was over 25 seconds),
       
   735             // renew the request with legacy maximum.. 
       
   736             if ( iLongPollIntervalReq )
       
   737                 {
       
   738                 TFLOGSTRING("CSAT: CSatNotificationsTsy::SetPollingResultL, \
       
   739         	        Request set to legacy maximum (25 seconds)");
       
   740                 SetPollingIntervalL( KMaxLegacyPollInterval );
       
   741                 iLongPollIntervalReq = EFalse;
       
   742                 }
       
   743             // ..otherwise there was an actual error.
       
   744             else
       
   745                 {
       
   746                 iNotifyPollInterval->CreateTerminalRespL( pCmdNumber, 
       
   747                 	RSat::KMeUnableToProcessCmd, RSat::KNoSpecificMeProblem, 
       
   748                 	interval );
       
   749                 }
       
   750             }
       
   751         }
       
   752             
       
   753     // Terminal Response is sent or the request was resent, reset flag
       
   754     iLongPollIntervalReq = EFalse;
       
   755     }
       
   756 
       
   757 // -----------------------------------------------------------------------------
       
   758 // CSatNotificationsTsy::SetPollingIntervalL
       
   759 // Set Polling Interval, sending a request to DOS
       
   760 // -----------------------------------------------------------------------------
       
   761 //
       
   762 void CSatNotificationsTsy::SetPollingIntervalL
       
   763         (
       
   764         TUint8 aValue
       
   765         )
       
   766     {
       
   767     TFLOGSTRING2("CSAT: CSatNotificationsTsy::SetPollingIntervalL, Value: %d",
       
   768         aValue);
       
   769     
       
   770     if ( KMaxLegacyPollInterval < aValue )
       
   771         {
       
   772         iLongPollIntervalReq = ETrue;
       
   773         }
       
   774 
       
   775     TBuf8<1> data;
       
   776     data.Append( aValue );
       
   777     // Pack data
       
   778     CSatDataPackage dataPackage;
       
   779 	dataPackage.PackData( &data );
       
   780     iSatTsy->MessageManager()->HandleRequestL( ESatTsySetPolling, 
       
   781     	&dataPackage );
       
   782     }
       
   783 
       
   784 // -----------------------------------------------------------------------------
       
   785 // CSatNotificationsTsy::TimerExpirationL
       
   786 // Converts timerValue to semi-octets and forwards message to LicenceeSimAtkTsy
       
   787 // -----------------------------------------------------------------------------
       
   788 //
       
   789 TInt CSatNotificationsTsy::TimerExpirationL
       
   790         (
       
   791         TInt aTimerId,
       
   792         TUint32 aTimerValue 
       
   793         )
       
   794     {
       
   795     TFLOGSTRING("CSAT: CSatNotificationsTsy::TimerExpirationL");
       
   796     TUint8 time[3] = {0, 0, 0}; 
       
   797     TInt num[3];
       
   798     num[0] = aTimerValue / 3600;         // Hours
       
   799     num[1] = ( aTimerValue % 3600 )/60;  // Minutes
       
   800     num[2] = ( aTimerValue % 3600 )%60;  // Seconds
       
   801 
       
   802     for ( TInt i = 0; i < 3; i++ )
       
   803         { 
       
   804         // Convert to semi-octet
       
   805         time[i] = TSatUtility::ConvertToSemiOctet( num[i] );
       
   806         }
       
   807         
       
   808 	TTlv data;    
       
   809     data.Begin( KBerTlvTimerExpirationTag );  
       
   810     // Create Device Identity TLV
       
   811     // Device identity tag
       
   812     data.AddTag( KTlvDeviceIdentityTag ); 
       
   813     // Source device identity = ME
       
   814     data.AddByte( KMe ); 
       
   815     // Destination device identity = SIM
       
   816     data.AddByte( KSim );
       
   817     // Value KTlvTimerIdentifierTagCRBitOn ( 0xA4 ) is added,
       
   818     // because used KTlvTimerIdentifierTag ( 0x24 ) doesn't
       
   819     // include comprehension bit in tag the value and it is expected
       
   820     // to be present in indications and terminal responses.
       
   821     data.AddTag( KTlvTimerIdentifierTagCRBitOn );
       
   822     data.AddByte( static_cast< TUint8 >( aTimerId ) );
       
   823     // Timer value in semi-octets
       
   824     data.AddTag( KTlvTimerValueTag );
       
   825     data.AddByte( time[0] ); // Hours
       
   826     data.AddByte( time[1] ); // Minutes
       
   827     data.AddByte( time[2] ); // Seconds
       
   828 	// Pack parameter for DOS call
       
   829     TPtrC8 berTlv = data.End();
       
   830 	CSatDataPackage dataPackage;
       
   831 	dataPackage.PackData( &berTlv );
       
   832 
       
   833 	return iSatTsy->MessageManager()->HandleRequestL( 
       
   834         ESatTsyTimerExpiredIPC, &dataPackage );
       
   835     }
       
   836 
       
   837 // -----------------------------------------------------------------------------
       
   838 // CSatNotificationsTsy::GetSatTimer
       
   839 // Returns iSatTimer pointer and control to calling object
       
   840 // -----------------------------------------------------------------------------
       
   841 //
       
   842 CSatTimer* CSatNotificationsTsy::GetSatTimer
       
   843         (
       
   844         // None 
       
   845         )
       
   846     {
       
   847     TFLOGSTRING("CSAT: CSatNotificationsTsy::GetSatTimer");
       
   848     // Pointer to SAT timer
       
   849     return iSatTimer; 
       
   850     }
       
   851 
       
   852 // -----------------------------------------------------------------------------
       
   853 // CSatNotificationsTsy::SatNotifySetUpCall
       
   854 // Return pointer to CSatNotifySetUpCall.
       
   855 // -----------------------------------------------------------------------------
       
   856 //
       
   857 CSatNotifySetUpCall* CSatNotificationsTsy::SatNotifySetUpCall
       
   858         (
       
   859         // None
       
   860         )
       
   861     {
       
   862     TFLOGSTRING("CSAT: CSatNotificationsTsy::SatNotifySetUpCall");
       
   863     // Pointer to NotifySetupCall
       
   864     return iNotifySetUpCall;
       
   865     }
       
   866 
       
   867 // -----------------------------------------------------------------------------
       
   868 // CSatNotificationsTsy::SetProactiveCommandOnGoingStatus
       
   869 // Sets proactive command on-going status 
       
   870 // -----------------------------------------------------------------------------
       
   871 //
       
   872 void CSatNotificationsTsy::SetProactiveCommandOnGoingStatus
       
   873         (
       
   874         CSatDataPackage* aDataPackage,  
       
   875 		TInt /*aResult*/             
       
   876         )
       
   877     {
       
   878 	TFLOGSTRING("CSAT: CSatNotificationsTsy::\
       
   879 		SetProactiveCommandOnGoingStatus");
       
   880     TBool ProactiveCommandOngoingStatus;
       
   881     aDataPackage->UnPackData( ProactiveCommandOngoingStatus );
       
   882     iSatTimer->SetProactiveCommandOnGoingStatus( 
       
   883     	ProactiveCommandOngoingStatus ); 
       
   884     }
       
   885     
       
   886 // -----------------------------------------------------------------------------
       
   887 // CSatNotificationsTsy::CompletePCmdL
       
   888 // Forwards the received Proactive command data to the correct Notify class
       
   889 // based on the type of command.
       
   890 // -----------------------------------------------------------------------------
       
   891 //
       
   892 TInt CSatNotificationsTsy::CompletePCmdL
       
   893         (
       
   894         CSatDataPackage* aDataPackage,
       
   895         TInt aResult
       
   896         )
       
   897     {
       
   898     TFLOGSTRING("CSAT: CSatNotificationsTsy::CompletePCmdL");
       
   899 
       
   900     TPtrC8* data;
       
   901     aDataPackage->UnPackData( &data );
       
   902     CBerTlv berTlv;
       
   903     berTlv.SetData( *data );
       
   904 	CTlv commandDetails;
       
   905 	berTlv.TlvByTagValue( &commandDetails, KTlvCommandDetailsTag );
       
   906     TInt ret( KErrNone );
       
   907     // Set flag on to indicate that proactive command is ongoing
       
   908     iSatTimer->SetProactiveCommandOnGoingStatus( ETrue );
       
   909     
       
   910     switch( commandDetails.GetShortInfo( ETLV_TypeOfCommand ) )
       
   911         {
       
   912         case KDisplayText:
       
   913             {
       
   914             ret = iNotifyDisplayText->CompleteNotifyL( aDataPackage, aResult );
       
   915             break;
       
   916             }
       
   917         case KGetInkey:
       
   918             {
       
   919             ret = iNotifyGetInkey->CompleteNotifyL( aDataPackage, aResult );            
       
   920             break;    
       
   921             }
       
   922         case KGetInput:         
       
   923             {
       
   924             ret = iNotifyGetInput->CompleteNotifyL( aDataPackage, aResult );
       
   925             break;    
       
   926             }
       
   927         case KPlayTone:         
       
   928             {
       
   929             ret = iNotifyPlayTone->CompleteNotifyL( aDataPackage, aResult );
       
   930             break;    
       
   931             }
       
   932         case KSetUpMenu:     
       
   933             {
       
   934             ret = iNotifySetUpMenu->CompleteNotifyL( aDataPackage, aResult );
       
   935             break;    
       
   936             }
       
   937         case KSelectItem:
       
   938             {
       
   939             ret = iNotifySelectItem->CompleteNotifyL( aDataPackage, aResult );
       
   940             break;
       
   941             }
       
   942         case KSendShortMessage:         
       
   943             {
       
   944             ret = iNotifySendSm->CompleteNotifyL( aDataPackage, aResult );
       
   945             break;
       
   946             }
       
   947         case KSendSs:
       
   948             {
       
   949             ret = iNotifySendSs->CompleteNotifyL( aDataPackage, aResult );
       
   950             break;
       
   951             }
       
   952         case KSendUssd:
       
   953             {
       
   954             ret = iNotifySendUssd->CompleteNotifyL( aDataPackage, aResult );
       
   955             break;
       
   956             }
       
   957         case KSetUpCall:
       
   958             {
       
   959             ret = iNotifySetUpCall->CompleteNotifyL( aDataPackage, aResult );
       
   960             break;
       
   961             }
       
   962         case KRefresh:
       
   963             {
       
   964             ret = iNotifyRefresh->CompleteNotifyL( aDataPackage, aResult );
       
   965             break;
       
   966             }
       
   967         case KSetUpIdleModeText:
       
   968             {
       
   969 			ret = iNotifySetUpIdleModeText->CompleteNotifyL( aDataPackage, 
       
   970 					aResult );
       
   971             break;
       
   972             }
       
   973         case KPollInterval:
       
   974             {
       
   975             ret = iNotifyPollInterval->CompleteNotifyL( aDataPackage, aResult );
       
   976             break;
       
   977             }
       
   978         case KSendDtmf:
       
   979             {
       
   980             ret = iNotifySendDtmf->CompleteNotifyL( aDataPackage, aResult );
       
   981             break;
       
   982             }
       
   983         case KSetUpEventList:
       
   984             {
       
   985             ret = iNotifySetUpEventList->CompleteNotifyL( aDataPackage, 
       
   986             		aResult );
       
   987             break;
       
   988             }
       
   989         case KPollingOff:
       
   990             {
       
   991             ret = iNotifyPollingOff->CompleteNotifyL( aDataPackage, aResult );
       
   992             break;
       
   993             }
       
   994         case KProvideLocalInformation:
       
   995             {
       
   996             ret = iNotifyLocalInfo->CompleteNotifyL( aDataPackage, aResult );
       
   997             break;
       
   998             }
       
   999         case KTimerManagement:
       
  1000             {
       
  1001             ret = iNotifyTimerMgmt->CompleteNotifyL( aDataPackage, aResult );
       
  1002             break;
       
  1003             }
       
  1004         case KMoreTime:
       
  1005             {
       
  1006             ret = iNotifyMoreTime->CompleteNotifyL( aDataPackage, aResult );
       
  1007             break;
       
  1008             }
       
  1009         case KLaunchBrowser: 
       
  1010             {
       
  1011             ret = iNotifyLaunchBrowser->CompleteNotifyL( aDataPackage, 
       
  1012             		aResult );
       
  1013 			break;
       
  1014             }
       
  1015         case KLanguageNotification:
       
  1016             {
       
  1017             ret = iNotifyLanguageNotification->CompleteNotifyL( aDataPackage, 
       
  1018             		aResult );
       
  1019             break;
       
  1020             }          
       
  1021 		case KOpenChannel:
       
  1022 			{
       
  1023 			ret = iNotifyOpenChannel->CompleteNotifyL( aDataPackage, aResult );
       
  1024 			break;
       
  1025 			}
       
  1026 		case KCloseChannel:
       
  1027 			{
       
  1028 			ret = iNotifyCloseChannel->CompleteNotifyL( aDataPackage, aResult );
       
  1029 			break;
       
  1030 			}		
       
  1031 		case KReceiveData:
       
  1032 			{
       
  1033 			ret = iNotifyReceiveData->CompleteNotifyL( aDataPackage, aResult );
       
  1034 			break;
       
  1035 			}		
       
  1036 		case KSendData:
       
  1037 			{
       
  1038 			ret = iNotifySendData->CompleteNotifyL( aDataPackage, aResult );
       
  1039 			break;
       
  1040 			}		
       
  1041 		case KGetChannelStatus:            
       
  1042 			{
       
  1043 			ret = iNotifyGetChannelStatus->CompleteNotifyL( aDataPackage, 
       
  1044 					aResult );
       
  1045 			break;
       
  1046 			}
       
  1047         default:
       
  1048             {
       
  1049             TFLOGSTRING("CSAT: CSatNotificationsTsy::CompletePCmdL, \
       
  1050             	Proactive command not supported" );
       
  1051         	// If proactive command is not supported, terminal response
       
  1052             // with "Command is beyond ME's capabilities" information 
       
  1053             // will be send. 
       
  1054             // Get command details tlv and set it to the struct
       
  1055         	iTerminalRespData.iCommandDetails.Copy( commandDetails.Data() );
       
  1056         	// Create and append response data
       
  1057         	TTlv tlvSpecificData;
       
  1058         	// Create General Result TLV here
       
  1059         	tlvSpecificData.AddTag( KTlvResultTag );
       
  1060         	tlvSpecificData.AddByte( KCommandBeyondMeCapabilities );
       
  1061         	TPtrC8 data = tlvSpecificData.GetDataWithoutTopLevelTag();
       
  1062         	CSatDataPackage dataPackage;
       
  1063         	dataPackage.PackData( &iTerminalRespData, &data );
       
  1064             // Forward request to the DOS
       
  1065     		ret = iSatTsy->MessageManager()->HandleRequestL( 
       
  1066 					ESatTerminalRsp, &dataPackage );	 
       
  1067             break;
       
  1068             }
       
  1069 
       
  1070         } // End of switch (msg type)
       
  1071 
       
  1072     return ret;
       
  1073     }
       
  1074     
       
  1075 // -----------------------------------------------------------------------------
       
  1076 // CSatNotificationsTsy::IsMoSmControlActivated
       
  1077 // Returns ETrue if MO-SMS Control is activated
       
  1078 // -----------------------------------------------------------------------------
       
  1079 //
       
  1080 TBool CSatNotificationsTsy::IsMoSmControlActivated
       
  1081 		(
       
  1082 		void
       
  1083 		)
       
  1084     {
       
  1085     TFLOGSTRING("CSAT: CSatNotificationsTsy::IsMoSmControlActivated");
       
  1086     return iNotifyMoSmControlRequest->ActivationStatus();
       
  1087     }
       
  1088      
       
  1089 // -----------------------------------------------------------------------------
       
  1090 // CSatNotificationsTsy::SetPollingOff
       
  1091 // Set PollingOff value
       
  1092 // -----------------------------------------------------------------------------
       
  1093 //
       
  1094 void CSatNotificationsTsy::SetPollingOffStatus
       
  1095 		( 
       
  1096 		TBool aPollingOff 
       
  1097 		)
       
  1098 	{
       
  1099 	TFLOGSTRING2("CSAT: CSatNotificationsTsy::SetPollingOffStatus \
       
  1100 		status: %d", aPollingOff);
       
  1101 	iPollingOff = aPollingOff;		
       
  1102 	}
       
  1103 
       
  1104 // -----------------------------------------------------------------------------
       
  1105 // CSatNotificationsTsy::SetPollingOff
       
  1106 // Returns iPollingOff
       
  1107 // -----------------------------------------------------------------------------
       
  1108 //	
       
  1109 TBool CSatNotificationsTsy::PollingOffStatus
       
  1110 		( 
       
  1111 		// None
       
  1112 		)
       
  1113 	{
       
  1114 	TFLOGSTRING("CSAT: CSatNotificationsTsy::PollingOffStatus");
       
  1115 	return iPollingOff;		
       
  1116 	}
       
  1117 
       
  1118 // -----------------------------------------------------------------------------
       
  1119 // CSatNotificationsTsy::AddLocationInformationToTlv
       
  1120 // Adds location informating to given TTlv.
       
  1121 // -----------------------------------------------------------------------------
       
  1122 //
       
  1123 void CSatNotificationsTsy::AddLocationInformationToTlv
       
  1124         (
       
  1125         TTlv& aTlv 
       
  1126         )
       
  1127     {
       
  1128     TFLOGSTRING("CSAT: CSatNotificationsTsy::AddLocationInformationToTlv");
       
  1129     
       
  1130     // Get the current location data from CSatNotifyLocalInfo
       
  1131     const TLocalInformation& locInfo = iNotifyLocalInfo->LocalInformation();
       
  1132         
       
  1133     // Add location information data, start with the tag
       
  1134     aTlv.AddTag( KTlvLocationInformationTag );
       
  1135     // Append Mobile Country  & Network Codes, 3 bytes
       
  1136     aTlv.AddData( locInfo.iOperatorCode );
       
  1137     // Append Location Area Code (LAC)
       
  1138     aTlv.AddByte( static_cast<TUint8>( locInfo.iLocationAreaCode >> 8 ) );//msb
       
  1139     aTlv.AddByte( static_cast<TUint8>( locInfo.iLocationAreaCode >> 0 ) );//lsb
       
  1140     // Append Cell Id
       
  1141     aTlv.AddByte( static_cast<TUint8>( locInfo.iCellId >> 8 ) ); // msb
       
  1142     aTlv.AddByte( static_cast<TUint8>( locInfo.iCellId >> 0 ) ); // lsb
       
  1143     }	
       
  1144     
       
  1145 // -----------------------------------------------------------------------------
       
  1146 // CSatNotificationsTsy::NotifyClientForAlphaId
       
  1147 // Requests completion for the ESatNotifyCallControlRequestPCmdReqType
       
  1148 // -----------------------------------------------------------------------------
       
  1149 //
       
  1150 void CSatNotificationsTsy::NotifyClientForAlphaId
       
  1151 	    (
       
  1152 	    RSat::TAlphaIdBuf& aAlphaId,
       
  1153 	    RSat::TControlResult aResult 
       
  1154 	    )
       
  1155     {
       
  1156     TFLOGSTRING("CSAT: CSatNotificationsTsy::NotifyClientForAlphaId");
       
  1157     iNotifyCallControlRequest->CompleteAlphaId( aAlphaId, aResult, KErrNone );
       
  1158     }
       
  1159     
       
  1160 // -----------------------------------------------------------------------------
       
  1161 // CSatNotificationsTsy::RequestHandleStore
       
  1162 // Returns pointer to the request handle store
       
  1163 // -----------------------------------------------------------------------------
       
  1164 //
       
  1165 CSatTsyReqHandleStore* CSatNotificationsTsy::RequestHandleStore
       
  1166 	    (
       
  1167 	    void
       
  1168 	    )
       
  1169     {
       
  1170     TFLOGSTRING("CSAT: CSatNotificationsTsy::RequestHandleStore");
       
  1171     return iSatReqHandleStore;
       
  1172     }
       
  1173     	       
       
  1174 // -----------------------------------------------------------------------------
       
  1175 // CSatNotificationsTsy::NotifySatReadyForNotification
       
  1176 // Passes a Sat ready indication to DOS and requests the possible pending
       
  1177 // Proactive command
       
  1178 // -----------------------------------------------------------------------------
       
  1179 //
       
  1180 TInt CSatNotificationsTsy::NotifySatReadyForNotification
       
  1181 	    (
       
  1182 	    TUint8 aPCmdMsgType 
       
  1183 	    )
       
  1184     {
       
  1185     TFLOGSTRING("CSAT: CSatNotificationsTsy::NotifySatReadyForNotification");
       
  1186     TInt ret( KErrNone );
       
  1187     // Pack parameter for DOS call
       
  1188 	CSatDataPackage dataPackage;
       
  1189 	dataPackage.PackData( &aPCmdMsgType );
       
  1190 	TRAPD( trapError, ret = iSatTsy->MessageManager()->HandleRequestL( 
       
  1191 		ESatTsyGetIfPendingNotification, &dataPackage ) 
       
  1192 		);
       
  1193 		
       
  1194 	if ( trapError )
       
  1195 		{
       
  1196 		ret = trapError;
       
  1197 		TFLOGSTRING2("CSAT: CSatNotificationsTsy::NotifySatReadyForNotification\
       
  1198 			Trap error: %d", trapError);
       
  1199 		}
       
  1200 		
       
  1201 	return ret;
       
  1202     }
       
  1203                 
       
  1204 // -----------------------------------------------------------------------------
       
  1205 // CSatNotificationsTsy::TerminalResponseL
       
  1206 // Called by ETel server, passes a response to SIM
       
  1207 // -----------------------------------------------------------------------------
       
  1208 //
       
  1209 TInt CSatNotificationsTsy::TerminalResponseL
       
  1210             (                    
       
  1211             RSat::TPCmd*    aPCmd,         
       
  1212             TDes8*          aRsp,           
       
  1213             TTsyReqHandle   aTsyReqHandle   
       
  1214             ) 
       
  1215     {
       
  1216     TFLOGSTRING2("CSAT: CSatNotificationsTsy::TerminalResponseL.\
       
  1217         \n\t\t\t Handle:%d\n\t\t\t", aTsyReqHandle );
       
  1218 
       
  1219     TInt ret( KErrNone );
       
  1220 
       
  1221     switch ( *aPCmd )
       
  1222         {
       
  1223         case RSat::EDisplayText:
       
  1224             {
       
  1225             ret = iNotifyDisplayText->TerminalResponseL( aRsp );
       
  1226             break;
       
  1227             }
       
  1228         case RSat::EGetInkey:
       
  1229             {
       
  1230             ret = iNotifyGetInkey->TerminalResponseL( aRsp );
       
  1231             break;
       
  1232             }
       
  1233         case RSat::EGetInput:
       
  1234             {
       
  1235             ret = iNotifyGetInput->TerminalResponseL( aRsp );
       
  1236             break;
       
  1237             }
       
  1238         case RSat::EPlayTone:
       
  1239             {
       
  1240             ret = iNotifyPlayTone->TerminalResponseL( aRsp );
       
  1241             break;
       
  1242             }
       
  1243         case RSat::ESetUpMenu:
       
  1244             {
       
  1245             ret = iNotifySetUpMenu->TerminalResponseL( aRsp );
       
  1246             break;
       
  1247             }
       
  1248         case RSat::ESelectItem:
       
  1249             {
       
  1250             ret = iNotifySelectItem->TerminalResponseL( aRsp );
       
  1251             break;
       
  1252             }
       
  1253         case RSat::ESendSm:
       
  1254             {
       
  1255             ret = iNotifySendSm->TerminalResponseL( aRsp );
       
  1256             break;
       
  1257             }
       
  1258         case RSat::ESendSs:
       
  1259             {
       
  1260             ret = iNotifySendSs->TerminalResponseL( aRsp );
       
  1261             break;
       
  1262             }
       
  1263         case RSat::ESetUpEventList:
       
  1264             {
       
  1265             ret = iNotifySetUpEventList->TerminalResponseL( aRsp );
       
  1266             break;
       
  1267             }
       
  1268        	case RSat::ESendUssd:
       
  1269             {
       
  1270             ret = iNotifySendUssd->TerminalResponseL( aRsp );
       
  1271             break;
       
  1272             }
       
  1273         case RSat::ESetUpIdleModeText:
       
  1274             {
       
  1275             ret = iNotifySetUpIdleModeText->TerminalResponseL( aRsp );
       
  1276             break;
       
  1277             }
       
  1278         case RSat::ESetUpCall:
       
  1279             {
       
  1280             ret = iNotifySetUpCall->TerminalResponseL( aRsp );
       
  1281             break;
       
  1282             }
       
  1283         case RSat::ERefresh:
       
  1284             {
       
  1285             ret = iNotifyRefresh->TerminalResponseL( aRsp );
       
  1286             break;
       
  1287             } 
       
  1288         case RSat::ELaunchBrowser:
       
  1289             {
       
  1290             ret = iNotifyLaunchBrowser->TerminalResponseL( aRsp );
       
  1291             break;
       
  1292             }
       
  1293 		case RSat::ESendDtmf:
       
  1294             {
       
  1295 			ret = iNotifySendDtmf->TerminalResponseL( aRsp );
       
  1296 			break;
       
  1297             }
       
  1298         case RSat::ELocalInfo:
       
  1299             {
       
  1300             ret = iNotifyLocalInfo->TerminalResponseL( aRsp );
       
  1301             break;
       
  1302             }
       
  1303         case RSat::ELanguageNotification:
       
  1304             {
       
  1305             ret = iNotifyLanguageNotification->TerminalResponseL( aRsp );
       
  1306             break;
       
  1307             }
       
  1308         case RSat::EOpenChannelCs:
       
  1309         case RSat::EOpenChannelGprs:
       
  1310         case RSat::EOpenChannelLocal:
       
  1311             {
       
  1312             ret = iNotifyOpenChannel->TerminalResponseL( aRsp );
       
  1313             break;
       
  1314             }
       
  1315        	case RSat::EGetChannelStatus:
       
  1316        		{
       
  1317        		ret = iNotifyGetChannelStatus->TerminalResponseL( aRsp );
       
  1318        		break;	
       
  1319        		}
       
  1320 		case RSat::ECloseChannel:
       
  1321         	{
       
  1322        		ret = iNotifyCloseChannel->TerminalResponseL( aRsp );
       
  1323         	break;
       
  1324         	}
       
  1325        	case RSat::ESendData:
       
  1326        		{
       
  1327        		ret = iNotifySendData->TerminalResponseL( aRsp );
       
  1328        		break;	
       
  1329        		}
       
  1330        	case RSat::EReceiveData:
       
  1331         	{
       
  1332         	ret = iNotifyReceiveData->TerminalResponseL( aRsp );
       
  1333         	break;	
       
  1334         	}	         			                            
       
  1335         default:
       
  1336         	{
       
  1337         	TFLOGSTRING("CSAT: CSatNotificationsTsy::TerminalResponseL.\
       
  1338         		Proactive command unknown" );
       
  1339             ret =  KErrGeneral;
       
  1340             break;
       
  1341         	}
       
  1342         }
       
  1343 	
       
  1344     // We must complete the request to the client right away, as an
       
  1345 	// indication that the request has been handled
       
  1346     iSatTsy->ReqCompleted( aTsyReqHandle, ret );
       
  1347 
       
  1348     return ret;
       
  1349     }
       
  1350 
       
  1351 // -----------------------------------------------------------------------------
       
  1352 // CSatNotificationsTsy::CompleteTerminalResponse
       
  1353 // This method completes an outstanding asynchronous Terminal response request. 
       
  1354 // -----------------------------------------------------------------------------
       
  1355 //
       
  1356 void CSatNotificationsTsy::CompleteTerminalResponse
       
  1357         (
       
  1358         TInt aErrorCode     // Error code
       
  1359         )
       
  1360     {
       
  1361     TFLOGSTRING2("CSAT: CSatNotificationsTsy::CompleteTerminalResponse - \
       
  1362     	Error:%d", aErrorCode);
       
  1363 
       
  1364     TTsyReqHandle reqHandle = iSatTsy->GetSatReqHandleStore()->
       
  1365         ResetTsyReqHandle( CSatTsy::ESatTerminalRspReqType );
       
  1366 
       
  1367     // Check if handle for terminal response exists
       
  1368     if ( CSatTsy::ESatReqHandleUnknown != reqHandle )
       
  1369         {
       
  1370         // Complete the request
       
  1371         iSatTsy->ReqCompleted( reqHandle, aErrorCode );
       
  1372         }
       
  1373    
       
  1374     }
       
  1375 
       
  1376 // -----------------------------------------------------------------------------
       
  1377 // CSatNotificationsTsy::CommandPerformedSuccessfully
       
  1378 // Test if a proactive command was performed successfully
       
  1379 // -----------------------------------------------------------------------------
       
  1380 //
       
  1381 TBool CSatNotificationsTsy::CommandPerformedSuccessfully
       
  1382         ( 
       
  1383         TUint8 aGeneralResult 
       
  1384         )
       
  1385     {
       
  1386     TFLOGSTRING("CSAT: CSatNotificationsTsy::CommandPerformedSuccessfully");
       
  1387     TBool ret( EFalse );
       
  1388 	switch ( aGeneralResult )
       
  1389 	    { 
       
  1390         case RSat::KSuccess:
       
  1391         case RSat::KPartialComprehension:
       
  1392         case RSat::KMissingInformation:
       
  1393         case RSat::KRefreshAdditionEFRead:
       
  1394         case RSat::KSuccessRequestedIconNotDisplayed:
       
  1395         case RSat::KModifiedByCallControl:
       
  1396         case RSat::KSuccessLimitedService:
       
  1397         case RSat::KPerformedWithModifications:
       
  1398         case RSat::KRefreshUSIMNotActive:
       
  1399         	{
       
  1400     		ret = ETrue;
       
  1401             break;
       
  1402         	}
       
  1403 	    default:
       
  1404 	    	{	
       
  1405 	    	TFLOGSTRING("CSAT: CSatNotificationsTsy:: \
       
  1406 	    		CommandPerformedSuccessfully, EFalse");
       
  1407 		    ret = EFalse;
       
  1408 		    break;
       
  1409 	    	}
       
  1410 	    }
       
  1411     return ret;
       
  1412    }
       
  1413 
       
  1414 // -----------------------------------------------------------------------------
       
  1415 // CSatNotificationsTsy::NotifyCbDownload
       
  1416 // Called by ETel server, passes a cell broadcast download response to NAA
       
  1417 // -----------------------------------------------------------------------------
       
  1418 //
       
  1419 TInt CSatNotificationsTsy::NotifyCbDownload
       
  1420         (
       
  1421         TTsyReqHandle   aTsyReqHandle 
       
  1422         )
       
  1423     {
       
  1424     TFLOGSTRING("CSAT: CSatNotificationsTsy::NotifyCbDownload");
       
  1425     TInt ret( KErrNone );
       
  1426     iSatTsy->ReqCompleted( aTsyReqHandle, ret );   
       
  1427     return ret; 
       
  1428     }
       
  1429 
       
  1430 // -----------------------------------------------------------------------------
       
  1431 // CSatNotificationsTsy::NotifySmsPpDownload
       
  1432 // Called by ETel server, passes a Sms Pp download response to NAA
       
  1433 // -----------------------------------------------------------------------------
       
  1434 //
       
  1435 TInt CSatNotificationsTsy::NotifySmsPpDownload
       
  1436         (
       
  1437         TTsyReqHandle   aTsyReqHandle
       
  1438         )
       
  1439     {
       
  1440     TFLOGSTRING("CSAT: CSatNotificationsTsy::NotifySmsPpDownload");
       
  1441     TInt ret( KErrNone );
       
  1442     iSatTsy->ReqCompleted( aTsyReqHandle, ret );   
       
  1443     return ret; 
       
  1444     }
       
  1445 
       
  1446 //  End of File