Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

(no description)

Author: Nicola Asuni
Version: 1.0.008
File Size: 1176 lines (43 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: Datamatrix  - X-Ref


__construct($code)   X-Ref
This is the class constructor.
Creates a datamatrix object

param: $code (string) Code to represent using Datamatrix.

getBarcodeArray()   X-Ref
Returns a barcode array which is readable by TCPDF

return: array barcode array readable by TCPDF;

getGFProduct($a, $b, $log, $alog, $gf)   X-Ref
Product of two numbers in a Power-of-Two Galois Field

return: int product
param: $a (int) first number to multiply.
param: $b (int) second number to multiply.
param: $log (array) Log table.
param: $alog (array) Anti-Log table.
param: $gf (array) Number of Factors of the Reed-Solomon polynomial.

getErrorCorrection($wd, $nb, $nd, $nc, $gf=256, $pp=301)   X-Ref
Add error correction codewords to data codewords array (ANNEX E).

return: array data codewords + error codewords
param: $wd (array) Array of datacodewords.
param: $nb (int) Number of blocks.
param: $nd (int) Number of data codewords per block.
param: $nc (int) Number of correction codewords per block.
param: $gf (int) numner of fields on log/antilog table (power of 2).
param: $pp (int) The value of its prime modulus polynomial (301 for ECC200).

get253StateCodeword($cwpad, $cwpos)   X-Ref
Return the 253-state codeword

return: pad codeword
param: $cwpad (int) Pad codeword.
param: $cwpos (int) Number of data codewords from the beginning of encoded data.

get255StateCodeword($cwpad, $cwpos)   X-Ref
Return the 255-state codeword

return: pad codeword
param: $cwpad (int) Pad codeword.
param: $cwpos (int) Number of data codewords from the beginning of encoded data.

isCharMode($chr, $mode)   X-Ref
Returns true if the char belongs to the selected mode

return: boolean true if the char is of the selected mode.
param: $chr (int) Character (byte) to check.
param: $mode (int) Current encoding mode.

lookAheadTest($data, $pos, $mode)   X-Ref
The look-ahead test scans the data to be encoded to find the best mode (Annex P - steps from J to S).

return: int encoding mode
param: $data (string) data to encode
param: $pos (int) current position
param: $mode (int) current encoding mode

getSwitchEncodingCodeword($mode)   X-Ref
Get the switching codeword to a new encoding mode (latch codeword)

return: (int) Switch codeword.
param: $mode (int) New encoding mode.

getMaxDataCodewords($numcw)   X-Ref
Choose the minimum matrix size and return the max number of data codewords.

return: number of data codewords in matrix
param: $numcw (int) Number of current codewords.

getHighLevelEncoding($data)   X-Ref
Get high level encoding using the minimum symbol data characters for ECC 200

return: array of codewords
param: $data (string) data to encode

placeModule($marr, $nrow, $ncol, $row, $col, $chr, $bit)   X-Ref
Places "chr+bit" with appropriate wrapping within array[].
(Annex F - ECC 200 symbol character placement)

return: array
param: $marr (array) Array of symbols.
param: $nrow (int) Number of rows.
param: $ncol (int) Number of columns.
param: $row (int) Row number.
param: $col (int) Column number.
param: $chr (int) Char byte.
param: $bit (int) Bit.

placeUtah($marr, $nrow, $ncol, $row, $col, $chr)   X-Ref
Places the 8 bits of a utah-shaped symbol character.
(Annex F - ECC 200 symbol character placement)

return: array
param: $marr (array) Array of symbols.
param: $nrow (int) Number of rows.
param: $ncol (int) Number of columns.
param: $row (int) Row number.
param: $col (int) Column number.
param: $chr (int) Char byte.

placeCornerA($marr, $nrow, $ncol, $chr)   X-Ref
Places the 8 bits of the first special corner case.
(Annex F - ECC 200 symbol character placement)

return: array
param: $marr (array) Array of symbols.
param: $nrow (int) Number of rows.
param: $ncol (int) Number of columns.
param: $chr (int) Char byte.

placeCornerB($marr, $nrow, $ncol, $chr)   X-Ref
Places the 8 bits of the second special corner case.
(Annex F - ECC 200 symbol character placement)

return: array
param: $marr (array) Array of symbols.
param: $nrow (int) Number of rows.
param: $ncol (int) Number of columns.
param: $chr (int) Char byte.

placeCornerC($marr, $nrow, $ncol, $chr)   X-Ref
Places the 8 bits of the third special corner case.
(Annex F - ECC 200 symbol character placement)

return: array
param: $marr (array) Array of symbols.
param: $nrow (int) Number of rows.
param: $ncol (int) Number of columns.
param: $chr (int) Char byte.

placeCornerD($marr, $nrow, $ncol, $chr)   X-Ref
Places the 8 bits of the fourth special corner case.
(Annex F - ECC 200 symbol character placement)

return: array
param: $marr (array) Array of symbols.
param: $nrow (int) Number of rows.
param: $ncol (int) Number of columns.
param: $chr (int) Char byte.

getPlacementMap($nrow, $ncol)   X-Ref
Build a placement map.
(Annex F - ECC 200 symbol character placement)

return: array
param: $nrow (int) Number of rows.
param: $ncol (int) Number of columns.