41
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2004 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: ?Description
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include "remconcontrol.h"
|
|
21 |
#include "remconactive.h"
|
|
22 |
#include "siftrace.h"
|
|
23 |
#include "remconcore.h"
|
|
24 |
#include <remconaddress.h>
|
|
25 |
|
|
26 |
// -----------------------------------------------------------------------------
|
|
27 |
//
|
|
28 |
//
|
|
29 |
// -----------------------------------------------------------------------------
|
|
30 |
//
|
|
31 |
CRemConCore::CRemConCore()
|
|
32 |
{
|
|
33 |
iEvent = ETFRemConEvent_None;
|
|
34 |
iParameter = KErrNone;
|
|
35 |
}
|
|
36 |
|
|
37 |
// -----------------------------------------------------------------------------
|
|
38 |
//
|
|
39 |
//
|
|
40 |
// -----------------------------------------------------------------------------
|
|
41 |
//
|
|
42 |
void CRemConCore::ConstructL( CRemConInterfaceSelector* aTargetInterfaceSelector )
|
|
43 |
{
|
|
44 |
iCore = CRemConCoreApiTarget::NewL( *aTargetInterfaceSelector, *this );
|
|
45 |
|
|
46 |
iCoreController = CRemConCoreApiController::NewL( *aTargetInterfaceSelector, *this );
|
|
47 |
|
|
48 |
iTargetInterfaceSelector = aTargetInterfaceSelector;
|
|
49 |
|
|
50 |
iActive = CRemConActive::NewL( *this );
|
|
51 |
}
|
|
52 |
|
|
53 |
// -----------------------------------------------------------------------------
|
|
54 |
//
|
|
55 |
//
|
|
56 |
// -----------------------------------------------------------------------------
|
|
57 |
//
|
|
58 |
CRemConCore* CRemConCore::NewL( CRemConInterfaceSelector* aTargetInterfaceSelector )
|
|
59 |
{
|
|
60 |
CRemConCore* self = new( ELeave ) CRemConCore();
|
|
61 |
CleanupStack::PushL( self );
|
|
62 |
self->ConstructL( aTargetInterfaceSelector );
|
|
63 |
CleanupStack::Pop();
|
|
64 |
return self;
|
|
65 |
}
|
|
66 |
|
|
67 |
// -----------------------------------------------------------------------------
|
|
68 |
//
|
|
69 |
//
|
|
70 |
// -----------------------------------------------------------------------------
|
|
71 |
//
|
|
72 |
CRemConCore::~CRemConCore()
|
|
73 |
{
|
|
74 |
delete iActive;
|
|
75 |
}
|
|
76 |
|
|
77 |
|
|
78 |
// -----------------------------------------------------------------------------
|
|
79 |
//
|
|
80 |
//
|
|
81 |
//
|
|
82 |
// -----------------------------------------------------------------------------
|
|
83 |
void CRemConCore::CompleteResponse( const TInt aError )
|
|
84 |
{
|
|
85 |
if( aError != KErrNone )
|
|
86 |
{
|
|
87 |
COMPONENT_TRACE( ( _L( "REMCONTESTCONTROL - CRemConCore::CompleteResponse( %d)" ), aError) );
|
|
88 |
}
|
|
89 |
else
|
|
90 |
{
|
|
91 |
|
|
92 |
MRemConControl* aControl = GetRemConControl();
|
|
93 |
aControl->CompleteKeyEventResponse( iEvent, iParameter, aError );
|
|
94 |
}
|
|
95 |
|
|
96 |
iEvent = ETFRemConEvent_None;
|
|
97 |
iParameter = KErrNone;
|
|
98 |
}
|
|
99 |
// -----------------------------------------------------------------------------
|
|
100 |
//
|
|
101 |
//
|
|
102 |
//
|
|
103 |
// -----------------------------------------------------------------------------
|
|
104 |
void CRemConCore::MrccatoCommand(TRemConCoreApiOperationId aOperationId,
|
|
105 |
TRemConCoreApiButtonAction aButtonAct)
|
|
106 |
{
|
|
107 |
|
|
108 |
iParameter = (TInt)aButtonAct;
|
|
109 |
|
|
110 |
switch ( aOperationId )
|
|
111 |
{
|
|
112 |
case ERemConCoreApiVolumeUp:
|
|
113 |
{
|
|
114 |
iEvent = ETFRemConEvent_VolumeUp;
|
|
115 |
break;
|
|
116 |
}
|
|
117 |
case ERemConCoreApiVolumeDown:
|
|
118 |
{
|
|
119 |
iEvent = ETFRemConEvent_VolumeDown;
|
|
120 |
break;
|
|
121 |
}
|
|
122 |
case ERemConCoreApiStop:
|
|
123 |
{
|
|
124 |
iEvent = ETFRemConEvent_CodeStop;
|
|
125 |
break;
|
|
126 |
}
|
|
127 |
case ERemConCoreApiFastForward:
|
|
128 |
{
|
|
129 |
iEvent = ETFRemConEvent_CodeForward;
|
|
130 |
break;
|
|
131 |
}
|
|
132 |
case ERemConCoreApiRewind:
|
|
133 |
{
|
|
134 |
iEvent = ETFRemConEvent_CodeBack;
|
|
135 |
break;
|
|
136 |
}
|
|
137 |
case ERemConCoreApiForward:
|
|
138 |
{
|
|
139 |
iEvent = ETFRemConEvent_CodeForward;
|
|
140 |
break;
|
|
141 |
}
|
|
142 |
|
|
143 |
case ERemConCoreApiBackward:
|
|
144 |
{
|
|
145 |
iEvent = ETFRemConEvent_CodeBack;
|
|
146 |
break;
|
|
147 |
}
|
|
148 |
|
|
149 |
case ERemConCoreApiPausePlayFunction:
|
|
150 |
{
|
|
151 |
iEvent = ETFRemConEvent_CoreApiPlaybackSpeedX1; //event not used in real implementation
|
|
152 |
break;
|
|
153 |
}
|
|
154 |
|
|
155 |
case ERemConCoreApiMute:
|
|
156 |
{
|
|
157 |
iEvent = ETFRemConEvent_Mute;
|
|
158 |
break;
|
|
159 |
}
|
|
160 |
|
|
161 |
default:
|
|
162 |
iEvent = ETFRemConEvent_None;
|
|
163 |
break;
|
|
164 |
}
|
|
165 |
MRemConControl* aControl = GetRemConControl();
|
|
166 |
aControl->NotifyKeyEvent(iEvent, aButtonAct);
|
|
167 |
|
|
168 |
iEvent = ETFRemConEvent_None;
|
|
169 |
iParameter = KErrNone;
|
|
170 |
|
|
171 |
}
|
|
172 |
|
|
173 |
// -----------------------------------------------------------------------------
|
|
174 |
//
|
|
175 |
//
|
|
176 |
//
|
|
177 |
// -----------------------------------------------------------------------------
|
|
178 |
void CRemConCore::MrccatoPlay(TRemConCoreApiPlaybackSpeed aSpeed,
|
|
179 |
TRemConCoreApiButtonAction aButtonAct)
|
|
180 |
{
|
|
181 |
|
|
182 |
//TTFRemConkeyEvent aKeyCode;
|
|
183 |
iParameter = (TInt)aButtonAct;
|
|
184 |
|
|
185 |
switch ( aSpeed )
|
|
186 |
{
|
|
187 |
case ERemConCoreApiPlaybackSpeedX1:
|
|
188 |
{
|
|
189 |
iEvent = ETFRemConEvent_CoreApiPlaybackSpeedX1;
|
|
190 |
break;
|
|
191 |
}
|
|
192 |
|
|
193 |
default:
|
|
194 |
iEvent = ETFRemConEvent_None;
|
|
195 |
break;
|
|
196 |
}
|
|
197 |
MRemConControl* aControl = GetRemConControl();
|
|
198 |
aControl->NotifyKeyEvent(iEvent, aButtonAct);
|
|
199 |
|
|
200 |
iEvent = ETFRemConEvent_None;
|
|
201 |
iParameter = KErrNone;
|
|
202 |
|
|
203 |
}
|
|
204 |
|
|
205 |
// -----------------------------------------------------------------------------
|
|
206 |
//
|
|
207 |
//
|
|
208 |
//
|
|
209 |
// -----------------------------------------------------------------------------
|
|
210 |
void CRemConCore::MrccatoTuneFunction(TBool /*aTwoPart*/,
|
|
211 |
TUint /*aMajorChannel*/,
|
|
212 |
TUint /*aMinorChannel*/,
|
|
213 |
TRemConCoreApiButtonAction /*aButtonAct*/)
|
|
214 |
{
|
|
215 |
}
|
|
216 |
|
|
217 |
// -----------------------------------------------------------------------------
|
|
218 |
//
|
|
219 |
//
|
|
220 |
//
|
|
221 |
// -----------------------------------------------------------------------------
|
|
222 |
void CRemConCore::MrccatoSelectDiskFunction(TUint /*aDisk*/,
|
|
223 |
TRemConCoreApiButtonAction /*aButtonAct*/)
|
|
224 |
{
|
|
225 |
}
|
|
226 |
|
|
227 |
// -----------------------------------------------------------------------------
|
|
228 |
//
|
|
229 |
//
|
|
230 |
//
|
|
231 |
// -----------------------------------------------------------------------------
|
|
232 |
void CRemConCore::MrccatoSelectAvInputFunction(TUint8 /*aAvInputSignalNumber*/,
|
|
233 |
TRemConCoreApiButtonAction /*aButtonAct*/)
|
|
234 |
{
|
|
235 |
}
|
|
236 |
|
|
237 |
// -----------------------------------------------------------------------------
|
|
238 |
//
|
|
239 |
//
|
|
240 |
//
|
|
241 |
// -----------------------------------------------------------------------------
|
|
242 |
void CRemConCore::MrccatoSelectAudioInputFunction(TUint8 /*aAudioInputSignalNumber*/,
|
|
243 |
TRemConCoreApiButtonAction /*aButtonAct*/)
|
|
244 |
{
|
|
245 |
}
|
|
246 |
|
|
247 |
// -----------------------------------------------------------------------------
|
|
248 |
//
|
|
249 |
//
|
|
250 |
//
|
|
251 |
// -----------------------------------------------------------------------------
|
|
252 |
void CRemConCore::Response(TRemConCoreApiOperationId /*aOperationId*/, TInt /*aError*/)
|
|
253 |
{
|
|
254 |
|
|
255 |
}
|
|
256 |
|
|
257 |
// -----------------------------------------------------------------------------
|
|
258 |
//
|
|
259 |
//
|
|
260 |
//
|
|
261 |
// -----------------------------------------------------------------------------
|
|
262 |
void CRemConCore::Play()
|
|
263 |
{
|
|
264 |
TUint numRemotes;
|
|
265 |
iCoreController->Play(iActive->iStatus, numRemotes, ERemConCoreApiButtonPress);
|
|
266 |
iActive->iStatus = KRequestPending;
|
|
267 |
iActive->SetActive();
|
|
268 |
}
|
|
269 |
|
|
270 |
// -----------------------------------------------------------------------------
|
|
271 |
//
|
|
272 |
//
|
|
273 |
//
|
|
274 |
// -----------------------------------------------------------------------------
|
|
275 |
|
|
276 |
void CRemConCore::Stop()
|
|
277 |
{
|
|
278 |
TUint numRemotes;
|
|
279 |
TRemConAddress* aConnection;
|
|
280 |
TSglQue<TRemConAddress> aConnections;
|
|
281 |
const TInt KBearerUid = 0x10205083;
|
|
282 |
|
|
283 |
iTargetInterfaceSelector->GetConnections(aConnections);
|
|
284 |
|
|
285 |
aConnection = aConnections.First();
|
|
286 |
|
|
287 |
if(aConnection->IsNull() == EFalse)
|
|
288 |
{
|
|
289 |
//
|
|
290 |
// Should check also last element...
|
|
291 |
//
|
|
292 |
while (aConnection->BearerUid() == TUid::Uid(KBearerUid))
|
|
293 |
{
|
|
294 |
aConnection = (TRemConAddress*)aConnection->iLink.iNext;
|
|
295 |
};
|
|
296 |
|
|
297 |
if(aConnection->IsNull() == EFalse)
|
|
298 |
{
|
|
299 |
iTargetInterfaceSelector->GoConnectionOrientedL(*aConnection);
|
|
300 |
}
|
|
301 |
|
|
302 |
iActive->iStatus = KRequestPending;
|
|
303 |
iCoreController->Stop(iActive->iStatus, numRemotes, ERemConCoreApiButtonPress);
|
|
304 |
iActive->SetActive();
|
|
305 |
}
|
|
306 |
}
|
|
307 |
|
|
308 |
// -----------------------------------------------------------------------------
|
|
309 |
//
|
|
310 |
//
|
|
311 |
//
|
|
312 |
// -----------------------------------------------------------------------------
|
|
313 |
void CRemConCore::Cancel()
|
|
314 |
{
|
|
315 |
TUint numRemotes;
|
|
316 |
iCoreController->Play(iActive->iStatus, numRemotes, ERemConCoreApiButtonPress);
|
|
317 |
iCoreController->Cancel();
|
|
318 |
iActive->SetActive();
|
|
319 |
}
|
|
320 |
|