TagDataTranslation 0.3.1
See the version list below for details.
dotnet add package TagDataTranslation --version 0.3.1
NuGet\Install-Package TagDataTranslation -Version 0.3.1
<PackageReference Include="TagDataTranslation" Version="0.3.1" />
paket add TagDataTranslation --version 0.3.1
#r "nuget: TagDataTranslation, 0.3.1"
// Install TagDataTranslation as a Cake Addin #addin nuget:?package=TagDataTranslation&version=0.3.1 // Install TagDataTranslation as a Cake Tool #tool nuget:?package=TagDataTranslation&version=0.3.1
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:
TDTFileNotFound
Reports if the engine could not locate the configured definition file to compile.TDTFieldBelowMinimum
Reports a (numeric) Field that fell below the decimalMinimum value allowed by the TDT markupTDTFieldAboveMaximum
Reports a (numeric) Field that exceeded the decimalMaximum value allowed by the TDT markupTDTFieldOutsideCharacterSet
Reports a Field containing characters outside the characterSet range allowed by the TDT markupTDTUndefinedField
Reports a Field required for the output or an intermediate rule, whose value is undefinedTDTSchemeNotFound
Reported if no matching Scheme can be found via prefixMatchTDTLevelNotFound
Reported if no matching Level can be found via prefixMatchTDTOptionNotFound
Reported if no matching Option can be found via the optionKey or via matching the patternTDTLookupFailed
Reported if lookup in an external table failed to provide a value – reports table URI and path expression.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 | Versions 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. |
-
.NETStandard 1.4
- System.ComponentModel.Primitives (>= 4.3.0)
- System.Runtime.Serialization.Formatters (>= 4.3.0)
- System.Xml.XmlSerializer (>= 4.3.0)
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 | 42,187 | 12/9/2019 |
1.1.4 | 1,039 | 12/9/2019 |
1.1.3 | 1,026 | 12/9/2019 |
1.1.3-beta | 933 | 10/22/2019 |
1.1.2 | 1,287 | 10/22/2019 |
1.1.2-beta | 850 | 10/21/2019 |
1.1.1-beta | 988 | 5/22/2019 |
1.1.0 | 1,583 | 2/3/2019 |
1.1.0-beta1 | 1,180 | 10/16/2018 |
1.0.2 | 3,183 | 10/8/2018 |
1.0.1 | 1,729 | 6/7/2018 |
1.0.0 | 1,711 | 3/9/2018 |
0.3.1 | 1,541 | 7/23/2017 |
0.3.1-beta | 1,254 | 4/23/2017 |
0.2.1 | 1,642 | 10/19/2016 |
0.2.0 | 1,485 | 8/4/2016 |
0.1.0 | 6,026 | 5/30/2016 |