Release 4.0.0-preview1-00051
[platform/core/csapi/tizenfx.git] / src / Tizen.Multimedia.Vision / MediaVision / MovementDetectionConfiguration.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
19 namespace Tizen.Multimedia
20 {
21     /// <summary>
22     /// Represents a configuration of <see cref="MovementDetector"/>.
23     /// </summary>
24     /// <since_tizen> 3</since_tizen>
25     public class MovementDetectionConfiguration : SurveillanceEngineConfiguration
26     {
27         private const string KeyThreshold = "MV_SURVEILLANCE_MOVEMENT_DETECTION_THRESHOLD";
28
29         /// <summary>
30         /// A read-only field that represents the default value of <see cref="Threshold"/>.
31         /// </summary>
32         /// <since_tizen> 3</since_tizen>
33         public static readonly int DefaultThreshold = 10;
34
35
36         /// <summary>
37         /// Initializes a new instance of the <see cref="MovementDetectionConfiguration"/> class.
38         /// </summary>
39         /// <exception cref="NotSupportedException">The feature is not supported.</exception>
40         /// <since_tizen> 3</since_tizen>
41         public MovementDetectionConfiguration()
42         {
43         }
44
45         /// <summary>
46         /// Gets or sets movement detection threshold.\n
47         /// This value might be set before subscription on <see cref="MovementDetector.Detected"/> event
48         /// to specify the sensitivity of the movement detector.
49         /// </summary>
50         /// <value>
51         /// The value indicating the sensitivity of the <see cref="MovementDetector"/> from 0 to 255 inclusive
52         /// where 255 means that no movements will be detected and 0 means that all frame changes
53         /// will be interpreted as movements.\n
54         /// The default is 10.
55         /// </value>
56         /// <exception cref="ObjectDisposedException">The <see cref="MovementDetectionConfiguration"/> already has been disposed of.</exception>
57         /// <exception cref="ArgumentOutOfRangeException">
58         ///     <paramref name="value"/> is less than zero.\n
59         ///     -or-\n
60         ///     <paramref name="value"/> is greater than 255.
61         /// </exception>
62         /// <since_tizen> 3</since_tizen>
63         public int Threshold
64         {
65             get
66             {
67                 return GetInt(KeyThreshold);
68             }
69             set
70             {
71                 if (value < 0 || value > 255)
72                 {
73                     throw new ArgumentOutOfRangeException(nameof(Threshold), value,
74                         $"Valid {nameof(Threshold)} range is 0 to 255 inclusive");
75                 }
76
77                 Set(KeyThreshold, value);
78             }
79         }
80     }
81 }