telephonyserverplugins/ctsydispatchlayer/src/csatdispatcher.cpp
changeset 0 3553901f7fa8
child 19 630d2f34d719
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2008-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 //
       
    15 
       
    16 #include "csatdispatcher.h"
       
    17 
       
    18 #include <etelsat.h>
       
    19 #include <ctsy/ltsy/mltsydispatchfactory.h>
       
    20 #include <ctsy/ltsy/mltsydispatchsatinterface.h>
       
    21 #include <ctsy/pluginapi/mmmessagemanagercallback.h>
       
    22 #include <ctsy/serviceapi/mstktsycallorigin.h>
       
    23 #include <satcs.h>
       
    24 
       
    25 
       
    26 #include <ctsy/ltsy/ltsylogger.h>
       
    27 #include "ctsydispatcherpanic.h"
       
    28 #include "tdispatcherholder.h"
       
    29 #include <ctsy/ltsy/sat_defs.h>
       
    30 #include <ctsy/rmmcustomapi.h> //for ECustomSatRefreshCompleteNotificationIPC
       
    31 
       
    32 __DEBUG_ONLY(const TInt KNmrLength = 16;) //this value is the length of a buffer within commonstktsy - its not defined anywhere as a constant. 
       
    33 __DEBUG_ONLY(const TInt KBcchListLength = 32;)  //this value is the length of a buffer within commonstktsy - its not defined anywhere as a constant.
       
    34 
       
    35 //const TUint8 KBasicIconDataLength		= 2;
       
    36 //const TUint8 KColourIconDataLength		= KIconInfoLength;
       
    37 
       
    38 CSatDispatcher::CSatDispatcher(
       
    39 		MLtsyDispatchFactoryV1& aLtsyFactory,
       
    40 		MmMessageManagerCallback& aTsyMessageManagerCallback,
       
    41 		MmMessageManagerCallback& aSatMessageManagerCallback,
       
    42 		CRequestQueueOneShot& aRequestAsyncOneShot)
       
    43 	: 	iLtsyFactoryV1(aLtsyFactory),
       
    44 		iTsyMessageManagerCallback(aTsyMessageManagerCallback),
       
    45 		iMessageManagerCallback(aSatMessageManagerCallback),
       
    46 		iRequestAsyncOneShot(aRequestAsyncOneShot),
       
    47 		iLocalInfoOngoing(EFalse)
       
    48 	{
       
    49 	} // CSatDispatcher::CSatDispatcher
       
    50 
       
    51 	  
       
    52 CSatDispatcher::~CSatDispatcher()
       
    53 	{
       
    54 	} // CSatDispatcher::~CSatDispatcher
       
    55 
       
    56 
       
    57 CSatDispatcher* CSatDispatcher::NewLC(
       
    58 	MLtsyDispatchFactoryV1& aLtsyFactory,
       
    59 	MmMessageManagerCallback& aTsyMessageManagerCallback,
       
    60 	MmMessageManagerCallback& aSatMessageManagerCallback,
       
    61 	CRequestQueueOneShot& aRequestAsyncOneShot)
       
    62 	{
       
    63 	TSYLOGENTRYEXIT;
       
    64 	CSatDispatcher* self =
       
    65 		new (ELeave) CSatDispatcher(aLtsyFactory, aTsyMessageManagerCallback, aSatMessageManagerCallback, aRequestAsyncOneShot);
       
    66 	CleanupStack::PushL(self);
       
    67 	self->ConstructL();
       
    68 	return self;
       
    69 	} // CSatDispatcher::NewLC
       
    70 
       
    71 
       
    72 CSatDispatcher* CSatDispatcher::NewL(
       
    73 	MLtsyDispatchFactoryV1& aLtsyFactory,
       
    74 	MmMessageManagerCallback& aTsyMessageManagerCallback,
       
    75 	MmMessageManagerCallback& aSatMessageManagerCallback,
       
    76 	CRequestQueueOneShot& aRequestAsyncOneShot)
       
    77 	{
       
    78 	TSYLOGENTRYEXIT;
       
    79 	CSatDispatcher* self =
       
    80 		CSatDispatcher::NewLC(aLtsyFactory, aTsyMessageManagerCallback, aSatMessageManagerCallback, aRequestAsyncOneShot);
       
    81 	CleanupStack::Pop (self);
       
    82 	return self;
       
    83 	} // CSatDispatcher::NewL
       
    84 
       
    85 
       
    86 void CSatDispatcher::ConstructL()
       
    87 /**
       
    88  * Second phase constructor.
       
    89  */
       
    90 	{
       
    91 	TSYLOGENTRYEXIT;
       
    92 	
       
    93 	// Get the Licensee LTSY interfaces related to Sat functionality
       
    94 	// from the factory
       
    95 	
       
    96 	
       
    97 	if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSatFuncUnitId, MLtsyDispatchSatSmsDeliverReport::KLtsyDispatchSatSmsDeliverReportApiId))
       
    98 		{
       
    99 		TAny* smsDeliverReportInterface = NULL;
       
   100 		iLtsyFactoryV1.GetDispatchHandler(
       
   101 		       	MLtsyDispatchSatSmsDeliverReport::KLtsyDispatchSatSmsDeliverReportApiId,
       
   102 		       	smsDeliverReportInterface);
       
   103 		iLtsyDispatchSatSmsDeliverReport =
       
   104 				static_cast<MLtsyDispatchSatSmsDeliverReport*>(smsDeliverReportInterface);
       
   105         __ASSERT_DEBUG(iLtsyDispatchSatSmsDeliverReport, CtsyDispatcherPanic(EInvalidNullPtr));
       
   106   		}
       
   107 	
       
   108 	if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSatFuncUnitId, MLtsyDispatchSatGetImageInstance::KLtsyDispatchSatGetImageInstanceApiId))
       
   109 		{
       
   110 		TAny* getImageInstanceInterface = NULL;
       
   111 		iLtsyFactoryV1.GetDispatchHandler(
       
   112 		       	MLtsyDispatchSatGetImageInstance::KLtsyDispatchSatGetImageInstanceApiId,
       
   113 		       	getImageInstanceInterface);
       
   114 		iLtsyDispatchSatGetImageInstance =
       
   115 				static_cast<MLtsyDispatchSatGetImageInstance*>(getImageInstanceInterface);
       
   116         __ASSERT_DEBUG(iLtsyDispatchSatGetImageInstance, CtsyDispatcherPanic(EInvalidNullPtr));
       
   117   		}
       
   118 	
       
   119 	if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSatFuncUnitId, MLtsyDispatchSatGetIconData::KLtsyDispatchSatGetIconDataApiId))
       
   120 		{
       
   121 		TAny* getIconDataInterface = NULL;
       
   122 		iLtsyFactoryV1.GetDispatchHandler(
       
   123 		       	MLtsyDispatchSatGetIconData::KLtsyDispatchSatGetIconDataApiId,
       
   124 		       	getIconDataInterface);
       
   125 		iLtsyDispatchSatGetIconData =
       
   126 				static_cast<MLtsyDispatchSatGetIconData*>(getIconDataInterface);
       
   127         __ASSERT_DEBUG(iLtsyDispatchSatGetIconData, CtsyDispatcherPanic(EInvalidNullPtr));
       
   128   		}
       
   129 	
       
   130 	if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSatFuncUnitId, MLtsyDispatchSatGetClut::KLtsyDispatchSatGetClutApiId))
       
   131 		{
       
   132 		TAny* getClutInterface = NULL;
       
   133 		iLtsyFactoryV1.GetDispatchHandler(
       
   134 		       	MLtsyDispatchSatGetClut::KLtsyDispatchSatGetClutApiId,
       
   135 		       	getClutInterface);
       
   136 		iLtsyDispatchSatGetClut =
       
   137 				static_cast<MLtsyDispatchSatGetClut*>(getClutInterface);
       
   138         __ASSERT_DEBUG(iLtsyDispatchSatGetClut, CtsyDispatcherPanic(EInvalidNullPtr));
       
   139   		}
       
   140 	
       
   141 	if(iLtsyFactoryV1.IsDispatchInterfaceSupported(	KDispatchSatFuncUnitId, 
       
   142 													MLtsyDispatchSatGetDefaultBearerCapability::KLtsyDispatchSatGetDefaultBearerCapabilityApiId))
       
   143 		{
       
   144 		TAny* getDefaultBearerCapabilityInterface = NULL;
       
   145 		iLtsyFactoryV1.GetDispatchHandler(
       
   146 		       	MLtsyDispatchSatGetDefaultBearerCapability::KLtsyDispatchSatGetDefaultBearerCapabilityApiId,
       
   147 		       	getDefaultBearerCapabilityInterface);
       
   148 		iLtsyDispatchSatGetDefaultBearerCapability =
       
   149 				static_cast<MLtsyDispatchSatGetDefaultBearerCapability*>(getDefaultBearerCapabilityInterface);
       
   150         __ASSERT_DEBUG(iLtsyDispatchSatGetDefaultBearerCapability, CtsyDispatcherPanic(EInvalidNullPtr));
       
   151   		}
       
   152 	
       
   153 	if(iLtsyFactoryV1.IsDispatchInterfaceSupported(	KDispatchSatFuncUnitId, 
       
   154 													MLtsyDispatchSatGetSmsPpDownloadSupported::KLtsyDispatchSatGetSmsPpDownloadSupportedApiId))
       
   155 		{
       
   156 		TAny* smsPpDdlStatusInterface = NULL;
       
   157 		iLtsyFactoryV1.GetDispatchHandler(
       
   158 		       	MLtsyDispatchSatGetSmsPpDownloadSupported::KLtsyDispatchSatGetSmsPpDownloadSupportedApiId,
       
   159 		       	smsPpDdlStatusInterface);
       
   160 		iLtsyDispatchSatGetSmsPpDownloadSupported =
       
   161 				static_cast<MLtsyDispatchSatGetSmsPpDownloadSupported*>(smsPpDdlStatusInterface);
       
   162         __ASSERT_DEBUG(iLtsyDispatchSatGetSmsPpDownloadSupported, CtsyDispatcherPanic(EInvalidNullPtr));
       
   163   		}
       
   164 	
       
   165 	if(iLtsyFactoryV1.IsDispatchInterfaceSupported(	KDispatchSatFuncUnitId, 
       
   166 													MLtsyDispatchSatGetSmsControlActivated::KLtsyDispatchSatGetSmsControlActivatedApiId))
       
   167 		{
       
   168 		TAny* getSmsControlActivatedInterface = NULL;
       
   169 		iLtsyFactoryV1.GetDispatchHandler(
       
   170 		       	MLtsyDispatchSatGetSmsControlActivated::KLtsyDispatchSatGetSmsControlActivatedApiId,
       
   171 		       	getSmsControlActivatedInterface);
       
   172 		iLtsyDispatchSatGetSmsControlActivated =
       
   173 				static_cast<MLtsyDispatchSatGetSmsControlActivated*>(getSmsControlActivatedInterface);
       
   174         __ASSERT_DEBUG(iLtsyDispatchSatGetSmsControlActivated, CtsyDispatcherPanic(EInvalidNullPtr));
       
   175   		}
       
   176 
       
   177 	if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSatFuncUnitId, MLtsyDispatchSatGetAccessTechnology::KLtsyDispatchSatGetAccessTechnologyApiId))
       
   178 		{
       
   179 		TAny* accTechInterface = NULL;
       
   180 		iLtsyFactoryV1.GetDispatchHandler(
       
   181 		       	MLtsyDispatchSatGetAccessTechnology::KLtsyDispatchSatGetAccessTechnologyApiId,
       
   182 		       	accTechInterface);
       
   183 		iLtsyDispatchSatAccTech =
       
   184 				static_cast<MLtsyDispatchSatGetAccessTechnology*>(accTechInterface);
       
   185         __ASSERT_DEBUG(iLtsyDispatchSatAccTech, CtsyDispatcherPanic(EInvalidNullPtr));
       
   186    		}
       
   187 	
       
   188 	if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSatFuncUnitId, MLtsyDispatchSatCellBroadcastEnvelope::KLtsyDispatchSatCellBroadcastEnvelopeApiId))
       
   189 		{
       
   190 		TAny* cellBroadcastInterface = NULL;
       
   191 		iLtsyFactoryV1.GetDispatchHandler(
       
   192 		       	MLtsyDispatchSatCellBroadcastEnvelope::KLtsyDispatchSatCellBroadcastEnvelopeApiId,
       
   193 		       	cellBroadcastInterface);
       
   194 		iLtsyDispatchSatCellBroadcast =
       
   195 				static_cast<MLtsyDispatchSatCellBroadcastEnvelope*>(cellBroadcastInterface);
       
   196         __ASSERT_DEBUG(iLtsyDispatchSatCellBroadcast, CtsyDispatcherPanic(EInvalidNullPtr));
       
   197   		}
       
   198 	
       
   199 	if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSatFuncUnitId, MLtsyDispatchSatTimingAdvance::KLtsyDispatchSatTimingAdvanceApiId))
       
   200 		{
       
   201 		TAny* timingAdvanceInterface = NULL;
       
   202 		iLtsyFactoryV1.GetDispatchHandler(
       
   203 		       	MLtsyDispatchSatTimingAdvance::KLtsyDispatchSatTimingAdvanceApiId,
       
   204 		       	timingAdvanceInterface);
       
   205 		iLtsyDispatchSatTimingAdvance =
       
   206 				static_cast<MLtsyDispatchSatTimingAdvance*>(timingAdvanceInterface);
       
   207         __ASSERT_DEBUG(iLtsyDispatchSatTimingAdvance, CtsyDispatcherPanic(EInvalidNullPtr));
       
   208   		}
       
   209 	
       
   210 	if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSatFuncUnitId, MLtsyDispatchSatSmControlResponseData::KLtsyDispatchSatSmControlResponseDataApiId))
       
   211 		{
       
   212 		TAny* smControlResponseDataInterface = NULL;
       
   213 		iLtsyFactoryV1.GetDispatchHandler(
       
   214 		       	MLtsyDispatchSatSmControlResponseData::KLtsyDispatchSatSmControlResponseDataApiId,
       
   215 		       	smControlResponseDataInterface);
       
   216 		iLtsyDispatchSatSmControlResponseData =
       
   217 				static_cast<MLtsyDispatchSatSmControlResponseData*>(smControlResponseDataInterface);
       
   218         __ASSERT_DEBUG(iLtsyDispatchSatSmControlResponseData, CtsyDispatcherPanic(EInvalidNullPtr));
       
   219   		}
       
   220 	
       
   221 	if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSatFuncUnitId, MLtsyDispatchSatProvideLocationInfo::KLtsyDispatchSatProvideLocationInfoApiId))
       
   222 		{
       
   223 		TAny* provideLocationInfoInterface = NULL;
       
   224 		iLtsyFactoryV1.GetDispatchHandler(
       
   225 		       	MLtsyDispatchSatProvideLocationInfo::KLtsyDispatchSatProvideLocationInfoApiId,
       
   226 		       	provideLocationInfoInterface);
       
   227 		iLtsyDispatchSatProvideLocationInfo =
       
   228 				static_cast<MLtsyDispatchSatProvideLocationInfo*>(provideLocationInfoInterface);
       
   229         __ASSERT_DEBUG(iLtsyDispatchSatProvideLocationInfo, CtsyDispatcherPanic(EInvalidNullPtr));
       
   230   		}
       
   231 	
       
   232 	if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSatFuncUnitId, MLtsyDispatchSatSetPollingInterval::KLtsyDispatchSatSetPollingIntervalApiId))
       
   233 		{
       
   234 		TAny* setPollingIntervalInterface = NULL;
       
   235 		iLtsyFactoryV1.GetDispatchHandler(
       
   236 		       	MLtsyDispatchSatSetPollingInterval::KLtsyDispatchSatSetPollingIntervalApiId,
       
   237 		       	setPollingIntervalInterface);
       
   238 		iLtsyDispatchSatSetPollingInterval =
       
   239 				static_cast<MLtsyDispatchSatSetPollingInterval*>(setPollingIntervalInterface);
       
   240         __ASSERT_DEBUG(iLtsyDispatchSatSetPollingInterval, CtsyDispatcherPanic(EInvalidNullPtr));
       
   241   		}
       
   242 	
       
   243 	if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSatFuncUnitId, MLtsyDispatchSatSmsPpDownloadEnvelope::KLtsyDispatchSatSmsPpDownloadEnvelopeApiId))
       
   244 		{
       
   245 		TAny* smsPpDownloadEnvelopeInterface = NULL;
       
   246 		iLtsyFactoryV1.GetDispatchHandler(
       
   247 		       	MLtsyDispatchSatSmsPpDownloadEnvelope::KLtsyDispatchSatSmsPpDownloadEnvelopeApiId,
       
   248 		       	smsPpDownloadEnvelopeInterface);
       
   249 		iLtsyDispatchSatSmsPpDownloadEnvelope =
       
   250 				static_cast<MLtsyDispatchSatSmsPpDownloadEnvelope*>(smsPpDownloadEnvelopeInterface);
       
   251         __ASSERT_DEBUG(iLtsyDispatchSatSmsPpDownloadEnvelope, CtsyDispatcherPanic(EInvalidNullPtr));
       
   252   		}
       
   253 	
       
   254 	if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSatFuncUnitId, MLtsyDispatchSatLocalInformationNmr::KLtsyDispatchSatLocalInformationNmrApiId))
       
   255 		{
       
   256 		TAny* localInformationNmrInterface = NULL;
       
   257 		iLtsyFactoryV1.GetDispatchHandler(
       
   258 		       	MLtsyDispatchSatLocalInformationNmr::KLtsyDispatchSatLocalInformationNmrApiId,
       
   259 		       	localInformationNmrInterface);
       
   260 		iLtsyDispatchSatLocalInformationNmr =
       
   261 				static_cast<MLtsyDispatchSatLocalInformationNmr*>(localInformationNmrInterface);
       
   262         __ASSERT_DEBUG(iLtsyDispatchSatLocalInformationNmr, CtsyDispatcherPanic(EInvalidNullPtr));
       
   263   		}
       
   264 	
       
   265 	if(iLtsyFactoryV1.IsDispatchInterfaceSupported(	KDispatchSatFuncUnitId, 
       
   266 													MLtsyDispatchSatCallAndSmsControlEnvelope::KLtsyDispatchSatCallAndSmsControlEnvelopeApiId))
       
   267 		{
       
   268 		TAny* callAndSmsControlEnvelopeInterface = NULL;
       
   269 		iLtsyFactoryV1.GetDispatchHandler(
       
   270 		       	MLtsyDispatchSatCallAndSmsControlEnvelope::KLtsyDispatchSatCallAndSmsControlEnvelopeApiId,
       
   271 		       	callAndSmsControlEnvelopeInterface);
       
   272 		iLtsyDispatchSatSendEnvelope =
       
   273 				static_cast<MLtsyDispatchSatCallAndSmsControlEnvelope*>(callAndSmsControlEnvelopeInterface);
       
   274         __ASSERT_DEBUG(iLtsyDispatchSatSendEnvelope, CtsyDispatcherPanic(EInvalidNullPtr));
       
   275   		}
       
   276 	
       
   277 	if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSatFuncUnitId, MLtsyDispatchSatRefreshAllowed::KLtsyDispatchSatRefreshAllowedApiId))
       
   278 		{
       
   279 		TAny* refreshAllowedInterface = NULL;
       
   280 		iLtsyFactoryV1.GetDispatchHandler(
       
   281 		       	MLtsyDispatchSatRefreshAllowed::KLtsyDispatchSatRefreshAllowedApiId,
       
   282 		       	refreshAllowedInterface);
       
   283 		iLtsyDispatchSatRefreshAllowed =
       
   284 				static_cast<MLtsyDispatchSatRefreshAllowed*>(refreshAllowedInterface);
       
   285         __ASSERT_DEBUG(iLtsyDispatchSatRefreshAllowed, CtsyDispatcherPanic(EInvalidNullPtr));
       
   286   		}
       
   287 	
       
   288 	if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSatFuncUnitId, MLtsyDispatchSatReady::KLtsyDispatchSatReadyApiId))
       
   289 		{
       
   290 		TAny* readyInterface = NULL;
       
   291 		iLtsyFactoryV1.GetDispatchHandler(
       
   292 		       	MLtsyDispatchSatReady::KLtsyDispatchSatReadyApiId,
       
   293 		       	readyInterface);
       
   294 		iLtsyDispatchSatReady =
       
   295 				static_cast<MLtsyDispatchSatReady*>(readyInterface);
       
   296         __ASSERT_DEBUG(iLtsyDispatchSatReady, CtsyDispatcherPanic(EInvalidNullPtr));
       
   297   		}
       
   298 	
       
   299 	if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSatFuncUnitId, MLtsyDispatchSatPCmdNotification::KLtsyDispatchSatPCmdNotificationApiId))
       
   300 		{
       
   301 		TAny* pCmdNotificationInterface = NULL;
       
   302 		iLtsyFactoryV1.GetDispatchHandler(
       
   303 		       	MLtsyDispatchSatPCmdNotification::KLtsyDispatchSatPCmdNotificationApiId,
       
   304 		       	pCmdNotificationInterface);
       
   305 		iLtsyDispatchSatPCmdNotification =
       
   306 				static_cast<MLtsyDispatchSatPCmdNotification*>(pCmdNotificationInterface);
       
   307         __ASSERT_DEBUG(iLtsyDispatchSatPCmdNotification, CtsyDispatcherPanic(EInvalidNullPtr));
       
   308   		}
       
   309 
       
   310 	if(iLtsyFactoryV1.IsDispatchInterfaceSupported(	KDispatchSatFuncUnitId, 
       
   311 													MLtsyDispatchSatUssdControlEnvelopeError::KLtsyDispatchSatUssdControlEnvelopeErrorApiId))
       
   312 		{
       
   313 		TAny* envelopeErrorInterface = NULL;
       
   314 		iLtsyFactoryV1.GetDispatchHandler(
       
   315 		       	MLtsyDispatchSatUssdControlEnvelopeError::KLtsyDispatchSatUssdControlEnvelopeErrorApiId,
       
   316 		       	envelopeErrorInterface);
       
   317 		iLtsyDispatchSatUssdControlEnvelopeError =
       
   318 				static_cast<MLtsyDispatchSatUssdControlEnvelopeError*>(envelopeErrorInterface);
       
   319         __ASSERT_DEBUG(iLtsyDispatchSatUssdControlEnvelopeError, CtsyDispatcherPanic(EInvalidNullPtr));
       
   320   		}
       
   321 	
       
   322 	if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSatFuncUnitId, MLtsyDispatchSatTimerExpirationEnvelope::KLtsyDispatchSatTimerExpirationEnvelopeApiId))
       
   323 		{
       
   324 		TAny* timerExpirationEnvelopInterface = NULL;
       
   325 		iLtsyFactoryV1.GetDispatchHandler(
       
   326 		       	MLtsyDispatchSatTimerExpirationEnvelope::KLtsyDispatchSatTimerExpirationEnvelopeApiId,
       
   327 		       	timerExpirationEnvelopInterface);
       
   328 		iLtsyDispatchSatTimerExpired =
       
   329 				static_cast<MLtsyDispatchSatTimerExpirationEnvelope*>(timerExpirationEnvelopInterface);
       
   330         __ASSERT_DEBUG(iLtsyDispatchSatTimerExpired, CtsyDispatcherPanic(EInvalidNullPtr));
       
   331   		}
       
   332 	
       
   333 	if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSatFuncUnitId, MLtsyDispatchSatTerminalRsp::KLtsyDispatchSatTerminalRspApiId))
       
   334 		{
       
   335 		TAny* terminalRspInterface = NULL;
       
   336 		iLtsyFactoryV1.GetDispatchHandler(
       
   337 		       	MLtsyDispatchSatTerminalRsp::KLtsyDispatchSatTerminalRspApiId,
       
   338 		       	terminalRspInterface);
       
   339 		iLtsyDispatchSatTerminalRsp =
       
   340 				static_cast<MLtsyDispatchSatTerminalRsp*>(terminalRspInterface);
       
   341         __ASSERT_DEBUG(iLtsyDispatchSatTerminalRsp, CtsyDispatcherPanic(EInvalidNullPtr));
       
   342   		}
       
   343 	
       
   344 	if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSatFuncUnitId, MLtsyDispatchSatMenuSelectionEnvelope::KLtsyDispatchSatMenuSelectionEnvelopeApiId))
       
   345 		{
       
   346 		TAny* menuSelectionEnvelopeInterface = NULL;
       
   347 		iLtsyFactoryV1.GetDispatchHandler(
       
   348 		       	MLtsyDispatchSatMenuSelectionEnvelope::KLtsyDispatchSatMenuSelectionEnvelopeApiId,
       
   349 		       	menuSelectionEnvelopeInterface);
       
   350 		iLtsyDispatchSatMenuSelection =
       
   351 				static_cast<MLtsyDispatchSatMenuSelectionEnvelope*>(menuSelectionEnvelopeInterface);
       
   352         __ASSERT_DEBUG(iLtsyDispatchSatMenuSelection, CtsyDispatcherPanic(EInvalidNullPtr));
       
   353   		}
       
   354 	
       
   355 	if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSatFuncUnitId, MLtsyDispatchSatEventDownloadEnvelope::KLtsyDispatchSatEventDownloadEnvelopeApiId))
       
   356 		{
       
   357 		TAny* eventDownloadEnvelopeInterface = NULL;
       
   358 		iLtsyFactoryV1.GetDispatchHandler(
       
   359 		       	MLtsyDispatchSatEventDownloadEnvelope::KLtsyDispatchSatEventDownloadEnvelopeApiId,
       
   360 		       	eventDownloadEnvelopeInterface);
       
   361 		iLtsyDispatchSatEventDownload =
       
   362 				static_cast<MLtsyDispatchSatEventDownloadEnvelope*>(eventDownloadEnvelopeInterface);
       
   363         __ASSERT_DEBUG(iLtsyDispatchSatEventDownload, CtsyDispatcherPanic(EInvalidNullPtr));
       
   364   		}
       
   365 	
       
   366 	if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSatFuncUnitId, MLtsyDispatchSatGetUssdControlSupported::KLtsyDispatchSatGetUssdControlSupportedApiId))
       
   367 		{
       
   368 		TAny* GetUssdControlSupportedInterface = NULL;
       
   369 		iLtsyFactoryV1.GetDispatchHandler(
       
   370 				MLtsyDispatchSatGetUssdControlSupported::KLtsyDispatchSatGetUssdControlSupportedApiId,
       
   371 		       	GetUssdControlSupportedInterface);
       
   372 		iLtsyDispatchSatGetUssdControlSupported =
       
   373 				static_cast<MLtsyDispatchSatGetUssdControlSupported*>(GetUssdControlSupportedInterface);
       
   374         __ASSERT_DEBUG(iLtsyDispatchSatGetUssdControlSupported, CtsyDispatcherPanic(EInvalidNullPtr));
       
   375   		}
       
   376 	
       
   377 	
       
   378 	} // CSatDispatcher::ConstructL
       
   379 
       
   380 void CSatDispatcher::SetDispatcherHolder(TDispatcherHolder& aDispatcherHolder)
       
   381 /**
       
   382  * Set the dispatcher holder.  
       
   383  * 
       
   384  * @param aDispatcherHolder Reference to dispatcher holder.
       
   385  */
       
   386 	{
       
   387 	TSYLOGENTRYEXIT;
       
   388 	
       
   389 	iDispatcherHolder = &aDispatcherHolder;
       
   390 	} // CSatDispatcher::SetDispatcherHolder
       
   391 
       
   392 /**
       
   393  * Allows the CTSY Dispatcher to ascertain
       
   394  * whether a call was requested by a Proactive Command.
       
   395  *          
       
   396  * @param aSatCallOrigin Interface to the cstktsy
       
   397  */
       
   398 
       
   399 void CSatDispatcher::SetSatCallOriginInterface(MStkTsyCallOrigin& aSatCallOrigin)
       
   400 	{
       
   401 	TSYLOGENTRYEXIT;
       
   402 	iStkTsyCallOrigin = &aSatCallOrigin;
       
   403 	}
       
   404 
       
   405 TBool CSatDispatcher::IsSimOriginatedCall(const RMobilePhone::TMobileAddress& aDialledParty)
       
   406 /**
       
   407  * Checks if the dialled party details passed into this function orignally came 
       
   408  * from the SIM. e.g. From a SET UP CALL proactive command. 
       
   409  * 
       
   410  * @param aDialledParty The dialled party details.
       
   411  * @return ETrue if the details did originally come from the SIM, EFalse otherwise.
       
   412  */
       
   413 	{
       
   414 	TSYLOGENTRYEXIT;	
       
   415 	TInt ret = EFalse;
       
   416 
       
   417 	 if (iStkTsyCallOrigin)
       
   418 		{
       
   419 		//convert 16-bit ascii to 8-bit ascii.
       
   420 		TBuf8<RMobilePhone::KMaxMobileTelNumberSize> address;
       
   421 		address.Copy(aDialledParty.iTelNumber);
       
   422 		ret = iStkTsyCallOrigin->IsSimOriginatedCall(address);
       
   423 		}
       
   424 	return ret;
       
   425 	} // CSatDispatcher::IsSimOriginatedCall
       
   426 
       
   427 
       
   428 void CSatDispatcher::CompleteNotifyLocalInfo(TInt aError)
       
   429 	{
       
   430 	//send off the in progress terminal response now that we have collected the required information for it.
       
   431 	if (iLocalInfoOngoing)
       
   432 		{
       
   433 		TTerminalRespData resp;
       
   434 		if (KErrNone == aError)
       
   435 			{
       
   436 			resp.iGeneralResult = RSat::KSuccess;
       
   437 			resp.iAdditionalInfo.Zero();
       
   438 			}
       
   439 		else
       
   440 			{
       
   441 			resp.iGeneralResult = RSat::KMeUnableToProcessCmd;
       
   442 			resp.iAdditionalInfo.Zero();
       
   443 			resp.iAdditionalInfo.Append( RSat::KNoSpecificMeProblem );
       
   444 			}
       
   445 		CMmDataPackage dataPackage;
       
   446 		dataPackage.PackData(&resp);
       
   447 		iMessageManagerCallback.Complete(ESatTsyNotifyLocalInfo, &dataPackage, aError);
       
   448 		
       
   449 		iLocalInfoOngoing = EFalse;
       
   450 		}
       
   451 	} //CSatDispatcher::CompleteNotifyLocalInfo
       
   452 
       
   453 
       
   454 TInt CSatDispatcher::DispatchSmsDeliverReportL(const CMmDataPackage* aDataPackage)
       
   455 /**
       
   456  * Unpack data related to ESatTsySmsDeliverReport
       
   457  * and pass request on to Licensee LTSY.
       
   458  *
       
   459  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
   460  *
       
   461  * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if
       
   462  * the Licensee LTSY does not support this request.
       
   463  */
       
   464 	{
       
   465 	TSYLOGENTRYEXIT;
       
   466 	TInt ret = KErrNotSupported;
       
   467 
       
   468 	__ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr));
       
   469 
       
   470     TBuf8<KTpduMaxSize>* reportData = NULL;
       
   471 	aDataPackage->UnPackData(&reportData);
       
   472 
       
   473 	__ASSERT_DEBUG(reportData, CtsyDispatcherPanic(EInvalidNullPtr));
       
   474 	// Call Handle... method in Licensee LTSY
       
   475 	if (iLtsyDispatchSatSmsDeliverReport)
       
   476 		{
       
   477 		ret = iLtsyDispatchSatSmsDeliverReport->HandleSmsDeliverReportReqL(*reportData);
       
   478 		}
       
   479 
       
   480 	return TSYLOGSETEXITERR(ret);
       
   481 	} // CSatDispatcher::DispatchSmsDeliverReportL
       
   482 
       
   483 TInt CSatDispatcher::DispatchGetImageInstanceL(const CMmDataPackage* aDataPackage)
       
   484 /**
       
   485  * Unpack data related to ESatTsyGetImageInstance
       
   486  * and pass request on to Licensee LTSY.
       
   487  *
       
   488  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
   489  *
       
   490  * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if
       
   491  * the Licensee LTSY does not support this request.
       
   492  */
       
   493 	{
       
   494 	TSYLOGENTRYEXIT;
       
   495 	TInt ret = KErrNotSupported;
       
   496 
       
   497 	__ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr));
       
   498 	TBuf8<KGetIconDataPckgLength> data;
       
   499 	aDataPackage->UnPackData(data);
       
   500 
       
   501 	__ASSERT_DEBUG(data.Length() == KGetIconDataPckgLength, CtsyDispatcherPanic(EBadLength));
       
   502 	// Call Handle... method in Licensee LTSY
       
   503 	if (iLtsyDispatchSatGetImageInstance)
       
   504 		{
       
   505 		//data[0] Record number
       
   506 		//data[1] Image instance number in the record
       
   507 		ret = iLtsyDispatchSatGetImageInstance->HandleGetImageInstanceReqL(data[0],data[1]);
       
   508 		}
       
   509 
       
   510 	return TSYLOGSETEXITERR(ret);
       
   511 	} // CSatDispatcher::DispatchGetImageInstanceL
       
   512 
       
   513 
       
   514 TInt CSatDispatcher::DispatchGetIconDataL(const CMmDataPackage* aDataPackage)
       
   515 /**
       
   516  * Unpack data related to ESatTsyGetIconData
       
   517  * and pass request on to Licensee LTSY.
       
   518  *
       
   519  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
   520  *
       
   521  * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if
       
   522  * the Licensee LTSY does not support this request.
       
   523  */
       
   524 	{
       
   525 	TSYLOGENTRYEXIT;
       
   526 	TInt ret = KErrNotSupported;
       
   527 	__ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr));
       
   528 	
       
   529 	TIconInfo* iconInfo = NULL;
       
   530 	aDataPackage->UnPackData(&iconInfo);
       
   531 	
       
   532 	__ASSERT_DEBUG(iconInfo, CtsyDispatcherPanic(EInvalidNullPtr));
       
   533 
       
   534 	// Call Handle... method in Licensee LTSY
       
   535 	if (iLtsyDispatchSatGetIconData)
       
   536 		{
       
   537 		const TInt KBitsToShiftForDivisonBy256 = 8;
       
   538 		// iconInfo.iOffset >> 8 undoes the conversion from the record number
       
   539 		// to an offset done in the CTSY.
       
   540 		ret = iLtsyDispatchSatGetIconData->HandleGetIconDataReqL(iconInfo->iOffset >> KBitsToShiftForDivisonBy256,iconInfo->iSimFilePath);
       
   541 		}
       
   542 
       
   543 	return TSYLOGSETEXITERR(ret);
       
   544 	} // CSatDispatcher::DispatchGetIconDataL
       
   545 
       
   546 TInt CSatDispatcher::DispatchGetClutL(const CMmDataPackage* aDataPackage)
       
   547 /**
       
   548  * Unpack data related to ESatTsyGetClut
       
   549  * and pass request on to Licensee LTSY.
       
   550  *
       
   551  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
   552  *
       
   553  * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if
       
   554  * the Licensee LTSY does not support this request.
       
   555  */
       
   556 	{
       
   557 	TSYLOGENTRYEXIT;
       
   558 	TInt ret = KErrNotSupported;
       
   559 
       
   560 	__ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr));
       
   561 	TBuf8<KGetIconDataPckgLength> data;
       
   562 	aDataPackage->UnPackData(data); 
       
   563 
       
   564 	__ASSERT_DEBUG(data.Length() == KGetIconDataPckgLength, CtsyDispatcherPanic(EBadLength));
       
   565 	// Call Handle... method in Licensee LTSY
       
   566 	if (iLtsyDispatchSatGetClut)
       
   567 		{
       
   568 		//data[0] Record number
       
   569 		//data[1] Instance number in the record
       
   570 		ret = iLtsyDispatchSatGetClut->HandleGetClutReqL(data[0], data[1]);
       
   571 		}
       
   572 	
       
   573 	return TSYLOGSETEXITERR(ret);
       
   574 	} // CSatDispatcher::DispatchGetClutL
       
   575 
       
   576 TInt CSatDispatcher::DispatchGetDefaultBearerCapabilityL()
       
   577 /**
       
   578  * Unpack data related to ESatTsyGetBearerCapability
       
   579  * and pass request on to Licensee LTSY.
       
   580  *
       
   581  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
   582  *
       
   583  * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if
       
   584  * the Licensee LTSY does not support this request.
       
   585  */
       
   586 	{
       
   587 	TSYLOGENTRYEXIT;
       
   588 	TInt ret = KErrNotSupported;
       
   589 
       
   590 	// Call Handle... method in Licensee LTSY
       
   591 	if (iLtsyDispatchSatGetDefaultBearerCapability)
       
   592 		{
       
   593 		ret = iLtsyDispatchSatGetDefaultBearerCapability->HandleGetDefaultBearerCapabilityReqL();
       
   594 		}
       
   595 
       
   596 	return TSYLOGSETEXITERR(ret);
       
   597 	} // CSatDispatcher::DispatchGetDefaultBearerCapabilityL
       
   598 
       
   599 TInt CSatDispatcher::DispatchSmsPpDdlStatusL()
       
   600 /**
       
   601  * Unpack data related to ESatTsySmsPpDdlStatus
       
   602  * and pass request on to Licensee LTSY.
       
   603  *
       
   604  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
   605  *
       
   606  * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if
       
   607  * the Licensee LTSY does not support this request.
       
   608  */
       
   609 	{
       
   610 	TSYLOGENTRYEXIT;
       
   611 	TInt ret = KErrNotSupported;
       
   612 
       
   613 	// Call Handle... method in Licensee LTSY
       
   614 	if (iLtsyDispatchSatGetSmsPpDownloadSupported)
       
   615 		{
       
   616 		ret = iLtsyDispatchSatGetSmsPpDownloadSupported->HandleGetSmsPpDownloadSupportedReqL();
       
   617 		}
       
   618 
       
   619 	return TSYLOGSETEXITERR(ret);
       
   620 	} // CSatDispatcher::DispatchSmsPpDdlStatusL
       
   621 
       
   622 TInt CSatDispatcher::DispatchGetSmsControlActivatedL()
       
   623 /**
       
   624  * Unpack data related to ESatTsyMoSmsControlActivation
       
   625  * and pass request on to Licensee LTSY.
       
   626  *
       
   627  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
   628  *
       
   629  * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if
       
   630  * the Licensee LTSY does not support this request.
       
   631  */
       
   632 	{
       
   633 	TSYLOGENTRYEXIT;
       
   634 	TInt ret = KErrNotSupported;
       
   635 
       
   636 	// Call Handle... method in Licensee LTSY
       
   637 	if (iLtsyDispatchSatGetSmsControlActivated)
       
   638 		{
       
   639 		ret = iLtsyDispatchSatGetSmsControlActivated->HandleGetSmsControlActivatedReqL();
       
   640 		}
       
   641 
       
   642 	return TSYLOGSETEXITERR(ret);
       
   643 	} // CSatDispatcher::DispatchGetSmsControlActivatedL
       
   644 
       
   645 TInt CSatDispatcher::DispatchCellBroadcastL(const CMmDataPackage* aDataPackage)
       
   646 /**
       
   647  * Unpack data related to ESatTsyCellBroadcast
       
   648  * and pass request on to Licensee LTSY.
       
   649  *
       
   650  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
   651  *
       
   652  * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if
       
   653  * the Licensee LTSY does not support this request.
       
   654  */
       
   655 	{
       
   656 	TSYLOGENTRYEXIT;
       
   657 	TInt ret = KErrNotSupported;
       
   658 
       
   659 	__ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr));
       
   660 	
       
   661 	TPtrC8* cellBroadcastEnvelope = NULL;
       
   662 	
       
   663 	aDataPackage->UnPackData(&cellBroadcastEnvelope);
       
   664 	
       
   665 	__ASSERT_DEBUG(cellBroadcastEnvelope, CtsyDispatcherPanic(EInvalidNullPtr));
       
   666 	
       
   667 	// Call Handle... method in Licensee LTSY
       
   668 	if (iLtsyDispatchSatCellBroadcast)
       
   669 		{
       
   670 		ret = iLtsyDispatchSatCellBroadcast->HandleCellBroadcastEnvelopeReqL(*cellBroadcastEnvelope);
       
   671 		}
       
   672 
       
   673 	return TSYLOGSETEXITERR(ret);
       
   674 	} // CSatDispatcher::DispatchCellBroadcastL
       
   675 
       
   676 TInt CSatDispatcher::DispatchAccessTechnologyL()
       
   677 /**
       
   678  * Unpack data related to ESatTsyAccTech
       
   679  * and pass request on to Licensee LTSY.
       
   680  *
       
   681  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
   682  *
       
   683  * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if
       
   684  * the Licensee LTSY does not support this request.
       
   685  */
       
   686 	{
       
   687 	TSYLOGENTRYEXIT;
       
   688 	TInt ret = KErrNotSupported;
       
   689 
       
   690 	//record that an Local Information proactive command request is in progress
       
   691 	iLocalInfoOngoing = ETrue;
       
   692 
       
   693 	// Call Handle... method in Licensee LTSY
       
   694 	if (iLtsyDispatchSatAccTech)
       
   695 		{
       
   696 		ret = iLtsyDispatchSatAccTech->HandleGetAccessTechnologyReqL();
       
   697 		}
       
   698 
       
   699 	return TSYLOGSETEXITERR(ret);
       
   700 	} // CSatDispatcher::DispatchAccessTechnologyL
       
   701 
       
   702 
       
   703 TInt CSatDispatcher::DispatchTimingAdvanceL()
       
   704 /**
       
   705  * Unpack data related to ESatTsyTimingAdvance
       
   706  * and pass request on to Licensee LTSY.
       
   707  *
       
   708  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
   709  *
       
   710  * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if
       
   711  * the Licensee LTSY does not support this request.
       
   712  */
       
   713 	{
       
   714 	TSYLOGENTRYEXIT;
       
   715 	TInt ret = KErrNotSupported;
       
   716 
       
   717 	//record that a Local Information proactive command request is in progress
       
   718 	iLocalInfoOngoing = ETrue;
       
   719 
       
   720 	// Call Handle... method in Licensee LTSY
       
   721 	if (iLtsyDispatchSatTimingAdvance)
       
   722 		{
       
   723 		ret = iLtsyDispatchSatTimingAdvance->HandleTimingAdvanceReqL();
       
   724 		}
       
   725 
       
   726 	return TSYLOGSETEXITERR(ret);
       
   727 	} // CSatDispatcher::DispatchTimingAdvanceL
       
   728 
       
   729 TInt CSatDispatcher::DispatchNotifySmControlRequestL(const CMmDataPackage* aDataPackage)
       
   730 /**
       
   731  * Unpack data related to ESatNotifyMoSmControlRequest
       
   732  * and pass request on to Licensee LTSY.
       
   733  *
       
   734  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
   735  *
       
   736  * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if
       
   737  * the Licensee LTSY does not support this request.
       
   738  */
       
   739 	{
       
   740 	TSYLOGENTRYEXIT;
       
   741 	TInt ret = KErrNotSupported;
       
   742 
       
   743 	__ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr));
       
   744 	TMoSmCtrlData* moSmsControlData = NULL;
       
   745 	aDataPackage->UnPackData(&moSmsControlData);
       
   746 	
       
   747 	__ASSERT_DEBUG(moSmsControlData, CtsyDispatcherPanic(EInvalidNullPtr));
       
   748 	
       
   749 	// Call Handle... method in Licensee LTSY
       
   750 	if (iLtsyDispatchSatSmControlResponseData)
       
   751 		{
       
   752 		ret = iLtsyDispatchSatSmControlResponseData->HandleSmControlResponseDataReqL(	
       
   753 				moSmsControlData->iResult,
       
   754 				moSmsControlData->iAddressData.iRPDestinationAddr,
       
   755 				moSmsControlData->iAddressData.iTPDestinationAddr);
       
   756 		}
       
   757 
       
   758 	return TSYLOGSETEXITERR(ret);
       
   759 	} // CSatDispatcher::DispatchNotifySmControlRequestL
       
   760 
       
   761 TInt CSatDispatcher::DispatchProvideLocationInfoL()
       
   762 /**
       
   763  * Pass ESatTsyProvideLocalInfo request on to Licensee LTSY.
       
   764  *
       
   765  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
   766  *
       
   767  * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if
       
   768  * the Licensee LTSY does not support this request.
       
   769  */
       
   770 	{
       
   771 	TSYLOGENTRYEXIT;
       
   772 	TInt ret = KErrNotSupported;
       
   773 	
       
   774 	//record that a Local Information proactive command request is in progress
       
   775 	iLocalInfoOngoing = ETrue;
       
   776 
       
   777 	// Call Handle... method in Licensee LTSY
       
   778 	if (iLtsyDispatchSatProvideLocationInfo)
       
   779 		{
       
   780 		ret = iLtsyDispatchSatProvideLocationInfo->HandleProvideLocationInfoReqL();
       
   781 		}
       
   782 
       
   783 	return TSYLOGSETEXITERR(ret);
       
   784 	} // CSatDispatcher::DispatchProvideLocationInfoL
       
   785 
       
   786 TInt CSatDispatcher::DispatchSetPollingIntervalL(const CMmDataPackage* aDataPackage)
       
   787 /**
       
   788  * Unpack data related to ESatTsySetPolling
       
   789  * and pass request on to Licensee LTSY.
       
   790  *
       
   791  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
   792  *
       
   793  * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if
       
   794  * the Licensee LTSY does not support this request.
       
   795  */
       
   796 	{
       
   797 	TSYLOGENTRYEXIT;
       
   798 	TInt ret = KErrNotSupported;
       
   799 
       
   800 	__ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr));
       
   801 	TBuf8<1> data;
       
   802 	aDataPackage->UnPackData(data);
       
   803 
       
   804 	__ASSERT_DEBUG(data.Length() == data.MaxLength(), CtsyDispatcherPanic(EInvalidNullPtr));
       
   805 	
       
   806 	// Call Handle... method in Licensee LTSY
       
   807 	if (iLtsyDispatchSatSetPollingInterval)
       
   808 		{
       
   809 		ret = iLtsyDispatchSatSetPollingInterval->HandleSetPollingIntervalReqL(data[0]);
       
   810 		}
       
   811 	
       
   812 	return TSYLOGSETEXITERR(ret);
       
   813 	} // CSatDispatcher::DispatchSetPollingIntervalL
       
   814 
       
   815 TInt CSatDispatcher::DispatchSmsPpDdlL(const CMmDataPackage* aDataPackage)
       
   816 /**
       
   817  * Unpack data related to ESatTsySmsPpDdl
       
   818  * and pass request on to Licensee LTSY.
       
   819  *
       
   820  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
   821  *
       
   822  * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if
       
   823  * the Licensee LTSY does not support this request.
       
   824  */
       
   825 	{
       
   826 	TSYLOGENTRYEXIT;
       
   827 	TInt ret = KErrNotSupported;
       
   828 
       
   829 	__ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr));
       
   830 	TPtrC8* smsPpDownloadEnvelope = NULL;
       
   831 	
       
   832 	aDataPackage->UnPackData(&smsPpDownloadEnvelope);
       
   833 	
       
   834 	__ASSERT_DEBUG(smsPpDownloadEnvelope, CtsyDispatcherPanic(EInvalidNullPtr));
       
   835 
       
   836 	// Call Handle... method in Licensee LTSY
       
   837 	if (iLtsyDispatchSatSmsPpDownloadEnvelope)
       
   838 		{
       
   839 		ret = iLtsyDispatchSatSmsPpDownloadEnvelope->HandleSmsPpDownloadEnvelopeReqL(*smsPpDownloadEnvelope);
       
   840 		}
       
   841 
       
   842 	return TSYLOGSETEXITERR(ret);
       
   843 	} // CSatDispatcher::DispatchSmsPpDdlL
       
   844 
       
   845 TInt CSatDispatcher::DispatchLocalInformationNmrL()
       
   846 /**
       
   847  * Unpack data related to ESatTsyLocalInformationNmr
       
   848  * and pass request on to Licensee LTSY.
       
   849  *
       
   850  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
   851  *
       
   852  * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if
       
   853  * the Licensee LTSY does not support this request.
       
   854  */
       
   855 	{
       
   856 	TSYLOGENTRYEXIT;
       
   857 	TInt ret = KErrNotSupported;
       
   858 
       
   859 	//record that a Local Information proactive command request is in progress
       
   860 	iLocalInfoOngoing = ETrue;
       
   861 	
       
   862 	// Call Handle... method in Licensee LTSY
       
   863 	if (iLtsyDispatchSatLocalInformationNmr)
       
   864 		{
       
   865 		ret = iLtsyDispatchSatLocalInformationNmr->HandleLocalInformationNmrReqL();
       
   866 		}
       
   867 
       
   868 	return TSYLOGSETEXITERR(ret);
       
   869 	} // CSatDispatcher::DispatchLocalInformationNmrL
       
   870 
       
   871 TInt CSatDispatcher::DispatchSendEnvelopeL(const CMmDataPackage* aDataPackage)
       
   872 /**
       
   873  * Unpack data related to ESatTsySendEnvelope
       
   874  * and pass request on to Licensee LTSY.
       
   875  *
       
   876  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
   877  *
       
   878  * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if
       
   879  * the Licensee LTSY does not support this request.
       
   880  */
       
   881 	{
       
   882 	TSYLOGENTRYEXIT;
       
   883 	TInt ret = KErrNotSupported;
       
   884 
       
   885 	__ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr));
       
   886 	TPtrC8* envelope = NULL;
       
   887 	
       
   888 	aDataPackage->UnPackData(&envelope);
       
   889 	
       
   890 	__ASSERT_DEBUG(envelope, CtsyDispatcherPanic(EInvalidNullPtr));
       
   891 	
       
   892 	// Call Handle... method in Licensee LTSY
       
   893 	if (iLtsyDispatchSatSendEnvelope)
       
   894 		{
       
   895 		ret = iLtsyDispatchSatSendEnvelope->HandleCallAndSmsControlEnvelopeReqL(*envelope);
       
   896 		}
       
   897 
       
   898 	return TSYLOGSETEXITERR(ret);
       
   899 	} // CSatDispatcher::DispatchSendEnvelopeL
       
   900 
       
   901 TInt CSatDispatcher::DispatchServiceRequestL(const CMmDataPackage* aDataPackage)
       
   902 /**
       
   903  * Unpack data related to ESatTsyServiceRequest
       
   904  * and pass request on to Licensee LTSY.
       
   905  *
       
   906  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
   907  *
       
   908  * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if
       
   909  * the Licensee LTSY does not support this request.
       
   910  */
       
   911 	{
       
   912 	TSYLOGENTRYEXIT;
       
   913 	TInt ret = KErrNotSupported;
       
   914 
       
   915 	__ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr));
       
   916 	TTerminalRespData* terminalRespData = NULL;
       
   917 	TRefreshInfo* refreshInfo = NULL;
       
   918 	
       
   919 	aDataPackage->UnPackData(&terminalRespData,&refreshInfo);
       
   920 
       
   921 	__ASSERT_DEBUG(terminalRespData && refreshInfo, CtsyDispatcherPanic(EInvalidNullPtr));
       
   922 	// Call Handle... method in Licensee LTSY
       
   923 	if (iLtsyDispatchSatRefreshAllowed)
       
   924 		{
       
   925 		ret = iLtsyDispatchSatRefreshAllowed->HandleRefreshAllowedReqL(refreshInfo->iFileList,
       
   926 																		refreshInfo->iAid,
       
   927 																		refreshInfo->iInternalCache);
       
   928 		}
       
   929 
       
   930 	return TSYLOGSETEXITERR(ret);
       
   931 	} // CSatDispatcher::DispatchServiceRequestL
       
   932 
       
   933 TInt CSatDispatcher::DispatchReadyL()
       
   934 /**
       
   935  * Unpack data related to ESatTsyReady
       
   936  * and pass request on to Licensee LTSY.
       
   937  *
       
   938  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
   939  *
       
   940  * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if
       
   941  * the Licensee LTSY does not support this request.
       
   942  */
       
   943 	{
       
   944 	TSYLOGENTRYEXIT;
       
   945 	TInt ret = KErrNotSupported;
       
   946 
       
   947 	// Call Handle... method in Licensee LTSY
       
   948 	if (iLtsyDispatchSatReady)
       
   949 		{
       
   950 		ret = iLtsyDispatchSatReady->HandleReadyReqL();
       
   951 		}
       
   952 
       
   953 	return TSYLOGSETEXITERR(ret);
       
   954 	} // CSatDispatcher::DispatchReadyL
       
   955 
       
   956 TInt CSatDispatcher::DispatchPCmdNotificationL(const CMmDataPackage* aDataPackage)
       
   957 /**
       
   958  * Unpack data related to ESatTsyGetIfPendingNotification
       
   959  * and pass request on to Licensee LTSY.
       
   960  *
       
   961  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
   962  *
       
   963  * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if
       
   964  * the Licensee LTSY does not support this request.
       
   965  */
       
   966 	{
       
   967 	TSYLOGENTRYEXIT;
       
   968 	TInt ret = KErrNotSupported;
       
   969 
       
   970 	__ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr));
       
   971 	TUint8 commandtype = 0;
       
   972 	aDataPackage->UnPackData(commandtype);
       
   973 
       
   974 	// Call Handle... method in Licensee LTSY
       
   975 	if (iLtsyDispatchSatPCmdNotification)
       
   976 		{
       
   977 		ret = iLtsyDispatchSatPCmdNotification->HandlePCmdNotificationReqL(commandtype);
       
   978 		}
       
   979 
       
   980 	return TSYLOGSETEXITERR(ret);
       
   981 	} // CSatDispatcher::DispatchPCmdNotificationL
       
   982 
       
   983 TInt CSatDispatcher::DispatchUssdControlEnvelopeErrorL()
       
   984 /**
       
   985  * Unpack data related to ESatTsyEnvelopeError
       
   986  * and pass request on to Licensee LTSY.
       
   987  *
       
   988  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
   989  *
       
   990  * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if
       
   991  * the Licensee LTSY does not support this request.
       
   992  */
       
   993 	{
       
   994 	TSYLOGENTRYEXIT;
       
   995 	TInt ret = KErrNotSupported;
       
   996 
       
   997 	// Call Handle... method in Licensee LTSY
       
   998 	if (iLtsyDispatchSatUssdControlEnvelopeError)
       
   999 		{
       
  1000 		ret = iLtsyDispatchSatUssdControlEnvelopeError->HandleUssdControlEnvelopeErrorReqL();
       
  1001 		}
       
  1002 
       
  1003 	return TSYLOGSETEXITERR(ret);
       
  1004 	} // CSatDispatcher::DispatchUssdControlEnvelopeErrorL
       
  1005 
       
  1006 TInt CSatDispatcher::DispatchTimerExpiredL(const CMmDataPackage* aDataPackage)
       
  1007 /**
       
  1008  * Unpack data related to ESatTsyTimerExpiredIPC
       
  1009  * and pass request on to Licensee LTSY.
       
  1010  *
       
  1011  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1012  *
       
  1013  * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if
       
  1014  * the Licensee LTSY does not support this request.
       
  1015  */
       
  1016 	{
       
  1017 	TSYLOGENTRYEXIT;
       
  1018 	TInt ret = KErrNotSupported;
       
  1019 
       
  1020 	__ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr));
       
  1021 	TPtrC8* timerExpirationEnvelope = NULL;
       
  1022 	aDataPackage->UnPackData(&timerExpirationEnvelope);
       
  1023 	__ASSERT_DEBUG(timerExpirationEnvelope, CtsyDispatcherPanic(EInvalidNullPtr));
       
  1024 	
       
  1025 	// Call Handle... method in Licensee LTSY
       
  1026 	if (iLtsyDispatchSatTimerExpired) 
       
  1027 		{
       
  1028 		ret = iLtsyDispatchSatTimerExpired->HandleTimerExpirationEnvelopeReqL(*timerExpirationEnvelope);
       
  1029 		}
       
  1030 
       
  1031 	return TSYLOGSETEXITERR(ret);
       
  1032 	} // CSatDispatcher::DispatchTimerExpiredL
       
  1033 
       
  1034 TInt CSatDispatcher::DispatchTerminalRspL(const CMmDataPackage* aDataPackage)
       
  1035 /**
       
  1036  * Unpack data related to ESatTerminalRsp
       
  1037  * and pass request on to Licensee LTSY.
       
  1038  *
       
  1039  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1040  *
       
  1041  * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if
       
  1042  * the Licensee LTSY does not support this request.
       
  1043  */
       
  1044 	{
       
  1045 	TSYLOGENTRYEXIT;
       
  1046 	TInt ret = KErrNotSupported;
       
  1047 
       
  1048 	__ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr));
       
  1049 	TTerminalRespData* response = NULL;
       
  1050 	TPtrC8* resultAndAddInfoTlv = NULL;
       
  1051 	aDataPackage->UnPackData(&response, &resultAndAddInfoTlv);
       
  1052 	
       
  1053 	__ASSERT_DEBUG(response && resultAndAddInfoTlv, CtsyDispatcherPanic(EInvalidNullPtr));
       
  1054 	
       
  1055 	if (iLtsyDispatchSatTerminalRsp)
       
  1056 		{
       
  1057 		RBuf8 terminalRsp;
       
  1058 		CleanupClosePushL(terminalRsp);
       
  1059 		
       
  1060 		const TInt KDeviceIdentityLength = 4;
       
  1061 		terminalRsp.CreateL((response->iCommandDetails).Length() + KDeviceIdentityLength + resultAndAddInfoTlv->Length());
       
  1062 		
       
  1063 		//command details
       
  1064 		terminalRsp.Append(response->iCommandDetails);
       
  1065 		
       
  1066 		//device identity
       
  1067 		const TInt KDeviceIdentityDataLength = 2;
       
  1068 		terminalRsp.Append(KTlvDeviceIdentityTag);
       
  1069 		terminalRsp.Append(KDeviceIdentityDataLength);
       
  1070 		terminalRsp.Append(KMe);
       
  1071 		terminalRsp.Append(KSim);
       
  1072 
       
  1073 		//result + additional data
       
  1074 		terminalRsp.Append(*resultAndAddInfoTlv);
       
  1075 		
       
  1076 		__ASSERT_DEBUG(terminalRsp.Length() <= KTlvMaxSize, CtsyDispatcherPanic(EBadLength));
       
  1077 		__ASSERT_DEBUG(terminalRsp.Length() == terminalRsp.MaxLength(), CtsyDispatcherPanic(EBadLength));
       
  1078 		
       
  1079 		ret = iLtsyDispatchSatTerminalRsp->HandleTerminalRspReqL(terminalRsp);
       
  1080 		
       
  1081 		CleanupStack::PopAndDestroy(&terminalRsp);
       
  1082 		}
       
  1083 
       
  1084 	return TSYLOGSETEXITERR(ret);
       
  1085 	} // CSatDispatcher::DispatchTerminalRspL
       
  1086 
       
  1087 TInt CSatDispatcher::DispatchMenuSelectionL(const CMmDataPackage* aDataPackage)
       
  1088 /**
       
  1089  * Unpack data related to ESatMenuSelection
       
  1090  * and pass request on to Licensee LTSY.
       
  1091  *
       
  1092  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1093  *
       
  1094  * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if
       
  1095  * the Licensee LTSY does not support this request.
       
  1096  */
       
  1097 	{
       
  1098 	TSYLOGENTRYEXIT;
       
  1099 	TInt ret = KErrNotSupported;
       
  1100 
       
  1101 	__ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr));
       
  1102 
       
  1103 	TPtrC8* envelope = NULL;
       
  1104 	aDataPackage->UnPackData(&envelope);
       
  1105 	__ASSERT_DEBUG(envelope, CtsyDispatcherPanic(EInvalidNullPtr));
       
  1106 	// Call Handle... method in Licensee LTSY
       
  1107 	if (iLtsyDispatchSatMenuSelection)
       
  1108 		{
       
  1109 		ret = iLtsyDispatchSatMenuSelection->HandleMenuSelectionEnvelopeReqL(*envelope);
       
  1110 		}
       
  1111 
       
  1112 	return TSYLOGSETEXITERR(ret);
       
  1113 	} // CSatDispatcher::DispatchMenuSelectionL
       
  1114 
       
  1115 TInt CSatDispatcher::DispatchEventDownloadL(const CMmDataPackage* aDataPackage)
       
  1116 /**
       
  1117  * Unpack data related to ESatEventDownload
       
  1118  * and pass request on to Licensee LTSY.
       
  1119  *
       
  1120  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1121  *
       
  1122  * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if
       
  1123  * the Licensee LTSY does not support this request.
       
  1124  */
       
  1125 	{
       
  1126 	TSYLOGENTRYEXIT;
       
  1127 	TInt ret = KErrNotSupported;
       
  1128 
       
  1129 	__ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr));
       
  1130 	TPtrC8* envelope = NULL;
       
  1131 	aDataPackage->UnPackData(&envelope);
       
  1132 	
       
  1133 	__ASSERT_DEBUG(envelope, CtsyDispatcherPanic(EInvalidNullPtr));
       
  1134 	
       
  1135 	// Call Handle... method in Licensee LTSY
       
  1136 	if (iLtsyDispatchSatEventDownload) 
       
  1137 		{
       
  1138 		ret = iLtsyDispatchSatEventDownload->HandleEventDownloadEnvelopeReqL(*envelope);
       
  1139 		}
       
  1140 
       
  1141 	return TSYLOGSETEXITERR(ret);
       
  1142 	} // CSatDispatcher::DispatchEventDownloadL
       
  1143 
       
  1144 TInt CSatDispatcher::DispatchGetUssdControlSupportedL()
       
  1145 /**
       
  1146  * Unpack data related to ESatTsyUssdControlSupported
       
  1147  * and pass request on to Licensee LTSY.
       
  1148  *
       
  1149  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1150  *
       
  1151  * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if
       
  1152  * the Licensee LTSY does not support this request.
       
  1153  */
       
  1154 	{
       
  1155 	TSYLOGENTRYEXIT;
       
  1156 	TInt ret = KErrNotSupported;
       
  1157 
       
  1158 	// Call Handle... method in Licensee LTSY
       
  1159 	if (iLtsyDispatchSatGetUssdControlSupported)
       
  1160 		{
       
  1161 		ret = iLtsyDispatchSatGetUssdControlSupported->HandleGetUssdControlSupportedReqL();
       
  1162 		}
       
  1163 
       
  1164 	return TSYLOGSETEXITERR(ret);
       
  1165 	} // CSatDispatcher::DispatchEventDownloadL
       
  1166 
       
  1167 
       
  1168 //
       
  1169 // Callback handlers follow
       
  1170 //
       
  1171 
       
  1172 
       
  1173 
       
  1174 void CSatDispatcher::CallbackUssdControlSupported(TInt aError, TBool aSupported)
       
  1175 /**
       
  1176  * Callback function to be used by the request to complete 
       
  1177  * CCtsyDispatcherCallback::CallbackSatGetUssdControlSupportedComp().
       
  1178  *
       
  1179  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1180  *
       
  1181  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  1182  * @param aSupported whether or not USSD-TLV is supported
       
  1183  *  in the (u)sim service table
       
  1184  */
       
  1185 	{
       
  1186 	TSYLOGENTRYEXITARGS(_L8("aError=%d,aSupported=%d"), aError, aSupported);
       
  1187 
       
  1188 	// Pack the data to return to the Common TSY
       
  1189 	CMmDataPackage dataPackage;
       
  1190 	dataPackage.PackData(&aSupported);
       
  1191 	
       
  1192 	iMessageManagerCallback.Complete(ESatTsyUssdStatus, &dataPackage, aError);
       
  1193 	
       
  1194 	} // CSatDispatcher::CallbackUssdControlSupported
       
  1195 
       
  1196 void CSatDispatcher::CallbackPcmd(TInt aError, const TDesC8& aData)
       
  1197 /**
       
  1198  * Callback function to be used by the request to complete.
       
  1199  *
       
  1200  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1201  *
       
  1202  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  1203  * @param aData TLV data received from the SIM that contains the proactive command.
       
  1204  */
       
  1205 	{
       
  1206 	TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError);
       
  1207 
       
  1208 	__DEBUG_ONLY(const TUint8 KCommandUiccTagIndex  = 0;)
       
  1209 	__ASSERT_DEBUG(aData[KCommandUiccTagIndex] == KBerTlvProactiveSimCommandTag, CtsyDispatcherPanic(ECorruptTlvData));
       
  1210 
       
  1211 	TPtrC8 dataPtr(aData);
       
  1212 	
       
  1213 	// Pack the data to return to the Common TSY
       
  1214     CMmDataPackage dataPackage;
       
  1215 	dataPackage.PackData(&dataPtr);
       
  1216 	
       
  1217 	iMessageManagerCallback.Complete(ESatTsyPCmd, &dataPackage, aError);
       
  1218 	
       
  1219 	} // CSatDispatcher::CallbackPcmd
       
  1220 
       
  1221 void CSatDispatcher::CallbackNotifyProactiveSimSessionEnd(TInt aError,TUint8 aStatusWord1, TUint8 aStatusWord2)
       
  1222 /**
       
  1223  * Callback function to be used by the request to complete 
       
  1224  * CCtsyDispatcherCallback::CallbackSatNotifyProactiveSimSessionEndInd().
       
  1225  *
       
  1226  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1227  *
       
  1228  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  1229  * @param aStatusWord1 The Status Word 1
       
  1230  * @param aStatusWord2 The Status Word 2
       
  1231  */
       
  1232 	{
       
  1233 	TSYLOGENTRYEXITARGS(_L8("aError=%d,aStatusWord1=%d,aStatusWord2=%d"), aError, aStatusWord1, aStatusWord2);
       
  1234 
       
  1235 	CMmDataPackage dataPackage;
       
  1236 	dataPackage.PackData(&aStatusWord1,&aStatusWord2);
       
  1237 	
       
  1238 	iMessageManagerCallback.Complete(ESatNotifyProactiveSimSessionEnd, &dataPackage, aError);
       
  1239 	
       
  1240 	} // CSatDispatcher::CallbackNotifyProactiveSimSessionEnd
       
  1241 
       
  1242 void CSatDispatcher::CallbackTimeZoneChange(TInt aError, TUint8 aTimeZone)
       
  1243 /**
       
  1244  * Callback function to be used by the request to complete 
       
  1245  * CCtsyDispatcherCallback::CallbackSatTimeZoneChangeInd().
       
  1246  *
       
  1247  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1248  *
       
  1249  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  1250  * @param aTimeZone The new time zone coded as defined in "ETSI TS 123 040" "TP-Service-Centre-Time-Stamp" 
       
  1251  */
       
  1252 	{
       
  1253 	TSYLOGENTRYEXITARGS(_L8("aError=%d,aTimeZone=%d"), aError, aTimeZone);
       
  1254 
       
  1255 	CMmDataPackage dataPackage;
       
  1256 	dataPackage.PackData(&aTimeZone);
       
  1257 
       
  1258 	iMessageManagerCallback.Complete(ESatTsyTimeZone, &dataPackage, aError);
       
  1259 	
       
  1260 	} // CSatDispatcher::CallbackTimeZoneChange
       
  1261 
       
  1262 void CSatDispatcher::CallbackAccessTechnologyChange(TInt aError, TUint8 aCurrentAccessTechnology)
       
  1263 /**
       
  1264  * Callback function to be used by the request to complete 
       
  1265  * CCtsyDispatcherCallback::CallbackSatAccessTechnologyChangeInd().
       
  1266  *
       
  1267  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1268  *
       
  1269  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  1270  * @param aCurrentAccessTechnology The current access technology being used by the terminal
       
  1271  * See "ETSI TS 102 223" "Access technology"
       
  1272  */
       
  1273 	{
       
  1274 	TSYLOGENTRYEXITARGS(_L8("aError=%d, aCurrentAccessTechnology=%d"), aError, aCurrentAccessTechnology);
       
  1275 
       
  1276 	CMmDataPackage dataPackage;
       
  1277 	dataPackage.PackData(&aCurrentAccessTechnology);
       
  1278 	
       
  1279 	iMessageManagerCallback.Complete(ESatTsyAccessTechnologyChange, &dataPackage, aError);
       
  1280 	} // CSatDispatcher::CallbackAccessTechnologyChange
       
  1281 
       
  1282 void CSatDispatcher::CallbackCallConnected(TInt aError, TUint8 aTransactionId, TBool aNearEnd)
       
  1283 /**
       
  1284  * Callback function to be used by the request to complete 
       
  1285  * CCtsyDispatcherCallback::CallbackSatCallConnectedInd().
       
  1286  *
       
  1287  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1288  *
       
  1289  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  1290  * @param aTransactionId The Transaction Identifier in the call connect message.
       
  1291  * @param aIsNearEnd If True, the case of connecting is at the near end (an MT call), (i.e. source = terminal, destination = UICC)
       
  1292  * 					 If False (i.e. far end), the case of connecting is at the far end (an MO call), (i.e. source = network, destination = UICC)
       
  1293  */
       
  1294 	{
       
  1295 	TSYLOGENTRYEXITARGS(_L8("aError=%d, aTransactionId=%d, aNearEnd=%d"),aError,aTransactionId,aNearEnd);
       
  1296 
       
  1297 	CMmDataPackage dataPackage;
       
  1298 	dataPackage.PackData(&aTransactionId,&aNearEnd);
       
  1299 	
       
  1300 	iMessageManagerCallback.Complete(ESatTsyCallConnected, &dataPackage, aError);
       
  1301 	
       
  1302 	} // CSatDispatcher::CallbackCallConnected
       
  1303 
       
  1304 void CSatDispatcher::CallbackSsChange(TInt aError, DispatcherSat::TSsStatus aStatus)
       
  1305 /**
       
  1306  * Callback function to be used by the request to complete 
       
  1307  * CCtsyDispatcherCallback::CallbackSatSsChangeInd().
       
  1308  *
       
  1309  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1310  *
       
  1311  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  1312  * @param aStatus whether SS or USSD is busy
       
  1313  */
       
  1314 	{
       
  1315 	TSYLOGENTRYEXITARGS(_L8("aError=%d, aStatus=%d"), aError, aStatus);
       
  1316 
       
  1317 	// Pack the data to return to the Common TSY
       
  1318 	CMmDataPackage dataPackage;
       
  1319 	
       
  1320 	//switch here to convert from DispatcherSat::TSsStatus to TSsStatus
       
  1321 	//could static cast from DispatcherSat::TSsStatus to TSsStatus be would
       
  1322 	//need to ensure DispatcherSat::TSsStatus enums always matchs TSsStatus enums.
       
  1323 	TSsStatus status;
       
  1324 	
       
  1325 	switch(aStatus)
       
  1326 		{
       
  1327 		case DispatcherSat::ENotBusy:
       
  1328 			status = ENotBusy;
       
  1329 			break;
       
  1330 		case DispatcherSat::ESsBusy:
       
  1331 			status = ESsBusy;
       
  1332 			break;
       
  1333 		case DispatcherSat::EUssdBusy:
       
  1334 			status = EUssdBusy;
       
  1335 			break;
       
  1336 		}
       
  1337 	
       
  1338 	dataPackage.PackData(&status);
       
  1339 	
       
  1340 	iMessageManagerCallback.Complete(ESatTsySsStatus, &dataPackage, aError);
       
  1341 	
       
  1342 	} // CSatDispatcher::CallbackSsChange
       
  1343 
       
  1344 void CSatDispatcher::CallbackCallDisconnected(TInt aError, TUint8 aTransactionId, TBool aNearEnd, const TDesC8& aCause)
       
  1345 /**
       
  1346  * Callback function to be used by the request to complete 
       
  1347  * CCtsyDispatcherCallback::CallbackSatCallDisconnectedInd().
       
  1348  *
       
  1349  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1350  *
       
  1351  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  1352  * @param aTransactionId The Transaction Identifier of the call being disconnected.
       
  1353  * @param aIsNearEnd If True, the case of disconnection is at the near end, (i.e. source = terminal, destination = UICC)
       
  1354  * 					If False (i.e. far end), the case of disconnection is at the far end, (i.e. source = network, destination = UICC)
       
  1355  * @param aCause 	The cause value is defined in the appropriate access technology specification. 
       
  1356  * 					Radio Link Timeout is indicated by the cause having zero length, the maximum length is defined in KMaxCauseLength
       
  1357  * 					See "ETSI TS 102 223" "COMPREHENSION-TLV data objects" "Cause"
       
  1358  */
       
  1359 	{
       
  1360 	TSYLOGENTRYEXITARGS(_L8("aError=%d,aTransactionId=%d,aNearEnd=%d"), aError,aTransactionId,aNearEnd);
       
  1361 
       
  1362 	__ASSERT_DEBUG(aCause.Length() <= KMaxCauseLength, CtsyDispatcherPanic(EBadLength));
       
  1363 	
       
  1364 	TCallDisconnectedEnvelope callDisconnectedEnvelope;
       
  1365 	callDisconnectedEnvelope.iCmdNumber  = aTransactionId;
       
  1366 	callDisconnectedEnvelope.iNearEnd	 = aNearEnd;
       
  1367 	callDisconnectedEnvelope.iCauseGiven = (aCause.Length() != 0);
       
  1368 	callDisconnectedEnvelope.iCause		 = aCause;
       
  1369 	
       
  1370 	CMmDataPackage dataPackage;
       
  1371 	dataPackage.PackData(&callDisconnectedEnvelope);
       
  1372 	iMessageManagerCallback.Complete(ESatTsyCallDisconnected, &dataPackage, aError);
       
  1373 	
       
  1374 	} // CSatDispatcher::CallbackCallDisconnected
       
  1375 
       
  1376 void CSatDispatcher::CallbackMtCall(
       
  1377 		TInt aError, TUint8 aTransactionId, const TDesC8& aAddress, const TDesC8& aSubAddress)
       
  1378 /**
       
  1379  * Callback function to be used by the request to complete CCtsyDispatcherCallback::CallbackSatMtCallInd().
       
  1380  *
       
  1381  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1382  *
       
  1383  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  1384  * @param aTransactionId The Transaction Identifier in the call setup message from the network.
       
  1385  * @param aAddress Holds the Calling Party number received by the terminal in the call setup message. If
       
  1386  * the Calling Party number is included in the call setup message, the Address shall be included, otherwise
       
  1387  * the address shall not be included  (zero length). See "ETSI TS 102 223" "COMPREHENSION-TLV data objects" "Address" 
       
  1388  * @param aSubAddress Holds the Calling Party Subaddress as received by the terminal in the call setup
       
  1389  * message. If the Calling Party Subaddress is included in the call setup message, the Subaddress shall be included, otherwise 
       
  1390  * the Subaddress shall not be included (zero length). See "ETSI TS 102 223" "COMPREHENSION-TLV data objects" "Subaddress"
       
  1391  */
       
  1392 	{
       
  1393 	TSYLOGENTRYEXITARGS(_L8("aError=%d,aTransactionId=%d"),aError,aTransactionId);
       
  1394 
       
  1395 	const TInt KTonAndNpiIndex = 0;
       
  1396 	const TInt KTonAndNpiLength = 1;
       
  1397 	
       
  1398 	TMTCallEnvelope mtCallEnvelope;
       
  1399 	
       
  1400 	mtCallEnvelope.iCmdNumber = aTransactionId;
       
  1401 	
       
  1402 	//according to TS 24.008. If the Dialling Number/SSC String does not contain a dialling number, e.g. a control
       
  1403 	//string deactivating a service, the TON/NPI byte shall be set to 'FF' by the ME, but..
       
  1404 	//the CTSY expects it to be zero to indicate it is missing
       
  1405 
       
  1406 	// chop so that it fits within the buffer (if required)
       
  1407 	TPtrC8 truncAddress = aAddress.Left(KNumberMaxLength + KTonAndNpiLength);
       
  1408 	mtCallEnvelope.iTONandNPI = (truncAddress.Length() >= KTonAndNpiLength) ? truncAddress[KTonAndNpiIndex] : 0;
       
  1409 
       
  1410 	// extract the dialling number (address minus the Ton & Npi)
       
  1411 	mtCallEnvelope.iDiallingNumber = truncAddress.Mid(KTonAndNpiLength);
       
  1412 		
       
  1413 	mtCallEnvelope.iCalledPartySubAddress.Set(aSubAddress);
       
  1414 	
       
  1415 	CMmDataPackage dataPackage;
       
  1416 	dataPackage.PackData(&mtCallEnvelope);
       
  1417 	
       
  1418 	iMessageManagerCallback.Complete(ESatTsyMTCall, &dataPackage, aError);
       
  1419 	
       
  1420 	} // CSatDispatcher::CallbackMtCall
       
  1421 
       
  1422 void CSatDispatcher::CallbackCallControlEnvelopeResponse(TInt aError, const TDesC8& aResponseTlv)
       
  1423 /**
       
  1424  * Callback function to be used by the request to allow the RSat client to display any alpha identifiers
       
  1425  * resulting from call control.
       
  1426  *
       
  1427  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1428  *
       
  1429  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  1430  * @param aResponseTlv the response from NAA to the ENVELOPE (CALL CONTROL) command. This will be parsed by the CTSY
       
  1431  * and if an alpha identifier exists in the data, it will be passed to the RSat client (if any) for display to the 
       
  1432  * user. As per ETSI 102.223 section 7.3.1.6, this contains 1 byte containing the Call Control result, followed by a 
       
  1433  * 1-2 byte length, then various optional fields depending on the outcome of the Call/SS/USSD Control. If the NAA
       
  1434  * application does not provide any response data then this is interpreted as "allowed, no modification".
       
  1435  */
       
  1436 	{
       
  1437 	TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError);
       
  1438 
       
  1439 	TUint8 callControlResult = 0; 
       
  1440 	if (aResponseTlv.Length() > 0) //no response data is interpreted as allowed no modification
       
  1441 		{
       
  1442 		callControlResult = aResponseTlv[0];
       
  1443 		}
       
  1444 	
       
  1445 	RSat::TControlResult res;
       
  1446 	switch (callControlResult)
       
  1447 		{
       
  1448 		case 2:
       
  1449 			{	
       
  1450 			res = RSat::EAllowedWithModifications;
       
  1451 			}
       
  1452 			break;
       
  1453 		case 1:
       
  1454 			{
       
  1455 			res = RSat::ENotAllowed;
       
  1456 			}
       
  1457 			break;
       
  1458 		case 0:
       
  1459 		default: //default case is invalid
       
  1460 			{
       
  1461 			res = RSat::EAllowedNoModification;
       
  1462 			}
       
  1463 			break;
       
  1464 		}
       
  1465 	
       
  1466 	CMmDataPackage dataPackage;
       
  1467 	dataPackage.PackData(&const_cast<TDesC8&>(aResponseTlv), &res);
       
  1468 	    
       
  1469 	iMessageManagerCallback.Complete(ESatTsyCheckAtkDataForAlphaId, &dataPackage, aError);
       
  1470 	
       
  1471 	} // CSatDispatcher::CallbackCallControlEnvelopeResponse
       
  1472 
       
  1473 void CSatDispatcher::CallbackCreateCallControlEnvelope(TInt aError, TUint8 aTag, const TDesC8& aBcc1, const TDesC8& aBcc2, 
       
  1474 			const TDesC8& aAddress, TUint8 aTonNpi, TUint8 aDcs)
       
  1475 /**
       
  1476  * Callback function to be used by the request to complete.
       
  1477  *
       
  1478  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1479  *
       
  1480  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  1481  * @param aCallControlInfo details of the Call/SS/USSD request that is being passed to UICC for possible Control
       
  1482  */
       
  1483 	{
       
  1484 	TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError);
       
  1485 	
       
  1486 	__ASSERT_DEBUG(aBcc1.Length() < KMaxBccLength, CtsyDispatcherPanic(EBadLength));
       
  1487 	__ASSERT_DEBUG(aBcc2.Length() < KMaxBccLength, CtsyDispatcherPanic(EBadLength));
       
  1488 	__ASSERT_DEBUG(aAddress.Length() < KMaxAddressLength, CtsyDispatcherPanic(EBadLength));
       
  1489 	
       
  1490 	TCCInfo ccInfo;
       
  1491 	ccInfo.iTag = aTag;
       
  1492 	ccInfo.iBcc1 = aBcc1;
       
  1493 	ccInfo.iBcc2 = aBcc2;
       
  1494 	ccInfo.iAddress = aAddress;
       
  1495 	ccInfo.iTonNpi = aTonNpi;
       
  1496 	ccInfo.iDcs = aDcs;
       
  1497 
       
  1498 	// Pack the data to return to the Common TSY
       
  1499 	CMmDataPackage dataPackage;
       
  1500 	dataPackage.PackData(&ccInfo);
       
  1501 	
       
  1502 	iMessageManagerCallback.Complete(ESatTsyCreateEnvelope, &dataPackage, aError);
       
  1503 	
       
  1504 	} // CSatDispatcher::CallbackCreateCallControlEnvelope
       
  1505 
       
  1506 void CSatDispatcher::CallbackCreateSmControlEnvelope(TInt aError, const TDesC8& aRpDestinationAddress, const TDesC8& aTpDestinationAddress)
       
  1507 /**
       
  1508  * Callback function to be used by the request to complete CCtsyDispatcherCallback::CallbackSatCreateSmControlEnvelopeInd().
       
  1509  *
       
  1510  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1511  *
       
  1512  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  1513  * @param aRpDestinationAddress RP Destination Address of the Service Center to which the ME is proposing to send the short message.
       
  1514  * @param aTpDestinationAddress TP Destination Address to which the ME is proposing to send the short message.
       
  1515  */
       
  1516 	{
       
  1517 	TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError);
       
  1518 
       
  1519 	TAddressData addressData;
       
  1520 	addressData.iRPDestinationAddr.Set(aRpDestinationAddress);
       
  1521 	addressData.iTPDestinationAddr.Set(aTpDestinationAddress);
       
  1522 	
       
  1523 	CMmDataPackage dataPackage;
       
  1524 	dataPackage.PackData(&addressData);
       
  1525 	
       
  1526 	iMessageManagerCallback.Complete(ESatTsyMoSmControlEnvelope, &dataPackage, aError);
       
  1527 	} // CSatDispatcher::CallbackCreateSmControlEnvelope
       
  1528 
       
  1529 void CSatDispatcher::CallbackImsiChanged(TInt aError)
       
  1530 /**
       
  1531  * Callback function to be used by the request to complete CCtsyDispatcherCallback::CallbackSatImsiChangedInd().
       
  1532  *
       
  1533  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1534  *
       
  1535  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  1536  */
       
  1537 	{
       
  1538 	TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError);
       
  1539 
       
  1540 	iMessageManagerCallback.Complete(ESatTsyImsiChanged, aError);
       
  1541 	
       
  1542 	} // CSatDispatcher::CallbackImsiChanged
       
  1543 
       
  1544 void CSatDispatcher::CallbackLocationStatus(TInt aError, TUint8 aLcnStatus, 
       
  1545 		const TDesC8& aCountryCode, TUint16 aLcnAreaCode, TUint16 aCellId)
       
  1546 /**
       
  1547  * Callback function to be used by the request to complete CCtsyDispatcherCallback::CallbackSatLocationStatusInd().
       
  1548  *
       
  1549  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1550  *
       
  1551  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  1552  * @param aLcnStatus the current service state of the terminal - 
       
  1553  * 			one of the values defined in ETSI 102.223 section 8.27
       
  1554  * @param aCountryCode 3 digit string (numerical) uniquely identifying the country. The length of 
       
  1555  * this descriptor should be 3.
       
  1556  * @param aLcnAreaCode The Location Area Code uniquely identifies a Location Area 
       
  1557  * 			with a network. 
       
  1558  * @param aCellId The current cell.
       
  1559  */
       
  1560 	{
       
  1561 	TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError);
       
  1562 
       
  1563 	__ASSERT_DEBUG(aCountryCode.Length() <= KCountryCodeLength, CtsyDispatcherPanic(EBadLength));
       
  1564 	
       
  1565 	// Pack the data to return to the Common TSY to construct possible EVENT DOWNLOAD envelope 
       
  1566 	TLocationStatusEnvelope lcnStatEnv;
       
  1567 	lcnStatEnv.iLocationStatus = aLcnStatus;
       
  1568 	lcnStatEnv.iCountryCode = aCountryCode;
       
  1569 	lcnStatEnv.iLocationAreaCode = aLcnAreaCode;
       
  1570 	lcnStatEnv.iCellId = aCellId;
       
  1571 	
       
  1572 	CMmDataPackage dataPackage;
       
  1573 	dataPackage.PackData(&lcnStatEnv);
       
  1574 	
       
  1575 	iMessageManagerCallback.Complete(ESatTsyLocationStatus, &dataPackage, aError);
       
  1576 	
       
  1577 	//Pack the data to return to the Common TSY to cache for use in Call/SS/USSD control envelopes
       
  1578 	TLocalInformation localInfo;
       
  1579 	localInfo.iLocationAreaCode = aLcnAreaCode;
       
  1580 	localInfo.iCellId = aCellId;
       
  1581 	localInfo.iOperatorCode = aCountryCode;
       
  1582 	
       
  1583 	dataPackage.PackData(&localInfo);
       
  1584 	
       
  1585 	iMessageManagerCallback.Complete(ESatTsyProvideLocalInfo, &dataPackage, aError);
       
  1586 	
       
  1587 	} // CSatDispatcher::CallbackLocationStatus
       
  1588 
       
  1589 void CSatDispatcher::CallbackRemoveEventList(TInt aError)
       
  1590 /**
       
  1591  * Callback function to be used by the request to complete CCtsyDispatcherCallback::CallbackSatRemoveEventListInd().
       
  1592  *
       
  1593  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1594  *
       
  1595  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  1596  */
       
  1597 	{
       
  1598 	TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError);
       
  1599 
       
  1600 	iMessageManagerCallback.Complete(ESatTsyRemoveEventList, aError);
       
  1601 	
       
  1602 	} // CSatDispatcher::CallbackRemoveEventList
       
  1603 
       
  1604 void CSatDispatcher::CallbackCreateRefreshTerminalRsp(TInt aError, RSat::TPCmdResult aGeneralResult, const TDesC& aResultAdditionalInfo)
       
  1605 /**
       
  1606  * Callback function to be used by the request to complete CCtsyDispatcherCallback::CallbackSatCreateRefreshTerminalRspInd().
       
  1607  *
       
  1608  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1609  *
       
  1610  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  1611  * @param aGeneralResult The General result that specifies the result and indicates appropriate UICC action (to be included in the 
       
  1612  * refresh terminal response result section, see ETSI 102 223 Under "Structure of TERMINAL RESPONSE" and Under "Result")
       
  1613  * @param aResultAdditionalInfo Additional information (to be included in the refresh terminal response result section, 
       
  1614  * see ETSI 102 223 Under "Structure of TERMINAL RESPONSE" and Under "Result")
       
  1615  */
       
  1616 	{
       
  1617 	TSYLOGENTRYEXITARGS(_L8("aError=%d,aGeneralResult=%d"), aError, aGeneralResult);
       
  1618 
       
  1619 	__ASSERT_DEBUG(aResultAdditionalInfo.Length() <= RSat::KAdditionalInfoMaxSize, CtsyDispatcherPanic(EBadLength));
       
  1620 	
       
  1621 	TTerminalRespData terminalRespData;
       
  1622 	terminalRespData.iGeneralResult = aGeneralResult;
       
  1623 	terminalRespData.iAdditionalInfo = aResultAdditionalInfo;	
       
  1624 
       
  1625 	CMmDataPackage dataPackage;
       
  1626 	dataPackage.PackData(&terminalRespData);
       
  1627 	
       
  1628 	iMessageManagerCallback.Complete(ESatTsyRefresh, &dataPackage, aError);
       
  1629 	
       
  1630 	} // CSatDispatcher::CallbackCreateRefreshTerminalRsp
       
  1631 
       
  1632 void CSatDispatcher::CallbackSmControlEnvelopeResponse(TInt aError, const TDesC8& aResponseTlv)
       
  1633 /**
       
  1634  * Callback function to be used by the request to complete CCtsyDispatcherCallback::CallbackSatSmControlEnvelopeResponseInd().
       
  1635  *
       
  1636  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1637  *
       
  1638  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  1639  * @param aResponseTlv Response data from the SIM encoded as defined in "3GPP 11.14 - MO Short Message Control by SIM"
       
  1640  */
       
  1641 	{
       
  1642 	TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError);
       
  1643 	
       
  1644 	CMmDataPackage dataPackage;
       
  1645 	dataPackage.PackData(&const_cast<TDesC8&>(aResponseTlv));
       
  1646 	
       
  1647 	iMessageManagerCallback.Complete(ESatNotifyMoSmControlRequest, &dataPackage, aError);
       
  1648 
       
  1649 	} // CSatDispatcher::CallbackSmControlEnvelopeResponse
       
  1650 
       
  1651 void CSatDispatcher::CallbackSatCreateSmsPpDownloadEnvelope(TInt aError, const TDesC8& aRpOriginatingAddress, const TDesC8& aSmsDeliveryTpdu)
       
  1652 /**
       
  1653  * Callback function to be used by the request to complete CCtsyDispatcherCallback::CallbackSatCreateSmsPpDownloadEnvelopeInd().
       
  1654  *
       
  1655  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1656  *
       
  1657  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  1658  * @param aRpOriginatingAddress RP Originating Address of the Service Centre (TS Service-Centre-Address), as defined in 3GPP TS 24.011)
       
  1659  * @param aSmsDeliveryTpdu The SMS-DELIVER TPDU (See "3GPP 23.040" under "SMS DELIVER type")
       
  1660  */
       
  1661 	{
       
  1662 	TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError);
       
  1663 
       
  1664 	__ASSERT_DEBUG(aRpOriginatingAddress.Length() + 1 <= KAddrMaxLength, CtsyDispatcherPanic(EBadLength));
       
  1665 	__ASSERT_DEBUG(aSmsDeliveryTpdu.Length() <= RMobileSmsMessaging::KGsmTpduSize, CtsyDispatcherPanic(EBadLength));
       
  1666 	
       
  1667 	//The SIM ATK CTSY takes an Rp Address with the address length prefixed to the adress (this is 
       
  1668 	//eventually calculated when constructing the TLV envelope and not used when SmsPp Download
       
  1669 	//is supported, but used when construdting the Ef(Sms) (SmsPP Download not supported))
       
  1670 	//The code below takes the address and process it into the format the SIM ATK CTSY expects
       
  1671 
       
  1672 	TBuf8<KAddrMaxLength> address;
       
  1673 	
       
  1674 	//chop to the the max buffer size (-1 for the length)
       
  1675 	TPtrC8 trucRpOriginatingAddress = aRpOriginatingAddress.Left(KAddrMaxLength - 1);
       
  1676 	address.Append(trucRpOriginatingAddress.Length());
       
  1677 	address.Append(trucRpOriginatingAddress);
       
  1678 		
       
  1679 	CMmDataPackage dataPackage;
       
  1680 	dataPackage.PackData(&address,&const_cast<TDesC8&>(aSmsDeliveryTpdu));
       
  1681 	
       
  1682 	//the error code is not currently used in the SIM ATK TSY
       
  1683 	iMessageManagerCallback.Complete(ESatTsySmsPpDdl, &dataPackage, aError);
       
  1684 	
       
  1685 	} // CSatDispatcher::CallbackSatCreateSmsPpDownloadEnvelope
       
  1686 
       
  1687 void CSatDispatcher::CallbackCreateSmsDeliverReport(TInt aError)
       
  1688 /**
       
  1689  * Callback function to be used by the request to complete CCtsyDispatcherCallback::CallbackSatCreateSmsDeliverReportInd().
       
  1690  *
       
  1691  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1692  *
       
  1693  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  1694  */
       
  1695 	{
       
  1696 	TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError);
       
  1697 
       
  1698 	iMessageManagerCallback.Complete(ESatTsySmsDeliverReport, aError);
       
  1699 	
       
  1700 	} // CSatDispatcher::CallbackCreateRefreshTerminalRsp
       
  1701 
       
  1702 void CSatDispatcher::CallbackCreateCellBroadcastEnvelope(TInt aError, const TDesC8& aCellBroadcastPage)
       
  1703 /**
       
  1704  * Callback function to be used by the request to complete CCCtsyDispatcherCallback::CallbackSatCreateCellBroadcastEnvelopeInd().
       
  1705  *
       
  1706  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1707  *
       
  1708  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  1709  * @param aCellBroadcastPage The Cell Broadcast page, formatted in the same way as described in 3GPP TS 23.041
       
  1710  */
       
  1711 	{
       
  1712 	TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError);
       
  1713 
       
  1714 	__ASSERT_DEBUG(aCellBroadcastPage.Length() <= KCbsMsgMaxLength, CtsyDispatcherPanic(EBadLength));
       
  1715 
       
  1716 	//the SIM ATK CTSY unpacks to a TBuf8 (of the stack) of maxlength KCbsMsgMaxLength
       
  1717 	TPtrC8 cellBroadcastPage = aCellBroadcastPage.Left(KCbsMsgMaxLength);
       
  1718 	
       
  1719 	CMmDataPackage dataPackage;
       
  1720 	dataPackage.PackData(&cellBroadcastPage);
       
  1721 		
       
  1722 	iMessageManagerCallback.Complete(ESatTsyCellBroadcast, &dataPackage, aError);
       
  1723 	} // CSatDispatcher::CallbackCreateCellBroadcastEnvelope
       
  1724 
       
  1725 
       
  1726 void CSatDispatcher::CallbackGetImageInstance(TInt aError, 
       
  1727 		const TDesC8& aImageInstanceData, const TDesC8& aImageInstanceBody)
       
  1728 /**
       
  1729  * Callback function to be used by the request to complete CCtsyDispatcherCallback::CallbackSatGetImageInstanceComp().
       
  1730  *
       
  1731  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1732  *
       
  1733  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  1734  * @param aImageInstanceData 	Descriptor containing the image instance coding scheme of the EF(IIDF),
       
  1735  * 								this must be of length 2 (KBasicIconDataLength) for basic 
       
  1736  * 								or length 6 (KColourIconDataLength) for colour image instances.
       
  1737  * 								See ETSI TS 131 102 under "Annex B (normative) Image Coding Schemes (B.1 & B.2)"
       
  1738  * @param aImageInstanceBody	Descriptor containing the image instance body of the EF(IIDF)
       
  1739  * 								See ETSI TS 131 102 under "Annex B (normative) Image Coding Schemes"
       
  1740  */
       
  1741 	{
       
  1742 	TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError);
       
  1743 	
       
  1744 	switch(aImageInstanceData.Length())
       
  1745 		{
       
  1746 		case KBasicIconDataLength:
       
  1747 			{
       
  1748 			//copy aImageInstanceData to a KColourIconDataLength (6) byte descriptor, 
       
  1749 			//the CTSY expects a length of KColourIconDataLength even if only 2 bytes are used,
       
  1750 			//for a basic image.
       
  1751 			TBuf8<KColourIconDataLength> imageInstanceData(aImageInstanceData);
       
  1752 			imageInstanceData.SetMax();
       
  1753 			
       
  1754 			// Pack the data to return to the Common TSY
       
  1755 			CMmDataPackage dataPackage;
       
  1756 			dataPackage.PackData(&const_cast<TDesC8&>(aImageInstanceBody),&imageInstanceData);
       
  1757 			iMessageManagerCallback.Complete(ESatTsyGetImageInstance, &dataPackage, aError);			
       
  1758 			break;
       
  1759 			}
       
  1760 		
       
  1761 		case KColourIconDataLength:
       
  1762 			{
       
  1763 			// Pack the data to return to the Common TSY
       
  1764 			CMmDataPackage dataPackage;
       
  1765 			dataPackage.PackData(&const_cast<TDesC8&>(aImageInstanceBody),&const_cast<TDesC8&>(aImageInstanceData));
       
  1766 			iMessageManagerCallback.Complete(ESatTsyGetImageInstance, &dataPackage, aError);
       
  1767 			break;
       
  1768 			}
       
  1769 		
       
  1770 		default:
       
  1771 			{
       
  1772 			// The descriptor length should be either 2 for basic (KBasicIconDataLength)
       
  1773 			// or 6 for colour (KColourIconDataLength)
       
  1774 			__ASSERT_DEBUG(EFalse, CtsyDispatcherPanic(EBadLength));
       
  1775 			}
       
  1776 		}
       
  1777 	} // CSatDispatcher::CallbackGetImageInstance
       
  1778 
       
  1779 void CSatDispatcher::CallbackGetIconData(TInt aError, const TDesC8& aIconEfImgRecord)
       
  1780 /**
       
  1781  * Callback function to be used by the request to complete.
       
  1782  *
       
  1783  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1784  *
       
  1785  * @param aError 			The error code to be returned to the CTSY Dispatcher.
       
  1786  * @param aIconEfImgRecord  The icon EF(Img) record retrieved from the UICC
       
  1787  * 							See ETSI TS 131 102 under "Contents of files at the DFGRAPHICS level"
       
  1788  */
       
  1789 	{
       
  1790 	TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError);
       
  1791 
       
  1792 	// Pack the data to return to the Common TSY
       
  1793 	CMmDataPackage iconEfImgRecordPkg;
       
  1794 	iconEfImgRecordPkg.PackData(&const_cast<TDesC8&>(aIconEfImgRecord));
       
  1795 	
       
  1796 	iMessageManagerCallback.Complete(ESatTsyGetIconData, &iconEfImgRecordPkg, aError);
       
  1797 	
       
  1798 	} // CSatDispatcher::CallbackGetIconData
       
  1799 
       
  1800 void CSatDispatcher::CallbackGetClut(TInt aError, const TDesC8& aClut)
       
  1801 /**
       
  1802  * Callback function to be used by the request to complete  CCtsyDispatcherCallback::CallbackSatGetClutComp().
       
  1803  *
       
  1804  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1805  *
       
  1806  * @param aError 	The error code to be returned to the CTSY Dispatcher.
       
  1807  * @param aClut 	The requested CLUT (Colour look up table) for a given icon instance
       
  1808  * 					See ETSI TS 131 102 under "B.2 Colour Image Coding Scheme"
       
  1809  */
       
  1810 	{
       
  1811 	TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError);
       
  1812 
       
  1813 	// Pack the data to return to the Common TSY
       
  1814 	CMmDataPackage clutPkg;
       
  1815 	clutPkg.PackData(&const_cast<TDesC8&>(aClut));
       
  1816 	iMessageManagerCallback.Complete(ESatTsyGetClut, &clutPkg, aError);
       
  1817 	} // CSatDispatcher::CallbackGetClut
       
  1818 
       
  1819 void CSatDispatcher::CallbackGetDefaultBearerCapability(TInt aError,
       
  1820 		const TDesC8& aCapability)
       
  1821 /**
       
  1822  * Callback function to be used by the request to complete CCtsyDispatcherCallback::CallbackSatGetDefaultBearerCapabilityComp().
       
  1823  *
       
  1824  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1825  *
       
  1826  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  1827  * @param aCapability The default bearer capability configuration (see 3GPP TS 04.08 for info about 
       
  1828  * bearer capability), this may be used by the CTSY when creating a Call Control ENVELOPE if a zero 
       
  1829  * length capability parameter is supplied with the Envelope creation request.  
       
  1830  * Note the maximum length capability the CTSY can store is 248, and a maximum length of 16 will be 
       
  1831  * used in the creation of the Call Control ENVELOPE.
       
  1832  *
       
  1833  * See "ETSI TS 102 223" "Structure of ENVELOPE (CALL CONTROL)" 
       
  1834  * See "3GPP TS 04.08"
       
  1835  * @see CSatDispatcher::CallbackSatCreateCallControlEnvelopeInd()
       
  1836  * 
       
  1837  */
       
  1838 	{
       
  1839 	TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError);
       
  1840 
       
  1841 	//debug assert if the capability is to long, otherwise in release mode
       
  1842 	//chop it down to the max buffer length to prevent the SIM ATK from panicing
       
  1843 	__ASSERT_DEBUG(aCapability.Length() <= KMaxLengthDefaultBearerData, CtsyDispatcherPanic(EBadLength));
       
  1844 	TPtrC8 beareraCapability(aCapability.Left(KMaxLengthDefaultBearerData));
       
  1845 	
       
  1846 	CMmDataPackage dataPackage;
       
  1847 	dataPackage.PackData(&beareraCapability);
       
  1848 	
       
  1849 	iMessageManagerCallback.Complete(ESatTsyGetBearerCapability, &dataPackage, aError);
       
  1850 	
       
  1851 	} // CSatDispatcher::CallbackGetDefaultBearerCapability
       
  1852 
       
  1853 void CSatDispatcher::CallbackGetSmsPpDownloadSupported(TInt aError, TBool aSupported)
       
  1854 /**
       
  1855  * Callback function to be used by the request to complete CCtsyDispatcherCallback::CallbackSatGetSmsPpDownloadSupportedComp().
       
  1856  *
       
  1857  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1858  *
       
  1859  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  1860  * @param aSupported If the service "data download via SMS Point-to-point" is allocated and activated in the SIM Service Table 
       
  1861  */
       
  1862 	{
       
  1863 	TSYLOGENTRYEXITARGS(_L8("aError=%d,aSupported=%d"), aError, aSupported);
       
  1864 
       
  1865 	// Pack the data to return to the Common TSY
       
  1866 	CMmDataPackage dataPackage;
       
  1867 	dataPackage.PackData(&aSupported);
       
  1868 	
       
  1869 	iMessageManagerCallback.Complete(ESatTsySmsPpDdlStatus, &dataPackage, aError);
       
  1870 	
       
  1871 	} // CSatDispatcher::CallbackGetSmsPpDownloadSupported
       
  1872 
       
  1873 void CSatDispatcher::CallbackGetSmsControlActivated(TInt aError, TBool aActivated)
       
  1874 /**
       
  1875  * Callback function to be used by the request to complete CCtsyDispatcherCallback::CallbackSatGetSmsControlActivatedComp().
       
  1876  *
       
  1877  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1878  *
       
  1879  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  1880  * @param aActivated True if MO-SMS Control by USIM (Service n°31) is currently activated (by the USIM),
       
  1881  * False otherwise
       
  1882  */
       
  1883 	{
       
  1884 	TSYLOGENTRYEXITARGS(_L8("aError=%d,aActivated=%d"), aError, aActivated);
       
  1885 
       
  1886 	// Pack the data to return to the Common TSY
       
  1887 	CMmDataPackage dataPackage;
       
  1888 	dataPackage.PackData(&aActivated);	
       
  1889 	iMessageManagerCallback.Complete(ESatTsyMoSmsControlActivation, &dataPackage, aError);
       
  1890 	
       
  1891 	} // CSatDispatcher::CallbackGetSmsControlActivated
       
  1892 
       
  1893 void CSatDispatcher::CallbackTimingAdvance(TInt aError,
       
  1894 		TUint8 aTimingAdvance, TUint8 aMeStatus)
       
  1895 /**
       
  1896  * Callback function to be used by the request to complete CCtsyDispatcherCallback::CallbackSatTimingAdvanceComp().
       
  1897  *
       
  1898  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1899  *
       
  1900  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  1901  * @param aTimingAdvance a value relating to the distance between the ME and the base station. This is used
       
  1902  * to compensate for propagation delay.
       
  1903  * @param aMeStatus Whether or not the ME is idle...this is to allow the application to know whether the
       
  1904  * timing advance is based on current or cached information.
       
  1905  */
       
  1906 	{
       
  1907 	TSYLOGENTRYEXITARGS(_L8("aError=%d,aTimingAdvance=%d,aMeStatus=%d"), aError, aTimingAdvance, aMeStatus);
       
  1908 
       
  1909 	// Pack the data to return to the Common TSY
       
  1910 	CMmDataPackage dataPackage;
       
  1911 	dataPackage.PackData(&aTimingAdvance, &aMeStatus);
       
  1912 	
       
  1913 	iMessageManagerCallback.Complete(ESatTsyTimingAdvance, &dataPackage, aError);
       
  1914 	
       
  1915 	//send off the in progress terminal response now that we have collected the required information for it.
       
  1916 	CompleteNotifyLocalInfo(aError);
       
  1917 
       
  1918 	
       
  1919 	} // CSatDispatcher::CallbackTimingAdvance
       
  1920 
       
  1921 void CSatDispatcher::CallbackGetAccessTechnology(TInt aError, TUint8 aAccessTechnology)
       
  1922 /**
       
  1923  * Callback function to be used by the request to complete CCtsyDispatcherCallback::CallbackSatAccessTechnologyChangeInd().
       
  1924  *
       
  1925  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1926  *
       
  1927  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  1928  * @param aAccessTechnology The current access technology being used by the terminal
       
  1929  * See "ETSI TS 102 223" "Access technology"
       
  1930  */
       
  1931 	{
       
  1932 	TSYLOGENTRYEXITARGS(_L8("aError=%d,aAccessTechnology=%d"), aError, aAccessTechnology);
       
  1933 
       
  1934 	// Pack the data to return to the Common TSY
       
  1935 	CMmDataPackage dataPackage;
       
  1936 	dataPackage.PackData(&aAccessTechnology);
       
  1937 	
       
  1938 	iMessageManagerCallback.Complete(ESatTsyAccTech, &dataPackage, aError);
       
  1939 	
       
  1940 	//send off the in progress terminal response now that we have collected the required information for it.
       
  1941 	CompleteNotifyLocalInfo(aError);
       
  1942 
       
  1943 	
       
  1944 } // CSatDispatcher::CallbackGetAccessTechnology
       
  1945 
       
  1946 void CSatDispatcher::CallbackProvideLocationInfo(TInt aError, TUint16 aLocationAreaCode, 
       
  1947 		TUint16 aCellId, const TDesC8& aOperatorCode)
       
  1948 /**
       
  1949  * Callback function to be used by the request to complete CCtsyDispatcherCallback::CallbackSatProvideLocationInfoComp().
       
  1950  *
       
  1951  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1952  *
       
  1953  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  1954  * @param aLocationAreaCode the ID of the Location Area (grouping of multiple cells)
       
  1955  * that the mobile is in 
       
  1956  * @param aCellId Id of the current GSM cell
       
  1957  * @param aOperatorCode Id of the current operator. This has a maximum length of 3.
       
  1958  */
       
  1959 	{
       
  1960 	TSYLOGENTRYEXITARGS(_L8("aError=%d,aLocationAreaCode=%d,aCellId=%d"), aError, aLocationAreaCode, aCellId);
       
  1961 
       
  1962 	__ASSERT_DEBUG(aOperatorCode.Length() <= KOperatorCodeLength, CtsyDispatcherPanic(EBadLength));
       
  1963 
       
  1964 	
       
  1965 	// Pack the data to return to the Common TSY
       
  1966 	TLocalInformation localInfo;
       
  1967 	localInfo.iLocationAreaCode = aLocationAreaCode;
       
  1968 	localInfo.iCellId = aCellId;
       
  1969 	localInfo.iOperatorCode = aOperatorCode;
       
  1970 	CMmDataPackage dataPackage;
       
  1971 	dataPackage.PackData(&localInfo);
       
  1972 	
       
  1973 	iMessageManagerCallback.Complete(ESatTsyProvideLocalInfo, &dataPackage, aError);
       
  1974 	
       
  1975 	//send off the in progress terminal response now that we have collected the required information for it.
       
  1976 	CompleteNotifyLocalInfo(aError);
       
  1977 
       
  1978 	
       
  1979 	} // CSatDispatcher::CallbackProvideLocationInfo
       
  1980 
       
  1981 void CSatDispatcher::CallbackSetPolling(TInt aError, TUint8 aPollingInterval)
       
  1982 /**
       
  1983  * Callback function to be used by the request to complete CCtsyDispatcherCallback::CallbackSatSetPollingIntervalComp().
       
  1984  *
       
  1985  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  1986  *
       
  1987  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  1988  * @param aPollingInterval The polling interval in use by the LTSY (zero) indicate Polling is off. This will be used
       
  1989  * in the terminal response to the original Polling Interval / Polling Off proactive command.
       
  1990  */
       
  1991 	{
       
  1992 	TSYLOGENTRYEXITARGS(_L8("aError=%d,aPollingInterval=%d"), aError, aPollingInterval);
       
  1993 
       
  1994 	//this proactive command number will be used in the CTSY to fill in TTerminalRespData's iPCmdNumber field,
       
  1995 	//the CTSY expects the LTSY to supply this.
       
  1996 	//As now the terminal response structure is created from the iCommandDetails which contains the
       
  1997 	//proactive command number anyway the dispatcher no longer needs to hide this from teh interface
       
  1998 	//with a cache and can just send up any number
       
  1999 	TUint8 pcmdNumber = 0;
       
  2000 
       
  2001 	CMmDataPackage dataPackage;
       
  2002 	dataPackage.PackData(&pcmdNumber,&aPollingInterval);
       
  2003 	
       
  2004 	iMessageManagerCallback.Complete(ESatTsySetPolling, &dataPackage, aError);
       
  2005 
       
  2006 	} // CSatDispatcher::CallbackSetPolling
       
  2007 
       
  2008 
       
  2009 void CSatDispatcher::CallbackLocalInformationNmr(TInt aError,
       
  2010 			const TDesC8& aNmr, const TDesC& aBcchList)
       
  2011 /**
       
  2012  * Callback function to be used by the request to complete CCtsyDispatcherCallback::CallbackSatLocalInformationNmrComp().
       
  2013  *
       
  2014  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  2015  *
       
  2016  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  2017  * @param aNmr - Network Measurement Results - reception level of BCCH of adjacent cells  
       
  2018  * @param aBcchList - Broadcast Control Channel List - the Broadcast Control Channel 
       
  2019  * of neighbouring cells (in 16-bit format, will be converted to 10-bit in CTSY).
       
  2020  * 
       
  2021  */
       
  2022 	{
       
  2023 	TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError);
       
  2024 	
       
  2025 	__ASSERT_DEBUG(aNmr.Length() <= KNmrLength, CtsyDispatcherPanic(EBadLength));
       
  2026 	__ASSERT_DEBUG(aBcchList.Length() <= KBcchListLength, CtsyDispatcherPanic(EBadLength));
       
  2027 	
       
  2028 	// Pack the data to return to the Common TSY
       
  2029 	CMmDataPackage dataPackage;
       
  2030 	dataPackage.PackData(const_cast<TDesC8*>(&aNmr),const_cast<TDesC*>(&aBcchList));
       
  2031 
       
  2032 	iMessageManagerCallback.Complete(ESatTsyLocalInformationNmr, &dataPackage, aError);
       
  2033 
       
  2034 	//send off the in progress terminal response now that we have collected the required information for it.
       
  2035 	CompleteNotifyLocalInfo(aError);
       
  2036 	
       
  2037 	} // CSatDispatcher::CallbackLocalInformationNmr
       
  2038 
       
  2039 void CSatDispatcher::CallbackRefreshAllowed(TInt aError)
       
  2040 /**
       
  2041  * Callback function to be used by the request to complete CCtsyDispatcherCallback::CallbackSatRefreshAllowedComp().
       
  2042  *
       
  2043  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  2044  *
       
  2045  * @param aError The error code to be returned to the CTSY Dispatcher and SAT client.
       
  2046  */
       
  2047 	{
       
  2048 	TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError);
       
  2049 	
       
  2050 	//the SAT TSY
       
  2051 	iMessageManagerCallback.Complete(ESatTsyCompleteRefresh, aError);
       
  2052 
       
  2053 	//custom TSY (will do nothing when custom TSY is not open)
       
  2054 	iTsyMessageManagerCallback.Complete(ECustomSatRefreshCompleteNotificationIPC, aError);
       
  2055 	
       
  2056 	} // CSatDispatcher::CallbackRefreshAllowed
       
  2057 
       
  2058 void CSatDispatcher::CallbackReady(TInt aError)
       
  2059 /**
       
  2060  * Callback function to be used by the request to completeCCtsyDispatcherCallback::CallbackSatReadyComp().
       
  2061  *
       
  2062  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  2063  *
       
  2064  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  2065  */
       
  2066 	{
       
  2067 	TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError);
       
  2068 
       
  2069 	iMessageManagerCallback.Complete(ESatTsyReady, aError);
       
  2070 	
       
  2071 	} // CSatDispatcher::CallbackReady
       
  2072 
       
  2073 void CSatDispatcher::CallbackUssdControlEnvelopeError(TInt aError)
       
  2074 /**
       
  2075  * Callback function to be used by the request to complete CCtsyDispatcherCallback::CallbackSatUssdControlEnvelopeErrorComp().
       
  2076  *
       
  2077  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  2078  *
       
  2079  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  2080  */
       
  2081 	{
       
  2082 	TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError);
       
  2083 
       
  2084 	iMessageManagerCallback.Complete(ESatTsyEnvelopeError, aError);
       
  2085 	
       
  2086 	} // CSatDispatcher::CallbackUssdControlEnvelopeError
       
  2087 
       
  2088 void CSatDispatcher::CallbackTerminalRsp(TInt aError)
       
  2089 /**
       
  2090  * Callback function to be used by the request to complete.
       
  2091  *
       
  2092  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.
       
  2093  *
       
  2094  * @param aError The error code to be returned to the CTSY Dispatcher.
       
  2095  */
       
  2096 	{
       
  2097 	TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError);
       
  2098 	
       
  2099 	TBool onGoing = (aError == KErrNone) ? FALSE : TRUE;
       
  2100 	
       
  2101 	CMmDataPackage dataPackage;
       
  2102 	dataPackage.PackData(&onGoing);
       
  2103 
       
  2104 	iMessageManagerCallback.Complete(ESatTsySetProactiveCommandOnGoingStatus, &dataPackage, aError);
       
  2105 
       
  2106 	} // CSatDispatcher::CallbackTerminalRsp
       
  2107 
       
  2108 void CSatDispatcher::CallbackSync(CRequestQueueOneShot::TIpcDataPackage& aIpcDataPackage)
       
  2109 /**
       
  2110  * Part of the MDispatcherCallback interface. Used to complete requests handled
       
  2111  * synchronously by the Licensee LTSY asynchronously back to the Common TSY.
       
  2112  *  
       
  2113  * This function is optional and should only be used if the licensee wishes to including the Dispatcher beneath their own SIM ATK TSY.  
       
  2114  *  
       
  2115  * @param aIpcDataPackage Package encapsulating the request.
       
  2116  * 
       
  2117  * @see MDispatcherCallback::CallbackSync
       
  2118  */
       
  2119 	{
       
  2120 	TSYLOGENTRYEXIT;
       
  2121 	
       
  2122 	switch (aIpcDataPackage.iIpc)
       
  2123 		{
       
  2124 	
       
  2125 	default:
       
  2126 		LOG(_L8("WARNING: CSatDispatcher::CallbackSync unhandled IPC=%d"), aIpcDataPackage.iIpc);
       
  2127 		__ASSERT_DEBUG(NULL, CtsyDispatcherPanic(EUnhandledCtsyIpc));
       
  2128 		break;		
       
  2129 		} // switch (aIpcDataPackage.iIpc)
       
  2130 	
       
  2131 	} // CSatDispatcher::CallbackSync
       
  2132 
       
  2133 
       
  2134