decoder

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2020 License: Apache-2.0, MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	C40_BASIC_SET_CHARS = []byte{
		'*', '*', '*', ' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
		'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
		'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
	}

	C40_SHIFT2_SET_CHARS = []byte{
		'!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.',
		'/', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_',
	}

	TEXT_BASIC_SET_CHARS = []byte{
		'*', '*', '*', ' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
		'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
		'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
	}

	TEXT_SHIFT2_SET_CHARS = C40_SHIFT2_SET_CHARS

	TEXT_SHIFT3_SET_CHARS = []byte{
		'`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
		'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '{', '|', '}', '~', 127,
	}
)

Functions

func DecodedBitStreamParser_decode

func DecodedBitStreamParser_decode(bytes []byte) (*common.DecoderResult, error)

Types

type BitMatrixParser

type BitMatrixParser struct {
	// contains filtered or unexported fields
}

func NewBitMatrixParser

func NewBitMatrixParser(bitMatrix *gozxing.BitMatrix) (*BitMatrixParser, error)

NewBitMatrixParser construct parser @param bitMatrix {@link BitMatrix} to parse @throws FormatException if dimension is < 8 or > 144 or not 0 mod 2

func (*BitMatrixParser) GetVersion

func (p *BitMatrixParser) GetVersion() *Version

type DataBlock

type DataBlock struct {
	// contains filtered or unexported fields
}

DataBlock Encapsulates a block of data within a Data Matrix Code. Data Matrix Codes may split their data into multiple blocks, each of which is a unit of data and error-correction codewords. Each is represented by an instance of this class.

func DataBlocks_getDataBlocks

func DataBlocks_getDataBlocks(rawCodewords []byte, version *Version) ([]DataBlock, error)

DataBlocks_getDataBlocks When Data Matrix Codes use multiple data blocks, they actually interleave the bytes of each of them. That is, the first byte of data block 1 to n is written, then the second bytes, and so on. This method will separate the data into original blocks.

@param rawCodewords bytes as read directly from the Data Matrix Code @param version version of the Data Matrix Code @return DataBlocks containing original bytes, "de-interleaved" from representation in the Data Matrix Code

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

Decoder The main class which implements Data Matrix Code decoding

-- as opposed to locating and extracting the Data Matrix Code from an image.

func NewDecoder

func NewDecoder() *Decoder

func (*Decoder) Decode

func (d *Decoder) Decode(bits *gozxing.BitMatrix) (*common.DecoderResult, error)

Decode Decodes a Data Matrix Code represented as a {@link BitMatrix}. A 1 or "true" is taken to mean a black module.

@param bits booleans representing white/black Data Matrix Code modules @return text and bytes encoded within the Data Matrix Code @throws FormatException if the Data Matrix Code cannot be decoded @throws ChecksumException if error correction fails

func (*Decoder) DecodeBoolMap

func (d *Decoder) DecodeBoolMap(image [][]bool) (*common.DecoderResult, error)

DecodeBoolMap Convenience method that can decode a Data Matrix Code represented as a 2D array of booleans. "true" is taken to mean a black module.

@param image booleans representing white/black Data Matrix Code modules @return text and bytes encoded within the Data Matrix Code @throws FormatException if the Data Matrix Code cannot be decoded @throws ChecksumException if error correction fails

type ECB

type ECB struct {
	// contains filtered or unexported fields
}

ECB Encapsulates the parameters for one error-correction block in one symbol version. This includes the number of data codewords, and the number of times a block with these parameters is used consecutively in the Data Matrix code version's format.

type ECBlocks

type ECBlocks struct {
	// contains filtered or unexported fields
}

ECBlocks Encapsulates a set of error-correction blocks in one symbol version. Most versions will use blocks of differing sizes within one version, so, this encapsulates the parameters for each set of blocks. It also holds the number of error-correction codewords per block since it will be the same across all blocks within one version.

type Mode

type Mode int
const (
	Mode_PDA_ENCODE Mode = iota
	Mode_ASCII_ENCODE
	Mode_C40_ENCODE
	Mode_TEXT_ENCODE
	Mode_ANSIX12_ENCODE
	Mode_EDIFACT_ENCODE
	Mode_BASE256_ENCODE
)

func (Mode) String

func (m Mode) String() string

type Version

type Version struct {
	// contains filtered or unexported fields
}

Version The Version object encapsulates attributes about a particular size Data Matrix Code.

func NewVersion

func NewVersion(
	versionNumber, symbolSizeRows, symbolSizeColumns,
	dataRegionSizeRows, dataRegionSizeColumns int, ecBlocks *ECBlocks) *Version

func (*Version) String

func (v *Version) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL