[NUI] TCSACR-226 code change (#1032)
[platform/core/csapi/tizenfx.git] / src / Tizen.Multimedia.Camera / Camera / CameraCapabilities.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 using System;
18 using System.Collections.Generic;
19 using NativeCapabilities = Interop.CameraCapabilities;
20 using NativeSettings = Interop.CameraSettings;
21
22 namespace Tizen.Multimedia
23 {
24     /// <summary>
25     /// The CameraCapabilities class provides properties
26     /// to get various capability information of the camera device.
27     /// </summary>
28     /// <since_tizen> 4 </since_tizen>
29     public class CameraCapabilities
30     {
31         internal readonly Camera _camera;
32
33         private IList<Size> _previewResolutions;
34         private IList<Size> _cameraResolutions;
35         private IList<CameraPixelFormat> _captureFormats;
36         private IList<CameraPixelFormat> _previewFormats;
37         private IList<CameraFps> _fps;
38         private IList<CameraAutoFocusMode> _autoFocusModes;
39         private IList<CameraExposureMode> _exposureModes;
40         private IList<CameraIsoLevel> _isoLevels;
41         private IList<CameraTheaterMode> _theaterModes;
42         private IList<CameraWhiteBalance> _whitebalances;
43         private IList<CameraFlashMode> _flashModes;
44         private IList<CameraSceneMode> _sceneModes;
45         private IList<CameraEffectMode> _effectModes;
46         private IList<Rotation> _streamRotations;
47         private IList<Flips> _streamFlips;
48         private IList<CameraPtzType> _ptzTypes;
49         private delegate CameraError GetRangeDelegate(IntPtr handle, out int min, out int max);
50         private delegate bool IsSupportedDelegate(IntPtr handle);
51
52         internal CameraCapabilities(Camera camera)
53         {
54             _camera = camera;
55
56             IsFaceDetectionSupported = IsFeatureSupported(NativeCapabilities.IsFaceDetectionSupported);
57             IsMediaPacketPreviewCallbackSupported = IsFeatureSupported(NativeCapabilities.IsMediaPacketPreviewCallbackSupported);
58             IsZeroShutterLagSupported = IsFeatureSupported(NativeCapabilities.IsZeroShutterLagSupported);
59             IsContinuousCaptureSupported = IsFeatureSupported(NativeCapabilities.IsContinuousCaptureSupported);
60             IsHdrCaptureSupported = IsFeatureSupported(NativeCapabilities.IsHdrCaptureSupported);
61             IsAntiShakeSupported = IsFeatureSupported(NativeCapabilities.IsAntiShakeSupported);
62             IsVideoStabilizationSupported = IsFeatureSupported(NativeCapabilities.IsVideoStabilizationSupported);
63             IsAutoContrastSupported = IsFeatureSupported(NativeCapabilities.IsAutoContrastSupported);
64             IsBrigtnessSupported = CheckRangeValid(NativeSettings.GetBrightnessRange);
65             IsExposureSupported = CheckRangeValid(NativeSettings.GetExposureRange);
66             IsZoomSupported = CheckRangeValid(NativeSettings.GetZoomRange);
67             IsPanSupported = CheckRangeValid(NativeSettings.GetPanRange);
68             IsTiltSupported = CheckRangeValid(NativeSettings.GetTiltRange);
69             IsHueSupported = CheckRangeValid(NativeSettings.GetHueRange);
70         }
71
72         private bool IsFeatureSupported(IsSupportedDelegate func)
73         {
74             return func(_camera.GetHandle());
75         }
76
77         private bool CheckRangeValid(GetRangeDelegate func)
78         {
79             func(_camera.GetHandle(), out int min, out int max).
80                 ThrowIfFailed("Failed to check feature is suported or not.");
81
82             return min < max;
83         }
84
85         /// <summary>
86         /// Gets the face detection feature's supported state.
87         /// </summary>
88         /// <value>true if supported, otherwise false.</value>
89         /// <since_tizen> 4 </since_tizen>
90         public bool IsFaceDetectionSupported { get; }
91
92         /// <summary>
93         /// Gets the media packet preview callback feature's supported state.
94         /// </summary>
95         /// <value>true if supported, otherwise false.</value>
96         /// <since_tizen> 4 </since_tizen>
97         public bool IsMediaPacketPreviewCallbackSupported { get; }
98
99         /// <summary>
100         /// Gets the zero shutter lag feature's supported state.
101         /// </summary>
102         /// <value>true if supported, otherwise false.</value>
103         /// <since_tizen> 4 </since_tizen>
104         public bool IsZeroShutterLagSupported { get; }
105
106         /// <summary>
107         /// Gets the continuous capture feature's supported state.
108         /// </summary>
109         /// <value>true if supported, otherwise false.</value>
110         /// <since_tizen> 4 </since_tizen>
111         public bool IsContinuousCaptureSupported { get; }
112
113         /// <summary>
114         /// Gets the support state of the HDR capture.
115         /// </summary>
116         /// <value>true if supported, otherwise false.</value>
117         /// <since_tizen> 4 </since_tizen>
118         public bool IsHdrCaptureSupported { get; }
119
120         /// <summary>
121         /// Gets the support state of the anti-shake feature.
122         /// </summary>
123         /// <value>true if supported, otherwise false.</value>
124         /// <since_tizen> 4 </since_tizen>
125         public bool IsAntiShakeSupported { get; }
126
127         /// <summary>
128         /// Gets the support state of the video stabilization feature.
129         /// </summary>
130         /// <value>true if supported, otherwise false.</value>
131         /// <since_tizen> 4 </since_tizen>
132         public bool IsVideoStabilizationSupported { get; }
133
134         /// <summary>
135         /// Gets the support state of auto contrast feature.
136         /// </summary>
137         /// <value>true if supported, otherwise false.</value>
138         /// <since_tizen> 4 </since_tizen>
139         public bool IsAutoContrastSupported { get; }
140
141         /// <summary>
142         /// Gets the support state of the brightness feature.
143         /// </summary>
144         /// <value>true if supported, otherwise false.</value>
145         /// <since_tizen> 4 </since_tizen>
146         public bool IsBrigtnessSupported { get; }
147
148         /// <summary>
149         /// Gets the support state of the exposure feature.
150         /// </summary>
151         /// <value>true if supported, otherwise false.</value>
152         /// <since_tizen> 4 </since_tizen>
153         public bool IsExposureSupported { get; }
154
155         /// <summary>
156         /// Gets the support state of the zoom feature.
157         /// </summary>
158         /// <value>true if supported, otherwise false.</value>
159         /// <since_tizen> 4 </since_tizen>
160         public bool IsZoomSupported { get; }
161
162         /// <summary>
163         /// Gets the support state of the pan feature.
164         /// </summary>
165         /// <value>true if supported, otherwise false.</value>
166         /// <since_tizen> 4 </since_tizen>
167         public bool IsPanSupported { get; }
168
169         /// <summary>
170         /// Gets the support state of the tilt feature.
171         /// </summary>
172         /// <value>true if supported, otherwise false.</value>
173         /// <since_tizen> 4 </since_tizen>
174         public bool IsTiltSupported { get; }
175
176         /// <summary>
177         /// Gets the support state of the hue feature.
178         /// </summary>
179         /// <value>true if supported, otherwise false.</value>
180         /// <since_tizen> 5 </since_tizen>
181         public bool IsHueSupported { get; }
182
183         /// <summary>
184         /// Retrieves all the preview resolutions supported by the camera.
185         /// </summary>
186         /// <since_tizen> 4 </since_tizen>
187         /// <returns>
188         /// It returns a list containing all the supported preview resolutions.
189         /// </returns>
190         /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
191         public IEnumerable<Size> SupportedPreviewResolutions
192         {
193             get
194             {
195                 if (_previewResolutions == null)
196                 {
197                     _previewResolutions = GetSupportedPreviewResolutions();
198                 }
199
200                 return _previewResolutions;
201             }
202         }
203
204         /// <summary>
205         /// Retrieves all the capture resolutions supported by the camera.
206         /// </summary>
207         /// <since_tizen> 4 </since_tizen>
208         /// <returns>
209         /// It returns a list containing all the supported capture resolutions.
210         /// </returns>
211         /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
212         public IEnumerable<Size> SupportedCaptureResolutions
213         {
214             get
215             {
216                 if (_cameraResolutions == null)
217                 {
218                     _cameraResolutions = GetSupportedCaptureResolutions();
219                 }
220
221                 return _cameraResolutions;
222             }
223         }
224
225         /// <summary>
226         /// Retrieves all the capture formats supported by the camera.
227         /// </summary>
228         /// <since_tizen> 4 </since_tizen>
229         /// <returns>
230         /// It returns a list containing all the supported <see cref="CameraPixelFormat"/>.
231         /// </returns>
232         /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
233         public IEnumerable<CameraPixelFormat> SupportedCapturePixelFormats
234         {
235             get
236             {
237                 if (_captureFormats == null)
238                 {
239                     _captureFormats = GetSupportedCapturePixelFormats();
240                 }
241
242                 return _captureFormats;
243             }
244         }
245
246         /// <summary>
247         /// Retrieves all the preview formats supported by the camera.
248         /// </summary>
249         /// <since_tizen> 4 </since_tizen>
250         /// <returns>
251         /// It returns a list containing all the supported <see cref="CameraPixelFormat"/>.
252         /// </returns>
253         /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
254         public IEnumerable<CameraPixelFormat> SupportedPreviewPixelFormats
255         {
256             get
257             {
258                 if (_previewFormats == null)
259                 {
260                     _previewFormats = GetSupportedPreviewPixelFormats();
261                 }
262
263                 return _previewFormats;
264             }
265         }
266
267         /// <summary>
268         /// Retrieves all the fps supported by the camera.
269         /// </summary>
270         /// <since_tizen> 4 </since_tizen>
271         /// <returns>
272         /// It returns a list containing all the supported <see cref="CameraFps"/>.
273         /// </returns>
274         /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
275         public IEnumerable<CameraFps> SupportedPreviewFps
276         {
277             get
278             {
279                 if (_fps == null)
280                 {
281                     _fps = GetSupportedPreviewFps();
282                 }
283
284                 return _fps;
285             }
286         }
287
288         /// <summary>
289         /// Retrieves all the fps by resolution supported by the camera.
290         /// </summary>
291         /// <param name="width">The width of required preview resolution.</param>
292         /// <param name="height">The height of required preview resolution.</param>
293         /// <returns>
294         /// It returns a list containing all the supported <see cref="CameraFps"/> by resolution.
295         /// </returns>
296         /// <since_tizen> 4 </since_tizen>
297         /// <feature> http://tizen.org/feature/camera </feature>
298         /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
299         public IEnumerable<CameraFps> GetSupportedPreviewFpsByResolution(int width, int height)
300         {
301             return GetSupportedPreviewFpsByResolutions(width, height);
302         }
303
304         /// <summary>
305         /// Retrieves all the fps by resolution supported by the camera.
306         /// </summary>
307         /// <param name="size">The size of required preview resolution.</param>
308         /// <returns>
309         /// It returns a list containing all the supported <see cref="CameraFps"/> by resolution.
310         /// </returns>
311         /// <since_tizen> 4 </since_tizen>
312         /// <feature> http://tizen.org/feature/camera </feature>
313         /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
314         public IEnumerable<CameraFps> GetSupportedPreviewFpsByResolution(Size size)
315         {
316             return GetSupportedPreviewFpsByResolutions(size.Width, size.Height);
317         }
318
319         /// <summary>
320         /// Retrieves all the auto focus modes supported by the camera.
321         /// </summary>
322         /// <returns>
323         /// It returns a list containing all the supported <see cref="CameraAutoFocusMode"/>.
324         /// </returns>
325         /// <since_tizen> 4 </since_tizen>
326         /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
327         public IEnumerable<CameraAutoFocusMode> SupportedAutoFocusModes
328         {
329             get
330             {
331                 if (_autoFocusModes == null)
332                 {
333                     _autoFocusModes = GetSupportedAutoFocusModes();
334                 }
335
336                 return _autoFocusModes;
337             }
338         }
339
340         /// <summary>
341         /// Retrieves all the exposure modes supported by the camera.
342         /// </summary>
343         /// <returns>
344         /// It returns a list containing all the supported <see cref="CameraExposureMode"/>.
345         /// </returns>
346         /// <since_tizen> 4 </since_tizen>
347         /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
348         public IEnumerable<CameraExposureMode> SupportedExposureModes
349         {
350             get
351             {
352                 if (_exposureModes == null)
353                 {
354                     _exposureModes = GetSupportedExposureModes();
355                 }
356
357                 return _exposureModes;
358             }
359         }
360
361         /// <summary>
362         /// Retrieves all the ISO levels supported by the camera.
363         /// </summary>
364         /// <since_tizen> 4 </since_tizen>
365         /// <returns>
366         /// It returns a list containing all the supported <see cref="CameraIsoLevel"/>.
367         /// </returns>
368         /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
369         public IEnumerable<CameraIsoLevel> SupportedIsoLevels
370         {
371             get
372             {
373                 if (_isoLevels == null)
374                 {
375                     _isoLevels = GetSupportedIsoLevels();
376                 }
377
378                 return _isoLevels;
379             }
380         }
381
382         /// <summary>
383         /// Retrieves all the theater modes supported by the camera.
384         /// </summary>
385         /// <since_tizen> 4 </since_tizen>
386         /// <returns>
387         /// It returns a list containing all the supported <see cref="CameraTheaterMode"/>.
388         /// </returns>
389         /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
390         public IEnumerable<CameraTheaterMode> SupportedTheaterModes
391         {
392             get
393             {
394                 if (_theaterModes == null)
395                 {
396                     _theaterModes = GetSupportedTheaterModes();
397                 }
398
399                 return _theaterModes;
400             }
401         }
402
403         /// <summary>
404         /// Retrieves all the white balance modes supported by the camera.
405         /// </summary>
406         /// <since_tizen> 4 </since_tizen>
407         /// <returns>
408         /// It returns a list containing all the supported <see cref="CameraWhiteBalance"/>.
409         /// </returns>
410         /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
411         public IEnumerable<CameraWhiteBalance> SupportedWhiteBalances
412         {
413             get
414             {
415                 if (_whitebalances == null)
416                 {
417                     _whitebalances = GetSupportedWhitebalances();
418                 }
419
420                 return _whitebalances;
421             }
422         }
423
424         /// <summary>
425         /// Retrieves all the flash modes supported by the camera.
426         /// </summary>
427         /// <since_tizen> 4 </since_tizen>
428         /// <returns>
429         /// It returns a list containing all the supported <see cref="CameraFlashMode"/>.
430         /// </returns>
431         /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
432         public IEnumerable<CameraFlashMode> SupportedFlashModes
433         {
434             get
435             {
436                 if (_flashModes == null)
437                 {
438                     _flashModes = GetSupportedFlashModes();
439                 }
440
441                 return _flashModes;
442             }
443         }
444
445         /// <summary>
446         /// Retrieves all the scene modes supported by the camera.
447         /// </summary>
448         /// <since_tizen> 4 </since_tizen>
449         /// <returns>
450         /// It returns a list containing all the supported <see cref="CameraSceneMode"/>.
451         /// </returns>
452         /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
453         public IEnumerable<CameraSceneMode> SupportedSceneModes
454         {
455             get
456             {
457                 if (_sceneModes == null)
458                 {
459                     _sceneModes = GetSupportedSceneModes();
460                 }
461
462                 return _sceneModes;
463             }
464         }
465
466         /// <summary>
467         /// Retrieves all the effect modes supported by the camera.
468         /// </summary>
469         /// <since_tizen> 4 </since_tizen>
470         /// <returns>
471         /// It returns a list containing all the supported <see cref="CameraEffectMode"/>.
472         /// </returns>
473         /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
474         public IEnumerable<CameraEffectMode> SupportedEffects
475         {
476             get
477             {
478                 if (_effectModes == null)
479                 {
480                     _effectModes = GetSupportedEffects();
481                 }
482
483                 return _effectModes;
484             }
485         }
486
487         /// <summary>
488         /// Retrieves all the stream rotations supported by the camera.
489         /// </summary>
490         /// <since_tizen> 4 </since_tizen>
491         /// <returns>
492         /// An IEnumerable containing all the supported <see cref="Rotation"/>.
493         /// </returns>
494         /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
495         public IEnumerable<Rotation> SupportedStreamRotations
496         {
497             get
498             {
499                 if (_streamRotations == null)
500                 {
501                     _streamRotations = GetSupportedStreamRotations();
502                 }
503
504                 return _streamRotations;
505             }
506         }
507
508         /// <summary>
509         /// Retrieves all the flips supported by the camera.
510         /// </summary>
511         /// <since_tizen> 4 </since_tizen>
512         /// <returns>
513         /// It returns a list containing all the supported <see cref="Flips"/>.
514         /// </returns>
515         /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
516         public IEnumerable<Flips> SupportedStreamFlips
517         {
518             get
519             {
520                 if (_streamFlips == null)
521                 {
522                     _streamFlips = GetSupportedStreamFlips();
523                 }
524
525                 return _streamFlips;
526             }
527         }
528
529         /// <summary>
530         /// Retrieves all the PTZ types by the camera.
531         /// </summary>
532         /// <since_tizen> 4 </since_tizen>
533         /// <returns>
534         /// It returns a list containing all the supported <see cref="CameraPtzType"/>.
535         /// </returns>
536         /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
537         public IEnumerable<CameraPtzType> SupportedPtzTypes
538         {
539             get
540             {
541                 if (_ptzTypes.Count == 0)
542                 {
543                     _ptzTypes = GetSupportedPtzTypes();
544                 }
545
546                 return _ptzTypes;
547             }
548         }
549
550         #region Methods for getting supported values
551         private IList<Size> GetSupportedPreviewResolutions()
552         {
553             List<Size> previewResolutions = new List<Size>();
554
555             NativeCapabilities.PreviewResolutionCallback callback = (int width, int height, IntPtr userData) =>
556             {
557                 previewResolutions.Add(new Size(width, height));
558                 return true;
559             };
560
561             NativeCapabilities.SupportedPreviewResolutions(_camera.GetHandle(), callback, IntPtr.Zero).
562                 ThrowIfFailed("Failed to get the supported preview resolutions");
563
564             return previewResolutions.AsReadOnly();
565         }
566
567         private IList<Size> GetSupportedCaptureResolutions()
568         {
569             List<Size> cameraResolutions = new List<Size>();
570
571             NativeCapabilities.CaptureResolutionCallback callback = (int width, int height, IntPtr userData) =>
572             {
573                 cameraResolutions.Add(new Size(width, height));
574                 return true;
575             };
576
577             NativeCapabilities.SupportedCaptureResolutions(_camera.GetHandle(), callback, IntPtr.Zero).
578                 ThrowIfFailed("Failed to get the supported capture resolutions");
579
580             return cameraResolutions.AsReadOnly();
581         }
582
583         private IList<CameraPixelFormat> GetSupportedCapturePixelFormats()
584         {
585             List<CameraPixelFormat> captureFormats = new List<CameraPixelFormat>();
586
587             NativeCapabilities.CaptureFormatCallback callback = (CameraPixelFormat format, IntPtr userData) =>
588             {
589                 captureFormats.Add(format);
590                 return true;
591             };
592
593             NativeCapabilities.SupportedCapturePixelFormats(_camera.GetHandle(), callback, IntPtr.Zero).
594                 ThrowIfFailed("Failed to get the supported capture formats.");
595
596             return captureFormats.AsReadOnly();
597         }
598
599         private IList<CameraPixelFormat> GetSupportedPreviewPixelFormats()
600         {
601             List<CameraPixelFormat> previewFormats = new List<CameraPixelFormat>();
602
603             NativeCapabilities.PreviewFormatCallback callback = (CameraPixelFormat format, IntPtr userData) =>
604             {
605                 previewFormats.Add(format);
606                 return true;
607             };
608
609             NativeCapabilities.SupportedPreviewPixelFormats(_camera.GetHandle(), callback, IntPtr.Zero).
610                 ThrowIfFailed("Failed to get the supported preview formats.");
611
612             return previewFormats.AsReadOnly();
613         }
614
615         private IList<CameraFps> GetSupportedPreviewFps()
616         {
617             List<CameraFps> previewFps = new List<CameraFps>();
618
619             NativeCapabilities.FpsCallback callback = (CameraFps fps, IntPtr userData) =>
620             {
621                 previewFps.Add(fps);
622                 return true;
623             };
624
625             NativeCapabilities.SupportedPreviewFps(_camera.GetHandle(), callback, IntPtr.Zero).
626                 ThrowIfFailed("Failed to get the supported camera fps");
627
628             return previewFps.AsReadOnly();
629         }
630
631         private IList<CameraFps> GetSupportedPreviewFpsByResolutions(int width, int height)
632         {
633             List<CameraFps> fpsByResolution = new List<CameraFps>();
634
635             NativeCapabilities.FpsByResolutionCallback callback = (CameraFps fps, IntPtr userData) =>
636             {
637                 fpsByResolution.Add(fps);
638                 return true;
639             };
640
641             NativeCapabilities.SupportedPreviewFpsByResolution(_camera.GetHandle(), width, height, callback, IntPtr.Zero).
642                 ThrowIfFailed("Failed to get the supported fps by resolutions.");
643
644             return fpsByResolution.AsReadOnly();
645         }
646
647         private IList<CameraAutoFocusMode> GetSupportedAutoFocusModes()
648         {
649             List<CameraAutoFocusMode> autoFocusModes = new List<CameraAutoFocusMode>();
650
651             NativeCapabilities.AfModeCallback callback = (CameraAutoFocusMode mode, IntPtr userData) =>
652             {
653                 autoFocusModes.Add(mode);
654                 return true;
655             };
656
657             NativeCapabilities.SupportedAutoFocusModes(_camera.GetHandle(), callback, IntPtr.Zero).
658                 ThrowIfFailed("Failed to get the supported Auto focus modes.");
659
660             return autoFocusModes.AsReadOnly();
661         }
662
663         private IList<CameraExposureMode> GetSupportedExposureModes()
664         {
665             List<CameraExposureMode> exposureModes = new List<CameraExposureMode>();
666
667             NativeCapabilities.ExposureModeCallback callback = (CameraExposureMode mode, IntPtr userData) =>
668             {
669                 exposureModes.Add(mode);
670                 return true;
671             };
672
673             NativeCapabilities.SupportedExposureModes(_camera.GetHandle(), callback, IntPtr.Zero).
674                 ThrowIfFailed("Failed to get the supported Exposure modes.");
675
676             return exposureModes.AsReadOnly();
677         }
678
679         private IList<CameraIsoLevel> GetSupportedIsoLevels()
680         {
681             List<CameraIsoLevel> isoLevels = new List<CameraIsoLevel>();
682
683             NativeCapabilities.IsoCallback callback = (CameraIsoLevel iso, IntPtr userData) =>
684             {
685                 isoLevels.Add(iso);
686                 return true;
687             };
688
689             NativeCapabilities.SupportedIso(_camera.GetHandle(), callback, IntPtr.Zero).
690                 ThrowIfFailed("Failed to get the supported Iso levels.");
691
692             return isoLevels.AsReadOnly();
693         }
694
695         private IList<CameraTheaterMode> GetSupportedTheaterModes()
696         {
697             List<CameraTheaterMode> theaterModes = new List<CameraTheaterMode>();
698
699             NativeCapabilities.TheaterModeCallback callback = (CameraTheaterMode theaterMode, IntPtr userData) =>
700             {
701                 theaterModes.Add(theaterMode);
702                 return true;
703             };
704
705             NativeCapabilities.SupportedTheaterModes(_camera.GetHandle(), callback, IntPtr.Zero).
706                 ThrowIfFailed("Failed to get the supported theater modes.");
707
708             return theaterModes.AsReadOnly();
709         }
710
711         private IList<CameraWhiteBalance> GetSupportedWhitebalances()
712         {
713             List<CameraWhiteBalance> whitebalances = new List<CameraWhiteBalance>();
714
715             NativeCapabilities.WhitebalanceCallback callback = (CameraWhiteBalance whiteBalance, IntPtr userData) =>
716             {
717                 whitebalances.Add(whiteBalance);
718                 return true;
719             };
720
721             NativeCapabilities.SupportedWhitebalance(_camera.GetHandle(), callback, IntPtr.Zero).
722                 ThrowIfFailed("Failed to get the supported white balance.");
723
724             return whitebalances.AsReadOnly();
725         }
726
727         private IList<CameraFlashMode> GetSupportedFlashModes()
728         {
729             List<CameraFlashMode> flashModes = new List<CameraFlashMode>();
730
731             NativeCapabilities.FlashModeCallback callback = (CameraFlashMode flashMode, IntPtr userData) =>
732             {
733                 flashModes.Add(flashMode);
734                 return true;
735             };
736
737             NativeCapabilities.SupportedFlashModes(_camera.GetHandle(), callback, IntPtr.Zero).
738                 ThrowIfFailed("Failed to get the supported flash modes.");
739
740             return flashModes.AsReadOnly();
741         }
742
743         private IList<CameraSceneMode> GetSupportedSceneModes()
744         {
745             List<CameraSceneMode> sceneModes = new List<CameraSceneMode>();
746
747             NativeCapabilities.SceneModeCallback callback = (CameraSceneMode sceneMode, IntPtr userData) =>
748             {
749                 sceneModes.Add(sceneMode);
750                 return true;
751             };
752
753             NativeCapabilities.SupportedSceneModes(_camera.GetHandle(), callback, IntPtr.Zero).
754                 ThrowIfFailed("Failed to get the supported scene modes.");
755
756             return sceneModes.AsReadOnly();
757         }
758
759         private IList<CameraEffectMode> GetSupportedEffects()
760         {
761             List<CameraEffectMode> effectModes = new List<CameraEffectMode>();
762
763             NativeCapabilities.EffectCallback callback = (CameraEffectMode effect, IntPtr userData) =>
764             {
765                 effectModes.Add(effect);
766                 return true;
767             };
768
769             NativeCapabilities.SupportedEffects(_camera.GetHandle(), callback, IntPtr.Zero).
770                 ThrowIfFailed("Failed to get the supported camera effects.");
771
772             return effectModes.AsReadOnly();
773         }
774
775         private IList<Rotation> GetSupportedStreamRotations()
776         {
777             List<Rotation> streamRotations = new List<Rotation>();
778
779             NativeCapabilities.StreamRotationCallback callback = (Rotation streamRotation, IntPtr userData) =>
780             {
781                 streamRotations.Add(streamRotation);
782                 return true;
783             };
784
785             NativeCapabilities.SupportedStreamRotations(_camera.GetHandle(), callback, IntPtr.Zero).
786                 ThrowIfFailed("Failed to get the supported camera rotations.");
787
788             return streamRotations.AsReadOnly();
789         }
790
791         private IList<Flips> GetSupportedStreamFlips()
792         {
793             List<Flips> streamFlips = new List<Flips>();
794
795             NativeCapabilities.StreamFlipCallback callback = (Flips streamFlip, IntPtr userData) =>
796             {
797                 streamFlips.Add(streamFlip);
798                 return true;
799             };
800
801             NativeCapabilities.SupportedStreamFlips(_camera.GetHandle(), callback, IntPtr.Zero).
802                 ThrowIfFailed("Failed to get the supported camera flips.");
803
804             return streamFlips.AsReadOnly();
805         }
806
807         private IList<CameraPtzType> GetSupportedPtzTypes()
808         {
809             List<CameraPtzType> ptzTypes = new List<CameraPtzType>();
810
811             NativeCapabilities.PtzTypeCallback callback = (CameraPtzType ptzType, IntPtr userData) =>
812             {
813                 ptzTypes.Add(ptzType);
814                 return true;
815             };
816
817             NativeCapabilities.SupportedPtzTypes(_camera.GetHandle(), callback, IntPtr.Zero).
818                 ThrowIfFailed("Failed to get the supported Ptz types.");
819
820             return ptzTypes.AsReadOnly();
821         }
822         #endregion Methods for getting supported values
823     }
824 }