28
|
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 "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: Implements the ECom plugin for HTI camera
|
|
15 |
* service.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
// INCLUDE FILES
|
|
22 |
#include <HtiDispatcherInterface.h>
|
|
23 |
#include <HtiLogging.h>
|
|
24 |
|
|
25 |
|
|
26 |
#include "HtiCameraServicePlugin.h"
|
|
27 |
|
|
28 |
// EXTERNAL DATA STRUCTURES
|
|
29 |
|
|
30 |
// EXTERNAL FUNCTION PROTOTYPES
|
|
31 |
|
|
32 |
// CONSTANTS
|
|
33 |
|
|
34 |
// MACROS
|
|
35 |
|
|
36 |
// LOCAL CONSTANTS AND MACROS
|
|
37 |
const static TUid KCameraServiceUid = { 0x2002EA9E };
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
// NOTE: Max length for error description is defined
|
|
42 |
// in HtiDispatcherInterface.h (currently 118).
|
|
43 |
|
|
44 |
_LIT8( KErrorNoCommand, "ERROR: No command given" );
|
|
45 |
_LIT8( KErrorUnknownCmd, "ERROR: Unknown Camera Service command" );
|
|
46 |
_LIT8( KErrorInitFailed, "ERROR: Failed to init");
|
31
|
47 |
_LIT8( KErrorUninitialized, "ERROR: Uninitialized");
|
28
|
48 |
_LIT8( KErrInvalidateParameters, "ERROR: Invalidate parameters");
|
|
49 |
_LIT8( KErrQualityLevel, "ERROR: Invalidate quality level");
|
|
50 |
_LIT8( KErrorPrepareVideoRecordingFailed, "ERROR: Prepare video recording failed");
|
|
51 |
_LIT8( KErrorStartVideoRecordingFailed, "ERROR: Start video recording failed");
|
|
52 |
_LIT8( KErrorPausingVideoRecordingFailed, "ERROR: Pausing video recording failed");
|
|
53 |
_LIT8( KErrorResumeVideoRecordingFailed, "ERROR: Resume video recording failed");
|
|
54 |
_LIT8( KErrorStopVideoRecordingFailed, "ERROR: Stop video recording failed");
|
|
55 |
_LIT8( KErrorSetZoomModeFailed, "ERROR: Set zoom mode failed");
|
|
56 |
_LIT8( KErrorSetZoomValueFailed, "ERROR: Set zoom value failed");
|
|
57 |
|
|
58 |
// MODULE DATA STRUCTURES
|
|
59 |
|
|
60 |
// LOCAL FUNCTION PROTOTYPES
|
|
61 |
|
|
62 |
// FORWARD DECLARATIONS
|
|
63 |
|
|
64 |
// ============================= LOCAL FUNCTIONS ===============================
|
|
65 |
|
|
66 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
67 |
|
|
68 |
// -----------------------------------------------------------------------------
|
|
69 |
// CHtiCameraServicePlugin::CHtiCameraServicePlugin
|
|
70 |
// C++ default constructor can NOT contain any code, that might leave.
|
|
71 |
// -----------------------------------------------------------------------------
|
|
72 |
//
|
|
73 |
CHtiCameraServicePlugin::CHtiCameraServicePlugin():iIsBusy(EFalse), iError(0),
|
|
74 |
iVideoRecordingEngine(NULL), iWaiter(NULL)
|
|
75 |
{
|
|
76 |
}
|
|
77 |
|
|
78 |
|
|
79 |
// -----------------------------------------------------------------------------
|
|
80 |
// CHtiCameraServicePlugin::ConstructL
|
|
81 |
// Symbian 2nd phase constructor can leave.
|
|
82 |
// -----------------------------------------------------------------------------
|
|
83 |
//
|
|
84 |
void CHtiCameraServicePlugin::ConstructL()
|
|
85 |
{
|
|
86 |
HTI_LOG_TEXT( "CHtiCameraServicePlugin::ConstructL" );
|
|
87 |
iWaiter = new ( ELeave ) CActiveSchedulerWait;
|
|
88 |
}
|
|
89 |
|
|
90 |
|
|
91 |
// -----------------------------------------------------------------------------
|
|
92 |
// CHtiCameraServicePlugin::NewL
|
|
93 |
// Two-phased constructor.
|
|
94 |
// -----------------------------------------------------------------------------
|
|
95 |
//
|
|
96 |
CHtiCameraServicePlugin* CHtiCameraServicePlugin::NewL()
|
|
97 |
{
|
|
98 |
CHtiCameraServicePlugin* self = new (ELeave) CHtiCameraServicePlugin;
|
|
99 |
CleanupStack::PushL( self );
|
|
100 |
self->ConstructL();
|
|
101 |
CleanupStack::Pop();
|
|
102 |
return self;
|
|
103 |
}
|
|
104 |
|
|
105 |
|
|
106 |
// Destructor
|
|
107 |
CHtiCameraServicePlugin::~CHtiCameraServicePlugin()
|
|
108 |
{
|
31
|
109 |
if(iVideoRecordingEngine)
|
|
110 |
{
|
|
111 |
delete iVideoRecordingEngine;
|
|
112 |
iVideoRecordingEngine = NULL;
|
|
113 |
}
|
28
|
114 |
|
|
115 |
delete iWaiter;
|
|
116 |
iWaiter = NULL;
|
|
117 |
}
|
|
118 |
|
|
119 |
|
|
120 |
// -----------------------------------------------------------------------------
|
|
121 |
// CHtiCameraServicePlugin::ProcessMessageL
|
|
122 |
// -----------------------------------------------------------------------------
|
|
123 |
//
|
|
124 |
void CHtiCameraServicePlugin::ProcessMessageL( const TDesC8& aMessage,
|
|
125 |
THtiMessagePriority /*aPriority*/ )
|
|
126 |
{
|
|
127 |
HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::ProcessMessageL" );
|
|
128 |
HTI_LOG_FORMAT( "Message length = %d", aMessage.Length() );
|
|
129 |
|
|
130 |
if ( iIsBusy )
|
|
131 |
{
|
|
132 |
HTI_LOG_TEXT( "Plugin is busy - leaving" );
|
|
133 |
User::Leave( KErrInUse );
|
|
134 |
}
|
|
135 |
|
|
136 |
// Will be set to EFalse in the SendResponseMsg or SendErrorResponseMsg
|
|
137 |
// methods when the response has been successfully sent and the plugin is
|
|
138 |
// ready for next message.
|
|
139 |
iIsBusy = ETrue;
|
|
140 |
|
|
141 |
if ( aMessage.Length() < 1 )
|
|
142 |
{
|
|
143 |
SendErrorMessageL( KErrArgument, KErrorNoCommand );
|
|
144 |
return;
|
|
145 |
}
|
|
146 |
|
|
147 |
TUint8 command = aMessage.Ptr()[0];
|
|
148 |
TInt err = KErrNone;
|
|
149 |
|
|
150 |
switch (command)
|
|
151 |
{
|
31
|
152 |
case ECmdInitialize:
|
|
153 |
TRAP(err, HandleInitializeCmdL(aMessage.Right( aMessage.Length() - 1 )));
|
|
154 |
break;
|
|
155 |
case ECmdUninitialize:
|
|
156 |
TRAP(err, HandleUninitializeCmdL(aMessage.Right( aMessage.Length() - 1 )));
|
28
|
157 |
break;
|
|
158 |
case ECmdPrepareVideoRecording:
|
|
159 |
TRAP(err, HandlePrepareVideoRecordingCmdL(aMessage.Right( aMessage.Length() - 1 )));
|
|
160 |
break;
|
|
161 |
case ECmdStartVideoRecording:
|
|
162 |
TRAP(err, HandleStartVideoRecordingCmdL(aMessage.Right( aMessage.Length() - 1 )));
|
|
163 |
break;
|
|
164 |
case ECmdPausingVideoRecording:
|
|
165 |
TRAP(err, HandlePausingVideoRecordingCmdL(aMessage.Right( aMessage.Length() - 1 )));
|
|
166 |
break;
|
|
167 |
case ECmdResumeVideoRecording:
|
|
168 |
TRAP(err, HandleResumeVideoRecordingCmdL(aMessage.Right( aMessage.Length() - 1 )));
|
|
169 |
break;
|
|
170 |
case ECmdStopVideoRecording:
|
|
171 |
TRAP(err, HandleStopVideoRecordingCmdL(aMessage.Right( aMessage.Length() - 1 )));
|
|
172 |
break;
|
|
173 |
case ECmdCloseVideoRecording:
|
|
174 |
TRAP(err, HandleCloseVideoRecordingCmdL(aMessage.Right( aMessage.Length() - 1 )));
|
|
175 |
break;
|
|
176 |
case ECmdGetZoom:
|
|
177 |
TRAP(err, HandleGetZoomCmdL(aMessage.Right( aMessage.Length() - 1 )));
|
|
178 |
break;
|
|
179 |
case ECmdSetZoom:
|
|
180 |
TRAP(err, HandleSetZoomCmdL(aMessage.Right( aMessage.Length() - 1 )));
|
|
181 |
break;
|
|
182 |
default:
|
|
183 |
TRAP(err, SendErrorMessageL(KErrArgument, KErrorUnknownCmd));
|
|
184 |
break;
|
|
185 |
}
|
|
186 |
|
|
187 |
if(err != KErrNone)
|
|
188 |
{
|
|
189 |
iIsBusy = EFalse;
|
|
190 |
User::Leave( err );
|
|
191 |
}
|
|
192 |
|
|
193 |
HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::ProcessMessageL" );
|
|
194 |
}
|
|
195 |
|
31
|
196 |
void CHtiCameraServicePlugin::HandleInitializeCmdL( const TDesC8& aData )
|
28
|
197 |
{
|
31
|
198 |
HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleInitializeCmdL" );
|
28
|
199 |
if(aData.Length() != 0)
|
|
200 |
{
|
|
201 |
SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
|
|
202 |
return;
|
|
203 |
}
|
|
204 |
|
|
205 |
HTI_LOG_TEXT("Initializes Camera Application Engine");
|
31
|
206 |
if(iVideoRecordingEngine)
|
|
207 |
{
|
|
208 |
delete iVideoRecordingEngine;
|
|
209 |
iVideoRecordingEngine = NULL;
|
|
210 |
}
|
|
211 |
|
|
212 |
iVideoRecordingEngine = CEngineVideoRecording::NewL(*this, 0);
|
28
|
213 |
iVideoRecordingEngine->InitL();
|
|
214 |
iWaiter->Start();
|
|
215 |
if(iError != KErrNone)
|
|
216 |
{
|
|
217 |
SendErrorMessageL(iError, KErrorInitFailed);
|
|
218 |
}
|
|
219 |
else
|
|
220 |
{
|
|
221 |
HTI_LOG_TEXT("Initializes video recording");
|
|
222 |
iVideoRecordingEngine->InitVideoRecorderL();
|
|
223 |
|
|
224 |
SendOkMsgL(KNullDesC8);
|
|
225 |
}
|
|
226 |
|
31
|
227 |
HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleInitializeCmdL" );
|
28
|
228 |
}
|
|
229 |
|
31
|
230 |
void CHtiCameraServicePlugin::HandleUninitializeCmdL(const TDesC8& aData)
|
|
231 |
{
|
|
232 |
HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleUninitializeCmdL" );
|
|
233 |
if(aData.Length() != 0)
|
|
234 |
{
|
|
235 |
SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
|
|
236 |
return;
|
|
237 |
}
|
|
238 |
|
|
239 |
if(iVideoRecordingEngine == NULL)
|
|
240 |
{
|
|
241 |
SendErrorMessageL(KErrNotReady, KErrorUninitialized);
|
|
242 |
return;
|
|
243 |
}
|
|
244 |
|
|
245 |
delete iVideoRecordingEngine;
|
|
246 |
iVideoRecordingEngine = NULL;
|
|
247 |
|
|
248 |
SendOkMsgL(KNullDesC8);
|
|
249 |
HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleUninitializeCmdL" );
|
|
250 |
}
|
28
|
251 |
|
|
252 |
void CHtiCameraServicePlugin::HandlePrepareVideoRecordingCmdL( const TDesC8& aData )
|
|
253 |
{
|
|
254 |
HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandlePrepareVideoRecordingCmdL" );
|
|
255 |
if(aData.Length() < 2 || aData[1] != aData.Length() -2)
|
|
256 |
{
|
|
257 |
SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
|
|
258 |
return;
|
|
259 |
}
|
|
260 |
|
31
|
261 |
if(iVideoRecordingEngine == NULL)
|
|
262 |
{
|
|
263 |
SendErrorMessageL(KErrNotReady, KErrorUninitialized);
|
|
264 |
return;
|
|
265 |
}
|
|
266 |
|
28
|
267 |
TInt qualityLevelIndex = aData[0];
|
|
268 |
if(qualityLevelIndex < 0 || qualityLevelIndex > iVideoRecordingEngine->VideoQualityCount() -1)
|
|
269 |
{
|
|
270 |
SendErrorMessageL(KErrOverflow, KErrQualityLevel);
|
|
271 |
return;
|
|
272 |
}
|
|
273 |
|
|
274 |
TBuf<255> filePath;
|
|
275 |
TInt nextOffset = ParseString( aData, 1, filePath );
|
|
276 |
if ( filePath.Length() < 1 || nextOffset < 0 )
|
|
277 |
{
|
|
278 |
SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
|
|
279 |
return;
|
|
280 |
}
|
|
281 |
|
|
282 |
HTI_LOG_FORMAT("Set video recording file name: %S", &filePath);
|
|
283 |
iVideoRecordingEngine->SetVideoRecordingFileNameL(filePath);
|
|
284 |
|
|
285 |
HTI_LOG_FORMAT("Prepare video recording with quality level index: %d", qualityLevelIndex);
|
|
286 |
iVideoRecordingEngine->PrepareVideoRecordingL(qualityLevelIndex);
|
|
287 |
|
|
288 |
iWaiter->Start();
|
|
289 |
if(iError != KErrNone)
|
|
290 |
{
|
|
291 |
SendErrorMessageL(iError, KErrorPrepareVideoRecordingFailed);
|
|
292 |
}
|
|
293 |
else
|
|
294 |
{
|
|
295 |
SendOkMsgL(KNullDesC8);
|
|
296 |
}
|
|
297 |
|
|
298 |
HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandlePrepareVideoRecordingCmdL" );
|
|
299 |
}
|
|
300 |
|
|
301 |
void CHtiCameraServicePlugin::HandleStartVideoRecordingCmdL( const TDesC8& aData )
|
|
302 |
{
|
|
303 |
HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleStartVideoRecordingCmdL" );
|
|
304 |
if(aData.Length() != 0)
|
|
305 |
{
|
|
306 |
SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
|
|
307 |
return;
|
|
308 |
}
|
|
309 |
|
31
|
310 |
if(iVideoRecordingEngine == NULL)
|
|
311 |
{
|
|
312 |
SendErrorMessageL(KErrNotReady, KErrorUninitialized);
|
|
313 |
return;
|
|
314 |
}
|
|
315 |
|
28
|
316 |
HTI_LOG_TEXT("Start video recording...");
|
|
317 |
iVideoRecordingEngine->StartVideoRecording();
|
|
318 |
|
|
319 |
if(iError != KErrNone)
|
|
320 |
{
|
|
321 |
SendErrorMessageL(iError, KErrorStartVideoRecordingFailed);
|
|
322 |
}
|
|
323 |
else
|
|
324 |
{
|
|
325 |
SendOkMsgL(KNullDesC8);
|
|
326 |
}
|
|
327 |
|
|
328 |
HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleStartVideoRecordingCmdL" );
|
|
329 |
}
|
|
330 |
|
|
331 |
void CHtiCameraServicePlugin::HandlePausingVideoRecordingCmdL( const TDesC8& aData )
|
|
332 |
{
|
|
333 |
HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandlePausingVideoRecordingCmdL" );
|
|
334 |
if(aData.Length() != 0)
|
|
335 |
{
|
|
336 |
SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
|
|
337 |
return;
|
|
338 |
}
|
|
339 |
|
31
|
340 |
if(iVideoRecordingEngine == NULL)
|
|
341 |
{
|
|
342 |
SendErrorMessageL(KErrNotReady, KErrorUninitialized);
|
|
343 |
return;
|
|
344 |
}
|
|
345 |
|
28
|
346 |
HTI_LOG_TEXT("Pausing video recording");
|
|
347 |
iVideoRecordingEngine->PauseVideoRecording();
|
|
348 |
if(iError != KErrNone)
|
|
349 |
{
|
|
350 |
SendErrorMessageL(iError, KErrorPausingVideoRecordingFailed);
|
|
351 |
}
|
|
352 |
else
|
|
353 |
{
|
|
354 |
SendOkMsgL(KNullDesC8);
|
|
355 |
}
|
|
356 |
HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandlePausingVideoRecordingCmdL" );
|
|
357 |
}
|
|
358 |
|
|
359 |
void CHtiCameraServicePlugin::HandleResumeVideoRecordingCmdL( const TDesC8& aData )
|
|
360 |
{
|
|
361 |
HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleResumeVideoRecordingCmdL" );
|
|
362 |
if(aData.Length() != 0)
|
|
363 |
{
|
|
364 |
SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
|
|
365 |
return;
|
|
366 |
}
|
|
367 |
|
31
|
368 |
if(iVideoRecordingEngine == NULL)
|
|
369 |
{
|
|
370 |
SendErrorMessageL(KErrNotReady, KErrorUninitialized);
|
|
371 |
return;
|
|
372 |
}
|
|
373 |
|
28
|
374 |
HTI_LOG_TEXT("Resume video recording...");
|
|
375 |
iVideoRecordingEngine->ResumeVideoRecording();
|
|
376 |
|
|
377 |
if(iError != KErrNone)
|
|
378 |
{
|
|
379 |
SendErrorMessageL(iError, KErrorResumeVideoRecordingFailed);
|
|
380 |
}
|
|
381 |
else
|
|
382 |
{
|
|
383 |
SendOkMsgL(KNullDesC8);
|
|
384 |
}
|
|
385 |
HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleResumeVideoRecordingCmdL" );
|
|
386 |
}
|
|
387 |
|
|
388 |
void CHtiCameraServicePlugin::HandleStopVideoRecordingCmdL( const TDesC8& aData )
|
|
389 |
{
|
|
390 |
HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleStopVideoRecordingCmdL" );
|
|
391 |
if(aData.Length() != 0)
|
|
392 |
{
|
|
393 |
SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
|
|
394 |
return;
|
|
395 |
}
|
|
396 |
|
31
|
397 |
if(iVideoRecordingEngine == NULL)
|
|
398 |
{
|
|
399 |
SendErrorMessageL(KErrNotReady, KErrorUninitialized);
|
|
400 |
return;
|
|
401 |
}
|
|
402 |
|
28
|
403 |
HTI_LOG_TEXT("Stop video recording");
|
|
404 |
iVideoRecordingEngine->StopVideoRecording();
|
|
405 |
if(iError != KErrNone)
|
|
406 |
{
|
|
407 |
SendErrorMessageL(iError, KErrorStopVideoRecordingFailed);
|
|
408 |
}
|
|
409 |
else
|
|
410 |
{
|
|
411 |
SendOkMsgL(KNullDesC8);
|
|
412 |
}
|
|
413 |
HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleStopVideoRecordingCmdL" );
|
|
414 |
}
|
|
415 |
|
|
416 |
void CHtiCameraServicePlugin::HandleCloseVideoRecordingCmdL( const TDesC8& aData )
|
|
417 |
{
|
|
418 |
HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleCloseVideoRecordingCmdL" );
|
|
419 |
if(aData.Length() != 0)
|
|
420 |
{
|
|
421 |
SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
|
|
422 |
return;
|
|
423 |
}
|
|
424 |
|
31
|
425 |
if(iVideoRecordingEngine == NULL)
|
|
426 |
{
|
|
427 |
SendErrorMessageL(KErrNotReady, KErrorUninitialized);
|
|
428 |
return;
|
|
429 |
}
|
|
430 |
|
28
|
431 |
HTI_LOG_TEXT("Close video recording");
|
|
432 |
iVideoRecordingEngine->CloseVideoRecording();
|
|
433 |
SendOkMsgL(KNullDesC8);
|
|
434 |
HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleCloseVideoRecordingCmdL" );
|
|
435 |
}
|
|
436 |
|
|
437 |
void CHtiCameraServicePlugin::HandleGetZoomCmdL( const TDesC8& aData )
|
|
438 |
{
|
|
439 |
HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleGetZoomCmdL" );
|
|
440 |
if(aData.Length() != 0)
|
|
441 |
{
|
|
442 |
SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
|
|
443 |
return;
|
|
444 |
}
|
|
445 |
|
31
|
446 |
if(iVideoRecordingEngine == NULL)
|
|
447 |
{
|
|
448 |
SendErrorMessageL(KErrNotReady, KErrorUninitialized);
|
|
449 |
return;
|
|
450 |
}
|
|
451 |
|
28
|
452 |
TUint8 zoomMode = (TUint8)iVideoRecordingEngine->ZoomMode();
|
|
453 |
HTI_LOG_FORMAT("Current zoom mode: %d", zoomMode);
|
|
454 |
|
|
455 |
TUint32 zoomValue = iVideoRecordingEngine->ZoomValue();
|
|
456 |
HTI_LOG_FORMAT("Current zoom value: %d", zoomValue);
|
|
457 |
|
|
458 |
TUint32 zoomMinValue = iVideoRecordingEngine->MinZoomValue();
|
|
459 |
HTI_LOG_FORMAT("Min zoom value: %d", zoomMinValue);
|
|
460 |
|
|
461 |
TUint32 zoomMaxValue = iVideoRecordingEngine->MaxZoomValue();
|
|
462 |
HTI_LOG_FORMAT("Max zoom value: %d", zoomMaxValue);
|
|
463 |
|
|
464 |
TBuf8<13> buf;
|
|
465 |
buf.Append(zoomMode);
|
|
466 |
buf.Append((TUint8*)&zoomValue, 4);
|
|
467 |
buf.Append((TUint8*)&zoomMinValue, 4);
|
|
468 |
buf.Append((TUint8*)&zoomMaxValue, 4);
|
|
469 |
SendOkMsgL( buf );
|
|
470 |
|
|
471 |
HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleGetZoomCmdL" );
|
|
472 |
}
|
|
473 |
|
|
474 |
void CHtiCameraServicePlugin::HandleSetZoomCmdL( const TDesC8& aData )
|
|
475 |
{
|
|
476 |
HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleSetZoomCmdL" );
|
|
477 |
if(aData.Length() != 5)
|
|
478 |
{
|
|
479 |
SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
|
|
480 |
return;
|
|
481 |
}
|
|
482 |
|
31
|
483 |
if(iVideoRecordingEngine == NULL)
|
|
484 |
{
|
|
485 |
SendErrorMessageL(KErrNotReady, KErrorUninitialized);
|
|
486 |
return;
|
|
487 |
}
|
|
488 |
|
28
|
489 |
CEngineVideoRecording::TZoomMode zoomMode = (CEngineVideoRecording::TZoomMode)aData[0];
|
|
490 |
HTI_LOG_FORMAT("Set zoom mode: %d", zoomMode);
|
|
491 |
TRAPD(err, iVideoRecordingEngine->SetZoomModeL(zoomMode));
|
|
492 |
if(err != KErrNone)
|
|
493 |
{
|
|
494 |
SendErrorMessageL(err, KErrorSetZoomModeFailed);
|
|
495 |
}
|
|
496 |
else
|
|
497 |
{
|
|
498 |
TInt value = aData[1] + ( aData[2] << 8 )
|
|
499 |
+ ( aData[3] << 16 )
|
|
500 |
+ ( aData[4] << 24 );
|
|
501 |
HTI_LOG_FORMAT("Set zoom value: %d", value);
|
|
502 |
TRAPD(err, iVideoRecordingEngine->SetZoomValueL(value));
|
|
503 |
if(err != KErrNone)
|
|
504 |
{
|
|
505 |
SendErrorMessageL(err, KErrorSetZoomValueFailed);
|
|
506 |
}
|
|
507 |
else
|
|
508 |
{
|
|
509 |
SendOkMsgL(KNullDesC8);
|
|
510 |
}
|
|
511 |
}
|
|
512 |
|
|
513 |
HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleSetZoomCmdL" );
|
|
514 |
}
|
|
515 |
|
|
516 |
|
|
517 |
// -----------------------------------------------------------------------------
|
|
518 |
// CHtiCameraServicePlugin::IsBusy
|
|
519 |
// -----------------------------------------------------------------------------
|
|
520 |
//
|
|
521 |
TBool CHtiCameraServicePlugin::IsBusy()
|
|
522 |
{
|
|
523 |
return iIsBusy;
|
|
524 |
}
|
|
525 |
|
|
526 |
|
|
527 |
// ----------------------------------------------------------------------------
|
|
528 |
void CHtiCameraServicePlugin::SendOkMsgL( const TDesC8& aData )
|
|
529 |
{
|
|
530 |
HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::SendOkMsgL: Starting" );
|
|
531 |
|
|
532 |
User::LeaveIfNull( iDispatcher );
|
|
533 |
|
|
534 |
HBufC8* temp = HBufC8::NewL( aData.Length() + 1 );
|
|
535 |
TPtr8 response = temp->Des();
|
|
536 |
response.Append( ( TChar ) EResultOk );
|
|
537 |
response.Append( aData );
|
|
538 |
User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
|
|
539 |
temp, KCameraServiceUid ) );
|
|
540 |
iIsBusy = EFalse;
|
|
541 |
HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::SendOkMsgL: Done" );
|
|
542 |
}
|
|
543 |
|
|
544 |
// ----------------------------------------------------------------------------
|
|
545 |
void CHtiCameraServicePlugin::SendErrorMessageL( TInt aError, const TDesC8& aDescription )
|
|
546 |
{
|
|
547 |
HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::SendErrorMessageL: Starting" );
|
|
548 |
User::LeaveIfNull( iDispatcher );
|
|
549 |
User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
|
|
550 |
aError, aDescription, KCameraServiceUid ) );
|
|
551 |
iIsBusy = EFalse;
|
|
552 |
HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::SendErrorMessageL: Done" );
|
|
553 |
}
|
|
554 |
|
|
555 |
TInt CHtiCameraServicePlugin::ParseString( const TDesC8& aRequest,
|
|
556 |
TInt aOffset,
|
|
557 |
TDes& aResult )
|
|
558 |
{
|
|
559 |
HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::ParseString" );
|
|
560 |
|
|
561 |
// If offset outside the string return empty string
|
|
562 |
if ( aOffset >= aRequest.Size() )
|
|
563 |
{
|
|
564 |
return aOffset;
|
|
565 |
}
|
|
566 |
|
|
567 |
TInt length = aRequest[aOffset];
|
|
568 |
HTI_LOG_FORMAT( "String length = %d", length );
|
|
569 |
|
|
570 |
// If length is zero return empty string
|
|
571 |
if ( length < 1 )
|
|
572 |
{
|
|
573 |
return aOffset + 1;
|
|
574 |
}
|
|
575 |
|
|
576 |
if ( length > aResult.MaxLength() )
|
|
577 |
{
|
|
578 |
return KErrBadDescriptor;
|
|
579 |
}
|
|
580 |
|
|
581 |
TInt nextOffset = length + aOffset + 1;
|
|
582 |
HTI_LOG_FORMAT( "Next offset = %d", nextOffset );
|
|
583 |
HTI_LOG_FORMAT( "Request size = %d", aRequest.Size() );
|
|
584 |
|
|
585 |
if ( nextOffset > aRequest.Size() )
|
|
586 |
{
|
|
587 |
return KErrArgument;
|
|
588 |
}
|
|
589 |
|
|
590 |
aResult.Copy( aRequest.Mid( aOffset + 1, length ) );
|
|
591 |
|
|
592 |
HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::ParseString" );
|
|
593 |
return nextOffset;
|
|
594 |
}
|
|
595 |
|
|
596 |
void CHtiCameraServicePlugin::MevroInitComplete( TInt aError )
|
|
597 |
{
|
|
598 |
HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::MevroInitComplete" );
|
|
599 |
HTI_LOG_FORMAT("aError = %d", aError);
|
31
|
600 |
iError = aError;
|
28
|
601 |
iWaiter->AsyncStop();
|
|
602 |
HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::MevroInitComplete" );
|
|
603 |
}
|
|
604 |
|
|
605 |
void CHtiCameraServicePlugin::MevroVideoPrepareComplete(TInt aError)
|
|
606 |
{
|
|
607 |
HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::MevroVideoPrepareComplete" );
|
|
608 |
HTI_LOG_FORMAT("aError = %d", aError);
|
29
|
609 |
iError = aError;
|
28
|
610 |
iWaiter->AsyncStop();
|
|
611 |
HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::MevroVideoPrepareComplete" );
|
|
612 |
}
|
|
613 |
|
|
614 |
void CHtiCameraServicePlugin::MevroVideoRecordingOn(TInt aError)
|
|
615 |
{
|
|
616 |
HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::MevroVideoRecordingOn" );
|
|
617 |
HTI_LOG_FORMAT("aError = %d", aError);
|
29
|
618 |
iError = aError;
|
28
|
619 |
HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::MevroVideoRecordingOn" );
|
|
620 |
}
|
|
621 |
|
|
622 |
void CHtiCameraServicePlugin::MevroVideoRecordingPaused(TInt aError)
|
|
623 |
{
|
|
624 |
HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::MevroVideoRecordingPaused" );
|
|
625 |
HTI_LOG_FORMAT("aError = %d", aError);
|
29
|
626 |
iError = aError;
|
28
|
627 |
HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::MevroVideoRecordingPaused" );
|
|
628 |
}
|
|
629 |
|
|
630 |
void CHtiCameraServicePlugin::MevroVideoRecordingComplete(TInt aError)
|
|
631 |
{
|
|
632 |
HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::MevroVideoRecordingComplete" );
|
|
633 |
HTI_LOG_FORMAT("aError = %d", aError);
|
29
|
634 |
iError = aError;
|
28
|
635 |
HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::MevroVideoRecordingComplete" );
|
|
636 |
}
|
|
637 |
// End of File
|