cmmanager/cmmgr/cmmserver/src/cmmconnmethoditem.cpp
changeset 40 c5b848e6c7d1
parent 20 9c97ad6591ae
equal deleted inserted replaced
34:3b0cec605979 40:c5b848e6c7d1
    17 * destinations.
    17 * destinations.
    18 *
    18 *
    19 */
    19 */
    20 
    20 
    21 
    21 
       
    22 #include <cmmanagerdef.h>
       
    23 #include <cmpluginembdestinationdef.h>
       
    24 
    22 #include "cmmconnmethoditem.h"
    25 #include "cmmconnmethoditem.h"
    23 
    26 
    24 
    27 
    25 // ---------------------------------------------------------------------------
    28 // ---------------------------------------------------------------------------
    26 // Constructor.
    29 // Constructor.
    27 // ---------------------------------------------------------------------------
    30 // ---------------------------------------------------------------------------
    28 //
    31 //
    29 TCmmConnMethodItem::TCmmConnMethodItem()
    32 TCmmConnMethodItem::TCmmConnMethodItem()
       
    33         :
       
    34         iId( 0 ),
       
    35         iBearerType( 0 ),
       
    36         iBearerPriority( 0 ),
       
    37         iPriority( 0 ),
       
    38         iIsVirtual( 0 ),
       
    39         iLinkedIapId( 0 ),
       
    40         iLinkedSnapId( 0 )           
    30     {
    41     {
    31     iId = 0;
       
    32     iBearerType = 0;
       
    33     iBearerPriority = 0;
       
    34     iPriority = 0;
       
    35     }
    42     }
    36 
    43 
    37 // ---------------------------------------------------------------------------
    44 // ---------------------------------------------------------------------------
    38 // Constructor.
    45 // Constructor.
    39 // ---------------------------------------------------------------------------
    46 // ---------------------------------------------------------------------------
    40 //
    47 //
    41 TCmmConnMethodItem::TCmmConnMethodItem(
    48 TCmmConnMethodItem::TCmmConnMethodItem(
    42         TUint32 aId,
    49         TUint32 aId,
    43         TUint32 aBearerType,
    50         TUint32 aBearerType,
    44         TUint aBearerPriority,
    51         TUint aBearerPriority,
    45         TUint aPriority )
    52         TUint aPriority,
       
    53         TBool aIsVirtual,
       
    54         TUint32 aLinkedIapId,
       
    55         TUint32 aLinkedSnapId )
    46         :
    56         :
    47         iId( aId ),
    57         iId( aId ),
    48         iBearerType( aBearerType ),
    58         iBearerType( aBearerType ),
    49         iBearerPriority( aBearerPriority ),
    59         iBearerPriority( aBearerPriority ),
    50         iPriority( aPriority )
    60         iPriority( aPriority ),
       
    61         iIsVirtual( aIsVirtual ),
       
    62         iLinkedIapId( aLinkedIapId ),
       
    63         iLinkedSnapId( aLinkedSnapId )
    51     {
    64     {
    52     }
    65     }
    53 
    66 
    54 // ---------------------------------------------------------------------------
    67 // ---------------------------------------------------------------------------
    55 // A comparison function. Uses priority since items are in priority order.
    68 // A comparison function. Uses priority since items are in priority order.
    58 TInt TCmmConnMethodItem::Compare(
    71 TInt TCmmConnMethodItem::Compare(
    59         const TCmmConnMethodItem& aFirst,
    72         const TCmmConnMethodItem& aFirst,
    60         const TCmmConnMethodItem& aSecond )
    73         const TCmmConnMethodItem& aSecond )
    61     {
    74     {
    62     // Zero if match, negative if first is smaller, positive otherwise.
    75     // Zero if match, negative if first is smaller, positive otherwise.
    63     return ( TInt )aFirst.iPriority - ( TInt )aSecond.iPriority;
    76     TInt result = ( TInt )aFirst.iPriority - ( TInt )aSecond.iPriority;
       
    77 
       
    78     if ( result == 0 &&
       
    79             aFirst.iPriority == CMManager::KDataMobilitySelectionPolicyPriorityWildCard )
       
    80         {
       
    81         // Embedded destination and virtual IAPs linking to SNAP have wildcard
       
    82         // priority.
       
    83         // If both connection methods have wildcard priority, only need to
       
    84         // ensure that an embedded destination looses in priority to everything
       
    85         // else.
       
    86         if ( aFirst.iBearerType == KUidEmbeddedDestination )
       
    87             {
       
    88             result = 1; // Positive.
       
    89             }
       
    90         else if ( aSecond.iBearerType == KUidEmbeddedDestination )
       
    91             {
       
    92             result = -1; // Negative.
       
    93             }
       
    94         }
       
    95     
       
    96     return result;
    64     }
    97     }
    65 
    98 
    66 // ---------------------------------------------------------------------------
    99 // ---------------------------------------------------------------------------
    67 // A comparison function to find a specific item by ID.
   100 // A comparison function to find a specific item by ID.
    68 // (Items are not sorted by ID in the array.)
   101 // (Items are not sorted by ID in the array.)
    79         result = ETrue;
   112         result = ETrue;
    80         }
   113         }
    81     return result;
   114     return result;
    82     }
   115     }
    83 
   116 
       
   117 // ---------------------------------------------------------------------------
       
   118 // Return ETrue if this connection method item represents a virtual
       
   119 // destination.
       
   120 // ---------------------------------------------------------------------------
       
   121 //
       
   122 TBool TCmmConnMethodItem::IsVirtual() const
       
   123     {
       
   124     return iIsVirtual;
       
   125     }
       
   126 
       
   127 // ---------------------------------------------------------------------------
       
   128 // Return ETrue if this connection method item represents an embedded
       
   129 // destination.
       
   130 // ---------------------------------------------------------------------------
       
   131 //
       
   132 TBool TCmmConnMethodItem::IsEmbedded() const
       
   133     {
       
   134     // No traces.
       
   135     TBool result( EFalse );
       
   136     if ( iBearerType == KUidEmbeddedDestination )
       
   137         {
       
   138         result = ETrue;
       
   139         }
       
   140     return result;
       
   141     }
       
   142 
       
   143 // ---------------------------------------------------------------------------
       
   144 // If this is a virtual IAP that points to an IAP, returns the ID of that IAP,
       
   145 // 0 otherwise.
       
   146 // ---------------------------------------------------------------------------
       
   147 //
       
   148 TUint32 TCmmConnMethodItem::LinkedIapId() const
       
   149     {
       
   150     return iLinkedIapId;
       
   151     }
       
   152 
       
   153 // ---------------------------------------------------------------------------
       
   154 // If this is a virtual IAP that points to a SNAP, returns the ID of that SNAP,
       
   155 // 0 otherwise.
       
   156 // ---------------------------------------------------------------------------
       
   157 //
       
   158 TUint32 TCmmConnMethodItem::LinkedSnapId() const
       
   159     {
       
   160     return iLinkedSnapId;
       
   161     }
       
   162 
    84 // End of file
   163 // End of file