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 public class CameraSettings
30 internal readonly Camera _camera;
32 private readonly Range? _brightnessRange;
33 private readonly Range? _contrastRange;
34 private readonly Range? _panRange;
35 private readonly Range? _tiltRange;
36 private readonly Range? _exposureRange;
37 private readonly Range? _zoomRange;
39 internal CameraSettings(Camera camera)
43 _contrastRange = GetRange(Native.GetContrastRange);
44 _brightnessRange = GetRange(Native.GetBrightnessRange);
45 _exposureRange = GetRange(Native.GetExposureRange);
46 _zoomRange = GetRange(Native.GetZoomRange);
47 _panRange = GetRange(Native.GetPanRange);
48 _tiltRange = GetRange(Native.GetTiltRange);
51 private delegate CameraError GetRangeDelegate(IntPtr handle, out int min, out int max);
52 private Range? GetRange(GetRangeDelegate func)
57 CameraErrorFactory.ThrowIfError(func(_camera.GetHandle(), out min, out max),
58 "Failed to initialize the camera settings");
65 return new Range(min, max);
70 /// Sets auto focus area.
72 /// <since_tizen> 3 </since_tizen>
74 /// <see cref="CameraAutoFocusMode"/> should not be the <see cref="CameraAutoFocusMode.None"/>.
76 /// <param name="x">X position</param>
77 /// <param name="y">Y position</param>
78 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
79 /// <exception cref="InvalidOperationException">In case of any invalid operations.</exception>
80 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
81 public void SetAutoFocusArea(int x, int y)
83 CameraErrorFactory.ThrowIfError(Native.SetAutoFocusArea(_camera.GetHandle(), x, y),
84 "Failed to set the autofocus area.");
88 /// Sets auto focus area.
90 /// <since_tizen> 3 </since_tizen>
92 /// <see cref="CameraAutoFocusMode"/> should not be the <see cref="CameraAutoFocusMode.None"/>.
94 /// <param name="pos"><see cref="Point"/> structure including X, Y position</param>
95 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
96 /// <exception cref="InvalidOperationException">In case of any invalid operations.</exception>
97 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
98 public void SetAutoFocusArea(Point pos)
100 CameraErrorFactory.ThrowIfError(Native.SetAutoFocusArea(_camera.GetHandle(), pos.X, pos.Y),
101 "Failed to set the autofocus area.");
105 /// Clears the auto focus area.
107 /// <since_tizen> 3 </since_tizen>
108 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
109 public void ClearFocusArea()
111 CameraErrorFactory.ThrowIfError(Native.ClearAutoFocusArea(_camera.GetHandle()),
112 "Failed to clear the autofocus area.");
116 /// The auto focus mode.
118 /// <since_tizen> 3 </since_tizen>
119 /// <value>A <see cref="CameraAutoFocusMode"/> that specifies the auto focus mode.</value>
120 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
121 public CameraAutoFocusMode AutoFocusMode
125 CameraAutoFocusMode val = CameraAutoFocusMode.None;
127 CameraErrorFactory.ThrowIfError(Native.GetAutoFocusMode(_camera.GetHandle(), out val),
128 "Failed to get camera autofocus mode");
135 ValidationUtil.ValidateEnum(typeof(CameraAutoFocusMode), value);
136 CameraErrorFactory.ThrowIfError(Native.SetAutoFocusMode(_camera.GetHandle(), value),
137 "Failed to set camera autofocus mode.");
140 #endregion Auto Focus
144 /// The contrast level of the camera.
146 /// <since_tizen> 3 </since_tizen>
147 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
154 CameraErrorFactory.ThrowIfError(Native.GetContrast(_camera.GetHandle(), out val),
155 "Failed to get camera contrast value");
162 CameraErrorFactory.ThrowIfError(Native.SetContrast(_camera.GetHandle(), value),
163 "Failed to set camera contrast value.");
168 /// The auto contrast.
169 /// If true auto contrast is enabled, otherwise false.
171 /// <since_tizen> 3 </since_tizen>
172 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
173 public bool AutoContrast
179 CameraErrorFactory.ThrowIfError(Native.IsEnabledAutoContrast(_camera.GetHandle(), out val),
180 "Failed to get camera auto contrast");
187 CameraErrorFactory.ThrowIfError(Native.EnableAutoContrast(_camera.GetHandle(), value),
188 "Failed to set camera enable auto contrast.");
192 /// Gets the available contrast level.
194 /// <since_tizen> 3 </since_tizen>
196 /// If min value is greater than the max value, it means this feature is not supported.
198 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
199 public Range ContrastRange
203 if (!_contrastRange.HasValue)
205 throw new NotSupportedException("Contrast is not supported.");
208 return _contrastRange.Value;
215 /// The brightness level of the camera.
217 /// <since_tizen> 3 </since_tizen>
218 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
219 public int Brightness
225 CameraErrorFactory.ThrowIfError(Native.GetBrightness(_camera.GetHandle(), out val),
226 "Failed to get camera brightness value");
233 CameraErrorFactory.ThrowIfError(Native.SetBrightness(_camera.GetHandle(), value),
234 "Failed to set camera brightness value.");
239 /// Gets the available brightness level.
241 /// <since_tizen> 3 </since_tizen>
243 /// If min value is greater than the max value, it means this feature is not supported.
245 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
246 public Range BrightnessRange
250 if (!_brightnessRange.HasValue)
252 throw new NotSupportedException("Brightness is not supported.");
255 return _brightnessRange.Value;
258 #endregion Brightness
262 /// The exposure value.
264 /// <since_tizen> 3 </since_tizen>
265 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
272 CameraErrorFactory.ThrowIfError(Native.GetExposure(_camera.GetHandle(), out val),
273 "Failed to get camera exposure value");
280 CameraErrorFactory.ThrowIfError(Native.SetExposure(_camera.GetHandle(), value),
281 "Failed to set camera exposure value.");
286 /// The exposure mode.
288 /// <since_tizen> 3 </since_tizen>
289 /// <value>A <see cref="CameraExposureMode"/> that specifies the exposure mode.</value>
290 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
291 public CameraExposureMode ExposureMode
295 CameraExposureMode val = CameraExposureMode.Off;
297 CameraErrorFactory.ThrowIfError(Native.GetExposureMode(_camera.GetHandle(), out val),
298 "Failed to get camera exposure mode");
305 ValidationUtil.ValidateEnum(typeof(CameraExposureMode), value);
306 CameraErrorFactory.ThrowIfError(Native.SetExposureMode(_camera.GetHandle(), value),
307 "Failed to set camera exposure mode.");
312 /// Gets the available exposure value.
314 /// <since_tizen> 3 </since_tizen>
316 /// If min value is greater than the max value, it means this feature is not supported.
318 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
319 public Range ExposureRange
323 if (!_exposureRange.HasValue)
325 throw new NotSupportedException("Exposure is not supported.");
328 return _exposureRange.Value;
336 /// The range for zoom level is received from ZoomRange property.
338 /// <since_tizen> 3 </since_tizen>
339 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
346 CameraErrorFactory.ThrowIfError(Native.GetZoom(_camera.GetHandle(), out val),
347 "Failed to get zoom level");
354 CameraErrorFactory.ThrowIfError(Native.SetZoom(_camera.GetHandle(), (int)value),
355 "Failed to set zoom level.");
360 /// Gets the available zoom level.
362 /// <since_tizen> 3 </since_tizen>
364 /// If min value is greater than the max value, it means this feature is not supported.
366 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
367 public Range ZoomRange
371 if (!_zoomRange.HasValue)
373 throw new NotSupportedException("Zoom is not supported.");
376 return _zoomRange.Value;
382 /// The whitebalance mode.
384 /// <since_tizen> 3 </since_tizen>
385 /// <value>A <see cref="CameraWhiteBalance"/> that specifies the white balance mode.</value>
386 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
387 public CameraWhiteBalance WhiteBalance
391 CameraWhiteBalance val = CameraWhiteBalance.None;
393 CameraErrorFactory.ThrowIfError(Native.GetWhiteBalance(_camera.GetHandle(), out val),
394 "Failed to get camera whitebalance");
401 ValidationUtil.ValidateEnum(typeof(CameraWhiteBalance), value);
402 CameraErrorFactory.ThrowIfError(Native.SetWhitebalance(_camera.GetHandle(), value),
403 "Failed to set camera whitebalance.");
410 /// <since_tizen> 3 </since_tizen>
411 /// <value>A <see cref="CameraIsoLevel"/> that specifies ISO level.</value>
412 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
413 public CameraIsoLevel IsoLevel
417 CameraIsoLevel val = CameraIsoLevel.Auto;
419 CameraErrorFactory.ThrowIfError(Native.GetIso(_camera.GetHandle(), out val),
420 "Failed to get camera Iso level");
427 ValidationUtil.ValidateEnum(typeof(CameraIsoLevel), value);
428 CameraErrorFactory.ThrowIfError(Native.SetIso(_camera.GetHandle(), value),
429 "Failed to set camera Iso level.");
434 /// The quality of the image.
435 /// The range for image quality is 1 to 100.
437 /// <since_tizen> 3 </since_tizen>
438 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
439 public int ImageQuality
445 CameraErrorFactory.ThrowIfError(Native.GetImageQuality(_camera.GetHandle(), out val),
446 "Failed to get image quality");
453 if (value < 1 || value > 100)
455 throw new ArgumentException("Valid value is from 1(lowest quality) to 100(highest quality)");
458 CameraErrorFactory.ThrowIfError(Native.SetImageQuality(_camera.GetHandle(), value),
459 "Failed to set image quality.");
463 #region Resolution, Format, Fps of preview, capture
465 /// The preview frame rate.
467 /// <since_tizen> 3 </since_tizen>
468 /// <value>A <see cref="CameraFps"/> that specifies preview frame rate.</value>
469 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
470 public CameraFps PreviewFps
474 CameraFps val = CameraFps.Auto;
476 CameraErrorFactory.ThrowIfError(Native.GetPreviewFps(_camera.GetHandle(), out val),
477 "Failed to get camera preview fps");
484 ValidationUtil.ValidateEnum(typeof(CameraFps), value);
485 CameraErrorFactory.ThrowIfError(Native.SetPreviewFps(_camera.GetHandle(), value),
486 "Failed to set preview fps.");
491 /// Gets or sets the resolution of preview
493 /// <since_tizen> 3 </since_tizen>
494 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
495 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
496 public Size PreviewResolution
503 CameraErrorFactory.ThrowIfError(GetPreviewResolution(_camera.GetHandle(), out width, out height),
504 "Failed to get camera preview resolution");
506 return new Size(width, height);
511 CameraErrorFactory.ThrowIfError(SetPreviewResolution(_camera.GetHandle(), value.Width, value.Height),
512 "Failed to set preview resolution.");
517 /// Gets the recommended preview resolution.
519 /// <since_tizen> 3 </since_tizen>
521 /// Depending on the capture resolution aspect ratio and display resolution,
522 /// the recommended preview resolution is determined.
524 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
525 public Size RecommendedPreviewResolution
532 CameraErrorFactory.ThrowIfError(GetRecommendedPreviewResolution(_camera.GetHandle(), out width, out height),
533 "Failed to get recommended preview resolution");
535 return new Size(width, height);
540 /// The preview data format.
542 /// <since_tizen> 3 </since_tizen>
543 /// <value>A <see cref="CameraPixelFormat"/> that specifies the pixel format of preview data.</value>
544 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
545 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
546 public CameraPixelFormat PreviewPixelFormat
550 CameraPixelFormat val = 0;
552 CameraErrorFactory.ThrowIfError(GetPreviewPixelFormat(_camera.GetHandle(), out val),
553 "Failed to get preview format");
560 ValidationUtil.ValidateEnum(typeof(CameraPixelFormat), value);
561 CameraErrorFactory.ThrowIfError(SetPreviewPixelFormat(_camera.GetHandle(), value),
562 "Failed to set preview format.");
567 /// Resolution of the captured image.
569 /// <since_tizen> 3 </since_tizen>
570 /// <exception cref="ArgumentException">In case of invalid parameters</exception>
571 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
572 public Size CaptureResolution
579 CameraErrorFactory.ThrowIfError(GetCaptureResolution(_camera.GetHandle(), out width, out height),
580 "Failed to get camera capture resolution");
582 return new Size(width, height);
589 CameraErrorFactory.ThrowIfError(SetCaptureResolution(_camera.GetHandle(), res.Width, res.Height),
590 "Failed to set capture resolution.");
595 /// Format of an image to be captured.
597 /// <since_tizen> 3 </since_tizen>
598 /// <value>A <see cref="CameraPixelFormat"/> that specifies the pixel format of captured image.</value>
599 /// <exception cref="ArgumentException">In case of invalid parameters</exception>
600 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
601 public CameraPixelFormat CapturePixelFormat
605 CameraPixelFormat val = CameraPixelFormat.Invalid;
607 CameraErrorFactory.ThrowIfError(GetCaptureFormat(_camera.GetHandle(), out val),
608 "Failed to get camera capture formats");
615 ValidationUtil.ValidateEnum(typeof(CameraPixelFormat), value);
616 CameraErrorFactory.ThrowIfError(SetCaptureFormat(_camera.GetHandle(), value),
617 "Failed to set capture format.");
620 #endregion Resolution, Format, Fps of preview, capture
622 #region Encoded preview
624 /// The bit rate of encoded preview.
626 /// <since_tizen> 3 </since_tizen>
627 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
628 public int EncodedPreviewBitrate
634 CameraErrorFactory.ThrowIfError(Native.GetBitrate(_camera.GetHandle(), out val),
635 "Failed to get preview bitrate");
642 CameraErrorFactory.ThrowIfError(Native.SetBitrate(_camera.GetHandle(), (int)value),
643 "Failed to set encoded preview bitrate.");
648 /// GOP(Group Of Pictures) interval of encoded preview.
650 /// <since_tizen> 3 </since_tizen>
651 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
652 public int EncodedPreviewGopInterval
658 CameraErrorFactory.ThrowIfError(Native.GetGopInterval(_camera.GetHandle(), out val),
659 "Failed to get preview gop interval");
666 CameraErrorFactory.ThrowIfError(Native.SetGopInterval(_camera.GetHandle(), (int)value),
667 "Failed to set encoded preview gop intervals.");
670 #endregion Encoded preview
673 /// The theater mode.
675 /// <since_tizen> 3 </since_tizen>
676 /// <value>A <see cref="CameraTheaterMode"/> that specifies theater mode.</value>
678 /// If you want to display the preview image on the external display with the full screen mode,
679 /// use this property.
681 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
682 public CameraTheaterMode TheaterMode
686 CameraTheaterMode val = CameraTheaterMode.Disable;
688 CameraErrorFactory.ThrowIfError(Native.GetTheaterMode(_camera.GetHandle(), out val),
689 "Failed to get camera theater mode");
696 ValidationUtil.ValidateEnum(typeof(CameraTheaterMode), value);
697 CameraErrorFactory.ThrowIfError(Native.SetTheaterMode(_camera.GetHandle(), value),
698 "Failed to set camera theater mode.");
703 /// The camera effect mode.
705 /// <since_tizen> 3 </since_tizen>
706 /// <value>A <see cref="CameraEffectMode"/> that specifies effect mode.</value>
707 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
708 public CameraEffectMode Effect
712 CameraEffectMode val = CameraEffectMode.None;
714 CameraErrorFactory.ThrowIfError(Native.GetEffect(_camera.GetHandle(), out val),
715 "Failed to get camera effect");
722 ValidationUtil.ValidateEnum(typeof(CameraEffectMode), value);
723 CameraErrorFactory.ThrowIfError(Native.SetEffect(_camera.GetHandle(), value),
724 "Failed to set camera effect.");
731 /// <since_tizen> 3 </since_tizen>
732 /// <value>A <see cref="CameraSceneMode"/> that specifies scene mode.</value>
733 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
734 public CameraSceneMode SceneMode
738 CameraSceneMode val = CameraSceneMode.Normal;
740 CameraErrorFactory.ThrowIfError(Native.GetSceneMode(_camera.GetHandle(), out val),
741 "Failed to get camera scene mode");
748 ValidationUtil.ValidateEnum(typeof(CameraSceneMode), value);
749 CameraErrorFactory.ThrowIfError(Native.SetSceneMode(_camera.GetHandle(), value),
750 "Failed to set camera scene mode.");
755 /// The camera's flash mode.
757 /// <since_tizen> 3 </since_tizen>
758 /// <value>A <see cref="CameraFlashMode"/> that specifies flash mode.</value>
759 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
760 public CameraFlashMode FlashMode
764 CameraFlashMode val = CameraFlashMode.Off;
766 CameraErrorFactory.ThrowIfError(Native.GetFlashMode(_camera.GetHandle(), out val),
767 "Failed to get camera flash mode");
774 ValidationUtil.ValidateEnum(typeof(CameraFlashMode), value);
775 CameraErrorFactory.ThrowIfError(Native.SetFlashMode(_camera.GetHandle(), value),
776 "Failed to set camera flash mode.");
781 /// Gets the camera lens orientation angle.
783 /// <since_tizen> 3 </since_tizen>
784 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
785 public int LensOrientation
791 CameraErrorFactory.ThrowIfError(Native.GetLensOrientation(_camera.GetHandle(), out val),
792 "Failed to get camera lens orientation");
799 /// The stream rotation.
801 /// <since_tizen> 3 </since_tizen>
802 /// <value>A <see cref="CameraRotation"/> that specifies the rotation of camera device.</value>
803 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
804 public CameraRotation StreamRotation
808 CameraRotation val = CameraRotation.None;
810 CameraErrorFactory.ThrowIfError(Native.GetStreamRotation(_camera.GetHandle(), out val),
811 "Failed to get camera stream rotation");
818 ValidationUtil.ValidateEnum(typeof(CameraRotation), value);
819 CameraErrorFactory.ThrowIfError(Native.SetStreamRotation(_camera.GetHandle(), value),
820 "Failed to set camera stream rotation.");
827 /// <since_tizen> 3 </since_tizen>
828 /// <value>A <see cref="CameraFlip"/> that specifies camera flip type.</value>
829 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
830 public CameraFlip StreamFlip
834 CameraFlip val = CameraFlip.None;
836 CameraErrorFactory.ThrowIfError(Native.GetFlip(_camera.GetHandle(), out val),
837 "Failed to get camera stream flip");
844 ValidationUtil.ValidateEnum(typeof(CameraFlip), value);
845 CameraErrorFactory.ThrowIfError(Native.SetFlip(_camera.GetHandle(), value),
846 "Failed to set camera flip.");
851 /// The mode of HDR(High dynamic range) capture.
853 /// <since_tizen> 3 </since_tizen>
854 /// <value>A <see cref="CameraHdrMode"/> that specifies the HDR mode.</value>
856 /// Taking multiple pictures at different exposure levels and intelligently stitching them together
857 /// so that we eventually arrive at a picture that is representative in both dark and bright areas.
858 /// If this attribute is set, then eventhandler set for HdrCaptureProgress event is invoked.
860 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
861 public CameraHdrMode HdrMode
865 CameraHdrMode val = 0;
867 CameraErrorFactory.ThrowIfError(Native.GetHdrMode(_camera.GetHandle(), out val),
868 "Failed to get camera hdr mode");
875 ValidationUtil.ValidateEnum(typeof(CameraHdrMode), value);
876 CameraErrorFactory.ThrowIfError(Native.SetHdrMode(_camera.GetHandle(), value),
877 "Failed to set camera hdr mode.");
882 /// The anti shake feature.
883 /// If true the antishake feature is enabled, otherwise false.
885 /// <since_tizen> 3 </since_tizen>
886 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
887 public bool AntiShake
893 CameraErrorFactory.ThrowIfError(Native.IsEnabledAntiShake(_camera.GetHandle(), out val),
894 "Failed to get camera anti shake value");
901 CameraErrorFactory.ThrowIfError(Native.EnableAntiShake(_camera.GetHandle(), value),
902 "Failed to set camera anti shake value.");
907 /// Enables/Disables the video stabilization feature.
908 /// If true video stabilization is enabled, otherwise false.
910 /// <since_tizen> 3 </since_tizen>
912 /// If video stabilization is enabled, zero shutter lag is disabled.
913 /// This feature is used to record a video.
915 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
916 public bool VideoStabilization
922 CameraErrorFactory.ThrowIfError(Native.IsEnabledVideoStabilization(_camera.GetHandle(), out val),
923 "Failed to get camera video stabilization");
930 CameraErrorFactory.ThrowIfError(Native.EnableVideoStabilization(_camera.GetHandle(), value),
931 "Failed to set camera video stabilization.");
936 /// Disables shutter sound.
937 /// If true shutter sound is disabled, otherwise false.
939 /// <since_tizen> 3 </since_tizen>
941 /// In some countries, this operation is not permitted.
943 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
944 public bool DisableShutterSound
948 CameraErrorFactory.ThrowIfError(Native.DisableShutterSound(_camera.GetHandle(), value),
949 "Failed to set disable shutter sound.");
953 #region PTZ(Pan Tilt Zoom), Pan, Tilt
955 /// Sets the type of PTZ(Pan Tilt Zoom). Mechanical or Electronic.
957 /// <since_tizen> 3 </since_tizen>
958 /// <value>A <see cref="CameraPtzType"/> that specifies the type of PTZ.</value>
959 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
960 public CameraPtzType PtzType
964 ValidationUtil.ValidateEnum(typeof(CameraPtzType), value);
965 CameraErrorFactory.ThrowIfError(Native.SetPtzType(_camera.GetHandle(), (int)value),
966 "Failed to set camera ptz type.");
971 /// Sets the position to move horizontally.
973 /// <since_tizen> 3 </since_tizen>
974 /// <param name="type">ptz move type. <seealso cref="CameraPtzMoveType"/></param>
975 /// <param name="panStep">pan step</param>
976 /// <exception cref="ArgumentException">In case of invalid parameters</exception>
977 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
978 public void SetPan(CameraPtzMoveType type, int panStep)
980 ValidationUtil.ValidateEnum(typeof(CameraPtzMoveType), type, nameof(type));
981 CameraErrorFactory.ThrowIfError(Native.SetPan(_camera.GetHandle(), type, panStep),
982 "Failed to set the camera pan type.");
986 /// Gets the current position of the camera.
988 /// <since_tizen> 3 </since_tizen>
989 /// <returns>Returns the camera's horizontal position</returns>
990 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
995 CameraErrorFactory.ThrowIfError(Native.GetPan(_camera.GetHandle(), out val),
996 "Failed to get the camera pan step.");
1002 /// Sets the position to move vertically.
1004 /// <since_tizen> 3 </since_tizen>
1005 /// <param name="type">ptz move type</param>
1006 /// <param name="tiltStep">tilt step</param>
1007 /// <exception cref="ArgumentException">In case of invalid parameters</exception>
1008 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
1009 public void SetTilt(CameraPtzMoveType type, int tiltStep)
1011 ValidationUtil.ValidateEnum(typeof(CameraPtzMoveType), type, nameof(type));
1012 CameraErrorFactory.ThrowIfError(Native.SetTilt(_camera.GetHandle(), type, tiltStep),
1013 "Failed to set the camera tilt type\t.");
1017 /// Gets the current position of the camera.
1019 /// <since_tizen> 3 </since_tizen>
1020 /// <returns>Returns the current vertical position</returns>
1021 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
1022 public int GetTilt()
1026 CameraErrorFactory.ThrowIfError(Native.GetTilt(_camera.GetHandle(), out val),
1027 "Failed to set the camera current position.");
1033 /// Gets lower limit and upper limit for pan position.
1035 /// <since_tizen> 3 </since_tizen>
1037 /// If min value is greater than the max value, it means this feature is not supported.
1039 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
1040 public Range PanRange
1044 if (!_panRange.HasValue)
1046 throw new NotSupportedException("Pan is not supported.");
1048 return _panRange.Value;
1053 /// Gets lower limit and upper limit for tilt position.
1055 /// <since_tizen> 3 </since_tizen>
1057 /// If min value is greater than the max value, it means this feature is not supported.
1059 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
1060 public Range TiltRange
1064 if (!_tiltRange.HasValue)
1066 throw new NotSupportedException("Tilt is not supported.");
1068 return _tiltRange.Value;
1071 #endregion PTZ(Pan Tilt Zoom), Pan, Tilt
1076 /// true if EXIF tags are enabled in JPEG file, otherwise false.
1078 /// <since_tizen> 3 </since_tizen>
1079 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
1080 public bool EnableTag
1086 CameraErrorFactory.ThrowIfError(Native.IsEnabledTag(_camera.GetHandle(), out val),
1087 "Failed to get camera enable tag");
1094 CameraErrorFactory.ThrowIfError(Native.EnableTag(_camera.GetHandle(), value),
1095 "Failed to set camera enable tag.");
1100 /// The camera image description in the EXIF tag.
1102 /// <since_tizen> 3 </since_tizen>
1103 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
1104 public string ImageDescriptionTag
1108 IntPtr val = IntPtr.Zero;
1111 CameraErrorFactory.ThrowIfError(Native.GetImageDescription(_camera.GetHandle(), out val),
1112 "Failed to get image description");
1114 return Marshal.PtrToStringAnsi(val);
1118 LibcSupport.Free(val);
1124 CameraErrorFactory.ThrowIfError(Native.SetImageDescription(_camera.GetHandle(), value),
1125 "Failed to set image description.");
1130 /// The software information in the EXIF tag.
1132 /// <since_tizen> 3 </since_tizen>
1133 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
1134 public string SoftwareTag
1138 IntPtr val = IntPtr.Zero;
1142 CameraErrorFactory.ThrowIfError(Native.GetTagSoftware(_camera.GetHandle(), out val),
1143 "Failed to get tag software");
1145 return Marshal.PtrToStringAnsi(val);
1149 LibcSupport.Free(val);
1155 CameraErrorFactory.ThrowIfError(Native.SetTagSoftware(_camera.GetHandle(), value),
1156 "Failed to set tag software.");
1161 /// The geotag(GPS data) in the EXIF tag.
1163 /// <since_tizen> 3 </since_tizen>
1164 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
1165 public Location GeoTag
1169 double latitude = 0.0;
1170 double longitude = 0.0;
1171 double altitude = 0.0;
1173 CameraErrorFactory.ThrowIfError(Native.GetGeotag(_camera.GetHandle(), out latitude, out longitude, out altitude),
1174 "Failed to get tag");
1176 return new Location(latitude, longitude, altitude);
1181 CameraErrorFactory.ThrowIfError(Native.SetGeotag(_camera.GetHandle(),
1182 value.Latitude, value.Longitude, value.Altitude), "Failed to set geo tag.");
1187 /// Removes the geotag(GPS data) in the EXIF(Exchangeable image file format) tag.
1189 /// <since_tizen> 3 </since_tizen>
1190 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
1191 public void RemoveGeoTag()
1193 CameraErrorFactory.ThrowIfError(Native.RemoveGeotag(_camera.GetHandle()),
1194 "Failed to remove the geotag\t.");
1198 /// The camera orientation in the tag.
1200 /// <since_tizen> 3 </since_tizen>
1201 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
1202 public CameraTagOrientation OrientationTag
1206 CameraTagOrientation val = 0;
1208 CameraErrorFactory.ThrowIfError(Native.GetTagOrientation(_camera.GetHandle(), out val),
1209 "Failed to get camera tag orientation");
1216 ValidationUtil.ValidateEnum(typeof(CameraTagOrientation), value);
1217 CameraErrorFactory.ThrowIfError(Native.SetTagOrientation(_camera.GetHandle(), value),
1218 "Failed to set camera tag orientation.");