NeKernel dev
Loading...
Searching...
No Matches
qr Namespace Reference

Classes

struct  Qr
class  QrDelegate
 QR code encoder class. More...

Enumerations

enum  Ecc { L , M , Q , H }
enum  Mode { M_NUMERIC , M_ALPHANUMERIC , M_BYTE , M_KANJI }

Functions

uint8_t gf_mul (uint8_t a, uint8_t b)
 galois finite field multiplication.
constexpr uint8_t get_bit_r (uint8_t *arr, int n)
constexpr void add_bits (uint16_t data, int n, uint8_t *arr, size_t &pos)
constexpr int alphanumeric (char c)
constexpr bool is_alphanumeric (const char *str, size_t len)
constexpr bool is_numeric (const char *str, size_t len)
constexpr bool is_kanji (const char *str, size_t len)
constexpr void gf_gen_poly (int degree, uint8_t *poly)
constexpr void gf_poly_div (uint8_t *dividend, size_t len, uint8_t *divisor, int degree, uint8_t *result)
constexpr Mode select_mode (const char *str, size_t len)
constexpr int cci (int ver, Mode mode)

Variables

uint8_t min_poly = 0b11101
uint8_t generator = 0b10
constexpr int ECC_CODEWORDS_PER_BLOCK [4][41]
constexpr int N_ECC_BLOCKS [4][41]
constexpr int ALIGN_POS [41][7]

Detailed Description

Note
the QR code is still code 128, it utilizes the same concept of having it's own character set.

Enumeration Type Documentation

◆ Ecc

enum qr::Ecc
Enumerator

◆ Mode

enum qr::Mode
Enumerator
M_NUMERIC 
M_ALPHANUMERIC 
M_BYTE 
M_KANJI 

Function Documentation

◆ add_bits()

void qr::add_bits ( uint16_t data,
int n,
uint8_t * arr,
size_t & pos )
constexpr

◆ alphanumeric()

int qr::alphanumeric ( char c)
constexpr

◆ cci()

int qr::cci ( int ver,
Mode mode )
constexpr

◆ get_bit_r()

uint8_t qr::get_bit_r ( uint8_t * arr,
int n )
constexpr

◆ gf_gen_poly()

void qr::gf_gen_poly ( int degree,
uint8_t * poly )
constexpr

◆ gf_mul()

uint8_t qr::gf_mul ( uint8_t a,
uint8_t b )
inline

galois finite field multiplication.

◆ gf_poly_div()

void qr::gf_poly_div ( uint8_t * dividend,
size_t len,
uint8_t * divisor,
int degree,
uint8_t * result )
constexpr

◆ is_alphanumeric()

bool qr::is_alphanumeric ( const char * str,
size_t len )
constexpr

◆ is_kanji()

bool qr::is_kanji ( const char * str,
size_t len )
constexpr

◆ is_numeric()

bool qr::is_numeric ( const char * str,
size_t len )
constexpr

◆ select_mode()

Mode qr::select_mode ( const char * str,
size_t len )
constexpr

Variable Documentation

◆ ALIGN_POS

int qr::ALIGN_POS[41][7]
constexpr

◆ ECC_CODEWORDS_PER_BLOCK

int qr::ECC_CODEWORDS_PER_BLOCK[4][41]
constexpr
Initial value:
= {
{0, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28,
28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30},
{0, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28, 26, 26, 26,
26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28},
{0, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30,
28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30},
{0, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28,
30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30},
}

◆ generator

uint8_t qr::generator = 0b10

◆ min_poly

uint8_t qr::min_poly = 0b11101
inline

◆ N_ECC_BLOCKS

int qr::N_ECC_BLOCKS[4][41]
constexpr
Initial value:
= {
{0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8,
8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25},
{0, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16,
17, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49},
{0, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20,
23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68},
{0, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25,
25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81},
}