37
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-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: This module contains the implementation of CPEGsmAudioData class
|
|
15 |
* member functions
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
#include "cpeaudiodtmftoneplayer.h"
|
|
22 |
#include "cpeaudiofactory.h"
|
|
23 |
#include "cpeaudioinbandtoneplayer.h"
|
|
24 |
#include "cpegsmaudiodata.h"
|
|
25 |
#include <ccpdefs.h>
|
|
26 |
#include <mpeclientinformation.h>
|
|
27 |
#include <mpedatastore.h>
|
|
28 |
#include <mpephonemodelinternal.h>
|
|
29 |
#include <talogger.h>
|
|
30 |
|
|
31 |
// EXTERNAL DATA STRUCTURES
|
|
32 |
// None.
|
|
33 |
|
|
34 |
// EXTERNAL FUNCTION PROTOTYPES
|
|
35 |
// None.
|
|
36 |
|
|
37 |
// CONSTANTS
|
|
38 |
// None.
|
|
39 |
|
|
40 |
// MACROS
|
|
41 |
// None.
|
|
42 |
|
|
43 |
// LOCAL CONSTANTS AND MACROS
|
|
44 |
// None.
|
|
45 |
|
|
46 |
// MODULE DATA STRUCTURES
|
|
47 |
// None.
|
|
48 |
|
|
49 |
// LOCAL FUNCTION PROTOTYPES
|
|
50 |
// None.
|
|
51 |
|
|
52 |
// FORWARD DECLARATIONS
|
|
53 |
// None.
|
|
54 |
|
|
55 |
// ==================== LOCAL FUNCTIONS ====================
|
|
56 |
// None.
|
|
57 |
|
|
58 |
// ================= MEMBER FUNCTIONS =======================
|
|
59 |
|
|
60 |
// -----------------------------------------------------------------------------
|
|
61 |
// CPEGsmAudioData::CPEGsmAudioData
|
|
62 |
// C++ default constructor can NOT contain any code, that
|
|
63 |
// might leave.
|
|
64 |
// -----------------------------------------------------------------------------
|
|
65 |
//
|
|
66 |
CPEGsmAudioData::CPEGsmAudioData
|
|
67 |
(
|
|
68 |
MPEPhoneModelInternal& aPhoneModel,
|
|
69 |
RFs& aFsSession
|
|
70 |
) : CPEAudioData( aPhoneModel ),
|
|
71 |
iFsSession( aFsSession )
|
|
72 |
{
|
|
73 |
}
|
|
74 |
|
|
75 |
// -----------------------------------------------------------------------------
|
|
76 |
// CPEGsmAudioData::ConstructL
|
|
77 |
// Symbian 2nd phase constructor can leave.
|
|
78 |
// -----------------------------------------------------------------------------
|
|
79 |
//
|
|
80 |
void CPEGsmAudioData::ConstructL( CPEAudioFactory& aAudioFactory )
|
|
81 |
{
|
|
82 |
CPEAudioData::ConstructL( aAudioFactory );
|
|
83 |
|
|
84 |
iInbandTonePlayer =
|
|
85 |
CPEAudioInbandTonePlayer::NewL( *this, iFsSession, aAudioFactory );
|
|
86 |
TInt volume = iPhoneModel.DataStore()->AudioVolume();
|
|
87 |
iInbandTonePlayer->SetVolume( volume );
|
|
88 |
|
|
89 |
iDtmfTonePlayer = CPEAudioDtmfTonePlayer::NewL();
|
|
90 |
}
|
|
91 |
|
|
92 |
// -----------------------------------------------------------------------------
|
|
93 |
// CPEGsmAudioData::NewL
|
|
94 |
// Two-phased constructor.
|
|
95 |
// -----------------------------------------------------------------------------
|
|
96 |
//
|
|
97 |
EXPORT_C CPEGsmAudioData* CPEGsmAudioData::NewL
|
|
98 |
(
|
|
99 |
MPEPhoneModelInternal& aPhoneModel,
|
|
100 |
RFs& aFsSession
|
|
101 |
)
|
|
102 |
{
|
|
103 |
CPEGsmAudioData* self = new ( ELeave )
|
|
104 |
CPEGsmAudioData ( aPhoneModel, aFsSession );
|
|
105 |
CleanupStack::PushL( self );
|
|
106 |
|
|
107 |
CPEAudioFactory* factory = CPEAudioFactory::NewLC();
|
|
108 |
self->ConstructL(*factory);
|
|
109 |
CleanupStack::PopAndDestroy( factory );
|
|
110 |
|
|
111 |
CleanupStack::Pop( self );
|
|
112 |
return self;
|
|
113 |
}
|
|
114 |
|
|
115 |
// -----------------------------------------------------------------------------
|
|
116 |
// CPEGsmAudioData::NewL
|
|
117 |
// Two-phased constructor for testing purposes.
|
|
118 |
// -----------------------------------------------------------------------------
|
|
119 |
//
|
|
120 |
EXPORT_C CPEGsmAudioData* CPEGsmAudioData::NewL
|
|
121 |
(
|
|
122 |
MPEPhoneModelInternal& aPhoneModel,
|
|
123 |
RFs& aFsSession,
|
|
124 |
CPEAudioFactory& aAudioFactory
|
|
125 |
)
|
|
126 |
{
|
|
127 |
CPEGsmAudioData* self = new ( ELeave )
|
|
128 |
CPEGsmAudioData ( aPhoneModel, aFsSession );
|
|
129 |
CleanupStack::PushL( self );
|
|
130 |
|
|
131 |
self->ConstructL(aAudioFactory);
|
|
132 |
CleanupStack::Pop( self );
|
|
133 |
return self;
|
|
134 |
}
|
|
135 |
|
|
136 |
// Destructor
|
|
137 |
EXPORT_C CPEGsmAudioData::~CPEGsmAudioData
|
|
138 |
(
|
|
139 |
// None.
|
|
140 |
)
|
|
141 |
{
|
|
142 |
delete iDtmfTonePlayer;
|
|
143 |
delete iInbandTonePlayer;
|
|
144 |
}
|
|
145 |
|
|
146 |
// -----------------------------------------------------------------------------
|
|
147 |
// CPEGsmAudioData::PlayDtmfTone
|
|
148 |
// Starts to play the given tone from dtmf player.
|
|
149 |
// (other items were commented in a header).
|
|
150 |
// -----------------------------------------------------------------------------
|
|
151 |
//
|
|
152 |
EXPORT_C void CPEGsmAudioData::PlayDtmfTone
|
|
153 |
(
|
|
154 |
const TChar& aTone //DTMF tone to play
|
|
155 |
) const
|
|
156 |
{
|
|
157 |
TInt volume; //DTMF tone volume
|
|
158 |
volume = iPhoneModel.DataStore()->KeypadVolume();
|
|
159 |
|
|
160 |
TEFLOGSTRING3( KTAREQIN,
|
|
161 |
"AUD CPEGsmAudioData::PlayDtmfTone, aTone = %s, volume = %d",
|
|
162 |
&aTone,
|
|
163 |
volume );
|
|
164 |
|
|
165 |
iDtmfTonePlayer->SetVolume( volume );
|
|
166 |
iDtmfTonePlayer->PlayDtmfTone( aTone );
|
|
167 |
}
|
|
168 |
|
|
169 |
// -----------------------------------------------------------------------------
|
|
170 |
// CPEGsmAudioData::StopDtmfTonePlay
|
|
171 |
// Stops the playing of dtmf tone.
|
|
172 |
// (other items were commented in a header).
|
|
173 |
// -----------------------------------------------------------------------------
|
|
174 |
//
|
|
175 |
EXPORT_C void CPEGsmAudioData::StopDtmfTonePlay
|
|
176 |
(
|
|
177 |
)
|
|
178 |
{
|
|
179 |
TEFLOGSTRING( KTAREQIN, "AUD CPEGsmAudioData::StopDtmfTonePlay" );
|
|
180 |
iDtmfTonePlayer->Cancel();
|
|
181 |
}
|
|
182 |
|
|
183 |
// -----------------------------------------------------------------------------
|
|
184 |
// CPEGsmAudioData::StopInbandTonePlay
|
|
185 |
// Stops the playing of inband tone.
|
|
186 |
// (other items were commented in a header).
|
|
187 |
// -----------------------------------------------------------------------------
|
|
188 |
//
|
|
189 |
EXPORT_C void CPEGsmAudioData::StopInbandTonePlay
|
|
190 |
(
|
|
191 |
)
|
|
192 |
{
|
|
193 |
TEFLOGSTRING( KTAREQIN, "AUD CPEGsmAudioData::StopInbandTonePlay" );
|
|
194 |
iInbandTonePlayer->Cancel();
|
|
195 |
}
|
|
196 |
|
|
197 |
// -----------------------------------------------------------------------------
|
|
198 |
// CPEGsmAudioData::PlayInbandTone
|
|
199 |
// Starts to play the given tone from inband player.
|
|
200 |
// -----------------------------------------------------------------------------
|
|
201 |
//
|
|
202 |
|
|
203 |
EXPORT_C void CPEGsmAudioData::PlayInbandTone()
|
|
204 |
{
|
|
205 |
TCCPTone tone = iPhoneModel.DataStore()->InbandTone();
|
|
206 |
|
|
207 |
TEFLOGSTRING2( KTAREQIN,
|
|
208 |
"AUD CPEGsmAudioData::PlayInbandTone, tone = %d",
|
|
209 |
tone );
|
|
210 |
iInbandTonePlayer->PlayInbandTone( tone );
|
|
211 |
}
|
|
212 |
|
|
213 |
// -----------------------------------------------------------------------------
|
|
214 |
// CPEGsmAudioData::HandleDtmfEvent
|
|
215 |
// From MCCEDtmfObserver.
|
|
216 |
// All the occurred DTMF events are notified through this interface.
|
|
217 |
// -----------------------------------------------------------------------------
|
|
218 |
//
|
|
219 |
EXPORT_C void CPEGsmAudioData::HandleDTMFEvent( const MCCEDtmfObserver::TCCEDtmfEvent aEvent,
|
|
220 |
const TInt aError,
|
|
221 |
const TChar aTone )
|
|
222 |
{
|
|
223 |
TEFLOGSTRING3(
|
|
224 |
KTAMESIN,
|
|
225 |
"AUD CPEGsmAudioData::HandleDtmfEvent: aEvent %d, aError %d",
|
|
226 |
aEvent,
|
|
227 |
aError );
|
|
228 |
|
|
229 |
if( aError == KErrNone )
|
|
230 |
{
|
|
231 |
switch( aEvent )
|
|
232 |
{
|
|
233 |
case ECCEDtmfManualStart:
|
|
234 |
case ECCEDtmfSequenceStart:
|
|
235 |
if ( DtmfLocalPlayAllowed() )
|
|
236 |
{
|
|
237 |
TEFLOGSTRING( KTAINT, "AUD CPEGsmAudioData::HandleDTMFEvent: PlayDtmfTone" );
|
|
238 |
PlayDtmfTone( aTone );
|
|
239 |
}
|
|
240 |
else
|
|
241 |
{
|
|
242 |
TEFLOGSTRING( KTAERROR, "AUD CPEGSMAUDIODATA::HANDLEDTMFEVENT ! LOCAL PLAY NOT ALLOWED" );
|
|
243 |
}
|
|
244 |
|
|
245 |
break;
|
|
246 |
|
|
247 |
case ECCEDtmfManualStop:
|
|
248 |
case ECCEDtmfSequenceStop:
|
|
249 |
case ECCEDtmfManualAbort:
|
|
250 |
case ECCEDtmfSequenceAbort:
|
|
251 |
case ECCEDtmfStopInDtmfString:
|
|
252 |
case ECCEDtmfStringSendingCompleted:
|
|
253 |
default:
|
|
254 |
TEFLOGSTRING( KTAINT, "AUD CPEGsmAudioData::HandleDTMFEvent: StopDtmfTonePlay" );
|
|
255 |
//Stop tone playing
|
|
256 |
StopDtmfTonePlay();
|
|
257 |
break;
|
|
258 |
}
|
|
259 |
}
|
|
260 |
else
|
|
261 |
{
|
|
262 |
TEFLOGSTRING( KTAINT, "AUD CPEGsmAudioData::HandleDTMFEvent: Error case" );
|
|
263 |
//Stop tone playing
|
|
264 |
StopDtmfTonePlay();
|
|
265 |
}
|
|
266 |
}
|
|
267 |
|
|
268 |
// -----------------------------------------------------------------------------
|
|
269 |
// CPEGsmAudioData::DtmfLocalPlayAllowed
|
|
270 |
// Checks if a DTMF tone may be played locally
|
|
271 |
// -----------------------------------------------------------------------------
|
|
272 |
//
|
|
273 |
TBool CPEGsmAudioData::DtmfLocalPlayAllowed() const
|
|
274 |
{
|
|
275 |
TBool localPlayAllowed( ETrue );
|
|
276 |
|
|
277 |
// Check if dtmf string sending was requested by user
|
|
278 |
if ( iPhoneModel.DataStore()->DtmfString() == KNullDesC )
|
|
279 |
{
|
|
280 |
// No dtmf string was defined - assuming dtmf string sending was initiated
|
|
281 |
// by third party. Proceed to check if a connected SAT originated call exists
|
|
282 |
for( TInt callId = 0; callId < KPEMaximumNumberOfVoiceCalls; callId++ )
|
|
283 |
{
|
|
284 |
if( iPhoneModel.DataStore()->CallOrigin( callId ) == EPECallOriginSAT
|
|
285 |
&& iPhoneModel.DataStore()->CallState( callId ) == EPEStateConnected )
|
|
286 |
{
|
|
287 |
// SAT call is in connected state - prevent dtmf local play
|
|
288 |
localPlayAllowed = EFalse;
|
|
289 |
break;
|
|
290 |
}
|
|
291 |
}
|
|
292 |
}
|
|
293 |
|
|
294 |
return localPlayAllowed;
|
|
295 |
}
|
|
296 |
|
|
297 |
// -----------------------------------------------------------------------------
|
|
298 |
// CPEGsmAudioData::DoHandleVolumeChange
|
|
299 |
// -----------------------------------------------------------------------------
|
|
300 |
//
|
|
301 |
void CPEGsmAudioData::DoHandleVolumeChange( TInt aVolume, TBool aSendMsg)
|
|
302 |
|
|
303 |
{
|
|
304 |
iInbandTonePlayer->SetVolume( aVolume );
|
|
305 |
CPEAudioData::DoHandleVolumeChange(aVolume , aSendMsg);
|
|
306 |
}
|
|
307 |
|
|
308 |
// ================= OTHER EXPORTED FUNCTIONS ===============================
|
|
309 |
// None
|
|
310 |
|
|
311 |
// End of File
|