|
|
|
@ -62,8 +62,7 @@ static void doBasicDemo() {
|
|
|
|
|
|
|
|
|
|
// Creates a variety of QR Codes that exercise different features of the library, and prints each one to the console.
|
|
|
|
|
static void doVarietyDemo() {
|
|
|
|
|
// Project Nayuki URL
|
|
|
|
|
{
|
|
|
|
|
{ // Project Nayuki URL
|
|
|
|
|
uint8_t qrcode[qrcodegen_BUFFER_LEN_MAX];
|
|
|
|
|
uint8_t tempBuffer[qrcodegen_BUFFER_LEN_MAX];
|
|
|
|
|
int version = qrcodegen_encodeText("https://www.nayuki.io/", tempBuffer, qrcode,
|
|
|
|
@ -72,8 +71,7 @@ static void doVarietyDemo() {
|
|
|
|
|
printQr(qrcode, version);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Numeric mode encoding (3.33 bits per digit)
|
|
|
|
|
{
|
|
|
|
|
{ // Numeric mode encoding (3.33 bits per digit)
|
|
|
|
|
uint8_t qrcode[qrcodegen_BUFFER_LEN_MAX];
|
|
|
|
|
uint8_t tempBuffer[qrcodegen_BUFFER_LEN_MAX];
|
|
|
|
|
int version = qrcodegen_encodeText("314159265358979323846264338327950288419716939937510", tempBuffer, qrcode,
|
|
|
|
@ -82,8 +80,7 @@ static void doVarietyDemo() {
|
|
|
|
|
printQr(qrcode, version);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Alphanumeric mode encoding (5.5 bits per character)
|
|
|
|
|
{
|
|
|
|
|
{ // Alphanumeric mode encoding (5.5 bits per character)
|
|
|
|
|
uint8_t qrcode[qrcodegen_BUFFER_LEN_MAX];
|
|
|
|
|
uint8_t tempBuffer[qrcodegen_BUFFER_LEN_MAX];
|
|
|
|
|
int version = qrcodegen_encodeText("DOLLAR-AMOUNT:$39.87 PERCENTAGE:100.00% OPERATIONS:+-*/", tempBuffer, qrcode,
|
|
|
|
@ -92,8 +89,7 @@ static void doVarietyDemo() {
|
|
|
|
|
printQr(qrcode, version);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Unicode text as UTF-8, and different masks
|
|
|
|
|
{
|
|
|
|
|
{ // Unicode text as UTF-8, and different masks
|
|
|
|
|
const char *text = "\xE3\x81\x93\xE3\x82\x93\xE3\x81\xAB\xE3\x81\xA1wa\xE3\x80\x81\xE4\xB8\x96\xE7\x95\x8C\xEF\xBC\x81\x20\xCE\xB1\xCE\xB2\xCE\xB3\xCE\xB4";
|
|
|
|
|
uint8_t qrcode[qrcodegen_BUFFER_LEN_MAX];
|
|
|
|
|
uint8_t tempBuffer[qrcodegen_BUFFER_LEN_MAX];
|
|
|
|
@ -120,8 +116,7 @@ static void doVarietyDemo() {
|
|
|
|
|
printQr(qrcode, version);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Moderately large QR Code using longer text (from Lewis Carroll's Alice in Wonderland)
|
|
|
|
|
{
|
|
|
|
|
{ // Moderately large QR Code using longer text (from Lewis Carroll's Alice in Wonderland)
|
|
|
|
|
const char *text =
|
|
|
|
|
"Alice was beginning to get very tired of sitting by her sister on the bank, "
|
|
|
|
|
"and of having nothing to do: once or twice she had peeped into the book her sister was reading, "
|
|
|
|
|