|
1 /* |
|
2 * Copyright (c) 2008 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: Monitors the network for availability and starts any pending data sync sessions. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef C_NETMON_H |
|
19 #define C_NETMON_H |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <e32base.h> |
|
23 #include <rconnmon.h> |
|
24 #include <nifvar.h> |
|
25 #include <SyncMLClient.h> |
|
26 #include <SyncMLClientDS.h> |
|
27 #include <SyncMLObservers.h> |
|
28 #include "NSmlDSAgent.h" |
|
29 #include "NSmlAgentBase.h" |
|
30 |
|
31 #include <e32property.h> |
|
32 #include <DataSyncInternalPSKeys.h> |
|
33 |
|
34 // USER INCLUDES |
|
35 #include "NsmlProfileUtil.h" |
|
36 |
|
37 // NetMon states |
|
38 enum TNetMonStates { ERegister = 0, |
|
39 EComplete }; |
|
40 |
|
41 //Forward class declaration |
|
42 class CNSmlDSAgent; |
|
43 |
|
44 |
|
45 /** |
|
46 */ |
|
47 class CNsmlDSNetmon : public CActive, |
|
48 public MConnectionMonitorObserver |
|
49 { |
|
50 public: |
|
51 |
|
52 /** |
|
53 * Two phase construction |
|
54 */ |
|
55 static CNsmlDSNetmon* NewL(CNSmlDSAgent& aDSAgent); |
|
56 |
|
57 /** |
|
58 * Destructor |
|
59 */ |
|
60 ~CNsmlDSNetmon(); |
|
61 |
|
62 protected: |
|
63 |
|
64 // From base class CActive |
|
65 |
|
66 /** |
|
67 * Implements cancellation of an outstanding request |
|
68 */ |
|
69 void DoCancel(); |
|
70 |
|
71 /** |
|
72 * Handles an active objects request completion event. |
|
73 */ |
|
74 void RunL(); |
|
75 |
|
76 /** |
|
77 * If the RunL function leaves, then the active scheduler call |
|
78 * RunError() to handle the leave. |
|
79 * @param aError - The error code |
|
80 */ |
|
81 TInt RunError ( TInt aError ); |
|
82 |
|
83 public: //New functions |
|
84 |
|
85 TBool LaunchAutoRestartL(); |
|
86 |
|
87 TBool IsRoaming(); |
|
88 void StartTimerL(); |
|
89 void StopTimer(); |
|
90 |
|
91 public: |
|
92 /** |
|
93 * ProfileId |
|
94 */ |
|
95 TSmlProfileId iProfileID; |
|
96 |
|
97 private: |
|
98 |
|
99 /** |
|
100 * Constructor |
|
101 */ |
|
102 CNsmlDSNetmon(); |
|
103 |
|
104 /** |
|
105 * Second phase constructor |
|
106 */ |
|
107 void ConstructL(CNSmlDSAgent& aDSAgent); |
|
108 |
|
109 /** |
|
110 * Resgiter for events |
|
111 */ |
|
112 void RegisterL(); |
|
113 |
|
114 /** |
|
115 * Close the server |
|
116 */ |
|
117 void Complete(); |
|
118 |
|
119 /** |
|
120 * Set active |
|
121 */ |
|
122 void IssueRequest(); |
|
123 |
|
124 // From base class MConnectionMonitorObserver |
|
125 void EventL ( const CConnMonEventBase& aConnMonEvent ); |
|
126 |
|
127 /** |
|
128 * Read the Global timeout from cenrep. |
|
129 */ |
|
130 TInt ReadTimeoutFromCenrepL(); |
|
131 |
|
132 private: |
|
133 |
|
134 /** |
|
135 *Instance of the DSAgent |
|
136 */ |
|
137 CNSmlDSAgent* iDSAgent; |
|
138 |
|
139 |
|
140 /** |
|
141 * Connection Monitor Server Instance |
|
142 */ |
|
143 RConnectionMonitor iConnectionMonitor; |
|
144 |
|
145 /** |
|
146 * States |
|
147 */ |
|
148 TNetMonStates iState; |
|
149 |
|
150 /** |
|
151 * Time @ which the packet data is resumed |
|
152 */ |
|
153 TTime iPacketDataAvailableTime; |
|
154 |
|
155 /** |
|
156 * Time @ which the packet data is lost |
|
157 */ |
|
158 TTime iPacketDataUnAvailableTime; |
|
159 |
|
160 /** |
|
161 * Auto Restart Timer |
|
162 */ |
|
163 CPeriodic* iAutoRestartTimer; |
|
164 |
|
165 /** |
|
166 * Roaming Status |
|
167 */ |
|
168 TInt iRoamingStatus; |
|
169 |
|
170 }; |
|
171 |
|
172 #endif // End of file |