DMCP interface 03.17_023
Loading...
Searching...
No Matches
qrcode_ifc.h
1
36#ifndef __QRCODE_H_
37#define __QRCODE_H_
38
39#ifndef __cplusplus
40typedef unsigned char bool;
41static const bool false = 0;
42static const bool true = 1;
43#endif
44
45#include <stdint.h>
46
47// If set to non-zero, this library can ONLY produce QR codes at that version
48// This saves a lot of dynamic memory, as the codeword tables are skipped
49#ifndef LOCK_VERSION
50#define LOCK_VERSION 0
51#endif
52
59// QR Code Format Encoding
60#define MODE_NUMERIC 0
61#define MODE_ALPHANUMERIC 1
62#define MODE_BYTE 2
65// Error Correction Code Levels
66#define ECC_LOW 0
67#define ECC_MEDIUM 1
68#define ECC_QUARTILE 2
69#define ECC_HIGH 3
76typedef struct QRCode {
77 uint8_t version;
78 uint8_t size;
79 uint8_t ecc;
80 uint8_t mode;
81 uint8_t mask;
82 uint8_t *modules;
84
85
86#ifdef __cplusplus
87extern "C"{
88#endif /* __cplusplus */
89
90
95uint16_t qrcode_getBufferSize(uint8_t version);
96
105int8_t qrcode_initText(QRCode *qrcode, uint8_t *modules, uint8_t version, uint8_t ecc, const char *data);
106
116int8_t qrcode_initBytes(QRCode *qrcode, uint8_t *modules, uint8_t version, uint8_t ecc, uint8_t *data, uint16_t length);
117
124bool qrcode_getModule(QRCode *qrcode, uint8_t x, uint8_t y);
125
126
127
128#ifdef __cplusplus
129}
130#endif /* __cplusplus */
131
135#endif /* __QRCODE_H_ */
bool qrcode_getModule(QRCode *qrcode, uint8_t x, uint8_t y)
Get QR code "bit" at given x,y position.
struct QRCode QRCode
QR code data structure.
int8_t qrcode_initBytes(QRCode *qrcode, uint8_t *modules, uint8_t version, uint8_t ecc, uint8_t *data, uint16_t length)
Generate QR code for given data.
uint16_t qrcode_getBufferSize(uint8_t version)
QR code buffer size required for given version.
int8_t qrcode_initText(QRCode *qrcode, uint8_t *modules, uint8_t version, uint8_t ecc, const char *data)
Generate QR code for given string.
QR code data structure.
Definition qrcode_ifc.h:76
uint8_t mode
Mode used.
Definition qrcode_ifc.h:80
uint8_t mask
QR code mask.
Definition qrcode_ifc.h:81
uint8_t version
QR code version.
Definition qrcode_ifc.h:77
uint8_t ecc
ECC used.
Definition qrcode_ifc.h:79
uint8_t size
QR code dimension corresponding to version.
Definition qrcode_ifc.h:78
uint8_t * modules
QR code data.
Definition qrcode_ifc.h:82