83
|
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: Helper for online/offline state handling
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef ONLINEOFFLINEHELPER_H
|
|
19 |
#define ONLINEOFFLINEHELPER_H
|
|
20 |
|
|
21 |
#include <e32base.h>
|
|
22 |
#include <NWHandlingEngine.h>
|
|
23 |
#include <MProfileChangeObserver.h>
|
|
24 |
#include <babitflags.h>
|
|
25 |
#include <cmgenconnsettings.h>
|
|
26 |
#include "cenrepobserver.h"
|
|
27 |
|
|
28 |
// Forward declrations
|
|
29 |
class CNWSession;
|
|
30 |
class CProfileChangeNotifyHandler;
|
|
31 |
class CXnNodeAppIf;
|
|
32 |
class CAknGlobalConfirmationQuery;
|
|
33 |
|
|
34 |
namespace AiXmlUiController
|
|
35 |
{
|
|
36 |
// Forward declrations
|
|
37 |
class CXmlUiController;
|
|
38 |
class CGlobalQueryHandler;
|
|
39 |
// Classe declaration
|
|
40 |
|
|
41 |
|
|
42 |
/**
|
|
43 |
* Online/offline state helper
|
|
44 |
*
|
|
45 |
* @ingroup group_aixmluimain
|
|
46 |
* @lib ai3xmluimain.lib
|
|
47 |
* @since S60 5.0
|
|
48 |
*/
|
|
49 |
|
|
50 |
class COnlineOfflineHelper : public CBase,
|
|
51 |
public MNWMessageObserver, public MProfileChangeObserver, public MCenRepObserver
|
|
52 |
{
|
|
53 |
public:
|
|
54 |
// Constructors
|
|
55 |
|
|
56 |
/**
|
|
57 |
* Two-phased constructor.
|
|
58 |
*/
|
|
59 |
static COnlineOfflineHelper* NewL( CXmlUiController& aUiCtl );
|
|
60 |
|
|
61 |
public:
|
|
62 |
// Destructor
|
|
63 |
|
|
64 |
~COnlineOfflineHelper();
|
|
65 |
|
|
66 |
private:
|
|
67 |
/*
|
|
68 |
* C++ default constructor
|
|
69 |
*/
|
|
70 |
COnlineOfflineHelper( CXmlUiController& aUiCtl );
|
|
71 |
|
|
72 |
/**
|
|
73 |
* 2nd phase constructor
|
|
74 |
*/
|
|
75 |
void ConstructL();
|
|
76 |
|
|
77 |
public :
|
|
78 |
// from MCenRepObserver
|
|
79 |
|
|
80 |
/**
|
|
81 |
* This method is called every time when Central Repository key
|
|
82 |
* KCRUidCmManager/ KCurrentCellularDataUsage changes.
|
|
83 |
*
|
|
84 |
* @param aValue The new value for KCurrentCellularDataUsage.
|
|
85 |
*
|
|
86 |
*/
|
|
87 |
void CurrentCellularDataUsageChangedL( const TInt aValue );
|
|
88 |
|
|
89 |
public:
|
|
90 |
// New functions
|
|
91 |
|
|
92 |
/*
|
|
93 |
* Determines if online menuitem can be shown
|
|
94 |
*
|
|
95 |
* @since S60 5.0
|
|
96 |
* @return ETrue if item can be shown, EFalse otherwise
|
|
97 |
*/
|
|
98 |
TBool ShowOnlineItem() const;
|
|
99 |
|
|
100 |
/*
|
|
101 |
* Determines if offline menuitem can be shown
|
|
102 |
*
|
|
103 |
* @since S60 5.0
|
|
104 |
* @return ETrue if item can be shown, EFalse otherwise
|
|
105 |
*/
|
|
106 |
TBool ShowOfflineItem() const;
|
|
107 |
|
|
108 |
/*
|
|
109 |
* Set online or offline state based on user selection
|
|
110 |
*
|
|
111 |
* @since S60 5.0
|
|
112 |
* @param aOnline ETrue to set online, EFalse to offline
|
|
113 |
*/
|
|
114 |
void ProcessOnlineStateL( TBool aOnline );
|
|
115 |
|
|
116 |
/*
|
|
117 |
* Handles the connection query dialogs
|
|
118 |
*
|
|
119 |
* @since S60 5.0
|
|
120 |
* @param aConnection connection disconnected or connected
|
|
121 |
*/
|
|
122 |
void HandleConnectionQueryL( const TDesC& aConnection);
|
|
123 |
|
|
124 |
/**
|
|
125 |
* Displayes global query for 'go online' or 'go offline' confirmations
|
|
126 |
* @param aResourceId resource id for the text string
|
|
127 |
* @param aSetOnline if ETrue then set widgets online if confirmation accepted,
|
|
128 |
* if EFalse then set widgets offline if confirmation accepted
|
|
129 |
*/
|
|
130 |
void ShowGlobalQueryL( TInt aResourceId, TBool aSetOnline );
|
|
131 |
|
|
132 |
private:
|
|
133 |
// from MNWMessageObserver
|
|
134 |
|
|
135 |
/**
|
|
136 |
* From MNWMessageObserver.
|
|
137 |
* Called by network handling engine when network info changes.
|
|
138 |
*
|
|
139 |
* @since S60 5.0
|
|
140 |
* @param aMessage is type of the change.
|
|
141 |
*/
|
|
142 |
void HandleNetworkMessage( const TNWMessages aMessage );
|
|
143 |
|
|
144 |
/**
|
|
145 |
* From MNWMessageObserver.
|
|
146 |
* Called if network handling engine fails.
|
|
147 |
*
|
|
148 |
* @since S60 5.0
|
|
149 |
* @param aOperation is failed operation.
|
|
150 |
* @param aErrorCode is fail reason.
|
|
151 |
*/
|
|
152 |
void HandleNetworkError( const TNWOperation aOperation, TInt aErrorCode );
|
|
153 |
|
|
154 |
private:
|
|
155 |
// from MProfileChangeObserver
|
|
156 |
|
|
157 |
/**
|
|
158 |
* Called when active profile changes.
|
|
159 |
*
|
|
160 |
* @since S60 5.0
|
|
161 |
* @param aProfileEvent Profile event.
|
|
162 |
* @param aProfileId New profile id.
|
|
163 |
*/
|
|
164 |
void HandleActiveProfileEventL( TProfileEvent aProfileEvent, TInt aProfileId );
|
|
165 |
|
|
166 |
private:
|
|
167 |
// New functions
|
|
168 |
|
|
169 |
TBool HasNetworkInfoChanged( const TNWMessages aMsg );
|
|
170 |
void InterpretNWMessageL( const TNWMessages aMessage, const TNWInfo );
|
|
171 |
|
|
172 |
void SetOnline( TBool aOnline );
|
|
173 |
|
|
174 |
void CurrentNetworkSetting();
|
|
175 |
|
|
176 |
private:
|
|
177 |
// Data types
|
|
178 |
|
|
179 |
/**
|
|
180 |
* Network related message flags
|
|
181 |
*/
|
|
182 |
enum TNetInfoFlags
|
|
183 |
{
|
|
184 |
ENetworkProviderNameReceived = 0x00000001,
|
|
185 |
ENetworkProviderNameOk = 0x00000002,
|
|
186 |
EServiceProviderNameReceived = 0x00000004,
|
|
187 |
EServiceProviderNameOk = 0x00000008,
|
|
188 |
ERegistrationStatusReceived = 0x00000010,
|
|
189 |
ENetworkInfoChangeReceived = 0x00000020,
|
|
190 |
EProgrammableOperatorInfoReceived = 0x00000040,
|
|
191 |
EProgrammableOperatorInfoReceivedOk = 0x00000080
|
|
192 |
};
|
|
193 |
|
|
194 |
enum
|
|
195 |
{
|
|
196 |
// if defined Home Screen is in online mode.
|
|
197 |
EOnline,
|
|
198 |
// if defined there is no need to show automatic offline note
|
|
199 |
// and automatic offline setting is disabled.
|
|
200 |
ERoamingShown,
|
|
201 |
// if defined phone profile is offline.
|
|
202 |
EOfflineProfile
|
|
203 |
};
|
|
204 |
private:
|
|
205 |
// data
|
|
206 |
|
|
207 |
/**
|
|
208 |
* UI controller
|
|
209 |
* Not own
|
|
210 |
*/
|
|
211 |
CXmlUiController& iUiCtl;
|
|
212 |
|
|
213 |
/**
|
|
214 |
* Session to network handling engine.
|
|
215 |
* Own.
|
|
216 |
*/
|
|
217 |
CNWSession* iSession;
|
|
218 |
|
|
219 |
/**
|
|
220 |
* Profile change handler.
|
|
221 |
* Own.
|
|
222 |
*/
|
|
223 |
CProfileChangeNotifyHandler* iHandler;
|
|
224 |
|
|
225 |
/**
|
|
226 |
* Cached network info structure.
|
|
227 |
*/
|
|
228 |
TNWInfo iInfo;
|
|
229 |
|
|
230 |
/**
|
|
231 |
* Previous network information.
|
|
232 |
*/
|
|
233 |
TNWInfo iOldInfo;
|
|
234 |
|
|
235 |
/**
|
|
236 |
* Subset of sum of TNetInfoFlags.
|
|
237 |
*/
|
|
238 |
TUint iReceivedMessageFlags;
|
|
239 |
|
|
240 |
/**
|
|
241 |
* Subset of sum of old TNetInfoFlags.
|
|
242 |
*/
|
|
243 |
TUint iOldReceivedMessageFlags;
|
|
244 |
|
|
245 |
/**
|
|
246 |
* current state of network
|
|
247 |
*/
|
|
248 |
TNWRegistrationStatus iCurrentNwStatus;
|
|
249 |
|
|
250 |
/**
|
|
251 |
* Flags
|
|
252 |
*/
|
|
253 |
TBitFlags32 iFlags;
|
|
254 |
|
|
255 |
/**
|
|
256 |
* Network setting observer, owned
|
|
257 |
*/
|
|
258 |
CCenRepObserver *iNwSettingObserver;
|
|
259 |
|
|
260 |
/**
|
|
261 |
* Home network setting
|
|
262 |
*/
|
|
263 |
TInt iHomeNetwork;
|
|
264 |
|
|
265 |
/**
|
|
266 |
* Roaming network setting
|
|
267 |
*/
|
|
268 |
TInt iRoamingNetwork;
|
|
269 |
|
|
270 |
/**
|
|
271 |
* Global query handler, owned.
|
|
272 |
*/
|
|
273 |
CGlobalQueryHandler* iGlobalQueryHandler;
|
|
274 |
|
|
275 |
/**
|
|
276 |
* Global confirmation query, owned.
|
|
277 |
*/
|
|
278 |
CAknGlobalConfirmationQuery* iGlobalConfirmationQuery;
|
|
279 |
|
|
280 |
};
|
|
281 |
|
|
282 |
}// namespace AiXmlUiController
|
|
283 |
#endif //ONLINEOFFLINEHELPER_H
|
|
284 |
|