qrencode  4.1.1
About: libqrencode is a fast and compact library and command-line utility for encoding data in a QR Code symbol.
  Fossies Dox: qrencode-4.1.1.tar.bz2  ("unofficial" and yet experimental doxygen-generated source code documentation)  

mqrspec.h
Go to the documentation of this file.
1/*
2 * qrencode - QR Code encoder
3 *
4 * Micro QR Code specification in convenient format.
5 * Copyright (C) 2006-2017 Kentaro Fukuchi <kentaro@fukuchi.org>
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef MQRSPEC_H
23#define MQRSPEC_H
24
25#include "qrencode.h"
26
27/******************************************************************************
28 * Version and capacity
29 *****************************************************************************/
30
31/**
32 * Maximum width of a symbol
33 */
34#define MQRSPEC_WIDTH_MAX 17
35
36/**
37 * Return maximum data code length (bits) for the version.
38 * @param version version of the symbol
39 * @param level error correction level
40 * @return maximum size (bits)
41 */
43
44/**
45 * Return maximum data code length (bytes) for the version.
46 * @param version version of the symbol
47 * @param level error correction level
48 * @return maximum size (bytes)
49 */
51
52/**
53 * Return maximum error correction code length (bytes) for the version.
54 * @param version version of the symbol
55 * @param level error correction level
56 * @return ECC size (bytes)
57 */
59
60/**
61 * Return a version number that satisfies the input code length.
62 * @param size input code length (byte)
63 * @param level error correction level
64 * @return version number
65 */
67
68/**
69 * Return the width of the symbol for the version.
70 * @param version version of the symbol
71 * @return width
72 */
73extern int MQRspec_getWidth(int version);
74
75/**
76 * Return the numer of remainder bits.
77 * @param version version of the symbol
78 * @return number of remainder bits
79 */
81
82/******************************************************************************
83 * Length indicator
84 *****************************************************************************/
85
86/**
87 * Return the size of length indicator for the mode and version.
88 * @param mode encode mode
89 * @param version vesion of the symbol
90 * @return the size of the appropriate length indicator (bits).
91 */
92extern int MQRspec_lengthIndicator(QRencodeMode mode, int version);
93
94/**
95 * Return the maximum length for the mode and version.
96 * @param mode encode mode
97 * @param version vesion of the symbol
98 * @return the maximum length (bytes)
99 */
100extern int MQRspec_maximumWords(QRencodeMode mode, int version);
101
102/******************************************************************************
103 * Version information pattern
104 *****************************************************************************/
105
106/**
107 * Return BCH encoded version information pattern that is used for the symbol
108 * of version 7 or greater. Use lower 18 bits.
109 * @param version vesion of the symbol
110 * @return BCH encoded version information pattern
111 */
112extern unsigned int MQRspec_getVersionPattern(int version);
113
114/******************************************************************************
115 * Format information
116 *****************************************************************************/
117
118/**
119 * Return BCH encoded format information pattern.
120 * @param mask mask number
121 * @param version version of the symbol
122 * @param level error correction level
123 * @return BCH encoded format information pattern
124 */
125extern unsigned int MQRspec_getFormatInfo(int mask, int version, QRecLevel level);
126
127/******************************************************************************
128 * Frame
129 *****************************************************************************/
130
131/**
132 * Return a copy of initialized frame.
133 * @param version version of the symbol
134 * @return Array of unsigned char. You can free it by free().
135 */
136extern unsigned char *MQRspec_newFrame(int version);
137
138/******************************************************************************
139 * Mode indicator
140 *****************************************************************************/
141
142/**
143 * Mode indicator. See Table 2 in Appendix 1 of JIS X0510:2004, pp.107.
144 */
145#define MQRSPEC_MODEID_NUM 0
146#define MQRSPEC_MODEID_AN 1
147#define MQRSPEC_MODEID_8 2
148#define MQRSPEC_MODEID_KANJI 3
149
150#endif /* MQRSPEC_H */
int MQRspec_getMinimumVersion(int size, QRecLevel level)
Return a version number that satisfies the input code length.
int MQRspec_getECCLength(int version, QRecLevel level)
Return maximum error correction code length (bytes) for the version.
Definition: mqrspec.c:75
int MQRspec_maximumWords(QRencodeMode mode, int version)
Return the maximum length for the mode and version.
Definition: mqrspec.c:104
int MQRspec_lengthIndicator(QRencodeMode mode, int version)
Length indicator.
Definition: mqrspec.c:99
unsigned int MQRspec_getFormatInfo(int mask, int version, QRecLevel level)
Format information.
Definition: mqrspec.c:139
unsigned char * MQRspec_newFrame(int version)
Frame.
Definition: mqrspec.c:227
int MQRspec_getWidth(int version)
Return the width of the symbol for the version.
Definition: mqrspec.c:80
int MQRspec_getDataLengthBit(int version, QRecLevel level)
Return maximum data code length (bits) for the version.
Definition: mqrspec.c:59
int MQRspec_getRemainder(int version)
Return the numer of remainder bits.
unsigned int MQRspec_getVersionPattern(int version)
Version information pattern.
int MQRspec_getDataLength(int version, QRecLevel level)
Return maximum data code length (bytes) for the version.
Definition: mqrspec.c:70
static int size
Definition: qrenc.c:41
static QRecLevel level
Definition: qrenc.c:50
static int version
Definition: qrenc.c:40
QRecLevel
Level of error correction.
Definition: qrencode.h:124
QRencodeMode
Encoding mode.
Definition: qrencode.h:109