browser/engine/inc/Camera.h
changeset 0 c316ab048e9d
equal deleted inserted replaced
-1:000000000000 0:c316ab048e9d
       
     1 /*
       
     2  * Name        : Camera.h
       
     3  * Description : Camera helper class
       
     4  * Project     : This file is part of OpenMAR, an Open Mobile Augmented Reality browser
       
     5  * Website     : http://OpenMAR.org
       
     6  *
       
     7  * Copyright (c) 2010 David Caabeiro
       
     8  *
       
     9  * All rights reserved. This program and the accompanying materials are made available 
       
    10  * under the terms of the Eclipse Public License v1.0 which accompanies this 
       
    11  * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
       
    12  *
       
    13  */
       
    14 
       
    15 #ifndef CAMERA_H_
       
    16 #define CAMERA_H_
       
    17 
       
    18 #include <ECam.h>
       
    19 
       
    20 class CFbsBitmap;
       
    21 
       
    22 /**
       
    23  * @brief Wrapper class over CCamera
       
    24  * 
       
    25  * Implemented to use the minimum frame size 
       
    26  */
       
    27 class CDigitalCamera : public CBase, 
       
    28             public MCameraObserver,
       
    29             public MCameraObserver2
       
    30 {
       
    31 public:
       
    32     class MObserver
       
    33     {
       
    34     public:
       
    35         virtual void CameraReady(TInt aError) = 0;
       
    36         virtual void CameraFrame(CFbsBitmap& aFrame) = 0;
       
    37         virtual void FocusReady(TInt aError) = 0;
       
    38     };
       
    39 
       
    40 public:
       
    41     static CDigitalCamera* NewL(MObserver& aObserver);
       
    42     ~CDigitalCamera();
       
    43 
       
    44 protected:
       
    45     CDigitalCamera(MObserver& aObserver);
       
    46     void ConstructL();
       
    47 
       
    48 public:
       
    49     void Start();
       
    50     void Stop();
       
    51 
       
    52     void StartFocus();
       
    53 
       
    54     const TSize& ViewportSize() const { return iViewportSize; }
       
    55 
       
    56 protected:
       
    57     // From MCameraObserver
       
    58     void ReserveComplete(TInt aError);
       
    59     void PowerOnComplete(TInt aError);
       
    60     void ViewFinderFrameReady(CFbsBitmap& aFrame);
       
    61     void ImageReady(CFbsBitmap* aBitmap, HBufC8* aData, TInt aError);
       
    62     void FrameBufferReady(MFrameBuffer* aFrameBuffer, TInt aError);
       
    63 
       
    64     // From MCameraObserver2
       
    65     void HandleEvent(const TECAMEvent& aEvent);
       
    66     void ViewFinderReady(MCameraBuffer& aCameraBuffer, TInt aError);
       
    67     void ImageBufferReady(MCameraBuffer& aCameraBuffer, TInt aError);
       
    68     void VideoBufferReady(MCameraBuffer& aCameraBuffer, TInt aError);
       
    69 
       
    70 private:
       
    71     MObserver& iObserver;
       
    72     CCamera* iCamera;
       
    73     CCamera::CCameraAdvancedSettings* iCameraSetting;
       
    74     TSize iViewportSize;
       
    75 };
       
    76 
       
    77 #endif