|
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 |
|
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 |
|
31 |
|
32 |
|
33 /** |
|
34 * CxeAutoFocusControl is responsible for handling Autofocus events from the camera adaptation. |
|
35 * It also routes the Autofocus successful and failed events to the clients interested in Žknowing the |
|
36 * status of Autofocus. |
|
37 */ |
|
38 class CxeAutoFocusControlSymbian : public CxeAutoFocusControl, |
|
39 public CxeStateMachine |
|
40 { |
|
41 Q_OBJECT |
|
42 public: |
|
43 |
|
44 CxeAutoFocusControlSymbian( CxeCameraDevice &cameraDevice ); |
|
45 virtual ~CxeAutoFocusControlSymbian(); |
|
46 |
|
47 CxeError::Id start(); |
|
48 void cancel(); |
|
49 void setMode( CxeAutoFocusControl::Mode newMode ); |
|
50 CxeAutoFocusControl::Mode mode() const; |
|
51 |
|
52 CxeAutoFocusControl::State state() const; |
|
53 bool supported() const; |
|
54 |
|
55 protected: // from CxeStateMachine |
|
56 void handleStateChanged( int newStateId, CxeError::Id error ); |
|
57 |
|
58 protected: |
|
59 void initializeStates(); |
|
60 // intializes all the resources we need for AF functionality |
|
61 void initializeResources(); |
|
62 |
|
63 void setFocusRange(CCamera::CCameraAdvancedSettings::TFocusRange range); |
|
64 CCamera::CCameraAdvancedSettings::TFocusRange focusRange() const; |
|
65 |
|
66 void setFocusType(CCamera::CCameraAdvancedSettings::TAutoFocusType type); |
|
67 int supportedFocusTypes() const; |
|
68 CCamera::CCameraAdvancedSettings::TAutoFocusType focusType() const; |
|
69 |
|
70 protected slots: |
|
71 |
|
72 // notifications when camera reference is changed |
|
73 void prepareForCameraDelete(); |
|
74 void handleCameraAllocated(CxeError::Id error); |
|
75 |
|
76 // notification for when camera is released |
|
77 void prepareForRelease(); |
|
78 |
|
79 // Handle ECam events |
|
80 void handleCameraEvent( int eventUid, int error ); |
|
81 void handleSceneChanged(CxeScene& scene); |
|
82 |
|
83 private: |
|
84 |
|
85 // handles to-do things if the event is AF event |
|
86 void handleAfEvent(int eventUid, int error); |
|
87 |
|
88 protected: |
|
89 CxeCameraDevice &mCameraDevice; |
|
90 CCamera::CCameraAdvancedSettings *mAdvancedSettings; // not owned |
|
91 CxeAutoFocusControl::Mode mAfMode; |
|
92 CCamera::CCameraAdvancedSettings::TFocusRange mAFRange; |
|
93 bool mCancelled; |
|
94 }; |
|
95 |
|
96 #endif // CXEAUTOFOCUSCONTROLSYMBIAN_H |