QRencode
QR Code encoder
qrencode.h
Go to the documentation of this file.
00001 
00099 #ifndef __QRENCODE_H__
00100 #define __QRENCODE_H__
00101 
00102 #if defined(__cplusplus)
00103 extern "C" {
00104 #endif
00105 
00109 typedef enum {
00110         QR_MODE_NUL = -1,  
00111         QR_MODE_NUM = 0,   
00112         QR_MODE_AN,        
00113         QR_MODE_8,         
00114         QR_MODE_KANJI,     
00115         QR_MODE_STRUCTURE, 
00116         QR_MODE_ECI,       
00117         QR_MODE_FNC1FIRST,  
00118         QR_MODE_FNC1SECOND, 
00119 } QRencodeMode;
00120 
00124 typedef enum {
00125         QR_ECLEVEL_L = 0, 
00126         QR_ECLEVEL_M,
00127         QR_ECLEVEL_Q,
00128         QR_ECLEVEL_H      
00129 } QRecLevel;
00130 
00134 #define QRSPEC_VERSION_MAX 40
00135 
00139 #define MQRSPEC_VERSION_MAX 4
00140 
00141 
00142 /******************************************************************************
00143  * Input data (qrinput.c)
00144  *****************************************************************************/
00145 
00152 typedef struct _QRinput QRinput;
00153 
00161 extern QRinput *QRinput_new(void);
00162 
00172 extern QRinput *QRinput_new2(int version, QRecLevel level);
00173 
00184 extern QRinput *QRinput_newMQR(int version, QRecLevel level);
00185 
00200 extern int QRinput_append(QRinput *input, QRencodeMode mode, int size, const unsigned char *data);
00201 
00213 extern int QRinput_appendECIheader(QRinput *input, unsigned int ecinum);
00214 
00220 extern int QRinput_getVersion(QRinput *input);
00221 
00230 extern int QRinput_setVersion(QRinput *input, int version);
00231 
00237 extern QRecLevel QRinput_getErrorCorrectionLevel(QRinput *input);
00238 
00247 extern int QRinput_setErrorCorrectionLevel(QRinput *input, QRecLevel level);
00248 
00258 extern int QRinput_setVersionAndErrorCorrectionLevel(QRinput *input, int version, QRecLevel level);
00259 
00265 extern void QRinput_free(QRinput *input);
00266 
00275 extern int QRinput_check(QRencodeMode mode, int size, const unsigned char *data);
00276 
00280 typedef struct _QRinput_Struct QRinput_Struct;
00281 
00288 extern QRinput_Struct *QRinput_Struct_new(void);
00289 
00295 extern void QRinput_Struct_setParity(QRinput_Struct *s, unsigned char parity);
00296 
00308 extern int QRinput_Struct_appendInput(QRinput_Struct *s, QRinput *input);
00309 
00314 extern void QRinput_Struct_free(QRinput_Struct *s);
00315 
00328 extern QRinput_Struct *QRinput_splitQRinputToStruct(QRinput *input);
00329 
00340 extern int QRinput_Struct_insertStructuredAppendHeaders(QRinput_Struct *s);
00341 
00345 extern int QRinput_setFNC1First(QRinput *input);
00346 
00350 extern int QRinput_setFNC1Second(QRinput *input, unsigned char appid);
00351 
00352 /******************************************************************************
00353  * QRcode output (qrencode.c)
00354  *****************************************************************************/
00355 
00375 typedef struct {
00376         int version;         
00377         int width;           
00378         unsigned char *data; 
00379 } QRcode;
00380 
00385 typedef struct _QRcode_List {
00386         QRcode *code;
00387         struct _QRcode_List *next;
00388 } QRcode_List;
00389 
00401 extern QRcode *QRcode_encodeInput(QRinput *input);
00402 
00426 extern QRcode *QRcode_encodeString(const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive);
00427 
00432 extern QRcode *QRcode_encodeString8bit(const char *string, int version, QRecLevel level);
00433 
00438 extern QRcode *QRcode_encodeStringMQR(const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive);
00439 
00444 extern QRcode *QRcode_encodeString8bitMQR(const char *string, int version, QRecLevel level);
00445 
00458 extern QRcode *QRcode_encodeData(int size, const unsigned char *data, int version, QRecLevel level);
00459 
00464 extern QRcode *QRcode_encodeDataMQR(int size, const unsigned char *data, int version, QRecLevel level);
00465 
00470 extern void QRcode_free(QRcode *qrcode);
00471 
00478 extern QRcode_List *QRcode_encodeInputStructured(QRinput_Struct *s);
00479 
00499 extern QRcode_List *QRcode_encodeStringStructured(const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive);
00500 
00505 extern QRcode_List *QRcode_encodeString8bitStructured(const char *string, int version, QRecLevel level);
00506 
00520 extern QRcode_List *QRcode_encodeDataStructured(int size, const unsigned char *data, int version, QRecLevel level);
00521 
00527 extern int QRcode_List_size(QRcode_List *qrlist);
00528 
00533 extern void QRcode_List_free(QRcode_List *qrlist);
00534 
00535 
00536 /******************************************************************************
00537  * System utilities
00538  *****************************************************************************/
00539 
00546 extern void QRcode_APIVersion(int *major_version, int *minor_version, int *micro_version);
00547 
00553 extern char *QRcode_APIVersionString(void);
00554 
00560 extern void QRcode_clearCache(void);
00561 
00562 #if defined(__cplusplus)
00563 }
00564 #endif
00565 
00566 #endif /* __QRENCODE_H__ */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines