|
1 /* |
|
2 * Copyright (c) 2004 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: See class definition below. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __CTCIAPMANAGER_H__ |
|
19 #define __CTCIAPMANAGER_H__ |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32base.h> |
|
23 #include <bamdesca.h> |
|
24 #include <cdblen.h> |
|
25 |
|
26 // CLASS DEFINITION |
|
27 /** |
|
28 * CTcIAPManager provides easy access to the Internet Access Points available |
|
29 * in the system. |
|
30 */ |
|
31 class CTcIAPManager |
|
32 : public CBase, |
|
33 public MDesC8Array |
|
34 { |
|
35 private: // Nested classes |
|
36 |
|
37 // CLASS DEFINITION |
|
38 /** |
|
39 * Container for IAP entries having an ID and a name. |
|
40 */ |
|
41 class TEntry |
|
42 { |
|
43 public: // Data |
|
44 |
|
45 /// IAP Id |
|
46 TUint32 iId; |
|
47 |
|
48 /// IAP Name |
|
49 TBuf8< KCommsDbSvrMaxFieldLength > iName; |
|
50 |
|
51 }; |
|
52 |
|
53 public: // Constructors and destructor |
|
54 |
|
55 /** |
|
56 * Static constructor. |
|
57 * |
|
58 * @return An initialized instance of this class. |
|
59 */ |
|
60 IMPORT_C static CTcIAPManager* NewL(); |
|
61 |
|
62 /// Destructor |
|
63 IMPORT_C ~CTcIAPManager(); |
|
64 |
|
65 private: // Constructors and destructor |
|
66 |
|
67 /// Default constructor. |
|
68 CTcIAPManager(); |
|
69 |
|
70 /// 2nd phase constructor |
|
71 void ConstructL(); |
|
72 |
|
73 public: // From MDesC8Array |
|
74 |
|
75 TInt MdcaCount() const; |
|
76 TPtrC8 MdcaPoint( TInt aIndex ) const; |
|
77 |
|
78 public: // New methods |
|
79 |
|
80 /// @return Number of IAPs available |
|
81 IMPORT_C TInt Count() const; |
|
82 |
|
83 /** |
|
84 * Return the CommDb ID of an IAP |
|
85 * |
|
86 * @param aIndex IAP entry index (0..Count()-1) |
|
87 * @return IAP id |
|
88 */ |
|
89 IMPORT_C TUint32 Id( TInt aIndex ) const; |
|
90 |
|
91 /** |
|
92 * Return the CommDb Name of an IAP |
|
93 * |
|
94 * @param aIndex IAP entry index (0..Count()-1) |
|
95 * @return Reference to IAP name |
|
96 */ |
|
97 IMPORT_C const TDesC8& Name( TInt aIndex ) const; |
|
98 |
|
99 /** |
|
100 * Searches for an IAP entry with a matching id. |
|
101 * |
|
102 * @param aId The id to be searched for. |
|
103 * @return Reference to IAP name |
|
104 * @exceptions Leaves with KErrNotFound if no match is found. |
|
105 */ |
|
106 IMPORT_C const TDesC8& NameForIdL( TUint32 aId ) const; |
|
107 |
|
108 /** |
|
109 * Searches for an IAP entry with a matching name. |
|
110 * |
|
111 * @param aName The name to be searched for. |
|
112 * @return IAP id |
|
113 * @exceptions Leaves with KErrNotFound if no match is found. |
|
114 */ |
|
115 IMPORT_C TUint32 IdForNameL( const TDesC8& aName ) const; |
|
116 |
|
117 private: // data |
|
118 |
|
119 /// Internet Access Point list. Owned. |
|
120 CArrayFixSeg< TEntry > iEntries; |
|
121 |
|
122 }; |
|
123 |
|
124 #endif // __CTCIAPMANAGER_H__ |