|
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 * Wrapper DLL |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 #include <cmmanager.h> // @since 3.2 |
|
21 #include <cmdestination.h> // @since 3.2 |
|
22 |
|
23 #include "smartinstallerdll.h" |
|
24 |
|
25 // --------------------------------------------------------------------------- |
|
26 // |
|
27 // --------------------------------------------------------------------------- |
|
28 // |
|
29 EXPORT_C CHelper* CHelper::NewL() |
|
30 { |
|
31 CHelper* self = CHelper::NewLC(); |
|
32 CleanupStack::Pop(); |
|
33 return self; |
|
34 } |
|
35 |
|
36 // --------------------------------------------------------------------------- |
|
37 // |
|
38 // --------------------------------------------------------------------------- |
|
39 // |
|
40 EXPORT_C CHelper* CHelper::NewLC() |
|
41 { |
|
42 CHelper* self = new (ELeave) CHelper(); |
|
43 CleanupStack::PushL(self); |
|
44 self->ConstructL(); |
|
45 return self; |
|
46 } |
|
47 |
|
48 // --------------------------------------------------------------------------- |
|
49 // Default destructor |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 EXPORT_C CHelper::~CHelper() |
|
53 { |
|
54 } |
|
55 |
|
56 // --------------------------------------------------------------------------- |
|
57 // |
|
58 // --------------------------------------------------------------------------- |
|
59 // |
|
60 EXPORT_C TUint CHelper::GetDefaultIapForSNAPL(const TUint aSNAPId) |
|
61 { |
|
62 RCmManager cmManager; |
|
63 TUint iap( 0 ); |
|
64 |
|
65 cmManager.OpenLC(); |
|
66 RCmDestination dest( cmManager.DestinationL( aSNAPId ) ); |
|
67 CleanupClosePushL( dest ); |
|
68 if ( dest.ConnectionMethodCount() <= 0 ) |
|
69 { |
|
70 User::Leave( KErrNotFound ); |
|
71 } |
|
72 |
|
73 RCmConnectionMethod meth( dest.ConnectionMethodL(0) ); |
|
74 CleanupClosePushL(meth); |
|
75 iap = meth.GetIntAttributeL(CMManager::ECmIapId); |
|
76 CleanupStack::PopAndDestroy( 3, &cmManager ); // cMeth, dest, cmManager |
|
77 |
|
78 return iap; |
|
79 } |
|
80 |
|
81 // --------------------------------------------------------------------------- |
|
82 // |
|
83 // --------------------------------------------------------------------------- |
|
84 // |
|
85 EXPORT_C void CHelper::GetSnapIapsL(const TUint aSNAPId, RArray<TUint32>& aIapArray) |
|
86 { |
|
87 RCmManager cmManager; |
|
88 cmManager.OpenLC(); |
|
89 |
|
90 RCmDestination dest = cmManager.DestinationL( aSNAPId ); |
|
91 CleanupClosePushL(dest); |
|
92 const TInt count = dest.ConnectionMethodCount(); |
|
93 if ( count <= 0 ) |
|
94 { |
|
95 User::Leave(KErrNotFound); |
|
96 } |
|
97 // Fill the array with IAP IDs. We're assuming they are in priority order. |
|
98 for (TInt i = 0; i < count; i++) |
|
99 { |
|
100 RCmConnectionMethod meth( dest.ConnectionMethodL(i) ); |
|
101 CleanupClosePushL(meth); |
|
102 aIapArray.AppendL( meth.GetIntAttributeL(CMManager::ECmIapId) ); |
|
103 CleanupStack::PopAndDestroy(&meth); |
|
104 } |
|
105 CleanupStack::PopAndDestroy( 2, &cmManager ); // destination, cmManager |
|
106 } |
|
107 |
|
108 // --------------------------------------------------------------------------- |
|
109 // Default 2nd level constructor |
|
110 // --------------------------------------------------------------------------- |
|
111 // |
|
112 void CHelper::ConstructL() |
|
113 { |
|
114 } |
|
115 |
|
116 // --------------------------------------------------------------------------- |
|
117 // Default constructor |
|
118 // --------------------------------------------------------------------------- |
|
119 // |
|
120 CHelper::CHelper() |
|
121 { |
|
122 } |