4dac24cb3e3b4191b349638dcbc02d2e0af182f6
[platform/core/csapi/tizenfx.git] / src / Tizen.Multimedia / Camera / CameraSetting.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 using System;
18 using System.Collections.Generic;
19 using System.Runtime.InteropServices;
20 using Tizen.Internals.Errors;
21
22 namespace Tizen.Multimedia
23 {
24     /// <summary>
25     /// The camera setting class provides methods/properties to get and
26     /// set basic camera attributes.
27     /// </summary>
28     public class CameraSetting
29     {
30         internal readonly IntPtr _settingHandle;
31
32         internal CameraSetting(IntPtr _handle)
33         {
34             _settingHandle = _handle;
35         }
36
37         /// <summary>
38         /// Sets auto focus area.
39         /// </summary>
40         /// <privilege>
41         /// http://tizen.org/privilege/camera
42         /// </privilege>
43         /// <param name="x">X position</param>
44         /// <param name="y">Y position</param>
45         /// <exception cref="ArgumentException">In case of invalid parameters</exception>
46         public void SetFocusArea(int x, int y)
47         {
48             int ret = Interop.CameraSetting.SetAfArea(_settingHandle, x, y);
49             if (ret != (int)CameraError.None)
50             {
51                 CameraErrorFactory.ThrowException(ret, "Failed to set the autofocus area.");
52             }
53         }
54
55         /// <summary>
56         /// Clears the auto focus area.
57         /// </summary>
58         /// <privilege>
59         /// http://tizen.org/privilege/camera
60         /// </privilege>
61         public void ClearFocusArea()
62         {
63             int ret = Interop.CameraSetting.ClearAfArea(_settingHandle);
64             if (ret != (int)CameraError.None)
65             {
66                 CameraErrorFactory.ThrowException(ret, "Failed to clear the autofocus area.");
67             }
68         }
69
70         /// <summary>
71         /// Sets the position to move horizontally.
72         /// </summary>
73         /// <privilege>
74         /// http://tizen.org/privilege/camera
75         /// </privilege>
76         /// <param name="type">ptz move type.</param>
77         /// <param name="panStep">pan step</param>
78         /// <exception cref="ArgumentException">In case of invalid parameters</exception>
79         public void SetPan(CameraPtzMoveType type, int panStep)
80         {
81             int ret = Interop.CameraSetting.SetPan(_settingHandle, (int)type, panStep);
82             if (ret != (int)CameraError.None)
83             {
84                 CameraErrorFactory.ThrowException(ret, "Failed to set the camera pan type.");
85             }
86         }
87
88         /// <summary>
89         /// Gets the current position of the camera.
90         /// </summary>
91         /// <privilege>
92         /// http://tizen.org/privilege/camera
93         /// </privilege>
94         /// <returns>Returns the camera's horizontal position</returns>
95         public int GetPan()
96         {
97             int val = 0;
98             int ret = Interop.CameraSetting.GetPan(_settingHandle, out val);
99             if (ret != (int)CameraError.None)
100             {
101                 CameraErrorFactory.ThrowException(ret, "Failed to get the camera pan step.");
102             }
103
104             return val;
105         }
106
107         /// <summary>
108         /// Sets the position to move vertically.
109         /// </summary>
110         /// <privilege>
111         /// http://tizen.org/privilege/camera
112         /// </privilege>
113         /// <param name="type">ptz move type</param>
114         /// <param name="tiltStep">tilt step</param>
115         /// <exception cref="ArgumentException">In case of invalid parameters</exception>
116         public void SetTilt(CameraPtzMoveType type, int tiltStep)
117         {
118             int ret = Interop.CameraSetting.SetTilt(_settingHandle, (int)type, tiltStep);
119             if (ret != (int)CameraError.None)
120             {
121                 CameraErrorFactory.ThrowException(ret, "Failed to set the camera tilt type\t.");
122             }
123         }
124
125         /// <summary>
126         /// Gets the current position of the camera.
127         /// </summary>
128         /// <privilege>
129         /// http://tizen.org/privilege/camera
130         /// </privilege>
131         /// <returns>Returns the current vertical position</returns>
132         public int GetTilt()
133         {
134             int val = 0;
135             int ret = Interop.CameraSetting.GetTilt(_settingHandle, out val);
136             if (ret != (int)CameraError.None)
137             {
138                 CameraErrorFactory.ThrowException(ret, "Failed to set the camera current position.");
139             }
140
141             return val;
142         }
143
144         /// <summary>
145         /// Removes the geotag(GPS data) in the EXIF(Exchangeable image file format) tag.
146         /// </summary>
147         /// <privilege>
148         /// http://tizen.org/privilege/camera
149         /// </privilege>
150         public void RemoveGeoTag()
151         {
152             int ret = Interop.CameraSetting.RemoveGeotag(_settingHandle);
153             if (ret != (int)CameraError.None)
154             {
155                 CameraErrorFactory.ThrowException(ret, "Failed to remove the geotag\t.");
156             }
157         }
158
159         /// <summary>
160         /// The preview frame rate.
161         /// </summary>
162         public CameraFps PreviewFps
163         {
164             get
165             {
166                 int val = 0;
167                 int ret = Interop.CameraSetting.GetPreviewFps(_settingHandle, out val);
168                 if ((CameraError)ret != CameraError.None)
169                 {
170                     Log.Error(CameraLog.Tag, "Failed to get camera preview fps, " + (CameraError)ret);
171                 }
172
173                 return (CameraFps)val;
174             }
175
176             set
177             {
178                 int ret = Interop.CameraSetting.SetPreviewFps(_settingHandle, (int)value);
179                 if ((CameraError)ret != CameraError.None)
180                 {
181                     Log.Error(CameraLog.Tag, "Failed to set preview fps, " + (CameraError)ret);
182                     CameraErrorFactory.ThrowException(ret, "Failed to set preview fps.");
183                 }
184             }
185         }
186
187         /// <summary>
188         /// The quality of the image.
189         /// The range for image quality is 1 to 100.
190         /// </summary>
191         /// <privilege>
192         /// http://tizen.org/privilege/camera.
193         /// </privilege>
194         public int ImageQuality
195         {
196             get
197             {
198                 int val = 0;
199                 int ret = Interop.CameraSetting.GetImageQuality(_settingHandle, out val);
200                 if ((CameraError)ret != CameraError.None)
201                 {
202                     Log.Error(CameraLog.Tag, "Failed to get image quality, " + (CameraError)ret);
203                 }
204
205                 return val;
206             }
207
208             set
209             {
210                 int ret = Interop.CameraSetting.SetImageQuality(_settingHandle, (int)value);
211                 if ((CameraError)ret != CameraError.None)
212                 {
213                     Log.Error(CameraLog.Tag, "Failed to set image quality, " + (CameraError)ret);
214                     CameraErrorFactory.ThrowException(ret, "Failed to set image quality.");
215                 }
216             }
217         }
218
219         /// <summary>
220         /// The bit rate of encoded preview.
221         /// </summary>
222         public int EncodedPreviewBitrate
223         {
224             get
225             {
226                 int val = 0;
227                 int ret = Interop.CameraSetting.GetBitrate(_settingHandle, out val);
228                 if ((CameraError)ret != CameraError.None)
229                 {
230                     Log.Error(CameraLog.Tag, "Failed to get preview bitrate, " + (CameraError)ret);
231                 }
232
233                 return val;
234             }
235
236             set
237             {
238                 int ret = Interop.CameraSetting.SetBitrate(_settingHandle, (int)value);
239                 if ((CameraError)ret != CameraError.None)
240                 {
241                     Log.Error(CameraLog.Tag, "Failed to set encoded preview bitrate, " + (CameraError)ret);
242                     CameraErrorFactory.ThrowException(ret, "Failed to set encoded preview bitrate.");
243                 }
244             }
245         }
246
247         /// <summary>
248         /// GOP(Group Of Pictures) interval of encoded preview.
249         /// </summary>
250         public int EncodedPreviewGopInterval
251         {
252             get
253             {
254                 int val = 0;
255                 int ret = Interop.CameraSetting.GetGopInterval(_settingHandle, out val);
256                 if ((CameraError)ret != CameraError.None)
257                 {
258                     Log.Error(CameraLog.Tag, "Failed to get preview gop interval, " + (CameraError)ret);
259                 }
260
261                 return val;
262             }
263
264             set
265             {
266                 int ret = Interop.CameraSetting.SetGopInterval(_settingHandle, (int)value);
267                 if ((CameraError)ret != CameraError.None)
268                 {
269                     Log.Error(CameraLog.Tag, "Failed to set encoded preview gop interval, " + (CameraError)ret);
270                     CameraErrorFactory.ThrowException(ret, "Failed to set encoded preview gop intervals.");
271                 }
272             }
273         }
274
275         /// <summary>
276         /// The zoom level.
277         /// The range for zoom level is received from ZoomRange property.
278         /// </summary>
279         /// <privilege>
280         /// http://tizen.org/privilege/camera.
281         /// </privilege>
282         public int ZoomLevel
283         {
284             get
285             {
286                 int val = 0;
287                 int ret = Interop.CameraSetting.GetZoom(_settingHandle, out val);
288                 if ((CameraError)ret != CameraError.None)
289                 {
290                     Log.Error(CameraLog.Tag, "Failed to get zoom level, " + (CameraError)ret);
291                 }
292
293                 return val;
294             }
295
296             set
297             {
298                 int ret = Interop.CameraSetting.SetZoom(_settingHandle, (int)value);
299                 if ((CameraError)ret != CameraError.None)
300                 {
301                     Log.Error(CameraLog.Tag, "Failed to set zoom level, " + (CameraError)ret);
302                     CameraErrorFactory.ThrowException(ret, "Failed to set zoom level.");
303                 }
304             }
305         }
306
307         /// <summary>
308         /// Gets the available zoom level.
309         /// </summary>
310         /// <remarks>
311         /// If min value is greater than the max value, it means this feature is not supported.
312         /// </remarks>
313         public Range ZoomRange
314         {
315             get
316             {
317                 int min = 0;
318                 int max = 0;
319
320                 int ret = Interop.CameraSetting.GetZoomRange(_settingHandle, out min, out max);
321                 if ((CameraError)ret != CameraError.None)
322                 {
323                     Log.Error(CameraLog.Tag, "Failed to get zoom range, " + (CameraError)ret);
324                 }
325
326                 Range res = new Range(min, max);
327                 return res;
328             }
329         }
330
331         /// <summary>
332         /// Gets the available exposure value.
333         /// </summary>
334         /// <remarks>
335         /// If min value is greater than the max value, it means this feature is not supported.
336         /// </remarks>
337         public Range ExposureRange
338         {
339             get
340             {
341                 int min = 0;
342                 int max = 0;
343
344                 int ret = Interop.CameraSetting.GetExposureRange(_settingHandle, out min, out max);
345                 if ((CameraError)ret != CameraError.None)
346                 {
347                     Log.Error(CameraLog.Tag, "Failed to get exposure range, " + (CameraError)ret);
348                 }
349
350                 Range res = new Range(min, max);
351                 return res;
352             }
353         }
354
355         /// <summary>
356         /// Gets the available brightness level.
357         /// </summary>
358         /// <remarks>
359         /// If min value is greater than the max value, it means this feature is not supported.
360         /// </remarks>
361         public Range BrightnessRange
362         {
363             get
364             {
365                 int min = 0;
366                 int max = 0;
367
368                 int ret = Interop.CameraSetting.GetBrightnessRange(_settingHandle, out min, out max);
369                 if ((CameraError)ret != CameraError.None)
370                 {
371                     Log.Error(CameraLog.Tag, "Failed to get brightness range, " + (CameraError)ret);
372                 }
373
374                 Range res = new Range(min, max);
375                 return res;
376             }
377         }
378
379         /// <summary>
380         /// Gets the available contrast level.
381         /// </summary>
382         /// <remarks>
383         /// If min value is greater than the max value, it means this feature is not supported.
384         /// </remarks>
385         public Range ContrastRange
386         {
387             get
388             {
389                 int min = 0;
390                 int max = 0;
391
392                 int ret = Interop.CameraSetting.GetContrastRange(_settingHandle, out min, out max);
393                 if ((CameraError)ret != CameraError.None)
394                 {
395                     Log.Error(CameraLog.Tag, "Failed to get contrast range, " + (CameraError)ret);
396                 }
397
398                 Range res = new Range(min, max);
399                 return res;
400             }
401         }
402
403         /// <summary>
404         /// Gets lower limit and upper limit for pan position.
405         /// </summary>
406         /// <remarks>
407         /// If min value is greater than the max value, it means this feature is not supported.
408         /// </remarks>
409         public Range PanRange
410         {
411             get
412             {
413                 int min = 0;
414                 int max = 0;
415
416                 int ret = Interop.CameraSetting.GetPanRange(_settingHandle, out min, out max);
417                 if ((CameraError)ret != CameraError.None)
418                 {
419                     Log.Error(CameraLog.Tag, "Failed to get pan range, " + (CameraError)ret);
420                 }
421
422                 Range res = new Range(min, max);
423                 return res;
424             }
425         }
426
427         /// <summary>
428         /// Gets lower limit and upper limit for tilt position.
429         /// </summary>
430         /// <remarks>
431         /// If min value is greater than the max value, it means this feature is not supported.
432         /// </remarks>
433         public Range TiltRange
434         {
435             get
436             {
437                 int min = 0;
438                 int max = 0;
439
440                 int ret = Interop.CameraSetting.GetTiltRange(_settingHandle, out min, out max);
441                 if ((CameraError)ret != CameraError.None)
442                 {
443                     Log.Error(CameraLog.Tag, "Failed to get tilt range, " + (CameraError)ret);
444                 }
445
446                 Range res = new Range(min, max);
447                 return res;
448             }
449         }
450
451         /// <summary>
452         /// The auto focus mode.
453         /// </summary>
454         /// <privilege>
455         /// http://tizen.org/privilege/camera
456         /// </privilege>
457         public CameraAutoFocusMode AfMode
458         {
459             get
460             {
461                 int val = 0;
462                 int ret = Interop.CameraSetting.GetAfMode(_settingHandle, out val);
463                 if ((CameraError)ret != CameraError.None)
464                 {
465                     Log.Error(CameraLog.Tag, "Failed to get camera autofocus mode, " + (CameraError)ret);
466                 }
467
468                 return (CameraAutoFocusMode)val;
469             }
470
471             set
472             {
473                 int ret = Interop.CameraSetting.SetAfMode(_settingHandle, (int)value);
474                 if ((CameraError)ret != CameraError.None)
475                 {
476                     Log.Error(CameraLog.Tag, "Failed to set camera autofocus mode, " + (CameraError)ret);
477                     CameraErrorFactory.ThrowException(ret, "Failed to set camera autofocus mode.");
478                 }
479             }
480         }
481
482         /// <summary>
483         /// The exposure mode.
484         /// </summary>
485         /// <privilege>
486         /// http://tizen.org/privilege/camera
487         /// </privilege>
488         public CameraExposureMode ExposureMode
489         {
490             get
491             {
492                 int val = 0;
493                 int ret = Interop.CameraSetting.GetExposureMode(_settingHandle, out val);
494                 if ((CameraError)ret != CameraError.None)
495                 {
496                     Log.Error(CameraLog.Tag, "Failed to get camera exposure mode, " + (CameraError)ret);
497                 }
498
499                 return (CameraExposureMode)val;
500             }
501
502             set
503             {
504                 int ret = Interop.CameraSetting.SetExposureMode(_settingHandle, (int)value);
505                 if ((CameraError)ret != CameraError.None)
506                 {
507                     Log.Error(CameraLog.Tag, "Failed to set camera exposure mode, " + (CameraError)ret);
508                     CameraErrorFactory.ThrowException(ret, "Failed to set camera exposure mode.");
509                 }
510             }
511         }
512
513         /// <summary>
514         /// The exposure value.
515         /// </summary>
516         /// <privilege>
517         /// http://tizen.org/privilege/camera
518         /// </privilege>
519         public int Exposure
520         {
521             get
522             {
523                 int val = 0;
524                 int ret = Interop.CameraSetting.GetExposure(_settingHandle, out val);
525                 if ((CameraError)ret != CameraError.None)
526                 {
527                     Log.Error(CameraLog.Tag, "Failed to get camera exposure value, " + (CameraError)ret);
528                 }
529
530                 return val;
531             }
532
533             set
534             {
535                 int ret = Interop.CameraSetting.SetExposure(_settingHandle, (int)value);
536                 if ((CameraError)ret != CameraError.None)
537                 {
538                     Log.Error(CameraLog.Tag, "Failed to set camera exposure value, " + (CameraError)ret);
539                     CameraErrorFactory.ThrowException(ret, "Failed to set camera exposure value.");
540                 }
541             }
542         }
543
544         /// <summary>
545         /// The ISO level.
546         /// </summary>
547         /// <privilege>
548         /// http://tizen.org/privilege/camera
549         /// </privilege>
550         public CameraIsoLevel IsoLevel
551         {
552             get
553             {
554                 int val = 0;
555                 int ret = Interop.CameraSetting.GetIso(_settingHandle, out val);
556                 if ((CameraError)ret != CameraError.None)
557                 {
558                     Log.Error(CameraLog.Tag, "Failed to get camera Iso level, " + (CameraError)ret);
559                 }
560
561                 return (CameraIsoLevel)val;
562             }
563
564             set
565             {
566                 int ret = Interop.CameraSetting.SetIso(_settingHandle, (int)value);
567                 if ((CameraError)ret != CameraError.None)
568                 {
569                     Log.Error(CameraLog.Tag, "Failed to set camera Iso level, " + (CameraError)ret);
570                     CameraErrorFactory.ThrowException(ret, "Failed to set camera Iso level.");
571                 }
572             }
573         }
574
575         /// <summary>
576         /// The theater mode.
577         /// </summary>
578         /// <privilege>
579         /// http://tizen.org/privilege/camera
580         /// </privilege>
581         /// <remarks>
582         /// If you want to display the preview image on the external display with the full screen mode,
583         /// use this property.
584         /// </remarks>
585         public CameraTheaterMode TheaterMode
586         {
587             get
588             {
589                 int val = 0;
590                 int ret = Interop.CameraSetting.GetTheaterMode(_settingHandle, out val);
591                 if ((CameraError)ret != CameraError.None)
592                 {
593                     Log.Error(CameraLog.Tag, "Failed to get camera theater mode, " + (CameraError)ret);
594                 }
595
596                 return (CameraTheaterMode)val;
597             }
598
599             set
600             {
601                 int ret = Interop.CameraSetting.SetTheaterMode(_settingHandle, (int)value);
602                 if ((CameraError)ret != CameraError.None)
603                 {
604                     Log.Error(CameraLog.Tag, "Failed to set camera theater mode, " + (CameraError)ret);
605                     CameraErrorFactory.ThrowException(ret, "Failed to set camera theater mode.");
606                 }
607             }
608         }
609
610         /// <summary>
611         /// The brightness level of the camera.
612         /// </summary>
613         /// <privilege>
614         /// http://tizen.org/privilege/camera
615         /// </privilege>
616         public int Brightness
617         {
618             get
619             {
620                 int val = 0;
621                 int ret = Interop.CameraSetting.GetBrightness(_settingHandle, out val);
622                 if ((CameraError)ret != CameraError.None)
623                 {
624                     Log.Error(CameraLog.Tag, "Failed to get camera brightness value, " + (CameraError)ret);
625                 }
626
627                 return val;
628             }
629
630             set
631             {
632                 int ret = Interop.CameraSetting.SetBrightness(_settingHandle, (int)value);
633                 if ((CameraError)ret != CameraError.None)
634                 {
635                     Log.Error(CameraLog.Tag, "Failed to set camera brightness value, " + (CameraError)ret);
636                     CameraErrorFactory.ThrowException(ret, "Failed to set camera brightness value.");
637                 }
638             }
639         }
640
641         /// <summary>
642         /// The contrast level of the camera.
643         /// </summary>
644         /// <privilege>
645         /// http://tizen.org/privilege/camera
646         /// </privilege>
647         public int Contrast
648         {
649             get
650             {
651                 int val = 0;
652                 int ret = Interop.CameraSetting.GetContrast(_settingHandle, out val);
653                 if ((CameraError)ret != CameraError.None)
654                 {
655                     Log.Error(CameraLog.Tag, "Failed to get camera contrast value, " + (CameraError)ret);
656                 }
657
658                 return val;
659             }
660
661             set
662             {
663                 int ret = Interop.CameraSetting.SetContrast(_settingHandle, (int)value);
664                 if ((CameraError)ret != CameraError.None)
665                 {
666                     Log.Error(CameraLog.Tag, "Failed to set camera contrast value, " + (CameraError)ret);
667                     CameraErrorFactory.ThrowException(ret, "Failed to set camera contrast value.");
668                 }
669             }
670         }
671
672         /// <summary>
673         /// The whitebalance mode.
674         /// </summary>
675         /// <privilege>
676         /// http://tizen.org/privilege/camera
677         /// </privilege>
678         public CameraWhitebalance Whitebalance
679         {
680             get
681             {
682                 int val = 0;
683                 int ret = Interop.CameraSetting.GetWhitebalance(_settingHandle, out val);
684                 if ((CameraError)ret != CameraError.None)
685                 {
686                     Log.Error(CameraLog.Tag, "Failed to get camera whitebalance, " + (CameraError)ret);
687                 }
688
689                 return (CameraWhitebalance)val;
690             }
691
692             set
693             {
694                 int ret = Interop.CameraSetting.SetWhitebalance(_settingHandle, (int)value);
695                 if ((CameraError)ret != CameraError.None)
696                 {
697                     Log.Error(CameraLog.Tag, "Failed to set camera whitebalance, " + (CameraError)ret);
698                     CameraErrorFactory.ThrowException(ret, "Failed to set camera whitebalance.");
699                 }
700             }
701         }
702
703         /// <summary>
704         /// The camera effect mode.
705         /// </summary>
706         /// <privilege>
707         /// http://tizen.org/privilege/camera
708         /// </privilege>
709         public CameraEffectMode Effect
710         {
711             get
712             {
713                 int val = 0;
714                 int ret = Interop.CameraSetting.GetEffect(_settingHandle, out val);
715                 if ((CameraError)ret != CameraError.None)
716                 {
717                     Log.Error(CameraLog.Tag, "Failed to get camera effect, " + (CameraError)ret);
718                 }
719
720                 return (CameraEffectMode)val;
721             }
722
723             set
724             {
725                 int ret = Interop.CameraSetting.SetEffect(_settingHandle, (int)value);
726                 if ((CameraError)ret != CameraError.None)
727                 {
728                     Log.Error(CameraLog.Tag, "Failed to set camera effect, " + (CameraError)ret);
729                     CameraErrorFactory.ThrowException(ret, "Failed to set camera effect.");
730                 }
731             }
732         }
733
734         /// <summary>
735         /// The scene mode.
736         /// </summary>
737         /// <privilege>
738         /// http://tizen.org/privilege/camera
739         /// </privilege>
740         public CameraSceneMode SceneMode
741         {
742             get
743             {
744                 int val = 0;
745                 int ret = Interop.CameraSetting.GetSceneMode(_settingHandle, out val);
746                 if ((CameraError)ret != CameraError.None)
747                 {
748                     Log.Error(CameraLog.Tag, "Failed to get camera scene mode, " + (CameraError)ret);
749                 }
750
751                 return (CameraSceneMode)val;
752             }
753
754             set
755             {
756                 int ret = Interop.CameraSetting.SetSceneMode(_settingHandle, (int)value);
757                 if ((CameraError)ret != CameraError.None)
758                 {
759                     Log.Error(CameraLog.Tag, "Failed to set camera scene mode, " + (CameraError)ret);
760                     CameraErrorFactory.ThrowException(ret, "Failed to set camera scene mode.");
761                 }
762             }
763         }
764
765         /// <summary>
766         /// The scene mode.
767         /// true if EXIF tags are enabled in JPEG file, otherwise false.
768         /// </summary>
769         public bool EnableTag
770         {
771             get
772             {
773                 bool val = false;
774                 int ret = Interop.CameraSetting.IsEnabledTag(_settingHandle, out val);
775                 if ((CameraError)ret != CameraError.None)
776                 {
777                     Log.Error(CameraLog.Tag, "Failed to get camera enable tag, " + (CameraError)ret);
778                 }
779
780                 return val;
781             }
782
783             set
784             {
785                 int ret = Interop.CameraSetting.EnableTag(_settingHandle, (bool)value);
786                 if ((CameraError)ret != CameraError.None)
787                 {
788                     Log.Error(CameraLog.Tag, "Failed to set camera enable tag, " + (CameraError)ret);
789                     CameraErrorFactory.ThrowException(ret, "Failed to set camera enable tag.");
790                 }
791             }
792         }
793
794         /// <summary>
795         /// The camera image description in the EXIF tag.
796         /// </summary>
797         public string ImageDescription
798         {
799             get
800             {
801                 IntPtr val;
802                 int ret = Interop.CameraSetting.GetImageDescription(_settingHandle, out val);
803                 if ((CameraError)ret != CameraError.None)
804                 {
805                     Log.Error(CameraLog.Tag, "Failed to get image description, " + (CameraError)ret);
806                 }
807
808                 string result = Marshal.PtrToStringAnsi(val);
809                 Interop.Libc.Free(val);
810                 return result;
811             }
812
813             set
814             {
815                 int ret = Interop.CameraSetting.SetImageDescription(_settingHandle, value);
816                 if ((CameraError)ret != CameraError.None)
817                 {
818                     Log.Error(CameraLog.Tag, "Failed to set image description, " + (CameraError)ret);
819                     CameraErrorFactory.ThrowException(ret, "Failed to set image description.");
820                 }
821             }
822         }
823
824         /// <summary>
825         /// The software information in the EXIF tag.
826         /// </summary>
827         public string TagSoftware
828         {
829             get
830             {
831                 IntPtr val;
832                 int ret = Interop.CameraSetting.GetTagSoftware(_settingHandle, out val);
833                 if ((CameraError)ret != CameraError.None)
834                 {
835                     Log.Error(CameraLog.Tag, "Failed to get tag software, " + (CameraError)ret);
836                 }
837
838                 string result = Marshal.PtrToStringAnsi(val);
839                 Interop.Libc.Free(val);
840                 return result;
841             }
842
843             set
844             {
845                 int ret = Interop.CameraSetting.SetTagSoftware(_settingHandle, value);
846                 if ((CameraError)ret != CameraError.None)
847                 {
848                     Log.Error(CameraLog.Tag, "Failed to set tag software, " + (CameraError)ret);
849                     CameraErrorFactory.ThrowException(ret, "Failed to set tag software.");
850                 }
851             }
852         }
853
854         /// <summary>
855         /// The geotag(GPS data) in the EXIF tag.
856         /// </summary>
857         public Location GeoTag
858         {
859             get
860             {
861                 double latitude = 0.0;
862                 double longitude = 0.0;
863                 double altitude = 0.0;
864
865                 int ret = Interop.CameraSetting.GetGeotag(_settingHandle, out latitude, out longitude, out altitude);
866                 if ((CameraError)ret != CameraError.None)
867                 {
868                     Log.Error(CameraLog.Tag, "Failed to get tag, " + (CameraError)ret);
869                 }
870
871                 Location loc = new Location(latitude, longitude, altitude);
872                 return loc;
873             }
874
875             set
876             {
877                 Location loc = value;
878                 int ret = Interop.CameraSetting.SetGeotag(_settingHandle, loc.Latitude, loc.Longitude, loc.Altitude);
879                 if ((CameraError)ret != CameraError.None)
880                 {
881                     Log.Error(CameraLog.Tag, "Failed to get contrast range, " + (CameraError)ret);
882                     CameraErrorFactory.ThrowException(ret, "Failed to set geo tag.");
883                 }
884             }
885         }
886
887         /// <summary>
888         /// The camera orientation in the tag.
889         /// </summary>
890         public CameraTagOrientation TagOrientation
891         {
892             get
893             {
894                 int val = 0;
895                 int ret = Interop.CameraSetting.GetTagOrientation(_settingHandle, out val);
896                 if ((CameraError)ret != CameraError.None)
897                 {
898                     Log.Error(CameraLog.Tag, "Failed to get camera tag orientation, " + (CameraError)ret);
899                 }
900
901                 return (CameraTagOrientation)val;
902             }
903
904             set
905             {
906                 int ret = Interop.CameraSetting.SetTagOrientation(_settingHandle, (int)value);
907                 if ((CameraError)ret != CameraError.None)
908                 {
909                     Log.Error(CameraLog.Tag, "Failed to set camera tag orientation, " + (CameraError)ret);
910                     CameraErrorFactory.ThrowException(ret, "Failed to set camera tag orientation.");
911                 }
912             }
913         }
914
915         /// <summary>
916         /// The camera's flash mode.
917         /// </summary>
918         /// <privilege>
919         /// http://tizen.org/privilege/camera
920         /// </privilege>
921         public CameraFlashMode FlashMode
922         {
923             get
924             {
925                 int val = 0;
926                 int ret = Interop.CameraSetting.GetFlashMode(_settingHandle, out val);
927                 if ((CameraError)ret != CameraError.None)
928                 {
929                     Log.Error(CameraLog.Tag, "Failed to get camera flash mode, " + (CameraError)ret);
930                 }
931
932                 return (CameraFlashMode)val;
933             }
934
935             set
936             {
937                 int ret = Interop.CameraSetting.SetFlashMode(_settingHandle, (int)value);
938                 if ((CameraError)ret != CameraError.None)
939                 {
940                     Log.Error(CameraLog.Tag, "Failed to set camera flash mode, " + (CameraError)ret);
941                     CameraErrorFactory.ThrowException(ret, "Failed to set camera flash mode.");
942                 }
943             }
944         }
945
946         /// <summary>
947         /// Gets the camera lens orientation angle.
948         /// </summary>
949         public int LensOrientation
950         {
951             get
952             {
953                 int val = 0;
954                 int ret = Interop.CameraSetting.GetLensOrientation(_settingHandle, out val);
955                 if ((CameraError)ret != CameraError.None)
956                 {
957                     Log.Error(CameraLog.Tag, "Failed to get camera lens orientation, " + (CameraError)ret);
958                 }
959
960                 return val;
961             }
962         }
963
964         /// <summary>
965         /// The stream rotation.
966         /// </summary>
967         public CameraRotation StreamRotation
968         {
969             get
970             {
971                 int val = 0;
972                 int ret = Interop.CameraSetting.GetStreamRotation(_settingHandle, out val);
973                 if ((CameraError)ret != CameraError.None)
974                 {
975                     Log.Error(CameraLog.Tag, "Failed to get camera stream rotation, " + (CameraError)ret);
976                 }
977
978                 return (CameraRotation)val;
979             }
980
981             set
982             {
983                 int ret = Interop.CameraSetting.SetStreamRotation(_settingHandle, (int)value);
984                 if ((CameraError)ret != CameraError.None)
985                 {
986                     Log.Error(CameraLog.Tag, "Failed to set camera stream rotation, " + (CameraError)ret);
987                     CameraErrorFactory.ThrowException(ret, "Failed to set camera stream rotation.");
988                 }
989             }
990         }
991
992         /// <summary>
993         /// The stream flip.
994         /// </summary>
995         public CameraFlip StreamFlip
996         {
997             get
998             {
999                 int val = 0;
1000                 int ret = Interop.CameraSetting.GetFlip(_settingHandle, out val);
1001                 if ((CameraError)ret != CameraError.None)
1002                 {
1003                     Log.Error(CameraLog.Tag, "Failed to get camera stream flip, " + (CameraError)ret);
1004                 }
1005
1006                 return (CameraFlip)val;
1007             }
1008
1009             set
1010             {
1011                 int ret = Interop.CameraSetting.SetFlip(_settingHandle, (int)value);
1012                 if ((CameraError)ret != CameraError.None)
1013                 {
1014                     Log.Error(CameraLog.Tag, "Failed to set camera stream flip, " + (CameraError)ret);
1015                     CameraErrorFactory.ThrowException(ret, "Failed to set camera flip.");
1016                 }
1017             }
1018         }
1019
1020         /// <summary>
1021         /// The mode of HDR(High dynamic range) capture.
1022         /// </summary>
1023         /// <privilege>
1024         /// http://tizen.org/privilege/camera
1025         /// </privilege>
1026         /// <remarks>
1027         /// Taking multiple pictures at different exposure levels and intelligently stitching them together
1028         /// so that we eventually arrive at a picture that is representative in both dark and bright areas.
1029         /// If this attribute is set, then eventhandler set for HdrCaptureProgress event is invoked.
1030         /// </remarks>
1031         public CameraHdrMode HdrMode
1032         {
1033             get
1034             {
1035                 int val = 0;
1036                 int ret = Interop.CameraSetting.GetHdrMode(_settingHandle, out val);
1037                 if ((CameraError)ret != CameraError.None)
1038                 {
1039                     Log.Error(CameraLog.Tag, "Failed to get camera hdr mode, " + (CameraError)ret);
1040                 }
1041
1042                 return (CameraHdrMode)val;
1043             }
1044
1045             set
1046             {
1047                 int ret = Interop.CameraSetting.SetHdrMode(_settingHandle, (int)value);
1048                 if ((CameraError)ret != CameraError.None)
1049                 {
1050                     Log.Error(CameraLog.Tag, "Failed to set camera hdr mode, " + (CameraError)ret);
1051                     CameraErrorFactory.ThrowException(ret, "Failed to set camera hdr mode.");
1052                 }
1053             }
1054         }
1055
1056         /// <summary>
1057         /// The anti shake feature.
1058         /// If true the antishake feature is enabled, otherwise false.
1059         /// </summary>
1060         public bool AntiShake
1061         {
1062             get
1063             {
1064                 bool val = false;
1065                 int ret = Interop.CameraSetting.IsEnabledAntiShake(_settingHandle, out val);
1066                 if ((CameraError)ret != CameraError.None)
1067                 {
1068                     Log.Error(CameraLog.Tag, "Failed to get camera anti shake value, " + (CameraError)ret);
1069                 }
1070
1071                 return val;
1072             }
1073
1074             set
1075             {
1076                 int ret = Interop.CameraSetting.EnableAntiShake(_settingHandle, (bool)value);
1077                 if ((CameraError)ret != CameraError.None)
1078                 {
1079                     Log.Error(CameraLog.Tag, "Failed to set camera anti shake value, " + (CameraError)ret);
1080                     CameraErrorFactory.ThrowException(ret, "Failed to set camera anti shake value.");
1081                 }
1082             }
1083         }
1084
1085         /// <summary>
1086         /// Enables/Disables the video stabilization feature.
1087         /// If true video stabilization is enabled, otherwise false.
1088         /// </summary>
1089         /// <privilege>
1090         /// http://tizen.org/privilege/camera
1091         /// </privilege>
1092         /// <remarks>
1093         /// If video stabilization is enabled, zero shutter lag is disabled.
1094         /// This feature is used to record a video.
1095         /// </remarks>
1096         public bool VideoStabilization
1097         {
1098             get
1099             {
1100                 bool val = false;
1101                 int ret = Interop.CameraSetting.IsEnabledVideoStabilization(_settingHandle, out val);
1102                 if ((CameraError)ret != CameraError.None)
1103                 {
1104                     Log.Error(CameraLog.Tag, "Failed to get camera video stabilization, " + (CameraError)ret);
1105                 }
1106
1107                 return val;
1108             }
1109
1110             set
1111             {
1112                 int ret = Interop.CameraSetting.EnableVideoStabilization(_settingHandle, (bool)value);
1113                 if ((CameraError)ret != CameraError.None)
1114                 {
1115                     Log.Error(CameraLog.Tag, "Failed to set camera video stabilization, " + (CameraError)ret);
1116                     CameraErrorFactory.ThrowException(ret, "Failed to set camera video stabilization.");
1117                 }
1118             }
1119         }
1120
1121         /// <summary>
1122         /// The auto contrast.
1123         /// If true auto contrast is enabled, otherwise false.
1124         /// </summary>
1125         /// <privilege>
1126         /// http://tizen.org/privilege/camera
1127         /// </privilege>
1128         public bool AutoContrast
1129         {
1130             get
1131             {
1132                 bool val = false;
1133                 int ret = Interop.CameraSetting.IsEnabledAutoContrast(_settingHandle, out val);
1134                 if ((CameraError)ret != CameraError.None)
1135                 {
1136                     Log.Error(CameraLog.Tag, "Failed to get camera auto contrast, " + (CameraError)ret);
1137                 }
1138
1139                 return val;
1140             }
1141
1142             set
1143             {
1144                 int ret = Interop.CameraSetting.EnableAutoContrast(_settingHandle, (bool)value);
1145                 if ((CameraError)ret != CameraError.None)
1146                 {
1147                     Log.Error(CameraLog.Tag, "Failed to set camera enable auto contrast, " + (CameraError)ret);
1148                     CameraErrorFactory.ThrowException(ret, "Failed to set camera enable auto contrast.");
1149                 }
1150             }
1151         }
1152
1153         /// <summary>
1154         /// Disables shutter sound.
1155         /// If true shutter sound is disabled, otherwise false.
1156         /// </summary>
1157         /// <remarks>
1158         /// In some countries, this operation is not permitted.
1159         /// </remarks>
1160         public bool DisableShutterSound
1161         {
1162             set
1163             {
1164                 int ret = Interop.CameraSetting.DisableShutterSound(_settingHandle, (bool)value);
1165                 if ((CameraError)ret != CameraError.None)
1166                 {
1167                     Log.Error(CameraLog.Tag, "Failed to disable shutter sound, " + (CameraError)ret);
1168                     CameraErrorFactory.ThrowException(ret, "Failed to set disable shutter sound.");
1169                 }
1170             }
1171         }
1172
1173         /// <summary>
1174         /// Sets the type of PTZ(Pan Tilt Zoom).
1175         /// </summary>
1176         public CameraPtzType PtzType
1177         {
1178             set
1179             {
1180                 int ret = Interop.CameraSetting.SetPtzType(_settingHandle, (int)value);
1181                 if ((CameraError)ret != CameraError.None)
1182                 {
1183                     Log.Error(CameraLog.Tag, "Failed to set camera ptz type, " + (CameraError)ret);
1184                     CameraErrorFactory.ThrowException(ret, "Failed to set camera ptz type.");
1185                 }
1186             }
1187         }
1188
1189         /// <summary>
1190         /// the ROI(Region Of Interest) area of display.
1191         /// </summary>
1192         public Area DisplayRoiArea
1193         {
1194             get
1195             {
1196                 int x = 0;
1197                 int y = 0;
1198                 int width = 0;
1199                 int height = 0;
1200
1201                 int ret = Interop.CameraSetting.GetDisplayRoiArea(_settingHandle, out x, out y, out width, out height);
1202                 if ((CameraError)ret != CameraError.None)
1203                 {
1204                     Log.Error(CameraLog.Tag, "Failed to get display roi area, " + (CameraError)ret);
1205                 }
1206
1207                 Area ar = new Area(x, y, width, height);
1208                 return ar;
1209             }
1210
1211             set
1212             {
1213                 Area ar = (Area)value;
1214                 int ret = Interop.CameraSetting.SetDisplayRoiArea(_settingHandle, ar.X, ar.Y, ar.Width, ar.Height);
1215                 if ((CameraError)ret != CameraError.None)
1216                 {
1217                     Log.Error(CameraLog.Tag, "Failed to set display roi area, " + (CameraError)ret);
1218                     CameraErrorFactory.ThrowException(ret, "Failed to set display roi area.");
1219                 }
1220             }
1221         }
1222     }
1223 }
1224