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? _exposureRange;
36 private readonly Range? _hueRange = null;
37 private readonly Range? _panRange;
38 private readonly Range? _tiltRange;
39 private readonly Range? _zoomRange;
41 internal CameraSettings(Camera camera)
45 _brightnessRange = GetRange(Native.GetBrightnessRange);
46 _contrastRange = GetRange(Native.GetContrastRange);
47 _exposureRange = GetRange(Native.GetExposureRange);
48 _hueRange = GetRange(Native.GetHueRange);
49 _panRange = GetRange(Native.GetPanRange);
50 _tiltRange = GetRange(Native.GetTiltRange);
51 _zoomRange = GetRange(Native.GetZoomRange);
54 private delegate CameraError GetRangeDelegate(IntPtr handle, out int min, out int max);
55 private Range? GetRange(GetRangeDelegate func)
57 func(_camera.GetHandle(), out int min, out int max).
58 ThrowIfFailed("Failed to initialize the camera settings");
65 return new Range(min, max);
70 /// Sets the auto focus area.
72 /// <param name="x">X position.</param>
73 /// <param name="y">Y position.</param>
74 /// <since_tizen> 3 </since_tizen>
75 /// <feature> http://tizen.org/feature/camera </feature>
77 /// <see cref="CameraAutoFocusMode"/> should not be the <see cref="CameraAutoFocusMode.None"/>.
79 /// /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
80 /// <exception cref="InvalidOperationException">In case of any invalid operations.</exception>
81 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
82 public void SetAutoFocusArea(int x, int y)
84 Native.SetAutoFocusArea(_camera.GetHandle(), x, y).
85 ThrowIfFailed("Failed to set the autofocus area.");
89 /// Sets the auto focus area.
91 /// <param name="pos"><see cref="Point"/> structure including X, Y position.</param>
92 /// <since_tizen> 3 </since_tizen>
93 /// <feature> http://tizen.org/feature/camera </feature>
95 /// <see cref="CameraAutoFocusMode"/> should not be the <see cref="CameraAutoFocusMode.None"/>.
97 /// /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
98 /// <exception cref="InvalidOperationException">In case of any invalid operations.</exception>
99 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
100 public void SetAutoFocusArea(Point pos)
102 Native.SetAutoFocusArea(_camera.GetHandle(), pos.X, pos.Y).
103 ThrowIfFailed("Failed to set the autofocus area.");
107 /// Clears the auto focus area.
109 /// <since_tizen> 3 </since_tizen>
110 /// <feature> http://tizen.org/feature/camera </feature>
111 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
112 public void ClearFocusArea()
114 Native.ClearAutoFocusArea(_camera.GetHandle()).
115 ThrowIfFailed("Failed to clear the autofocus area.");
119 /// The auto focus mode.
121 /// <since_tizen> 3 </since_tizen>
122 /// <value>A <see cref="CameraAutoFocusMode"/> that specifies the auto focus mode.</value>
123 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
124 public CameraAutoFocusMode AutoFocusMode
128 CameraAutoFocusMode val = CameraAutoFocusMode.None;
130 Native.GetAutoFocusMode(_camera.GetHandle(), out val).
131 ThrowIfFailed("Failed to get camera autofocus mode");
138 ValidationUtil.ValidateEnum(typeof(CameraAutoFocusMode), value, nameof(value));
140 Native.SetAutoFocusMode(_camera.GetHandle(), value).
141 ThrowIfFailed("Failed to set camera autofocus mode.");
144 #endregion Auto Focus
148 /// The contrast level of the camera.
150 /// <since_tizen> 3 </since_tizen>
151 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
156 Native.GetContrast(_camera.GetHandle(), out int val).
157 ThrowIfFailed("Failed to get camera contrast value");
164 Native.SetContrast(_camera.GetHandle(), value).
165 ThrowIfFailed("Failed to set camera contrast value.");
170 /// The auto contrast.
171 /// If true auto contrast is enabled, otherwise false.
173 /// <since_tizen> 3 </since_tizen>
174 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
175 public bool AutoContrast
179 Native.IsEnabledAutoContrast(_camera.GetHandle(), out bool val).
180 ThrowIfFailed("Failed to get camera auto contrast");
187 Native.EnableAutoContrast(_camera.GetHandle(), value).
188 ThrowIfFailed("Failed to set camera enable auto contrast.");
193 /// Gets the available contrast level.
195 /// <since_tizen> 3 </since_tizen>
197 /// If the mininum value is greater than the maximum value, it means this feature is not supported.
199 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
200 public Range ContrastRange
204 if (!_contrastRange.HasValue)
206 throw new NotSupportedException("Contrast is not supported.");
209 return _contrastRange.Value;
216 /// The hue level of the camera.
218 /// <since_tizen> 5 </since_tizen>
219 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
224 Native.GetHue(_camera.GetHandle(), out int val).
225 ThrowIfFailed("Failed to get camera hue value");
232 Native.SetHue(_camera.GetHandle(), value).
233 ThrowIfFailed("Failed to set camera hue value.");
238 /// Gets the available hue level.
240 /// <since_tizen> 5 </since_tizen>
242 /// If HueRange returns null, it means that hue feature is not supported.
243 /// It can be checked also with <see cref="CameraCapabilities.IsHueSupported"/>.
245 /// <seealso cref="Hue"/>
246 public Range? HueRange
250 if (!_hueRange.HasValue)
255 return _hueRange.Value;
262 /// The brightness level of the camera.
264 /// <since_tizen> 3 </since_tizen>
265 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
266 public int Brightness
270 Native.GetBrightness(_camera.GetHandle(), out int val).
271 ThrowIfFailed("Failed to get camera brightness value");
278 Native.SetBrightness(_camera.GetHandle(), value).
279 ThrowIfFailed("Failed to set camera brightness value.");
284 /// Gets the available brightness level.
286 /// <since_tizen> 3 </since_tizen>
288 /// If the minimum value is greater than the maximum value, it means this feature is not supported.
290 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
291 public Range BrightnessRange
295 if (!_brightnessRange.HasValue)
297 throw new NotSupportedException("Brightness is not supported.");
300 return _brightnessRange.Value;
303 #endregion Brightness
307 /// The exposure value.
309 /// <since_tizen> 3 </since_tizen>
310 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
315 Native.GetExposure(_camera.GetHandle(), out int val).
316 ThrowIfFailed("Failed to get camera exposure value");
323 Native.SetExposure(_camera.GetHandle(), value).
324 ThrowIfFailed("Failed to set camera exposure value.");
329 /// The exposure mode.
331 /// <since_tizen> 3 </since_tizen>
332 /// <value>A <see cref="CameraExposureMode"/> that specifies the exposure mode.</value>
333 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
334 public CameraExposureMode ExposureMode
338 CameraExposureMode val = CameraExposureMode.Off;
340 Native.GetExposureMode(_camera.GetHandle(), out val).
341 ThrowIfFailed("Failed to get camera exposure mode");
348 ValidationUtil.ValidateEnum(typeof(CameraExposureMode), value, nameof(value));
350 Native.SetExposureMode(_camera.GetHandle(), value).
351 ThrowIfFailed("Failed to set camera exposure mode.");
356 /// Gets the available exposure value.
358 /// <since_tizen> 3 </since_tizen>
360 /// If the minimum value is greater than the maximum value, it means this feature is not supported.
362 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
363 public Range ExposureRange
367 if (!_exposureRange.HasValue)
369 throw new NotSupportedException("Exposure is not supported.");
372 return _exposureRange.Value;
380 /// The range for the zoom level is received from the ZoomRange property.
382 /// <since_tizen> 3 </since_tizen>
383 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
388 Native.GetZoom(_camera.GetHandle(), out int val).
389 ThrowIfFailed("Failed to get zoom level");
396 Native.SetZoom(_camera.GetHandle(), value).
397 ThrowIfFailed("Failed to set zoom level.");
402 /// Gets the available zoom level.
404 /// <since_tizen> 3 </since_tizen>
406 /// If the minimum value is greater than the maximum value, it means this feature is not supported.
408 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
409 public Range ZoomRange
413 if (!_zoomRange.HasValue)
415 throw new NotSupportedException("Zoom is not supported.");
418 return _zoomRange.Value;
424 /// The white balance mode.
426 /// <since_tizen> 3 </since_tizen>
427 /// <value>A <see cref="CameraWhiteBalance"/> that specifies the white balance mode.</value>
428 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
429 public CameraWhiteBalance WhiteBalance
433 CameraWhiteBalance val = CameraWhiteBalance.None;
435 Native.GetWhiteBalance(_camera.GetHandle(), out val).
436 ThrowIfFailed("Failed to get camera whitebalance");
443 ValidationUtil.ValidateEnum(typeof(CameraWhiteBalance), value, nameof(value));
445 Native.SetWhitebalance(_camera.GetHandle(), value).
446 ThrowIfFailed("Failed to set camera whitebalance.");
453 /// <since_tizen> 3 </since_tizen>
454 /// <value>A <see cref="CameraIsoLevel"/> that specifies the ISO level.</value>
455 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
456 public CameraIsoLevel IsoLevel
460 CameraIsoLevel val = CameraIsoLevel.Auto;
462 Native.GetIso(_camera.GetHandle(), out val).
463 ThrowIfFailed("Failed to get camera Iso level");
470 ValidationUtil.ValidateEnum(typeof(CameraIsoLevel), value, nameof(value));
472 Native.SetIso(_camera.GetHandle(), value).
473 ThrowIfFailed("Failed to set camera Iso level.");
478 /// The quality of the image.
479 /// The range for the image quality is 1 to 100.
481 /// <since_tizen> 3 </since_tizen>
482 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
483 public int ImageQuality
487 Native.GetImageQuality(_camera.GetHandle(), out int val).
488 ThrowIfFailed("Failed to get image quality");
495 if (value < 1 || value > 100)
497 throw new ArgumentException("Valid value is from 1(lowest quality) to 100(highest quality)");
500 Native.SetImageQuality(_camera.GetHandle(), value).
501 ThrowIfFailed("Failed to set image quality.");
505 #region Resolution, Format, Fps of preview, capture
507 /// The preview frame rate.
509 /// <since_tizen> 3 </since_tizen>
510 /// <value>A <see cref="CameraFps"/> that specifies the preview frame rate.</value>
511 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
512 public CameraFps PreviewFps
516 Native.GetPreviewFps(_camera.GetHandle(), out var val).
517 ThrowIfFailed("Failed to get camera preview fps");
524 ValidationUtil.ValidateEnum(typeof(CameraFps), value, nameof(value));
526 Native.SetPreviewFps(_camera.GetHandle(), value).
527 ThrowIfFailed("Failed to set preview fps.");
532 /// Gets or sets the resolution of the preview.
534 /// <since_tizen> 3 </since_tizen>
535 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
536 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
537 public Size PreviewResolution
541 GetPreviewResolution(_camera.GetHandle(), out int width, out int height).
542 ThrowIfFailed("Failed to get camera preview resolution");
544 return new Size(width, height);
549 SetPreviewResolution(_camera.GetHandle(), value.Width, value.Height).
550 ThrowIfFailed("Failed to set preview resolution.");
555 /// Gets the recommended preview resolution.
557 /// <since_tizen> 3 </since_tizen>
559 /// Depending on the capture resolution aspect ratio and the display resolution,
560 /// the recommended preview resolution is determined.
562 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
563 public Size RecommendedPreviewResolution
567 GetRecommendedPreviewResolution(_camera.GetHandle(), out int width, out int height).
568 ThrowIfFailed("Failed to get recommended preview resolution");
570 return new Size(width, height);
575 /// The preview data format.
577 /// <since_tizen> 3 </since_tizen>
578 /// <value>A <see cref="CameraPixelFormat"/> that specifies the pixel format of the preview data.</value>
579 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
580 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
581 public CameraPixelFormat PreviewPixelFormat
585 GetPreviewPixelFormat(_camera.GetHandle(), out var val).
586 ThrowIfFailed("Failed to get preview format");
593 ValidationUtil.ValidateEnum(typeof(CameraPixelFormat), value, nameof(value));
595 SetPreviewPixelFormat(_camera.GetHandle(), value).
596 ThrowIfFailed("Failed to set preview format.");
601 /// Resolution of the captured image.
603 /// <since_tizen> 3 </since_tizen>
604 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
605 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
606 public Size CaptureResolution
610 GetCaptureResolution(_camera.GetHandle(), out int width, out int height).
611 ThrowIfFailed("Failed to get camera capture resolution");
613 return new Size(width, height);
620 SetCaptureResolution(_camera.GetHandle(), res.Width, res.Height).
621 ThrowIfFailed("Failed to set capture resolution.");
626 /// Format of an image to be captured.
628 /// <since_tizen> 3 </since_tizen>
629 /// <value>A <see cref="CameraPixelFormat"/> that specifies the pixel format of captured image.</value>
630 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
631 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
632 public CameraPixelFormat CapturePixelFormat
636 GetCaptureFormat(_camera.GetHandle(), out var val).
637 ThrowIfFailed("Failed to get camera capture formats");
644 ValidationUtil.ValidateEnum(typeof(CameraPixelFormat), value, nameof(value));
646 SetCaptureFormat(_camera.GetHandle(), value).
647 ThrowIfFailed("Failed to set capture format.");
650 #endregion Resolution, Format, Fps of preview, capture
652 #region Encoded preview
654 /// The bit rate of the encoded preview.
656 /// <since_tizen> 3 </since_tizen>
657 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
658 public int EncodedPreviewBitrate
662 Native.GetBitrate(_camera.GetHandle(), out int val).
663 ThrowIfFailed("Failed to get preview bitrate");
670 Native.SetBitrate(_camera.GetHandle(), value).
671 ThrowIfFailed("Failed to set encoded preview bitrate.");
676 /// The GOP(Group Of Pictures) interval of the encoded preview.
678 /// <since_tizen> 3 </since_tizen>
679 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
680 public int EncodedPreviewGopInterval
684 Native.GetGopInterval(_camera.GetHandle(), out int val).
685 ThrowIfFailed("Failed to get preview gop interval");
692 Native.SetGopInterval(_camera.GetHandle(), value).
693 ThrowIfFailed("Failed to set encoded preview gop intervals.");
696 #endregion Encoded preview
699 /// The theater mode.
701 /// <since_tizen> 3 </since_tizen>
702 /// <value>A <see cref="CameraTheaterMode"/> that specifies the theater mode.</value>
704 /// If you want to display the preview image on the external display with the full screen mode,
705 /// use this property.
707 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
708 public CameraTheaterMode TheaterMode
712 Native.GetTheaterMode(_camera.GetHandle(), out var val).
713 ThrowIfFailed("Failed to get camera theater mode");
720 ValidationUtil.ValidateEnum(typeof(CameraTheaterMode), value, nameof(value));
722 Native.SetTheaterMode(_camera.GetHandle(), value).
723 ThrowIfFailed("Failed to set camera theater mode.");
728 /// The camera effect mode.
730 /// <since_tizen> 3 </since_tizen>
731 /// <value>A <see cref="CameraEffectMode"/> that specifies the effect mode.</value>
732 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
733 public CameraEffectMode Effect
737 Native.GetEffect(_camera.GetHandle(), out var val).
738 ThrowIfFailed("Failed to get camera effect");
745 ValidationUtil.ValidateEnum(typeof(CameraEffectMode), value, nameof(value));
747 Native.SetEffect(_camera.GetHandle(), value).
748 ThrowIfFailed("Failed to set camera effect.");
755 /// <since_tizen> 3 </since_tizen>
756 /// <value>A <see cref="CameraSceneMode"/> that specifies the scene mode.</value>
757 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
758 public CameraSceneMode SceneMode
762 Native.GetSceneMode(_camera.GetHandle(), out var val).
763 ThrowIfFailed("Failed to get camera scene mode");
770 ValidationUtil.ValidateEnum(typeof(CameraSceneMode), value, nameof(value));
772 Native.SetSceneMode(_camera.GetHandle(), value).
773 ThrowIfFailed("Failed to set camera scene mode.");
778 /// The camera's flash mode.
780 /// <since_tizen> 3 </since_tizen>
781 /// <value>A <see cref="CameraFlashMode"/> that specifies the flash mode.</value>
782 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
783 public CameraFlashMode FlashMode
787 Native.GetFlashMode(_camera.GetHandle(), out var val).
788 ThrowIfFailed("Failed to get camera flash mode");
795 ValidationUtil.ValidateEnum(typeof(CameraFlashMode), value, nameof(value));
797 Native.SetFlashMode(_camera.GetHandle(), value).
798 ThrowIfFailed("Failed to set camera flash mode.");
803 /// Gets the camera lens orientation angle.
805 /// <since_tizen> 3 </since_tizen>
806 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
807 public int LensOrientation
811 Native.GetLensOrientation(_camera.GetHandle(), out var val).
812 ThrowIfFailed("Failed to get camera lens orientation");
819 /// The stream rotation.
821 /// <since_tizen> 3 </since_tizen>
822 /// <value>A <see cref="Rotation"/> that specifies the rotation of camera device.</value>
823 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
824 public Rotation StreamRotation
828 Native.GetStreamRotation(_camera.GetHandle(), out var val).
829 ThrowIfFailed("Failed to get camera stream rotation");
836 ValidationUtil.ValidateEnum(typeof(Rotation), value, nameof(value));
838 Native.SetStreamRotation(_camera.GetHandle(), value).
839 ThrowIfFailed("Failed to set camera stream rotation.");
846 /// <since_tizen> 3 </since_tizen>
847 /// <value>A <see cref="Flips"/> that specifies the camera flip type.</value>
848 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
849 public Flips StreamFlip
853 Native.GetFlip(_camera.GetHandle(), out var val).
854 ThrowIfFailed("Failed to get camera stream flip");
861 ValidationUtil.ValidateFlagsEnum(value, Flips.Horizontal | Flips.Vertical, nameof(Flips));
863 Native.SetFlip(_camera.GetHandle(), value).
864 ThrowIfFailed("Failed to set camera flip.");
869 /// The mode of the HDR(High dynamic range) capture.
871 /// <since_tizen> 3 </since_tizen>
872 /// <value>A <see cref="CameraHdrMode"/> that specifies the HDR mode.</value>
874 /// Taking multiple pictures at different exposure levels and intelligently stitching them together,
875 /// so that we eventually arrive at a picture that is representative in both dark and bright areas.
876 /// If this attribute is set, then event handler set for the HdrCaptureProgress event is invoked.
878 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
879 public CameraHdrMode HdrMode
883 Native.GetHdrMode(_camera.GetHandle(), out var val).
884 ThrowIfFailed("Failed to get camera hdr mode");
891 ValidationUtil.ValidateEnum(typeof(CameraHdrMode), value, nameof(value));
893 Native.SetHdrMode(_camera.GetHandle(), value).
894 ThrowIfFailed("Failed to set camera hdr mode.");
899 /// The anti shake feature.
900 /// If true, the antishake feature is enabled, otherwise false.
902 /// <since_tizen> 3 </since_tizen>
903 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
904 public bool AntiShake
908 Native.IsEnabledAntiShake(_camera.GetHandle(), out bool val).
909 ThrowIfFailed("Failed to get camera anti shake value");
916 Native.EnableAntiShake(_camera.GetHandle(), value).
917 ThrowIfFailed("Failed to set camera anti shake value.");
922 /// Enables or disables the video stabilization feature.
923 /// If true, video stabilization is enabled, otherwise false.
925 /// <since_tizen> 3 </since_tizen>
927 /// If video stabilization is enabled, zero shutter lag is disabled.
928 /// This feature is used to record a video.
930 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
931 public bool VideoStabilization
935 Native.IsEnabledVideoStabilization(_camera.GetHandle(), out bool val).
936 ThrowIfFailed("Failed to get camera video stabilization");
943 Native.EnableVideoStabilization(_camera.GetHandle(), value).
944 ThrowIfFailed("Failed to set camera video stabilization.");
949 /// Turn the shutter sound on or off, if it is permitted by policy.
951 /// <param name="shutterSound">Shutter sound On/Off flag</param>
952 /// <since_tizen> 4 </since_tizen>
953 /// <feature> http://tizen.org/feature/camera </feature>
955 /// If this value is true, shutter sound will be disabled, otherwise enabled.
956 /// In some countries, this operation is not permitted.
958 /// <exception cref="InvalidOperationException">Disabling shutter sound is not permitted.</exception>
959 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
960 public void DisableShutterSound(bool shutterSound)
962 Native.DisableShutterSound(_camera.GetHandle(), shutterSound).
963 ThrowIfFailed("Failed to set disable shutter sound.");
966 #region PTZ(Pan Tilt Zoom), Pan, Tilt
968 /// Sets the type of the PTZ(Pan Tilt Zoom). Mechanical or electronic.
970 /// <since_tizen> 3 </since_tizen>
971 /// <value>A <see cref="CameraPtzType"/> that specifies the type of the PTZ.</value>
972 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
973 public CameraPtzType PtzType
977 ValidationUtil.ValidateEnum(typeof(CameraPtzType), value, nameof(value));
979 Native.SetPtzType(_camera.GetHandle(), value).
980 ThrowIfFailed("Failed to set camera ptz type.");
985 /// Sets the position to move horizontally.
987 /// <param name="type">The PTZ move type. <seealso cref="CameraPtzMoveType"/>.</param>
988 /// <param name="panStep">The pan step.</param>
989 /// <since_tizen> 3 </since_tizen>
990 /// <feature> http://tizen.org/feature/camera </feature>
991 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
992 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
993 public void SetPan(CameraPtzMoveType type, int panStep)
995 ValidationUtil.ValidateEnum(typeof(CameraPtzMoveType), type, nameof(type));
997 Native.SetPan(_camera.GetHandle(), type, panStep).
998 ThrowIfFailed("Failed to set the camera pan type.");
1002 /// Gets the current position of the camera.
1004 /// <returns>Returns the camera's horizontal position.</returns>
1005 /// <since_tizen> 3 </since_tizen>
1006 /// <feature> http://tizen.org/feature/camera </feature>
1007 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
1010 Native.GetPan(_camera.GetHandle(), out int val).
1011 ThrowIfFailed("Failed to get the camera pan step.");
1017 /// Sets the position to move vertically.
1019 /// <param name="type">the PTZ move type.</param>
1020 /// <param name="tiltStep">The tilt step.</param>
1021 /// <since_tizen> 3 </since_tizen>
1022 /// <feature> http://tizen.org/feature/camera </feature>
1023 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
1024 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
1025 public void SetTilt(CameraPtzMoveType type, int tiltStep)
1027 ValidationUtil.ValidateEnum(typeof(CameraPtzMoveType), type, nameof(type));
1029 Native.SetTilt(_camera.GetHandle(), type, tiltStep).
1030 ThrowIfFailed("Failed to set the camera tilt type\t.");
1034 /// Gets the current position of the camera.
1036 /// <since_tizen> 3 </since_tizen>
1037 /// <feature> http://tizen.org/feature/camera </feature>
1038 /// <returns>Returns the current vertical position.</returns>
1039 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
1040 public int GetTilt()
1042 Native.GetTilt(_camera.GetHandle(), out int val).
1043 ThrowIfFailed("Failed to set the camera current position.");
1049 /// Gets the lower limit and the upper limit for the pan position.
1051 /// <since_tizen> 3 </since_tizen>
1053 /// If the minimum value is greater than the maximum value, it means this feature is not supported.
1055 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
1056 public Range PanRange
1060 if (!_panRange.HasValue)
1062 throw new NotSupportedException("Pan is not supported.");
1065 return _panRange.Value;
1070 /// Gets the lower limit and the upper limit for the tilt position.
1072 /// <since_tizen> 3 </since_tizen>
1074 /// If the minimum value is greater than the maximum value, it means this feature is not supported.
1076 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
1077 public Range TiltRange
1081 if (!_tiltRange.HasValue)
1083 throw new NotSupportedException("Tilt is not supported.");
1086 return _tiltRange.Value;
1089 #endregion PTZ(Pan Tilt Zoom), Pan, Tilt
1095 /// <value>true if EXIF tags are enabled in the JPEG file, otherwise false.</value>
1096 /// <since_tizen> 3 </since_tizen>
1097 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
1098 public bool EnableTag
1102 Native.IsEnabledTag(_camera.GetHandle(), out bool val).
1103 ThrowIfFailed("Failed to get camera enable tag");
1110 Native.EnableTag(_camera.GetHandle(), value).
1111 ThrowIfFailed("Failed to set camera enable tag.");
1116 /// The camera image description in the EXIF tag.
1118 /// <since_tizen> 3 </since_tizen>
1119 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
1120 public string ImageDescriptionTag
1124 IntPtr val = IntPtr.Zero;
1127 Native.GetImageDescription(_camera.GetHandle(), out val).
1128 ThrowIfFailed("Failed to get image description");
1130 return Marshal.PtrToStringAnsi(val);
1134 LibcSupport.Free(val);
1140 Native.SetImageDescription(_camera.GetHandle(), value).
1141 ThrowIfFailed("Failed to set image description.");
1146 /// The software information in the EXIF tag.
1148 /// <since_tizen> 3 </since_tizen>
1149 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
1150 public string SoftwareTag
1154 IntPtr val = IntPtr.Zero;
1158 Native.GetTagSoftware(_camera.GetHandle(), out val).
1159 ThrowIfFailed("Failed to get tag software");
1161 return Marshal.PtrToStringAnsi(val);
1165 LibcSupport.Free(val);
1171 Native.SetTagSoftware(_camera.GetHandle(), value).
1172 ThrowIfFailed("Failed to set tag software.");
1177 /// The geo tag(GPS data) in the EXIF tag.
1179 /// <since_tizen> 3 </since_tizen>
1180 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
1181 public Location GeoTag
1185 Native.GetGeotag(_camera.GetHandle(), out double latitude, out double longitude, out double altitude).
1186 ThrowIfFailed("Failed to get tag");
1188 return new Location(latitude, longitude, altitude);
1193 Native.SetGeotag(_camera.GetHandle(), value.Latitude, value.Longitude, value.Altitude).
1194 ThrowIfFailed("Failed to set geo tag.");
1199 /// Removes the geo tag(GPS data) in the EXIF(EXchangeable Image File format) tag.
1201 /// <since_tizen> 3 </since_tizen>
1202 /// <feature> http://tizen.org/feature/camera </feature>
1203 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
1204 public void RemoveGeoTag()
1206 Native.RemoveGeotag(_camera.GetHandle()).
1207 ThrowIfFailed("Failed to remove the geotag.");
1211 /// The camera orientation in the tag.
1213 /// <since_tizen> 3 </since_tizen>
1214 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
1215 public CameraTagOrientation OrientationTag
1219 Native.GetTagOrientation(_camera.GetHandle(), out var val).
1220 ThrowIfFailed("Failed to get camera tag orientation");
1227 ValidationUtil.ValidateEnum(typeof(CameraTagOrientation), value, nameof(value));
1229 Native.SetTagOrientation(_camera.GetHandle(), value).
1230 ThrowIfFailed("Failed to set camera tag orientation.");