|
1 /* |
|
2 * Copyright (c) 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: Monitors device incoming call state |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "cvtengincomingcallmonitor.h" |
|
21 #include "CVTEngPubSubsListener.h" |
|
22 #include "CVtEngEventManager.h" |
|
23 #include "cvtlogger.h" |
|
24 |
|
25 #include <ctsydomainpskeys.h> |
|
26 |
|
27 // ============================ MEMBER FUNCTIONS =============================== |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // CVtEngIncomingCallMonitor::NewL |
|
31 // Two-phased constructor. |
|
32 // ----------------------------------------------------------------------------- |
|
33 // |
|
34 CVtEngIncomingCallMonitor* CVtEngIncomingCallMonitor::NewL() |
|
35 { |
|
36 CVtEngIncomingCallMonitor* self = new ( ELeave ) CVtEngIncomingCallMonitor(); |
|
37 CleanupStack::PushL( self ); |
|
38 self->ConstructL(); |
|
39 CleanupStack::Pop( self ); |
|
40 return self; |
|
41 } |
|
42 |
|
43 // |
|
44 // ----------------------------------------------------------------------------- |
|
45 // CVtEngIncomingCallMonitor::~ |
|
46 // Destructor. |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 CVtEngIncomingCallMonitor::~CVtEngIncomingCallMonitor() |
|
50 { |
|
51 delete iIncomingCallListener; |
|
52 } |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CVtEngIncomingCallMonitor::NotifyState |
|
56 // Notifies UI about device incoming call state |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 void CVtEngIncomingCallMonitor::NotifyState() const |
|
60 { |
|
61 __VTPRINTENTER( "IncomingCall.NotifyState" ) |
|
62 |
|
63 // Initialize state as first valuea of call state enum |
|
64 TInt state = EPSCTsyCallStateUninitialized; |
|
65 |
|
66 // Get incomig call state and send event to UI |
|
67 if ( iIncomingCallListener->Get( state ) == KErrNone ) |
|
68 { |
|
69 __VTPRINT2( DEBUG_SESSION, "IncomingCall.NotifyState=%d", state ) |
|
70 const TInt event = ( state == EPSCTsyCallStateRinging ) ? |
|
71 KVtEngSessionWaitingCallActive : KVtEngSessionWaitingCallInactive; |
|
72 CVtEngEventManager::NotifyEvent( event ); |
|
73 } |
|
74 __VTPRINTEXIT( "IncomingCall.NotifyState" ) |
|
75 } |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // CVtEngIncomingCallMonitoronitor::HandleNotifyPSL |
|
79 // Callback for incoming call state change |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 void CVtEngIncomingCallMonitor::HandleNotifyPSL( |
|
83 const TUid aUid, |
|
84 const TInt& aKey, |
|
85 const TRequestStatus& aStatus ) |
|
86 { |
|
87 if ( aStatus == KErrNone && |
|
88 aUid == KPSUidCtsyCallInformation && |
|
89 aKey == KCTsyCallState ) |
|
90 { |
|
91 NotifyState(); |
|
92 } |
|
93 } |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // CVtEngIncomingCallMonitor::CVtEngIncomingCallMonitor |
|
97 // C++ default constructor can NOT contain any code, that |
|
98 // might leave. |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 CVtEngIncomingCallMonitor::CVtEngIncomingCallMonitor() |
|
102 { |
|
103 } |
|
104 |
|
105 // ----------------------------------------------------------------------------- |
|
106 // CVtEngIncomingCallMonitor::ConstructL |
|
107 // Symbian 2nd phase constructor can leave. |
|
108 // ----------------------------------------------------------------------------- |
|
109 // |
|
110 void CVtEngIncomingCallMonitor::ConstructL() |
|
111 { |
|
112 __VTPRINTENTER( "IncomingCall.ConstructL" ) |
|
113 // Listener for incoming call state |
|
114 iIncomingCallListener = CVtEngPubSubsListener::NewL( |
|
115 KPSUidCtsyCallInformation, KCTsyCallState, this ); |
|
116 __VTPRINTEXIT( "IncomingCall.ConstructL" ) |
|
117 } |
|
118 |
|
119 // End of File |