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.
19 namespace Tizen.Multimedia.Vision
22 /// Represents a QR configuration of <see cref="BarcodeGenerator"/>.
24 /// <since_tizen> 4 </since_tizen>
25 public class QrConfiguration
27 private string _embedImagePath;
28 private QrShape _dataShape = QrShape.Rectangular;
29 private QrShape _finderShape = QrShape.Rectangular;
32 /// Initializes a new instance of the <see cref="QrConfiguration"/> class.
34 /// <param name="qrMode">Encoding mode for the message.</param>
35 /// <param name="ecc">Error correction level.</param>
36 /// <param name="version">QR code version. From 1 to 40 inclusive.</param>
37 /// <exception cref="ArgumentOutOfRangeException">
38 /// <paramref name="version"/> is less than 1.<br/>
40 /// <paramref name="version"/> is greater than 40.
42 /// <exception cref="ArgumentException">
43 /// <paramref name="qrMode"/> is invalid.<br/>
45 /// <paramref name="ecc"/> is invalid.
49 /// var qrConfig = new QrConfiguration(QrMode.Numeric, ErrorCorrectionLevel.Medium, 30);
52 /// <since_tizen> 4 </since_tizen>
53 public QrConfiguration(QrMode qrMode, ErrorCorrectionLevel ecc, int version)
55 if (version < 1 || version > 40)
57 throw new ArgumentOutOfRangeException(nameof(version), version,
58 "Valid version range is 1 to 40 inclusive.");
60 ValidationUtil.ValidateEnum(typeof(QrMode), qrMode, nameof(qrMode));
61 ValidationUtil.ValidateEnum(typeof(ErrorCorrectionLevel), ecc, nameof(ecc));
64 ErrorCorrectionLevel = ecc;
69 /// Gets the encoding mode for the message.
71 /// <since_tizen> 4 </since_tizen>
72 public QrMode Mode { get; }
75 /// Gets the error correction level.
77 /// <since_tizen> 4 </since_tizen>
78 public ErrorCorrectionLevel ErrorCorrectionLevel { get; }
81 /// Gets the QR code version.
83 /// <since_tizen> 4 </since_tizen>
84 public int Version { get; }
87 /// Gets or sets the embed image absolute path of the Design QR code.
90 /// The mediastorage privilege (http://tizen.org/privilege/mediastorage) is needed if the image path is relevant to media storage.<br/>
91 /// The externalstorage privilege (http://tizen.org/privilege/externalstorage) is needed if the image path is relevant to external storage.
93 /// <exception cref="ArgumentNullException"><paramref name="value"/> is null.</exception>
94 /// <exception cref="ArgumentException"><paramref name="value"/> is zero-length string.</exception>
95 /// <since_tizen> 11 </since_tizen>
96 public string EmbedImagePath
100 return _embedImagePath;
104 ValidationUtil.ValidateIsNullOrEmpty(value, nameof(value));
106 _embedImagePath = value;
111 /// Gets or sets the data shape of the Design QR code.
113 /// <remarks>The default value is <see cref="QrShape.Rectangular"/>.</remarks>
114 /// <exception cref="ArgumentException"><paramref name="value"/> is not valid.</exception>
115 /// <since_tizen> 11 </since_tizen>
116 public QrShape DataShape
124 ValidationUtil.ValidateEnum(typeof(QrShape), value, nameof(value));
131 /// Gets or sets the finder shape of the Design QR code.
133 /// <remarks>The default value is <see cref="QrShape.Rectangular"/>.</remarks>
134 /// <exception cref="ArgumentException"><paramref name="value"/> is not valid.</exception>
135 /// <since_tizen> 11 </since_tizen>
136 public QrShape FinderShape
144 ValidationUtil.ValidateEnum(typeof(QrShape), value, nameof(value));
146 _finderShape = value;