camerauis/cameraxui/cxengine/inc/cxecameradevicecontrolsymbian.h
changeset 19 d9aefe59d544
child 51 ccc0e7e3344f
equal deleted inserted replaced
3:8b2d6d0384b0 19:d9aefe59d544
       
     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:
       
    15 *
       
    16 */
       
    17 #ifndef CXECAMERADEVICECONTROLSYMBIAN_H
       
    18 #define CXECAMERADEVICECONTROLSYMBIAN_H
       
    19 
       
    20 //  Include Files
       
    21 
       
    22 #include "cxecameradevicecontrol.h"
       
    23 #include "cxecameradevice.h"
       
    24 #include "cxestatemachine.h"
       
    25 #include "cxeerror.h"
       
    26 
       
    27 class CxeCameraDeviceControlSymbian : public CxeCameraDeviceControl,
       
    28                                       public CxeStateMachine,
       
    29                                       public MCameraObserver2
       
    30 {
       
    31     Q_OBJECT
       
    32 
       
    33 public:
       
    34 
       
    35     CxeCameraDeviceControlSymbian();
       
    36     virtual ~CxeCameraDeviceControlSymbian();
       
    37 
       
    38 public: // from CxeCameraDeviceControl
       
    39 
       
    40     /**
       
    41     * Calls newCamera and emits initModeComplete() on error.
       
    42     * This is in a separate method and not in the constructor so that
       
    43     * newCamera() can be properly overridden in derived classes.
       
    44     */
       
    45     void init();
       
    46     Cxe::CameraMode mode() const;
       
    47     void setMode(Cxe::CameraMode mode);
       
    48     void reserve();
       
    49     void release();
       
    50     Cxe::CameraIndex cameraIndex() const;
       
    51     CxeError::Id switchCamera(Cxe::CameraIndex index);
       
    52     State state() const;
       
    53     CxeCameraDevice *cameraDevice();
       
    54 
       
    55 protected: // from CxeStateMachine
       
    56     void handleStateChanged(int newStateId, CxeError::Id error);
       
    57 
       
    58 protected:
       
    59     void initializeStates();
       
    60     void powerOn();
       
    61     void prepare(int mode);
       
    62     void releaseCurrentCamera();
       
    63     void doHandleEvent(const TECAMEvent &aEvent);
       
    64     void handleReserveComplete(int error);
       
    65     void handlePowerOnComplete(int error);
       
    66     void handleNoLongerReserved(int error);
       
    67 
       
    68 protected: // from MCameraObserver2
       
    69     void HandleEvent(const TECAMEvent &aEvent);
       
    70     void ViewFinderReady(MCameraBuffer &aCameraBuffer, TInt aError);
       
    71     void ImageBufferReady(MCameraBuffer &aCameraBuffer, TInt aError);
       
    72     void VideoBufferReady(MCameraBuffer &aCameraBuffer, TInt aError);
       
    73 
       
    74 signals:
       
    75     void cameraEvent(int eventUid, int error); // ECam events
       
    76     void imageBufferReady(MCameraBuffer* buffer, int error);
       
    77     void deviceReady(); // device is ready to prepared in either still or video mode
       
    78     void vfFrameReady(MCameraBuffer* buffer, int error);
       
    79 
       
    80 protected: // Protected data so that unit test cases can replace
       
    81            // mCameraDevice with a fake implementation.
       
    82     CxeCameraDevice *mCameraDevice; // own
       
    83 
       
    84 protected: // data
       
    85     Cxe::CameraIndex mCameraIndex;
       
    86     Cxe::CameraMode  mCameraMode;
       
    87 };
       
    88 
       
    89 #endif  // CXECAMERADEVICECONTROLSYMBIAN_H
       
    90