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.
19 using System.Runtime.InteropServices;
21 namespace Tizen.Multimedia
24 /// The camera setting class provides methods/properties to get and
25 /// set basic camera attributes.
27 public class CameraSettings
29 internal readonly Camera _camera;
31 private readonly Range? _brightnessRange;
32 private readonly Range? _contrastRange;
33 private readonly Range? _panRange;
34 private readonly Range? _tiltRange;
35 private readonly Range? _exposureRange;
36 private readonly Range? _zoomRange;
38 internal CameraSettings(Camera camera)
42 _contrastRange = GetRange(Interop.CameraSettings.GetContrastRange);
43 _brightnessRange = GetRange(Interop.CameraSettings.GetBrightnessRange);
44 _exposureRange = GetRange(Interop.CameraSettings.GetExposureRange);
45 _zoomRange = GetRange(Interop.CameraSettings.GetZoomRange);
46 _panRange = GetRange(Interop.CameraSettings.GetPanRange);
47 _tiltRange = GetRange(Interop.CameraSettings.GetTiltRange);
50 private delegate CameraError GetRangeDelegate(IntPtr handle, out int min, out int max);
51 private Range? GetRange(GetRangeDelegate func)
56 CameraErrorFactory.ThrowIfError(func(_camera.GetHandle(), out min, out max),
57 "Failed to initialize the camera settings");
64 return new Range(min, max);
69 /// Sets auto focus area.
72 /// <see cref="CameraAutoFocusMode"/> should not be the <see cref="CameraAutoFocusMode.None"/>.
75 /// http://tizen.org/privilege/camera
77 /// <param name="x">X position</param>
78 /// <param name="y">Y position</param>
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.</exception>
82 public void SetAutoFocusArea(int x, int y)
84 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetAutoFocusArea(_camera.GetHandle(), x, y),
85 "Failed to set the autofocus area.");
89 /// Sets auto focus area.
92 /// <see cref="CameraAutoFocusMode"/> should not be the <see cref="CameraAutoFocusMode.None"/>.
95 /// http://tizen.org/privilege/camera
97 /// <param name="pos"><see cref="Point"/> structure including X, Y position</param>
98 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
99 /// <exception cref="InvalidOperationException">In case of any invalid operations.</exception>
100 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
101 public void SetAutoFocusArea(Point pos)
103 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetAutoFocusArea(_camera.GetHandle(), pos.X, pos.Y),
104 "Failed to set the autofocus area.");
108 /// Clears the auto focus area.
111 /// http://tizen.org/privilege/camera
113 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
114 public void ClearFocusArea()
116 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.ClearAutoFocusArea(_camera.GetHandle()),
117 "Failed to clear the autofocus area.");
121 /// The auto focus mode.
123 /// <value>A <see cref="CameraAutoFocusMode"/> that specifies the auto focus mode.</value>
125 /// http://tizen.org/privilege/camera
127 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
128 public CameraAutoFocusMode AutoFocusMode
132 CameraAutoFocusMode val = CameraAutoFocusMode.None;
134 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetAutoFocusMode(_camera.GetHandle(), out val),
135 "Failed to get camera autofocus mode");
142 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetAutoFocusMode(_camera.GetHandle(), value),
143 "Failed to set camera autofocus mode.");
146 #endregion Auto Focus
150 /// The contrast level of the camera.
153 /// http://tizen.org/privilege/camera
155 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
162 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetContrast(_camera.GetHandle(), out val),
163 "Failed to get camera contrast value");
170 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetContrast(_camera.GetHandle(), value),
171 "Failed to set camera contrast value.");
176 /// The auto contrast.
177 /// If true auto contrast is enabled, otherwise false.
180 /// http://tizen.org/privilege/camera
182 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
183 public bool AutoContrast
189 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.IsEnabledAutoContrast(_camera.GetHandle(), out val),
190 "Failed to get camera auto contrast");
197 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.EnableAutoContrast(_camera.GetHandle(), value),
198 "Failed to set camera enable auto contrast.");
202 /// Gets the available contrast level.
205 /// If min value is greater than the max value, it means this feature is not supported.
207 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
208 public Range ContrastRange
212 if (!_contrastRange.HasValue)
214 throw new NotSupportedException("Contrast is not supported.");
217 return _contrastRange.Value;
224 /// The brightness level of the camera.
227 /// http://tizen.org/privilege/camera
229 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
230 public int Brightness
236 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetBrightness(_camera.GetHandle(), out val),
237 "Failed to get camera brightness value");
244 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetBrightness(_camera.GetHandle(), value),
245 "Failed to set camera brightness value.");
250 /// Gets the available brightness level.
253 /// If min value is greater than the max value, it means this feature is not supported.
255 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
256 public Range BrightnessRange
260 if (!_brightnessRange.HasValue)
262 throw new NotSupportedException("Brightness is not supported.");
265 return _brightnessRange.Value;
268 #endregion Brightness
272 /// The exposure value.
275 /// http://tizen.org/privilege/camera
277 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
284 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetExposure(_camera.GetHandle(), out val),
285 "Failed to get camera exposure value");
292 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetExposure(_camera.GetHandle(), value),
293 "Failed to set camera exposure value.");
298 /// The exposure mode.
300 /// <value>A <see cref="CameraExposureMode"/> that specifies the exposure mode.</value>
302 /// http://tizen.org/privilege/camera
304 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
305 public CameraExposureMode ExposureMode
309 CameraExposureMode val = CameraExposureMode.Off;
311 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetExposureMode(_camera.GetHandle(), out val),
312 "Failed to get camera exposure mode");
319 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetExposureMode(_camera.GetHandle(), value),
320 "Failed to set camera exposure mode.");
325 /// Gets the available exposure value.
328 /// If min value is greater than the max value, it means this feature is not supported.
330 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
331 public Range ExposureRange
335 if (!_exposureRange.HasValue)
337 throw new NotSupportedException("Exposure is not supported.");
340 return _exposureRange.Value;
348 /// The range for zoom level is received from ZoomRange property.
351 /// http://tizen.org/privilege/camera.
353 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
360 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetZoom(_camera.GetHandle(), out val),
361 "Failed to get zoom level");
368 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetZoom(_camera.GetHandle(), (int)value),
369 "Failed to set zoom level.");
374 /// Gets the available zoom level.
377 /// If min value is greater than the max value, it means this feature is not supported.
379 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
380 public Range ZoomRange
384 if (!_zoomRange.HasValue)
386 throw new NotSupportedException("Zoom is not supported.");
389 return _zoomRange.Value;
395 /// The whitebalance mode.
397 /// <value>A <see cref="CameraWhiteBalance"/> that specifies the white balance mode.</value>
399 /// http://tizen.org/privilege/camera
401 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
402 public CameraWhiteBalance WhiteBalance
406 CameraWhiteBalance val = CameraWhiteBalance.None;
408 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetWhiteBalance(_camera.GetHandle(), out val),
409 "Failed to get camera whitebalance");
416 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetWhitebalance(_camera.GetHandle(), value),
417 "Failed to set camera whitebalance.");
424 /// <value>A <see cref="CameraIsoLevel"/> that specifies ISO level.</value>
426 /// http://tizen.org/privilege/camera
428 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
429 public CameraIsoLevel IsoLevel
433 CameraIsoLevel val = CameraIsoLevel.Auto;
435 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetIso(_camera.GetHandle(), out val),
436 "Failed to get camera Iso level");
443 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetIso(_camera.GetHandle(), value),
444 "Failed to set camera Iso level.");
449 /// The quality of the image.
450 /// The range for image quality is 1 to 100.
453 /// http://tizen.org/privilege/camera.
455 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
456 public int ImageQuality
462 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetImageQuality(_camera.GetHandle(), out val),
463 "Failed to get image quality");
470 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetImageQuality(_camera.GetHandle(), value),
471 "Failed to set image quality.");
475 #region Resolution, Format, Fps of preview, capture
477 /// The preview frame rate.
479 /// <value>A <see cref="CameraFps"/> that specifies preview frame rate.</value>
480 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
481 public CameraFps PreviewFps
485 CameraFps val = CameraFps.Auto;
487 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetPreviewFps(_camera.GetHandle(), out val),
488 "Failed to get camera preview fps");
495 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetPreviewFps(_camera.GetHandle(), value),
496 "Failed to set preview fps.");
501 /// Gets or sets the resolution of preview
504 /// http://tizen.org/privilege/camera
506 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
507 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
508 public Size PreviewResolution
515 CameraErrorFactory.ThrowIfError(Interop.Camera.GetPreviewResolution(_camera.GetHandle(), out width, out height),
516 "Failed to get camera preview resolution");
518 return new Size(width, height);
523 CameraErrorFactory.ThrowIfError(Interop.Camera.SetPreviewResolution(_camera.GetHandle(), value.Width, value.Height),
524 "Failed to set preview resolution.");
529 /// Gets the recommended preview resolution.
532 /// Depending on the capture resolution aspect ratio and display resolution,
533 /// the recommended preview resolution is determined.
535 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
536 public Size RecommendedPreviewResolution
543 CameraErrorFactory.ThrowIfError(Interop.Camera.GetRecommendedPreviewResolution(_camera.GetHandle(), out width, out height),
544 "Failed to get recommended preview resolution");
546 return new Size(width, height);
551 /// The preview data format.
553 /// <value>A <see cref="CameraPixelFormat"/> that specifies the pixel format of preview data.</value>
554 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
555 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
556 public CameraPixelFormat PreviewPixelFormat
560 CameraPixelFormat val = 0;
562 CameraErrorFactory.ThrowIfError(Interop.Camera.GetPreviewPixelFormat(_camera.GetHandle(), out val),
563 "Failed to get preview format");
570 CameraErrorFactory.ThrowIfError(Interop.Camera.SetPreviewPixelFormat(_camera.GetHandle(), value),
571 "Failed to set preview format.");
576 /// Resolution of the captured image.
579 /// http://tizen.org/privilege/camera
581 /// <exception cref="ArgumentException">In case of invalid parameters</exception>
582 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
583 public Size CaptureResolution
590 CameraErrorFactory.ThrowIfError(Interop.Camera.GetCaptureResolution(_camera.GetHandle(), out width, out height),
591 "Failed to get camera capture resolution");
593 return new Size(width, height);
600 CameraErrorFactory.ThrowIfError(Interop.Camera.SetCaptureResolution(_camera.GetHandle(), res.Width, res.Height),
601 "Failed to set capture resolution.");
606 /// Format of an image to be captured.
608 /// <value>A <see cref="CameraPixelFormat"/> that specifies the pixel format of captured image.</value>
609 /// <exception cref="ArgumentException">In case of invalid parameters</exception>
610 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
611 public CameraPixelFormat CapturePixelFormat
615 CameraPixelFormat val = CameraPixelFormat.Invalid;
617 CameraErrorFactory.ThrowIfError(Interop.Camera.GetCaptureFormat(_camera.GetHandle(), out val),
618 "Failed to get camera capture formats");
625 CameraErrorFactory.ThrowIfError(Interop.Camera.SetCaptureFormat(_camera.GetHandle(), value),
626 "Failed to set capture format.");
629 #endregion Resolution, Format, Fps of preview, capture
631 #region Encoded preview
633 /// The bit rate of encoded preview.
635 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
636 public int EncodedPreviewBitrate
642 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetBitrate(_camera.GetHandle(), out val),
643 "Failed to get preview bitrate");
650 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetBitrate(_camera.GetHandle(), (int)value),
651 "Failed to set encoded preview bitrate.");
656 /// GOP(Group Of Pictures) interval of encoded preview.
658 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
659 public int EncodedPreviewGopInterval
665 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetGopInterval(_camera.GetHandle(), out val),
666 "Failed to get preview gop interval");
673 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetGopInterval(_camera.GetHandle(), (int)value),
674 "Failed to set encoded preview gop intervals.");
677 #endregion Encoded preview
680 /// The theater mode.
682 /// <value>A <see cref="CameraTheaterMode"/> that specifies theater mode.</value>
684 /// http://tizen.org/privilege/camera
687 /// If you want to display the preview image on the external display with the full screen mode,
688 /// use this property.
690 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
691 public CameraTheaterMode TheaterMode
695 CameraTheaterMode val = CameraTheaterMode.Disable;
697 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetTheaterMode(_camera.GetHandle(), out val),
698 "Failed to get camera theater mode");
705 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetTheaterMode(_camera.GetHandle(), value),
706 "Failed to set camera theater mode.");
711 /// The camera effect mode.
713 /// <value>A <see cref="CameraEffectMode"/> that specifies effect mode.</value>
715 /// http://tizen.org/privilege/camera
717 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
718 public CameraEffectMode Effect
722 CameraEffectMode val = CameraEffectMode.None;
724 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetEffect(_camera.GetHandle(), out val),
725 "Failed to get camera effect");
732 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetEffect(_camera.GetHandle(), value),
733 "Failed to set camera effect.");
740 /// <value>A <see cref="CameraSceneMode"/> that specifies scene mode.</value>
742 /// http://tizen.org/privilege/camera
744 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
745 public CameraSceneMode SceneMode
749 CameraSceneMode val = CameraSceneMode.Normal;
751 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetSceneMode(_camera.GetHandle(), out val),
752 "Failed to get camera scene mode");
759 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetSceneMode(_camera.GetHandle(), value),
760 "Failed to set camera scene mode.");
765 /// The camera's flash mode.
767 /// <value>A <see cref="CameraFlashMode"/> that specifies flash mode.</value>
769 /// http://tizen.org/privilege/camera
771 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
772 public CameraFlashMode FlashMode
776 CameraFlashMode val = CameraFlashMode.Off;
778 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetFlashMode(_camera.GetHandle(), out val),
779 "Failed to get camera flash mode");
786 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetFlashMode(_camera.GetHandle(), value),
787 "Failed to set camera flash mode.");
792 /// Gets the camera lens orientation angle.
794 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
795 public int LensOrientation
801 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetLensOrientation(_camera.GetHandle(), out val),
802 "Failed to get camera lens orientation");
809 /// The stream rotation.
811 /// <value>A <see cref="CameraRotation"/> that specifies the rotation of camera device.</value>
812 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
813 public CameraRotation StreamRotation
817 CameraRotation val = CameraRotation.None;
819 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetStreamRotation(_camera.GetHandle(), out val),
820 "Failed to get camera stream rotation");
827 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetStreamRotation(_camera.GetHandle(), value),
828 "Failed to set camera stream rotation.");
835 /// <value>A <see cref="CameraFlip"/> that specifies camera flip type.</value>
836 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
837 public CameraFlip StreamFlip
841 CameraFlip val = CameraFlip.None;
843 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetFlip(_camera.GetHandle(), out val),
844 "Failed to get camera stream flip");
851 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetFlip(_camera.GetHandle(), value),
852 "Failed to set camera flip.");
857 /// The mode of HDR(High dynamic range) capture.
859 /// <value>A <see cref="CameraHdrMode"/> that specifies the HDR mode.</value>
861 /// http://tizen.org/privilege/camera
864 /// Taking multiple pictures at different exposure levels and intelligently stitching them together
865 /// so that we eventually arrive at a picture that is representative in both dark and bright areas.
866 /// If this attribute is set, then eventhandler set for HdrCaptureProgress event is invoked.
868 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
869 public CameraHdrMode HdrMode
873 CameraHdrMode val = 0;
875 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetHdrMode(_camera.GetHandle(), out val),
876 "Failed to get camera hdr mode");
883 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetHdrMode(_camera.GetHandle(), value),
884 "Failed to set camera hdr mode.");
889 /// The anti shake feature.
890 /// If true the antishake feature is enabled, otherwise false.
892 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
893 public bool AntiShake
899 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.IsEnabledAntiShake(_camera.GetHandle(), out val),
900 "Failed to get camera anti shake value");
907 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.EnableAntiShake(_camera.GetHandle(), value),
908 "Failed to set camera anti shake value.");
913 /// Enables/Disables the video stabilization feature.
914 /// If true video stabilization is enabled, otherwise false.
917 /// http://tizen.org/privilege/camera
920 /// If video stabilization is enabled, zero shutter lag is disabled.
921 /// This feature is used to record a video.
923 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
924 public bool VideoStabilization
930 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.IsEnabledVideoStabilization(_camera.GetHandle(), out val),
931 "Failed to get camera video stabilization");
938 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.EnableVideoStabilization(_camera.GetHandle(), value),
939 "Failed to set camera video stabilization.");
944 /// Disables shutter sound.
945 /// If true shutter sound is disabled, otherwise false.
948 /// In some countries, this operation is not permitted.
950 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
951 public bool DisableShutterSound
955 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.DisableShutterSound(_camera.GetHandle(), value),
956 "Failed to set disable shutter sound.");
960 #region PTZ(Pan Tilt Zoom), Pan, Tilt
962 /// Sets the type of PTZ(Pan Tilt Zoom). Mechanical or Electronic.
964 /// <value>A <see cref="CameraPtzType"/> that specifies the type of PTZ.</value>
965 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
966 public CameraPtzType PtzType
970 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetPtzType(_camera.GetHandle(), (int)value),
971 "Failed to set camera ptz type.");
976 /// Sets the position to move horizontally.
979 /// http://tizen.org/privilege/camera
981 /// <param name="type">ptz move type. <seealso cref="CameraPtzMoveType"/></param>
982 /// <param name="panStep">pan step</param>
983 /// <exception cref="ArgumentException">In case of invalid parameters</exception>
984 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
985 public void SetPan(CameraPtzMoveType type, int panStep)
987 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetPan(_camera.GetHandle(), type, panStep),
988 "Failed to set the camera pan type.");
992 /// Gets the current position of the camera.
995 /// http://tizen.org/privilege/camera
997 /// <returns>Returns the camera's horizontal position</returns>
998 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
1003 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetPan(_camera.GetHandle(), out val),
1004 "Failed to get the camera pan step.");
1010 /// Sets the position to move vertically.
1013 /// http://tizen.org/privilege/camera
1015 /// <param name="type">ptz move type</param>
1016 /// <param name="tiltStep">tilt step</param>
1017 /// <exception cref="ArgumentException">In case of invalid parameters</exception>
1018 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
1019 public void SetTilt(CameraPtzMoveType type, int tiltStep)
1021 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetTilt(_camera.GetHandle(), type, tiltStep),
1022 "Failed to set the camera tilt type\t.");
1026 /// Gets the current position of the camera.
1029 /// http://tizen.org/privilege/camera
1031 /// <returns>Returns the current vertical position</returns>
1032 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
1033 public int GetTilt()
1037 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetTilt(_camera.GetHandle(), out val),
1038 "Failed to set the camera current position.");
1044 /// Gets lower limit and upper limit for pan position.
1047 /// If min value is greater than the max value, it means this feature is not supported.
1049 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
1050 public Range PanRange
1054 if (!_panRange.HasValue)
1056 throw new NotSupportedException("Pan is not supported.");
1058 return _panRange.Value;
1063 /// Gets lower limit and upper limit for tilt position.
1066 /// If min value is greater than the max value, it means this feature is not supported.
1068 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
1069 public Range TiltRange
1073 if (!_tiltRange.HasValue)
1075 throw new NotSupportedException("Tilt is not supported.");
1077 return _tiltRange.Value;
1080 #endregion PTZ(Pan Tilt Zoom), Pan, Tilt
1085 /// true if EXIF tags are enabled in JPEG file, otherwise false.
1087 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
1088 public bool EnableTag
1094 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.IsEnabledTag(_camera.GetHandle(), out val),
1095 "Failed to get camera enable tag");
1102 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.EnableTag(_camera.GetHandle(), value),
1103 "Failed to set camera enable tag.");
1108 /// The camera image description in the EXIF tag.
1110 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
1111 public string ImageDescriptionTag
1115 IntPtr val = IntPtr.Zero;
1118 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetImageDescription(_camera.GetHandle(), out val),
1119 "Failed to get image description");
1121 return Marshal.PtrToStringAnsi(val);
1125 Interop.Libc.Free(val);
1131 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetImageDescription(_camera.GetHandle(), value),
1132 "Failed to set image description.");
1137 /// The software information in the EXIF tag.
1139 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
1140 public string SoftwareTag
1144 IntPtr val = IntPtr.Zero;
1148 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetTagSoftware(_camera.GetHandle(), out val),
1149 "Failed to get tag software");
1151 return Marshal.PtrToStringAnsi(val);
1155 Interop.Libc.Free(val);
1161 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetTagSoftware(_camera.GetHandle(), value),
1162 "Failed to set tag software.");
1167 /// The geotag(GPS data) in the EXIF tag.
1169 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
1170 public Location GeoTag
1174 double latitude = 0.0;
1175 double longitude = 0.0;
1176 double altitude = 0.0;
1178 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetGeotag(_camera.GetHandle(), out latitude, out longitude, out altitude),
1179 "Failed to get tag");
1181 return new Location(latitude, longitude, altitude);
1186 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetGeotag(_camera.GetHandle(),
1187 value.Latitude, value.Longitude, value.Altitude), "Failed to set geo tag.");
1192 /// Removes the geotag(GPS data) in the EXIF(Exchangeable image file format) tag.
1195 /// http://tizen.org/privilege/camera
1197 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
1198 public void RemoveGeoTag()
1200 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.RemoveGeotag(_camera.GetHandle()),
1201 "Failed to remove the geotag\t.");
1205 /// The camera orientation in the tag.
1207 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
1208 public CameraTagOrientation OrientationTag
1212 CameraTagOrientation val = 0;
1214 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetTagOrientation(_camera.GetHandle(), out val),
1215 "Failed to get camera tag orientation");
1222 CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetTagOrientation(_camera.GetHandle(), value),
1223 "Failed to set camera tag orientation.");