|
1 /* |
|
2 * Copyright (c) 2005-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: Monitor the events of CS call |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "mussesseioninformationapi.h" |
|
20 #include "muscalleventmonitor.h" |
|
21 #include "muslogger.h" |
|
22 |
|
23 #include <etelmm.h> |
|
24 #include <e32svr.h> |
|
25 #include <mmtsy_names.h> |
|
26 #include <e32property.h> |
|
27 |
|
28 |
|
29 // ------------------------------------------------------------------------------ |
|
30 // Symbian two-phase constructor. |
|
31 // ------------------------------------------------------------------------------ |
|
32 // |
|
33 CMusCallEventMonitor* CMusCallEventMonitor::NewL( const RMobileCall& aCall, MMusTsyPropertyObserver& aObserver ) |
|
34 { |
|
35 MUS_LOG( "mus: [MUSAO] -> CMusCallEventMonitor::NewL" ) |
|
36 CMusCallEventMonitor* self = new (ELeave) CMusCallEventMonitor(aCall, aObserver); |
|
37 CleanupStack::PushL( self ); |
|
38 self->ConstructL(); |
|
39 CleanupStack::Pop( self ); |
|
40 MUS_LOG( "mus: [MUSAO] <- CMusCallEventMonitor::NewL" ) |
|
41 return self; |
|
42 } |
|
43 |
|
44 |
|
45 // ------------------------------------------------------------------------------ |
|
46 // C++ destructor. |
|
47 // ------------------------------------------------------------------------------ |
|
48 // |
|
49 CMusCallEventMonitor::~CMusCallEventMonitor() |
|
50 { |
|
51 MUS_LOG( "mus: [MUSAO] -> CMusCallEventMonitor::~CMusCallEventMonitor" ) |
|
52 Cancel(); |
|
53 MUS_LOG( "mus: [MUSAO] <- CMusCallEventMonitor::~CMusCallEventMonitor" ) |
|
54 } |
|
55 |
|
56 // ------------------------------------------------------------------------------ |
|
57 // Symbian second-phase constructor. |
|
58 // ------------------------------------------------------------------------------ |
|
59 // |
|
60 void CMusCallEventMonitor::ConstructL( ) |
|
61 { |
|
62 MUS_LOG( "mus: [MUSAO] -> CMusCallEventMonitor::ConstructL" ) |
|
63 CActiveScheduler::Add( this ); |
|
64 iCall.NotifyCallEvent( iStatus, iCallEvent ); |
|
65 SetActive(); |
|
66 MUS_LOG( "mus: [MUSAO] <- CMusCallEventMonitor::ConstructL" ) |
|
67 } |
|
68 |
|
69 |
|
70 // ------------------------------------------------------------------------------ |
|
71 // C++ constructor. |
|
72 // ------------------------------------------------------------------------------ |
|
73 // |
|
74 CMusCallEventMonitor::CMusCallEventMonitor( const RMobileCall& aCall, MMusTsyPropertyObserver& aObserver ) |
|
75 : CMusCallMonitorBase(aCall, aObserver) |
|
76 |
|
77 { |
|
78 |
|
79 } |
|
80 |
|
81 |
|
82 // ----------------------------------------------------------------------------- |
|
83 // CMusCallEventMonitor::RunL() |
|
84 // From CActive.It will be called any NotifyMobileLineStatusChange |
|
85 // Event happens. |
|
86 // ----------------------------------------------------------------------------- |
|
87 // |
|
88 void CMusCallEventMonitor::RunL() |
|
89 { |
|
90 MUS_LOG( "mus: [MUSAO] -> CMusCallEventMonitor::RunL" ) |
|
91 iCall.NotifyCallEvent( iStatus, iCallEvent ); |
|
92 SetActive(); |
|
93 MUS_LOG1( "mus: [MUSAO] iCallEvent = %d", iCallEvent ) |
|
94 switch(iCallEvent) |
|
95 { |
|
96 case RMobileCall::ELocalHold: |
|
97 iLocalCallEvent = RMobileCall::ELocalHold; |
|
98 SetStateL( NMusSessionInformationApi::ECallHold ); |
|
99 break; |
|
100 case RMobileCall::ELocalResume: |
|
101 iLocalCallEvent = RMobileCall::ELocalResume; |
|
102 // when local resume happens , check the remote call state. |
|
103 // without knowing remote call state we can not set the state |
|
104 // to call connected. |
|
105 if( iRemoteCallEvent == RMobileCall::ERemoteResume) |
|
106 { |
|
107 SetStateL( NMusSessionInformationApi::ECallConnected ); |
|
108 } |
|
109 else |
|
110 { |
|
111 SetStateL( NMusSessionInformationApi::ECallHold ); |
|
112 } |
|
113 break; |
|
114 case RMobileCall::ELocalDeflectCall: |
|
115 //SetStateL( NMusSessionInformationApi::ECallHold ); |
|
116 break; |
|
117 case RMobileCall::ELocalTransfer: |
|
118 SetStateL( NMusSessionInformationApi::ENoCall ); |
|
119 break; |
|
120 case RMobileCall::ERemoteHold: |
|
121 iRemoteCallEvent = RMobileCall::ERemoteHold; |
|
122 SetStateL( NMusSessionInformationApi::ECallHold ); |
|
123 break; |
|
124 case RMobileCall::ERemoteResume: |
|
125 iRemoteCallEvent = RMobileCall::ERemoteResume; |
|
126 // when remote resume happens , check the local call state. |
|
127 // without knowing local call state we can not set the state |
|
128 // to call connected. |
|
129 if( iLocalCallEvent == RMobileCall::ELocalResume) |
|
130 { |
|
131 SetStateL( NMusSessionInformationApi::ECallConnected ); |
|
132 } |
|
133 else |
|
134 { |
|
135 SetStateL( NMusSessionInformationApi::ECallHold ); |
|
136 } |
|
137 break; |
|
138 case RMobileCall::ERemoteTerminated: |
|
139 SetStateL( NMusSessionInformationApi::ENoCall ); |
|
140 NotifyCallStateChanged( NMusSessionInformationApi::ENoCall ); |
|
141 break; |
|
142 case RMobileCall::ERemoteConferenceCreate: |
|
143 SetStateL( NMusSessionInformationApi::EConferenceCall ); |
|
144 break; |
|
145 case RMobileCall::ERemoteTransferring: |
|
146 //SetStateL( NMusSessionInformationApi::ECallHold ); |
|
147 break; |
|
148 case RMobileCall::ERemoteTransferAlerting: |
|
149 //SetStateL( NMusSessionInformationApi::ECallHold ); |
|
150 break; |
|
151 case RMobileCall::ERemoteBarred: |
|
152 //SetStateL( NMusSessionInformationApi::ECallHold ); |
|
153 break; |
|
154 case RMobileCall::ERemoteForwarding: |
|
155 //SetStateL( NMusSessionInformationApi::ECallHold ); |
|
156 break; |
|
157 case RMobileCall::ERemoteWaiting: |
|
158 //SetStateL( NMusSessionInformationApi::ECallHold ); |
|
159 break; |
|
160 case RMobileCall::ELocalBarred: |
|
161 //SetStateL( NMusSessionInformationApi::ECallHold ); |
|
162 break; |
|
163 default: |
|
164 break; |
|
165 } |
|
166 MUS_LOG( "mus: [MUSAO] <- CMusCallEventMonitor::RunL" ) |
|
167 } |
|
168 |
|
169 |
|
170 // ----------------------------------------------------------------------------- |
|
171 // CMusCallEventMonitor::DoCancel() |
|
172 // Implemented for CActive. |
|
173 // Will be called when Cancel() method is called. |
|
174 // ----------------------------------------------------------------------------- |
|
175 // |
|
176 void CMusCallEventMonitor::DoCancel() |
|
177 { |
|
178 MUS_LOG( "mus: [MUSAO] -> CMusCallEventMonitor::DoCancel" ) |
|
179 iCall.CancelAsyncRequest( EMobileCallNotifyCallEvent ); |
|
180 MUS_LOG( "mus: [MUSAO] <- CMusCallEventMonitor::DoCancel" ) |
|
181 } |
|
182 |
|
183 // End of file |