|
1 /* |
|
2 * Copyright (c) 2002-2009 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: This file contains the header file of the CNWNetworkMcnEngine class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CNWNETWORKMCNENGINE_H |
|
20 #define CNWNETWORKMCNENGINE_H |
|
21 |
|
22 // INCLUDES |
|
23 #include "MCbsMcnObserver.h" //For McbsMcnObserver |
|
24 #include "MNWNetworkTimer.h" |
|
25 #include <e32base.h> |
|
26 #include <etelmm.h> |
|
27 |
|
28 |
|
29 //#define TESTINGMCN |
|
30 // CONSTANTS |
|
31 const TUint KNWMcnMsgId = 50; |
|
32 |
|
33 #ifdef TESTINGMCN |
|
34 const TInt KWaitTimeForNewMcn = 120000000; |
|
35 const TInt KWaitTimeToClearOldMcnIndicator = 5000000; |
|
36 const TInt KWaitTimeForNewMcnAfterClearingOld = KWaitTimeForNewMcn \ |
|
37 - KWaitTimeToClearOldMcnIndicator; |
|
38 #else |
|
39 //timer values |
|
40 const TInt KWaitTimeForNewMcn = 120000000; |
|
41 const TInt KWaitTimeToClearOldMcnIndicator = 5000000; |
|
42 const TInt KWaitTimeForNewMcnAfterClearingOld = KWaitTimeForNewMcn \ |
|
43 - KWaitTimeToClearOldMcnIndicator; |
|
44 #endif |
|
45 |
|
46 //for shared data |
|
47 const TInt KOptionalDefaultValue = 1; |
|
48 |
|
49 |
|
50 // FORWARD DECLARATIONS |
|
51 class CNWGsmSessionImplementation; |
|
52 class CNWNetworkMcnTimer; |
|
53 class CMcnTopicArray; |
|
54 class CMcn; |
|
55 class CNWGsmMessageHandler; |
|
56 class CRepository; |
|
57 |
|
58 // CLASS DECLARATION |
|
59 |
|
60 /** |
|
61 * Monitors current network change event from MMEtel. |
|
62 * |
|
63 * @lib Networkhandling.lib |
|
64 * @since Series 60_2.8 |
|
65 */ |
|
66 class CNWNetworkMcnEngine : public CActive, |
|
67 public MCbsMcnObserver, |
|
68 protected MNWNetworkTimer |
|
69 { |
|
70 public: // Constructors and destructor |
|
71 /** |
|
72 * C++ default constructor. |
|
73 */ |
|
74 CNWNetworkMcnEngine( CNWGsmMessageHandler& aMessageHandler, |
|
75 TNWInfo& aNetworkInfo, |
|
76 RMmCustomAPI& aCustomAPI, |
|
77 CNWGsmNetworkCellReselectionHandler& |
|
78 aCellReselectionHandler ); |
|
79 |
|
80 /** |
|
81 * Two-phased constructor. |
|
82 */ |
|
83 static CNWNetworkMcnEngine* NewL( |
|
84 CNWGsmMessageHandler& aMessageHandler, |
|
85 TNWInfo& aNetworkInfo, |
|
86 RMmCustomAPI& aCustomAPI, |
|
87 CNWGsmNetworkCellReselectionHandler& |
|
88 aCellReselectionHandler ); |
|
89 |
|
90 /** |
|
91 * Destructor. |
|
92 */ |
|
93 virtual ~CNWNetworkMcnEngine(); |
|
94 |
|
95 public: // Functions from MCbsMcnObserver |
|
96 /** |
|
97 * This method is called when a message of a subscribed topic |
|
98 * is received from the network. |
|
99 * @param aMcnMessage MCN message received from the network. |
|
100 * @return Result code |
|
101 */ |
|
102 TInt CellInfoChanged( const TCbsMcnMessage& aMcnMessage ); |
|
103 |
|
104 public: // Functions from SharedDataI |
|
105 /** |
|
106 * Is executed when shared data's cell info display value changes. |
|
107 * @param aPtr |
|
108 * @return Error code. |
|
109 */ |
|
110 static TInt SharedDataCallBack(TAny* aPtr); |
|
111 |
|
112 /** |
|
113 * Is called by CNWNetworkCurrentNetworkMonitor in case of |
|
114 * cell re-selection. |
|
115 */ |
|
116 void CellReselection(); |
|
117 |
|
118 |
|
119 private: |
|
120 /** |
|
121 * By default EPOC constructor is private. |
|
122 */ |
|
123 void ConstructL(); |
|
124 |
|
125 /** |
|
126 * Reads current cell info display setting value from shared data |
|
127 * or Central Repository. |
|
128 * @return Error code. |
|
129 */ |
|
130 void GetMcnDisplayValue(); |
|
131 |
|
132 /** |
|
133 * Registers to listen CBS messages. |
|
134 * @param aTopic Topic id of the CBS messages to listen. |
|
135 * @return Error code. |
|
136 */ |
|
137 void RegisterToCBSL( TUint16 aTopic ); |
|
138 |
|
139 /** |
|
140 * Handles the MCN display. |
|
141 * |
|
142 */ |
|
143 void StartIndicatorHandling(); |
|
144 |
|
145 |
|
146 /** |
|
147 * Handles the CBS messages. |
|
148 * @param aMcnMessage MCN message received from the network. |
|
149 * @return Possible error code |
|
150 */ |
|
151 TInt HandleCBSMessages( const TCbsMcnMessage& aMcnMessage ); |
|
152 |
|
153 /** |
|
154 * Resets MCN display's TNWInfo values. |
|
155 * |
|
156 */ |
|
157 void ResetIndicatorValues(); |
|
158 |
|
159 |
|
160 |
|
161 /** |
|
162 * Notify MCN display changed. |
|
163 * |
|
164 */ |
|
165 void NotifyMcnDisplayChanged(); |
|
166 |
|
167 protected: // Functions from MNWNetworkTimer |
|
168 /** |
|
169 * This method is called when network timer expires. |
|
170 * |
|
171 */ |
|
172 void HandleTimeOut(); |
|
173 |
|
174 protected: // Functions from CActive |
|
175 |
|
176 /** |
|
177 * Cancels asyncronous request(s). |
|
178 */ |
|
179 void DoCancel(); |
|
180 |
|
181 /** |
|
182 * Informs object that asyncronous request is ready. |
|
183 */ |
|
184 void RunL(); |
|
185 |
|
186 private: // Data |
|
187 |
|
188 //States |
|
189 enum |
|
190 { |
|
191 EListeningNone, |
|
192 EListeningMCN, |
|
193 } iCBSState; |
|
194 |
|
195 enum |
|
196 { |
|
197 EIdle, |
|
198 ECbsWaitingToClearMcnIndicator, |
|
199 ECbsWaitingForNewMcn |
|
200 } iState; |
|
201 |
|
202 //Timer |
|
203 CNWNetworkMcnTimer* iTimer; |
|
204 //new cellId that will be used to comparization |
|
205 TUint iComparedCellId; |
|
206 |
|
207 // Reference to CNWGsmMessageHandler |
|
208 CNWGsmMessageHandler& iGsmMessageHandler; |
|
209 // Reference to the network info structure. |
|
210 TNWInfo& iNWNetworkInfo; |
|
211 // Reference to the customAPI connection |
|
212 RMmCustomAPI& iCustomAPI; |
|
213 // Reference to the CNWGsmNetworkCellReselectionHandler |
|
214 CNWGsmNetworkCellReselectionHandler& iCellReselectionHandler; |
|
215 // Pointer to MCN object |
|
216 CMcn* iMcn; |
|
217 //Boolean indicating if to listen MCN Display area |
|
218 TBool iListenMCNDisplay; |
|
219 |
|
220 //Handle to Central repository |
|
221 CRepository* iRepository; |
|
222 }; |
|
223 |
|
224 #endif // CNWNETWORKMCNENGINE_H |
|
225 |
|
226 // End of File |