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