|
1 /* |
|
2 * Copyright (c) 2005-2007 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 that observes the status of the Kodiak PTT call |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "muspttcallmonitor.h" |
|
20 #include "muslogger.h" |
|
21 #include <e32property.h> |
|
22 |
|
23 |
|
24 // -------------------------------------------------------------------------- |
|
25 // Symbian two-phase constructor. |
|
26 // -------------------------------------------------------------------------- |
|
27 // |
|
28 CMusPttCallMonitor* CMusPttCallMonitor::NewL(MMusPttEventObserver& aObserver) |
|
29 { |
|
30 MUS_LOG( "mus: [MUSAO] -> CMusPttCallMonitor::NewL" ) |
|
31 CMusPttCallMonitor* self = new (ELeave) CMusPttCallMonitor(aObserver); |
|
32 CleanupStack::PushL( self ); |
|
33 self->ConstructL(); |
|
34 CleanupStack::Pop( self ); |
|
35 MUS_LOG( "mus: [MUSAO] <- CMusPttCallMonitor::NewL" ) |
|
36 return self; |
|
37 } |
|
38 |
|
39 |
|
40 // -------------------------------------------------------------------------- |
|
41 // C++ destructor. |
|
42 // -------------------------------------------------------------------------- |
|
43 // |
|
44 CMusPttCallMonitor::~CMusPttCallMonitor() |
|
45 { |
|
46 MUS_LOG( "mus: [MUSAO] -> CMusPttCallMonitor::~CMusPttCallMonitor" ) |
|
47 Cancel(); |
|
48 iPropertyEvent.Close(); |
|
49 MUS_LOG( "mus: [MUSAO] <- CMusPttCallMonitor::~CMusPttCallMonitor" ) |
|
50 } |
|
51 |
|
52 |
|
53 // -------------------------------------------------------------------------- |
|
54 // C++ constructor. |
|
55 // -------------------------------------------------------------------------- |
|
56 // |
|
57 CMusPttCallMonitor::CMusPttCallMonitor(MMusPttEventObserver& aObserver) |
|
58 :CActive( EPriorityNormal ),iObserver(aObserver) |
|
59 { |
|
60 |
|
61 } |
|
62 |
|
63 |
|
64 // -------------------------------------------------------------------------- |
|
65 // Symbian second-phase constructor. |
|
66 // -------------------------------------------------------------------------- |
|
67 // |
|
68 void CMusPttCallMonitor::ConstructL() |
|
69 { |
|
70 MUS_LOG( "mus: [MUSAO] -> CMusPttCallMonitor::ConstructL" ) |
|
71 CActiveScheduler::Add(this); |
|
72 |
|
73 User::LeaveIfError( iPropertyEvent.Attach( |
|
74 KPSUidCtsyCallInformation, |
|
75 KCTsyKodiakPtt) ); |
|
76 iPropertyEvent.Subscribe( iStatus ); |
|
77 SetActive(); |
|
78 |
|
79 MUS_LOG( "mus: [MUSAO] <- CMusPttCallMonitor::ConstructL" ) |
|
80 } |
|
81 |
|
82 // ----------------------------------------------------------------------------- |
|
83 // CMusPttCallMonitor::RunL() |
|
84 // ----------------------------------------------------------------------------- |
|
85 // |
|
86 void CMusPttCallMonitor::RunL() |
|
87 { |
|
88 MUS_LOG( "mus: [MUSAO] -> CMusPttCallMonitor::RunL" ) |
|
89 // resubscribe before processing new value to prevent missing updates |
|
90 |
|
91 iPropertyEvent.Subscribe( iStatus ); |
|
92 SetActive(); |
|
93 TInt val = KErrNone; |
|
94 User::LeaveIfError(iPropertyEvent.Get( val )); |
|
95 iObserver.PttCallEventOccuredL((TPSCTsyKodiakPtt&)val); |
|
96 |
|
97 MUS_LOG( "mus: [MUSAO] <- CMusPttCallMonitor::RunL" ) |
|
98 } |
|
99 |
|
100 |
|
101 // ----------------------------------------------------------------------------- |
|
102 // CMusPttCallMonitor::DoCancel() |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 void CMusPttCallMonitor::DoCancel() |
|
106 { |
|
107 MUS_LOG( "mus: [MUSAO] -> CMusPttCallMonitor::DoCancel" ) |
|
108 iPropertyEvent.Cancel(); |
|
109 MUS_LOG( "mus: [MUSAO] <- CMusPttCallMonitor::DoCancel" ) |
|
110 } |
|
111 |
|
112 |
|
113 // ----------------------------------------------------------------------------- |
|
114 // CMusPttCallMonitor::IsPTTCallExist() |
|
115 // ----------------------------------------------------------------------------- |
|
116 // |
|
117 TBool CMusPttCallMonitor::IsPTTCallExist() |
|
118 { |
|
119 MUS_LOG( "mus: [MUSAO] -> CMusPttCallMonitor::IsPTTCallExist" ) |
|
120 |
|
121 TInt val = KErrNone; |
|
122 TInt ret = iPropertyEvent.Get( val ); |
|
123 MUS_LOG1( "mus: [MUSAO] iPropertyEvent.Get( val ) returns: %d",ret ) |
|
124 MUS_LOG1( "mus: [MUSAO] <- CMusPttCallMonitor::IsPTTCallExist = %d",val ) |
|
125 return ( val==EPSCTsyKodiakPttActive ) ? ETrue : EFalse; |
|
126 } |
|
127 |
|
128 // ----------------------------------------------------------------------------- |
|
129 // CMusCallEventMonitor::RunError( TInt aError ) |
|
130 // Implemented for CActive. |
|
131 // Will be called automatically by framework when RunL Leaves. |
|
132 // ----------------------------------------------------------------------------- |
|
133 // |
|
134 |
|
135 TInt CMusPttCallMonitor::RunError( TInt aError ) |
|
136 { |
|
137 MUS_LOG1( "mus: [MUSAO] -> CMusCallEventMonitor::RunError, aError %d", aError ) |
|
138 aError = KErrNone; // just to avoid warnings. |
|
139 MUS_LOG( "mus: [MUSAO] <- CMusCallEventMonitor::RunError" ) |
|
140 return aError; |
|
141 } |
|
142 |
|
143 |
|
144 |
|
145 //End of File |