Add E_UNSUPPORTED_OPERATION to Uix:Vision namespace
[platform/framework/native/vision.git] / inc / FUixVisionQrCodeGenerator.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18
19 /**
20  * @file     FUixVisionQrCodeGenerator.h
21  * @brief    This is the header file for the %Tizen::Uix::Vision::QrCodeGenerator class.
22  */
23
24 #ifndef _FUIX_VISION_QR_CODE_GENERATOR_H_
25 #define _FUIX_VISION_QR_CODE_GENERATOR_H_
26 #include <FBaseObject.h>
27 #include <FGrpBitmap.h>
28 #include <FBase.h>
29 #include <FMedia.h>
30 #include "FUixVisionQrCodeTypes.h"
31
32
33 namespace Tizen { namespace Uix { namespace Vision
34 {
35
36 /**
37  * @class    QrCodeGenerator
38  * @brief    This class provides methods to generate QR code image.
39  *
40  * @since    2.1
41  * The following example demonstrates how to use the %QrCodeGenerator class.
42  *
43  * @code
44  * Tizen::Uix::Vision::QrCodeGenerator qrGen;
45  * qrGen.Construct();
46  *
47  * qrGen.EncodeToFile("test message", Tizen::Uix::Vision::QR_MODE_UTF8, Tizen::Uix::Vision::QR_ECL_Q, "/mnt/ums/Others/temp.bmp", Tizen::Media::IMG_FORMAT_PNG);
48  * @endcode
49  */
50 class _OSP_EXPORT_ QrCodeGenerator
51     : public Tizen::Base::Object
52 {
53 public:
54
55     /**
56      * This is the default constructor for this class.
57      * The object is not fully constructed after this constructor is called.
58      * For full construction, the Construct() method must be called right after calling this constructor.
59      *
60      * @since    2.1
61      */
62     QrCodeGenerator(void);
63
64     /**
65      * This is the destructor for this class. @n
66      * The resources are deallocated by this method.
67      * This destructor overrides Tizen::Base::Object::~Object().
68      *
69      * @since    2.1
70      */
71     ~QrCodeGenerator(void);
72
73     /**
74      * Initializes this instance of QRCodeGenerator.
75      * Every application must call Construct() before calling any other method of QRCodeGenerator.
76      *
77      * @since        2.1
78      *
79      * @feature      %http://tizen.org/feature/vision.qrcode_generation
80      *
81      * @exception    E_SUCCESS          The method is successful.
82      * @exception    E_UNSUPPORTED_OPERATION   The Emulator or target device does not support the required feature. 
83      * For more information, see <a href="../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm">Application Filtering</a>.
84      * @remarks      Before calling this method, check whether the feature is supported by %Tizen::System::SystemInfo::GetValue() methods.
85      * @see
86      */
87     result Construct(void);
88
89     /**
90      * Returns list of supported image file formats .
91      *
92      * @return       list of supported image file formats
93      * @since        2.1
94      *
95      * @remarks
96      * @see
97      */
98     static Tizen::Base::Collection::IListT<Tizen::Media::ImageFormat>* GetSupportedImageFileFormatsListN(void);
99
100     /**
101      * Generates QR code into file
102      *
103      * @since        2.1
104      *
105      * @return       An error code.
106      * @param[in]    message                Text to be encoded to QR code image
107      * @param[in]    mode                   Input text encoding format (QR_CODE_MODE_ALPHANUMERIC, QR_CODE_MODE_BYTE, QR_CODE_MODE_UTF8)
108      * @param[in]    errorCorrectionLevel   QR code error correction level
109      * @param[in]    compatibility          Compatibility mode with zxing library for UTF-8 codes mode when mode is selected with QR_MODE_UTF8
110      * @param[in]    imageFilePath          File path of the generated QR code image
111      * @param[in]    imageFormat            Image file format of the generated QR code image
112      * @param[out]   width                  Width of the generated QR code image
113      * @param[out]   height                 Height of the generated QR code image
114      * @exception    E_SUCCESS              The method is successful.
115      * @exception    E_INVALID_ARG          A specified input parameter is invalid.
116      * @exception    E_FILE_NOT_FOUND       The specified file cannot be found or accessed.
117      *
118      * @remarks      QR code encoding for UTF-8 is not standardized yet.
119      *               So we support UTF-8 encoding/decoding compatibility to zxing(http://http://code.google.com/p/zxing/) library.
120      * @see
121      */
122     result EncodeToFile(const Tizen::Base::String& message, QrCodeMode mode, QrCodeErrorCorrectionLevel errorCorrectionLevel, bool compatibility, const Tizen::Base::String& imageFilePath, Tizen::Media::ImageFormat imageFormat, int& width, int& height);
123
124     /**
125      * Generates QR code into a byte buffer
126      *
127      * @since        2.1
128      *
129      * @return       A pointer to the ByteBuffer instance containing the generated QR code image
130      * @param[in]    message                  Text to be encoded to QR code image
131      * @param[in]    mode                     Input text encoding format (QR_MODE_ALPHANUMERIC, QR_MODE_BYTE, QR_MODE_UTF8)
132      * @param[in]    errorCorrectionLevel     QR code error correction level
133      * @param[in]    compatibility            Compatibility mode with zxing library for UTF-8 codes mode when mode is selected with QR_MODE_UTF8
134      * @param[out]   width                    Width of the generated QR code image
135      * @param[out]   height                   Height of the generated QR code image
136      * @exception    E_SUCCESS                The method is successful.
137      * @exception    E_INVALID_ARG            A specified input parameter is invalid.
138      *
139      * @remarks      QR code encoding for UTF-8 is not standardized yet.
140      *               So we support UTF-8 encoding/decoding compatibility to zxing(http://http://code.google.com/p/zxing/) library.
141      * @see
142      */
143     Tizen::Base::ByteBuffer* EncodeToBufferN(const Tizen::Base::String& message, QrCodeMode mode, QrCodeErrorCorrectionLevel error_level, bool compatibility, int& width, int& height);
144
145
146 private:
147     /**
148      * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
149      */
150     QrCodeGenerator(const QrCodeGenerator& in);
151
152     /**
153      * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
154      */
155     QrCodeGenerator& operator=(const QrCodeGenerator& in);
156
157 private:
158     class _QrCodeGeneratorImpl* __pQrCodeGeneratorImpl;
159     friend class _QrCodeGeneratorImpl;
160 };
161
162 } } } //Tizen::Uix::Vision
163
164 #endif // _FUIX_VISION_QR_CODE_GENERATOR_H_