1 /* |
|
2 * ============================================================================== |
|
3 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 * All rights reserved. |
|
5 * This component and the accompanying materials are made available |
|
6 * under the terms of "Eclipse Public License v1.0" |
|
7 * which accompanies this distribution, and is available |
|
8 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
9 * |
|
10 * Initial Contributors: |
|
11 * Nokia Corporation - initial contribution. |
|
12 * |
|
13 * Contributors: |
|
14 * |
|
15 * Description: |
|
16 * |
|
17 * ============================================================================== |
|
18 */ |
|
19 |
|
20 #include <smldmadapter.h> |
|
21 #include <cdbcols.h> |
|
22 #include <cmpluginpacketdatadef.h> |
|
23 #include "BranchBase.h" |
|
24 |
|
25 #include "Utils.h" |
|
26 #include "OstTraceDefinitions.h" |
|
27 #ifdef OST_TRACE_COMPILER_IN_USE |
|
28 #include "BranchBaseTraces.h" |
|
29 #endif |
|
30 |
|
31 _LIT8( KCMProxyNodeSeparator, "/" ); |
|
32 |
|
33 |
|
34 |
|
35 // ======== LOCAL FUNCTIONS ========= |
|
36 |
|
37 // ======== MEMBER FUNCTIONS ======== |
|
38 // ------------------------------------------------------------------------------------- |
|
39 // CBranchBase::CBranchBase() |
|
40 // ------------------------------------------------------------------------------------- |
|
41 CBranchBase::CBranchBase() |
|
42 { |
|
43 OstTraceFunctionEntry0( CBRANCHBASE_CBRANCHBASE_ENTRY ); |
|
44 |
|
45 OstTraceFunctionExit0( CBRANCHBASE_CBRANCHBASE_EXIT ); |
|
46 } |
|
47 // ------------------------------------------------------------------------------------- |
|
48 // CBranchBase::CBranchBase |
|
49 // ------------------------------------------------------------------------------------- |
|
50 CBranchBase::CBranchBase( MSmlDmCallback* aDmCallback ) |
|
51 |
|
52 { |
|
53 OstTraceFunctionEntry0( CBRANCHBASE_CBRANCHBASE_2_ENTRY ); |
|
54 iCallback = aDmCallback; |
|
55 OstTraceFunctionExit0( DUP1_CBRANCHBASE_CBRANCHBASE_2_EXIT ); |
|
56 } |
|
57 // ------------------------------------------------------------------------------------- |
|
58 // CBranchBase::~CBranchBase() |
|
59 // ------------------------------------------------------------------------------------- |
|
60 CBranchBase::~CBranchBase() |
|
61 { |
|
62 OstTraceFunctionEntry0( CBRANCHBASE_DELETE_ENTRY ); |
|
63 |
|
64 OstTraceFunctionExit0( CBRANCHBASE_DELETE_EXIT ); |
|
65 } |
|
66 |
|
67 // ------------------------------------------------------------------------------------- |
|
68 // CBranchBase::GetAllConnectionMethodsL() |
|
69 // Returns all connection methods |
|
70 // ------------------------------------------------------------------------------------- |
|
71 void CBranchBase::GetAllConnectionMethodsL( RArray<TUint32>& aCmArray, |
|
72 RCmManagerExt& aCmManager ) |
|
73 { |
|
74 OstTraceFunctionEntry0( CBRANCHBASE_GETALLCONNECTIONMETHODSL_ENTRY ); |
|
75 |
|
76 // Get all connection methods |
|
77 TBool supportedBearersOnly = EFalse; |
|
78 TBool legacyCmsOnly = EFalse; |
|
79 TBool includeEasyWlan = EFalse; |
|
80 |
|
81 aCmManager.ConnectionMethodL( aCmArray, |
|
82 supportedBearersOnly, |
|
83 legacyCmsOnly, |
|
84 includeEasyWlan ); |
|
85 |
|
86 RCmConnectionMethodExt cm; |
|
87 |
|
88 // Loop all connection methods and filter away everything else besides packet data. |
|
89 // Other bearer types are not supported |
|
90 for( TInt i = 0; i < aCmArray.Count(); i++ ) |
|
91 { |
|
92 if ( GetConnectionMethodLC( aCmManager, cm, aCmArray[i] ) ) |
|
93 { |
|
94 TUint bearerType = cm.GetIntAttributeL( CMManager::ECmBearerType ); |
|
95 |
|
96 if( bearerType != KUidPacketDataBearerType ) |
|
97 { |
|
98 // Non supported bearer type. Remove |
|
99 aCmArray.Remove( i ); |
|
100 i--; |
|
101 } |
|
102 } |
|
103 CleanupStack::PopAndDestroy( &cm ); |
|
104 } |
|
105 OstTrace1( TRACE_NORMAL, CBRANCHBASE_GETALLCONNECTIONMETHODSL_COUNT, "CBranchBase::GetAllConnectionMethodsL; Found %u connection methods.", aCmArray.Count() ); |
|
106 |
|
107 OstTraceFunctionExit0( CBRANCHBASE_GETALLCONNECTIONMETHODSL_EXIT ); |
|
108 } |
|
109 |
|
110 //----------------------------------------------------------------------------- |
|
111 // TBool CBranchBase::CheckPreviousURIList() |
|
112 //----------------------------------------------------------------------------- |
|
113 TBool CBranchBase::CheckPreviousURIList( const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList, |
|
114 const TUint32 aCmId, |
|
115 TDes8& aURISeg ) |
|
116 { |
|
117 OstTraceExt2( TRACE_NORMAL, CBRANCHBASE_CHECKPREVIOUSURILIST_ENTRY, "ENTRY: CBranchBase::CheckPreviousURIList;aURISeg=%s;aCmId=%u", aURISeg, aCmId ); |
|
118 |
|
119 TBool retval = EFalse; |
|
120 |
|
121 for ( TInt i = 0; i < aPreviousURISegmentList.Count(); i++ ) |
|
122 { |
|
123 if ( CUtils::IntLUID( aPreviousURISegmentList.At(i).iURISegLUID ) == aCmId ) |
|
124 { |
|
125 aURISeg.Copy( aPreviousURISegmentList.At(i).iURISeg ); |
|
126 retval = ETrue; |
|
127 break; |
|
128 } |
|
129 } |
|
130 OstTrace1( TRACE_NORMAL, CBRANCHBASE_CHECKPREVIOUSURILIST_EXIT, "EXIT: CBranchBase::CheckPreviousURIList;retval=%d", retval ); |
|
131 |
|
132 return retval; |
|
133 } |
|
134 |
|
135 |
|
136 //----------------------------------------------------------------------------- |
|
137 // CBranchBase::GetAllDynamicNodesL |
|
138 //----------------------------------------------------------------------------- |
|
139 void CBranchBase::GetAllDynamicNodesL( const TDesC8& aURI, |
|
140 const TDesC8& /*aLUID*/, |
|
141 const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList, |
|
142 TInt aResultsRef, |
|
143 TInt aStatusRef, |
|
144 RCmManagerExt& /*aCmManagerExt*/, |
|
145 CBufBase& aCurrentURISegmentList, |
|
146 const TDesC8& aField, |
|
147 const TInt aNodeCount, |
|
148 MSmlDmCallback* aCallback ) |
|
149 { |
|
150 OstTraceExt3( TRACE_NORMAL, |
|
151 CBRANCHBASE_GETALLDYNAMICNODESL_ENTRY, |
|
152 "ENTRY: CBranchBase::GetAllDynamicNodesL;aURI=%s;aField=%s;aNodeCount=%d", |
|
153 aURI, |
|
154 aField, |
|
155 aNodeCount ); |
|
156 |
|
157 if ( aPreviousURISegmentList.Count() > 0 ) // Already mapped |
|
158 { |
|
159 for ( TInt i = 0; i < aPreviousURISegmentList.Count(); i++ ) |
|
160 { |
|
161 aCurrentURISegmentList.InsertL( aCurrentURISegmentList.Size(), |
|
162 aPreviousURISegmentList.At(i).iURISeg ); |
|
163 aCurrentURISegmentList.InsertL( aCurrentURISegmentList.Size(), |
|
164 KCMProxyNodeSeparator ); |
|
165 } |
|
166 } |
|
167 else |
|
168 { |
|
169 TBuf8<KSmlMaxURISegLen> addNodeName; |
|
170 |
|
171 // Generate as many nodes as defined |
|
172 for ( TInt i = 1; i <= aNodeCount; i++ ) |
|
173 { |
|
174 addNodeName.Format( _L8( "%s%d" ), aField.Ptr(), i ); |
|
175 aCurrentURISegmentList.InsertL( aCurrentURISegmentList.Size(), addNodeName ); |
|
176 aCurrentURISegmentList.InsertL( aCurrentURISegmentList.Size(), |
|
177 KCMProxyNodeSeparator ); |
|
178 } |
|
179 } |
|
180 |
|
181 aCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); |
|
182 aCallback->SetResultsL( aResultsRef, aCurrentURISegmentList, KNullDesC8); |
|
183 |
|
184 OstTrace0( TRACE_NORMAL, |
|
185 CBRANCHBASE_GETALLDYNAMICNODESL_EXIT, |
|
186 "EXIT: CBranchBase::GetAllDynamicNodesL" ); |
|
187 |
|
188 } |
|
189 |
|
190 //------------------------------------------------------------------------------ |
|
191 // TBool CBranchBase::GetConnectionMethodLC() |
|
192 //------------------------------------------------------------------------------ |
|
193 TBool CBranchBase::GetConnectionMethodLC( RCmManagerExt& aCmManagerExt, |
|
194 RCmConnectionMethodExt& aCm, |
|
195 TUint32 aCmId ) |
|
196 { |
|
197 OstTrace1( TRACE_NORMAL, CBRANCHBASE_GETCONNECTIONMETHODLC_ENTRY, "ENTRY: CBranchBase::GetConnectionMethodLC;aCmId=%d", aCmId ); |
|
198 TInt error( KErrNone ); |
|
199 |
|
200 TRAP( error, aCm = aCmManagerExt.ConnectionMethodL( aCmId ) ); |
|
201 |
|
202 CleanupClosePushL( aCm ); |
|
203 |
|
204 if ( error != KErrNone ) |
|
205 { |
|
206 OstTrace0( TRACE_NORMAL, |
|
207 CBRANCHBASE_GETCONNECTIONMETHODLC_EXIT_NOT_FOUND, |
|
208 "EXIT: CBranchBase::GetConnectionMethodLC;Connection Method NOT found: EFalse." ); |
|
209 return EFalse; |
|
210 } |
|
211 |
|
212 OstTrace0( TRACE_NORMAL, |
|
213 CBRANCHBASE_GETCONNECTIONMETHODLC_EXIT_FOUND, |
|
214 "EXIT: CBranchBase::GetConnectionMethodLC;Connection Method FOUND: ETrue." ); |
|
215 |
|
216 return ETrue; |
|
217 } |
|
218 |
|
219 // ======== GLOBAL FUNCTIONS ======== |
|
220 |
|