Qrencode QR code generation library function usage experience, qrencode Library Function

Source: Internet
Author: User

Qrencode QR code generation library function usage experience, qrencode Library Function

Development Environment:

Linux: ubuntu 14.04

Cross-compilation tool: gcc-4.4.3

Arm Development Board: mini2440

Arm kernel version: linux-3.4.99


Recently, the company's project needs to implement the string generation QR code function on the display function platform. After searching online, there is an open-source QR code C function library qrencode under the linux platform. So we attempted to port the source code.

Download the qrencode-3.4.4.tar.gz source code, enter the qrencode-3.4.4 directory, because the actual code does not run in the linux environment, so I do not follow. /configuer, make, make install ...... and other commands to generate the library and header files required for linux.

Create a new project folder, copy the qrencode-related files to the folder, and try to compile (this is not the case for makefile compilation ), finally, it is found that almost all files are dependent (and the source code is not cropped in depth). For details about the files, see:


The main file is self-written.

The simplest function to call a string to generate a QR code is:

QRcode *qrcode;qrcode = QRcode_encodeString("sissi", 2, QR_ECLEVEL_L, QR_MODE_8, 0);

For more information about function parameters and other functions, see QRencode. In the returned struct, qrcode-> data contains information about the QR code image. In fact, bit0 represents the color of the vertex, 1 indicates black, 0 indicates white.

In level2 (the second parameter specifies the QR code level), the generated QR code image is 25x25. Write a test program to print the serial port:

for(i=0;i<25;i++){for(j=0;j<25;j++){if(qrcode->data[i*25+j]&0x01){printf("#");}else{printf("_");}}printf("\n");}printf("\n");
Run the following command on the Development Board:

Now we can see the approximate image of the QR code.


Next, we try to display the LCD. We will not introduce the LCD display here. It is nothing more than the most basic line chart, but note that if we only follow the original line of 1.1, the image is too small to be scanned. You can first enlarge the image and then display it:

The displayed QR code can indeed scan the "sissi" string.

The source code of a self-built project does not depend on any special function library. Therefore, it should be easily transplanted to another processor and independent from the linux system.



Can Zxing generate a QR code on ios?

I added libqrencode to my current project and used QRCode to generate a QR code. However, I found that the original ZXing QR code had a problem, the scan page is displayed, but the scan is not performed. What is the relationship between the two? Please advise
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.