C# Class FOSSTRAK.TDT.TDTEngine

This class provides methods for translating an electronic product code (EPC) between various levels of representation including BINARY, TAG_ENCODING, PURE_IDENTITY and LEGACY formats. An additional output level ONS_HOSTNAME may be defined for some coding schemes.
Author Mike Lohmeier [email protected]
Show file Open project: Zambonilli/FOSSTRAK

Public Methods

Method Description
Bin2Dec ( String binary ) : String
RefreshTranslations ( ) : void

Checks each subscription for any update, reloading new rules where necessary and forces the software to reload or recompile its internal representation of the encoding/decoding rules based on the current remaining subscriptions.

TDTEngine ( ) : System

Constructor for a new Tag Data Translation engine.

Constructor for a new Tag Data Translation engine. This constructor loads and parses the schemes included in the directory Resources\Schemes The ManagerTranslation.xml file is loaded from a directory called Resources\Auxiliary. All schemes must have filenames ending in .xml

Translate ( String epcIdentifier, String>.IEnumerable parameterList, LevelTypeList outputFormat ) : String

Translates epcIdentifier from one representation into another within the same coding scheme. [.NET Version]

Translate ( String epcIdentifier, String parameterList, String outputFormat ) : String

Translates epcIdentifier from one representation into another within the same coding scheme. [TDT 1.6 Version]

dec2bin ( String d ) : String

Private Methods

Method Description
ApplyPadChar ( String bare, PadDirectionList dir, String padchar, int requiredLength ) : String
Bin2AlphaNumSix ( String binary ) : String
Bin2UpperCaseFive ( String binary ) : String
BinaryToString ( String value, int compaction ) : String

Converts a binary string to a character string according to the specified compaction

BuildGrammer ( Tuple outputOption, String>.Dictionary tokens ) : String

Builds the out string using ABNF protocol

CheckTokenCharacterSet ( Field f, String token ) : void

Method to check the CharacterSet of an input token

CheckTokenMinMax ( Field f, String token ) : void

Method to check an input tokens min and max based on the min and max field attributes

ConvertTokensToBinary ( Tuple outputOption, String>.Dictionary tokens ) : void
ExtractInputTokens ( String epcIdentifier, String>.IEnumerable parameterList, Tuple inputOption, Tuple outputOption, String>.Dictionary tokens ) : void

Method to extract, validate and format the field tokens from the input into its string representation

GetInputOption ( String epcIdentifier, String>.IEnumerable paramterList ) : Tuple

Gets the Option for the input and the inputParameters

GetInputParameterValue ( String parameterName, String>.IEnumerable inputParameters ) : String

Helper to find an input parameter if it exists in the inputParameters

LoadEpcTagDataTranslations ( ) : void

Method for loading all of the *.xml schemes files from disk to main memory data structures

LoadGEPC64Table ( ) : void

Method that loads and parses the Resources\Auxilary\ManagerTranslation.xml into _gs1cpi

ProcessRules ( Tuple option, ModeList ruleType, String>.Dictionary tokens ) : void

Method for processing extract & format rules

StringToBinary ( String value, CompactionMethodList compaction ) : String
StripPadChar ( String padded, PadDirectionList dir, String padchar ) : String
StripTokenBinaryPadding ( String token, PadDirectionList bitPadDir, int compaction ) : String

Method to Strip the binary padding from a token

alphanumsix2bin ( String alphanumsix ) : String
asciiseven2bin ( String asciiseven ) : String
bin2asciiseven ( String binary ) : String
bin2bytestring ( String binary ) : String
bytestring2bin ( String bytestring ) : String
padBinary ( String binary, int reqlen ) : String
uppercasefive2bin ( String uppercasefive ) : String

Method Details

Bin2Dec() public method

public Bin2Dec ( String binary ) : String
binary String
return String

RefreshTranslations() public method

Checks each subscription for any update, reloading new rules where necessary and forces the software to reload or recompile its internal representation of the encoding/decoding rules based on the current remaining subscriptions.
public RefreshTranslations ( ) : void
return void

TDTEngine() public method

Constructor for a new Tag Data Translation engine.
Constructor for a new Tag Data Translation engine. This constructor loads and parses the schemes included in the directory Resources\Schemes The ManagerTranslation.xml file is loaded from a directory called Resources\Auxiliary. All schemes must have filenames ending in .xml
public TDTEngine ( ) : System
return System

Translate() public method

Translates epcIdentifier from one representation into another within the same coding scheme. [.NET Version]
public Translate ( String epcIdentifier, String>.IEnumerable parameterList, LevelTypeList outputFormat ) : String
epcIdentifier String The epcIdentifier to be converted. This should be expressed as a string, in accordance with one of the grammars /// or patterns in the TDT markup files, i.e. a binary string consisting of characters '0' and '1', a URI (either tag-encoding or pure-identity formats), /// or a serialized identifier expressed as in Table 3
parameterList String>.IEnumerable IEnumerable list of key value pair parameters needed for doing some translations
outputFormat LevelTypeList The output format for the in the same scheme
return String

Translate() public method

Translates epcIdentifier from one representation into another within the same coding scheme. [TDT 1.6 Version]
public Translate ( String epcIdentifier, String parameterList, String outputFormat ) : String
epcIdentifier String The epcIdentifier to be converted. This should be expressed as a string, in accordance with one of the grammars /// or patterns in the TDT markup files, i.e. a binary string consisting of characters '0' and '1', a URI (either tag-encoding or pure-identity formats), /// or a serialized identifier expressed as in Table 3
parameterList String This is a parameter string containing key value pairs, using the semicolon [';'] as delimiter between key=value pairs. /// GTIN filter=3;companyprefixlength=7;tagLength=96 ///
outputFormat String The output format into which the epcIdentifier SHALL be converted. /// BINARY /// LEGACY /// LEGACY_AI /// TAG_ENCODING /// PURE_IDENTITY /// ONS_HOSTNAME ///
return String

dec2bin() public method

public dec2bin ( String d ) : String
d String
return String