|
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: Incoming Call Handler. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_EVTCALLHANDLER_H |
|
20 #define C_EVTCALLHANDLER_H |
|
21 |
|
22 // System Includes |
|
23 #include <e32base.h> |
|
24 #include <etel3rdparty.h> |
|
25 |
|
26 //Forward Declaration |
|
27 |
|
28 // Class Definition |
|
29 /** |
|
30 * Interface class to observe for an incoming call. |
|
31 * |
|
32 * @lib |
|
33 * @since S60 v9.1 |
|
34 */ |
|
35 class MEvtCallObserver |
|
36 { |
|
37 public: |
|
38 /** |
|
39 * This will notify when there is an incoming call. |
|
40 */ |
|
41 virtual void HandleIncomingCallL( )=0; |
|
42 |
|
43 }; |
|
44 |
|
45 /** |
|
46 * Adapter class to observe for an incoming Call. |
|
47 * This class listens for an incoming call and notifies |
|
48 * the observer(MEvtCallObserver). |
|
49 * |
|
50 * @lib |
|
51 * @since S60 v9.1 |
|
52 */ |
|
53 NONSHARABLE_CLASS( CEvtCallHandler ): public CActive |
|
54 { |
|
55 public: |
|
56 /** |
|
57 * Constructs a new instance of Call Handler. |
|
58 * |
|
59 * @return The new instance of Call Handler object. |
|
60 * @leave System wide error code if the object creation fails. |
|
61 */ |
|
62 static CEvtCallHandler* NewL( MEvtCallObserver& aObserver ); |
|
63 |
|
64 /** |
|
65 * Constructs a new instance of Call Handler. |
|
66 * Leaves the created instance on the cleanup stack. |
|
67 * |
|
68 * @return The new instance of Call Handler object. |
|
69 * @leave System wide error code if the object creation fails. |
|
70 */ |
|
71 static CEvtCallHandler* NewLC( MEvtCallObserver& aObserver ); |
|
72 |
|
73 /** |
|
74 * Destructor. |
|
75 */ |
|
76 virtual ~CEvtCallHandler(); |
|
77 |
|
78 public: // Public Functions |
|
79 |
|
80 /** |
|
81 * Starts listening for the incoming calls. |
|
82 */ |
|
83 void StartListening(); |
|
84 |
|
85 /** |
|
86 * Check if there is any outstanding call. |
|
87 * @param TBool Returns ETrue if a call is active. |
|
88 */ |
|
89 TBool IsCallActive( ); |
|
90 |
|
91 /** |
|
92 * Check if there is any incoming call. |
|
93 * @param TBool Returns ETrue if there is an incoming call. |
|
94 */ |
|
95 TBool IsCallIncoming( ); |
|
96 |
|
97 private: |
|
98 /** |
|
99 * From CActive |
|
100 */ |
|
101 void RunL(); |
|
102 |
|
103 /** |
|
104 * From CActive |
|
105 */ |
|
106 TInt RunError(TInt anError); |
|
107 |
|
108 /** |
|
109 * From CActive |
|
110 */ |
|
111 void DoCancel(); |
|
112 |
|
113 /** |
|
114 * Default C++ Constructor. |
|
115 */ |
|
116 CEvtCallHandler( MEvtCallObserver& aObserver ); |
|
117 |
|
118 /** |
|
119 * Second phase of the two phase constructor. |
|
120 */ |
|
121 void ConstructL(); |
|
122 |
|
123 private: // data |
|
124 |
|
125 /** |
|
126 * Incoming Call Observer. |
|
127 */ |
|
128 MEvtCallObserver& iObserver; |
|
129 |
|
130 /** |
|
131 * CTelephony handle. |
|
132 * Own |
|
133 */ |
|
134 CTelephony* iTelephony; |
|
135 |
|
136 /** |
|
137 * Call status |
|
138 */ |
|
139 CTelephony::TCallStatusV1 iCallStatus; |
|
140 |
|
141 /** |
|
142 * Package for Call status |
|
143 */ |
|
144 CTelephony::TCallStatusV1Pckg iCallStatusPkg; |
|
145 |
|
146 }; |
|
147 |
|
148 #endif C_EVTCALLHANDLER_H |