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 if ( iObserver ) |
|
141 { |
|
142 switch ( aOperationId ) |
|
143 { |
|
144 case ERemConCoreApiChannelUp: |
|
145 { |
|
146 if ( aButtonAct == ERemConCoreApiButtonClick ) |
|
147 { |
|
148 TRAP_IGNORE( iObserver->ChannelUpL( ETrue ); iObserver->ChannelUpL( EFalse )) |
|
149 } |
|
150 else if ( aButtonAct == ERemConCoreApiButtonPress ) |
|
151 { |
|
152 TRAP_IGNORE( iObserver->ChannelUpL( ETrue )) |
|
153 } |
|
154 else if ( aButtonAct == ERemConCoreApiButtonRelease ) |
|
155 { |
|
156 TRAP_IGNORE( iObserver->ChannelUpL( EFalse )) |
|
157 } |
|
158 else {} |
|
159 break; |
|
160 } |
|
161 case ERemConCoreApiChannelDown: |
|
162 { |
|
163 if ( aButtonAct == ERemConCoreApiButtonClick ) |
|
164 { |
|
165 TRAP_IGNORE( iObserver->ChannelDownL( ETrue ); iObserver->ChannelDownL( EFalse )) |
|
166 } |
|
167 else if ( aButtonAct == ERemConCoreApiButtonPress ) |
|
168 { |
|
169 TRAP_IGNORE( iObserver->ChannelDownL( ETrue )) |
|
170 } |
|
171 else if ( aButtonAct == ERemConCoreApiButtonRelease ) |
|
172 { |
|
173 TRAP_IGNORE( iObserver->ChannelDownL( EFalse )) |
|
174 } |
|
175 else {} |
|
176 break; |
|
177 } |
|
178 case ERemConCoreApiVolumeUp: |
|
179 { |
|
180 if ( aButtonAct == ERemConCoreApiButtonClick ) |
|
181 { |
|
182 TRAP_IGNORE( iObserver->VolumeUpL( ETrue ); iObserver->VolumeUpL( EFalse )) |
|
183 } |
|
184 else if ( aButtonAct == ERemConCoreApiButtonPress ) |
|
185 { |
|
186 iRepeatTimer->Cancel(); |
|
187 iRepeatId = ERemConCoreApiVolumeUp; |
|
188 // iRepeatTimer->Start( KVRVolumeTimerInitialDelay, KAknStandardKeyboardRepeatRate, TCallBack( RepeatTimerCallback, this )); |
|
189 iRepeatTimer->Start( KVRVolumeTimerInitialDelay, 1000000, TCallBack( RepeatTimerCallback, this )); |
|
190 } |
|
191 else if ( aButtonAct == ERemConCoreApiButtonRelease ) |
|
192 { |
|
193 iRepeatTimer->Cancel(); |
|
194 } |
|
195 else {} |
|
196 break; |
|
197 } |
|
198 case ERemConCoreApiVolumeDown: |
|
199 { |
|
200 if ( aButtonAct == ERemConCoreApiButtonClick ) |
|
201 { |
|
202 TRAP_IGNORE( iObserver->VolumeDownL( ETrue ); iObserver->VolumeDownL( EFalse )) |
|
203 } |
|
204 else if ( aButtonAct == ERemConCoreApiButtonPress ) |
|
205 { |
|
206 iRepeatTimer->Cancel(); |
|
207 iRepeatId = ERemConCoreApiVolumeDown; |
|
208 // iRepeatTimer->Start( KVRVolumeTimerInitialDelay, KAknStandardKeyboardRepeatRate, TCallBack( RepeatTimerCallback, this )); |
|
209 iRepeatTimer->Start( KVRVolumeTimerInitialDelay, 1000000, TCallBack( RepeatTimerCallback, this )); |
|
210 } |
|
211 else if ( aButtonAct == ERemConCoreApiButtonRelease ) |
|
212 { |
|
213 iRepeatTimer->Cancel(); |
|
214 } |
|
215 else {} |
|
216 break; |
|
217 } |
|
218 case ERemConCoreApiStop: |
|
219 { |
|
220 if ( aButtonAct == ERemConCoreApiButtonClick ) |
|
221 { |
|
222 TRAP_IGNORE( iObserver->StopL( ETrue ); iObserver->StopL( EFalse )) |
|
223 } |
|
224 break; |
|
225 } |
|
226 case ERemConCoreApiBackward: |
|
227 case ERemConCoreApiRewind: |
|
228 { |
|
229 if ( aButtonAct == ERemConCoreApiButtonPress ) |
|
230 { |
|
231 TRAP_IGNORE( iObserver->RewindL( ETrue )) |
|
232 } |
|
233 else if ( aButtonAct == ERemConCoreApiButtonRelease ) |
|
234 { |
|
235 TRAP_IGNORE( iObserver->RewindL( EFalse )) |
|
236 } |
|
237 else if ( aButtonAct == ERemConCoreApiButtonClick ) |
|
238 { |
|
239 TRAP_IGNORE( iObserver->BackwardL( ETrue ); iObserver->BackwardL( EFalse )) |
|
240 } |
|
241 else {} |
|
242 break; |
|
243 } |
|
244 case ERemConCoreApiForward: |
|
245 case ERemConCoreApiFastForward: |
|
246 { |
|
247 if ( aButtonAct == ERemConCoreApiButtonPress ) |
|
248 { |
|
249 TRAP_IGNORE( iObserver->FastForwardL( ETrue )) |
|
250 } |
|
251 else if ( aButtonAct == ERemConCoreApiButtonRelease ) |
|
252 { |
|
253 TRAP_IGNORE( iObserver->FastForwardL( EFalse )) |
|
254 } |
|
255 else if ( aButtonAct == ERemConCoreApiButtonClick ) |
|
256 { |
|
257 TRAP_IGNORE( iObserver->ForwardL( ETrue ); iObserver->ForwardL( EFalse )) |
|
258 } |
|
259 else {} |
|
260 break; |
|
261 } |
|
262 case ERemConCoreApiPlay: |
|
263 case ERemConCoreApiPause: |
|
264 case ERemConCoreApiPausePlayFunction: |
|
265 { |
|
266 if ( aButtonAct == ERemConCoreApiButtonClick ) |
|
267 { |
|
268 TRAP_IGNORE( iObserver->PausePlayL( ETrue ); iObserver->PausePlayL( EFalse )) |
|
269 } |
|
270 break; |
|
271 } |
|
272 default: |
|
273 { |
|
274 break; |
|
275 } |
|
276 } |
|
277 } |
|
278 } |
|
279 |
|
280 // --------------------------------------------------------------------------- |
|
281 // |
|
282 // --------------------------------------------------------------------------- |
|
283 // |
|
284 void CRadioRemConTargetImp::MrccatoPlay( TRemConCoreApiPlaybackSpeed /*aSpeed*/, |
|
285 TRemConCoreApiButtonAction aButtonAct ) |
|
286 { |
|
287 LOG_METHOD_AUTO; |
|
288 if ( iObserver ) |
|
289 { |
|
290 if ( aButtonAct == ERemConCoreApiButtonClick ) |
|
291 { |
|
292 TRAP_IGNORE( iObserver->PlayL( ETrue ); iObserver->PlayL( EFalse )) |
|
293 } |
|
294 } |
|
295 } |
|
296 |
|
297 // --------------------------------------------------------------------------- |
|
298 // |
|
299 // --------------------------------------------------------------------------- |
|
300 // |
|
301 void CRadioRemConTargetImp::MrccatoTuneFunction( TBool /*aTwoPart*/, |
|
302 TUint /*aMajorChannel*/, |
|
303 TUint /*aMinorChannel*/, |
|
304 TRemConCoreApiButtonAction /*aButtonAct*/) |
|
305 { |
|
306 LOG_METHOD_AUTO; |
|
307 } |
|
308 |
|
309 // --------------------------------------------------------------------------- |
|
310 // |
|
311 // --------------------------------------------------------------------------- |
|
312 // |
|
313 void CRadioRemConTargetImp::MrccatoSelectDiskFunction( TUint /*aDisk*/, |
|
314 TRemConCoreApiButtonAction /*aButtonAct*/) |
|
315 { |
|
316 LOG_METHOD_AUTO; |
|
317 } |
|
318 |
|
319 // --------------------------------------------------------------------------- |
|
320 // |
|
321 // --------------------------------------------------------------------------- |
|
322 // |
|
323 void CRadioRemConTargetImp::MrccatoSelectAvInputFunction( TUint8 /*aAvInputSignalNumber*/, |
|
324 TRemConCoreApiButtonAction /*aButtonAct*/) |
|
325 { |
|
326 LOG_METHOD_AUTO; |
|
327 } |
|
328 |
|
329 // --------------------------------------------------------------------------- |
|
330 // |
|
331 // --------------------------------------------------------------------------- |
|
332 // |
|
333 void CRadioRemConTargetImp::MrccatoSelectAudioInputFunction( TUint8 /*aAudioInputSignalNumber*/, |
|
334 TRemConCoreApiButtonAction /*aButtonAct*/) |
|
335 { |
|
336 LOG_METHOD_AUTO; |
|
337 } |
|
338 |
|
339 // --------------------------------------------------------------------------- |
|
340 // |
|
341 // --------------------------------------------------------------------------- |
|
342 // |
|
343 TInt CRadioRemConTargetImp::RepeatTimerCallback( TAny* aPtr ) |
|
344 { |
|
345 LOG_METHOD_AUTO; |
|
346 |
|
347 CRadioRemConTargetImp* self = reinterpret_cast<CRadioRemConTargetImp*>( aPtr ); |
|
348 |
|
349 if ( self ) |
|
350 { |
|
351 if ( self->iObserver ) |
|
352 { |
|
353 switch ( self->iRepeatId ) |
|
354 { |
|
355 case ERemConCoreApiVolumeUp: |
|
356 { |
|
357 TRAP_IGNORE( self->iObserver->VolumeUpL( ETrue ); self->iObserver->VolumeUpL( EFalse )) |
|
358 break; |
|
359 } |
|
360 case ERemConCoreApiVolumeDown: |
|
361 { |
|
362 TRAP_IGNORE( self->iObserver->VolumeDownL( ETrue ); self->iObserver->VolumeDownL( EFalse )) |
|
363 break; |
|
364 } |
|
365 default: |
|
366 { |
|
367 break; |
|
368 } |
|
369 } |
|
370 } |
|
371 } |
|
372 |
|
373 return KErrNone; |
|
374 } |
|
375 |
|
376 // --------------------------------------------------------------------------- |
|
377 // |
|
378 // --------------------------------------------------------------------------- |
|
379 // |
|
380 void CRadioRemConTargetImp::AnswerCall() |
|
381 { |
|
382 LOG_METHOD_AUTO; |
|
383 } |
|
384 |
|
385 // --------------------------------------------------------------------------- |
|
386 // |
|
387 // --------------------------------------------------------------------------- |
|
388 // |
|
389 void CRadioRemConTargetImp::AnswerEndCall() |
|
390 { |
|
391 LOG_METHOD_AUTO; |
|
392 if ( iObserver ) |
|
393 { |
|
394 TRAP_IGNORE( iObserver->AnswerEndCallL()) |
|
395 } |
|
396 } |
|
397 |
|
398 // --------------------------------------------------------------------------- |
|
399 // |
|
400 // --------------------------------------------------------------------------- |
|
401 // |
|
402 void CRadioRemConTargetImp::DialCall( const TDesC8& /*aTelNumber*/ ) |
|
403 { |
|
404 LOG_METHOD_AUTO; |
|
405 } |
|
406 |
|
407 // --------------------------------------------------------------------------- |
|
408 // |
|
409 // --------------------------------------------------------------------------- |
|
410 // |
|
411 void CRadioRemConTargetImp::EndCall() |
|
412 { |
|
413 LOG_METHOD_AUTO; |
|
414 } |
|
415 |
|
416 // --------------------------------------------------------------------------- |
|
417 // |
|
418 // --------------------------------------------------------------------------- |
|
419 // |
|
420 void CRadioRemConTargetImp::GenerateDTMF( const TChar /*aChar*/ ) |
|
421 { |
|
422 LOG_METHOD_AUTO; |
|
423 } |
|
424 |
|
425 // --------------------------------------------------------------------------- |
|
426 // |
|
427 // --------------------------------------------------------------------------- |
|
428 // |
|
429 void CRadioRemConTargetImp::LastNumberRedial() |
|
430 { |
|
431 LOG_METHOD_AUTO; |
|
432 } |
|
433 |
|
434 // --------------------------------------------------------------------------- |
|
435 // |
|
436 // --------------------------------------------------------------------------- |
|
437 // |
|
438 void CRadioRemConTargetImp::MultipartyCalling( const TDesC8& /*aData*/ ) |
|
439 { |
|
440 LOG_METHOD_AUTO; |
|
441 } |
|
442 |
|
443 // --------------------------------------------------------------------------- |
|
444 // |
|
445 // --------------------------------------------------------------------------- |
|
446 // |
|
447 void CRadioRemConTargetImp::SpeedDial( const TInt /*aIndex*/ ) |
|
448 { |
|
449 LOG_METHOD_AUTO; |
|
450 } |
|
451 |
|
452 // --------------------------------------------------------------------------- |
|
453 // |
|
454 // --------------------------------------------------------------------------- |
|
455 // |
|
456 void CRadioRemConTargetImp::VoiceDial( const TBool /*aActivate*/ ) |
|
457 { |
|
458 LOG_METHOD_AUTO; |
|
459 } |
|