2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.1 (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
9 // http://floralicense.org/license/
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.
18 #ifndef QRCODEGENERATOR_H
19 #define QRCODEGENERATOR_H
21 #include "QRCodeTypes.h"
25 enum QRCodeSaveFormats
27 QR_SAVE_FORMAT_BMP = 1,
28 QR_SAVE_FORMAT_PNG = 2,
29 QR_SAVE_FORMAT_JPG = 3,
32 /// \brief Class that provides utilities for QR codes generation
39 /// \brief Generates QR code
40 /// \param[in] message - text to be encoded
41 /// \param[in] mode - QR code mode
42 /// \param[in] error_level - error correction level
43 /// \param[in] compatibility - compatibility mode with zxing library for UTF codes
44 /// \returns OK on success
45 bool encode(const char* message, QRCodeMode mode, QRCodeErrorCorrectionLevel error_level, bool compatibility = true);
46 /// \brief Determines the generated QR code image size
47 /// \param[out] width - image width
48 /// \param[out] height - image height
49 /// \returns OK on success
50 bool getSize(unsigned int& width, unsigned int& height);
51 /// \brief Writes generated QR code to file
52 /// \param[in] imagepath - path to file to be used
53 /// \returns OK on success
54 bool saveToFile(const char* imagepath, QRCodeSaveFormats imageFormat);
55 /// \brief Copies generated QR code image into given buffer. Buffer size should be no less than returned by size() method
57 /// \returns OK on success
58 bool saveToBuffer(unsigned char* image);
60 QRCodeGenerator(const QRCodeGenerator& in);
61 QRCodeGenerator& operator=(const QRCodeGenerator& in);
62 class QRCodeGeneratorImpl;
63 QRCodeGeneratorImpl* mImpl;
68 #endif // QRCODEGENERATOR_H