|
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Common Fax/Hayes definitions |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalAll |
|
21 */ |
|
22 |
|
23 #ifndef __NOTIFY_H__ |
|
24 #define __NOTIFY_H__ |
|
25 |
|
26 #include "ATBASE.H" |
|
27 /** |
|
28 @internalComponent |
|
29 */ |
|
30 enum TNotifications |
|
31 { |
|
32 EModemDetection, |
|
33 EIncomingCall, |
|
34 ELineHookChange, |
|
35 ECallHookChange, |
|
36 ELineStatusChange, |
|
37 ENewCallAdded, |
|
38 ECallStatusChange, |
|
39 ECallDurationChange, |
|
40 ECallCaps, |
|
41 EReadOrWriteFax, |
|
42 EEndOfFaxPage, // used for both Rx and Tx modes |
|
43 ERegistrationStatus, |
|
44 ECurrentNetwork, |
|
45 EMobileCallStatusChange, |
|
46 ECallMobileCaps, |
|
47 EMobileLineStatusChange, |
|
48 // GPRS |
|
49 EPacketContextAdded, |
|
50 EPacketStatusChange, |
|
51 EPacketNtwkRegStatusChange, |
|
52 // GPRS Context |
|
53 EPacketContextConfigChange, |
|
54 EPacketContextStatusChange, |
|
55 // GPRS QoS |
|
56 EPacketQoSProfileChange |
|
57 }; |
|
58 /** |
|
59 @internalComponent |
|
60 */ |
|
61 enum TEvent |
|
62 { |
|
63 ENoEvent, |
|
64 ERingOccurred, |
|
65 ERingStopped, |
|
66 EPhoneDetected, |
|
67 EPhoneNotDetected, |
|
68 EBegunConnecting, |
|
69 EConnected, |
|
70 EBegunHangingUp, |
|
71 EBecomeIdle, |
|
72 ECallAdded, |
|
73 ETimePeriodElapsed, |
|
74 EDataPortLoaned, |
|
75 EDataPortRecovered, |
|
76 EFaxReadOrWriteCompleted, |
|
77 EEndOfFaxPageCompleted, |
|
78 EFaxProgressChanged, |
|
79 EFaxSessionTerminated, |
|
80 EAddressAddedToPhoneBookCompleted, |
|
81 EAddressRemovedFromPhoneBookCompleted, |
|
82 ERegistrationStatusChanged, |
|
83 ECurrentNetworkChanged, |
|
84 // GPRS |
|
85 EPacketContextAddedChanged, |
|
86 EPacketStatusChanged, |
|
87 // GPRS Context |
|
88 EPacketContextConfigChanged, |
|
89 EPacketContextStatusChanged, |
|
90 // GPRS QoS |
|
91 EPacketQoSProfileChanged |
|
92 }; |
|
93 /** |
|
94 @internalComponent |
|
95 */ |
|
96 struct TLastEvent |
|
97 { |
|
98 TEvent iLastEvent; |
|
99 CTelObject* iTelObject; |
|
100 }; |
|
101 |
|
102 class CFaxSession; |
|
103 class CNotifyBase; |
|
104 class CNotifications : public CBase |
|
105 /** |
|
106 @internalComponent |
|
107 */ |
|
108 { |
|
109 public: |
|
110 static CNotifications* NewL(); |
|
111 CNotifications(); |
|
112 void ConstructL(); |
|
113 ~CNotifications(); |
|
114 void RegisterNotification(TNotifications aWhichNotification, |
|
115 TTsyReqHandle aTsyReqHandle, |
|
116 CTelObject* aTelObject, |
|
117 TAny* aParams = NULL); |
|
118 void CheckNotification(CTelObject* aTelObject,TEvent aEvent); |
|
119 void CheckNotification(CCallBase* aCallObject,TEvent aEvent); |
|
120 void CheckNotification(CFaxSession* aETelFaxObject,TEvent aEvent, |
|
121 TInt aError,TAny* aParams=NULL); |
|
122 void CheckNotification(CTelObject* aTelObject, TNotifications aNotification); |
|
123 TBool CheckForEIncomingSmsNotification(); |
|
124 void RemoveNotification(TTsyReqHandle aTsyReqHandle); |
|
125 void CompleteNotificationsWithError(TInt aError); |
|
126 void RemoveClientFromLastEvents(CTelObject* aTelObject); |
|
127 void RemoveEventFromLastEvents(TEvent aEvent); |
|
128 protected: |
|
129 TInt AddLastEvent(CTelObject* aTelObject,TEvent aLastEvent); |
|
130 TInt FindLastEvent(CTelObject* aTelObject); |
|
131 TInt GetLastEvent(CTelObject* aTelObject, TLastEvent& aLastEvent); |
|
132 void RegisterNotificationL(CNotifyBase* aNotify); |
|
133 protected: |
|
134 CArrayPtrFlat<CNotifyBase>* iNotifications; |
|
135 CArrayFixFlat<TLastEvent>* iLastEvents; // each TelObject has a last event |
|
136 TBool iAlreadyChecking; |
|
137 }; |
|
138 |
|
139 class CCallMobileFax; |
|
140 class CATBase; |
|
141 class CNotifyBase : public CBase |
|
142 /** |
|
143 @internalComponent |
|
144 */ |
|
145 { |
|
146 protected: |
|
147 CNotifyBase(TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
148 public: |
|
149 ~CNotifyBase(); |
|
150 virtual TBool CheckAndCompleteNotification(CTelObject* aTelObject,TEvent aEvent,TEvent aLastEvent); |
|
151 virtual TBool CheckAndCompleteNotification(CCallBase* aCallObject,TEvent aEvent,TEvent aLastEvent); |
|
152 virtual TBool CheckAndCompleteNotification(CFaxSession* aETelFaxObject,TEvent aEvent,TInt aError,TAny* aParams=NULL); |
|
153 virtual TBool CheckAndCompleteNotification(CTelObject* aTelObject, TNotifications aNotification); |
|
154 public: |
|
155 TTsyReqHandle TsyReqHandle(); |
|
156 CTelObject* TelObject(); |
|
157 protected: |
|
158 TTsyReqHandle iReqHandle; |
|
159 CTelObject* iTelObject; |
|
160 private: |
|
161 CArrayFixFlat<CNotifyBase*>* iNotifications; |
|
162 }; |
|
163 |
|
164 class CNotifyModemDetected : public CNotifyBase |
|
165 /** |
|
166 @internalComponent |
|
167 */ |
|
168 { |
|
169 public: |
|
170 static CNotifyModemDetected* NewL(RPhone::TModemDetection* aDetection,TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
171 CNotifyModemDetected(RPhone::TModemDetection* aDetection,TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
172 ~CNotifyModemDetected(); |
|
173 virtual TBool CheckAndCompleteNotification(CTelObject* aTelObject,TEvent aEvent,TEvent iLastEvent); |
|
174 virtual TBool CheckAndCompleteNotification(CCallBase* aCallObject,TEvent aEvent,TEvent aLastEvent); |
|
175 private: |
|
176 RPhone::TModemDetection* iDetection; |
|
177 }; |
|
178 |
|
179 class CNotifyIncomingCall : public CNotifyBase |
|
180 /** |
|
181 @internalComponent |
|
182 */ |
|
183 { |
|
184 public: |
|
185 static CNotifyIncomingCall* NewL(TDes* aName,TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
186 CNotifyIncomingCall(TDes* aName,TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
187 ~CNotifyIncomingCall(); |
|
188 virtual TBool CheckAndCompleteNotification(CTelObject* aTelObject,TEvent aEvent,TEvent iLastEvent); |
|
189 virtual TBool CheckAndCompleteNotification(CCallBase* aCallBase,TEvent aEvent,TEvent aLastEvent); |
|
190 private: |
|
191 TDes* iName; |
|
192 }; |
|
193 |
|
194 class CNotifyLineHookChange : public CNotifyBase |
|
195 /** |
|
196 @internalComponent |
|
197 */ |
|
198 { |
|
199 public: |
|
200 static CNotifyLineHookChange* NewL(RCall::THookStatus* aHookStatus,TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
201 CNotifyLineHookChange(RCall::THookStatus* aHookStatus,TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
202 ~CNotifyLineHookChange(); |
|
203 virtual TBool CheckAndCompleteNotification(CCallBase* aCallObject,TEvent aEvent,TEvent iLastEvent); |
|
204 private: |
|
205 RCall::THookStatus* iHookStatus; |
|
206 }; |
|
207 |
|
208 class CNotifyCallHookChange : public CNotifyBase |
|
209 /** |
|
210 @internalComponent |
|
211 */ |
|
212 { |
|
213 public: |
|
214 static CNotifyCallHookChange* NewL(RCall::THookStatus* aHookStatus,TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
215 CNotifyCallHookChange(RCall::THookStatus* aHookStatus,TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
216 ~CNotifyCallHookChange(); |
|
217 virtual TBool CheckAndCompleteNotification(CTelObject* aTelObject,TEvent aEvent,TEvent iLastEvent); |
|
218 virtual TBool CheckAndCompleteNotification(CCallBase* aCallObject,TEvent aEvent,TEvent iLastEvent); |
|
219 private: |
|
220 RCall::THookStatus* iHookStatus; |
|
221 }; |
|
222 |
|
223 class CNotifyLineStatusChange : public CNotifyBase |
|
224 /** |
|
225 @internalComponent |
|
226 */ |
|
227 { |
|
228 public: |
|
229 static CNotifyLineStatusChange* NewL(RCall::TStatus* aStatus,TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
230 CNotifyLineStatusChange(RCall::TStatus* aStatus,TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
231 ~CNotifyLineStatusChange(); |
|
232 virtual TBool CheckAndCompleteNotification(CTelObject* aTelObject,TEvent aEvent,TEvent iLastEvent); |
|
233 virtual TBool CheckAndCompleteNotification(CCallBase* aCallObject,TEvent aEvent,TEvent iLastEvent); |
|
234 private: |
|
235 RCall::TStatus* iStatus; |
|
236 }; |
|
237 |
|
238 class CNotifyMobileLineStatusChange : public CNotifyBase |
|
239 /** |
|
240 @internalComponent |
|
241 */ |
|
242 { |
|
243 public: |
|
244 static CNotifyMobileLineStatusChange* NewL(RMobileCall::TMobileCallStatus* aStatus,TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
245 CNotifyMobileLineStatusChange(RMobileCall::TMobileCallStatus* aStatus,TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
246 ~CNotifyMobileLineStatusChange(); |
|
247 virtual TBool CheckAndCompleteNotification(CTelObject* aTelObject,TEvent aEvent,TEvent iLastEvent); |
|
248 virtual TBool CheckAndCompleteNotification(CCallBase* aCallObject,TEvent aEvent,TEvent iLastEvent); |
|
249 private: |
|
250 RMobileCall::TMobileCallStatus* iStatus; |
|
251 }; |
|
252 |
|
253 class CNotifyLineNewCallAdded : public CNotifyBase |
|
254 /** |
|
255 @internalComponent |
|
256 */ |
|
257 { |
|
258 public: |
|
259 static CNotifyLineNewCallAdded* NewL(TDes* aName,TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
260 CNotifyLineNewCallAdded(TDes* aName,TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
261 ~CNotifyLineNewCallAdded(); |
|
262 virtual TBool CheckAndCompleteNotification(CTelObject* aTelObject,TEvent aEvent,TEvent iLastEvent); |
|
263 private: |
|
264 TDes* iName; |
|
265 }; |
|
266 |
|
267 class CNotifyCallStatusChange : public CNotifyBase |
|
268 /** |
|
269 @internalComponent |
|
270 */ |
|
271 { |
|
272 public: |
|
273 static CNotifyCallStatusChange* NewL(RCall::TStatus* aStatus,TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
274 CNotifyCallStatusChange(RCall::TStatus* aStatus,TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
275 ~CNotifyCallStatusChange(); |
|
276 // virtual TBool CheckAndCompleteNotification(CTelObject* /*aTelObject*/,TEvent aEvent,TEvent aLastEvent); |
|
277 virtual TBool CheckAndCompleteNotification(CCallBase* aCallObject,TEvent aEvent,TEvent iLastEvent); |
|
278 private: |
|
279 RCall::TStatus* iStatus; |
|
280 }; |
|
281 |
|
282 class CNotifyMobileCallStatusChange : public CNotifyBase |
|
283 /** |
|
284 @internalComponent |
|
285 */ |
|
286 { |
|
287 public: |
|
288 static CNotifyMobileCallStatusChange* NewL(RMobileCall::TMobileCallStatus* aStatus,TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
289 CNotifyMobileCallStatusChange(RMobileCall::TMobileCallStatus* aStatus,TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
290 ~CNotifyMobileCallStatusChange(); |
|
291 virtual TBool CheckAndCompleteNotification(CCallBase* aCallObject,TEvent aEvent,TEvent iLastEvent); |
|
292 private: |
|
293 RMobileCall::TMobileCallStatus* iStatus; |
|
294 }; |
|
295 |
|
296 class CNotifyCallDurationChange : public CNotifyBase |
|
297 /** |
|
298 @internalComponent |
|
299 */ |
|
300 { |
|
301 public: |
|
302 static CNotifyCallDurationChange* NewL(TTimeIntervalSeconds* aTime,TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
303 CNotifyCallDurationChange(TTimeIntervalSeconds* aTime,TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
304 ~CNotifyCallDurationChange(); |
|
305 virtual TBool CheckAndCompleteNotification(CCallBase* aCallObject,TEvent aEvent,TEvent iLastEvent); |
|
306 private: |
|
307 TTimeIntervalSeconds* iTime; |
|
308 }; |
|
309 |
|
310 class CNotifyCallCaps : public CNotifyBase |
|
311 /** |
|
312 @internalComponent |
|
313 */ |
|
314 { |
|
315 public: |
|
316 static CNotifyCallCaps* NewL(RCall::TCaps* aCaps,TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
317 CNotifyCallCaps(RCall::TCaps* aCaps,TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
318 ~CNotifyCallCaps(); |
|
319 virtual TBool CheckAndCompleteNotification(CTelObject* /*aTelObject*/,TEvent aEvent,TEvent aLastEvent); |
|
320 virtual TBool CheckAndCompleteNotification(CCallBase* aCallObject,TEvent aEvent,TEvent iLastEvent); |
|
321 private: |
|
322 RCall::TCaps* iCaps; |
|
323 }; |
|
324 |
|
325 class CNotifyMobileCallCaps : public CNotifyBase |
|
326 /** |
|
327 @internalComponent |
|
328 */ |
|
329 { |
|
330 public: |
|
331 static CNotifyMobileCallCaps* NewL(TDes8* aCaps,TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
332 CNotifyMobileCallCaps(TDes8* aCaps,TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
333 ~CNotifyMobileCallCaps(); |
|
334 virtual TBool CheckAndCompleteNotification(CTelObject* /*aTelObject*/,TEvent aEvent,TEvent aLastEvent); |
|
335 virtual TBool CheckAndCompleteNotification(CCallBase* aCallObject,TEvent aEvent,TEvent iLastEvent); |
|
336 private: |
|
337 RMobileCall::TMobileCallCapsV1Pckg* iCapsPckg; |
|
338 }; |
|
339 |
|
340 class CNotifyFaxReadOrWrite : public CNotifyBase |
|
341 /** |
|
342 @internalComponent |
|
343 */ |
|
344 { |
|
345 public: |
|
346 static CNotifyFaxReadOrWrite* NewL(TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
347 CNotifyFaxReadOrWrite(TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
348 ~CNotifyFaxReadOrWrite(); |
|
349 virtual TBool CheckAndCompleteNotification(CFaxSession* aETelFaxObject,TEvent aEvent,TInt aError,TAny* aParams); |
|
350 }; |
|
351 |
|
352 class CNotifyFaxEndOfPage : public CNotifyBase |
|
353 /** |
|
354 @internalComponent |
|
355 */ |
|
356 { |
|
357 public: |
|
358 static CNotifyFaxEndOfPage* NewL(TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
359 CNotifyFaxEndOfPage(TTsyReqHandle aReqHandle,CTelObject* aTelObject); |
|
360 ~CNotifyFaxEndOfPage(); |
|
361 virtual TBool CheckAndCompleteNotification(CFaxSession* aETelFaxObject,TEvent aEvent,TInt aError,TAny* aParams); |
|
362 }; |
|
363 |
|
364 #endif |