Release 4.0.0-preview1-00051
[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
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         /// <code>
34         /// var obj = new QrConfiguration(QrMode.Numeric, ErrorCorrectionLevel.Medium, 30);
35         /// </code>
36         /// <exception cref="ArgumentOutOfRangeException">
37         ///     <paramref name="version"/> is less than 1.\n
38         ///     -or-\n
39         ///     <paramref name="version"/> is greater than 40.
40         /// </exception>
41         /// <exception cref="ArgumentException">
42         ///     <paramref name="qrMode"/> is invalid.\n
43         ///     -or-
44         ///     <paramref name="ecc"/> is invalid.
45         /// </exception>
46         /// <since_tizen> 3</since_tizen>
47         public QrConfiguration(QrMode qrMode, ErrorCorrectionLevel ecc, int version)
48         {
49             if (version < 1 || version > 40)
50             {
51                 throw new ArgumentOutOfRangeException(nameof(version), version,
52                     "Valid version range is 1 to 40 inclusive.");
53             }
54             ValidationUtil.ValidateEnum(typeof(QrMode), qrMode, nameof(qrMode));
55             ValidationUtil.ValidateEnum(typeof(ErrorCorrectionLevel), ecc, nameof(ecc));
56
57             Mode = qrMode;
58             ErrorCorrectionLevel = ecc;
59             Version = version;
60         }
61
62         /// <summary>
63         /// Gets the encoding mode for the message.
64         /// </summary>
65         /// <since_tizen> 3</since_tizen>
66         public QrMode Mode { get; }
67
68         /// <summary>
69         /// Gets the error correction level.
70         /// </summary>
71         /// <since_tizen> 3</since_tizen>
72         public ErrorCorrectionLevel ErrorCorrectionLevel { get; }
73
74         /// <summary>
75         /// Gets the QR code version.
76         /// </summary>
77         /// <since_tizen> 3</since_tizen>
78         public int Version { get; }
79     }
80 }