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