camerauis/cameraxui/cxengine/inc/cxeautofocuscontrolsymbian.h
branchRCL_3
changeset 24 bac7acad7cb3
parent 23 61bc0f252b2b
child 25 2c87b2808fd7
equal deleted inserted replaced
23:61bc0f252b2b 24:bac7acad7cb3
     1 /*
       
     2 * Copyright (c) 2009-2010 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 
       
    18 #ifndef CXEAUTOFOCUSCONTROLSYMBIAN_H
       
    19 #define CXEAUTOFOCUSCONTROLSYMBIAN_H
       
    20 
       
    21 #include <QVariant>
       
    22 #include <ecam.h> // CCamera
       
    23 #include <ecam/ecamadvsettingsintf.h> // CCamera
       
    24 #include "cxenamespace.h"
       
    25 #include "cxeautofocuscontrol.h"
       
    26 #include "cxestatemachine.h"
       
    27 
       
    28 //forward declarations
       
    29 class CxeCameraDevice;
       
    30 class CxeSettings;
       
    31 
       
    32 
       
    33 
       
    34 /**
       
    35  * CxeAutoFocusControl is responsible for handling Autofocus events from the camera adaptation.
       
    36  * It also routes the Autofocus successful and failed events to the clients interested in Žknowing the
       
    37  * status of Autofocus.
       
    38  */
       
    39 class CxeAutoFocusControlSymbian : public CxeAutoFocusControl,
       
    40                                    public CxeStateMachine
       
    41     {
       
    42     Q_OBJECT
       
    43 public:
       
    44 
       
    45     CxeAutoFocusControlSymbian( CxeCameraDevice &cameraDevice, CxeSettings &settings );
       
    46     virtual ~CxeAutoFocusControlSymbian();
       
    47 
       
    48     CxeError::Id  start(bool soundEnabled = true);
       
    49     void cancel();
       
    50     void setMode( CxeAutoFocusControl::Mode newMode );
       
    51     CxeAutoFocusControl::Mode mode() const;
       
    52     bool isFixedFocusMode(CxeAutoFocusControl::Mode mode) const;
       
    53 
       
    54     CxeAutoFocusControl::State state() const;
       
    55     bool supported() const;
       
    56 
       
    57     bool isSoundEnabled() const;
       
    58 
       
    59 protected: // from CxeStateMachine
       
    60     void handleStateChanged( int newStateId, CxeError::Id error );
       
    61 
       
    62 protected:
       
    63     void initializeStates();
       
    64     // intializes all the resources we need for AF functionality
       
    65     void initializeResources();
       
    66 
       
    67     void setFocusRange(CCamera::CCameraAdvancedSettings::TFocusRange range);
       
    68     CCamera::CCameraAdvancedSettings::TFocusRange  focusRange() const;
       
    69 
       
    70     void setFocusType(CCamera::CCameraAdvancedSettings::TAutoFocusType type);
       
    71     int supportedFocusTypes() const;
       
    72     CCamera::CCameraAdvancedSettings::TAutoFocusType focusType() const;
       
    73 
       
    74 protected slots:
       
    75 
       
    76     // notifications when camera reference is changed
       
    77     void prepareForCameraDelete();
       
    78     void handleCameraAllocated(CxeError::Id error);
       
    79 
       
    80     // notification for when camera is released
       
    81     void prepareForRelease();
       
    82 
       
    83     // Handle ECam events
       
    84     void handleCameraEvent( int eventUid, int error );
       
    85     void handleSceneChanged(const QVariant &scene);
       
    86     void handleSettingValueChanged(const QString &settingId, QVariant newValue);
       
    87 
       
    88 private:
       
    89 
       
    90     // handles to-do things if the event is AF event
       
    91     void handleAfEvent(int eventUid, int error);
       
    92 
       
    93 protected:
       
    94     CxeCameraDevice &mCameraDevice;
       
    95     CCamera::CCameraAdvancedSettings *mAdvancedSettings; // not owned
       
    96     CxeAutoFocusControl::Mode mAfMode;
       
    97     CCamera::CCameraAdvancedSettings::TFocusRange mAFRange;
       
    98     CxeSettings &mSettings;
       
    99     bool mCancelled;
       
   100     bool mSoundEnabled;
       
   101     bool mFaceTrackingOverride; //need for temporary override of the AF mode if FT is enabled by user
       
   102     CxeAutoFocusControl::Mode mPreviousAFMode; //for restoring previous AF mode in case of FT override
       
   103     };
       
   104 
       
   105 #endif // CXEAUTOFOCUSCONTROLSYMBIAN_H