|
1 /* |
|
2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Class representing any kind on connection method, including embedded |
|
16 * destination. Used for priority based ordering of connection methods inside |
|
17 * destinations. |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 #include "cmmconnmethoditem.h" |
|
23 |
|
24 |
|
25 // --------------------------------------------------------------------------- |
|
26 // Constructor. |
|
27 // --------------------------------------------------------------------------- |
|
28 // |
|
29 TCmmConnMethodItem::TCmmConnMethodItem() |
|
30 { |
|
31 iId = 0; |
|
32 iBearerType = 0; |
|
33 iBearerPriority = 0; |
|
34 iPriority = 0; |
|
35 } |
|
36 |
|
37 // --------------------------------------------------------------------------- |
|
38 // Constructor. |
|
39 // --------------------------------------------------------------------------- |
|
40 // |
|
41 TCmmConnMethodItem::TCmmConnMethodItem( |
|
42 TUint32 aId, |
|
43 TUint32 aBearerType, |
|
44 TUint aBearerPriority, |
|
45 TUint aPriority ) |
|
46 : |
|
47 iId( aId ), |
|
48 iBearerType( aBearerType ), |
|
49 iBearerPriority( aBearerPriority ), |
|
50 iPriority( aPriority ) |
|
51 { |
|
52 } |
|
53 |
|
54 // --------------------------------------------------------------------------- |
|
55 // A comparison function. Uses priority since items are in priority order. |
|
56 // --------------------------------------------------------------------------- |
|
57 // |
|
58 TInt TCmmConnMethodItem::Compare( |
|
59 const TCmmConnMethodItem& aFirst, |
|
60 const TCmmConnMethodItem& aSecond ) |
|
61 { |
|
62 // Zero if match, negative if first is smaller, positive otherwise. |
|
63 return ( TInt )aFirst.iPriority - ( TInt )aSecond.iPriority; |
|
64 } |
|
65 |
|
66 // --------------------------------------------------------------------------- |
|
67 // A comparison function to find a specific item by ID. |
|
68 // (Items are not sorted by ID in the array.) |
|
69 // --------------------------------------------------------------------------- |
|
70 // |
|
71 TBool TCmmConnMethodItem::FindCompare( |
|
72 const TUint32* aKey, |
|
73 const TCmmConnMethodItem& aEntry ) |
|
74 { |
|
75 // True if match, false otherwise. |
|
76 TBool result( EFalse ); |
|
77 if ( *aKey == aEntry.iId ) |
|
78 { |
|
79 result = ETrue; |
|
80 } |
|
81 return result; |
|
82 } |
|
83 |
|
84 // End of file |