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.
18 using System.ComponentModel;
20 namespace Tizen.Multimedia.Vision
23 /// Represents a QR configuration of <see cref="BarcodeGenerator"/>.
25 /// <since_tizen> 4 </since_tizen>
26 public class QrConfiguration
28 private string _embedImagePath;
29 private QrShape _dataShape = QrShape.Rectangular;
30 private QrShape _finderShape = QrShape.Rectangular;
33 /// Initializes a new instance of the <see cref="QrConfiguration"/> class.
35 /// <param name="qrMode">Encoding mode for the message.</param>
36 /// <param name="ecc">Error correction level.</param>
37 /// <param name="version">QR code version. From 1 to 40 inclusive.</param>
38 /// <exception cref="ArgumentOutOfRangeException">
39 /// <paramref name="version"/> is less than 1.<br/>
41 /// <paramref name="version"/> is greater than 40.
43 /// <exception cref="ArgumentException">
44 /// <paramref name="qrMode"/> is invalid.<br/>
46 /// <paramref name="ecc"/> is invalid.
50 /// var qrConfig = new QrConfiguration(QrMode.Numeric, ErrorCorrectionLevel.Medium, 30);
53 /// <since_tizen> 4 </since_tizen>
54 public QrConfiguration(QrMode qrMode, ErrorCorrectionLevel ecc, int version)
56 if (version < 1 || version > 40)
58 throw new ArgumentOutOfRangeException(nameof(version), version,
59 "Valid version range is 1 to 40 inclusive.");
61 ValidationUtil.ValidateEnum(typeof(QrMode), qrMode, nameof(qrMode));
62 ValidationUtil.ValidateEnum(typeof(ErrorCorrectionLevel), ecc, nameof(ecc));
65 ErrorCorrectionLevel = ecc;
70 /// Gets the encoding mode for the message.
72 /// <since_tizen> 4 </since_tizen>
73 public QrMode Mode { get; }
76 /// Gets the error correction level.
78 /// <since_tizen> 4 </since_tizen>
79 public ErrorCorrectionLevel ErrorCorrectionLevel { get; }
82 /// Gets the QR code version.
84 /// <since_tizen> 4 </since_tizen>
85 public int Version { get; }
88 /// Gets or sets the embed image absolute path of the Design QR code.
91 /// The mediastorage privilege (http://tizen.org/privilege/mediastorage) is needed if the image path is relevant to media storage.<br/>
92 /// The externalstorage privilege (http://tizen.org/privilege/externalstorage) is needed if the image path is relevant to external storage.
94 /// <exception cref="ArgumentNullException"><paramref name="value"/> is null.</exception>
95 /// <exception cref="ArgumentException"><paramref name="value"/> is zero-length string.</exception>
96 [EditorBrowsable(EditorBrowsableState.Never)]
97 public string EmbedImagePath
101 return _embedImagePath;
105 ValidationUtil.ValidateIsNullOrEmpty(value, nameof(value));
107 _embedImagePath = value;
112 /// Gets or sets the data shape of the Design QR code.
114 /// <remarks>The default value is <see cref="QrShape.Rectangular"/>.</remarks>
115 /// <exception cref="ArgumentException"><paramref name="value"/> is not valid.</exception>
116 [EditorBrowsable(EditorBrowsableState.Never)]
117 public QrShape DataShape
125 ValidationUtil.ValidateEnum(typeof(QrShape), value, nameof(value));
132 /// Gets or sets the finder shape of the Design QR code.
134 /// <remarks>The default value is <see cref="QrShape.Rectangular"/>.</remarks>
135 /// <exception cref="ArgumentException"><paramref name="value"/> is not valid.</exception>
136 [EditorBrowsable(EditorBrowsableState.Never)]
137 public QrShape FinderShape
145 ValidationUtil.ValidateEnum(typeof(QrShape), value, nameof(value));
147 _finderShape = value;