|
1 /* |
|
2 * Copyright (c) 2009 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 the License "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: |
|
15 * |
|
16 */ |
|
17 |
|
18 // System includes |
|
19 #include <RemConCallHandlingTarget.h> |
|
20 #include <remconcoreapitarget.h> |
|
21 #include <remconinterfaceselector.h> |
|
22 |
|
23 // User includes |
|
24 #include "cradioenginelogger.h" |
|
25 #include "cradioremcontargetimp_stub.h" |
|
26 #include "mradiocontroleventobserver.h" |
|
27 #include "radioengineutils.h" |
|
28 |
|
29 #define STUB iRadioStubManager->iRemConTarget |
|
30 |
|
31 // Constants |
|
32 const TInt KVRVolumeTimerInitialDelay = 0; // Initial timer for headset volume up/down press event should expire immediately |
|
33 |
|
34 // ================= MEMBER FUNCTIONS ======================= |
|
35 |
|
36 // --------------------------------------------------------------------------- |
|
37 // |
|
38 // --------------------------------------------------------------------------- |
|
39 // |
|
40 CRadioRemConTargetImp::CRadioRemConTargetImp() |
|
41 { |
|
42 LOG_METHOD_AUTO; |
|
43 } |
|
44 |
|
45 // --------------------------------------------------------------------------- |
|
46 // |
|
47 // --------------------------------------------------------------------------- |
|
48 // |
|
49 void CRadioRemConTargetImp::ConstructL() |
|
50 { |
|
51 LOG_METHOD_AUTO;; |
|
52 // Open chunk for test configuration/control data |
|
53 TInt err = iRadioStubManagerChunk.OpenGlobal( |
|
54 KRadioStubManagerLocalChunkName, |
|
55 EFalse, // == Read | Write |
|
56 EOwnerThread ); |
|
57 User::LeaveIfError( err ); |
|
58 if ( sizeof(SRadioStubManager) > iRadioStubManagerChunk.MaxSize() ) |
|
59 { |
|
60 User::Leave( KErrTooBig ); |
|
61 } |
|
62 TUint8* basePtr = iRadioStubManagerChunk.Base(); |
|
63 User::LeaveIfNull( basePtr ); |
|
64 iRadioStubManager = (SRadioStubManager*)basePtr; |
|
65 if ( STUB.iLeaveNewL.iError ) |
|
66 { |
|
67 User::Leave( STUB.iLeaveNewL.iError ); |
|
68 } |
|
69 if ( STUB.iLeaveConstructL.iError ) |
|
70 { |
|
71 User::Leave( STUB.iLeaveConstructL.iError ); |
|
72 } |
|
73 STUB.iRemConCoreApiTargetObserver = this; |
|
74 STUB.iRemConCallHandlingTargetObserver = this; |
|
75 RadioEngineUtils::InitializeL(); |
|
76 // Create interface selector. |
|
77 //iInterfaceSelector = CRemConInterfaceSelector::NewL(); |
|
78 // Create a new CRemConCoreApiTarget, owned by the interface selector. |
|
79 //iCoreTarget = CRemConCoreApiTarget::NewL( *iInterfaceSelector, *this ); |
|
80 // Create a new CRemConCallHandlingTarget, owned by the interface selector. |
|
81 //iCallTarget = CRemConCallHandlingTarget::NewL( *iInterfaceSelector, *this ); |
|
82 // Start being a target. |
|
83 //iInterfaceSelector->OpenTargetL(); |
|
84 // Create repeat timer. |
|
85 iRepeatTimer = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
86 } |
|
87 |
|
88 // --------------------------------------------------------------------------- |
|
89 // |
|
90 // --------------------------------------------------------------------------- |
|
91 // |
|
92 CRadioRemConTargetImp* CRadioRemConTargetImp::NewL() |
|
93 { |
|
94 LOG_METHOD_AUTO;; |
|
95 CRadioRemConTargetImp* self = new ( ELeave ) CRadioRemConTargetImp(); |
|
96 CleanupStack::PushL( self ); |
|
97 self->ConstructL(); |
|
98 CleanupStack::Pop(); |
|
99 return self; |
|
100 } |
|
101 |
|
102 // --------------------------------------------------------------------------- |
|
103 // |
|
104 // --------------------------------------------------------------------------- |
|
105 // |
|
106 CRadioRemConTargetImp::~CRadioRemConTargetImp() |
|
107 { |
|
108 LOG_METHOD_AUTO;; |
|
109 if ( iRepeatTimer ) |
|
110 { |
|
111 iRepeatTimer->Cancel(); |
|
112 } |
|
113 delete iRepeatTimer; |
|
114 //delete iInterfaceSelector; //deletes also iCallTarget and iCoreTarget |
|
115 //iCoreTarget = NULL; |
|
116 //iCallTarget = NULL; |
|
117 RadioEngineUtils::Release(); |
|
118 iRadioStubManagerChunk.Close(); |
|
119 } |
|
120 |
|
121 // --------------------------------------------------------------------------- |
|
122 // |
|
123 // --------------------------------------------------------------------------- |
|
124 // |
|
125 void CRadioRemConTargetImp::SetControlEventObserver( MRadioControlEventObserver* aControlEventObserver ) |
|
126 { |
|
127 LOG_METHOD_AUTO;; |
|
128 iObserver = aControlEventObserver; |
|
129 } |
|
130 |
|
131 // --------------------------------------------------------------------------- |
|
132 // |
|
133 // --------------------------------------------------------------------------- |
|
134 // |
|
135 void CRadioRemConTargetImp::MrccatoCommand( TRemConCoreApiOperationId aOperationId, |
|
136 TRemConCoreApiButtonAction aButtonAct ) |
|
137 { |
|
138 LOG_FORMAT( "aOperationId = %d, aButtonAct = %d", aOperationId, aButtonAct ); |
|
139 LOG_METHOD_AUTO; |
|
140 //TODO: Refactor |
|
141 if ( iObserver ) |
|
142 { |
|
143 switch ( aOperationId ) |
|
144 { |
|
145 case ERemConCoreApiChannelUp: |
|
146 { |
|
147 if ( aButtonAct == ERemConCoreApiButtonClick ) |
|
148 { |
|
149 TRAP_IGNORE( iObserver->ChannelUpL( ETrue ); iObserver->ChannelUpL( EFalse )) |
|
150 } |
|
151 else if ( aButtonAct == ERemConCoreApiButtonPress ) |
|
152 { |
|
153 TRAP_IGNORE( iObserver->ChannelUpL( ETrue )) |
|
154 } |
|
155 else if ( aButtonAct == ERemConCoreApiButtonRelease ) |
|
156 { |
|
157 TRAP_IGNORE( iObserver->ChannelUpL( EFalse )) |
|
158 } |
|
159 else {} |
|
160 break; |
|
161 } |
|
162 case ERemConCoreApiChannelDown: |
|
163 { |
|
164 if ( aButtonAct == ERemConCoreApiButtonClick ) |
|
165 { |
|
166 TRAP_IGNORE( iObserver->ChannelDownL( ETrue ); iObserver->ChannelDownL( EFalse )) |
|
167 } |
|
168 else if ( aButtonAct == ERemConCoreApiButtonPress ) |
|
169 { |
|
170 TRAP_IGNORE( iObserver->ChannelDownL( ETrue )) |
|
171 } |
|
172 else if ( aButtonAct == ERemConCoreApiButtonRelease ) |
|
173 { |
|
174 TRAP_IGNORE( iObserver->ChannelDownL( EFalse )) |
|
175 } |
|
176 else {} |
|
177 break; |
|
178 } |
|
179 case ERemConCoreApiVolumeUp: |
|
180 { |
|
181 if ( aButtonAct == ERemConCoreApiButtonClick ) |
|
182 { |
|
183 TRAP_IGNORE( iObserver->VolumeUpL( ETrue ); iObserver->VolumeUpL( EFalse )) |
|
184 } |
|
185 else if ( aButtonAct == ERemConCoreApiButtonPress ) |
|
186 { |
|
187 iRepeatTimer->Cancel(); |
|
188 iRepeatId = ERemConCoreApiVolumeUp; |
|
189 // iRepeatTimer->Start( KVRVolumeTimerInitialDelay, KAknStandardKeyboardRepeatRate, TCallBack( RepeatTimerCallback, this )); |
|
190 iRepeatTimer->Start( KVRVolumeTimerInitialDelay, 1000000, TCallBack( RepeatTimerCallback, this )); |
|
191 } |
|
192 else if ( aButtonAct == ERemConCoreApiButtonRelease ) |
|
193 { |
|
194 iRepeatTimer->Cancel(); |
|
195 } |
|
196 else {} |
|
197 break; |
|
198 } |
|
199 case ERemConCoreApiVolumeDown: |
|
200 { |
|
201 if ( aButtonAct == ERemConCoreApiButtonClick ) |
|
202 { |
|
203 TRAP_IGNORE( iObserver->VolumeDownL( ETrue ); iObserver->VolumeDownL( EFalse )) |
|
204 } |
|
205 else if ( aButtonAct == ERemConCoreApiButtonPress ) |
|
206 { |
|
207 iRepeatTimer->Cancel(); |
|
208 iRepeatId = ERemConCoreApiVolumeDown; |
|
209 // iRepeatTimer->Start( KVRVolumeTimerInitialDelay, KAknStandardKeyboardRepeatRate, TCallBack( RepeatTimerCallback, this )); |
|
210 iRepeatTimer->Start( KVRVolumeTimerInitialDelay, 1000000, TCallBack( RepeatTimerCallback, this )); |
|
211 } |
|
212 else if ( aButtonAct == ERemConCoreApiButtonRelease ) |
|
213 { |
|
214 iRepeatTimer->Cancel(); |
|
215 } |
|
216 else {} |
|
217 break; |
|
218 } |
|
219 case ERemConCoreApiStop: |
|
220 { |
|
221 if ( aButtonAct == ERemConCoreApiButtonClick ) |
|
222 { |
|
223 TRAP_IGNORE( iObserver->StopL( ETrue ); iObserver->StopL( EFalse )) |
|
224 } |
|
225 break; |
|
226 } |
|
227 case ERemConCoreApiBackward: |
|
228 case ERemConCoreApiRewind: |
|
229 { |
|
230 if ( aButtonAct == ERemConCoreApiButtonPress ) |
|
231 { |
|
232 TRAP_IGNORE( iObserver->RewindL( ETrue )) |
|
233 } |
|
234 else if ( aButtonAct == ERemConCoreApiButtonRelease ) |
|
235 { |
|
236 TRAP_IGNORE( iObserver->RewindL( EFalse )) |
|
237 } |
|
238 else if ( aButtonAct == ERemConCoreApiButtonClick ) |
|
239 { |
|
240 TRAP_IGNORE( iObserver->BackwardL( ETrue ); iObserver->BackwardL( EFalse )) |
|
241 } |
|
242 else {} |
|
243 break; |
|
244 } |
|
245 case ERemConCoreApiForward: |
|
246 case ERemConCoreApiFastForward: |
|
247 { |
|
248 if ( aButtonAct == ERemConCoreApiButtonPress ) |
|
249 { |
|
250 TRAP_IGNORE( iObserver->FastForwardL( ETrue )) |
|
251 } |
|
252 else if ( aButtonAct == ERemConCoreApiButtonRelease ) |
|
253 { |
|
254 TRAP_IGNORE( iObserver->FastForwardL( EFalse )) |
|
255 } |
|
256 else if ( aButtonAct == ERemConCoreApiButtonClick ) |
|
257 { |
|
258 TRAP_IGNORE( iObserver->ForwardL( ETrue ); iObserver->ForwardL( EFalse )) |
|
259 } |
|
260 else {} |
|
261 break; |
|
262 } |
|
263 case ERemConCoreApiPlay: |
|
264 case ERemConCoreApiPause: |
|
265 case ERemConCoreApiPausePlayFunction: |
|
266 { |
|
267 if ( aButtonAct == ERemConCoreApiButtonClick ) |
|
268 { |
|
269 TRAP_IGNORE( iObserver->PausePlayL( ETrue ); iObserver->PausePlayL( EFalse )) |
|
270 } |
|
271 break; |
|
272 } |
|
273 default: |
|
274 { |
|
275 break; |
|
276 } |
|
277 } |
|
278 } |
|
279 } |
|
280 |
|
281 // --------------------------------------------------------------------------- |
|
282 // |
|
283 // --------------------------------------------------------------------------- |
|
284 // |
|
285 void CRadioRemConTargetImp::MrccatoPlay( TRemConCoreApiPlaybackSpeed /*aSpeed*/, |
|
286 TRemConCoreApiButtonAction aButtonAct ) |
|
287 { |
|
288 LOG_METHOD_AUTO; |
|
289 if ( iObserver ) |
|
290 { |
|
291 if ( aButtonAct == ERemConCoreApiButtonClick ) |
|
292 { |
|
293 TRAP_IGNORE( iObserver->PlayL( ETrue ); iObserver->PlayL( EFalse )) |
|
294 } |
|
295 } |
|
296 } |
|
297 |
|
298 // --------------------------------------------------------------------------- |
|
299 // |
|
300 // --------------------------------------------------------------------------- |
|
301 // |
|
302 void CRadioRemConTargetImp::MrccatoTuneFunction( TBool /*aTwoPart*/, |
|
303 TUint /*aMajorChannel*/, |
|
304 TUint /*aMinorChannel*/, |
|
305 TRemConCoreApiButtonAction /*aButtonAct*/) |
|
306 { |
|
307 LOG_METHOD_AUTO; |
|
308 } |
|
309 |
|
310 // --------------------------------------------------------------------------- |
|
311 // |
|
312 // --------------------------------------------------------------------------- |
|
313 // |
|
314 void CRadioRemConTargetImp::MrccatoSelectDiskFunction( TUint /*aDisk*/, |
|
315 TRemConCoreApiButtonAction /*aButtonAct*/) |
|
316 { |
|
317 LOG_METHOD_AUTO; |
|
318 } |
|
319 |
|
320 // --------------------------------------------------------------------------- |
|
321 // |
|
322 // --------------------------------------------------------------------------- |
|
323 // |
|
324 void CRadioRemConTargetImp::MrccatoSelectAvInputFunction( TUint8 /*aAvInputSignalNumber*/, |
|
325 TRemConCoreApiButtonAction /*aButtonAct*/) |
|
326 { |
|
327 LOG_METHOD_AUTO; |
|
328 } |
|
329 |
|
330 // --------------------------------------------------------------------------- |
|
331 // |
|
332 // --------------------------------------------------------------------------- |
|
333 // |
|
334 void CRadioRemConTargetImp::MrccatoSelectAudioInputFunction( TUint8 /*aAudioInputSignalNumber*/, |
|
335 TRemConCoreApiButtonAction /*aButtonAct*/) |
|
336 { |
|
337 LOG_METHOD_AUTO; |
|
338 } |
|
339 |
|
340 // --------------------------------------------------------------------------- |
|
341 // |
|
342 // --------------------------------------------------------------------------- |
|
343 // |
|
344 TInt CRadioRemConTargetImp::RepeatTimerCallback( TAny* aPtr ) |
|
345 { |
|
346 LOG_METHOD_AUTO; |
|
347 |
|
348 CRadioRemConTargetImp* self = reinterpret_cast<CRadioRemConTargetImp*>( aPtr ); |
|
349 |
|
350 if ( self ) |
|
351 { |
|
352 if ( self->iObserver ) |
|
353 { |
|
354 switch ( self->iRepeatId ) |
|
355 { |
|
356 case ERemConCoreApiVolumeUp: |
|
357 { |
|
358 TRAP_IGNORE( self->iObserver->VolumeUpL( ETrue ); self->iObserver->VolumeUpL( EFalse )) |
|
359 break; |
|
360 } |
|
361 case ERemConCoreApiVolumeDown: |
|
362 { |
|
363 TRAP_IGNORE( self->iObserver->VolumeDownL( ETrue ); self->iObserver->VolumeDownL( EFalse )) |
|
364 break; |
|
365 } |
|
366 default: |
|
367 { |
|
368 break; |
|
369 } |
|
370 } |
|
371 } |
|
372 } |
|
373 |
|
374 return KErrNone; |
|
375 } |
|
376 |
|
377 // --------------------------------------------------------------------------- |
|
378 // |
|
379 // --------------------------------------------------------------------------- |
|
380 // |
|
381 void CRadioRemConTargetImp::AnswerCall() |
|
382 { |
|
383 LOG_METHOD_AUTO; |
|
384 } |
|
385 |
|
386 // --------------------------------------------------------------------------- |
|
387 // |
|
388 // --------------------------------------------------------------------------- |
|
389 // |
|
390 void CRadioRemConTargetImp::AnswerEndCall() |
|
391 { |
|
392 LOG_METHOD_AUTO; |
|
393 if ( iObserver ) |
|
394 { |
|
395 TRAP_IGNORE( iObserver->AnswerEndCallL()) |
|
396 } |
|
397 } |
|
398 |
|
399 // --------------------------------------------------------------------------- |
|
400 // |
|
401 // --------------------------------------------------------------------------- |
|
402 // |
|
403 void CRadioRemConTargetImp::DialCall( const TDesC8& /*aTelNumber*/ ) |
|
404 { |
|
405 LOG_METHOD_AUTO; |
|
406 } |
|
407 |
|
408 // --------------------------------------------------------------------------- |
|
409 // |
|
410 // --------------------------------------------------------------------------- |
|
411 // |
|
412 void CRadioRemConTargetImp::EndCall() |
|
413 { |
|
414 LOG_METHOD_AUTO; |
|
415 } |
|
416 |
|
417 // --------------------------------------------------------------------------- |
|
418 // |
|
419 // --------------------------------------------------------------------------- |
|
420 // |
|
421 void CRadioRemConTargetImp::GenerateDTMF( const TChar /*aChar*/ ) |
|
422 { |
|
423 LOG_METHOD_AUTO; |
|
424 } |
|
425 |
|
426 // --------------------------------------------------------------------------- |
|
427 // |
|
428 // --------------------------------------------------------------------------- |
|
429 // |
|
430 void CRadioRemConTargetImp::LastNumberRedial() |
|
431 { |
|
432 LOG_METHOD_AUTO; |
|
433 } |
|
434 |
|
435 // --------------------------------------------------------------------------- |
|
436 // |
|
437 // --------------------------------------------------------------------------- |
|
438 // |
|
439 void CRadioRemConTargetImp::MultipartyCalling( const TDesC8& /*aData*/ ) |
|
440 { |
|
441 LOG_METHOD_AUTO; |
|
442 } |
|
443 |
|
444 // --------------------------------------------------------------------------- |
|
445 // |
|
446 // --------------------------------------------------------------------------- |
|
447 // |
|
448 void CRadioRemConTargetImp::SpeedDial( const TInt /*aIndex*/ ) |
|
449 { |
|
450 LOG_METHOD_AUTO; |
|
451 } |
|
452 |
|
453 // --------------------------------------------------------------------------- |
|
454 // |
|
455 // --------------------------------------------------------------------------- |
|
456 // |
|
457 void CRadioRemConTargetImp::VoiceDial( const TBool /*aActivate*/ ) |
|
458 { |
|
459 LOG_METHOD_AUTO; |
|
460 } |