1 /* |
1 /* |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 #include <ECamOrientationCustomInterface2.h> |
17 #include <ECamOrientationCustomInterface2.h> |
18 #include <ecamfacetrackingcustomapi.h> |
18 #include <ecamfacetrackingcustomapi.h> |
|
19 #include <ecamusecasehintcustomapi.h> |
19 |
20 |
20 #include "cxecameradevice.h" |
21 #include "cxecameradevice.h" |
21 #include "cxeerrormappingsymbian.h" |
22 #include "cxeerrormappingsymbian.h" |
22 #include "cxutils.h" |
23 #include "cxutils.h" |
23 #include "cxedummycamera.h" |
24 #include "cxedummycamera.h" |
70 } |
71 } |
71 |
72 |
72 CX_DEBUG_EXIT_FUNCTION(); |
73 CX_DEBUG_EXIT_FUNCTION(); |
73 } |
74 } |
74 |
75 |
|
76 void CxeCameraDevice::reserveCamera() |
|
77 { |
|
78 CX_DEBUG_ENTER_FUNCTION(); |
|
79 |
|
80 if (mCamera) { |
|
81 emit aboutToReserve(); |
|
82 mCamera->Reserve(); |
|
83 } |
|
84 |
|
85 CX_DEBUG_EXIT_FUNCTION(); |
|
86 } |
|
87 |
75 void CxeCameraDevice::setCamera( CCamera *camera ) |
88 void CxeCameraDevice::setCamera( CCamera *camera ) |
76 { |
89 { |
77 CX_DEBUG_ENTER_FUNCTION(); |
90 CX_DEBUG_ENTER_FUNCTION(); |
78 |
91 |
79 if (mCamera != camera) { |
92 if (mCamera != camera) { |
122 MCameraFaceTracking* CxeCameraDevice::faceTracking() |
135 MCameraFaceTracking* CxeCameraDevice::faceTracking() |
123 { |
136 { |
124 return mFaceTracking; |
137 return mFaceTracking; |
125 } |
138 } |
126 |
139 |
|
140 MCameraUseCaseHint *CxeCameraDevice::useCaseHintApi() |
|
141 { |
|
142 return mUseCaseHintApi; |
|
143 } |
|
144 |
127 CxeError::Id CxeCameraDevice::initResources() |
145 CxeError::Id CxeCameraDevice::initResources() |
128 { |
146 { |
129 CX_DEBUG_ENTER_FUNCTION(); |
147 CX_DEBUG_ENTER_FUNCTION(); |
130 |
148 |
131 TInt status = KErrNone; |
149 TInt status = KErrNone; |
132 |
150 |
133 if (mCamera) { |
151 if (mCamera) { |
|
152 OstTrace0(camerax_performance, CXECAMERADEVICE_EXTENSIONS_1, "msg: e_CX_GET_CCAMERA_EXTENSIONS 1"); |
|
153 |
134 CX_DEBUG(("Get CCamera extensions..")); |
154 CX_DEBUG(("Get CCamera extensions..")); |
135 |
155 |
136 mCameraOrientation = static_cast<MCameraOrientation*>( |
156 mCameraOrientation = static_cast<MCameraOrientation*>( |
137 mCamera->CustomInterface(KCameraOrientationUid)); |
157 mCamera->CustomInterface(KCameraOrientationUid)); |
138 CX_DEBUG(("MCameraOrientation interface 0x%08x", mCameraOrientation)); |
158 CX_DEBUG(("MCameraOrientation interface 0x%08x", mCameraOrientation)); |
139 |
159 |
140 mFaceTracking = static_cast<MCameraFaceTracking*>( |
160 mFaceTracking = static_cast<MCameraFaceTracking*>( |
141 mCamera->CustomInterface(KCameraFaceTrackingUid)); |
161 mCamera->CustomInterface(KCameraFaceTrackingUid)); |
142 CX_DEBUG(("MCameraFaceTracking interface 0x%08x", mFaceTracking)); |
162 CX_DEBUG(("MCameraFaceTracking interface 0x%08x", mFaceTracking)); |
|
163 |
|
164 mUseCaseHintApi = static_cast<MCameraUseCaseHint*>( |
|
165 mCamera->CustomInterface(KCameraUseCaseHintUid)); |
|
166 CX_DEBUG(("MCameraUseCaseHint interface 0x%08x", mUseCaseHintApi)); |
143 |
167 |
144 TRAPD(errorAdvSet, mAdvancedSettings = |
168 TRAPD(errorAdvSet, mAdvancedSettings = |
145 CCamera::CCameraAdvancedSettings::NewL(*mCamera)); |
169 CCamera::CCameraAdvancedSettings::NewL(*mCamera)); |
146 CX_DEBUG(("CCameraAdvancedSettings status: %d", errorAdvSet)); |
170 CX_DEBUG(("CCameraAdvancedSettings status: %d", errorAdvSet)); |
147 |
171 |
157 // Check all statuses and set first error code encountered. |
181 // Check all statuses and set first error code encountered. |
158 // Imageprocessing is not supported by 2nd camera so we just ignore the error. |
182 // Imageprocessing is not supported by 2nd camera so we just ignore the error. |
159 status = errorAdvSet != KErrNone |
183 status = errorAdvSet != KErrNone |
160 ? errorAdvSet : errorSnap; |
184 ? errorAdvSet : errorSnap; |
161 CX_DEBUG(("Total status: %d", status)); |
185 CX_DEBUG(("Total status: %d", status)); |
|
186 |
|
187 OstTrace0(camerax_performance, CXECAMERADEVICE_EXTENSIONS_2, "msg: e_CX_GET_CCAMERA_EXTENSIONS 0"); |
162 } |
188 } |
163 |
189 |
164 CX_DEBUG_EXIT_FUNCTION(); |
190 CX_DEBUG_EXIT_FUNCTION(); |
165 return CxeErrorHandlingSymbian::map(status); |
191 return CxeErrorHandlingSymbian::map(status); |
166 } |
192 } |
170 CX_DEBUG_ENTER_FUNCTION(); |
196 CX_DEBUG_ENTER_FUNCTION(); |
171 |
197 |
172 // not owned. |
198 // not owned. |
173 mCameraOrientation = NULL; |
199 mCameraOrientation = NULL; |
174 mFaceTracking = NULL; |
200 mFaceTracking = NULL; |
|
201 mUseCaseHintApi = NULL; |
175 |
202 |
176 delete mCameraSnapshot; |
203 delete mCameraSnapshot; |
177 mCameraSnapshot = NULL; |
204 mCameraSnapshot = NULL; |
178 |
205 |
179 delete mAdvancedSettings; |
206 delete mAdvancedSettings; |
189 } |
216 } |
190 |
217 |
191 CxeError::Id CxeCameraDevice::newCamera( Cxe::CameraIndex cameraIndex, MCameraObserver2 *observer ) |
218 CxeError::Id CxeCameraDevice::newCamera( Cxe::CameraIndex cameraIndex, MCameraObserver2 *observer ) |
192 { |
219 { |
193 CX_DEBUG_ENTER_FUNCTION(); |
220 CX_DEBUG_ENTER_FUNCTION(); |
194 OstTrace0(camerax_performance, CXECAMERADEVICE_NEWCAMERA_IN, "msg: e_CX_CAMERADEVICE_CREATE_CCAMERA 1"); |
221 OstTrace0(camerax_performance, CXECAMERADEVICE_NEWCAMERA_IN, "msg: e_CX_CREATE_CCAMERA 1"); |
195 |
222 |
196 CX_DEBUG(("Cxe: using camera index %d", cameraIndex)); |
223 CX_DEBUG(("Cxe: using camera index %d", cameraIndex)); |
197 |
224 |
198 CX_DEBUG_ASSERT(cameraIndex == Cxe::PrimaryCameraIndex || cameraIndex == Cxe::SecondaryCameraIndex); |
225 CX_DEBUG_ASSERT(cameraIndex == Cxe::PrimaryCameraIndex || cameraIndex == Cxe::SecondaryCameraIndex); |
199 |
226 |
205 #else |
232 #else |
206 TRAPD(err, camera = CCamera::New2L(*observer, cameraIndex, 100 /*KCameraClientPriority*/)); |
233 TRAPD(err, camera = CCamera::New2L(*observer, cameraIndex, 100 /*KCameraClientPriority*/)); |
207 CX_DEBUG(("CxeCameraDevice::newCamera <> new CCamera")); |
234 CX_DEBUG(("CxeCameraDevice::newCamera <> new CCamera")); |
208 #endif |
235 #endif |
209 |
236 |
|
237 OstTrace0(camerax_performance, CXECAMERADEVICE_NEWCAMERA_OUT, "msg: e_CX_CREATE_CCAMERA 0"); |
|
238 |
210 if (!err) { |
239 if (!err) { |
211 setCamera(camera); |
240 setCamera(camera); |
212 } |
241 } |
213 |
242 |
214 OstTrace0(camerax_performance, CXECAMERADEVICE_NEWCAMERA_OUT, "msg: e_CX_CAMERADEVICE_CREATE_CCAMERA 0"); |
|
215 CX_DEBUG_EXIT_FUNCTION(); |
243 CX_DEBUG_EXIT_FUNCTION(); |
216 return CxeErrorHandlingSymbian::map(err); |
244 return CxeErrorHandlingSymbian::map(err); |
217 } |
245 } |
218 |
246 |
219 // end of file |
247 // end of file |