2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 using System.Runtime.InteropServices;
19 using Native = Interop.CameraSettings;
20 using static Interop.Camera;
22 namespace Tizen.Multimedia
25 /// The camera setting class provides methods/properties to get and
26 /// set basic camera attributes.
28 /// <since_tizen> 3 </since_tizen>
29 public class CameraSettings
31 internal readonly Camera _camera;
33 private readonly Range? _brightnessRange;
34 private readonly Range? _contrastRange;
35 private readonly Range? _panRange;
36 private readonly Range? _tiltRange;
37 private readonly Range? _exposureRange;
38 private readonly Range? _zoomRange;
40 internal CameraSettings(Camera camera)
44 _contrastRange = GetRange(Native.GetContrastRange);
45 _brightnessRange = GetRange(Native.GetBrightnessRange);
46 _exposureRange = GetRange(Native.GetExposureRange);
47 _zoomRange = GetRange(Native.GetZoomRange);
48 _panRange = GetRange(Native.GetPanRange);
49 _tiltRange = GetRange(Native.GetTiltRange);
52 private delegate CameraError GetRangeDelegate(IntPtr handle, out int min, out int max);
53 private Range? GetRange(GetRangeDelegate func)
55 CameraErrorFactory.ThrowIfError(func(_camera.GetHandle(), out int min, out int max),
56 "Failed to initialize the camera settings");
63 return new Range(min, max);
68 /// Sets the auto focus area.
70 /// <since_tizen> 3 </since_tizen>
72 /// <see cref="CameraAutoFocusMode"/> should not be the <see cref="CameraAutoFocusMode.None"/>.
74 /// <param name="x">X position.</param>
75 /// <param name="y">Y position.</param>
76 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
77 /// <exception cref="InvalidOperationException">In case of any invalid operations.</exception>
78 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
79 public void SetAutoFocusArea(int x, int y)
81 CameraErrorFactory.ThrowIfError(Native.SetAutoFocusArea(_camera.GetHandle(), x, y),
82 "Failed to set the autofocus area.");
86 /// Sets the auto focus area.
88 /// <since_tizen> 3 </since_tizen>
90 /// <see cref="CameraAutoFocusMode"/> should not be the <see cref="CameraAutoFocusMode.None"/>.
92 /// <param name="pos"><see cref="Point"/> structure including X, Y position.</param>
93 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
94 /// <exception cref="InvalidOperationException">In case of any invalid operations.</exception>
95 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
96 public void SetAutoFocusArea(Point pos)
98 CameraErrorFactory.ThrowIfError(Native.SetAutoFocusArea(_camera.GetHandle(), pos.X, pos.Y),
99 "Failed to set the autofocus area.");
103 /// Clears the auto focus area.
105 /// <since_tizen> 3 </since_tizen>
106 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
107 public void ClearFocusArea()
109 CameraErrorFactory.ThrowIfError(Native.ClearAutoFocusArea(_camera.GetHandle()),
110 "Failed to clear the autofocus area.");
114 /// The auto focus mode.
116 /// <since_tizen> 3 </since_tizen>
117 /// <value>A <see cref="CameraAutoFocusMode"/> that specifies the auto focus mode.</value>
118 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
119 public CameraAutoFocusMode AutoFocusMode
123 CameraAutoFocusMode val = CameraAutoFocusMode.None;
125 CameraErrorFactory.ThrowIfError(Native.GetAutoFocusMode(_camera.GetHandle(), out val),
126 "Failed to get camera autofocus mode");
133 ValidationUtil.ValidateEnum(typeof(CameraAutoFocusMode), value, nameof(value));
135 CameraErrorFactory.ThrowIfError(Native.SetAutoFocusMode(_camera.GetHandle(), value),
136 "Failed to set camera autofocus mode.");
139 #endregion Auto Focus
143 /// The contrast level of the camera.
145 /// <since_tizen> 3 </since_tizen>
146 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
151 CameraErrorFactory.ThrowIfError(Native.GetContrast(_camera.GetHandle(), out int val),
152 "Failed to get camera contrast value");
159 CameraErrorFactory.ThrowIfError(Native.SetContrast(_camera.GetHandle(), value),
160 "Failed to set camera contrast value.");
165 /// The auto contrast.
166 /// If true auto contrast is enabled, otherwise false.
168 /// <since_tizen> 3 </since_tizen>
169 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
170 public bool AutoContrast
174 CameraErrorFactory.ThrowIfError(Native.IsEnabledAutoContrast(_camera.GetHandle(), out bool val),
175 "Failed to get camera auto contrast");
182 CameraErrorFactory.ThrowIfError(Native.EnableAutoContrast(_camera.GetHandle(), value),
183 "Failed to set camera enable auto contrast.");
187 /// Gets the available contrast level.
189 /// <since_tizen> 3 </since_tizen>
191 /// If the mininum value is greater than the maximum value, it means this feature is not supported.
193 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
194 public Range ContrastRange
198 if (!_contrastRange.HasValue)
200 throw new NotSupportedException("Contrast is not supported.");
203 return _contrastRange.Value;
210 /// The brightness level of the camera.
212 /// <since_tizen> 3 </since_tizen>
213 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
214 public int Brightness
218 CameraErrorFactory.ThrowIfError(Native.GetBrightness(_camera.GetHandle(), out int val),
219 "Failed to get camera brightness value");
226 CameraErrorFactory.ThrowIfError(Native.SetBrightness(_camera.GetHandle(), value),
227 "Failed to set camera brightness value.");
232 /// Gets the available brightness level.
234 /// <since_tizen> 3 </since_tizen>
236 /// If the minimum value is greater than the maximum value, it means this feature is not supported.
238 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
239 public Range BrightnessRange
243 if (!_brightnessRange.HasValue)
245 throw new NotSupportedException("Brightness is not supported.");
248 return _brightnessRange.Value;
251 #endregion Brightness
255 /// The exposure value.
257 /// <since_tizen> 3 </since_tizen>
258 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
263 CameraErrorFactory.ThrowIfError(Native.GetExposure(_camera.GetHandle(), out int val),
264 "Failed to get camera exposure value");
271 CameraErrorFactory.ThrowIfError(Native.SetExposure(_camera.GetHandle(), value),
272 "Failed to set camera exposure value.");
277 /// The exposure mode.
279 /// <since_tizen> 3 </since_tizen>
280 /// <value>A <see cref="CameraExposureMode"/> that specifies the exposure mode.</value>
281 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
282 public CameraExposureMode ExposureMode
286 CameraExposureMode val = CameraExposureMode.Off;
288 CameraErrorFactory.ThrowIfError(Native.GetExposureMode(_camera.GetHandle(), out val),
289 "Failed to get camera exposure mode");
296 ValidationUtil.ValidateEnum(typeof(CameraExposureMode), value, nameof(value));
298 CameraErrorFactory.ThrowIfError(Native.SetExposureMode(_camera.GetHandle(), value),
299 "Failed to set camera exposure mode.");
304 /// Gets the available exposure value.
306 /// <since_tizen> 3 </since_tizen>
308 /// If the minimum value is greater than the maximum value, it means this feature is not supported.
310 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
311 public Range ExposureRange
315 if (!_exposureRange.HasValue)
317 throw new NotSupportedException("Exposure is not supported.");
320 return _exposureRange.Value;
328 /// The range for the zoom level is received from the ZoomRange property.
330 /// <since_tizen> 3 </since_tizen>
331 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
336 CameraErrorFactory.ThrowIfError(Native.GetZoom(_camera.GetHandle(), out int val),
337 "Failed to get zoom level");
344 CameraErrorFactory.ThrowIfError(Native.SetZoom(_camera.GetHandle(), value),
345 "Failed to set zoom level.");
350 /// Gets the available zoom level.
352 /// <since_tizen> 3 </since_tizen>
354 /// If the minimum value is greater than the maximum value, it means this feature is not supported.
356 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
357 public Range ZoomRange
361 if (!_zoomRange.HasValue)
363 throw new NotSupportedException("Zoom is not supported.");
366 return _zoomRange.Value;
372 /// The white balance mode.
374 /// <since_tizen> 3 </since_tizen>
375 /// <value>A <see cref="CameraWhiteBalance"/> that specifies the white balance mode.</value>
376 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
377 public CameraWhiteBalance WhiteBalance
381 CameraWhiteBalance val = CameraWhiteBalance.None;
383 CameraErrorFactory.ThrowIfError(Native.GetWhiteBalance(_camera.GetHandle(), out val),
384 "Failed to get camera whitebalance");
391 ValidationUtil.ValidateEnum(typeof(CameraWhiteBalance), value, nameof(value));
393 CameraErrorFactory.ThrowIfError(Native.SetWhitebalance(_camera.GetHandle(), value),
394 "Failed to set camera whitebalance.");
401 /// <since_tizen> 3 </since_tizen>
402 /// <value>A <see cref="CameraIsoLevel"/> that specifies the ISO level.</value>
403 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
404 public CameraIsoLevel IsoLevel
408 CameraIsoLevel val = CameraIsoLevel.Auto;
410 CameraErrorFactory.ThrowIfError(Native.GetIso(_camera.GetHandle(), out val),
411 "Failed to get camera Iso level");
418 ValidationUtil.ValidateEnum(typeof(CameraIsoLevel), value, nameof(value));
420 CameraErrorFactory.ThrowIfError(Native.SetIso(_camera.GetHandle(), value),
421 "Failed to set camera Iso level.");
426 /// The quality of the image.
427 /// The range for the image quality is 1 to 100.
429 /// <since_tizen> 3 </since_tizen>
430 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
431 public int ImageQuality
435 CameraErrorFactory.ThrowIfError(Native.GetImageQuality(_camera.GetHandle(), out int val),
436 "Failed to get image quality");
443 if (value < 1 || value > 100)
445 throw new ArgumentException("Valid value is from 1(lowest quality) to 100(highest quality)");
448 CameraErrorFactory.ThrowIfError(Native.SetImageQuality(_camera.GetHandle(), value),
449 "Failed to set image quality.");
453 #region Resolution, Format, Fps of preview, capture
455 /// The preview frame rate.
457 /// <since_tizen> 3 </since_tizen>
458 /// <value>A <see cref="CameraFps"/> that specifies the preview frame rate.</value>
459 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
460 public CameraFps PreviewFps
464 CameraErrorFactory.ThrowIfError(Native.GetPreviewFps(_camera.GetHandle(), out var val),
465 "Failed to get camera preview fps");
472 ValidationUtil.ValidateEnum(typeof(CameraFps), value, nameof(value));
474 CameraErrorFactory.ThrowIfError(Native.SetPreviewFps(_camera.GetHandle(), value),
475 "Failed to set preview fps.");
480 /// Gets or sets the resolution of the preview.
482 /// <since_tizen> 3 </since_tizen>
483 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
484 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
485 public Size PreviewResolution
489 CameraErrorFactory.ThrowIfError(GetPreviewResolution(_camera.GetHandle(), out int width, out int height),
490 "Failed to get camera preview resolution");
492 return new Size(width, height);
497 CameraErrorFactory.ThrowIfError(SetPreviewResolution(_camera.GetHandle(), value.Width, value.Height),
498 "Failed to set preview resolution.");
503 /// Gets the recommended preview resolution.
505 /// <since_tizen> 3 </since_tizen>
507 /// Depending on the capture resolution aspect ratio and the display resolution,
508 /// the recommended preview resolution is determined.
510 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
511 public Size RecommendedPreviewResolution
515 CameraErrorFactory.ThrowIfError(GetRecommendedPreviewResolution(_camera.GetHandle(), out int width, out int height),
516 "Failed to get recommended preview resolution");
518 return new Size(width, height);
523 /// The preview data format.
525 /// <since_tizen> 3 </since_tizen>
526 /// <value>A <see cref="CameraPixelFormat"/> that specifies the pixel format of the preview data.</value>
527 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
528 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
529 public CameraPixelFormat PreviewPixelFormat
533 CameraErrorFactory.ThrowIfError(GetPreviewPixelFormat(_camera.GetHandle(), out var val),
534 "Failed to get preview format");
541 ValidationUtil.ValidateEnum(typeof(CameraPixelFormat), value, nameof(value));
543 CameraErrorFactory.ThrowIfError(SetPreviewPixelFormat(_camera.GetHandle(), value),
544 "Failed to set preview format.");
549 /// Resolution of the captured image.
551 /// <since_tizen> 3 </since_tizen>
552 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
553 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
554 public Size CaptureResolution
558 CameraErrorFactory.ThrowIfError(GetCaptureResolution(_camera.GetHandle(), out int width, out int height),
559 "Failed to get camera capture resolution");
561 return new Size(width, height);
568 CameraErrorFactory.ThrowIfError(SetCaptureResolution(_camera.GetHandle(), res.Width, res.Height),
569 "Failed to set capture resolution.");
574 /// Format of an image to be captured.
576 /// <since_tizen> 3 </since_tizen>
577 /// <value>A <see cref="CameraPixelFormat"/> that specifies the pixel format of captured image.</value>
578 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
579 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
580 public CameraPixelFormat CapturePixelFormat
584 CameraErrorFactory.ThrowIfError(GetCaptureFormat(_camera.GetHandle(), out var val),
585 "Failed to get camera capture formats");
592 ValidationUtil.ValidateEnum(typeof(CameraPixelFormat), value, nameof(value));
594 CameraErrorFactory.ThrowIfError(SetCaptureFormat(_camera.GetHandle(), value),
595 "Failed to set capture format.");
598 #endregion Resolution, Format, Fps of preview, capture
600 #region Encoded preview
602 /// The bit rate of the encoded preview.
604 /// <since_tizen> 3 </since_tizen>
605 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
606 public int EncodedPreviewBitrate
610 CameraErrorFactory.ThrowIfError(Native.GetBitrate(_camera.GetHandle(), out int val),
611 "Failed to get preview bitrate");
618 CameraErrorFactory.ThrowIfError(Native.SetBitrate(_camera.GetHandle(), value),
619 "Failed to set encoded preview bitrate.");
624 /// The GOP(Group Of Pictures) interval of the encoded preview.
626 /// <since_tizen> 3 </since_tizen>
627 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
628 public int EncodedPreviewGopInterval
632 CameraErrorFactory.ThrowIfError(Native.GetGopInterval(_camera.GetHandle(), out int val),
633 "Failed to get preview gop interval");
640 CameraErrorFactory.ThrowIfError(Native.SetGopInterval(_camera.GetHandle(), value),
641 "Failed to set encoded preview gop intervals.");
644 #endregion Encoded preview
647 /// The theater mode.
649 /// <since_tizen> 3 </since_tizen>
650 /// <value>A <see cref="CameraTheaterMode"/> that specifies the theater mode.</value>
652 /// If you want to display the preview image on the external display with the full screen mode,
653 /// use this property.
655 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
656 public CameraTheaterMode TheaterMode
660 CameraErrorFactory.ThrowIfError(Native.GetTheaterMode(_camera.GetHandle(), out var val),
661 "Failed to get camera theater mode");
668 ValidationUtil.ValidateEnum(typeof(CameraTheaterMode), value, nameof(value));
670 CameraErrorFactory.ThrowIfError(Native.SetTheaterMode(_camera.GetHandle(), value),
671 "Failed to set camera theater mode.");
676 /// The camera effect mode.
678 /// <since_tizen> 3 </since_tizen>
679 /// <value>A <see cref="CameraEffectMode"/> that specifies the effect mode.</value>
680 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
681 public CameraEffectMode Effect
685 CameraErrorFactory.ThrowIfError(Native.GetEffect(_camera.GetHandle(), out var val),
686 "Failed to get camera effect");
693 ValidationUtil.ValidateEnum(typeof(CameraEffectMode), value, nameof(value));
695 CameraErrorFactory.ThrowIfError(Native.SetEffect(_camera.GetHandle(), value),
696 "Failed to set camera effect.");
703 /// <since_tizen> 3 </since_tizen>
704 /// <value>A <see cref="CameraSceneMode"/> that specifies the scene mode.</value>
705 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
706 public CameraSceneMode SceneMode
710 CameraErrorFactory.ThrowIfError(Native.GetSceneMode(_camera.GetHandle(), out var val),
711 "Failed to get camera scene mode");
718 ValidationUtil.ValidateEnum(typeof(CameraSceneMode), value, nameof(value));
720 CameraErrorFactory.ThrowIfError(Native.SetSceneMode(_camera.GetHandle(), value),
721 "Failed to set camera scene mode.");
726 /// The camera's flash mode.
728 /// <since_tizen> 3 </since_tizen>
729 /// <value>A <see cref="CameraFlashMode"/> that specifies the flash mode.</value>
730 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
731 public CameraFlashMode FlashMode
735 CameraErrorFactory.ThrowIfError(Native.GetFlashMode(_camera.GetHandle(), out var val),
736 "Failed to get camera flash mode");
743 ValidationUtil.ValidateEnum(typeof(CameraFlashMode), value, nameof(value));
745 CameraErrorFactory.ThrowIfError(Native.SetFlashMode(_camera.GetHandle(), value),
746 "Failed to set camera flash mode.");
751 /// Gets the camera lens orientation angle.
753 /// <since_tizen> 3 </since_tizen>
754 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
755 public int LensOrientation
759 CameraErrorFactory.ThrowIfError(Native.GetLensOrientation(_camera.GetHandle(), out var val),
760 "Failed to get camera lens orientation");
767 /// The stream rotation.
769 /// <since_tizen> 3 </since_tizen>
770 /// <value>A <see cref="Rotation"/> that specifies the rotation of camera device.</value>
771 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
772 public Rotation StreamRotation
776 CameraErrorFactory.ThrowIfError(Native.GetStreamRotation(_camera.GetHandle(), out var val),
777 "Failed to get camera stream rotation");
784 ValidationUtil.ValidateEnum(typeof(Rotation), value, nameof(value));
786 CameraErrorFactory.ThrowIfError(Native.SetStreamRotation(_camera.GetHandle(), value),
787 "Failed to set camera stream rotation.");
794 /// <since_tizen> 3 </since_tizen>
795 /// <value>A <see cref="Flips"/> that specifies the camera flip type.</value>
796 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
797 public Flips StreamFlip
801 CameraErrorFactory.ThrowIfError(Native.GetFlip(_camera.GetHandle(), out var val),
802 "Failed to get camera stream flip");
809 ValidationUtil.ValidateFlagsEnum(value, Flips.Horizontal | Flips.Vertical, nameof(Flips));
811 CameraErrorFactory.ThrowIfError(Native.SetFlip(_camera.GetHandle(), value),
812 "Failed to set camera flip.");
817 /// The mode of the HDR(High dynamic range) capture.
819 /// <since_tizen> 3 </since_tizen>
820 /// <value>A <see cref="CameraHdrMode"/> that specifies the HDR mode.</value>
822 /// Taking multiple pictures at different exposure levels and intelligently stitching them together,
823 /// so that we eventually arrive at a picture that is representative in both dark and bright areas.
824 /// If this attribute is set, then event handler set for the HdrCaptureProgress event is invoked.
826 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
827 public CameraHdrMode HdrMode
831 CameraErrorFactory.ThrowIfError(Native.GetHdrMode(_camera.GetHandle(), out var val),
832 "Failed to get camera hdr mode");
839 ValidationUtil.ValidateEnum(typeof(CameraHdrMode), value, nameof(value));
841 CameraErrorFactory.ThrowIfError(Native.SetHdrMode(_camera.GetHandle(), value),
842 "Failed to set camera hdr mode.");
847 /// The anti shake feature.
848 /// If true, the antishake feature is enabled, otherwise false.
850 /// <since_tizen> 3 </since_tizen>
851 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
852 public bool AntiShake
856 CameraErrorFactory.ThrowIfError(Native.IsEnabledAntiShake(_camera.GetHandle(), out bool val),
857 "Failed to get camera anti shake value");
864 CameraErrorFactory.ThrowIfError(Native.EnableAntiShake(_camera.GetHandle(), value),
865 "Failed to set camera anti shake value.");
870 /// Enables or disables the video stabilization feature.
871 /// If true, video stabilization is enabled, otherwise false.
873 /// <since_tizen> 3 </since_tizen>
875 /// If video stabilization is enabled, zero shutter lag is disabled.
876 /// This feature is used to record a video.
878 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
879 public bool VideoStabilization
883 CameraErrorFactory.ThrowIfError(Native.IsEnabledVideoStabilization(_camera.GetHandle(), out bool val),
884 "Failed to get camera video stabilization");
891 CameraErrorFactory.ThrowIfError(Native.EnableVideoStabilization(_camera.GetHandle(), value),
892 "Failed to set camera video stabilization.");
897 /// Turn the shutter sound on or off, if it is permitted by policy.
899 /// <since_tizen> 4 </since_tizen>
900 /// <param name="shutterSound">Shutter sound On/Off flag</param>
902 /// If this value is true, shutter sound will be disabled, otherwise enabled.
903 /// In some countries, this operation is not permitted.
905 /// <exception cref="InvalidOperationException">Disabling shutter sound is not permitted.</exception>
906 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
907 public void DisableShutterSound(bool shutterSound)
909 CameraErrorFactory.ThrowIfError(Native.DisableShutterSound(_camera.GetHandle(), shutterSound),
910 "Failed to set disable shutter sound.");
913 #region PTZ(Pan Tilt Zoom), Pan, Tilt
915 /// Sets the type of the PTZ(Pan Tilt Zoom). Mechanical or electronic.
917 /// <since_tizen> 3 </since_tizen>
918 /// <value>A <see cref="CameraPtzType"/> that specifies the type of the PTZ.</value>
919 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
920 public CameraPtzType PtzType
924 ValidationUtil.ValidateEnum(typeof(CameraPtzType), value, nameof(value));
926 CameraErrorFactory.ThrowIfError(Native.SetPtzType(_camera.GetHandle(), value),
927 "Failed to set camera ptz type.");
932 /// Sets the position to move horizontally.
934 /// <since_tizen> 3 </since_tizen>
935 /// <param name="type">The PTZ move type. <seealso cref="CameraPtzMoveType"/>.</param>
936 /// <param name="panStep">The pan step.</param>
937 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
938 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
939 public void SetPan(CameraPtzMoveType type, int panStep)
941 ValidationUtil.ValidateEnum(typeof(CameraPtzMoveType), type, nameof(type));
943 CameraErrorFactory.ThrowIfError(Native.SetPan(_camera.GetHandle(), type, panStep),
944 "Failed to set the camera pan type.");
948 /// Gets the current position of the camera.
950 /// <since_tizen> 3 </since_tizen>
951 /// <returns>Returns the camera's horizontal position.</returns>
952 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
955 CameraErrorFactory.ThrowIfError(Native.GetPan(_camera.GetHandle(), out int val),
956 "Failed to get the camera pan step.");
962 /// Sets the position to move vertically.
964 /// <since_tizen> 3 </since_tizen>
965 /// <param name="type">the PTZ move type.</param>
966 /// <param name="tiltStep">The tilt step.</param>
967 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
968 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
969 public void SetTilt(CameraPtzMoveType type, int tiltStep)
971 ValidationUtil.ValidateEnum(typeof(CameraPtzMoveType), type, nameof(type));
972 CameraErrorFactory.ThrowIfError(Native.SetTilt(_camera.GetHandle(), type, tiltStep),
973 "Failed to set the camera tilt type\t.");
977 /// Gets the current position of the camera.
979 /// <since_tizen> 3 </since_tizen>
980 /// <returns>Returns the current vertical position.</returns>
981 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
984 CameraErrorFactory.ThrowIfError(Native.GetTilt(_camera.GetHandle(), out int val),
985 "Failed to set the camera current position.");
991 /// Gets the lower limit and the upper limit for the pan position.
993 /// <since_tizen> 3 </since_tizen>
995 /// If the minimum value is greater than the maximum value, it means this feature is not supported.
997 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
998 public Range PanRange
1002 if (!_panRange.HasValue)
1004 throw new NotSupportedException("Pan is not supported.");
1007 return _panRange.Value;
1012 /// Gets the lower limit and the upper limit for the tilt position.
1014 /// <since_tizen> 3 </since_tizen>
1016 /// If the minimum value is greater than the maximum value, it means this feature is not supported.
1018 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
1019 public Range TiltRange
1023 if (!_tiltRange.HasValue)
1025 throw new NotSupportedException("Tilt is not supported.");
1028 return _tiltRange.Value;
1031 #endregion PTZ(Pan Tilt Zoom), Pan, Tilt
1037 /// <value>true if EXIF tags are enabled in the JPEG file, otherwise false.</value>
1038 /// <since_tizen> 3 </since_tizen>
1039 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
1040 public bool EnableTag
1044 CameraErrorFactory.ThrowIfError(Native.IsEnabledTag(_camera.GetHandle(), out bool val),
1045 "Failed to get camera enable tag");
1052 CameraErrorFactory.ThrowIfError(Native.EnableTag(_camera.GetHandle(), value),
1053 "Failed to set camera enable tag.");
1058 /// The camera image description in the EXIF tag.
1060 /// <since_tizen> 3 </since_tizen>
1061 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
1062 public string ImageDescriptionTag
1066 IntPtr val = IntPtr.Zero;
1069 CameraErrorFactory.ThrowIfError(Native.GetImageDescription(_camera.GetHandle(), out val),
1070 "Failed to get image description");
1072 return Marshal.PtrToStringAnsi(val);
1076 LibcSupport.Free(val);
1082 CameraErrorFactory.ThrowIfError(Native.SetImageDescription(_camera.GetHandle(), value),
1083 "Failed to set image description.");
1088 /// The software information in the EXIF tag.
1090 /// <since_tizen> 3 </since_tizen>
1091 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
1092 public string SoftwareTag
1096 IntPtr val = IntPtr.Zero;
1100 CameraErrorFactory.ThrowIfError(Native.GetTagSoftware(_camera.GetHandle(), out val),
1101 "Failed to get tag software");
1103 return Marshal.PtrToStringAnsi(val);
1107 LibcSupport.Free(val);
1113 CameraErrorFactory.ThrowIfError(Native.SetTagSoftware(_camera.GetHandle(), value),
1114 "Failed to set tag software.");
1119 /// The geo tag(GPS data) in the EXIF tag.
1121 /// <since_tizen> 3 </since_tizen>
1122 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
1123 public Location GeoTag
1127 CameraErrorFactory.ThrowIfError(Native.GetGeotag(_camera.GetHandle(),
1128 out double latitude, out double longitude, out double altitude), "Failed to get tag");
1130 return new Location(latitude, longitude, altitude);
1135 CameraErrorFactory.ThrowIfError(Native.SetGeotag(_camera.GetHandle(),
1136 value.Latitude, value.Longitude, value.Altitude), "Failed to set geo tag.");
1141 /// Removes the geo tag(GPS data) in the EXIF(EXchangeable Image File format) tag.
1143 /// <since_tizen> 3 </since_tizen>
1144 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
1145 public void RemoveGeoTag()
1147 CameraErrorFactory.ThrowIfError(Native.RemoveGeotag(_camera.GetHandle()),
1148 "Failed to remove the geotag\t.");
1152 /// The camera orientation in the tag.
1154 /// <since_tizen> 3 </since_tizen>
1155 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
1156 public CameraTagOrientation OrientationTag
1160 CameraErrorFactory.ThrowIfError(Native.GetTagOrientation(_camera.GetHandle(), out var val),
1161 "Failed to get camera tag orientation");
1168 ValidationUtil.ValidateEnum(typeof(CameraTagOrientation), value, nameof(value));
1170 CameraErrorFactory.ThrowIfError(Native.SetTagOrientation(_camera.GetHandle(), value),
1171 "Failed to set camera tag orientation.");