cmmanager/cmmgr/cmmplugins/cmpluginlan/src/cmpluginlan.cpp
changeset 27 489cf6208544
parent 23 7ec726f93df1
child 40 c5b848e6c7d1
--- a/cmmanager/cmmgr/cmmplugins/cmpluginlan/src/cmpluginlan.cpp	Fri May 14 16:15:46 2010 +0300
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginlan/src/cmpluginlan.cpp	Thu May 27 13:17:01 2010 +0300
@@ -57,8 +57,6 @@
 const TInt KLanLastSocketClosedTimeout = -1;
 const TInt KLanLastSessionClosedTimeout = -1;
 
-const TUint32 KDefaultPriorityLAN = 0;
-
 
 // ---------------------------------------------------------
 // CCmPluginLan::NewOutgoingL()
@@ -135,6 +133,16 @@
     FeatureManager::InitializeLibL();
 
     CCmPluginBaseEng::ConstructL();
+    
+    // Get bearer priority table ID.
+    TRAP_IGNORE( iBearerPriorityTableId = 
+            CCDGlobalBearerTypePriorizationRecord::TableIdL( iSession ) );
+
+    if ( !iBearerPriorityTableId )
+        {
+        iBearerPriorityTableId = 
+                CCDGlobalBearerTypePriorizationRecord::CreateTableL( iSession );
+        }
 
     OstTraceFunctionExit0( CCMPLUGINLAN_CONSTRUCTL_EXIT );
     }
@@ -197,7 +205,6 @@
 void CCmPluginLan::PreparePluginToLoadRecordsL()
     {
     OstTraceFunctionEntry0( CCMPLUGINLAN_PREPAREPLUGINTOLOADRECORDSL_ENTRY );
-
     OstTraceFunctionExit0( CCMPLUGINLAN_PREPAREPLUGINTOLOADRECORDSL_EXIT );
     }
 
@@ -206,8 +213,8 @@
 // ----------------------------------------------------------------------------
 //
 void CCmPluginLan::PreparePluginToUpdateRecordsL(
-    RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
-    RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray )
+        RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
+        RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray )
     {
     OstTraceFunctionEntry0( CCMPLUGINLAN_PREPAREPLUGINTOUPDATERECORDSL_ENTRY );
 
@@ -245,11 +252,10 @@
     delete iServiceRecord;
     iServiceRecord = NULL;
 
-    iServiceRecord = static_cast<CCDLANServiceRecord*>
-                (CCDRecordBase::RecordFactoryL( KCDTIdLANServiceRecord ) );
+    iServiceRecord = static_cast<CCDLANServiceRecord*>(
+            CCDRecordBase::RecordFactoryL( KCDTIdLANServiceRecord ) );
 
-    CCDLANServiceRecord* lanServiceRecord = static_cast<CCDLANServiceRecord *>( iServiceRecord );
-
+    CCDLANServiceRecord* lanServiceRecord = static_cast<CCDLANServiceRecord*>( iServiceRecord );
 
     if ( FeatureManager::FeatureSupported( KFeatureIdIPv6 ) )
         {
@@ -283,6 +289,7 @@
         lanServiceRecord->iConfigDaemonManagerName.SetL( KEmpty );
         lanServiceRecord->iConfigDaemonName.SetL( KEmpty );
         }
+
     OstTraceFunctionExit0( CCMPLUGINLAN_CREATESERVICERECORDL_EXIT );
     }
 
@@ -831,9 +838,14 @@
             retVal = KCommDbBearerLAN;
             }
             break;
+        case ECmDefaultUiPriority:
+            {
+            retVal = GetDefPriorityL( aAttribute );
+            }
+            break;
         case ECmDefaultPriority:
             {
-            retVal = KDefaultPriorityLAN;
+            retVal = GetDefPriorityL( aAttribute );
             }
             break;
         case ELanServiceExtensionTableRecordId:
@@ -1311,9 +1323,13 @@
             }
             break;
         case ECmDefaultUiPriority:
+            {
+            retVal = GetDefPriorityL( aAttribute );
+            }
+            break;
         case ECmDefaultPriority:
             {
-            retVal = KDefaultPriorityLAN;
+            retVal = GetDefPriorityL( aAttribute );
             }
             break;
         case ECmExtensionLevel:
@@ -1459,4 +1475,44 @@
     OstTraceFunctionExit0( CCMPLUGINLAN_GETBEARERTABLEIDSTOBEOBSERVED_EXIT );
     }
 
+// ---------------------------------------------------------------------------
+// CCmPluginLan::GetDefPriorityL
+// ---------------------------------------------------------------------------
+//
+TUint32 CCmPluginLan::GetDefPriorityL( const TUint32 aAttribute ) const//TODO, OST
+    {
+
+    TUint32 retVal( KDataMobilitySelectionPolicyPriorityWildCard );
+
+    CCDGlobalBearerTypePriorizationRecord* priorityRecord =
+            new( ELeave ) CCDGlobalBearerTypePriorizationRecord( iBearerPriorityTableId );
+    CleanupStack::PushL( priorityRecord );
+
+    priorityRecord->iServiceType.SetL( TPtrC( KCDTypeNameLANService ) );
+
+    if ( priorityRecord->FindL( iSession ) )
+        {
+        priorityRecord->LoadL( iSession );
+
+        switch ( aAttribute )
+            {
+            case ECmDefaultPriority:
+                {
+                retVal = priorityRecord->iPriority;
+                }
+                break;
+            case ECmDefaultUiPriority:
+                {
+                retVal = priorityRecord->iUIPriority;
+                }
+                break;
+            default:
+                break;
+            }
+        }
+    CleanupStack::PopAndDestroy( priorityRecord );
+
+    return retVal;
+    }
+
 //  End of File