telephonyserverplugins/simatktsy/src/csattsy.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
child 42 3adadc800673
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Name        : CSatTsy.cpp
       
    15 // Part of     : Common SIM ATK TSY / commonsimatktsy
       
    16 // Main entry point for Etel requests
       
    17 // Version     : 1.0  
       
    18 //
       
    19 
       
    20 
       
    21 
       
    22 //  INCLUDE FILES
       
    23 #include <etelsat.h>                // Etel SAT API
       
    24 #include <satcs.h>                  // Etel SAT API
       
    25 //#include "CMmPhoneTsy.h"			// Phone Tsy class
       
    26 #include "CSatDataPackage.h"		// For data packages
       
    27 //#include "MmTsy_numberOfSlots.h"    // Number of Slots
       
    28 #include "cmmmessagemanagerbase.h"	// Message manager base
       
    29 #include <ctsy/pluginapi/mmessagerouter.h>
       
    30 #include <ctsy/serviceapi/mctsysatservice.h>
       
    31 //#include "CMmMessageRouterBase.h"	// Message router
       
    32 
       
    33 //#include "CMmSmsTsy.h"              // MmSmsTsy
       
    34 //#include "CMmMessageManager.h"      // Message manager
       
    35 
       
    36 #include "CSatTsy.h"				// Messaging class
       
    37 #include "CSatCCTsy.h"              // SatCallControl class
       
    38 #include "CSatIconTsy.h"            // SatIcon class
       
    39 #include "CSatNotificationsTsy.h"   // SatNotifications class
       
    40 #include "CSatNotifySetUpCall.h"    // CSatNotifySetUpCall    
       
    41 #include "CSatEventDownloadTsy.h"   // SatEventDownload class
       
    42 #include "CSatDataDownloadTsy.h"    // SatDataDownload class
       
    43 
       
    44 #include "msattsy_ipcdefs.h"		// Sat Tsy specific request types
       
    45 #include "TfLogger.h"               // For TFLOGSTRING
       
    46 #include "TSatUtility.h"		    // Sat Tsy Utility class
       
    47 #include "TTlv.h"					// TTlv class
       
    48 #include "CSatTsyReqHandleStore.h"  // Request handle storage
       
    49 
       
    50 #include "stktsy_number_of_slots.h"
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // CSatTsy::NewL
       
    54 // Two-phased constructor.
       
    55 // -----------------------------------------------------------------------------
       
    56 //
       
    57 CSatTsy* CSatTsy::NewL
       
    58 		(
       
    59 		MMessageRouter& aMmMessageRouter,
       
    60 		MCtsySatService& aSatService
       
    61 		)
       
    62     {
       
    63     TFLOGSTRING("CSAT: CSatTsy::NewL");
       
    64 
       
    65 	// Create subsession
       
    66     CSatTsy* subsession = new ( ELeave ) CSatTsy( aMmMessageRouter, aSatService );
       
    67 
       
    68     CleanupStack::PushL( subsession );
       
    69     subsession->ConstructL();
       
    70     CleanupStack::Pop();
       
    71 
       
    72 	TFLOGSTRING("CSAT: CSatTsy::NewL, end of method");
       
    73     return subsession;
       
    74     }
       
    75 
       
    76 // -----------------------------------------------------------------------------
       
    77 // CSatTsy::~CSatTsy
       
    78 // Destructor
       
    79 // -----------------------------------------------------------------------------
       
    80 // 
       
    81 CSatTsy::~CSatTsy
       
    82 		(
       
    83 		// None
       
    84 		)
       
    85     {
       
    86     TFLOGSTRING("CSAT: CSatTsy::~CSatTsy");
       
    87 
       
    88     // Unregister.
       
    89     iMessageManager->RegisterTsyObject(
       
    90 		CMmMessageManagerBase::ESatTsyObjType, NULL );
       
    91 
       
    92     // Delete also specific TSY objects
       
    93     delete iSatCCTsy;
       
    94     delete iSatIconTsy;
       
    95     delete iSatNotificationsTsy;
       
    96     delete iSatDataDownloadTsy;
       
    97     delete iSatEventDownloadTsy;
       
    98 	// Message router and message manager are deleted here
       
    99     delete iMessageManager;
       
   100     // Request handle store
       
   101     delete iSatReqHandleStore;
       
   102     TFLOGSTRING("CSAT: CSatTsy::~CSatTsy, end of method");
       
   103     }
       
   104 
       
   105 // -----------------------------------------------------------------------------
       
   106 // CSatTsy::CSatTsy
       
   107 // C++ constructor
       
   108 // -----------------------------------------------------------------------------
       
   109 //
       
   110 CSatTsy::CSatTsy
       
   111 		( 
       
   112         MMessageRouter& aMmMessageRouter,
       
   113         MCtsySatService& aSatService
       
   114 		): 
       
   115 		iMessageRouter ( aMmMessageRouter ),
       
   116 		iSatService(aSatService)
       
   117     {
       
   118     // None
       
   119     }
       
   120 
       
   121 // -----------------------------------------------------------------------------
       
   122 // CSatTsy::ConstructL
       
   123 // Symbian 2nd phase constructor. Initialises internal attributes.
       
   124 // -----------------------------------------------------------------------------
       
   125 //
       
   126 void CSatTsy::ConstructL
       
   127 		( 
       
   128         )
       
   129     { 
       
   130     TFLOGSTRING("CSAT: CSatTsy::ConstructL");
       
   131     
       
   132     // Set pointer to the message router 
       
   133     iMessageManager = CMmMessageManagerBase::NewL(iMessageRouter);
       
   134    
       
   135     // Register
       
   136     iMessageManager->RegisterTsyObject(
       
   137 		CMmMessageManagerBase::ESatTsyObjType, this );
       
   138 
       
   139     // Create request handle store
       
   140     iSatReqHandleStore = CSatTsyReqHandleStore::NewL( 
       
   141         ESatMaxNumOfRequests, iSatReqHandles );
       
   142 
       
   143 	// Create IconTsy instance
       
   144 	iSatIconTsy = CSatIconTsy::NewL( this );
       
   145 	// Create NotificationsTsy instance
       
   146 	iSatNotificationsTsy = CSatNotificationsTsy::NewL( 
       
   147         this, iSatReqHandleStore );              
       
   148     // Create CCTsy instance
       
   149     iSatCCTsy = CSatCCTsy::NewL( this, iSatNotificationsTsy );
       
   150     // Create DataDownloadTsy instance
       
   151     iSatDataDownloadTsy = CSatDataDownloadTsy::NewL( this );
       
   152     // Create EventDownloadTsy instance
       
   153 	iSatEventDownloadTsy = CSatEventDownloadTsy::NewL( this );
       
   154 	
       
   155     // Request to read Cbmids
       
   156 #ifdef USING_CTSY_DISPATCHER
       
   157 	//Commented out due to not seemingly doing anything as the STK TSY does not hold EF_cbmid cache
       
   158     //iSatDataDownloadTsy->CompleteReadCbmidsL( );
       
   159     // Request Network status (removed as no known completion)   
       
   160     //iMessageManager->HandleRequestL( ESatTsyNetStatus );
       
   161     // Check if guardians should be activated (removed as no known completion)
       
   162 	//iMessageManager->HandleRequestL( ESatTsyCallControlActivation );
       
   163 	//Check if the SIM card suppords USSD tlv's in the call control envelopes (removed as no known completion)
       
   164 	//iMessageManager->HandleRequestL( ESatTsyUssdControlActivation );
       
   165 	// Get the default bearer data
       
   166 	iMessageManager->HandleRequestL( ESatTsyGetBearerCapability );
       
   167 	//prime the cached version of this setting
       
   168 	iMessageManager->HandleRequestL( ESatTsyUssdStatus);
       
   169 #else
       
   170 	iSatDataDownloadTsy->CompleteReadCbmidsL( );
       
   171 	// Request Network status    
       
   172 	iMessageManager->HandleRequestL( ESatTsyNetStatus );
       
   173 	// Check if guardians should be activated
       
   174 	iMessageManager->HandleRequestL( ESatTsyCallControlActivation );
       
   175 	//Check if the SIM card suppords USSD tlv's in the call control envelopes
       
   176 	iMessageManager->HandleRequestL( ESatTsyUssdControlActivation );
       
   177 	// Get the default bearer data
       
   178 	iMessageManager->HandleRequestL( ESatTsyGetBearerCapability );
       
   179 #endif //USING_CTSY_DISPATCHER
       
   180 	// Notify Licencee SIM ATK TSY that we are ready to receive messages
       
   181 	iMessageManager->HandleRequestL( ESatTsyReady );
       
   182 	// Get SMS Point to Point Data Download support status
       
   183     iMessageManager->HandleRequestL( ESatTsySmsPpDdlStatus );
       
   184 	
       
   185 	TFLOGSTRING("CSAT: CSatTsy::ConstructL, end of method");
       
   186     }
       
   187     
       
   188 // -----------------------------------------------------------------------------
       
   189 // CSatTsy::ExtFunc
       
   190 // TRAP's all CSatTsy related Etel API requests in cases that they fail.
       
   191 // -----------------------------------------------------------------------------
       
   192 //
       
   193 TInt CSatTsy::ExtFunc
       
   194 		( 
       
   195 		const TTsyReqHandle aTsyReqHandle,  
       
   196 		const TInt aIpc,           
       
   197 		const TDataPackage& aPackage        
       
   198 		)
       
   199     {
       
   200     TFLOGSTRING3("CSAT: CSatTsy::ExtFunc ReqHandle=%d IPC=%d", aTsyReqHandle, 
       
   201         aIpc);
       
   202 	TInt ret( KErrNone );
       
   203 
       
   204     // Some SAT functions need trapping so we use two level function where 
       
   205     // first one is just a trap harness
       
   206     
       
   207     // It is responsibility of IPC handling functions to always handle 
       
   208     // calling ReqComplete, ( it must either call it, or arrange it to 
       
   209     // be called in some way ), except in the case of Leave. It is also 
       
   210     // assumed that if after IPC handling function has called ReqComplete, 
       
   211     // then it doesn't Leave.
       
   212     TInt trapError( KErrNone );
       
   213 
       
   214     TRAP( trapError, ret = DoExtFuncL( aTsyReqHandle, aIpc, aPackage ) );
       
   215 
       
   216     if ( KErrNone != trapError )
       
   217         {
       
   218         TFLOGSTRING2("CSAT: CSatTsy::ExtFunc, trapError: %d", trapError );
       
   219         ReqCompleted( aTsyReqHandle, trapError );
       
   220         }
       
   221 	else if ( KErrNone != ret )
       
   222         {
       
   223         TFLOGSTRING2("CSAT: CSatTsy::ExtFunc, ret: %d", ret);
       
   224         ReqCompleted( aTsyReqHandle, ret );
       
   225         }
       
   226     else										
       
   227 	    {
       
   228         // Reset last Tsy request type
       
   229         iReqHandleType = ESatReqHandleUnknown;
       
   230         }
       
   231 
       
   232     return KErrNone;
       
   233     }
       
   234 
       
   235 // -----------------------------------------------------------------------------
       
   236 // CSatTsy::SaveReqHandle
       
   237 // Saves the request handle
       
   238 // -----------------------------------------------------------------------------
       
   239 //
       
   240 void CSatTsy::SaveReqHandle
       
   241 		( 
       
   242 		const TTsyReqHandle aTsyReqHandle,  
       
   243         const TSatRequestTypes aSatRequestType
       
   244 		)
       
   245     {
       
   246     TFLOGSTRING3("CSAT: CSatTsy::SaveReqHandle ReqHandle=%d ReqHandleType=%d", 
       
   247         aTsyReqHandle, aSatRequestType);
       
   248     
       
   249     // Don't save the request handle if the type is unknown.
       
   250     if ( ESatReqHandleUnknown != aSatRequestType )
       
   251         {
       
   252         iSatReqHandleStore->SetTsyReqHandle( aSatRequestType, aTsyReqHandle );
       
   253         }
       
   254     }
       
   255 
       
   256 // -----------------------------------------------------------------------------
       
   257 // CSatTsy::ReqModeL
       
   258 // Mode service function used by ETel, request mode. ReqModeL is called from 
       
   259 // the server's CTelObject::ReqAnalyserL in order to check the type of request
       
   260 // it has.
       
   261 // -----------------------------------------------------------------------------
       
   262 //
       
   263 CTelObject::TReqMode CSatTsy::ReqModeL
       
   264 		( 
       
   265 		const TInt aIpc    
       
   266 		)
       
   267     {
       
   268     TFLOGSTRING("CSAT: CSatTsy::ReqModeL.");
       
   269     CTelObject::TReqMode ret = 0;
       
   270 
       
   271     switch ( aIpc )
       
   272         {
       
   273         // Multiple Completion Services
       
   274         case ESatNotifyDisplayTextPCmd:
       
   275         case ESatNotifyGetInkeyPCmd:
       
   276         case ESatNotifyGetInputPCmd:
       
   277         case ESatNotifyPlayTonePCmd:
       
   278         case ESatNotifySetUpMenuPCmd:
       
   279         case ESatNotifySelectItemPCmd:
       
   280         case ESatNotifySendSmPCmd:
       
   281         case ESatNotifySendSsPCmd:
       
   282         case ESatNotifySendUssdPCmd:
       
   283         case ESatNotifySetUpCallPCmd:
       
   284         case ESatNotifyRefreshPCmd:
       
   285         case ESatNotifyRefreshRequiredParam:
       
   286         case ESatRefreshAllowed:        
       
   287         case ESatNotifyCallControlRequest:
       
   288         case ESatNotifySendDtmfPCmd:
       
   289         case ESatNotifyMoSmControlRequest:
       
   290         case ESatNotifySetUpEventListPCmd:
       
   291         case ESatNotifySetUpIdleModeTextPCmd:
       
   292         case ESatNotifyProactiveSimSessionEnd:
       
   293         case ESatNotifyLaunchBrowserPCmd:
       
   294         case ESatNotifyPollingIntervalPCmd:
       
   295         case ESatNotifyPollingOffPCmd:
       
   296         case ESatNotifyLanguageNotificationPCmd:
       
   297         case ESatNotifyLocalInfoPCmd:
       
   298         case ESatNotifyOpenChannelPCmd:
       
   299         case ESatNotifyGetChannelStatusPCmd:
       
   300         case ESatNotifyCloseChannelPCmd:
       
   301         case ESatNotifySendDataPCmd:
       
   302         case ESatNotifyReceiveDataPCmd:               
       
   303             {
       
   304             ret = KReqModeMultipleCompletionEnabled;
       
   305             break;
       
   306             }
       
   307         // Non-flow Controlled Services
       
   308         case ESatTerminalRsp:
       
   309         case ESatMenuSelection:
       
   310         case ESatEventDownload:
       
   311         case ESatGetIcon:
       
   312         case ESatGetImageInstance:
       
   313         case ESatGetClut:
       
   314         case ESatGetMeSideSatProfile:
       
   315         case ESatClientSatProfileIndication:
       
   316         case ESatSendMessageNoLogging:
       
   317             {
       
   318             break;
       
   319             }
       
   320         default:
       
   321             {
       
   322             TFLOGSTRING2("CSAT: CSatTsy::ReqModeL unsupported IPC %d", aIpc);
       
   323             User::Leave( KErrNotSupported );
       
   324             break;
       
   325             }
       
   326         }
       
   327     return ret;
       
   328     }
       
   329 
       
   330 // -----------------------------------------------------------------------------
       
   331 // CSatTsy::CancelService
       
   332 // Cancels Sat requests
       
   333 // -----------------------------------------------------------------------------
       
   334 //
       
   335 TInt CSatTsy::CancelService
       
   336 		( 
       
   337 		const TInt aIpc,           
       
   338 		const TTsyReqHandle aTsyReqHandle   
       
   339 		)
       
   340     {
       
   341     TFLOGSTRING3("CSAT: CSatTsy::CancelService ReqHandle=%d IPC=%d", 
       
   342         aTsyReqHandle, aIpc);
       
   343     TInt ret( KErrNotSupported );
       
   344 
       
   345 	// When the clients close their sub-sessions (eg. by calling RLine::Close), 
       
   346     // they may not have cancelled all their outstanding asynchronous requests 
       
   347     // before closing.  It is up to the ETel server to clean up in this 
       
   348     // situation, so the server will find the list of outstanding requests 
       
   349     // related to that sub-session object and pass these outstanding IPC 
       
   350     // request numbers, one at a time, to the CancelService method in the TSY.
       
   351 
       
   352     switch ( aIpc )
       
   353         {
       
   354         case ESatTerminalRsp:
       
   355         case ESatMenuSelection:
       
   356         //case ESatSendMessageNoLogging:
       
   357             {
       
   358             ret = KErrNone;
       
   359             break;
       
   360             }
       
   361         case ESatNotifyCallControlRequest:
       
   362 		case ESatNotifyMoSmControlRequest:        
       
   363         case ESatNotifyDisplayTextPCmd:
       
   364         case ESatNotifyGetInkeyPCmd:
       
   365         case ESatNotifyGetInputPCmd:
       
   366         case ESatNotifyPlayTonePCmd:
       
   367         case ESatNotifySetUpMenuPCmd:
       
   368         case ESatNotifySelectItemPCmd:
       
   369         case ESatNotifySetUpCallPCmd:
       
   370         case ESatNotifySendSmPCmd:
       
   371         case ESatNotifySendSsPCmd:
       
   372         case ESatNotifySendUssdPCmd:   
       
   373         case ESatNotifyRefreshPCmd:
       
   374         case ESatNotifyRefreshRequiredParam:
       
   375         case ESatNotifySetUpIdleModeTextPCmd:
       
   376         case ESatNotifySendDtmfPCmd:
       
   377         case ESatNotifyLaunchBrowserPCmd:
       
   378         case ESatNotifyLocalInfoPCmd:
       
   379         case ESatNotifyLanguageNotificationPCmd:
       
   380         case ESatNotifySetUpEventListPCmd:
       
   381         case ESatNotifyProactiveSimSessionEnd:
       
   382         case ESatNotifyOpenChannelPCmd:
       
   383         case ESatNotifyGetChannelStatusPCmd:
       
   384         case ESatNotifyCloseChannelPCmd:
       
   385         case ESatNotifySendDataPCmd:
       
   386         case ESatNotifyReceiveDataPCmd:       
       
   387             {
       
   388             ret = iSatNotificationsTsy->CancelService ( aIpc, aTsyReqHandle );
       
   389             break;
       
   390             }
       
   391         
       
   392         case ESatEventDownload:
       
   393             {
       
   394             ret = iSatEventDownloadTsy->CancelService ( aIpc, aTsyReqHandle );
       
   395             break;
       
   396             }
       
   397         
       
   398         // Following functions are not supported, hence they are completed
       
   399         // by DoExtFuncL function at once.
       
   400         // ETel server will not pass cancel function to SAT, because the 
       
   401         // request is not 'ON' in ETel.
       
   402         // They are listed here for future reference.
       
   403         //
       
   404 
       
   405         // ESatNotifyMoSmControlRequest
       
   406         // ESatEventDownload
       
   407         // ESatGetMeSideSatProfile
       
   408 
       
   409         default:
       
   410             {
       
   411             TFLOGSTRING2("CSAT: CSatTsy::CancelService invalid IPC %d", aIpc);
       
   412             ret = KErrGeneral; 
       
   413             break;           	
       
   414             }
       
   415         }
       
   416     return ret;
       
   417 
       
   418     }
       
   419         
       
   420 // -----------------------------------------------------------------------------
       
   421 // CSatTsy::RegisterNotification
       
   422 // ETel Server subscribe notifications from NOS. RegisterNotification is called
       
   423 // when the server recognises that this notification is being posted for the 
       
   424 // first time on this sub-session object. It enables the TSY to "turn on" any 
       
   425 // regular notification messages that it may receive from the phone.
       
   426 // -----------------------------------------------------------------------------
       
   427 //
       
   428 TInt CSatTsy::RegisterNotification
       
   429 		( 
       
   430 		const TInt aIpc    // IPC number of request
       
   431 		)
       
   432     {
       
   433     TFLOGSTRING("CSAT: CSatTsy::RegisterNotification.");
       
   434     // Initialize return value
       
   435     TInt ret( KErrNone );
       
   436 
       
   437     switch ( aIpc )
       
   438         {
       
   439         case ESatNotifyDisplayTextPCmd:
       
   440         case ESatNotifyGetInkeyPCmd:
       
   441         case ESatNotifyGetInputPCmd:
       
   442         case ESatNotifyPlayTonePCmd:
       
   443         case ESatNotifySetUpMenuPCmd:
       
   444         case ESatNotifySelectItemPCmd:
       
   445         case ESatNotifySendSmPCmd:
       
   446         case ESatNotifySendSsPCmd:
       
   447         case ESatNotifySendUssdPCmd:
       
   448         case ESatNotifySetUpCallPCmd:
       
   449         case ESatNotifyRefreshPCmd:
       
   450         case ESatNotifyRefreshRequiredParam:
       
   451         case ESatRefreshAllowed:        
       
   452         case ESatNotifyProactiveSimSessionEnd:
       
   453         case ESatNotifySetUpIdleModeTextPCmd:
       
   454         case ESatNotifyLaunchBrowserPCmd:
       
   455         case ESatNotifyCallControlRequest:
       
   456 		case ESatNotifySendDtmfPCmd:
       
   457         case ESatNotifySetUpEventListPCmd:
       
   458         case ESatNotifyLanguageNotificationPCmd:
       
   459         case ESatNotifyLocalInfoPCmd:
       
   460         case ESatNotifyMoSmControlRequest:
       
   461         case ESatNotifyOpenChannelPCmd:
       
   462         case ESatNotifyGetChannelStatusPCmd:
       
   463         case ESatNotifyCloseChannelPCmd:
       
   464         case ESatNotifySendDataPCmd:
       
   465         case ESatNotifyReceiveDataPCmd:      
       
   466             {
       
   467             // Ret already set to KErrNone
       
   468             break;
       
   469             }
       
   470         default:
       
   471             {
       
   472             // Unknown or invalid IPC
       
   473             TFLOGSTRING2("CSAT: CSatTsy::RegisterNotification, \
       
   474                 Unsupported IPC %d", aIpc);
       
   475             ret = KErrNotSupported;
       
   476             break;
       
   477             }
       
   478         }
       
   479     return ret;
       
   480     }
       
   481 
       
   482 // -----------------------------------------------------------------------------
       
   483 // CSatTsy::DeregisterNotification
       
   484 // ETel server unsubscribe notifications from NOS. DeregisterNotification is 
       
   485 // called when the server recognizes that this notification will not be posted 
       
   486 // again because the last client to have a handle on this sub-session object  
       
   487 // has just closed the handle. It enables the TSY to "turn off" any regular 
       
   488 // notification messages that it may receive from the phone.
       
   489 // -----------------------------------------------------------------------------
       
   490 //
       
   491 TInt CSatTsy::DeregisterNotification
       
   492 		( 
       
   493 		const TInt aIpc    // IPC number of request
       
   494 		)
       
   495     {
       
   496     TFLOGSTRING("CSAT: CSatTsy::DeregisterNotification.");
       
   497     // Initialize return value
       
   498     TInt ret( KErrNone );
       
   499 
       
   500     switch ( aIpc )
       
   501         {
       
   502         case ESatNotifyDisplayTextPCmd:
       
   503         case ESatNotifyGetInkeyPCmd:
       
   504         case ESatNotifyGetInputPCmd:
       
   505         case ESatNotifyPlayTonePCmd:
       
   506         case ESatNotifySetUpMenuPCmd:
       
   507         case ESatNotifySelectItemPCmd:
       
   508         case ESatNotifySendSmPCmd:
       
   509         case ESatNotifySendSsPCmd:
       
   510         case ESatNotifySendUssdPCmd:
       
   511         case ESatNotifySetUpCallPCmd:
       
   512         case ESatNotifyRefreshPCmd:
       
   513         case ESatNotifyRefreshRequiredParam:
       
   514         case ESatRefreshAllowed:        
       
   515         case ESatNotifyProactiveSimSessionEnd:
       
   516         case ESatNotifySetUpIdleModeTextPCmd:
       
   517         case ESatNotifyLaunchBrowserPCmd:
       
   518         case ESatNotifyCallControlRequest:
       
   519 		case ESatNotifySendDtmfPCmd:		
       
   520         case ESatNotifySetUpEventListPCmd:
       
   521         case ESatNotifyLanguageNotificationPCmd:
       
   522         case ESatNotifyLocalInfoPCmd:
       
   523         case ESatNotifyOpenChannelPCmd:
       
   524         case ESatNotifyGetChannelStatusPCmd:
       
   525         case ESatNotifyMoSmControlRequest:
       
   526         case ESatNotifyCloseChannelPCmd:
       
   527         case ESatNotifySendDataPCmd:
       
   528         case ESatNotifyReceiveDataPCmd:       
       
   529             {
       
   530             // Ret already set to KErrNone
       
   531             break;
       
   532             }
       
   533         default:
       
   534             {
       
   535             // Unknown or invalid IPC
       
   536             TFLOGSTRING2("CSAT: CSatTsy::DeregisterNotification, \
       
   537                 Unsupported IPC %d", aIpc);
       
   538             ret = KErrNotSupported;
       
   539             break;            	
       
   540             }
       
   541         }
       
   542     return ret;
       
   543     }
       
   544 
       
   545 // -----------------------------------------------------------------------------
       
   546 // CSatTsy::NumberOfSlotsL
       
   547 // Returns number of slots to be used for given IPC. NumberOfSlotsL is called 
       
   548 // by the server when it is registering a new notification. It enables the TSY 
       
   549 // to tell the server how many buffer slots to allocate for "repost 
       
   550 // immediately" notifications that may trigger before clients collect them.
       
   551 // -----------------------------------------------------------------------------
       
   552 //
       
   553 TInt CSatTsy::NumberOfSlotsL
       
   554 		( 
       
   555 		const TInt aIpc    // IPC number of request
       
   556 		)
       
   557     {
       
   558     TFLOGSTRING("CSAT: CSatTsy::NumberOfSlotsL.");
       
   559     TInt numberOfSlots( 1 );
       
   560 
       
   561     switch ( aIpc )
       
   562         {
       
   563         case ESatNotifyDisplayTextPCmd:
       
   564             {
       
   565             numberOfSlots = KSatNotifyDisplayTextPCmdSlots;
       
   566             break;
       
   567             }
       
   568         case ESatNotifyGetInkeyPCmd:
       
   569             {
       
   570             numberOfSlots = KSatNotifyGetInkeyPCmdSlots;
       
   571             break;
       
   572             }
       
   573         case ESatNotifyGetInputPCmd:
       
   574             {
       
   575             numberOfSlots = KSatNotifyGetInputPCmdSlots;
       
   576             break;
       
   577             }
       
   578         case ESatNotifyPlayTonePCmd:
       
   579             {
       
   580             numberOfSlots = KSatNotifyPlayTonePCmdSlots;
       
   581             break;
       
   582             }
       
   583         case ESatNotifySetUpMenuPCmd:
       
   584             {
       
   585             numberOfSlots = KSatNotifySetUpMenuPCmdSlots;
       
   586             break;
       
   587             }
       
   588         case ESatNotifySelectItemPCmd:
       
   589             {
       
   590             numberOfSlots = KSatNotifySelectItemPCmdSlots;
       
   591             break;
       
   592             }
       
   593         case ESatNotifySendSmPCmd:
       
   594             {
       
   595             numberOfSlots = KSatNotifySendSmPCmdSlots;
       
   596             break;
       
   597             }
       
   598         case ESatNotifySendSsPCmd:
       
   599             {
       
   600             numberOfSlots = KSatNotifySendSsPCmdSlots;
       
   601             break;
       
   602             }
       
   603         case ESatNotifySendUssdPCmd:
       
   604             {
       
   605             numberOfSlots = KSatNotifySendUssdPCmdSlots;
       
   606             break;
       
   607             }
       
   608         case ESatNotifySetUpCallPCmd:
       
   609             {
       
   610             numberOfSlots = KSatNotifySetUpCallPCmdSlots;
       
   611             break;
       
   612             }
       
   613         case ESatNotifyRefreshPCmd:
       
   614             {
       
   615             numberOfSlots = KSatNotifyRefreshPCmdSlots;
       
   616             break;
       
   617             }
       
   618         case ESatNotifyProactiveSimSessionEnd:
       
   619             {
       
   620             numberOfSlots = KSatNotifyProactiveSimSessionEndSlots;
       
   621             break;
       
   622             }
       
   623         case ESatNotifySetUpIdleModeTextPCmd:
       
   624             {
       
   625             numberOfSlots = KSatNotifySetUpIdleModeTextPCmdSlots;
       
   626             break;
       
   627             }
       
   628         case ESatNotifyLaunchBrowserPCmd:
       
   629             {
       
   630             numberOfSlots = KSatNotifyLaunchBrowserSlots;
       
   631             break;
       
   632             }
       
   633         case ESatNotifyCallControlRequest:
       
   634             {
       
   635             numberOfSlots = KSatNotifyCallControlRequestSlots;
       
   636             break;
       
   637             }
       
   638         case ESatNotifySendDtmfPCmd:
       
   639             {
       
   640             numberOfSlots = KSatNotifySendDtmfSlots;
       
   641             break;
       
   642             }
       
   643         case ESatNotifySetUpEventListPCmd:
       
   644             {
       
   645             numberOfSlots = KSatNotifySetUpEventListSlots;
       
   646             break;
       
   647             }
       
   648         case ESatNotifyLanguageNotificationPCmd:
       
   649         	{
       
   650             numberOfSlots = KSatNotifySetUpEventListSlots;
       
   651             break;
       
   652         	}
       
   653         case ESatNotifyLocalInfoPCmd:
       
   654         case ESatNotifyOpenChannelPCmd:							
       
   655 	    case ESatNotifyCloseChannelPCmd:							
       
   656 	    case ESatNotifyReceiveDataPCmd:						
       
   657 	    case ESatNotifySendDataPCmd:								
       
   658 	    case ESatNotifyGetChannelStatusPCmd:
       
   659         case ESatNotifyMoSmControlRequest:
       
   660         	{
       
   661             numberOfSlots = KSatNotifySetUpEventListSlots;
       
   662             break;
       
   663         	}
       
   664         case ESatNotifyRefreshRequiredParam:
       
   665         case ESatRefreshAllowed:
       
   666         	{
       
   667         	// Default is set to one
       
   668         	break;        	
       
   669         	}
       
   670         default:
       
   671             {
       
   672             // Unknown or invalid IPC
       
   673             TFLOGSTRING2("CSAT: CSatTsy::NumberOfSlotsL, Unsupported IPC %d", 
       
   674                 aIpc);
       
   675             User::Leave( KErrNotSupported );
       
   676             break;
       
   677             }
       
   678         }  
       
   679     return numberOfSlots;
       
   680     }
       
   681 
       
   682 // -----------------------------------------------------------------------------
       
   683 // CSatTsy::ReqCompleted
       
   684 // Completes requests to ETel
       
   685 // -----------------------------------------------------------------------------
       
   686 //
       
   687 void CSatTsy::ReqCompleted
       
   688 		( 
       
   689 		TTsyReqHandle aReqHandle,
       
   690         TInt aRet 
       
   691         )
       
   692 	{
       
   693 	TFLOGSTRING2("CSAT: CSatTsy::ReqCompleted, ReqHandle=%d ", aReqHandle);
       
   694 #ifdef USING_CTSY_DISPATCHER
       
   695 	CTelObject::ReqCompleted( aReqHandle, aRet );
       
   696 #else
       
   697 	ReqCompleted( aReqHandle, aRet );
       
   698 #endif //USING_CTSY_DISPATCHER
       
   699 	}
       
   700 	
       
   701 // -----------------------------------------------------------------------------
       
   702 // CSatTsy::StoreCallConnectedEvent
       
   703 // Cache call connected envelope to CSatNotifySetUpCall class
       
   704 // -----------------------------------------------------------------------------
       
   705 //
       
   706 void CSatTsy::StoreCallConnectedEvent
       
   707         (
       
   708         const TDesC8& aEnvelope
       
   709         )
       
   710     {
       
   711     TFLOGSTRING("CSAT: CSatTsy::StoreCallConnectedEvent");
       
   712     iSatNotificationsTsy->SatNotifySetUpCall()->StoreCallConnectedEvent( 
       
   713         aEnvelope );
       
   714     }
       
   715 
       
   716 // -----------------------------------------------------------------------------
       
   717 // CSatTsy::SetSetUpCallStatus
       
   718 // Set Status of SetUpCall command to the CSatEventDownloadTsy class
       
   719 // -----------------------------------------------------------------------------
       
   720 //
       
   721 void CSatTsy::SetSetUpCallStatus
       
   722         (
       
   723         const TBool aStatus
       
   724         )
       
   725     {
       
   726     TFLOGSTRING("CSAT: CSatTsy::SetSetUpCallStatus");
       
   727     iSatEventDownloadTsy->SetSetUpCallStatus( aStatus );
       
   728     }
       
   729 
       
   730 // -----------------------------------------------------------------------------
       
   731 // CSatTsy::SetUpEventList
       
   732 // Sets events that are reported to NAA
       
   733 // -----------------------------------------------------------------------------
       
   734 //
       
   735 void CSatTsy::SetUpEventList
       
   736         (
       
   737         TUint32 aEvents     // events to be monitored
       
   738         ) 
       
   739     {
       
   740     TFLOGSTRING("CSAT: CSatTsy::SetUpEventList");
       
   741     iSatEventDownloadTsy->SetUpEventList( aEvents );
       
   742     }
       
   743 
       
   744 // -----------------------------------------------------------------------------
       
   745 // CSatTsy::MessageManager
       
   746 // This method returns a pointer to iMessageManager object.
       
   747 // -----------------------------------------------------------------------------
       
   748 //
       
   749 CMmMessageManagerBase* CSatTsy::MessageManager
       
   750         (
       
   751         // none
       
   752         )
       
   753     {
       
   754     TFLOGSTRING("CSAT: CSatTsy::MessageManager");
       
   755     return iMessageManager;
       
   756     }
       
   757 
       
   758 // -----------------------------------------------------------------------------
       
   759 // CSatTsy::SatCCTsy
       
   760 // This method returns a pointer to Call Control TSY object.
       
   761 // -----------------------------------------------------------------------------
       
   762 //
       
   763 CSatCCTsy* CSatTsy::SatCCTsy
       
   764         (
       
   765         // none
       
   766         )
       
   767     {
       
   768     TFLOGSTRING("CSAT: CSatTsy::SatCCTsy");
       
   769     return iSatCCTsy;
       
   770     }  
       
   771 
       
   772 // -----------------------------------------------------------------------------
       
   773 // CSatTsy::GetSatReqHandleStore
       
   774 // Returns iSatReqHandleStore pointer and control to calling object
       
   775 // -----------------------------------------------------------------------------
       
   776 //
       
   777 CSatTsyReqHandleStore* CSatTsy::GetSatReqHandleStore
       
   778 	    (
       
   779 	    //none
       
   780 	    )
       
   781 	{
       
   782     TFLOGSTRING("CSAT: CSatTsy::GetSatReqHandleStore");
       
   783 	return iSatReqHandleStore;
       
   784 	}
       
   785 
       
   786 // -----------------------------------------------------------------------------
       
   787 // CSatTsy::GetReqHandleType
       
   788 // Returns pointer to request handle type
       
   789 // -----------------------------------------------------------------------------
       
   790 //
       
   791 CSatTsy::TSatRequestTypes* CSatTsy::GetReqHandleType
       
   792 	    (
       
   793 	    //none
       
   794 	    )
       
   795 	{
       
   796     TFLOGSTRING("CSAT: CSatTsy::GetReqHandleType");
       
   797 	return &iReqHandleType;
       
   798 	}
       
   799 
       
   800 // -----------------------------------------------------------------------------
       
   801 // CSatTsy::CompleteSendSmsMessage
       
   802 // Message from MMSMS side that message sending has been completed
       
   803 // -----------------------------------------------------------------------------
       
   804 //
       
   805 TInt CSatTsy::CompleteSendSmsMessage
       
   806         (
       
   807         TInt aStatus 
       
   808         )
       
   809     {
       
   810     TFLOGSTRING("CSAT: CSatTsy::CompleteSendSmsMessage");
       
   811     
       
   812     // Reset req handle. Returns the deleted req handle
       
   813     TTsyReqHandle reqHandle = iSatNotificationsTsy->RequestHandleStore()->
       
   814         ResetTsyReqHandle( CSatTsy::ESatSendMessageNoLoggingReqType );
       
   815 		
       
   816 	// In case the request was ongoing, continue..
       
   817     if ( CSatTsy::ESatReqHandleUnknown != reqHandle )
       
   818         {
       
   819     	ReqCompleted( reqHandle, aStatus );
       
   820         }
       
   821     return KErrNone;
       
   822     }
       
   823     
       
   824 // -----------------------------------------------------------------------------
       
   825 // CSatTsy::IsMoSmControlBySimActivated
       
   826 // This method is required by CommonTSY, which needs to know whether the 
       
   827 // MoSmControlBySim is activated or not.
       
   828 // -----------------------------------------------------------------------------
       
   829 //
       
   830 TBool CSatTsy::IsMoSmControlBySimActivated
       
   831 		(
       
   832 		void
       
   833 		)
       
   834     {
       
   835     TFLOGSTRING("CSAT: CSatTsy::IsMoSmControlBySimActivated");
       
   836     return iSatNotificationsTsy->IsMoSmControlActivated();
       
   837     }
       
   838 
       
   839 #ifdef USING_CTSY_DISPATCHER
       
   840     /**
       
   841      * From MStkTsyCallOrigin 
       
   842      * Dummy implementation for IsSimOriginatedCall function
       
   843      *          
       
   844      * @param aAddress The number whose origin is required.
       
   845      * @return ETrue if call originates from a Proactive Command
       
   846      */ 
       
   847 TBool CSatTsy::IsSimOriginatedCall
       
   848 			(
       
   849 			const TDesC8& aAddress
       
   850 			)
       
   851 	{
       
   852 	TFLOGSTRING("CSAT: CSatTsy::IsSimOriginatedCall");
       
   853 	TBool ret = EFalse;
       
   854 	if (iSatCCTsy)
       
   855 		{
       
   856 		ret = iSatCCTsy->HasProactiveOrigin(aAddress);
       
   857 		}
       
   858 	return ret;
       
   859 	}
       
   860 #endif //USING_CTSY_DISPATCHER
       
   861 
       
   862 // -----------------------------------------------------------------------------
       
   863 // CSatTsy::StoreProactiveAddress
       
   864 // Stores latest address of Send SS/Setup call proactive command to CSatCC
       
   865 // (other items were commented in a header). Method is also called when 
       
   866 // proactive session is over with parameter NULL.
       
   867 // -----------------------------------------------------------------------------
       
   868 //    
       
   869 void CSatTsy::StoreProactiveAddress
       
   870         ( 
       
   871         const TDesC8* aAddress 
       
   872         )
       
   873     {
       
   874     TFLOGSTRING("CSAT: CSatTsy::StoreProactiveAddress");
       
   875     iSatCCTsy->StoreAddressForCC( *aAddress );
       
   876     }  
       
   877     
       
   878 // -----------------------------------------------------------------------------
       
   879 // CSatTsy::SetTonNpi
       
   880 // Stores Ton Npi to CSatCC
       
   881 // -----------------------------------------------------------------------------
       
   882 //    
       
   883 void CSatTsy::SetTonNpi
       
   884         ( 
       
   885         const TUint8 aTonNpi 
       
   886         )
       
   887     {
       
   888     TFLOGSTRING("CSAT: CSatTsy::SetTonNpi");
       
   889     iSatCCTsy->SetTonNpiForSS( aTonNpi );
       
   890     }  
       
   891     
       
   892 // -----------------------------------------------------------------------------
       
   893 // CSatTsy::DoExtFuncL
       
   894 // Dispatch to correct SAT Tsy/function according to the IPC
       
   895 // -----------------------------------------------------------------------------
       
   896 //
       
   897 TInt CSatTsy::DoExtFuncL
       
   898 		(
       
   899 		const TTsyReqHandle aTsyReqHandle,  
       
   900 		const TInt aIpc,           
       
   901 		const TDataPackage& aPackage	
       
   902 		)
       
   903     {
       
   904     TFLOGSTRING3("CSAT: CSatTsy::DoExtFuncL\t IPC:%d,\t Handle:%d",
       
   905            aIpc, aTsyReqHandle);
       
   906 	TInt ret( KErrNone );
       
   907 
       
   908 	// Add here ALL supported Sat request types, and call either the correct 
       
   909 	//	Sat Tsy to handle the request, or a request directly here in CSatTsy.
       
   910     switch ( aIpc )
       
   911         {
       
   912         // General
       
   913         case ESatMenuSelection:
       
   914             {
       
   915             ret = MenuSelectionL( aTsyReqHandle, 
       
   916 				reinterpret_cast<RSat::TMenuSelectionV1Pckg*>( 
       
   917 				aPackage.Des1n() ) );
       
   918             break;
       
   919             }
       
   920         case ESatSendMessageNoLogging:
       
   921             {
       
   922             SendMessageNoLogging( aPackage.Des1n(), aTsyReqHandle );
       
   923             break;
       
   924             }
       
   925         // Icon
       
   926         case ESatGetIcon:
       
   927 		case ESatGetImageInstance:
       
   928 		case ESatGetClut:
       
   929             {
       
   930             ret = iSatIconTsy->DoExtFuncL ( aTsyReqHandle, aIpc, aPackage );
       
   931             break;
       
   932             }
       
   933         // Notifications
       
   934         case ESatTerminalRsp:
       
   935         case ESatNotifyCallControlRequest:
       
   936         case ESatNotifyDisplayTextPCmd:
       
   937         case ESatNotifyGetInkeyPCmd:
       
   938         case ESatNotifyGetInputPCmd:
       
   939         case ESatNotifyPlayTonePCmd:
       
   940         case ESatNotifySetUpMenuPCmd:
       
   941         case ESatNotifySelectItemPCmd:
       
   942         case ESatNotifySendSmPCmd:
       
   943         case ESatNotifySendSsPCmd:
       
   944         case ESatNotifySendUssdPCmd:
       
   945         case ESatNotifySetUpCallPCmd:
       
   946 		case ESatNotifyRefreshPCmd:
       
   947         case ESatNotifyRefreshRequiredParam:
       
   948         case ESatRefreshAllowed:
       
   949         case ESatNotifySetUpEventListPCmd:
       
   950         case ESatNotifySetUpIdleModeTextPCmd:
       
   951         case ESatNotifySendDtmfPCmd:
       
   952         case ESatNotifyLanguageNotificationPCmd:
       
   953         case ESatNotifyLaunchBrowserPCmd:
       
   954         case ESatNotifyLocalInfoPCmd:   
       
   955         case ESatNotifyProactiveSimSessionEnd:
       
   956         case ESatNotifyOpenChannelPCmd:
       
   957         case ESatNotifyGetChannelStatusPCmd:
       
   958         case ESatNotifyCloseChannelPCmd:
       
   959         case ESatNotifySendDataPCmd:
       
   960         case ESatNotifyReceiveDataPCmd:
       
   961         case ESatNotifySmsPpDownload:
       
   962         case ESatNotifyCbDownload:
       
   963 		case ESatNotifyMoSmControlRequest:                    
       
   964             {
       
   965             iSatNotificationsTsy->DoExtFuncL ( aTsyReqHandle, aIpc, aPackage );
       
   966             break;
       
   967             }
       
   968         // EventDownload
       
   969         case ESatEventDownload:
       
   970             {
       
   971             ret = iSatEventDownloadTsy->DoExtFuncL ( aTsyReqHandle, aIpc, 
       
   972                 aPackage );
       
   973             break;
       
   974             }
       
   975         // Tsy internal requests
       
   976         // Not supported
       
   977         /*
       
   978         case ESatGetMeSideSatProfile:
       
   979         case ESatClientSatProfileIndication:
       
   980         case ESatUsatClientReadyIndication:
       
   981         case ESatGetProvisioningRefFile:
       
   982         case ESatNotifyRefreshRequired:
       
   983         // Notifications
       
   984         case ESatNotifyPerformCardApduPCmd:
       
   985         case ESatNotifyPowerOffCardPCmd:
       
   986         case ESatNotifyPowerOnCardPCmd:
       
   987         case ESatNotifyGetReaderStatusPCmd:
       
   988         case ESatNotifyRunAtCommandPCmd:
       
   989 		case ESatNotifyPollingOff:
       
   990 		case ESatNotifyPollingInterval:
       
   991         case ESatNotifyServiceSearchPCmd:
       
   992         case ESatNotifyGetServiceInfoPCmd:
       
   993         case ESatNotifyDeclareServicePCmd:
       
   994         case ESatNotifyProactiveSimSessionStart:
       
   995         case ESatNotifyTimerExpiration:
       
   996         case ESatNotifyTimerMgmtPCmd:
       
   997         case ESatNotifyTsyStateUpdated:
       
   998         */
       
   999 
       
  1000 		// Complete with KErrNotSupported, function not supported
       
  1001 		default:
       
  1002 			{
       
  1003 			TFLOGSTRING2("CSAT: CSatTsy::DoExtFuncL unsupported IPC %d", aIpc);
       
  1004 			ReqCompleted( aTsyReqHandle, KErrNotSupported );
       
  1005 			break;
       
  1006 			}
       
  1007         }
       
  1008 
       
  1009     return ret;
       
  1010     }
       
  1011 
       
  1012 // -----------------------------------------------------------------------------
       
  1013 // CSatTsy::MenuSelection
       
  1014 // Passes a menu selection response to DOS
       
  1015 // -----------------------------------------------------------------------------
       
  1016 //
       
  1017 TInt CSatTsy::MenuSelectionL
       
  1018 		(
       
  1019 		TTsyReqHandle   aTsyReqHandle,			
       
  1020 		RSat::TMenuSelectionV1Pckg* aSelection	
       
  1021 		) 
       
  1022     {
       
  1023     TFLOGSTRING("CSAT: CSatTsy::MenuSelection");
       
  1024     TInt ret( KErrNone );
       
  1025 
       
  1026 	// It should not be possible that the request is asked more than once at 
       
  1027 	// time, therefore we do not need to check whether it is already ongoing
       
  1028 
       
  1029 	RSat::TMenuSelectionV1& selectionV1 = ( *aSelection ) ();
       
  1030 	TFLOGSTRING3("CSAT:MenuSelection, iItemId %x, Help: %c", 
       
  1031 		selectionV1.iItemId, selectionV1.iHelp );
       
  1032 
       
  1033     TTlv tlvSpecificData;
       
  1034     
       
  1035     tlvSpecificData.Begin( KBerTlvMenuSelectionTag );
       
  1036     tlvSpecificData.AddTag( KTlvDeviceIdentityTag );
       
  1037     tlvSpecificData.AddByte( KKeypad );
       
  1038     tlvSpecificData.AddByte( KSim );
       
  1039     tlvSpecificData.AddTag( KTlvItemIdentifierTag );
       
  1040     tlvSpecificData.AddByte( selectionV1.iItemId );
       
  1041 
       
  1042 	// If user has requested help, add tag.
       
  1043     if ( RSat::EHelpRequested == selectionV1.iHelp )
       
  1044         {
       
  1045         tlvSpecificData.AddTag( KTlvHelpRequestTag );
       
  1046         }
       
  1047 
       
  1048 	// Pack parameter for DOS call.
       
  1049     TPtrC8 berTlv = tlvSpecificData.End();
       
  1050 	CSatDataPackage dataPackage;
       
  1051 	dataPackage.PackData( &berTlv );
       
  1052 
       
  1053 	ret = iMessageManager->HandleRequestL( ESatMenuSelection, &dataPackage );
       
  1054 
       
  1055 	if ( KErrNone == ret )
       
  1056         {
       
  1057     	// We must complete the request to the client right away, as an
       
  1058     	// indication that the request has been handled
       
  1059     	ReqCompleted( aTsyReqHandle, ret );    
       
  1060         }
       
  1061     
       
  1062     return ret; 
       
  1063     }
       
  1064 
       
  1065 // -----------------------------------------------------------------------------
       
  1066 // CSatTsy::SendMessageNoLogging
       
  1067 // Called by ETel server, passes SMS message to MMSMS
       
  1068 // -----------------------------------------------------------------------------
       
  1069 //
       
  1070 TInt CSatTsy::SendMessageNoLogging
       
  1071         (
       
  1072         TDes8* aMsg,           
       
  1073         TTsyReqHandle   aTsyReqHandle   
       
  1074         )
       
  1075     {
       
  1076     TFLOGSTRING("CSAT: CSatTsy::SendMessageNoLogging");
       
  1077     TInt ret( KErrNone );
       
  1078 	
       
  1079 	// Save the request handle
       
  1080     SaveReqHandle( aTsyReqHandle, ESatSendMessageNoLoggingReqType );
       
  1081 	
       
  1082     RSat::TSatSmsV1Pckg* aPckg = reinterpret_cast<RSat::TSatSmsV1Pckg*>( 
       
  1083         aMsg );
       
  1084     RSat::TSatSmsV1& satSmsV1 = ( *aPckg ) ();
       
  1085 
       
  1086     // SMS GSM extension checks that SCA length is not over the max limit
       
  1087     // that SMS allows
       
  1088 
       
  1089     // Check that we have a SCA address
       
  1090     if ( 0x0 < satSmsV1.iServiceCenter.iTelNumber.Length() )
       
  1091         {
       
  1092         // SCA number conversion from unicode to GSM 3.40 format 
       
  1093         // is done by MMSMS dll
       
  1094 
       
  1095         // Set SCA pointer
       
  1096         TDes16* sca;
       
  1097         sca = &satSmsV1.iServiceCenter.iTelNumber;
       
  1098 
       
  1099         // Type of Number, mapping from ETelSat format to MMETel format
       
  1100         RMobilePhone::TMobileTON numberType;
       
  1101         
       
  1102         switch ( satSmsV1.iServiceCenter.iTypeOfNumber )
       
  1103             {
       
  1104             case RSat::ETypeOfNumberNotSet:
       
  1105             case RSat::EUnknownNumber:
       
  1106             	{	
       
  1107                 numberType = RMobilePhone::EUnknownNumber;
       
  1108                 break;
       
  1109             	}
       
  1110             case RSat::EInternationalNumber:
       
  1111             	{
       
  1112                 numberType = RMobilePhone::EInternationalNumber;
       
  1113                 break;
       
  1114             	}
       
  1115             case RSat::ENationalNumber:
       
  1116             	{
       
  1117                 numberType = RMobilePhone::ENationalNumber;
       
  1118                 break;
       
  1119             	}
       
  1120             case RSat::ENetworkSpecificNumber:
       
  1121             	{
       
  1122                 numberType = RMobilePhone::ENetworkSpecificNumber;
       
  1123                 break;
       
  1124             	}
       
  1125             case RSat::EDedicatedNumber:
       
  1126             	{
       
  1127                 numberType = RMobilePhone::ESubscriberNumber;
       
  1128                 break;
       
  1129             	}
       
  1130             default:
       
  1131             	{
       
  1132                 // Unknown or invalid Type of Number
       
  1133                 numberType = RMobilePhone::EUnknownNumber;
       
  1134                 break;
       
  1135             	}
       
  1136             }
       
  1137 
       
  1138         // Numbering Plan, mapping from ETelSat format to MMETel format
       
  1139         RMobilePhone::TMobileNPI numberPlan;
       
  1140         switch ( satSmsV1.iServiceCenter.iNumberPlan )
       
  1141             {
       
  1142             case RSat::ENumberingPlanNotSet:
       
  1143             case RSat::EUnknownNumberingPlan:
       
  1144             	{
       
  1145                 numberPlan = RMobilePhone::EUnknownNumberingPlan;
       
  1146                 break;
       
  1147             	}
       
  1148             case RSat::EIsdnNumberPlan:
       
  1149             	{
       
  1150                 numberPlan = RMobilePhone::EIsdnNumberPlan;
       
  1151                 break;
       
  1152             	}
       
  1153             case RSat::EDataNumberPlan:
       
  1154             	{
       
  1155                 numberPlan = RMobilePhone::EDataNumberPlan;
       
  1156                 break;
       
  1157             	}
       
  1158             case RSat::ETelexNumberPlan:
       
  1159             	{
       
  1160                 numberPlan = RMobilePhone::ETelexNumberPlan;
       
  1161                 break;
       
  1162             	}
       
  1163             case RSat::ENationalNumberPlan:
       
  1164             	{
       
  1165                 numberPlan = RMobilePhone::ENationalNumberPlan;
       
  1166                 break;
       
  1167             	}
       
  1168             case RSat::EPrivateNumberPlan:
       
  1169             	{
       
  1170                 numberPlan = RMobilePhone::EPrivateNumberPlan;
       
  1171                 break;
       
  1172             	}
       
  1173             default:
       
  1174             	{
       
  1175                 // Unknown or invalid Numbering Plan
       
  1176                 numberPlan = RMobilePhone::EUnknownNumberingPlan;
       
  1177                 break;
       
  1178             	}
       
  1179             }
       
  1180 
       
  1181         // SMS message, Packet Data Unit
       
  1182         TDes8* pdu;
       
  1183         pdu = &satSmsV1.iBuf;
       
  1184 
       
  1185         // Call SMS sending function from MMSMS
       
  1186         ret = iSatService.SendSatMessage( *this, pdu, sca, &numberType, 
       
  1187                 &numberPlan, EFalse, aTsyReqHandle );
       
  1188         TFLOGSTRING2("CSAT: CSatTsy::SendMessageNoLogging, \
       
  1189                 SendSmsMessage done, ret: %x", ret);
       
  1190        
       
  1191        
       
  1192         }
       
  1193     else // SCA missing
       
  1194         {
       
  1195         ret = KErrGeneral;
       
  1196         TFLOGSTRING("CSAT: CSatTsy::SendMessageNoLogging, SCA missing");
       
  1197         }
       
  1198 
       
  1199     // Failure in sending of SAT SMS, call complete method
       
  1200     if ( KErrNone != ret )
       
  1201         {
       
  1202         CompleteSendSmsMessage( ret ); 
       
  1203         TFLOGSTRING("CSAT: CSatTsy::SendMessageNoLogging, \
       
  1204             failure sending SAT SMS, complete");
       
  1205         }
       
  1206     
       
  1207     return KErrNone;
       
  1208 
       
  1209     }     
       
  1210 
       
  1211 MmMessageManagerCallback* CSatTsy::GetMessageManagerCallback()    
       
  1212 {
       
  1213 	return iMessageManager->GetMessageManagerCallback();
       
  1214 }
       
  1215 
       
  1216 
       
  1217 //  End of File