Merge "[Multimedia] Fixed errors in ImageUtil"
[platform/core/csapi/tizenfx.git] / src / Tizen.Multimedia.Vision / MediaVision / QrConfiguration.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.Vision
20 {
21     /// <summary>
22     /// Represents a QR configuration of <see cref="BarcodeGenerator"/>.
23     /// </summary>
24     /// <since_tizen> 3 </since_tizen>
25     public class QrConfiguration
26     {
27         /// <summary>
28         /// Initializes a new instance of the <see cref="QrConfiguration"/> class.
29         /// </summary>
30         /// <param name="qrMode">Encoding mode for the message.</param>
31         /// <param name="ecc">Error correction level.</param>
32         /// <param name="version">QR code version. From 1 to 40 inclusive.</param>
33         /// <exception cref="ArgumentOutOfRangeException">
34         ///     <paramref name="version"/> is less than 1.<br/>
35         ///     -or-<br/>
36         ///     <paramref name="version"/> is greater than 40.
37         /// </exception>
38         /// <exception cref="ArgumentException">
39         ///     <paramref name="qrMode"/> is invalid.<br/>
40         ///     -or-<br/>
41         ///     <paramref name="ecc"/> is invalid.
42         /// </exception>
43         /// <example>
44         /// <code>
45         /// var qrConfig = new QrConfiguration(QrMode.Numeric, ErrorCorrectionLevel.Medium, 30);
46         /// </code>
47         /// </example>
48         /// <since_tizen> 3 </since_tizen>
49         public QrConfiguration(QrMode qrMode, ErrorCorrectionLevel ecc, int version)
50         {
51             if (version < 1 || version > 40)
52             {
53                 throw new ArgumentOutOfRangeException(nameof(version), version,
54                     "Valid version range is 1 to 40 inclusive.");
55             }
56             ValidationUtil.ValidateEnum(typeof(QrMode), qrMode, nameof(qrMode));
57             ValidationUtil.ValidateEnum(typeof(ErrorCorrectionLevel), ecc, nameof(ecc));
58
59             Mode = qrMode;
60             ErrorCorrectionLevel = ecc;
61             Version = version;
62         }
63
64         /// <summary>
65         /// Gets the encoding mode for the message.
66         /// </summary>
67         /// <since_tizen> 3 </since_tizen>
68         public QrMode Mode { get; }
69
70         /// <summary>
71         /// Gets the error correction level.
72         /// </summary>
73         /// <since_tizen> 3 </since_tizen>
74         public ErrorCorrectionLevel ErrorCorrectionLevel { get; }
75
76         /// <summary>
77         /// Gets the QR code version.
78         /// </summary>
79         /// <since_tizen> 3 </since_tizen>
80         public int Version { get; }
81     }
82 }