|
1 /* |
|
2 * Copyright (c) 2006-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: ConnMon Telephony watcher. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CONNMONTELNOTI_H |
|
19 #define CONNMONTELNOTI_H |
|
20 |
|
21 #include <etelpckt.h> |
|
22 #include <etelmm.h> |
|
23 |
|
24 /** |
|
25 * Connection Monitor Server Telephony watcher observer. |
|
26 * @lib CONNMON.LIB |
|
27 */ |
|
28 class MConnMonTelephonyObserver |
|
29 { |
|
30 public: |
|
31 /** |
|
32 * Notifies the observer that the phone line status has changed. |
|
33 */ |
|
34 virtual void PhoneLineStatusChange() = 0; |
|
35 }; |
|
36 |
|
37 /** |
|
38 * Connection Monitor Server Telephony watcher. |
|
39 * @lib CONNMON.LIB |
|
40 */ |
|
41 NONSHARABLE_CLASS( CConnMonTelNotifier ) : public CActive |
|
42 { |
|
43 public: |
|
44 /** |
|
45 * Two-phased constructor. |
|
46 * |
|
47 * @param aObserver A refernce to the observer which wants to listen to the |
|
48 * notifications. |
|
49 * @param aMobilePhone A pointer to a RMobilePhone instance, which has been |
|
50 * initialized fully. |
|
51 * @return An initialized instance of this class. |
|
52 */ |
|
53 static CConnMonTelNotifier* NewL( |
|
54 MConnMonTelephonyObserver& aObserver, |
|
55 RMobilePhone* aMobilePhone ); |
|
56 |
|
57 /** |
|
58 * Destructor. |
|
59 */ |
|
60 virtual ~CConnMonTelNotifier(); |
|
61 |
|
62 public: |
|
63 /** |
|
64 * Checks if phone call is active. |
|
65 * @return ETrue phone call is active, otherwice EFalse. |
|
66 */ |
|
67 TBool IsCallActive() const; |
|
68 |
|
69 /** |
|
70 * Starts to notify client of the events. |
|
71 */ |
|
72 void Receive(); |
|
73 |
|
74 /** |
|
75 * Cancels notifying the the events. |
|
76 */ |
|
77 void CancelNotifications(); |
|
78 |
|
79 protected: |
|
80 /** |
|
81 * From CActive. Cancels request. |
|
82 */ |
|
83 void DoCancel(); |
|
84 |
|
85 /** |
|
86 * From CActive. Run when request completes. |
|
87 */ |
|
88 void RunL(); |
|
89 |
|
90 private: |
|
91 /** |
|
92 * Constructor. |
|
93 * |
|
94 * @param aObserver A refernce to the observer which wants to listen to the |
|
95 * notifications. |
|
96 * @param aMobilePhone A pointer to a RMobilePhone instance, which has been |
|
97 * initialized fully. |
|
98 */ |
|
99 CConnMonTelNotifier( |
|
100 MConnMonTelephonyObserver& aObserver, |
|
101 RMobilePhone* aMobilePhone ); |
|
102 |
|
103 /** |
|
104 * 2nd phase constructor. |
|
105 */ |
|
106 void Construct(); |
|
107 |
|
108 private: |
|
109 RMobilePhone* iMobilePhone; |
|
110 TBool iVoiceCallActive; |
|
111 RCall::TStatus iCallStatus; |
|
112 MConnMonTelephonyObserver& iObserver; |
|
113 |
|
114 // ETrue if client has called receive and wants the notifications. Only |
|
115 // affects the sending of the notifications not the receving. |
|
116 TBool iSendEvents; |
|
117 |
|
118 RLine iLine; |
|
119 }; |
|
120 |
|
121 #endif // CONNMONTELNOTI_H |
|
122 |
|
123 // End-of-file |