telephonyprotocols/pdplayer/src/pdptiermanagerselector.cpp
branchRCL_3
changeset 66 07a122eea281
parent 65 630d2f34d719
equal deleted inserted replaced
65:630d2f34d719 66:07a122eea281
     1 // Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2006-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 "pdptiermanagerselectorTraces.h"
       
    25 #endif
       
    26 
       
    27 #include "pdptiermanagerselector.h"
    21 #include "pdptiermanagerselector.h"
    28 #include "pdptiermanagerfactory.h"
    22 #include "pdptiermanagerfactory.h"
    29 
    23 
    30 #include <comms-infras/ss_log.h>
    24 #include <comms-infras/ss_log.h>
    31 #include <commsdattypesv1_1.h>
    25 #include <commsdattypesv1_1.h>
    32 #include <commsdattypesv1_1_partner.h>
    26 #include <commsdattypesv1_1_partner.h>
    33 #include <comms-infras/ss_tiermanagerutils.h>
    27 #include <comms-infras/ss_tiermanagerutils.h>
    34 #include <es_connpref.h>	//TConnIdList
    28 #include <es_connpref.h>	//TConnIdList
    35 #include <es_enum_internal.h>
    29 #include <es_enum_internal.h>	
       
    30 
       
    31 #ifdef __CFLOG_ACTIVE
       
    32 #define KPdpTierMgrTag KESockTierTag
       
    33 _LIT8(KPdpTierMgrSubTag, "pdptiermgr");
       
    34 #endif // __CFLOG_ACTIVE
    36 
    35 
    37 using namespace ESock;
    36 using namespace ESock;
    38 using namespace CommsDat;
    37 using namespace CommsDat;
    39 
    38 
    40 
    39 
    76 	__ASSERT_DEBUG(defaultAccessPoint!=0,User::Panic(KPdpSelectorPanic,EExpectedAccessPointAwareSystem));
    75 	__ASSERT_DEBUG(defaultAccessPoint!=0,User::Panic(KPdpSelectorPanic,EExpectedAccessPointAwareSystem));
    77 
    76 
    78 	if (iSelectionPrefs.IsEmpty())
    77 	if (iSelectionPrefs.IsEmpty())
    79 		{
    78 		{
    80     	//Implicit case on the new setup
    79     	//Implicit case on the new setup
    81         OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPPROVIDERSELECTOR_SELECTL_1, "CPdpProviderSelector %08x::\tSelectL() Using Default AP:%d",(TUint)this,defaultAccessPoint);
    80 		__CFLOG_VAR((KPdpTierMgrTag, KPdpTierMgrSubTag, _L8("CPdpProviderSelector %08x::\tSelectL() Using Default AP:%d"),this,defaultAccessPoint));
    82 		aSelectionNotify.SelectComplete(this,FindOrCreateProviderL(defaultAccessPoint));
    81 		aSelectionNotify.SelectComplete(this,FindOrCreateProviderL(defaultAccessPoint));
    83 		aSelectionNotify.SelectComplete(this,NULL);
    82 		aSelectionNotify.SelectComplete(this,NULL);
    84 		return;
    83 		return;
    85 		}
    84 		}
    86 
    85 
    87 	const TConnPref& prefs = iSelectionPrefs.Prefs();
    86 	const TConnPref& prefs = iSelectionPrefs.Prefs();
    88 	if (prefs.ExtensionId() == TConnPref::EConnPrefProviderInfo)
    87 	if (prefs.ExtensionId() == TConnPref::EConnPrefProviderInfo)
    89 		{
    88 		{
    90     	ASSERT(iSelectionPrefs.Scope() & TSelectionPrefs::ESelectFromExisting); //This is always attach
    89     	ASSERT(iSelectionPrefs.Scope() & TSelectionPrefs::ESelectFromExisting); //This is always attach
    91 		const TConnProviderInfo& connProvInfo = static_cast<const TConnProviderInfoPref&>(prefs).Info();
    90 		const TConnProviderInfo& connProvInfo = static_cast<const TConnProviderInfoPref&>(prefs).Info();
    92 		OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPPROVIDERSELECTOR_SELECTL_2, "CPdpProviderSelector %08x::\tSelectL() Using TConnProviderInfoPref, AP:%d",(TUint)this,connProvInfo.iInfo[1]);
    91 		__CFLOG_VAR((KPdpTierMgrTag, KPdpTierMgrSubTag, _L8("CPdpProviderSelector %08x::\tSelectL() Using TConnProviderInfoPref, AP:%d"),this,connProvInfo.iInfo[1]));
    93 		aSelectionNotify.SelectComplete(this,FindProviderL(connProvInfo.iInfo[1],(TAny*)connProvInfo.iInfo[2]));
    92 		aSelectionNotify.SelectComplete(this,FindProviderL(connProvInfo.iInfo[1],(TAny*)connProvInfo.iInfo[2]));
    94 		aSelectionNotify.SelectComplete(this,NULL);
    93 		aSelectionNotify.SelectComplete(this,NULL);
    95 		return;
    94 		return;
    96 		}
    95 		}
    97 
    96 
    98 	if (prefs.ExtensionId() == TConnPref::EConnPrefSnap)
    97 	if (prefs.ExtensionId() == TConnPref::EConnPrefSnap)
    99 		{
    98 		{
   100 		TUint accessPoint = static_cast<const TConnSnapPref&>(prefs).Snap();
    99 		TUint accessPoint = static_cast<const TConnSnapPref&>(prefs).Snap();
   101 		OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPPROVIDERSELECTOR_SELECTL_3, "CPdpProviderSelector %08x::\tSelectL() Using TConnPrefSnap, AP:%d",(TUint)this,accessPoint);
   100 		__CFLOG_VAR((KPdpTierMgrTag, KPdpTierMgrSubTag, _L8("CPdpProviderSelector %08x::\tSelectL() Using TConnPrefSnap, AP:%d"),this,accessPoint));
   102 		aSelectionNotify.SelectComplete(this,FindOrCreateProviderL(accessPoint));
   101 		aSelectionNotify.SelectComplete(this,FindOrCreateProviderL(accessPoint));
   103 		aSelectionNotify.SelectComplete(this,NULL);
   102 		aSelectionNotify.SelectComplete(this,NULL);
   104 		return;
   103 		return;
   105 		}
   104 		}
   106 
   105 
   107 	if (prefs.ExtensionId() == TConnPref::EConnPrefIdList)
   106 	if (prefs.ExtensionId() == TConnPref::EConnPrefIdList)
   108 		{
   107 		{
   109 		OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPPROVIDERSELECTOR_SELECTL_4, "CPdpProviderSelector %08x::\tSelectL() Using TConnIdList",(TUint)this);
   108 		__CFLOG_VAR((KPdpTierMgrTag, KPdpTierMgrSubTag, _L8("CPdpProviderSelector %08x::\tSelectL() Using TConnIdList"),this));
   110 		const TConnIdList& list = static_cast<const TConnIdList&>(prefs);
   109 		const TConnIdList& list = static_cast<const TConnIdList&>(prefs);
   111 		TInt count = list.Count();
   110 		TInt count = list.Count();
   112 		for (TInt i = 0; i < count; i++)
   111 		for (TInt i = 0; i < count; i++)
   113 			{
   112 			{
   114 			aSelectionNotify.SelectComplete(this,FindOrCreateProviderL(list.Get(i)));
   113 			aSelectionNotify.SelectComplete(this,FindOrCreateProviderL(list.Get(i)));
   117 		return;
   116 		return;
   118 		}
   117 		}
   119 
   118 
   120 	//In this selector we _must_ have the new preferences, otherwise it means that
   119 	//In this selector we _must_ have the new preferences, otherwise it means that
   121 	//a critical, non-recoverable mitsake has occured before when this selector has been picked.
   120 	//a critical, non-recoverable mitsake has occured before when this selector has been picked.
   122 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPPROVIDERSELECTOR_SELECTL_5, "ERROR: CPdpProviderSelector %08x::\tSelectL() Unexpected selection preferences",(TUint)this);
   121 	__CFLOG_VAR((KPdpTierMgrTag, KPdpTierMgrSubTag, _L8("ERROR: CPdpProviderSelector %08x::\tSelectL() Unexpected selection preferences"),this));
   123 	User::Panic(KPdpSelectorPanic,EUnExpectedSelectionPreferences);
   122 	User::Panic(KPdpSelectorPanic,EUnExpectedSelectionPreferences);
   124 	}
   123 	}
   125 
   124 
   126 //
   125 //
   127 // TPdpSelectorFactory::NewSelectorL - This fn matches a selector
   126 // TPdpSelectorFactory::NewSelectorL - This fn matches a selector
   128 MProviderSelector* TPdpSelectorFactory::NewSelectorL(const Meta::SMetaData& aSelectionPreferences)
   127 MProviderSelector* TPdpSelectorFactory::NewSelectorL(const Meta::SMetaData& aSelectionPreferences)
   129 	{
   128 	{
   130 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, TPDPSELECTORFACTORY_NEWSELECTORL_1, "CPdpMetaCprSelectorBase::\tNewL()");
   129 	__CFLOG_VAR((KPdpTierMgrTag, KPdpTierMgrSubTag, _L8("CPdpMetaCprSelectorBase::\tNewL()")));
   131 	ASSERT(aSelectionPreferences.IsTypeOf(TSelectionPrefs::TypeId()));
   130 	ASSERT(aSelectionPreferences.IsTypeOf(TSelectionPrefs::TypeId()));
   132 	CMDBSession* dbs = CMDBSession::NewLC(KCDVersion1_2);
   131 	CMDBSession* dbs = CMDBSession::NewLC(KCDVersion1_2);
   133 	CPdpProviderSelector* self = new (ELeave) CPdpProviderSelector(aSelectionPreferences);
   132 	CPdpProviderSelector* self = new (ELeave) CPdpProviderSelector(aSelectionPreferences);
   134 	CleanupStack::PushL(self);
   133 	CleanupStack::PushL(self);
   135 	ASSERT(self->iTierRecord==NULL);
   134 	ASSERT(self->iTierRecord==NULL);