33
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2005 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: Receives call handling related key presses from accessories and
|
|
15 |
* executes them.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
// INCLUDE FILES
|
|
22 |
#include "phonehandlercontrol.h"
|
|
23 |
#include "phonehandlerservice.h"
|
|
24 |
#include "phonehandleranswercall.h"
|
|
25 |
#include "phonehandlerendcall.h"
|
|
26 |
#include "phonehandlerdialcall.h"
|
|
27 |
#include "phonehandlervoicedial.h"
|
|
28 |
#include "phonehandlerredial.h"
|
|
29 |
#include "phonehandlermultipartycall.h"
|
|
30 |
#include "phonehandlerdtmf.h"
|
|
31 |
#include "phonehandleractive.h"
|
|
32 |
#include "phonehandlerresponse.h"
|
|
33 |
#include "phonehandlercallstate.h"
|
|
34 |
#include "phonehandlerdebug.h"
|
|
35 |
#include <remconinterfaceselector.h>
|
|
36 |
#include <RemConCallHandlingTarget.h>
|
|
37 |
#include <ctsydomainpskeys.h>
|
|
38 |
|
|
39 |
#if 0
|
|
40 |
#include <voiceuidomainpskeys.h>
|
|
41 |
#endif
|
|
42 |
|
|
43 |
#include <connect/sbdefs.h>
|
|
44 |
|
|
45 |
// EXTERNAL DATA STRUCTURES
|
|
46 |
|
|
47 |
// EXTERNAL FUNCTION PROTOTYPES
|
|
48 |
|
|
49 |
// CONSTANTS
|
|
50 |
|
|
51 |
// MACROS
|
|
52 |
|
|
53 |
// LOCAL CONSTANTS AND MACROS
|
|
54 |
|
|
55 |
// MODULE DATA STRUCTURES
|
|
56 |
|
|
57 |
// LOCAL FUNCTION PROTOTYPES
|
|
58 |
const TInt KMultipartyCallMinParam = 1;
|
|
59 |
const TInt KMultipartyCallMaxParam = 2;
|
|
60 |
|
|
61 |
// FORWARD DECLARATIONS
|
|
62 |
|
|
63 |
// ============================= LOCAL FUNCTIONS ===============================
|
|
64 |
|
|
65 |
|
|
66 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
67 |
|
|
68 |
// -----------------------------------------------------------------------------
|
|
69 |
// CPhoneHandlerControl::CPhoneHandlerControl
|
|
70 |
// C++ default constructor can NOT contain any code, that
|
|
71 |
// might leave.
|
|
72 |
// -----------------------------------------------------------------------------
|
|
73 |
//
|
|
74 |
CPhoneHandlerControl::CPhoneHandlerControl()
|
|
75 |
: iPrevState( EPSCTsyCallStateNone )
|
|
76 |
{
|
|
77 |
}
|
|
78 |
|
|
79 |
// -----------------------------------------------------------------------------
|
|
80 |
// CPhoneHandlerControl::ConstructL
|
|
81 |
// Symbian 2nd phase constructor can leave.
|
|
82 |
// -----------------------------------------------------------------------------
|
|
83 |
//
|
|
84 |
void CPhoneHandlerControl::ConstructL( CRemConInterfaceSelector* aIfSelector )
|
|
85 |
{
|
|
86 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() start" );
|
|
87 |
|
|
88 |
if( !aIfSelector )
|
|
89 |
{
|
|
90 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() Create connection to RemCon." );
|
|
91 |
|
|
92 |
// Target connection to RemCon FW hasn't been done.
|
|
93 |
iInterfaceSelector = CRemConInterfaceSelector::NewL();
|
|
94 |
iTarget = CRemConCallHandlingTarget::NewL( *iInterfaceSelector, *this );
|
|
95 |
iInterfaceSelector->OpenTargetL();
|
|
96 |
}
|
|
97 |
else
|
|
98 |
{
|
|
99 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() Don't create connection to RemCon." );
|
|
100 |
|
|
101 |
// Connection to RemCon FW as target has already been done in a process.
|
|
102 |
iTarget = CRemConCallHandlingTarget::NewL( *aIfSelector, *this );
|
|
103 |
}
|
|
104 |
|
|
105 |
iResponse = CPhoneHandlerResponse::NewL( *this );
|
|
106 |
iCallStateObserver = CPhoneHandlerCallState::NewL( *this );
|
|
107 |
|
|
108 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() end" );
|
|
109 |
}
|
|
110 |
|
|
111 |
// -----------------------------------------------------------------------------
|
|
112 |
// CPhoneHandlerControl::NewL
|
|
113 |
// Two-phased constructor.
|
|
114 |
// -----------------------------------------------------------------------------
|
|
115 |
//
|
|
116 |
CPhoneHandlerControl* CPhoneHandlerControl::NewL(
|
|
117 |
CRemConInterfaceSelector* aIfSelector )
|
|
118 |
{
|
|
119 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NewL() start" );
|
|
120 |
|
|
121 |
CPhoneHandlerControl* self = new ( ELeave ) CPhoneHandlerControl();
|
|
122 |
|
|
123 |
CleanupStack::PushL( self );
|
|
124 |
self->ConstructL( aIfSelector );
|
|
125 |
CleanupStack::Pop( self );
|
|
126 |
|
|
127 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NewL() end" );
|
|
128 |
|
|
129 |
return self;
|
|
130 |
}
|
|
131 |
|
|
132 |
// Destructor
|
|
133 |
CPhoneHandlerControl::~CPhoneHandlerControl()
|
|
134 |
{
|
|
135 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::~CPhoneHandlerControl() start" );
|
53
|
136 |
|
|
137 |
delete iInterfaceSelector; // deletes iTarget
|
|
138 |
delete iResponse;
|
|
139 |
delete iCallStateObserver;
|
33
|
140 |
|
|
141 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::~CPhoneHandlerControl() end" );
|
|
142 |
}
|
|
143 |
|
|
144 |
// -----------------------------------------------------------------------------
|
|
145 |
// CPhoneHandlerControl::TelephoneNumber
|
|
146 |
// Provides phone number for service.
|
|
147 |
// (other items were commented in a header).
|
|
148 |
// -----------------------------------------------------------------------------
|
|
149 |
//
|
|
150 |
const TPhCltTelephoneNumber&
|
|
151 |
CPhoneHandlerControl::TelephoneNumber() const
|
|
152 |
{
|
|
153 |
return iTelNumber;
|
|
154 |
}
|
|
155 |
|
|
156 |
// -----------------------------------------------------------------------------
|
|
157 |
// CPhoneHandlerControl::VoiceDialStatus
|
|
158 |
// Provides voice dial status for service.
|
|
159 |
// (other items were commented in a header).
|
|
160 |
// -----------------------------------------------------------------------------
|
|
161 |
//
|
|
162 |
const TBool&
|
|
163 |
CPhoneHandlerControl::VoiceDialStatus() const
|
|
164 |
{
|
|
165 |
return iActivate;
|
|
166 |
}
|
|
167 |
|
|
168 |
// -----------------------------------------------------------------------------
|
|
169 |
// CPhoneHandlerControl::ChldCommand
|
|
170 |
// Provides CHLD command for service.
|
|
171 |
// (other items were commented in a header).
|
|
172 |
// -----------------------------------------------------------------------------
|
|
173 |
//
|
|
174 |
const TInt&
|
|
175 |
CPhoneHandlerControl::ChldCommand() const
|
|
176 |
{
|
|
177 |
return iChldCommand;
|
|
178 |
}
|
|
179 |
|
|
180 |
// -----------------------------------------------------------------------------
|
|
181 |
// CPhoneHandlerControl::ChldCallNumber
|
|
182 |
// Provides CHLD call number for service.
|
|
183 |
// (other items were commented in a header).
|
|
184 |
// -----------------------------------------------------------------------------
|
|
185 |
//
|
|
186 |
const TInt&
|
|
187 |
CPhoneHandlerControl::ChldCallNumber() const
|
|
188 |
{
|
|
189 |
return iChldCallNumber;
|
|
190 |
}
|
|
191 |
|
|
192 |
// -----------------------------------------------------------------------------
|
|
193 |
// CPhoneHandlerControl::Tone
|
|
194 |
// Provides DTMF tone for service.
|
|
195 |
// (other items were commented in a header).
|
|
196 |
// -----------------------------------------------------------------------------
|
|
197 |
//
|
|
198 |
const TChar&
|
|
199 |
CPhoneHandlerControl::Tone() const
|
|
200 |
{
|
|
201 |
return iChar;
|
|
202 |
}
|
|
203 |
|
|
204 |
// -----------------------------------------------------------------------------
|
|
205 |
// CPhoneHandlerControl::CommandInitiator
|
|
206 |
// Provides API that service uses to send reponse to command.
|
|
207 |
// (other items were commented in a header).
|
|
208 |
// -----------------------------------------------------------------------------
|
|
209 |
//
|
|
210 |
CRemConCallHandlingTarget&
|
|
211 |
CPhoneHandlerControl::CommandInitiator() const
|
|
212 |
{
|
|
213 |
return *iTarget;
|
|
214 |
}
|
|
215 |
|
|
216 |
// -----------------------------------------------------------------------------
|
|
217 |
// CPhoneHandlerControl::NotifyCallState
|
|
218 |
// (other items were commented in a header).
|
|
219 |
// -----------------------------------------------------------------------------
|
|
220 |
//
|
|
221 |
void CPhoneHandlerControl::NotifyCallState( const TInt aState )
|
|
222 |
{
|
|
223 |
COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState() aState=%d", aState );
|
|
224 |
|
|
225 |
if( aState == EPSCTsyCallStateConnected && iPrevState != EPSCTsyCallStateHold )
|
|
226 |
{
|
|
227 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): iActiveCalls++" );
|
|
228 |
|
|
229 |
iActiveCalls++;
|
|
230 |
}
|
|
231 |
else if( aState == EPSCTsyCallStateDisconnecting &&
|
|
232 |
( iPrevState == EPSCTsyCallStateConnected || iPrevState == EPSCTsyCallStateHold ))
|
|
233 |
{
|
|
234 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): iActiveCalls--" );
|
|
235 |
|
|
236 |
iActiveCalls--;
|
|
237 |
}
|
|
238 |
else if( aState == EPSCTsyCallStateNone )
|
|
239 |
{
|
|
240 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): iActiveCalls = 0" );
|
|
241 |
iActiveCalls = 0;
|
|
242 |
}
|
|
243 |
|
|
244 |
iPrevState = aState;
|
|
245 |
COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState() iActiveCalls=%d", iActiveCalls );
|
|
246 |
}
|
|
247 |
|
|
248 |
// -----------------------------------------------------------------------------
|
|
249 |
// CPhoneHandlerControl::AnswerCall
|
|
250 |
// (other items were commented in a header).
|
|
251 |
// -----------------------------------------------------------------------------
|
|
252 |
//
|
|
253 |
void CPhoneHandlerControl::AnswerCall()
|
|
254 |
{
|
|
255 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerCall() start" );
|
|
256 |
|
|
257 |
StartProcessing( ERemConExtAnswerCall );
|
|
258 |
|
|
259 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerCall() end" );
|
|
260 |
}
|
|
261 |
|
|
262 |
// -----------------------------------------------------------------------------
|
|
263 |
// CPhoneHandlerControl::EndCall
|
|
264 |
// (other items were commented in a header).
|
|
265 |
// -----------------------------------------------------------------------------
|
|
266 |
//
|
|
267 |
void CPhoneHandlerControl::EndCall()
|
|
268 |
{
|
|
269 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::EndCall() start" );
|
|
270 |
|
|
271 |
StartProcessing( ERemConExtEndCall );
|
|
272 |
|
|
273 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::EndCall() end" );
|
|
274 |
}
|
|
275 |
|
|
276 |
// -----------------------------------------------------------------------------
|
|
277 |
// CPhoneHandlerControl::AnswerEndCall
|
|
278 |
// (other items were commented in a header).
|
|
279 |
// -----------------------------------------------------------------------------
|
|
280 |
//
|
|
281 |
void CPhoneHandlerControl::AnswerEndCall()
|
|
282 |
{
|
|
283 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerEndCall() start" );
|
|
284 |
|
|
285 |
StartProcessing( ERemConExtAnswerEnd );
|
|
286 |
|
|
287 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerEndCall() end" );
|
|
288 |
}
|
|
289 |
|
|
290 |
// -----------------------------------------------------------------------------
|
|
291 |
// CPhoneHandlerControl::VoiceDial
|
|
292 |
// (other items were commented in a header).
|
|
293 |
// -----------------------------------------------------------------------------
|
|
294 |
//
|
|
295 |
#if 0 // SCB CR EHSA-7APJWF: SIND subscribes to RemCon directly
|
|
296 |
void CPhoneHandlerControl::VoiceDial( const TBool aActivate )
|
|
297 |
{
|
|
298 |
COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial() aActivate=%d", aActivate );
|
|
299 |
|
|
300 |
TInt callState( EPSCTsyCallStateUninitialized );
|
|
301 |
iProperty.Get( KPSUidCtsyCallInformation, KCTsyCallState, callState );
|
|
302 |
|
|
303 |
COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() call state = %d", callState );
|
|
304 |
|
|
305 |
if( callState == EPSCTsyCallStateUninitialized ||
|
|
306 |
callState == EPSCTsyCallStateNone )
|
|
307 |
{
|
|
308 |
TInt voiceUiState( KVoiceUiIsClose );
|
|
309 |
iProperty.Get( KPSUidVoiceUiAccMonitor, KVoiceUiOpenKey, voiceUiState );
|
|
310 |
|
|
311 |
if( voiceUiState == KVoiceUiIsOpen )
|
|
312 |
{
|
|
313 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial() voice UI is open!" );
|
|
314 |
iProperty.Set( KPSUidVoiceUiAccMonitor , KVoiceUiAccessoryEvent, ERemConExtVoiceDial );
|
|
315 |
iResponse->SetResponse( ERemConExtVoiceDial, KErrNone );
|
|
316 |
iResponse->Process();
|
|
317 |
}
|
|
318 |
else
|
|
319 |
{
|
|
320 |
iActivate = aActivate;
|
|
321 |
StartProcessing( ERemConExtVoiceDial );
|
|
322 |
}
|
|
323 |
}
|
|
324 |
else
|
|
325 |
{
|
|
326 |
iResponse->SetResponse( ERemConExtVoiceDial, KErrNone );
|
|
327 |
iResponse->Process();
|
|
328 |
}
|
|
329 |
|
|
330 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial() end" );
|
|
331 |
}
|
|
332 |
#else
|
|
333 |
void CPhoneHandlerControl::VoiceDial( const TBool /*aActivate*/ )
|
|
334 |
{
|
|
335 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial()" );
|
|
336 |
|
|
337 |
iResponse->SetResponse( ERemConExtVoiceDial, KErrNone );
|
|
338 |
iResponse->Process();
|
|
339 |
|
|
340 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial() end" );
|
|
341 |
}
|
|
342 |
#endif
|
|
343 |
// -----------------------------------------------------------------------------
|
|
344 |
// CPhoneHandlerControl::LastNumberRedial
|
|
345 |
// (other items were commented in a header).
|
|
346 |
// -----------------------------------------------------------------------------
|
|
347 |
//
|
|
348 |
void CPhoneHandlerControl::LastNumberRedial( )
|
|
349 |
{
|
|
350 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::LastNumberRedial() start" );
|
|
351 |
|
|
352 |
StartProcessing( ERemConExtLastNumberRedial );
|
|
353 |
|
|
354 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::LastNumberRedial() end" );
|
|
355 |
}
|
|
356 |
|
|
357 |
// -----------------------------------------------------------------------------
|
|
358 |
// CPhoneHandlerControl::DialCall
|
|
359 |
// (other items were commented in a header).
|
|
360 |
// -----------------------------------------------------------------------------
|
|
361 |
//
|
|
362 |
void CPhoneHandlerControl::DialCall( const TDesC8& aTelNumber )
|
|
363 |
{
|
|
364 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::DialCall() start" );
|
|
365 |
|
|
366 |
// Check aTelNumber range
|
|
367 |
if( KPhCltTelephoneNumberLength < aTelNumber.Length() )
|
|
368 |
{
|
|
369 |
COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::DialCall() number value=%d too long", aTelNumber.Size() );
|
|
370 |
iResponse->SetResponse( ERemConExtDialCall, KErrArgument );
|
|
371 |
iResponse->Process();
|
|
372 |
return;
|
|
373 |
}
|
|
374 |
|
|
375 |
iTelNumber.Copy( aTelNumber );
|
|
376 |
|
|
377 |
StartProcessing( ERemConExtDialCall );
|
|
378 |
|
|
379 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::DialCall() end" );
|
|
380 |
}
|
|
381 |
|
|
382 |
// -----------------------------------------------------------------------------
|
|
383 |
// CPhoneHandlerControl::MultipartyCalling
|
|
384 |
// Method supports multiparty call handling according to BT handsfree profile
|
|
385 |
// (HFP) 1.5. BT HFP 1.5 defines contents of aData parameter as follows: 0, 1,
|
|
386 |
// 1<idx>, 2, 2<idx>, 3 and 4, where:
|
|
387 |
//
|
|
388 |
// 0 = Releases all held calls or sets User Determined User Busy (UDUB) for
|
|
389 |
// a waiting call.
|
|
390 |
// 1 = Releases all active calls (if any exist) and accepts the other
|
|
391 |
// (held or waiting) call.
|
|
392 |
// 1<idx> = Releases specified active call only (<idx> = digit from 1 to 9.
|
|
393 |
// Command is e.g. "11" ).
|
|
394 |
// 2 = Places all active calls (if any exist) on hold and accepts the other
|
|
395 |
// (held or waiting) call.
|
|
396 |
// 2<idx> = Request private consultation mode with specified call (<idx> =
|
|
397 |
// from 1 to 9. Command is e.g. "21" ).
|
|
398 |
// (Place all calls on hold EXCEPT the call indicated by <idx>.)
|
|
399 |
// 3 = Adds a held call to the conversation.
|
|
400 |
// 4 = Connects the two calls and disconnects the subscriber from both calls
|
|
401 |
// (Explicit Call Transfer). Support for this value and its associated
|
|
402 |
// functionality is optional for the HF.
|
|
403 |
//
|
|
404 |
// (other items were commented in a header).
|
|
405 |
// -----------------------------------------------------------------------------
|
|
406 |
//
|
|
407 |
void CPhoneHandlerControl::MultipartyCalling( const TDesC8& aData )
|
|
408 |
{
|
|
409 |
TBool error( EFalse );
|
|
410 |
iChldCommand = 0;
|
|
411 |
iChldCallNumber = 0;
|
|
412 |
TBuf8< KRemConExtParamMaxLength > buf( aData );
|
|
413 |
buf.Trim();
|
|
414 |
TInt length = buf.Length();
|
|
415 |
|
|
416 |
// Check invalid number of characters
|
|
417 |
if ( length < KMultipartyCallMinParam || length > KMultipartyCallMaxParam )
|
|
418 |
{
|
|
419 |
error = ETrue;
|
|
420 |
}
|
|
421 |
else
|
|
422 |
{
|
|
423 |
TLex8 param;
|
|
424 |
// Set command
|
|
425 |
param.Assign( buf.Mid( 0, 1 ) );
|
|
426 |
if( param.Val( iChldCommand ) != KErrNone )
|
|
427 |
{
|
|
428 |
error = ETrue;
|
|
429 |
}
|
|
430 |
else if ( length == KMultipartyCallMaxParam )
|
|
431 |
{
|
|
432 |
// Set call number
|
|
433 |
param.Assign( buf.Mid(1) );
|
|
434 |
if( param.Val( iChldCallNumber ) != KErrNone )
|
|
435 |
{
|
|
436 |
error = ETrue;
|
|
437 |
}
|
|
438 |
}
|
|
439 |
}
|
|
440 |
|
|
441 |
if( error )
|
|
442 |
{
|
|
443 |
// Invalid command
|
|
444 |
iResponse->SetResponse( ERemConExt3WaysCalling, KErrArgument );
|
|
445 |
iResponse->Process();
|
|
446 |
return;
|
|
447 |
}
|
|
448 |
|
|
449 |
COM_TRACE_2( "[PHONECMDHANDLER] CPhoneHandlerControl::MultipartyCalling() iChldCommand=%d, iChldCallNumber=%d", iChldCommand, iChldCallNumber );
|
|
450 |
|
|
451 |
StartProcessing( ERemConExt3WaysCalling );
|
|
452 |
|
|
453 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::MultipartyCalling() end" );
|
|
454 |
}
|
|
455 |
|
|
456 |
// -----------------------------------------------------------------------------
|
|
457 |
// CPhoneHandlerControl::GenerateDTMF
|
|
458 |
// (other items were commented in a header).
|
|
459 |
// -----------------------------------------------------------------------------
|
|
460 |
//
|
|
461 |
void CPhoneHandlerControl::GenerateDTMF( const TChar aChar )
|
|
462 |
{
|
|
463 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::GenerateDTMF() start" );
|
|
464 |
|
|
465 |
iChar = aChar;
|
|
466 |
|
|
467 |
StartProcessing( ERemConExtGenerateDTMF );
|
|
468 |
|
|
469 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::GenerateDTMF() end" );
|
|
470 |
}
|
|
471 |
|
|
472 |
// -----------------------------------------------------------------------------
|
|
473 |
// CPhoneHandlerControl::SpeedDial
|
|
474 |
// (other items were commented in a header).
|
|
475 |
// -----------------------------------------------------------------------------
|
|
476 |
//
|
|
477 |
void CPhoneHandlerControl::SpeedDial( const TInt /*aIndex*/ )
|
|
478 |
{
|
|
479 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::SpeedDial() - Not Supported" );
|
|
480 |
}
|
|
481 |
|
|
482 |
// -----------------------------------------------------------------------------
|
|
483 |
// CPhoneHandlerControl::StartProcessing
|
|
484 |
// Creates an object that executes call handling command received from
|
|
485 |
// accessory.
|
|
486 |
// (other items were commented in a header).
|
|
487 |
// -----------------------------------------------------------------------------
|
|
488 |
//
|
|
489 |
void CPhoneHandlerControl::StartProcessing(
|
|
490 |
const TRemConExtCallHandlingApiOperationId aOperation )
|
|
491 |
{
|
|
492 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::StartProcessing() start" );
|
|
493 |
|
|
494 |
// Create a service
|
|
495 |
MPhoneHandlerService* service = NULL;
|
|
496 |
TInt error( KErrNone );
|
|
497 |
TRAP( error, service = CreateServiceL( aOperation ) );
|
|
498 |
|
|
499 |
COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() returned %d", error );
|
|
500 |
|
|
501 |
if( error )
|
|
502 |
{
|
|
503 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::StartProcessing(): service wasn't created succesfully." );
|
|
504 |
|
|
505 |
// An error happened. Delete service, if it exists.
|
|
506 |
if( service )
|
|
507 |
{
|
|
508 |
service->Delete();
|
|
509 |
service = NULL;
|
|
510 |
}
|
|
511 |
|
|
512 |
iResponse->SetResponse( aOperation, error );
|
|
513 |
iResponse->Process();
|
|
514 |
return;
|
|
515 |
}
|
|
516 |
else
|
|
517 |
{
|
|
518 |
// start service
|
|
519 |
service->Process();
|
|
520 |
iSwitchCall = EFalse;
|
|
521 |
}
|
|
522 |
|
|
523 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::StartProcessing() end" );
|
|
524 |
}
|
|
525 |
|
|
526 |
// -----------------------------------------------------------------------------
|
|
527 |
// CPhoneHandlerControl::CreateServiceL
|
|
528 |
// (other items were commented in a header).
|
|
529 |
// -----------------------------------------------------------------------------
|
|
530 |
//
|
|
531 |
MPhoneHandlerService* CPhoneHandlerControl::
|
|
532 |
CreateServiceL( const TRemConExtCallHandlingApiOperationId aOperation )
|
|
533 |
{
|
|
534 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() start" );
|
|
535 |
|
|
536 |
MPhoneHandlerService* pService = NULL;
|
|
537 |
|
|
538 |
switch( aOperation )
|
|
539 |
{
|
|
540 |
case ERemConExtAnswerCall:
|
|
541 |
{
|
|
542 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtAnswerCall command" );
|
|
543 |
COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - iActiveCalls is %d", iActiveCalls );
|
|
544 |
|
|
545 |
/*
|
|
546 |
if( iActiveCalls > 0 )
|
|
547 |
{
|
|
548 |
// Multiparty call
|
|
549 |
iSwitchCall = ETrue;
|
|
550 |
pService = CPhoneHandlerMultipartyCall::NewL( *this );
|
|
551 |
}
|
|
552 |
else
|
|
553 |
{
|
|
554 |
// non-multiparty call
|
|
555 |
pService = CPhoneHandlerAnswerCall::NewL( *this );
|
|
556 |
}
|
|
557 |
*/
|
|
558 |
pService = CPhoneHandlerAnswerCall::NewL( *this );
|
|
559 |
|
|
560 |
break;
|
|
561 |
}
|
|
562 |
|
|
563 |
case ERemConExtEndCall:
|
|
564 |
{
|
|
565 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtEndCall command" );
|
|
566 |
|
|
567 |
pService = CPhoneHandlerEndCall::NewL( *this );
|
|
568 |
|
|
569 |
break;
|
|
570 |
}
|
|
571 |
|
|
572 |
case ERemConExtAnswerEnd:
|
|
573 |
{
|
|
574 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtAnswerEnd command" );
|
|
575 |
|
|
576 |
TInt callState( EPSCTsyCallStateUninitialized );
|
|
577 |
iProperty.Get( KPSUidCtsyCallInformation, KCTsyCallState, callState );
|
|
578 |
|
|
579 |
COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() call state = %d", callState );
|
|
580 |
|
|
581 |
if( callState != EPSCTsyCallStateUninitialized &&
|
|
582 |
callState != EPSCTsyCallStateNone &&
|
|
583 |
callState != EPSCTsyCallStateDisconnecting )
|
|
584 |
{
|
|
585 |
if( callState == EPSCTsyCallStateAlerting ||
|
|
586 |
callState == EPSCTsyCallStateDialling ||
|
|
587 |
callState == EPSCTsyCallStateAnswering ||
|
|
588 |
callState == EPSCTsyCallStateConnected ||
|
|
589 |
callState == EPSCTsyCallStateHold )
|
|
590 |
{
|
|
591 |
pService = CPhoneHandlerEndCall::NewL( *this,
|
|
592 |
aOperation );
|
|
593 |
}
|
|
594 |
// callState == EPSTelephonyCallStateRinging
|
|
595 |
else
|
|
596 |
{
|
|
597 |
COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() iActiveCalls = %d", iActiveCalls );
|
|
598 |
if( iActiveCalls > 0 )
|
|
599 |
{
|
|
600 |
// multicall case : End call that has existed longer.
|
|
601 |
// (From UI viewpoint ringing call is in waiting state.)
|
|
602 |
pService = CPhoneHandlerEndCall::NewL( *this,
|
|
603 |
aOperation );
|
|
604 |
if( callState == EPSCTsyCallStateRinging )
|
|
605 |
{
|
|
606 |
// In multiparty case the telephony key is not
|
|
607 |
// updated. The call amount is updated manually.
|
|
608 |
iActiveCalls--;
|
|
609 |
}
|
|
610 |
}
|
|
611 |
else
|
|
612 |
{
|
|
613 |
pService = CPhoneHandlerAnswerCall::NewL(
|
|
614 |
*this,
|
|
615 |
aOperation );
|
|
616 |
}
|
|
617 |
}
|
|
618 |
}
|
|
619 |
else
|
|
620 |
{
|
|
621 |
// Send / end button was pressed when there were not
|
|
622 |
// any calls active. Response has to be sent back to accessory
|
|
623 |
// at least for following reasons:
|
|
624 |
|
|
625 |
// 1. RemCon FW releases message related memory only when response
|
|
626 |
// is sent back to accessory.
|
|
627 |
|
|
628 |
// 2. BT accessory key press producing ERemConExtAnswerEnd
|
|
629 |
// operation has some other meaning than answer/end call
|
|
630 |
// and it's processed by proper client. However, there
|
|
631 |
// might be a situation where proper client isn't active
|
|
632 |
// and can't process command. In any case RemCon/BT accessory
|
|
633 |
// requires response to command. That's why PhoneCmdHandler
|
|
634 |
// sends reponse to command.
|
|
635 |
|
|
636 |
iResponse->SetResponse( aOperation, KErrNone );
|
|
637 |
pService = iResponse;
|
|
638 |
}
|
|
639 |
break;
|
|
640 |
}
|
|
641 |
|
|
642 |
case ERemConExtDialCall:
|
|
643 |
{
|
|
644 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtDialCall command" );
|
|
645 |
|
|
646 |
pService = CPhoneHandlerDialCall::NewL( *this );
|
|
647 |
break;
|
|
648 |
}
|
|
649 |
|
|
650 |
case ERemConExtVoiceDial:
|
|
651 |
{
|
|
652 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtVoiceDial command" );
|
|
653 |
|
|
654 |
pService = CPhoneHandlerVoiceDial::NewL( *this );
|
|
655 |
break;
|
|
656 |
}
|
|
657 |
|
|
658 |
case ERemConExtLastNumberRedial:
|
|
659 |
{
|
|
660 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtLastNumberRedial command" );
|
|
661 |
|
|
662 |
pService = CPhoneHandlerLastNumberRedial::NewL( *this );
|
|
663 |
break;
|
|
664 |
}
|
|
665 |
|
|
666 |
case ERemConExt3WaysCalling:
|
|
667 |
{
|
|
668 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExt3WaysCalling command" );
|
|
669 |
|
|
670 |
pService = CPhoneHandlerMultipartyCall::NewL( *this );
|
|
671 |
break;
|
|
672 |
}
|
|
673 |
|
|
674 |
case ERemConExtGenerateDTMF:
|
|
675 |
{
|
|
676 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtGenerateDTMF command" );
|
|
677 |
|
|
678 |
pService = CPhoneHandlerDTMF::NewL( *this );
|
|
679 |
break;
|
|
680 |
}
|
|
681 |
|
|
682 |
default:
|
|
683 |
{
|
|
684 |
COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() Unspecified state" );
|
|
685 |
break;
|
|
686 |
}
|
|
687 |
};
|
|
688 |
|
|
689 |
COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() end, %d", pService );
|
|
690 |
return pService;
|
|
691 |
}
|
|
692 |
|
|
693 |
// -----------------------------------------------------------------------------
|
|
694 |
// CPhoneHandlerControl::SwitchCall
|
|
695 |
// (other items were commented in a header).
|
|
696 |
// -----------------------------------------------------------------------------
|
|
697 |
//
|
|
698 |
TBool CPhoneHandlerControl::SwitchCall()
|
|
699 |
{
|
|
700 |
return iSwitchCall;
|
|
701 |
}
|
|
702 |
// ======================== OTHER EXPORTED FUNCTIONS ===========================
|
|
703 |
|
|
704 |
// End of File
|