TagDataTranslation 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package TagDataTranslation --version 1.0.0                
NuGet\Install-Package TagDataTranslation -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TagDataTranslation" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TagDataTranslation --version 1.0.0                
#r "nuget: TagDataTranslation, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install TagDataTranslation as a Cake Addin
#addin nuget:?package=TagDataTranslation&version=1.0.0

// Install TagDataTranslation as a Cake Tool
#tool nuget:?package=TagDataTranslation&version=1.0.0                

Synopsis

Tag Data Translation implemented according to the GS1 EPC Tag Data Translation 1.6 specification (http://www.gs1.org/epc/tag-data-translation-standard) for RAIN RFID, and updated for Tag Data Standard 1.11. Comes with unit tests and a demonstration application. Online accessible at https://www.mimasu.nl/tdt.

An online demo is available at https://www.mimasu.nl.

The following schemes are supported:

  • ADI-var
  • CPI-96, CPI-var
  • GTDI-96, GDTI-174
  • GIAI-96, GIAI-202
  • GID-96
  • GRAI-96, GRAI-170
  • GSRN-96
  • GSRNP-96
  • ITIP-110, ITIP-212
  • SGCN-96
  • SGLN-96, SGLN-195
  • SGTIN-96, SGTIN-198
  • SSCC-96
  • USDOD-96

The following programming languages are supported:

  • C# .NET Framework 4.0 (Microsoft and Xamarin Mono runtime)
  • C# .NET Standard 1.4

Example

The following code is an example on how to use the library, to go from a GTIN and serial to hexadecimal.

TDTEngine engine = new TDTEngine ();
string epcIdentifier = @"gtin=00037000302414;serial=10419703"
string parameterList = @"filter=3;gs1companyprefixlength=7;tagLength=96";
string binary = engine.Translate(epcIdentifier, parameterList, @"BINARY");
string binaryHex = engine.BinaryToHex(binary);

Or the other way around.

TDTEngine engine = new TDTEngine ();
string epcIdentifier = engine.HexToBinary(@"30340242201d8840009efdf7");
string parameterList = @"tagLength=96";
string legacy = engine.Translate(epcIdentifier, parameterList, @"LEGACY");

API

The library follows the client API as defined in the standard and there are some additional helper functions.

Translate

public String translate(String epcIdentifier, String parameterList, String outputFormat)

Translates epcIdentifier from one representation into another within the same coding scheme.

Parameters
Parameter Description
epcIdentifier 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 This is a parameter string containing key value pairs, using the semicolon [';'] as delimiter between key=value pairs. For example, to convert a GTIN code the parameter string would look like the following: filter=3;companyprefixlength=7;tagLength=96
outputFormat The output format into which the epcIdentifier SHALL be converted. The following are the formats supported: BINARY, LEGACY, LEGACY_AI, TAG_ENCODING, PURE_IDENTITY
Returns

The converted value into one of the above formats as String.

Throws

TDTTranslationException – Throws exceptions due to the following reason:

  1. TDTFileNotFound Reports if the engine could not locate the configured definition file to compile.
  2. TDTFieldBelowMinimum Reports a (numeric) Field that fell below the decimalMinimum value allowed by the TDT markup
  3. TDTFieldAboveMaximum Reports a (numeric) Field that exceeded the decimalMaximum value allowed by the TDT markup
  4. TDTFieldOutsideCharacterSet Reports a Field containing characters outside the characterSet range allowed by the TDT markup
  5. TDTUndefinedField Reports a Field required for the output or an intermediate rule, whose value is undefined
  6. TDTSchemeNotFound Reported if no matching Scheme can be found via prefixMatch
  7. TDTLevelNotFound Reported if no matching Level can be found via prefixMatch
  8. TDTOptionNotFound Reported if no matching Option can be found via the optionKey or via matching the pattern
  9. TDTLookupFailed Reported if lookup in an external table failed to provide a value – reports table URI and path expression.
  10. TDTNumericOverflow Reported when a numeric overflow occurs when handling numeric values such as serial number.

GetPrefixLength

public PrefixLengthResult GetPrefixLength(string input)

Gets the GS1 Prefix Length for the given identifier. Based on the gcpprefixformatlist.xml file from GS1 (GCP Length Table, https://www.gs1.org/standards/bc-epc-interop).

Parameters
Parameter Description
input Identifier for which to find the GS1 Prefix Length. Input as string.
Returns

An object with the following properties.

Property Description
Prefix The full GS1 Prefix as a string.
Length The length of the GS1 Prefix as integer.

GetFilterValueTable

public Dictionary<int, string> GetFilterValueTable(string scheme)

Gets the Filter Value table for the provided scheme.

Parameters
Parameter Description
scheme The GS1 EPC scheme for which to retrieve the Filter Value Table. Input as string.
Returns

A dictionary with an integer as key (Filter Value) and a string as value (description).

License

This library is dual-licensed:

  • GNU Affero General Public License version 3
  • Commercial license, contact tdt@dannyhaak.nl for more details

The included XML and XSD artifacts are (c) by GS1 (https://www.gs1.org/epc/tag-data-translation-standard).

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp1.0 was computed.  netcoreapp1.1 was computed.  netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard1.4 is compatible.  netstandard1.5 was computed.  netstandard1.6 was computed.  netstandard2.0 was computed.  netstandard2.1 was computed. 
.NET Framework net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen30 was computed.  tizen40 was computed.  tizen60 was computed. 
Universal Windows Platform uap was computed.  uap10.0 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.5 39,268 12/9/2019
1.1.4 1,033 12/9/2019
1.1.3 1,020 12/9/2019
1.1.3-beta 931 10/22/2019
1.1.2 1,281 10/22/2019
1.1.2-beta 848 10/21/2019
1.1.1-beta 986 5/22/2019
1.1.0 1,575 2/3/2019
1.1.0-beta1 1,172 10/16/2018
1.0.2 3,171 10/8/2018
1.0.1 1,719 6/7/2018
1.0.0 1,700 3/9/2018
0.3.1 1,528 7/23/2017
0.3.1-beta 1,250 4/23/2017
0.2.1 1,632 10/19/2016
0.2.0 1,476 8/4/2016
0.1.0 6,017 5/30/2016