|
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 status of CS call |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "muscallstatusmonitor.h" |
|
20 #include "mussesseioninformationapi.h" |
|
21 #include "muslogger.h" |
|
22 |
|
23 #include <mmtsy_names.h> |
|
24 #include <e32property.h> |
|
25 |
|
26 |
|
27 // ----------------------------------------------------------------------------- |
|
28 // Symbian two-phase constructor. |
|
29 // ----------------------------------------------------------------------------- |
|
30 // |
|
31 CMusCallStatusMonitor* CMusCallStatusMonitor::NewL( |
|
32 const RMobileCall& aCall, |
|
33 MMusTsyPropertyObserver& aObserver, |
|
34 MMusCallStateObserver& aCallStateObserver ) |
|
35 { |
|
36 MUS_LOG( "mus: [MUSAO] -> CMusCallStatusMonitor::NewL" ) |
|
37 CMusCallStatusMonitor* self = |
|
38 new( ELeave )CMusCallStatusMonitor( aCall, aObserver, aCallStateObserver ); |
|
39 CleanupStack::PushL( self ); |
|
40 self->ConstructL(); |
|
41 CleanupStack::Pop( self ); |
|
42 MUS_LOG( "mus: [MUSAO] <- CMusCallStatusMonitor::NewL" ) |
|
43 return self; |
|
44 } |
|
45 |
|
46 |
|
47 // ----------------------------------------------------------------------------- |
|
48 // C++ destructor. |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 CMusCallStatusMonitor::~CMusCallStatusMonitor() |
|
52 { |
|
53 MUS_LOG( "mus: [MUSAO] -> CMusCallStatusMonitor::~CMusCallStatusMonitor" ) |
|
54 Cancel(); |
|
55 MUS_LOG( "mus: [MUSAO] <- CMusCallStatusMonitor::~CMusCallStatusMonitor" ) |
|
56 } |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // Symbian second-phase constructor. |
|
60 // ----------------------------------------------------------------------------- |
|
61 // |
|
62 void CMusCallStatusMonitor::ConstructL() |
|
63 { |
|
64 MUS_LOG( "mus: [MUSAO] -> CMusCallStatusMonitor::ConstructL" ) |
|
65 CActiveScheduler::Add( this ); |
|
66 User::LeaveIfError( iCall.GetMobileCallStatus(iCallStatus) ); |
|
67 CheckStateL(); |
|
68 iCall.NotifyMobileCallStatusChange( iStatus, iCallStatus ); |
|
69 SetActive(); |
|
70 MUS_LOG( "mus: [MUSAO] <- CMusCallStatusMonitor::ConstructL" ) |
|
71 } |
|
72 |
|
73 // ----------------------------------------------------------------------------- |
|
74 // C++ constructor. |
|
75 // ----------------------------------------------------------------------------- |
|
76 // |
|
77 CMusCallStatusMonitor::CMusCallStatusMonitor( |
|
78 const RMobileCall& aCall, |
|
79 MMusTsyPropertyObserver& aObserver, |
|
80 MMusCallStateObserver& aCallStateObserver ) |
|
81 : CMusCallMonitorBase( aCall, aObserver, aCallStateObserver ) |
|
82 { |
|
83 } |
|
84 |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CMusCallStatusMonitor::RunL() |
|
88 // Implemented for CActive.It will be called any NotifyMobileLineStatusChange |
|
89 // Event happens. |
|
90 // ----------------------------------------------------------------------------- |
|
91 // |
|
92 void CMusCallStatusMonitor::RunL() |
|
93 { |
|
94 MUS_LOG( "mus: [MUSAO] -> CMusCallStatusMonitor::RunL" ) |
|
95 iCall.NotifyMobileCallStatusChange( iStatus, iCallStatus ); |
|
96 SetActive(); |
|
97 CheckStateL(); |
|
98 MUS_LOG( "mus: [MUSAO] <- CMusCallStatusMonitor::RunL" ) |
|
99 } |
|
100 |
|
101 |
|
102 // ----------------------------------------------------------------------------- |
|
103 // CMusCallStatusMonitor::DoCancel() |
|
104 // Implemented for CActive. |
|
105 // Will be called when Cancel() method is called. |
|
106 // ----------------------------------------------------------------------------- |
|
107 // |
|
108 void CMusCallStatusMonitor::DoCancel() |
|
109 { |
|
110 MUS_LOG( "mus: [MUSAO] -> CMusCallStatusMonitor::DoCancel" ) |
|
111 iCall.CancelAsyncRequest( EMobileCallNotifyMobileCallStatusChange ); |
|
112 MUS_LOG( "mus: [MUSAO] <- CMusCallStatusMonitor::DoCancel" ) |
|
113 } |
|
114 |
|
115 |
|
116 // ----------------------------------------------------------------------------- |
|
117 // CMusCallStatusMonitor::SetIntialStateL() |
|
118 // Sets the Call State to Property |
|
119 // ----------------------------------------------------------------------------- |
|
120 // |
|
121 |
|
122 void CMusCallStatusMonitor::CheckStateL() |
|
123 { |
|
124 MUS_LOG( "mus: [MUSAO] -> CMusCallStatusMonitor::CheckStateL" ) |
|
125 MUS_LOG1( "mus: [MUSAO] Call->iCallStatus = %d", iCallStatus ) |
|
126 switch ( iCallStatus ) |
|
127 { |
|
128 case RMobileCall::EStatusConnected: |
|
129 SetStateL( NMusSessionInformationApi::ECallConnected ); |
|
130 break; |
|
131 case RMobileCall::EStatusDisconnecting: |
|
132 case RMobileCall::EStatusDisconnectingWithInband: |
|
133 SetStateL( NMusSessionInformationApi::ENoCall ); |
|
134 // The following callback causes self deletion: |
|
135 NotifyCallStateChanged( NMusSessionInformationApi::ENoCall ); |
|
136 // Do not use the member variables after this point. |
|
137 break; |
|
138 case RMobileCall::EStatusHold: |
|
139 SetStateL( NMusSessionInformationApi::ECallHold ); |
|
140 break; |
|
141 default: |
|
142 break; // No actions |
|
143 } |
|
144 MUS_LOG( "mus: [MUSAO] <- CMusCallStatusMonitor::CheckStateL" ) |
|
145 } |
|
146 |
|
147 // End of file |
|
148 |
|
149 |