telephonyprotocols/pdplayer/src/pdpservices.cpp
branchRCL_3
changeset 66 07a122eea281
parent 65 630d2f34d719
child 74 9200f38b1324
equal deleted inserted replaced
65:630d2f34d719 66:07a122eea281
     1 // Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    16 /**
    16 /**
    17  @file
    17  @file
    18  @internalComponent
    18  @internalComponent
    19 */
    19 */
    20 
    20 
    21 
       
    22 #include "OstTraceDefinitions.h"
       
    23 #ifdef OST_TRACE_COMPILER_IN_USE
       
    24 #include "pdpservicesTraces.h"
       
    25 #endif
       
    26 
       
    27 #include <comms-infras/ss_log.h>
    21 #include <comms-infras/ss_log.h>
    28 #include <comms-infras/ss_corepractivities.h> // TODO is this needed?
    22 #include <comms-infras/ss_corepractivities.h> // TODO is this needed?
    29 #include <comms-infras/coretiermanagerstates.h> // TODO is this needed?
    23 #include <comms-infras/coretiermanagerstates.h> // TODO is this needed?
    30 #include <comms-infras/coretiermanageractivities.h> // TODO is this needed?
    24 #include <comms-infras/coretiermanageractivities.h> // TODO is this needed?
    31 #include "pdpservices.h"
    25 #include "pdpservices.h"
    32 #include "pdptiermanager.h"
    26 #include "pdptiermanager.h"
    33 #include <pcktcs.h>
    27 #include <pcktcs.h>
    34 #include <comms-infras/es_connectionserv.h>
    28 #include <comms-infras/es_connectionserv.h>
       
    29 
       
    30 #ifdef __CFLOG_ACTIVE
       
    31 #define KPDPTierMgrTag KESockMetaConnectionTag
       
    32 _LIT8(KMBMSObjectTag, "MBMSObject");
       
    33 #endif
    35 
    34 
    36 using namespace Messages;
    35 using namespace Messages;
    37 using namespace MeshMachine; // TODO is this needed?
    36 using namespace MeshMachine; // TODO is this needed?
    38 using namespace ESock;
    37 using namespace ESock;
    39 using namespace NetStateMachine; // TODO is this needed?
    38 using namespace NetStateMachine; // TODO is this needed?
   118 @param aError const TInt
   117 @param aError const TInt
   119 @return void
   118 @return void
   120 */
   119 */
   121 void CMBMSServiceRequest::CancelMessage(const TInt aError)
   120 void CMBMSServiceRequest::CancelMessage(const TInt aError)
   122 	{
   121 	{
   123     OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMBMSSERVICEREQUEST_CANCELMESSAGE_1, "CMBMSServiceRequest[%08x]::CancelMessage(%d)", (TUint)this, aError);
   122 	__CFLOG_VAR((KPDPTierMgrTag, KMBMSObjectTag, _L8("CMBMSServiceRequest[%08x]::CancelMessage(%d)"), this, aError));
   124 	if (iRequestType == TCFTierStatusProvider::TTierNotificationRegistration::Id())
   123 	if (iRequestType == TCFTierStatusProvider::TTierNotificationRegistration::Id())
   125 		{
   124 		{
   126 		iRequestOriginator.PostMessage(
   125 		iRequestOriginator.PostMessage(
   127 				iMBMSTMCommsId,
   126 				iMBMSTMCommsId,
   128 				TEBase::TError(TCFTierStatusProvider::TTierNotificationRegistration::Id(), aError).CRef()
   127 				TEBase::TError(TCFTierStatusProvider::TTierNotificationRegistration::Id(), aError).CRef()
   196 @param None
   195 @param None
   197 @return TInt
   196 @return TInt
   198 */
   197 */
   199 TInt CMBMSServiceRequest::RunError(TInt aError)
   198 TInt CMBMSServiceRequest::RunError(TInt aError)
   200 	{
   199 	{
   201     OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMBMSSERVICEREQUEST_RUNERROR_1, "CMBMSServiceRequest[%08x]::RunError(%d)", (TUint)this, aError);
   200 	__CFLOG_VAR((KPDPTierMgrTag, KMBMSObjectTag, _L8("CMBMSServiceRequest[%08x]::RunError(%d)"), this, aError));
   202 
   201 
   203 	// Stop the ScanEngine components
   202 	// Stop the ScanEngine components
   204 	Cancel();
   203 	Cancel();
   205 
   204 
   206 	if (iRequestType == TCFTierStatusProvider::TTierNotificationRegistration::Id())
   205 	if (iRequestType == TCFTierStatusProvider::TTierNotificationRegistration::Id())
   224 	if (iStatus == KErrNone)
   223 	if (iStatus == KErrNone)
   225 		{
   224 		{
   226 		switch(iScanEngineState)
   225 		switch(iScanEngineState)
   227 			{
   226 			{
   228 			case EChecking:
   227 			case EChecking:
   229 				OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMBMSSERVICEREQUEST_RUNL_1, "CMBMSServiceRequest[%08x]::In EChecking State", (TUint)this);
   228 				__CFLOG_VAR((KPDPTierMgrTag, KMBMSObjectTag, _L8("CMBMSServiceRequest[%08x]::In EChecking State"), this));
   230 				User::LeaveIfError(iMBMSEngine.GetRPacketService().GetStatus(iPsdStatus)); // get initial status
   229 				User::LeaveIfError(iMBMSEngine.GetRPacketService().GetStatus(iPsdStatus)); // get initial status
   231 
   230 
   232 				//check the query type
   231 				//check the query type
   233 				if(iQueryType == XMBMSServiceQuerySet::EBearerAvailability)
   232 				if(iQueryType == XMBMSServiceQuerySet::EBearerAvailability)
   234 					iScanEngineState = EBearerAvailable;
   233 					iScanEngineState = EBearerAvailable;
   247 				User::RequestComplete(status, KErrNone);
   246 				User::RequestComplete(status, KErrNone);
   248 			break;
   247 			break;
   249 
   248 
   250 			case EBearerAvailable:
   249 			case EBearerAvailable:
   251 				//get MBMS bearer availability.
   250 				//get MBMS bearer availability.
   252 				 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMBMSSERVICEREQUEST_RUNL_2, "CMBMSServiceRequest[%08x]::In EBearerAvailable State", (TUint)this);
   251 				 __CFLOG_VAR((KPDPTierMgrTag, KMBMSObjectTag, _L8("CMBMSServiceRequest[%08x]::In EBearerAvailable State"), this));
   253 				 iMBMSEngine.GetRPacketService().GetMbmsNetworkServiceStatus(iStatus,ETrue,iNetworkServiceStatus);
   252 				 iMBMSEngine.GetRPacketService().GetMbmsNetworkServiceStatus(iStatus,ETrue,iNetworkServiceStatus);
   254 			 	 iScanEngineState = ERetrieveBearerAvailability;
   253 			 	 iScanEngineState = ERetrieveBearerAvailability;
   255 				 SetActive();
   254 				 SetActive();
   256 			break;
   255 			break;
   257 
   256 
   258 		   	case ERetrieveBearerAvailability:
   257 		   	case ERetrieveBearerAvailability:
   259 				OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMBMSSERVICEREQUEST_RUNL_3, "CMBMSServiceRequest[%08x]::In ERetrieveBearerAvailability State", (TUint)this);
   258 				__CFLOG_VAR((KPDPTierMgrTag, KMBMSObjectTag, _L8("CMBMSServiceRequest[%08x]::In ERetrieveBearerAvailability State"), this));
   260 			    //create a parameter bundle and send the results to the client.
   259 			    //create a parameter bundle and send the results to the client.
   261 			    SendResultBundleL();
   260 			    SendResultBundleL();
   262 
   261 
   263 			    iScanEngineState = EBearerAvailable;
   262 			    iScanEngineState = EBearerAvailable;
   264 			    SetActive();
   263 			    SetActive();
   302 				}
   301 				}
   303 			break;
   302 			break;
   304 
   303 
   305 			case EGetCountMonitorList:
   304 			case EGetCountMonitorList:
   306 				{
   305 				{
   307 				OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMBMSSERVICEREQUEST_RUNL_4, "CMBMSServiceRequest[%08x]::In ECountActiveServiceList State", (TUint)this);
   306 				__CFLOG_VAR((KPDPTierMgrTag, KMBMSObjectTag, _L8("CMBMSServiceRequest[%08x]::In ECountActiveServiceList State"), this));
   308 				iMBMSEngine.GetRPacketService().EnumerateMbmsMonitorServiceList(iStatus,iCount,iMaxCount);
   307 				iMBMSEngine.GetRPacketService().EnumerateMbmsMonitorServiceList(iStatus,iCount,iMaxCount);
   309 
   308 
   310 				SetActive();
   309 				SetActive();
   311 				iScanEngineState = EResultCount;
   310 				iScanEngineState = EResultCount;
   312 				}
   311 				}
   313 			break;
   312 			break;
   314 
   313 
   315 			case EGetCountServiceList:
   314 			case EGetCountServiceList:
   316 				{
   315 				{
   317 				OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMBMSSERVICEREQUEST_RUNL_5, "CMBMSServiceRequest[%08x]::In ECountActiveServiceList State", (TUint)this);
   316 				__CFLOG_VAR((KPDPTierMgrTag, KMBMSObjectTag, _L8("CMBMSServiceRequest[%08x]::In ECountActiveServiceList State"), this));
   318 				iMBMSEngine.GetRPacketService().EnumerateMbmsActiveServiceList(iStatus,iCount,iMaxCount);
   317 				iMBMSEngine.GetRPacketService().EnumerateMbmsActiveServiceList(iStatus,iCount,iMaxCount);
   319 
   318 
   320 				SetActive();
   319 				SetActive();
   321 				iScanEngineState = EResultCount;
   320 				iScanEngineState = EResultCount;
   322 				}
   321 				}
   326 				SendResultBundleL();
   325 				SendResultBundleL();
   327 			break;
   326 			break;
   328 
   327 
   329 			case ENotifyService:
   328 			case ENotifyService:
   330 				//notify for MBMS Services.
   329 				//notify for MBMS Services.
   331 				OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMBMSSERVICEREQUEST_RUNL_6, "CMBMSServiceRequest[%08x]::In ENotifyService State", (TUint)this);
   330 				__CFLOG_VAR((KPDPTierMgrTag, KMBMSObjectTag, _L8("CMBMSServiceRequest[%08x]::In ENotifyService State"), this));
   332 				iMBMSEngine.GetRPacketService().NotifyMbmsServiceAvailabilityChange(iStatus);
   331 				iMBMSEngine.GetRPacketService().NotifyMbmsServiceAvailabilityChange(iStatus);
   333 			    SetActive();
   332 			    SetActive();
   334 				iScanEngineState = EStartMonitor;
   333 				iScanEngineState = EStartMonitor;
   335 			break;
   334 			break;
   336 
   335 
   337 			case EStartMonitor:
   336 			case EStartMonitor:
   338 				OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMBMSSERVICEREQUEST_RUNL_7, "CMBMSServiceRequest[%08x]::In EStartMonitor State", (TUint)this);
   337 				__CFLOG_VAR((KPDPTierMgrTag, KMBMSObjectTag, _L8("CMBMSServiceRequest[%08x]::In EStartMonitor State"), this));
   339 				iRetrievePcktMbms = CRetrievePcktMbmsMonitoredServices::NewL(iMBMSEngine.GetRPacketService());
   338 				iRetrievePcktMbms = CRetrievePcktMbmsMonitoredServices::NewL(iMBMSEngine.GetRPacketService());
   340 			    iRetrievePcktMbms->Start(iStatus);
   339 			    iRetrievePcktMbms->Start(iStatus);
   341 
   340 
   342 			    SetActive();
   341 			    SetActive();
   343 				iScanEngineState = EGetMonitorList;
   342 				iScanEngineState = EGetMonitorList;
   353 
   352 
   354 		  }
   353 		  }
   355 		}
   354 		}
   356 	else if(((iStatus.Int() == KErrMbmsImpreciseServiceEntries))||((iStatus.Int() == KErrNotFound)))
   355 	else if(((iStatus.Int() == KErrMbmsImpreciseServiceEntries))||((iStatus.Int() == KErrNotFound)))
   357 		 {
   356 		 {
   358 		  OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMBMSSERVICEREQUEST_RUNL_8, "CMBMSServiceRequest[%08x]::RunL() KErrMbmsImpreciseServiceEntries || KErrNotFound", (TUint)this);
   357 		  __CFLOG_VAR((KPDPTierMgrTag, KMBMSObjectTag, _L8("CMBMSServiceRequest[%08x]::RunL() KErrMbmsImpreciseServiceEntries || KErrNotFound"), this));
   359 		  CancelMessage(iStatus.Int());
   358 		  CancelMessage(iStatus.Int());
   360 		  iMBMSEngine.RemoveFromRequestListL(GetClientId());
   359 		  iMBMSEngine.RemoveFromRequestListL(GetClientId());
   361 		 }
   360 		 }
   362 	else
   361 	else
   363 		{
   362 		{
   364 		 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMBMSSERVICEREQUEST_RUNL_9, "CMBMSServiceRequest[%08x]::RunL() ERROR: Incorrect status, Aborting", (TUint)this);
   363 		 __CFLOG_VAR((KPDPTierMgrTag, KMBMSObjectTag, _L8("CMBMSServiceRequest[%08x]::RunL() ERROR: Incorrect status, Aborting"), this));
   365 		 User::Leave(iStatus.Int());
   364 		 User::Leave(iStatus.Int());
   366 		}
   365 		}
   367 
   366 
   368 	}
   367 	}
   369 
   368 
   372 @param None
   371 @param None
   373 @return Void
   372 @return Void
   374 */
   373 */
   375 CPcktMbmsMonitoredServiceList* CMBMSServiceRequest::UpdateMonitorServiceListL()
   374 CPcktMbmsMonitoredServiceList* CMBMSServiceRequest::UpdateMonitorServiceListL()
   376 	{
   375 	{
   377 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMBMSSERVICEREQUEST_UPDATEMONITORSERVICELISTL_1, "CMBMSServiceRequest[%08x]::In UpdateMonitorServiceListL()", (TUint)this);
   376 	__CFLOG_VAR((KPDPTierMgrTag, KMBMSObjectTag, _L8("CMBMSServiceRequest[%08x]::In UpdateMonitorServiceListL()"), this));
   378 
   377 
   379 	//Read the entries in the parameter bundle and pass them to Etel.
   378 	//Read the entries in the parameter bundle and pass them to Etel.
   380 	CPcktMbmsMonitoredServiceList* serviceList= CPcktMbmsMonitoredServiceList::NewL();
   379 	CPcktMbmsMonitoredServiceList* serviceList= CPcktMbmsMonitoredServiceList::NewL();
   381 	CleanupStack::PushL(serviceList);
   380 	CleanupStack::PushL(serviceList);
   382 
   381 
   446 CConnectionServParameterBundle* CMBMSServiceRequest::PrepareMonitorResultBundleL() const
   445 CConnectionServParameterBundle* CMBMSServiceRequest::PrepareMonitorResultBundleL() const
   447 	{
   446 	{
   448 	CConnectionServParameterBundle* returnBundle = CConnectionServParameterBundle::NewL();
   447 	CConnectionServParameterBundle* returnBundle = CConnectionServParameterBundle::NewL();
   449 	CleanupStack::PushL(returnBundle);
   448 	CleanupStack::PushL(returnBundle);
   450 
   449 
   451 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMBMSSERVICEREQUEST_PREPAREMONITORRESULTBUNDLEL_1, "CMBMSServiceRequest[%08x]::In PrepareMonitorResultBundleL function", (TUint)this);
   450 	__CFLOG_VAR((KPDPTierMgrTag, KMBMSObjectTag, _L8("CMBMSServiceRequest[%08x]::In PrepareMonitorResultBundleL function"), this));
   452 	//read the MBMS Service list from Etel after receiving the MBMS Service Availability Notification.
   451 	//read the MBMS Service list from Etel after receiving the MBMS Service Availability Notification.
   453 
   452 
   454 	CPcktMbmsMonitoredServiceList* serviceList = iRetrievePcktMbms->RetrieveListL();
   453 	CPcktMbmsMonitoredServiceList* serviceList = iRetrievePcktMbms->RetrieveListL();
   455 	TInt count = serviceList->Enumerate();
   454 	TInt count = serviceList->Enumerate();
   456 	CleanupStack::PushL(serviceList);
   455 	CleanupStack::PushL(serviceList);
   491 @param None
   490 @param None
   492 @return CConnectionServParameterBundle*
   491 @return CConnectionServParameterBundle*
   493 */
   492 */
   494 CConnectionServParameterBundle* CMBMSServiceRequest::PrepareBearerResultBundleL() const
   493 CConnectionServParameterBundle* CMBMSServiceRequest::PrepareBearerResultBundleL() const
   495 	{
   494 	{
   496 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMBMSSERVICEREQUEST_PREPAREBEARERRESULTBUNDLEL_1, "CMBMSServiceRequest[%08x]::In PrepareBearerResultBundleL function", (TUint)this);
   495 	__CFLOG_VAR((KPDPTierMgrTag, KMBMSObjectTag, _L8("CMBMSServiceRequest[%08x]::In PrepareBearerResultBundleL function"), this));
   497 
   496 
   498 	CConnectionServParameterBundle* returnBundle = CConnectionServParameterBundle::NewL();
   497 	CConnectionServParameterBundle* returnBundle = CConnectionServParameterBundle::NewL();
   499 	CleanupStack::PushL(returnBundle);
   498 	CleanupStack::PushL(returnBundle);
   500 
   499 
   501 	CParameterSetContainer* returnPSC = CParameterSetContainer::NewL(*returnBundle);
   500 	CParameterSetContainer* returnPSC = CParameterSetContainer::NewL(*returnBundle);
   516 @param None
   515 @param None
   517 @return CConnectionServParameterBundle*
   516 @return CConnectionServParameterBundle*
   518 */
   517 */
   519 CConnectionServParameterBundle* CMBMSServiceRequest::PrepareCountBundleL() const
   518 CConnectionServParameterBundle* CMBMSServiceRequest::PrepareCountBundleL() const
   520 	{
   519 	{
   521 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMBMSSERVICEREQUEST_PREPARECOUNTBUNDLEL_1, "CMBMSServiceRequest[%08x]::In PrepareCountBundleL function", (TUint)this);
   520 	__CFLOG_VAR((KPDPTierMgrTag, KMBMSObjectTag, _L8("CMBMSServiceRequest[%08x]::In PrepareCountBundleL function"), this));
   522 
   521 
   523 	CConnectionServParameterBundle* returnBundle = CConnectionServParameterBundle::NewL();
   522 	CConnectionServParameterBundle* returnBundle = CConnectionServParameterBundle::NewL();
   524 	CleanupStack::PushL(returnBundle);
   523 	CleanupStack::PushL(returnBundle);
   525 
   524 
   526 	CParameterSetContainer* returnPSC = CParameterSetContainer::NewL(*returnBundle);
   525 	CParameterSetContainer* returnPSC = CParameterSetContainer::NewL(*returnBundle);
   542 @return CConnectionServParameterBundle*
   541 @return CConnectionServParameterBundle*
   543 */
   542 */
   544 CConnectionServParameterBundle* CMBMSServiceRequest::PrepareRemoveAllBundleL() const
   543 CConnectionServParameterBundle* CMBMSServiceRequest::PrepareRemoveAllBundleL() const
   545 	{
   544 	{
   546 	//pass empty bundle
   545 	//pass empty bundle
   547 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMBMSSERVICEREQUEST_PREPAREREMOVEALLBUNDLEL_1, "CMBMSServiceRequest[%08x]::In PrepareRemoveAllBundleL function", (TUint)this);
   546 	__CFLOG_VAR((KPDPTierMgrTag, KMBMSObjectTag, _L8("CMBMSServiceRequest[%08x]::In PrepareRemoveAllBundleL function"), this));
   548 
   547 
   549 	CConnectionServParameterBundle* returnBundle = CConnectionServParameterBundle::NewL();
   548 	CConnectionServParameterBundle* returnBundle = CConnectionServParameterBundle::NewL();
   550 	return returnBundle;
   549 	return returnBundle;
   551 	}
   550 	}