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: |
|
15 * Declaration of class CWlanSettingsUiModel. |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef WLAN_SETTINGS_UI_MODEL_H |
|
22 #define WLAN_SETTINGS_UI_MODEL_H |
|
23 |
|
24 // INCLUDES |
|
25 |
|
26 #include <e32base.h> |
|
27 #include "wlansettingsui.hrh" |
|
28 #include <wlancontainer.h> |
|
29 |
|
30 |
|
31 // CONSTANTS |
|
32 |
|
33 /** |
|
34 * Default "Show WLAN Availability" setting. |
|
35 */ |
|
36 LOCAL_D const TBool KWlanSettingsUiDefaultShowWlanAvail = EFalse; |
|
37 |
|
38 /** |
|
39 * Value for scanning setting off. |
|
40 */ |
|
41 LOCAL_D const TUint KWlanSettingsUiScanNetworkNever = 0; |
|
42 |
|
43 /** |
|
44 * Value for automatic scanning. |
|
45 */ |
|
46 LOCAL_D const TUint KWlanSettingsUiScanNetworkAuto = 0xFFFFFFFF; |
|
47 |
|
48 /** |
|
49 * Default user-defined scan interval (5 minutes). |
|
50 */ |
|
51 LOCAL_D const TUint KWlanSettingsUiDefaultUserDefScanInterval = 5; |
|
52 |
|
53 /** |
|
54 * Default "Scan Networks" setting. |
|
55 */ |
|
56 LOCAL_D const TUint KWlanSettingsUiDefaultScanNetwork = |
|
57 KWlanSettingsUiScanNetworkAuto; |
|
58 |
|
59 /** |
|
60 * Default "Power saving" setting. |
|
61 */ |
|
62 LOCAL_D const TBool KWlanSettingsUiDefaultPowerSaving = ETrue; |
|
63 |
|
64 // FORWARD DECLARATIONS |
|
65 |
|
66 class CWlanMgmtClient; |
|
67 class CRepository; |
|
68 |
|
69 // CLASS DECLARATION |
|
70 |
|
71 /** |
|
72 * Data model for WLAN Settings UI. |
|
73 */ |
|
74 NONSHARABLE_CLASS( CWlanSettingsUiModel ) : public CBase |
|
75 { |
|
76 |
|
77 public: // Constructors and destructor |
|
78 |
|
79 /** |
|
80 * Destructor |
|
81 */ |
|
82 ~CWlanSettingsUiModel(); |
|
83 |
|
84 public: // Types |
|
85 |
|
86 enum TSettingType ///< Setting type. |
|
87 { |
|
88 EDefaultSettings, ///< Default settings. |
|
89 EUserSettings ///< User settings. |
|
90 }; |
|
91 |
|
92 public: // New methods |
|
93 |
|
94 |
|
95 /** |
|
96 * First phase of two phase construction |
|
97 * @param - |
|
98 * @return returns an instance |
|
99 */ |
|
100 static CWlanSettingsUiModel* NewL |
|
101 ( |
|
102 CMDBSession* aSession, |
|
103 CWlanMgmtClient* aWlanMgmtClient, |
|
104 CRepository* aRepository |
|
105 ); |
|
106 |
|
107 /** |
|
108 * Load settings from comms database. |
|
109 */ |
|
110 void LoadSettingsL(); |
|
111 |
|
112 /** |
|
113 * Save settings to comms database. |
|
114 */ |
|
115 void SaveSettingsL(); |
|
116 |
|
117 /** |
|
118 * Checks from CenRep if the PowerSave Mode is on (full or partial) |
|
119 */ |
|
120 void CheckPsmModeL(); |
|
121 |
|
122 |
|
123 public: |
|
124 //getters and setters |
|
125 |
|
126 /** |
|
127 * Gets if Wlan availablity is shown. |
|
128 * @return Returns wlan availablity. |
|
129 */ |
|
130 inline TBool ShowWlanAvail(); |
|
131 |
|
132 /** |
|
133 * Gets scan networks mode. Returns 0 for no scan, 0xFFFFFFFF for |
|
134 * automatic scan or user-defined scan time in minutes. |
|
135 * @return Scan networks mode. |
|
136 */ |
|
137 TUint ScanNetworks(); |
|
138 |
|
139 /** |
|
140 * Gets if power saving mode is enabled. |
|
141 * @return Returns if power saving mode is enabled. |
|
142 */ |
|
143 inline TBool PowerSaving(); |
|
144 |
|
145 /** |
|
146 * Sets the value of iShowWlanAvail. |
|
147 * @param aShowWlanAvail The set value. |
|
148 */ |
|
149 inline void SetShowWlanAvail( TBool aShowWlanAvail ); |
|
150 |
|
151 /** |
|
152 * Sets the value of iScanNetworks. 0 for no scan, 0xFFFFFFFF for |
|
153 * automatic scan or user-defined scan time in minutes. |
|
154 * @param aScanNetworks The set value. |
|
155 */ |
|
156 void SetScanNetworks( TUint aScanNetworks ); |
|
157 |
|
158 /** |
|
159 * Sets the value of iPowerSaving. |
|
160 * @param aPowerSaving The set value. |
|
161 */ |
|
162 inline void SetPowerSaving( TBool aPowerSaving ); |
|
163 |
|
164 /** |
|
165 * Gets if user selectable power save mode is enabled. |
|
166 * @return Returns ETrue/EFalse according to if PSM mode is enabled. |
|
167 */ |
|
168 inline TBool PsmModeOn(); |
|
169 |
|
170 |
|
171 private: // New methods |
|
172 |
|
173 /** |
|
174 * Constructor. |
|
175 * @param aSession CommsDat session. |
|
176 * @param aWlanMgmtClient Wlan management client. |
|
177 * @param aRepository Centeral repository. |
|
178 */ |
|
179 CWlanSettingsUiModel |
|
180 ( |
|
181 CMDBSession* aSession, |
|
182 CWlanMgmtClient* aWlanMgmtClient, |
|
183 CRepository* aRepository |
|
184 ); |
|
185 |
|
186 /** |
|
187 * Second phase of two phase construction |
|
188 */ |
|
189 void ConstructL(); |
|
190 |
|
191 /** |
|
192 * Fix "Scan networks" value: make sure that the numeric value is |
|
193 * valid. Ensures fault tolerant behaviour if commsdb contains |
|
194 * invalid value. |
|
195 * @param TUint aSavedScanInternal The saved value of scan interval. |
|
196 */ |
|
197 void FixScanNetworks( TUint aSavedScanInternal ); |
|
198 |
|
199 /** |
|
200 * Scan interval is stored in seconds in the database but the UI |
|
201 * handles only 1-30 minutes. Method ensures that scan interval is |
|
202 * 0, 1-30 minutes or automatic (0xFFFFFFFF). |
|
203 * Ensures fault tolerant behaviour if commsdb contains invalid value. |
|
204 * @param TUint aScanInterval this value will be converted. |
|
205 * @return TUint the converted value. |
|
206 */ |
|
207 TUint FixScanInterval(TUint aScanInterval); |
|
208 |
|
209 private: |
|
210 |
|
211 /// Show WLAN availability. |
|
212 TBool iShowWlanAvail; |
|
213 /// Scan networks interval in seconds. 0 for no scan, 0xFFFFFFFF for automatic. |
|
214 TUint iScanNetworks; |
|
215 /// Power saving. |
|
216 TBool iPowerSaving; |
|
217 /// Full or partial PSM mode. |
|
218 TBool iPsmMode; |
|
219 |
|
220 /// Comms database. |
|
221 CMDBSession* iSession; |
|
222 |
|
223 // WLAN Management client |
|
224 CWlanMgmtClient* iWlanMgmtClient; // not owned |
|
225 |
|
226 /** |
|
227 * Central repository member |
|
228 */ |
|
229 CRepository* iRepository; // not owned |
|
230 |
|
231 // Power Save Mode Feature |
|
232 TBool iPsmSupported; |
|
233 |
|
234 }; |
|
235 |
|
236 #include "wlansettingsuimodel.inl" |
|
237 |
|
238 #endif |
|