camerauis/cameraapp/generic/src/cameracontroller/camsnapshotprovider.cpp
branchRCL_3
changeset 24 bac7acad7cb3
parent 0 1ddebce53859
equal deleted inserted replaced
23:61bc0f252b2b 24:bac7acad7cb3
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Implemantation of CCamSnapshotProvider class.
       
    15 *                Handles different setups of CCamSnapshot and CCameraSnapshot.
       
    16 *                For example secondary camera does not always support 
       
    17 *                CCameraSnapshot.
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 // ===========================================================================
       
    23 // Includes
       
    24 #include <ecam.h>           // CCamera, MCameraObserver2
       
    25 #include <ecam/camerasnapshot.h> // CCameraSnapshot
       
    26 
       
    27 #include "camcameracontroller.pan"
       
    28 #include "camlogging.h"
       
    29 #include "camsnapshot.h"
       
    30 #include "camsnapshotprovider.h"
       
    31 
       
    32 
       
    33 
       
    34 // ===========================================================================
       
    35 // Constants etc
       
    36 using namespace NCamCameraController;
       
    37 
       
    38 
       
    39 // ===========================================================================
       
    40 // Methods (see also inline methods in .inl)
       
    41 
       
    42 // ---------------------------------------------------------------------------
       
    43 //
       
    44 // ---------------------------------------------------------------------------
       
    45 //
       
    46 CCamSnapshotProvider* 
       
    47 CCamSnapshotProvider::NewL( CCamera&              aCamera,
       
    48                             MCameraObserver2&     aObserver, 
       
    49                             MCamCameraObservable& aObservable )
       
    50   {
       
    51   CCamSnapshotProvider* self = new (ELeave) CCamSnapshotProvider;
       
    52 
       
    53   CleanupStack::PushL( self );
       
    54   self->ConstructL( aCamera, aObserver, aObservable );
       
    55   CleanupStack::Pop( self );
       
    56 
       
    57   return self;
       
    58   }
       
    59 
       
    60 // ---------------------------------------------------------------------------
       
    61 //
       
    62 // ---------------------------------------------------------------------------
       
    63 //
       
    64 CCamSnapshotProvider::~CCamSnapshotProvider()
       
    65   {
       
    66   delete iSs1;
       
    67   delete iSs2;
       
    68   }
       
    69 
       
    70 // ---------------------------------------------------------------------------
       
    71 //
       
    72 // ---------------------------------------------------------------------------
       
    73 //
       
    74 void 
       
    75 CCamSnapshotProvider::ConstructL( CCamera&              aCamera, 
       
    76                                   MCameraObserver2&     aObserver, 
       
    77                                   MCamCameraObservable& aObservable )
       
    78   {
       
    79   PRINT( _L("Camera => CCamSnapshotProvider::ConstructL") );
       
    80 #ifdef CAMERAAPP_CAPI_V2_SS 
       
    81   TRAPD( error, iSs1 = CCamera::CCameraSnapshot::NewL( aCamera ) );
       
    82 
       
    83   PRINT1( _L("Camera <> status from CCameraSnapshot::NewL: %d"), error );
       
    84   if( KErrNone != error )
       
    85     {
       
    86     if( KErrNotSupported == error )
       
    87       {
       
    88       PRINT( _L("Camera <> CCameraSnapshot not supported, use CCamSnapshot..") );
       
    89       iSs2 = CCamSnapshot::NewL( aCamera, aObserver, aObservable );
       
    90       }
       
    91     else
       
    92       {
       
    93       User::Leave( error );
       
    94       }
       
    95     }
       
    96 #else
       
    97   iSs1 = NULL;
       
    98   iSs2 = CCamSnapshot::NewL( aCamera, aObserver, aObservable );
       
    99 #endif
       
   100 
       
   101   __ASSERT_ALWAYS( iSs1 || iSs2, Panic( ECamNullPointer ) );
       
   102   PRINT( _L("Camera <= CCamSnapshotProvider::ConstructL") );
       
   103   }
       
   104 
       
   105 // ---------------------------------------------------------------------------
       
   106 //
       
   107 // ---------------------------------------------------------------------------
       
   108 //
       
   109 CCamSnapshotProvider::CCamSnapshotProvider()
       
   110   {
       
   111   }
       
   112 
       
   113 
       
   114 
       
   115 // ===========================================================================
       
   116 // end of file