QRencode
QR Code encoder
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
qrencode.h
Go to the documentation of this file.
1 
99 #ifndef __QRENCODE_H__
100 #define __QRENCODE_H__
101 
102 #if defined(__cplusplus)
103 extern "C" {
104 #endif
105 
109 typedef enum {
110  QR_MODE_NUL = -1,
119 } QRencodeMode;
120 
124 typedef enum {
129 } QRecLevel;
130 
134 #define QRSPEC_VERSION_MAX 40
135 
139 #define MQRSPEC_VERSION_MAX 4
140 
141 
142 /******************************************************************************
143  * Input data (qrinput.c)
144  *****************************************************************************/
145 
152 typedef struct _QRinput QRinput;
153 
161 extern QRinput *QRinput_new(void);
162 
172 extern QRinput *QRinput_new2(int version, QRecLevel level);
173 
184 extern QRinput *QRinput_newMQR(int version, QRecLevel level);
185 
200 extern int QRinput_append(QRinput *input, QRencodeMode mode, int size, const unsigned char *data);
201 
213 extern int QRinput_appendECIheader(QRinput *input, unsigned int ecinum);
214 
220 extern int QRinput_getVersion(QRinput *input);
221 
230 extern int QRinput_setVersion(QRinput *input, int version);
231 
238 
247 extern int QRinput_setErrorCorrectionLevel(QRinput *input, QRecLevel level);
248 
258 extern int QRinput_setVersionAndErrorCorrectionLevel(QRinput *input, int version, QRecLevel level);
259 
265 extern void QRinput_free(QRinput *input);
266 
275 extern int QRinput_check(QRencodeMode mode, int size, const unsigned char *data);
276 
280 typedef struct _QRinput_Struct QRinput_Struct;
281 
288 extern QRinput_Struct *QRinput_Struct_new(void);
289 
295 extern void QRinput_Struct_setParity(QRinput_Struct *s, unsigned char parity);
296 
308 extern int QRinput_Struct_appendInput(QRinput_Struct *s, QRinput *input);
309 
314 extern void QRinput_Struct_free(QRinput_Struct *s);
315 
329 
341 
345 extern int QRinput_setFNC1First(QRinput *input);
346 
350 extern int QRinput_setFNC1Second(QRinput *input, unsigned char appid);
351 
352 /******************************************************************************
353  * QRcode output (qrencode.c)
354  *****************************************************************************/
355 
375 typedef struct {
376  int version;
377  int width;
378  unsigned char *data;
379 } QRcode;
380 
385 typedef struct _QRcode_List {
387  struct _QRcode_List *next;
388 } QRcode_List;
389 
401 extern QRcode *QRcode_encodeInput(QRinput *input);
402 
425 extern QRcode *QRcode_encodeString(const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive);
426 
431 extern QRcode *QRcode_encodeString8bit(const char *string, int version, QRecLevel level);
432 
437 extern QRcode *QRcode_encodeStringMQR(const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive);
438 
443 extern QRcode *QRcode_encodeString8bitMQR(const char *string, int version, QRecLevel level);
444 
457 extern QRcode *QRcode_encodeData(int size, const unsigned char *data, int version, QRecLevel level);
458 
463 extern QRcode *QRcode_encodeDataMQR(int size, const unsigned char *data, int version, QRecLevel level);
464 
469 extern void QRcode_free(QRcode *qrcode);
470 
478 
497 extern QRcode_List *QRcode_encodeStringStructured(const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive);
498 
503 extern QRcode_List *QRcode_encodeString8bitStructured(const char *string, int version, QRecLevel level);
504 
518 extern QRcode_List *QRcode_encodeDataStructured(int size, const unsigned char *data, int version, QRecLevel level);
519 
525 extern int QRcode_List_size(QRcode_List *qrlist);
526 
531 extern void QRcode_List_free(QRcode_List *qrlist);
532 
533 
534 /******************************************************************************
535  * System utilities
536  *****************************************************************************/
537 
544 extern void QRcode_APIVersion(int *major_version, int *minor_version, int *micro_version);
545 
551 extern char *QRcode_APIVersionString(void);
552 
558 extern void QRcode_clearCache(void);
559 
560 #if defined(__cplusplus)
561 }
562 #endif
563 
564 #endif /* __QRENCODE_H__ */