camerauis/cameraapp/generic/dummyengine/CameraappDummyEngine.cpp
branchRCL_3
changeset 24 bac7acad7cb3
parent 0 1ddebce53859
equal deleted inserted replaced
23:61bc0f252b2b 24:bac7acad7cb3
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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:  Camera Application Engine implementation still capturing,*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 
       
    21 #include <CaeEngine.h>
       
    22 #include "CameraappDummyEngine.h"              // Engine implementation header.
       
    23 #include "CamLogger.h"
       
    24 #include "CameraappDummyCallbackActive.h"
       
    25 
       
    26 
       
    27 // ============================ MEMBER FUNCTIONS ===============================
       
    28 
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // CCaeEngine::NewL
       
    32 // Two-phased constructor. Calls CCaeEngineImp's NewL().
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 CCaeEngine* CCameraappDummyEngine::NewL()
       
    36     {
       
    37     return CCameraappDummyEngineImp::NewL();
       
    38     }
       
    39 
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // CCameraappDummyEngineImp::CCameraappDummyEngineImp
       
    43 // Default constructor.
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 CCameraappDummyEngineImp::CCameraappDummyEngineImp()
       
    47     {
       
    48     }
       
    49 
       
    50 void CCameraappDummyEngineImp::SetCamAppEngineObserver( MCamAppEngineObserver& aObserver )
       
    51     {
       
    52     iObserver = &aObserver;
       
    53     if ( !iCallBackActive )
       
    54         {
       
    55         TRAPD( ignore, iCallBackActive = CCameraappDummyCallbackActive::NewL( *iObserver ) )
       
    56         if ( ignore )
       
    57             { 
       
    58             // Do nothing ( removes build warning )
       
    59             }                     
       
    60         }
       
    61     }
       
    62 
       
    63 // -----------------------------------------------------------------------------
       
    64 // CCameraappDummyEngineImp::~CCameraappDummyEngineImp
       
    65 // Destructor.
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 CCameraappDummyEngineImp::~CCameraappDummyEngineImp()
       
    69     {
       
    70     if ( iCallBackActive )
       
    71         {
       
    72         iCallBackActive->Cancel();
       
    73         delete iCallBackActive;
       
    74         }
       
    75     }
       
    76 
       
    77 void CCameraappDummyEngineImp::InitL( TBool /*aCreateSnapImage*/ )
       
    78     {
       
    79     if ( iCallBackActive )
       
    80         {
       
    81         iCallBackActive->InitComplete();
       
    82         }
       
    83     }
       
    84 
       
    85 void CCameraappDummyEngineImp::Reserve()
       
    86     {
       
    87     if ( iCallBackActive )
       
    88         {
       
    89         iCallBackActive->InitComplete();
       
    90         }
       
    91     }
       
    92 
       
    93 void CCameraappDummyEngineImp::StartViewFinderBitmapsL( TSize& /*aSize*/ )
       
    94     {
       
    95     iIsViewFinding = ETrue;
       
    96     if ( !iCallBackActive )
       
    97         {
       
    98         iCallBackActive = CCameraappDummyCallbackActive::NewL( *iObserver );
       
    99         }
       
   100 
       
   101     if ( iCallBackActive )
       
   102         {
       
   103         iCallBackActive->SendViewFinderFrames();
       
   104         }
       
   105     }
       
   106 
       
   107 void CCameraappDummyEngineImp::StopViewFinder()
       
   108     {
       
   109     if ( iIsViewFinding )
       
   110         {
       
   111         iIsViewFinding = EFalse;
       
   112         if ( iCallBackActive )
       
   113             {
       
   114             iCallBackActive->StopViewFinderFrames();
       
   115             }
       
   116         }
       
   117     }
       
   118 
       
   119 TBool CCameraappDummyEngineImp::IsViewFinding() const
       
   120     {
       
   121     return iIsViewFinding;
       
   122     }
       
   123 
       
   124 void CCameraappDummyEngineImp::SetCaeStillBurstObserver( MCaeStillBurstObserver& aObserver )
       
   125     {
       
   126     if ( iCallBackActive )
       
   127         {
       
   128         iCallBackActive->SetBurstObserver( &aObserver );
       
   129         }
       
   130     }
       
   131 
       
   132 void CCameraappDummyEngineImp::StopStillBurstCapture()
       
   133     {
       
   134     if ( iCallBackActive )
       
   135         {
       
   136         iCallBackActive->StopBurst();
       
   137         }  
       
   138     }
       
   139 
       
   140 
       
   141 TInt CCameraappDummyEngineImp::SetStillCaptureImageCountL( TInt aImageCount )
       
   142     {
       
   143     iImageCount = aImageCount;
       
   144     return KErrNone;
       
   145     }
       
   146 
       
   147 void CCameraappDummyEngineImp::PrepareStillCaptureL(
       
   148                                             const TSize& /*aSize*/, 
       
   149                                             CCamera::TFormat /*aFormat*/,  
       
   150                                             TInt /*aCompressionQuality*/, 
       
   151                                             const TRect& /*aCropRect*/,
       
   152                                             TSize& /*aSnapSize*/ )
       
   153     {
       
   154     iVideoPrepared = EFalse;
       
   155     if ( iCallBackActive )
       
   156         {
       
   157         iCallBackActive->StillPrepareComplete();
       
   158         }       
       
   159     }
       
   160 
       
   161 void CCameraappDummyEngineImp::CaptureStill()
       
   162     {
       
   163     if ( iImageCount < 1 || !iCallBackActive )
       
   164         {
       
   165         return;
       
   166         }
       
   167     if ( iImageCount == 1 )
       
   168         {
       
   169         iCallBackActive->CaptureStill();
       
   170         }
       
   171     else
       
   172         {       
       
   173         iCallBackActive->CaptureBurst( iImageCount );
       
   174         }
       
   175     }
       
   176 
       
   177 void CCameraappDummyEngineImp::StopVideoRecording()
       
   178     {
       
   179     if ( iCallBackActive )
       
   180         {
       
   181         iCallBackActive->VideoRecordingStopped();
       
   182         }
       
   183     }
       
   184 
       
   185 void CCameraappDummyEngineImp::PauseVideoRecording()
       
   186     {
       
   187     if ( iCallBackActive )
       
   188         {
       
   189         iCallBackActive->VideoRecordingPaused();
       
   190         }
       
   191     }
       
   192 
       
   193 void CCameraappDummyEngineImp::StartVideoRecording()
       
   194     {
       
   195     if ( iCallBackActive )
       
   196         {
       
   197         iCallBackActive->VideoRecordingResumed();
       
   198         }    
       
   199     }
       
   200 
       
   201 void CCameraappDummyEngineImp::ResumeVideoRecording()
       
   202     {
       
   203     if ( iCallBackActive )
       
   204         {
       
   205         iCallBackActive->VideoRecordingResumed();
       
   206         }
       
   207     }
       
   208 
       
   209 void CCameraappDummyEngineImp::SetVideoRecordingFileNameL( 
       
   210                                 const TDesC& /*aVideoClipFileName*/ )
       
   211     {
       
   212     if ( iVideoPrepared && iCallBackActive )
       
   213         {
       
   214         iCallBackActive->VideoPrepareComplete();
       
   215         }  
       
   216     }
       
   217 
       
   218 void CCameraappDummyEngineImp::PrepareVideoRecordingL(
       
   219                                         const TSize&  /*aFrameSize*/, 
       
   220                                         TReal32       /*aFrameRate*/, 
       
   221                                         TInt          /*aBitRate*/, 
       
   222                                         TBool         /*aAudioEnabled*/,
       
   223                                         TInt          /*aAudioBitRate*/, 
       
   224                                         const TDesC8& /*aMimeType*/, 
       
   225                                         const TDesC&  /*aPreferredSupplier*/, 
       
   226                                         const TDesC8& /*aVideoType*/, 
       
   227                                         const TDesC8& /*aAudioType*/ )
       
   228     {
       
   229     iVideoPrepared = ETrue;
       
   230     if ( iCallBackActive )
       
   231         {
       
   232         iCallBackActive->VideoPrepareComplete();
       
   233         }  
       
   234     }
       
   235 
       
   236 // -----------------------------------------------------------------------------
       
   237 // CCameraappDummyEngineImp::ConstructL
       
   238 // Symbian 2nd phase constructor that can leave.
       
   239 // -----------------------------------------------------------------------------
       
   240 //
       
   241 void CCameraappDummyEngineImp::ConstructL()
       
   242     {
       
   243     iImageCount = 1;
       
   244     }
       
   245 
       
   246 
       
   247 
       
   248 
       
   249 void CCameraappDummyEngineImp::GetInfo( TCamAppEngineInfo& aInfo ) const
       
   250     {
       
   251     aInfo.iMaxDigitalZoom = 20;
       
   252     aInfo.iFlashModesSupported = CCamera::EFlashNone | 
       
   253     							 CCamera::EFlashAuto | 
       
   254     							 CCamera::EFlashForced;
       
   255     							 
       
   256     aInfo.iWhiteBalanceModesSupported = CCamera::EWBAuto |
       
   257     									CCamera::EWBDaylight |
       
   258     									CCamera::EWBCloudy |
       
   259     									CCamera::EWBTungsten |
       
   260     									CCamera::EWBFluorescent;
       
   261     }
       
   262 
       
   263 
       
   264 void CCameraappDummyEngineImp::SetZoomValueL( TInt aZoomValue )    
       
   265     {
       
   266     iZoomValue = aZoomValue;
       
   267 
       
   268     TBuf <100> buf;
       
   269     buf.Format( _L("__zm %d, val %d__"), iZoomMode, iZoomValue );
       
   270     User::InfoPrint( buf );   
       
   271     }
       
   272 
       
   273 
       
   274 
       
   275 TInt CCameraappDummyEngineImp::ZoomValue() const
       
   276     { 
       
   277     return iZoomValue; 
       
   278     }
       
   279     
       
   280     
       
   281 void CCameraappDummyEngineImp::SetZoomModeL( CCaeEngine::TZoomMode aZoomMode )    
       
   282     {
       
   283     iZoomMode = aZoomMode;
       
   284     
       
   285     TBuf <100> buf;
       
   286     buf.Format( _L("__zm %d, val %d__"), iZoomMode, iZoomValue );
       
   287     User::InfoPrint( buf );
       
   288     }
       
   289 
       
   290 void CCameraappDummyEngineImp::GetOrderL( RCaeOrderedFeatureList& /*aOrderedFeatureList*/ )
       
   291     {
       
   292     }
       
   293    
       
   294 void CCameraappDummyEngineImp::SetOrderL( const RCaeOrderedFeatureList& /*aOrderedFeatureList*/ )
       
   295     {
       
   296     }
       
   297    
       
   298 void CCameraappDummyEngineImp::SetSnapImageSourceL( TSnapImageSource /*aSnapImageSource*/ )
       
   299     {
       
   300     }
       
   301     
       
   302 void CCameraappDummyEngineImp::SetImageCodecsL( TUid/*aDecoderUid*/, TUid /*aEncoderUid*/ )
       
   303     {
       
   304     }    
       
   305 
       
   306 TInt CCameraappDummyEngineImp::CamerasAvailable()
       
   307     {
       
   308     return 2;
       
   309     }
       
   310 
       
   311 
       
   312 TInt CCameraappDummyEngineImp::EnumerateVideoFrameSizeL( const TSize& /*aSize*/ ) { return 0; };
       
   313         
       
   314 TInt CCameraappDummyEngineImp::CCameraHandle() const { return 1; };
       
   315 
       
   316 void CCameraappDummyEngineImp::EnableVideoRecording() {};
       
   317         
       
   318 void CCameraappDummyEngineImp::DisableVideoRecording() {};
       
   319 
       
   320 void CCameraappDummyEngineImp::SetCaeExtensionModeL( TBool aExtModeActive, TBool aCreateSnapImage )
       
   321     {
       
   322     (void)aExtModeActive; // removes compiler warning
       
   323     (void)aCreateSnapImage; // removes compiler warning
       
   324     }
       
   325 
       
   326 void CCameraappDummyEngineImp::ProcessExtViewFinderFrameReadyL( CFbsBitmap& aFrame )
       
   327     {
       
   328     (void)aFrame; // removes compiler warning
       
   329     }
       
   330 
       
   331 void CCameraappDummyEngineImp::ProcessExtSnapImageL( CFbsBitmap& aSnapImage )
       
   332     {
       
   333     (void)aSnapImage; // removes compiler warning
       
   334     }        
       
   335 
       
   336 void CCameraappDummyEngineImp::ProcessExtCapturedImageL( CFbsBitmap& aBitmap, TBool aLastImage )
       
   337     {
       
   338     (void)aBitmap; // removes compiler warning
       
   339     (void)aLastImage; // removes compiler warning
       
   340     }
       
   341 
       
   342 void CCameraappDummyEngineImp::ProcessExtCapturedImageL( HBufC8* aImageData, TBool aLastImage )
       
   343     {
       
   344     (void)aImageData; // removes compiler warning
       
   345     (void)aLastImage; // removes compiler warning
       
   346     }
       
   347 
       
   348 void CCameraappDummyEngineImp::ProcessExtCapturedImageL( TDesC8& aImageDataDes, TBool aLastImage )
       
   349     {
       
   350     (void)aImageDataDes; //removes compiler warning
       
   351     (void)aLastImage; // removes compiler warning
       
   352     }
       
   353 
       
   354 void CCameraappDummyEngineImp::ProcessExtCancel()
       
   355     {
       
   356     }
       
   357 
       
   358 void CCameraappDummyEngineImp::SkippedExtensionListL( RCaeOrderedFeatureList& aSkippedExtensions )
       
   359     {
       
   360     (void)aSkippedExtensions; // removes compiler warning
       
   361     }
       
   362 
       
   363 void CCameraappDummyEngineImp::SetSkippedExtensionList( RCaeOrderedFeatureList& aSkippedExtensions )
       
   364     {
       
   365     (void)aSkippedExtensions; // removes compiler warning
       
   366     }
       
   367 
       
   368 TInt CCameraappDummyEngineImp::SetAsyncVideoStopMode( TBool aAsyncVideoStopEnabled ) 
       
   369     {
       
   370     (void)aAsyncVideoStopEnabled; // removes compiler warning
       
   371     return KErrNone; 
       
   372     }
       
   373 
       
   374 // -----------------------------------------------------------------------------
       
   375 // CCaeEngineImp::NewL
       
   376 // Two-phased constructor.
       
   377 // -----------------------------------------------------------------------------
       
   378 //
       
   379 CCameraappDummyEngineImp* CCameraappDummyEngineImp::NewL()
       
   380     {
       
   381     CCameraappDummyEngineImp* self = new( ELeave ) CCameraappDummyEngineImp();
       
   382 
       
   383     CleanupStack::PushL( self );
       
   384     self->ConstructL();
       
   385     CleanupStack::Pop( self );
       
   386 
       
   387     return self;
       
   388     }
       
   389 
       
   390 //  End of File