camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakecameradevicecontrol.cpp
changeset 19 d9aefe59d544
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 #include "cxefakecameradevicecontrol.h"
       
    18 #include "cxenamespace.h"
       
    19 #include "cxutils.h"
       
    20 
       
    21 CxeFakeCameraDeviceControl::CxeFakeCameraDeviceControl()
       
    22     : CxeCameraDeviceControl(),
       
    23     mCameraIndex(Cxe::PrimaryCameraIndex),
       
    24     mCameraMode(Cxe::ImageMode),
       
    25     mState(CxeCameraDeviceControl::Idle)
       
    26 {
       
    27     CX_DEBUG_IN_FUNCTION();
       
    28 }
       
    29 
       
    30 CxeFakeCameraDeviceControl::~CxeFakeCameraDeviceControl()
       
    31 {
       
    32     CX_DEBUG_IN_FUNCTION();
       
    33 }
       
    34 
       
    35 /*!
       
    36     Get current camera mode.
       
    37 */
       
    38 Cxe::CameraMode CxeFakeCameraDeviceControl::mode() const
       
    39 {
       
    40     return mCameraMode;
       
    41 }
       
    42 
       
    43 /*!
       
    44     Set current camera mode.
       
    45 */
       
    46 void CxeFakeCameraDeviceControl::setMode(Cxe::CameraMode mode)
       
    47 {
       
    48     mCallHistory.append(SetMode);
       
    49     mCameraMode = mode;
       
    50 }
       
    51 
       
    52 /*!
       
    53     Initialize
       
    54 */
       
    55 void CxeFakeCameraDeviceControl::init()
       
    56 {
       
    57 }
       
    58 
       
    59 /*!
       
    60     Reserve camera hardware
       
    61 */
       
    62 void CxeFakeCameraDeviceControl::reserve()
       
    63 {
       
    64     mCallHistory.append(Reserve);
       
    65 }
       
    66 
       
    67 /*!
       
    68     Cancel all operations and release camera for other applications to use.
       
    69     Camera module is also powered off.
       
    70 */
       
    71 void CxeFakeCameraDeviceControl::release()
       
    72 {
       
    73     mCallHistory.append(Release);
       
    74 }
       
    75 
       
    76 /**
       
    77  * Get current camera index (primary or secondary).
       
    78  *
       
    79  * @return Current camera index
       
    80  */
       
    81 Cxe::CameraIndex CxeFakeCameraDeviceControl::cameraIndex() const {
       
    82 
       
    83     return mCameraIndex;
       
    84 }
       
    85 
       
    86 /**
       
    87  * Switch between primary and secondary camera.
       
    88  * @todo what happens if initMode is called during an ongoing operation?
       
    89  *
       
    90  * @param index New camera index
       
    91  */
       
    92 CxeError::Id CxeFakeCameraDeviceControl::switchCamera( Cxe::CameraIndex index )
       
    93 {
       
    94     mCallHistory.append(SwitchCamera);
       
    95 
       
    96     mCameraIndex = index;
       
    97 
       
    98     return CxeError::None;
       
    99 }
       
   100 
       
   101 /**
       
   102  * Get current device control state.
       
   103  *
       
   104  * @return Current state
       
   105  */
       
   106 CxeCameraDeviceControl::State CxeFakeCameraDeviceControl::state() const {
       
   107 
       
   108     return mState;
       
   109 }
       
   110 
       
   111 void CxeFakeCameraDeviceControl::setState(
       
   112         CxeCameraDeviceControl::State newState)
       
   113 {
       
   114     mState = newState;
       
   115 
       
   116     emit stateChanged(mState, CxeError::None);
       
   117     if (mState == CxeCameraDeviceControl::Ready) {
       
   118         emit initModeComplete(CxeError::None);
       
   119     }
       
   120 }
       
   121 
       
   122 void CxeFakeCameraDeviceControl::HandleEvent(const TECAMEvent &/*aEvent*/)
       
   123 {
       
   124 }
       
   125 
       
   126 void CxeFakeCameraDeviceControl::ViewFinderReady(
       
   127         MCameraBuffer &/*aCameraBuffer*/, TInt /*aError*/)
       
   128 {
       
   129 }
       
   130 void CxeFakeCameraDeviceControl::ImageBufferReady(
       
   131         MCameraBuffer &/*aCameraBuffer*/, TInt /*aError*/)
       
   132 {
       
   133 }
       
   134 void CxeFakeCameraDeviceControl::VideoBufferReady(
       
   135         MCameraBuffer &/*aCameraBuffer*/, TInt /*aError*/)
       
   136 {
       
   137 }
       
   138 
       
   139 QList<CxeFakeCameraDeviceControl::MethodIndex> CxeFakeCameraDeviceControl::callHistory() const
       
   140 {
       
   141     return mCallHistory;
       
   142 }
       
   143 
       
   144 void CxeFakeCameraDeviceControl::resetCallHistory()
       
   145 {
       
   146     mCallHistory.clear();
       
   147 }
       
   148 
       
   149 // end of file