|
1 /* |
|
2 * Copyright (c) 2002-2006 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: Container of event monitors |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CSATEVENTMONITORCONTAINER_H |
|
21 #define CSATEVENTMONITORCONTAINER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <etelsat.h> |
|
26 #include "MSatEventMonitorUtils.h" |
|
27 #include "MSatEventMonitorContainer.h" |
|
28 #include "MSatEventObserver.h" |
|
29 |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 class MSatEventMonitor; |
|
33 class TUSatAPI; |
|
34 class MSatUtils; |
|
35 class MSatBIPEventNotifier; |
|
36 |
|
37 /** |
|
38 * Base class for SAT commands. |
|
39 * |
|
40 * @lib SatServer |
|
41 * @since Series 60 3.0 |
|
42 */ |
|
43 class CSatEventMonitorContainer : public MSatEventMonitorContainer, |
|
44 public MSatEventMonitorUtils, |
|
45 public MSatEventObserver, |
|
46 public CActive |
|
47 { |
|
48 public: // Constructors and destructor |
|
49 |
|
50 /** |
|
51 * Two-phased constructor. |
|
52 * @param aUsatAPI Interface for EventDownload commands |
|
53 * @param aSatUtils Interface for SAT Utils class. |
|
54 */ |
|
55 static CSatEventMonitorContainer* NewL( |
|
56 TUSatAPI& aUsatAPI, |
|
57 MSatUtils& aSatUtils ); |
|
58 |
|
59 /** |
|
60 * Destructor. |
|
61 */ |
|
62 virtual ~CSatEventMonitorContainer(); |
|
63 |
|
64 public: // Functions from parent class |
|
65 |
|
66 /** |
|
67 * From MSatEventObserver |
|
68 */ |
|
69 void Event( TInt aEvent ); |
|
70 |
|
71 /** |
|
72 * From MSatEventMonitorContainer Updates monitors state. |
|
73 * @param aEvents Events that should be monitored. |
|
74 * @return KErrNone if all goes OK |
|
75 */ |
|
76 TInt SetUpEventMonitors( TUint aEvents ); |
|
77 |
|
78 /** |
|
79 * From MSatEventMonitorContainer Cancels all monitors |
|
80 * @return KErrNone if all monitros were cancelled |
|
81 */ |
|
82 TInt CancelAllMonitors(); |
|
83 |
|
84 /** |
|
85 * From MSatEventMonitorContainer Solves language code. |
|
86 * @param aLanguageId Resolved language ID |
|
87 */ |
|
88 void LanguageSettingL( TInt& aLanguageId ); |
|
89 |
|
90 /** |
|
91 * From MSatEventMonitorUtils Sends notify to SIM about some event |
|
92 * using EventDownload command. |
|
93 * @param aSingleEvent Single event reported to SIM. |
|
94 * @param aFirstArg First argument interpreted according to type of event |
|
95 * @param aSecArg Second argument interpreted according to type of event |
|
96 */ |
|
97 void EventDownload( RSat::TEventList aSingleEvent, |
|
98 TInt aFirstArg, |
|
99 TInt aSecArg ); |
|
100 |
|
101 /** |
|
102 * From MSatEventMonitorUtils Returns reference to |
|
103 * BIP Event notifier class. |
|
104 * @return Interface for BIP Utils class. |
|
105 */ |
|
106 MSatBIPEventNotifier& BipNotifier(); |
|
107 |
|
108 /** |
|
109 * From MSatEventMonitorContainer Called when SIM is removed. |
|
110 * This causes all monitors to be cancelled. |
|
111 */ |
|
112 void SimRemoved(); |
|
113 |
|
114 /** |
|
115 * From MSatEventMonitorContainer Gets the ISO639 language code. |
|
116 * @param aId Language ID |
|
117 * @param aText Language code can be read from this after function call. |
|
118 */ |
|
119 void GetLanguageString( const TInt aId, TDes& aText ); |
|
120 |
|
121 /** |
|
122 * From CActive Checks that EventDownload were succesful |
|
123 */ |
|
124 void RunL(); |
|
125 |
|
126 /** |
|
127 * From CActive Cancels EventDownload |
|
128 */ |
|
129 void DoCancel(); |
|
130 |
|
131 /** |
|
132 * From MSatEventMonitorUtils |
|
133 * Writes time between language selection and reboot. |
|
134 * @param aTime Time before reboot. |
|
135 * @return KErrNone if language selection time is set. |
|
136 */ |
|
137 TInt WriteLanguageSelectionTime( TInt aTime ); |
|
138 |
|
139 private: |
|
140 |
|
141 /** |
|
142 * C++ default constructor. |
|
143 * @param aUsatAPI Interface for EventDownload commands |
|
144 * @param aSatUtils Interface for SAT Utils class. |
|
145 */ |
|
146 CSatEventMonitorContainer( TUSatAPI& aUsatAPI, MSatUtils& aSatUtils ); |
|
147 |
|
148 /** |
|
149 * By default Symbian 2nd phase constructor is private. |
|
150 */ |
|
151 void ConstructL(); |
|
152 |
|
153 private: |
|
154 |
|
155 /** |
|
156 * Handles Language Selection event and sends event download |
|
157 * @param aLanguageId ID read from the P&S. Comes from monitor. |
|
158 */ |
|
159 void LanguageSelectionEvent( TInt aLanguageId ); |
|
160 |
|
161 /** |
|
162 * Handles the browser termination event and sends event download. |
|
163 * @param aCause The cause of the browser termination |
|
164 */ |
|
165 void BrowserTerminationEvent( TInt aCause ); |
|
166 |
|
167 /** |
|
168 * Handles Data avaliable event and sends event download |
|
169 * @param aChannelId Data channel identifier. Comes from monitor. |
|
170 */ |
|
171 void DataAvailableEvent( const TInt aChannelId, const TInt aLength ); |
|
172 |
|
173 /** |
|
174 * Handles Channel status event and sends event download |
|
175 * @param aChannelId Data channel identifier. Comes from monitor. |
|
176 * @param aStatus Status of the data channel. |
|
177 */ |
|
178 void ChannelStatusEvent( const TInt aChannelId, const TInt aStatus ); |
|
179 |
|
180 /** |
|
181 * Checks if aEvents contains only events that |
|
182 * are supported. |
|
183 * @param aEvents Events from SIM. |
|
184 * @return ETrue if aEvents are supported. |
|
185 */ |
|
186 TBool EventsSupported( TUint aEvents ) const; |
|
187 |
|
188 /** |
|
189 * Removes single event from event list |
|
190 * @param aSingleEvent Event to remove |
|
191 */ |
|
192 void RemoveSingleEvent( RSat::TEventList aSingleEvent ); |
|
193 |
|
194 private: // Data |
|
195 |
|
196 // Ponter array containing event monitors |
|
197 CArrayPtrFlat<MSatEventMonitor>* iEventMonitors; |
|
198 |
|
199 // Interface to EventDownload command sending |
|
200 TUSatAPI& iSat; |
|
201 |
|
202 // Indecates is there event pending |
|
203 TBool iEventPending; |
|
204 |
|
205 // Pending event |
|
206 RSat::TEventList iPendingEvent; |
|
207 |
|
208 // Pending first argument |
|
209 TInt iPendingFirstArg; |
|
210 |
|
211 // Pending second argument |
|
212 TInt iPendingSecondArg; |
|
213 |
|
214 // Utils class for BIP event monitors |
|
215 MSatUtils& iSatUtils; |
|
216 |
|
217 // Indicates whether there is BIP command executing or not |
|
218 TBool iBipExecuting; |
|
219 |
|
220 // Removable event after event download |
|
221 TInt iRemovableSingleEvent; |
|
222 |
|
223 }; |
|
224 |
|
225 #endif // CSATEVENTMONITORCONTAINER_H |
|
226 |
|
227 // End of File |