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);
134 CameraErrorFactory.ThrowIfError(Native.SetAutoFocusMode(_camera.GetHandle(), value),
135 "Failed to set camera autofocus mode.");
138 #endregion Auto Focus
142 /// The contrast level of the camera.
144 /// <since_tizen> 3 </since_tizen>
145 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
150 CameraErrorFactory.ThrowIfError(Native.GetContrast(_camera.GetHandle(), out int val),
151 "Failed to get camera contrast value");
158 CameraErrorFactory.ThrowIfError(Native.SetContrast(_camera.GetHandle(), value),
159 "Failed to set camera contrast value.");
164 /// The auto contrast.
165 /// If true auto contrast is enabled, otherwise false.
167 /// <since_tizen> 3 </since_tizen>
168 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
169 public bool AutoContrast
173 CameraErrorFactory.ThrowIfError(Native.IsEnabledAutoContrast(_camera.GetHandle(), out bool val),
174 "Failed to get camera auto contrast");
181 CameraErrorFactory.ThrowIfError(Native.EnableAutoContrast(_camera.GetHandle(), value),
182 "Failed to set camera enable auto contrast.");
186 /// Gets the available contrast level.
188 /// <since_tizen> 3 </since_tizen>
190 /// If the mininum value is greater than the maximum value, it means this feature is not supported.
192 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
193 public Range ContrastRange
197 if (!_contrastRange.HasValue)
199 throw new NotSupportedException("Contrast is not supported.");
202 return _contrastRange.Value;
209 /// The brightness level of the camera.
211 /// <since_tizen> 3 </since_tizen>
212 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
213 public int Brightness
217 CameraErrorFactory.ThrowIfError(Native.GetBrightness(_camera.GetHandle(), out int val),
218 "Failed to get camera brightness value");
225 CameraErrorFactory.ThrowIfError(Native.SetBrightness(_camera.GetHandle(), value),
226 "Failed to set camera brightness value.");
231 /// Gets the available brightness level.
233 /// <since_tizen> 3 </since_tizen>
235 /// If the minimum value is greater than the maximum value, it means this feature is not supported.
237 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
238 public Range BrightnessRange
242 if (!_brightnessRange.HasValue)
244 throw new NotSupportedException("Brightness is not supported.");
247 return _brightnessRange.Value;
250 #endregion Brightness
254 /// The exposure value.
256 /// <since_tizen> 3 </since_tizen>
257 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
262 CameraErrorFactory.ThrowIfError(Native.GetExposure(_camera.GetHandle(), out int val),
263 "Failed to get camera exposure value");
270 CameraErrorFactory.ThrowIfError(Native.SetExposure(_camera.GetHandle(), value),
271 "Failed to set camera exposure value.");
276 /// The exposure mode.
278 /// <since_tizen> 3 </since_tizen>
279 /// <value>A <see cref="CameraExposureMode"/> that specifies the exposure mode.</value>
280 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
281 public CameraExposureMode ExposureMode
285 CameraExposureMode val = CameraExposureMode.Off;
287 CameraErrorFactory.ThrowIfError(Native.GetExposureMode(_camera.GetHandle(), out val),
288 "Failed to get camera exposure mode");
295 ValidationUtil.ValidateEnum(typeof(CameraExposureMode), value);
296 CameraErrorFactory.ThrowIfError(Native.SetExposureMode(_camera.GetHandle(), value),
297 "Failed to set camera exposure mode.");
302 /// Gets the available exposure value.
304 /// <since_tizen> 3 </since_tizen>
306 /// If the minimum value is greater than the maximum value, it means this feature is not supported.
308 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
309 public Range ExposureRange
313 if (!_exposureRange.HasValue)
315 throw new NotSupportedException("Exposure is not supported.");
318 return _exposureRange.Value;
326 /// The range for the zoom level is received from the ZoomRange property.
328 /// <since_tizen> 3 </since_tizen>
329 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
334 CameraErrorFactory.ThrowIfError(Native.GetZoom(_camera.GetHandle(), out int val),
335 "Failed to get zoom level");
342 CameraErrorFactory.ThrowIfError(Native.SetZoom(_camera.GetHandle(), value),
343 "Failed to set zoom level.");
348 /// Gets the available zoom level.
350 /// <since_tizen> 3 </since_tizen>
352 /// If the minimum value is greater than the maximum value, it means this feature is not supported.
354 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
355 public Range ZoomRange
359 if (!_zoomRange.HasValue)
361 throw new NotSupportedException("Zoom is not supported.");
364 return _zoomRange.Value;
370 /// The white balance mode.
372 /// <since_tizen> 3 </since_tizen>
373 /// <value>A <see cref="CameraWhiteBalance"/> that specifies the white balance mode.</value>
374 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
375 public CameraWhiteBalance WhiteBalance
379 CameraWhiteBalance val = CameraWhiteBalance.None;
381 CameraErrorFactory.ThrowIfError(Native.GetWhiteBalance(_camera.GetHandle(), out val),
382 "Failed to get camera whitebalance");
389 ValidationUtil.ValidateEnum(typeof(CameraWhiteBalance), value);
390 CameraErrorFactory.ThrowIfError(Native.SetWhitebalance(_camera.GetHandle(), value),
391 "Failed to set camera whitebalance.");
398 /// <since_tizen> 3 </since_tizen>
399 /// <value>A <see cref="CameraIsoLevel"/> that specifies the ISO level.</value>
400 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
401 public CameraIsoLevel IsoLevel
405 CameraIsoLevel val = CameraIsoLevel.Auto;
407 CameraErrorFactory.ThrowIfError(Native.GetIso(_camera.GetHandle(), out val),
408 "Failed to get camera Iso level");
415 ValidationUtil.ValidateEnum(typeof(CameraIsoLevel), value);
416 CameraErrorFactory.ThrowIfError(Native.SetIso(_camera.GetHandle(), value),
417 "Failed to set camera Iso level.");
422 /// The quality of the image.
423 /// The range for the image quality is 1 to 100.
425 /// <since_tizen> 3 </since_tizen>
426 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
427 public int ImageQuality
431 CameraErrorFactory.ThrowIfError(Native.GetImageQuality(_camera.GetHandle(), out int val),
432 "Failed to get image quality");
439 if (value < 1 || value > 100)
441 throw new ArgumentException("Valid value is from 1(lowest quality) to 100(highest quality)");
444 CameraErrorFactory.ThrowIfError(Native.SetImageQuality(_camera.GetHandle(), value),
445 "Failed to set image quality.");
449 #region Resolution, Format, Fps of preview, capture
451 /// The preview frame rate.
453 /// <since_tizen> 3 </since_tizen>
454 /// <value>A <see cref="CameraFps"/> that specifies the preview frame rate.</value>
455 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
456 public CameraFps PreviewFps
460 CameraErrorFactory.ThrowIfError(Native.GetPreviewFps(_camera.GetHandle(), out var val),
461 "Failed to get camera preview fps");
468 ValidationUtil.ValidateEnum(typeof(CameraFps), value);
469 CameraErrorFactory.ThrowIfError(Native.SetPreviewFps(_camera.GetHandle(), value),
470 "Failed to set preview fps.");
475 /// Gets or sets the resolution of the preview.
477 /// <since_tizen> 3 </since_tizen>
478 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
479 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
480 public Size PreviewResolution
484 CameraErrorFactory.ThrowIfError(GetPreviewResolution(_camera.GetHandle(), out int width, out int height),
485 "Failed to get camera preview resolution");
487 return new Size(width, height);
492 CameraErrorFactory.ThrowIfError(SetPreviewResolution(_camera.GetHandle(), value.Width, value.Height),
493 "Failed to set preview resolution.");
498 /// Gets the recommended preview resolution.
500 /// <since_tizen> 3 </since_tizen>
502 /// Depending on the capture resolution aspect ratio and the display resolution,
503 /// the recommended preview resolution is determined.
505 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
506 public Size RecommendedPreviewResolution
510 CameraErrorFactory.ThrowIfError(GetRecommendedPreviewResolution(_camera.GetHandle(), out int width, out int height),
511 "Failed to get recommended preview resolution");
513 return new Size(width, height);
518 /// The preview data format.
520 /// <since_tizen> 3 </since_tizen>
521 /// <value>A <see cref="CameraPixelFormat"/> that specifies the pixel format of the preview data.</value>
522 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
523 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
524 public CameraPixelFormat PreviewPixelFormat
528 CameraErrorFactory.ThrowIfError(GetPreviewPixelFormat(_camera.GetHandle(), out var val),
529 "Failed to get preview format");
536 ValidationUtil.ValidateEnum(typeof(CameraPixelFormat), value);
537 CameraErrorFactory.ThrowIfError(SetPreviewPixelFormat(_camera.GetHandle(), value),
538 "Failed to set preview format.");
543 /// Resolution of the captured image.
545 /// <since_tizen> 3 </since_tizen>
546 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
547 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
548 public Size CaptureResolution
552 CameraErrorFactory.ThrowIfError(GetCaptureResolution(_camera.GetHandle(), out int width, out int height),
553 "Failed to get camera capture resolution");
555 return new Size(width, height);
562 CameraErrorFactory.ThrowIfError(SetCaptureResolution(_camera.GetHandle(), res.Width, res.Height),
563 "Failed to set capture resolution.");
568 /// Format of an image to be captured.
570 /// <since_tizen> 3 </since_tizen>
571 /// <value>A <see cref="CameraPixelFormat"/> that specifies the pixel format of captured image.</value>
572 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
573 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
574 public CameraPixelFormat CapturePixelFormat
578 CameraErrorFactory.ThrowIfError(GetCaptureFormat(_camera.GetHandle(), out var val),
579 "Failed to get camera capture formats");
586 ValidationUtil.ValidateEnum(typeof(CameraPixelFormat), value);
587 CameraErrorFactory.ThrowIfError(SetCaptureFormat(_camera.GetHandle(), value),
588 "Failed to set capture format.");
591 #endregion Resolution, Format, Fps of preview, capture
593 #region Encoded preview
595 /// The bit rate of the encoded preview.
597 /// <since_tizen> 3 </since_tizen>
598 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
599 public int EncodedPreviewBitrate
603 CameraErrorFactory.ThrowIfError(Native.GetBitrate(_camera.GetHandle(), out int val),
604 "Failed to get preview bitrate");
611 CameraErrorFactory.ThrowIfError(Native.SetBitrate(_camera.GetHandle(), value),
612 "Failed to set encoded preview bitrate.");
617 /// The GOP(Group Of Pictures) interval of the encoded preview.
619 /// <since_tizen> 3 </since_tizen>
620 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
621 public int EncodedPreviewGopInterval
625 CameraErrorFactory.ThrowIfError(Native.GetGopInterval(_camera.GetHandle(), out int val),
626 "Failed to get preview gop interval");
633 CameraErrorFactory.ThrowIfError(Native.SetGopInterval(_camera.GetHandle(), value),
634 "Failed to set encoded preview gop intervals.");
637 #endregion Encoded preview
640 /// The theater mode.
642 /// <since_tizen> 3 </since_tizen>
643 /// <value>A <see cref="CameraTheaterMode"/> that specifies the theater mode.</value>
645 /// If you want to display the preview image on the external display with the full screen mode,
646 /// use this property.
648 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
649 public CameraTheaterMode TheaterMode
653 CameraErrorFactory.ThrowIfError(Native.GetTheaterMode(_camera.GetHandle(), out var val),
654 "Failed to get camera theater mode");
661 ValidationUtil.ValidateEnum(typeof(CameraTheaterMode), value);
662 CameraErrorFactory.ThrowIfError(Native.SetTheaterMode(_camera.GetHandle(), value),
663 "Failed to set camera theater mode.");
668 /// The camera effect mode.
670 /// <since_tizen> 3 </since_tizen>
671 /// <value>A <see cref="CameraEffectMode"/> that specifies the effect mode.</value>
672 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
673 public CameraEffectMode Effect
677 CameraErrorFactory.ThrowIfError(Native.GetEffect(_camera.GetHandle(), out var val),
678 "Failed to get camera effect");
685 ValidationUtil.ValidateEnum(typeof(CameraEffectMode), value);
686 CameraErrorFactory.ThrowIfError(Native.SetEffect(_camera.GetHandle(), value),
687 "Failed to set camera effect.");
694 /// <since_tizen> 3 </since_tizen>
695 /// <value>A <see cref="CameraSceneMode"/> that specifies the scene mode.</value>
696 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
697 public CameraSceneMode SceneMode
701 CameraErrorFactory.ThrowIfError(Native.GetSceneMode(_camera.GetHandle(), out var val),
702 "Failed to get camera scene mode");
709 ValidationUtil.ValidateEnum(typeof(CameraSceneMode), value);
710 CameraErrorFactory.ThrowIfError(Native.SetSceneMode(_camera.GetHandle(), value),
711 "Failed to set camera scene mode.");
716 /// The camera's flash mode.
718 /// <since_tizen> 3 </since_tizen>
719 /// <value>A <see cref="CameraFlashMode"/> that specifies the flash mode.</value>
720 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
721 public CameraFlashMode FlashMode
725 CameraErrorFactory.ThrowIfError(Native.GetFlashMode(_camera.GetHandle(), out var val),
726 "Failed to get camera flash mode");
733 ValidationUtil.ValidateEnum(typeof(CameraFlashMode), value);
734 CameraErrorFactory.ThrowIfError(Native.SetFlashMode(_camera.GetHandle(), value),
735 "Failed to set camera flash mode.");
740 /// Gets the camera lens orientation angle.
742 /// <since_tizen> 3 </since_tizen>
743 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
744 public int LensOrientation
748 CameraErrorFactory.ThrowIfError(Native.GetLensOrientation(_camera.GetHandle(), out var val),
749 "Failed to get camera lens orientation");
756 /// The stream rotation.
758 /// <since_tizen> 3 </since_tizen>
759 /// <value>A <see cref="Rotation"/> that specifies the rotation of camera device.</value>
760 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
761 public Rotation StreamRotation
765 CameraErrorFactory.ThrowIfError(Native.GetStreamRotation(_camera.GetHandle(), out var val),
766 "Failed to get camera stream rotation");
773 ValidationUtil.ValidateEnum(typeof(Rotation), value);
775 CameraErrorFactory.ThrowIfError(Native.SetStreamRotation(_camera.GetHandle(), value),
776 "Failed to set camera stream rotation.");
783 /// <since_tizen> 3 </since_tizen>
784 /// <value>A <see cref="Flips"/> that specifies the camera flip type.</value>
785 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
786 public Flips StreamFlip
790 CameraErrorFactory.ThrowIfError(Native.GetFlip(_camera.GetHandle(), out var val),
791 "Failed to get camera stream flip");
798 ValidationUtil.ValidateFlagsEnum(value, Flips.Horizontal | Flips.Vertical, nameof(Flips));
800 CameraErrorFactory.ThrowIfError(Native.SetFlip(_camera.GetHandle(), value),
801 "Failed to set camera flip.");
806 /// The mode of the HDR(High dynamic range) capture.
808 /// <since_tizen> 3 </since_tizen>
809 /// <value>A <see cref="CameraHdrMode"/> that specifies the HDR mode.</value>
811 /// Taking multiple pictures at different exposure levels and intelligently stitching them together,
812 /// so that we eventually arrive at a picture that is representative in both dark and bright areas.
813 /// If this attribute is set, then event handler set for the HdrCaptureProgress event is invoked.
815 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
816 public CameraHdrMode HdrMode
820 CameraErrorFactory.ThrowIfError(Native.GetHdrMode(_camera.GetHandle(), out var val),
821 "Failed to get camera hdr mode");
828 ValidationUtil.ValidateEnum(typeof(CameraHdrMode), value);
829 CameraErrorFactory.ThrowIfError(Native.SetHdrMode(_camera.GetHandle(), value),
830 "Failed to set camera hdr mode.");
835 /// The anti shake feature.
836 /// If true, the antishake feature is enabled, otherwise false.
838 /// <since_tizen> 3 </since_tizen>
839 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
840 public bool AntiShake
844 CameraErrorFactory.ThrowIfError(Native.IsEnabledAntiShake(_camera.GetHandle(), out bool val),
845 "Failed to get camera anti shake value");
852 CameraErrorFactory.ThrowIfError(Native.EnableAntiShake(_camera.GetHandle(), value),
853 "Failed to set camera anti shake value.");
858 /// Enables or disables the video stabilization feature.
859 /// If true, video stabilization is enabled, otherwise false.
861 /// <since_tizen> 3 </since_tizen>
863 /// If video stabilization is enabled, zero shutter lag is disabled.
864 /// This feature is used to record a video.
866 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
867 public bool VideoStabilization
871 CameraErrorFactory.ThrowIfError(Native.IsEnabledVideoStabilization(_camera.GetHandle(), out bool val),
872 "Failed to get camera video stabilization");
879 CameraErrorFactory.ThrowIfError(Native.EnableVideoStabilization(_camera.GetHandle(), value),
880 "Failed to set camera video stabilization.");
885 /// Turn the shutter sound on or off, if it is permitted by policy.
887 /// <since_tizen> 4 </since_tizen>
888 /// <param name="shutterSound">Shutter sound On/Off flag</param>
890 /// If this value is true, shutter sound will be disabled, otherwise enabled.
891 /// In some countries, this operation is not permitted.
893 /// <exception cref="InvalidOperationException">Disabling shutter sound is not permitted.</exception>
894 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
895 public void DisableShutterSound(bool shutterSound)
897 CameraErrorFactory.ThrowIfError(Native.DisableShutterSound(_camera.GetHandle(), shutterSound),
898 "Failed to set disable shutter sound.");
901 #region PTZ(Pan Tilt Zoom), Pan, Tilt
903 /// Sets the type of the PTZ(Pan Tilt Zoom). Mechanical or electronic.
905 /// <since_tizen> 3 </since_tizen>
906 /// <value>A <see cref="CameraPtzType"/> that specifies the type of the PTZ.</value>
907 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
908 public CameraPtzType PtzType
912 ValidationUtil.ValidateEnum(typeof(CameraPtzType), value);
914 CameraErrorFactory.ThrowIfError(Native.SetPtzType(_camera.GetHandle(), value),
915 "Failed to set camera ptz type.");
920 /// Sets the position to move horizontally.
922 /// <since_tizen> 3 </since_tizen>
923 /// <param name="type">The PTZ move type. <seealso cref="CameraPtzMoveType"/>.</param>
924 /// <param name="panStep">The pan step.</param>
925 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
926 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
927 public void SetPan(CameraPtzMoveType type, int panStep)
929 ValidationUtil.ValidateEnum(typeof(CameraPtzMoveType), type, nameof(type));
930 CameraErrorFactory.ThrowIfError(Native.SetPan(_camera.GetHandle(), type, panStep),
931 "Failed to set the camera pan type.");
935 /// Gets the current position of the camera.
937 /// <since_tizen> 3 </since_tizen>
938 /// <returns>Returns the camera's horizontal position.</returns>
939 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
942 CameraErrorFactory.ThrowIfError(Native.GetPan(_camera.GetHandle(), out int val),
943 "Failed to get the camera pan step.");
949 /// Sets the position to move vertically.
951 /// <since_tizen> 3 </since_tizen>
952 /// <param name="type">the PTZ move type.</param>
953 /// <param name="tiltStep">The tilt step.</param>
954 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
955 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
956 public void SetTilt(CameraPtzMoveType type, int tiltStep)
958 ValidationUtil.ValidateEnum(typeof(CameraPtzMoveType), type, nameof(type));
959 CameraErrorFactory.ThrowIfError(Native.SetTilt(_camera.GetHandle(), type, tiltStep),
960 "Failed to set the camera tilt type\t.");
964 /// Gets the current position of the camera.
966 /// <since_tizen> 3 </since_tizen>
967 /// <returns>Returns the current vertical position.</returns>
968 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
971 CameraErrorFactory.ThrowIfError(Native.GetTilt(_camera.GetHandle(), out int val),
972 "Failed to set the camera current position.");
978 /// Gets the lower limit and the upper limit for the pan position.
980 /// <since_tizen> 3 </since_tizen>
982 /// If the minimum value is greater than the maximum value, it means this feature is not supported.
984 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
985 public Range PanRange
989 if (!_panRange.HasValue)
991 throw new NotSupportedException("Pan is not supported.");
994 return _panRange.Value;
999 /// Gets the lower limit and the upper limit for the tilt position.
1001 /// <since_tizen> 3 </since_tizen>
1003 /// If the minimum value is greater than the maximum value, it means this feature is not supported.
1005 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
1006 public Range TiltRange
1010 if (!_tiltRange.HasValue)
1012 throw new NotSupportedException("Tilt is not supported.");
1015 return _tiltRange.Value;
1018 #endregion PTZ(Pan Tilt Zoom), Pan, Tilt
1024 /// <value>true if EXIF tags are enabled in the JPEG file, otherwise false.</value>
1025 /// <since_tizen> 3 </since_tizen>
1026 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
1027 public bool EnableTag
1031 CameraErrorFactory.ThrowIfError(Native.IsEnabledTag(_camera.GetHandle(), out bool val),
1032 "Failed to get camera enable tag");
1039 CameraErrorFactory.ThrowIfError(Native.EnableTag(_camera.GetHandle(), value),
1040 "Failed to set camera enable tag.");
1045 /// The camera image description in the EXIF tag.
1047 /// <since_tizen> 3 </since_tizen>
1048 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
1049 public string ImageDescriptionTag
1053 IntPtr val = IntPtr.Zero;
1056 CameraErrorFactory.ThrowIfError(Native.GetImageDescription(_camera.GetHandle(), out val),
1057 "Failed to get image description");
1059 return Marshal.PtrToStringAnsi(val);
1063 LibcSupport.Free(val);
1069 CameraErrorFactory.ThrowIfError(Native.SetImageDescription(_camera.GetHandle(), value),
1070 "Failed to set image description.");
1075 /// The software information in the EXIF tag.
1077 /// <since_tizen> 3 </since_tizen>
1078 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
1079 public string SoftwareTag
1083 IntPtr val = IntPtr.Zero;
1087 CameraErrorFactory.ThrowIfError(Native.GetTagSoftware(_camera.GetHandle(), out val),
1088 "Failed to get tag software");
1090 return Marshal.PtrToStringAnsi(val);
1094 LibcSupport.Free(val);
1100 CameraErrorFactory.ThrowIfError(Native.SetTagSoftware(_camera.GetHandle(), value),
1101 "Failed to set tag software.");
1106 /// The geo tag(GPS data) in the EXIF tag.
1108 /// <since_tizen> 3 </since_tizen>
1109 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
1110 public Location GeoTag
1114 CameraErrorFactory.ThrowIfError(Native.GetGeotag(_camera.GetHandle(),
1115 out double latitude, out double longitude, out double altitude), "Failed to get tag");
1117 return new Location(latitude, longitude, altitude);
1122 CameraErrorFactory.ThrowIfError(Native.SetGeotag(_camera.GetHandle(),
1123 value.Latitude, value.Longitude, value.Altitude), "Failed to set geo tag.");
1128 /// Removes the geo tag(GPS data) in the EXIF(EXchangeable Image File format) tag.
1130 /// <since_tizen> 3 </since_tizen>
1131 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
1132 public void RemoveGeoTag()
1134 CameraErrorFactory.ThrowIfError(Native.RemoveGeotag(_camera.GetHandle()),
1135 "Failed to remove the geotag\t.");
1139 /// The camera orientation in the tag.
1141 /// <since_tizen> 3 </since_tizen>
1142 /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
1143 public CameraTagOrientation OrientationTag
1147 CameraErrorFactory.ThrowIfError(Native.GetTagOrientation(_camera.GetHandle(), out var val),
1148 "Failed to get camera tag orientation");
1155 ValidationUtil.ValidateEnum(typeof(CameraTagOrientation), value);
1156 CameraErrorFactory.ThrowIfError(Native.SetTagOrientation(_camera.GetHandle(), value),
1157 "Failed to set camera tag orientation.");