|
1 /* |
|
2 * Copyright (c) 2006-2007 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 the License "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: Class for handling groups of IAPs.* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __CIPTVIAPLIST_H__ |
|
22 #define __CIPTVIAPLIST_H__ |
|
23 |
|
24 // INCLUDE FILES |
|
25 #include <s32mem.h> |
|
26 #include "TIptvIap.h" |
|
27 #include "CIptvUtil.h" |
|
28 #include <e32base.h> |
|
29 |
|
30 // CLASS DECLARATION |
|
31 /** |
|
32 * Class for handling groups of IAPs. |
|
33 * @lib IptvUtil.lib |
|
34 */ |
|
35 class CIptvIapList: public CBase |
|
36 { |
|
37 public: |
|
38 |
|
39 /** |
|
40 * Constructor. |
|
41 */ |
|
42 IMPORT_C static CIptvIapList* NewL(); |
|
43 |
|
44 /** |
|
45 * Destructor. |
|
46 */ |
|
47 IMPORT_C ~CIptvIapList(); |
|
48 |
|
49 /** |
|
50 * Adds Internet access point.\n |
|
51 * Maximum of KIptvSmServicesDbMaxIaps access points are allowed,\n |
|
52 * function call fails if tried to add more.\n |
|
53 * |
|
54 * @param aIap IAP to add. |
|
55 * @return System wide error code. |
|
56 */ |
|
57 IMPORT_C TInt AddIap(TIptvIap& aIap); |
|
58 |
|
59 /** |
|
60 * Adds Internet access point.\n |
|
61 * If you add more than KIptvSmServicesDbMaxIaps IAPs with this method, |
|
62 * don't send them to Service Manager. |
|
63 * |
|
64 * @param aIap IAP to add. |
|
65 * @param aIgnoreMax If ETrue, ignores KIptvSmServicesDbMaxIaps limit. |
|
66 * @return System wide error code. |
|
67 */ |
|
68 IMPORT_C TInt AddIap(TIptvIap& aIap, TBool aIgnoreMax); |
|
69 |
|
70 /** |
|
71 * Deletes Internet access point.\n |
|
72 * |
|
73 * @param aIndex Index of the IAP to delete. |
|
74 * @return KErrNone on success, KErrNotFound if not found. |
|
75 */ |
|
76 IMPORT_C TInt DeleteIap(TUint8 aIndex); |
|
77 |
|
78 /** |
|
79 * Deletes Internet access point.\n |
|
80 * |
|
81 * @param aIap IAP to delete, iId member is used to identify IAPs. |
|
82 * @return KErrNone on success, KErrNotFound if not found. |
|
83 */ |
|
84 IMPORT_C TInt DeleteIap(TIptvIap& aIap); |
|
85 |
|
86 /** |
|
87 * Modifies Internet access point. |
|
88 * |
|
89 * @param aIndex Index of the access point to modify. |
|
90 * @param aIap New access point. |
|
91 * @return System wide error code. |
|
92 */ |
|
93 IMPORT_C TInt ModifyIap(TUint8 aIndex, TIptvIap& aIap); |
|
94 |
|
95 /** |
|
96 * Returns Internet access point. Leaves with KErrOverFlow |
|
97 * if index is out of range. |
|
98 * |
|
99 * @param aIndex Index of the IAP on the list. |
|
100 * @return Reference to TIptvIap. |
|
101 */ |
|
102 IMPORT_C TIptvIap& IapL( TUint8 aIndex ); |
|
103 |
|
104 /** |
|
105 * Gets IAP from aIndex position. |
|
106 * |
|
107 * @param aIndex Index of the IAP on the list. |
|
108 * @param aIap IAP values are written here. |
|
109 * @return Returns KErrOverFlow if aIndex is out of bounds. |
|
110 */ |
|
111 IMPORT_C TInt GetIap( TUint8 aIndex, TIptvIap& aIap ); |
|
112 |
|
113 /** |
|
114 * Gets Internet access point count. |
|
115 * |
|
116 * @return Internet access point count. |
|
117 */ |
|
118 IMPORT_C TUint8 Count(); |
|
119 |
|
120 /** |
|
121 * Externalizes this object to aStream. |
|
122 * |
|
123 * @param aStream |
|
124 */ |
|
125 IMPORT_C void ExternalizeL(RDesWriteStream& aStream) const; |
|
126 |
|
127 /** |
|
128 * Internalizes this object from aStream. |
|
129 * |
|
130 * @param aStream |
|
131 */ |
|
132 IMPORT_C void InternalizeL(RDesReadStream& aStream); |
|
133 |
|
134 /** |
|
135 * Counts the memory block needed for the externalize call. |
|
136 * |
|
137 * @return Memory size (in bytes) needed for the externalize. |
|
138 */ |
|
139 IMPORT_C TUint32 CountExternalizeSize(); |
|
140 |
|
141 /** |
|
142 * Set this object from aIapList (Copies data). |
|
143 * |
|
144 * @param aIapList |
|
145 */ |
|
146 IMPORT_C void SetL(CIptvIapList& aIapList); |
|
147 |
|
148 /** |
|
149 * Sorts the list, the highest priority to index 0, 2nd highest to 1, and so on. |
|
150 */ |
|
151 IMPORT_C void SortByPriorityL(); |
|
152 |
|
153 /** |
|
154 * Finds the first occurance of IAP which has aIapId as ID. |
|
155 * |
|
156 * @param aIapId IAP ID in CommsDB. |
|
157 * @param aIndex Index of the found IAP |
|
158 * @return System-wide error code. |
|
159 */ |
|
160 IMPORT_C TInt FindIap(TUint32 aIapId, TUint8& aIndex); |
|
161 |
|
162 private: |
|
163 |
|
164 /** |
|
165 * Does the leaving part of the construction. |
|
166 */ |
|
167 void ConstructL(); |
|
168 |
|
169 /** |
|
170 * Gets index which has the highest priority IAP in it. |
|
171 * |
|
172 * @return List index |
|
173 */ |
|
174 TUint8 GetHighestPriorityIapIndexL(); |
|
175 |
|
176 /* |
|
177 * Constructor. |
|
178 */ |
|
179 CIptvIapList(); |
|
180 |
|
181 private: |
|
182 |
|
183 /* |
|
184 * Array of IAPs. |
|
185 */ |
|
186 RArray<TIptvIap> iIapList; |
|
187 }; |
|
188 |
|
189 #endif // __CIPTVIAPLIST_H__ |