41
|
1 |
/*
|
71
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
41
|
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: Listen VPN toggle key changes in central repository.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef MPMVPNTOGGLEWATCHER_H
|
|
19 |
#define MPMVPNTOGGLEWATCHER_H
|
|
20 |
|
|
21 |
// INCLUDES
|
|
22 |
#include <e32base.h>
|
|
23 |
|
|
24 |
// FORWARD DECLARATIONS
|
|
25 |
class CRepository;
|
|
26 |
|
|
27 |
// Stop after this many consecutive central repository errors.
|
|
28 |
const TInt KMpmVpnToggleWatcherCenRepErrorThreshold = 80;
|
|
29 |
|
|
30 |
/**
|
|
31 |
* Class that specifies the functions for handling notify messages about
|
|
32 |
* VPN toggle key changes in central repository.
|
|
33 |
*/
|
|
34 |
class MMpmVpnToggleWatcherNotify
|
|
35 |
{
|
|
36 |
public:
|
71
|
37 |
|
41
|
38 |
/**
|
|
39 |
* Sets values for VPN toggle after VPN toggle key changes in central
|
|
40 |
* repository.
|
|
41 |
* @param aVpnPreferred Informs if VPN connection is preferred
|
|
42 |
* connection
|
|
43 |
* @param aVpnIapId VPN IAP Id, which is used for VPN connection, when
|
71
|
44 |
* VPN connection is preferred
|
41
|
45 |
* @param aSnapId SNAP Id SNAP Id, which is used for VPN connection,
|
|
46 |
* when VPN connection is preferred
|
|
47 |
*/
|
|
48 |
virtual void SetVpnToggleValuesL( const TBool aVpnPreferred,
|
|
49 |
const TUint32 aVpnIapId,
|
|
50 |
const TUint32 aSnapId ) = 0;
|
|
51 |
};
|
|
52 |
|
|
53 |
|
|
54 |
/**
|
|
55 |
* Class for monitoring VPN toggle key changes in central repository.
|
|
56 |
* Follows KMpmVpnToggleCenRepUid key in central repository.
|
|
57 |
*/
|
|
58 |
class CMpmVpnToggleWatcher : public CActive
|
|
59 |
{
|
|
60 |
public:
|
|
61 |
|
|
62 |
/**
|
|
63 |
* Two-phased constructor.
|
|
64 |
* @param aNotify Handler for notify messages.
|
71
|
65 |
*/
|
41
|
66 |
static CMpmVpnToggleWatcher* NewL( MMpmVpnToggleWatcherNotify& aNotify );
|
|
67 |
|
|
68 |
/**
|
|
69 |
* Destructor.
|
|
70 |
*/
|
|
71 |
virtual ~CMpmVpnToggleWatcher();
|
71
|
72 |
|
41
|
73 |
/**
|
|
74 |
* Call this when you want to start listen event.
|
|
75 |
*/
|
71
|
76 |
void StartL();
|
|
77 |
|
41
|
78 |
/**
|
|
79 |
* Informs if VPN connection is preferred.
|
|
80 |
* @return True if VPN connection is preferred.
|
|
81 |
*/
|
|
82 |
TBool IsVpnConnectionPreferred() const;
|
71
|
83 |
|
41
|
84 |
/**
|
|
85 |
* Returns VPN IAP Id, which is used for VPN connection, when VPN
|
|
86 |
* connection is preferred.
|
|
87 |
* @return VPN IAP Id
|
|
88 |
*/
|
|
89 |
TUint32 VpnIapId() const;
|
71
|
90 |
|
41
|
91 |
/**
|
|
92 |
* Returns SNAP Id, which is used for VPN connection, when VPN
|
|
93 |
* connection is preferred.
|
|
94 |
* @return SNAP Id
|
|
95 |
*/
|
71
|
96 |
TUint32 SnapId() const;
|
|
97 |
|
41
|
98 |
/**
|
|
99 |
* Resets VPN toggle values.
|
71
|
100 |
*/
|
41
|
101 |
void ResetVpnToggleValues();
|
71
|
102 |
|
41
|
103 |
private:
|
|
104 |
|
|
105 |
CMpmVpnToggleWatcher( MMpmVpnToggleWatcherNotify& aNotify );
|
|
106 |
|
|
107 |
void ConstructL();
|
71
|
108 |
|
41
|
109 |
/**
|
|
110 |
* Request for notifications.
|
|
111 |
* @return Error value
|
|
112 |
*/
|
|
113 |
TInt RequestNotifications();
|
71
|
114 |
|
41
|
115 |
/**
|
|
116 |
* Gets VPN toggle values.
|
|
117 |
* @return Error value
|
|
118 |
*/
|
|
119 |
TInt GetVpnToggleValues();
|
|
120 |
|
71
|
121 |
protected: // from base class CActive
|
41
|
122 |
|
71
|
123 |
/**
|
|
124 |
* Active object's RunL.
|
|
125 |
*/
|
41
|
126 |
void RunL();
|
|
127 |
|
71
|
128 |
/**
|
|
129 |
* Handles a leave occurring in RunL.
|
|
130 |
* @param aError Leave code of RunL method.
|
|
131 |
* @return KErrNone
|
|
132 |
*/
|
|
133 |
TInt RunError( TInt aError );
|
|
134 |
|
|
135 |
/**
|
|
136 |
* Active object's DoCancel.
|
|
137 |
*/
|
41
|
138 |
void DoCancel();
|
71
|
139 |
|
41
|
140 |
private: // data
|
71
|
141 |
|
41
|
142 |
/**
|
|
143 |
* Central repository handle
|
|
144 |
* Own.
|
|
145 |
*/
|
71
|
146 |
CRepository* iRepository;
|
|
147 |
|
41
|
148 |
/**
|
|
149 |
* Informs if VPN connection is preferred connection
|
|
150 |
* Own.
|
|
151 |
*/
|
|
152 |
TBool iVpnConnectionPreferred;
|
71
|
153 |
|
41
|
154 |
/**
|
|
155 |
* VPN IAP Id which is used, when VPN connection is preferred
|
|
156 |
* Own.
|
|
157 |
*/
|
|
158 |
TUint32 iVpnIapId;
|
71
|
159 |
|
41
|
160 |
/**
|
|
161 |
* SNAP Id which is used, when VPN connection is preferred
|
|
162 |
* Own.
|
|
163 |
*/
|
|
164 |
TUint32 iSnapId;
|
71
|
165 |
|
41
|
166 |
/**
|
|
167 |
* Error counter.
|
|
168 |
*/
|
|
169 |
TUint iErrorCounter;
|
|
170 |
|
|
171 |
/**
|
|
172 |
* Handler for notify messages.
|
|
173 |
* Not own.
|
|
174 |
*/
|
|
175 |
MMpmVpnToggleWatcherNotify& iNotify;
|
71
|
176 |
|
41
|
177 |
};
|
|
178 |
|
|
179 |
#endif // MPMVPNTOGGLEWATCHER_H
|