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 #include <stdio.h> |
|
19 #include <stdlib.h> |
|
20 #include <assert.h> |
|
21 #include "xaglobals.h" |
|
22 #include "xacameracapabilitiesitf.h" |
|
23 |
|
24 |
|
25 #include "xastaticcameracapsadaptation.h" |
|
26 |
|
27 |
|
28 static XACameraCapabilitiesItfImpl* GetImpl(XACameraCapabilitiesItf self) |
|
29 { |
|
30 if( self ) |
|
31 { |
|
32 XACameraCapabilitiesItfImpl* impl = (XACameraCapabilitiesItfImpl*)(*self); |
|
33 if( impl && (impl == impl->self) ) |
|
34 { |
|
35 return impl; |
|
36 } |
|
37 } |
|
38 return NULL; |
|
39 } |
|
40 |
|
41 /** |
|
42 * Base interface XACameraCapabilitiesItf implementation |
|
43 */ |
|
44 XAresult XACameraCapabilitiesItfImpl_GetCameraCapabilities( |
|
45 XACameraCapabilitiesItf self, |
|
46 XAuint32* pIndex, |
|
47 XAuint32* pCameraDeviceID, |
|
48 XACameraDescriptor* pDescriptor) |
|
49 { |
|
50 XAresult ret = XA_RESULT_SUCCESS; |
|
51 XACameraCapabilitiesItfImpl* impl = GetImpl(self); |
|
52 DEBUG_API("->XACameraCapabilitiesItfImpl_GetCameraCapabilities"); |
|
53 |
|
54 if( !impl ) |
|
55 { |
|
56 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
|
57 DEBUG_API("<-XACameraCapabilitiesItfImpl_GetCameraCapabilities"); |
|
58 return XA_RESULT_PARAMETER_INVALID; |
|
59 } |
|
60 |
|
61 ret = XAStaticCameraCaps_GetCameraCapabilities(pIndex,pCameraDeviceID,pDescriptor); |
|
62 |
|
63 DEBUG_API("<-XACameraCapabilitiesItfImpl_GetCameraCapabilities"); |
|
64 return ret; |
|
65 } |
|
66 |
|
67 |
|
68 XAresult XACameraCapabilitiesItfImpl_QueryFocusRegionPatterns( |
|
69 XACameraCapabilitiesItf self, |
|
70 XAuint32 cameraDeviceID, |
|
71 XAuint32* pPatternID, |
|
72 XAuint32* pFocusPattern, |
|
73 XAuint32* pCustomPoints1, |
|
74 XAuint32* pCustomPoints2) |
|
75 { |
|
76 XAresult ret = XA_RESULT_SUCCESS; |
|
77 XACameraCapabilitiesItfImpl* impl = GetImpl(self); |
|
78 DEBUG_API("->XACameraCapabilitiesItfImpl_QueryFocusRegionPatterns"); |
|
79 |
|
80 if( !impl ) |
|
81 { |
|
82 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
|
83 DEBUG_API("<-XACameraCapabilitiesItfImpl_QueryFocusRegionPatterns"); |
|
84 return XA_RESULT_PARAMETER_INVALID; |
|
85 } |
|
86 |
|
87 ret = XAStaticCameraCaps_QueryFocusRegionPatterns( |
|
88 cameraDeviceID, pPatternID, pFocusPattern,pCustomPoints1,pCustomPoints2); |
|
89 |
|
90 DEBUG_API("<-XACameraCapabilitiesItfImpl_QueryFocusRegionPatterns"); |
|
91 return ret; |
|
92 } |
|
93 |
|
94 |
|
95 XAresult XACameraCapabilitiesItfImpl_GetSupportedAutoLocks( |
|
96 XACameraCapabilitiesItf self, |
|
97 XAuint32 cameraDeviceID, |
|
98 XAuint32* pNumCombinations, |
|
99 XAuint32** ppLocks) |
|
100 { |
|
101 XAresult ret = XA_RESULT_SUCCESS; |
|
102 XACameraCapabilitiesItfImpl* impl = GetImpl(self); |
|
103 |
|
104 DEBUG_API("->XACameraCapabilitiesItfImpl_GetSupportedAutoLocks"); |
|
105 if( !impl ) |
|
106 { |
|
107 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
|
108 DEBUG_API("<-XACameraCapabilitiesItfImpl_GetSupportedAutoLocks"); |
|
109 return XA_RESULT_PARAMETER_INVALID; |
|
110 } |
|
111 |
|
112 ret = XAStaticCameraCaps_GetSupportedAutoLocks( |
|
113 cameraDeviceID, pNumCombinations, ppLocks); |
|
114 |
|
115 DEBUG_API("<-XACameraCapabilitiesItfImpl_GetSupportedAutoLocks"); |
|
116 return ret; |
|
117 } |
|
118 |
|
119 |
|
120 XAresult XACameraCapabilitiesItfImpl_GetSupportedFocusManualSettings( |
|
121 XACameraCapabilitiesItf self, |
|
122 XAuint32 cameraDeviceID, |
|
123 XAboolean macroEnabled, |
|
124 XAmillimeter* pMinValue, |
|
125 XAmillimeter* pMaxValue, |
|
126 XAuint32* pNumSettings, |
|
127 XAmillimeter** ppSettings) |
|
128 { |
|
129 XAresult ret = XA_RESULT_SUCCESS; |
|
130 XACameraCapabilitiesItfImpl* impl = GetImpl(self); |
|
131 DEBUG_API("->XACameraCapabilitiesItfImpl_GetSupportedFocusManualSettings"); |
|
132 |
|
133 if( !impl ) |
|
134 { |
|
135 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
|
136 DEBUG_API("<-XACameraCapabilitiesItfImpl_GetSupportedFocusManualSettings"); |
|
137 return XA_RESULT_PARAMETER_INVALID; |
|
138 } |
|
139 |
|
140 ret = XAStaticCameraCaps_GetSupportedFocusManualSettings( |
|
141 cameraDeviceID, macroEnabled,pMinValue, pMaxValue, pNumSettings, ppSettings); |
|
142 |
|
143 DEBUG_API("<-XACameraCapabilitiesItfImpl_GetSupportedFocusManualSettings"); |
|
144 return ret; |
|
145 } |
|
146 |
|
147 |
|
148 XAresult XACameraCapabilitiesItfImpl_GetSupportedISOSensitivitySettings( |
|
149 XACameraCapabilitiesItf self, |
|
150 XAuint32 cameraDeviceID, |
|
151 XAuint32* pMinValue, |
|
152 XAuint32* pMaxValue, |
|
153 XAuint32* pNumSettings, |
|
154 XAuint32** ppSettings) |
|
155 { |
|
156 XAresult ret = XA_RESULT_SUCCESS; |
|
157 XACameraCapabilitiesItfImpl* impl = GetImpl(self); |
|
158 DEBUG_API("->XACameraCapabilitiesItfImpl_GetSupportedISOSensitivitySettings"); |
|
159 |
|
160 if( !impl ) |
|
161 { |
|
162 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
|
163 DEBUG_API("<-XACameraCapabilitiesItfImpl_GetSupportedISOSensitivitySettings"); |
|
164 return XA_RESULT_PARAMETER_INVALID; |
|
165 } |
|
166 |
|
167 ret = XAStaticCameraCaps_GetSupportedISOSensitivitySettings( |
|
168 cameraDeviceID, pMinValue, pMaxValue, pNumSettings, ppSettings ); |
|
169 |
|
170 DEBUG_API("<-XACameraCapabilitiesItfImpl_GetSupportedISOSensitivitySettings"); |
|
171 return ret; |
|
172 } |
|
173 |
|
174 |
|
175 XAresult XACameraCapabilitiesItfImpl_GetSupportedApertureManualSettings( |
|
176 XACameraCapabilitiesItf self, |
|
177 XAuint32 cameraDeviceID, |
|
178 XAuint32* pMinValue, |
|
179 XAuint32* pMaxValue, |
|
180 XAuint32* pNumSettings, |
|
181 XAuint32** ppSettings) |
|
182 { |
|
183 XAresult ret = XA_RESULT_SUCCESS; |
|
184 XACameraCapabilitiesItfImpl* impl = GetImpl(self); |
|
185 DEBUG_API("->XACameraCapabilitiesItfImpl_GetSupportedApertureManualSettings"); |
|
186 |
|
187 if( !impl ) |
|
188 { |
|
189 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
|
190 DEBUG_API("<-XACameraCapabilitiesItfImpl_GetSupportedApertureManualSettings"); |
|
191 return XA_RESULT_PARAMETER_INVALID; |
|
192 } |
|
193 |
|
194 ret = XAStaticCameraCaps_GetSupportedApertureManualSettings( |
|
195 cameraDeviceID, pMinValue, pMaxValue, pNumSettings, ppSettings ); |
|
196 |
|
197 DEBUG_API("<-XACameraCapabilitiesItfImpl_GetSupportedApertureManualSettings"); |
|
198 return ret; |
|
199 } |
|
200 |
|
201 |
|
202 XAresult XACameraCapabilitiesItfImpl_GetSupportedShutterSpeedManualSettings( |
|
203 XACameraCapabilitiesItf self, |
|
204 XAuint32 cameraDeviceID, |
|
205 XAmicrosecond* pMinValue, |
|
206 XAmicrosecond* pMaxValue, |
|
207 XAuint32* pNumSettings, |
|
208 XAmicrosecond** ppSettings) |
|
209 { |
|
210 XAresult ret = XA_RESULT_SUCCESS; |
|
211 XACameraCapabilitiesItfImpl* impl = GetImpl(self); |
|
212 DEBUG_API("->XACameraCapabilitiesItfImpl_GetSupportedShutterSpeedManualSettings"); |
|
213 |
|
214 if( !impl ) |
|
215 { |
|
216 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
|
217 DEBUG_API("<-XACameraCapabilitiesItfImpl_GetSupportedShutterSpeedManualSettings"); |
|
218 return XA_RESULT_PARAMETER_INVALID; |
|
219 } |
|
220 |
|
221 ret = XAStaticCameraCaps_GetSupportedShutterSpeedManualSettings( |
|
222 cameraDeviceID, pMinValue, pMaxValue, pNumSettings, ppSettings); |
|
223 |
|
224 DEBUG_API("<-XACameraCapabilitiesItfImpl_GetSupportedShutterSpeedManualSettings"); |
|
225 return ret; |
|
226 } |
|
227 |
|
228 |
|
229 XAresult XACameraCapabilitiesItfImpl_GetSupportedWhiteBalanceManualSettings( |
|
230 XACameraCapabilitiesItf self, |
|
231 XAuint32 cameraDeviceID, |
|
232 XAuint32* pMinValue, |
|
233 XAuint32* pMaxValue, |
|
234 XAuint32* pNumSettings, |
|
235 XAuint32** ppSettings) |
|
236 { |
|
237 XAresult ret = XA_RESULT_SUCCESS; |
|
238 XACameraCapabilitiesItfImpl* impl = GetImpl(self); |
|
239 DEBUG_API("->XACameraCapabilitiesItfImpl_GetSupportedWhiteBalanceManualSettings"); |
|
240 |
|
241 if( !impl ) |
|
242 { |
|
243 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
|
244 DEBUG_API("<-XACameraCapabilitiesItfImpl_GetSupportedWhiteBalanceManualSettings"); |
|
245 return XA_RESULT_PARAMETER_INVALID; |
|
246 } |
|
247 |
|
248 ret = XAStaticCameraCaps_GetSupportedWhiteBalanceManualSettings( |
|
249 cameraDeviceID, pMinValue, pMaxValue, pNumSettings, ppSettings); |
|
250 |
|
251 DEBUG_API("<-XACameraCapabilitiesItfImpl_GetSupportedWhiteBalanceManualSettings"); |
|
252 return ret; |
|
253 } |
|
254 |
|
255 |
|
256 XAresult XACameraCapabilitiesItfImpl_GetSupportedZoomSettings( |
|
257 XACameraCapabilitiesItf self, |
|
258 XAuint32 cameraDeviceID, |
|
259 XAboolean digitalEnabled, |
|
260 XAboolean macroEnabled, |
|
261 XApermille* pMaxValue, |
|
262 XAuint32* pNumSettings, |
|
263 XApermille** ppSettings, |
|
264 XAboolean* pSpeedSupported) |
|
265 { |
|
266 XAresult ret = XA_RESULT_SUCCESS; |
|
267 XACameraCapabilitiesItfImpl* impl = GetImpl(self); |
|
268 DEBUG_API("->XACameraCapabilitiesItfImpl_GetSupportedZoomSettings"); |
|
269 |
|
270 if( !impl ) |
|
271 { |
|
272 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
|
273 DEBUG_API("<-XACameraCapabilitiesItfImpl_GetSupportedZoomSettings"); |
|
274 return XA_RESULT_PARAMETER_INVALID; |
|
275 } |
|
276 |
|
277 ret = XAStaticCameraCaps_GetSupportedZoomSettings( |
|
278 cameraDeviceID, digitalEnabled, macroEnabled, pMaxValue, |
|
279 pNumSettings, ppSettings, pSpeedSupported); |
|
280 |
|
281 DEBUG_API("<-XACameraCapabilitiesItfImpl_GetSupportedZoomSettings"); |
|
282 return ret; |
|
283 } |
|
284 |
|
285 |
|
286 /** |
|
287 * XACameraCapabilitiesItfImpl -specific methods |
|
288 **/ |
|
289 XACameraCapabilitiesItfImpl* XACameraCapabilitiesItfImpl_Create(void) |
|
290 { |
|
291 XACameraCapabilitiesItfImpl* self = (XACameraCapabilitiesItfImpl*) |
|
292 calloc(1,sizeof(XACameraCapabilitiesItfImpl)); |
|
293 DEBUG_API("->XACameraCapabilitiesItfImpl_Create"); |
|
294 |
|
295 if( self ) |
|
296 { |
|
297 /* init itf default implementation */ |
|
298 self->itf.GetCameraCapabilities = |
|
299 XACameraCapabilitiesItfImpl_GetCameraCapabilities; |
|
300 self->itf.QueryFocusRegionPatterns = |
|
301 XACameraCapabilitiesItfImpl_QueryFocusRegionPatterns; |
|
302 self->itf.GetSupportedAutoLocks = |
|
303 XACameraCapabilitiesItfImpl_GetSupportedAutoLocks; |
|
304 self->itf.GetSupportedFocusManualSettings = |
|
305 XACameraCapabilitiesItfImpl_GetSupportedFocusManualSettings; |
|
306 self->itf.GetSupportedISOSensitivitySettings = |
|
307 XACameraCapabilitiesItfImpl_GetSupportedISOSensitivitySettings; |
|
308 self->itf.GetSupportedApertureManualSettings = |
|
309 XACameraCapabilitiesItfImpl_GetSupportedApertureManualSettings; |
|
310 self->itf.GetSupportedShutterSpeedManualSettings = |
|
311 XACameraCapabilitiesItfImpl_GetSupportedShutterSpeedManualSettings; |
|
312 self->itf.GetSupportedWhiteBalanceManualSettings = |
|
313 XACameraCapabilitiesItfImpl_GetSupportedWhiteBalanceManualSettings; |
|
314 self->itf.GetSupportedZoomSettings = |
|
315 XACameraCapabilitiesItfImpl_GetSupportedZoomSettings; |
|
316 |
|
317 self->self = self; |
|
318 } |
|
319 DEBUG_API("<-XACameraCapabilitiesItfImpl_Create"); |
|
320 return self; |
|
321 } |
|
322 |
|
323 void XACameraCapabilitiesItfImpl_Free(XACameraCapabilitiesItfImpl* self) |
|
324 { |
|
325 DEBUG_API("->XACameraCapabilitiesItfImpl_Free"); |
|
326 assert(self==self->self); |
|
327 free(self); |
|
328 DEBUG_API("<-XACameraCapabilitiesItfImpl_Free"); |
|
329 } |
|
330 |
|