cmmanager/cmmgr/cmmserver/src/cmmconnmethoditem.cpp
changeset 40 c5b848e6c7d1
parent 20 9c97ad6591ae
--- a/cmmanager/cmmgr/cmmserver/src/cmmconnmethoditem.cpp	Thu May 27 14:35:19 2010 +0300
+++ b/cmmanager/cmmgr/cmmserver/src/cmmconnmethoditem.cpp	Thu Jun 10 16:00:16 2010 +0300
@@ -19,6 +19,9 @@
 */
 
 
+#include <cmmanagerdef.h>
+#include <cmpluginembdestinationdef.h>
+
 #include "cmmconnmethoditem.h"
 
 
@@ -27,11 +30,15 @@
 // ---------------------------------------------------------------------------
 //
 TCmmConnMethodItem::TCmmConnMethodItem()
+        :
+        iId( 0 ),
+        iBearerType( 0 ),
+        iBearerPriority( 0 ),
+        iPriority( 0 ),
+        iIsVirtual( 0 ),
+        iLinkedIapId( 0 ),
+        iLinkedSnapId( 0 )           
     {
-    iId = 0;
-    iBearerType = 0;
-    iBearerPriority = 0;
-    iPriority = 0;
     }
 
 // ---------------------------------------------------------------------------
@@ -42,12 +49,18 @@
         TUint32 aId,
         TUint32 aBearerType,
         TUint aBearerPriority,
-        TUint aPriority )
+        TUint aPriority,
+        TBool aIsVirtual,
+        TUint32 aLinkedIapId,
+        TUint32 aLinkedSnapId )
         :
         iId( aId ),
         iBearerType( aBearerType ),
         iBearerPriority( aBearerPriority ),
-        iPriority( aPriority )
+        iPriority( aPriority ),
+        iIsVirtual( aIsVirtual ),
+        iLinkedIapId( aLinkedIapId ),
+        iLinkedSnapId( aLinkedSnapId )
     {
     }
 
@@ -60,7 +73,27 @@
         const TCmmConnMethodItem& aSecond )
     {
     // Zero if match, negative if first is smaller, positive otherwise.
-    return ( TInt )aFirst.iPriority - ( TInt )aSecond.iPriority;
+    TInt result = ( TInt )aFirst.iPriority - ( TInt )aSecond.iPriority;
+
+    if ( result == 0 &&
+            aFirst.iPriority == CMManager::KDataMobilitySelectionPolicyPriorityWildCard )
+        {
+        // Embedded destination and virtual IAPs linking to SNAP have wildcard
+        // priority.
+        // If both connection methods have wildcard priority, only need to
+        // ensure that an embedded destination looses in priority to everything
+        // else.
+        if ( aFirst.iBearerType == KUidEmbeddedDestination )
+            {
+            result = 1; // Positive.
+            }
+        else if ( aSecond.iBearerType == KUidEmbeddedDestination )
+            {
+            result = -1; // Negative.
+            }
+        }
+    
+    return result;
     }
 
 // ---------------------------------------------------------------------------
@@ -81,4 +114,50 @@
     return result;
     }
 
+// ---------------------------------------------------------------------------
+// Return ETrue if this connection method item represents a virtual
+// destination.
+// ---------------------------------------------------------------------------
+//
+TBool TCmmConnMethodItem::IsVirtual() const
+    {
+    return iIsVirtual;
+    }
+
+// ---------------------------------------------------------------------------
+// Return ETrue if this connection method item represents an embedded
+// destination.
+// ---------------------------------------------------------------------------
+//
+TBool TCmmConnMethodItem::IsEmbedded() const
+    {
+    // No traces.
+    TBool result( EFalse );
+    if ( iBearerType == KUidEmbeddedDestination )
+        {
+        result = ETrue;
+        }
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// If this is a virtual IAP that points to an IAP, returns the ID of that IAP,
+// 0 otherwise.
+// ---------------------------------------------------------------------------
+//
+TUint32 TCmmConnMethodItem::LinkedIapId() const
+    {
+    return iLinkedIapId;
+    }
+
+// ---------------------------------------------------------------------------
+// If this is a virtual IAP that points to a SNAP, returns the ID of that SNAP,
+// 0 otherwise.
+// ---------------------------------------------------------------------------
+//
+TUint32 TCmmConnMethodItem::LinkedSnapId() const
+    {
+    return iLinkedSnapId;
+    }
+
 // End of file