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