Geeks With Blogs
All Things Edgeware An unofficial blog about iMotion and RFID

Overview

As noted in my previous post about iMotion Encoding Adapters, iMotion 5.1 introduced a new encoding library that allows developers to easily encode and decode EPC values as well as create and process tag filter and group patterns.  This new library improves upon the previous 5.0 library in three significant ways:

  • Introduces a feature rich object-oriented API that allows developers to interact with tags at various levels of abstraction.
  • Raises the status of RFID tags to strongly-typed first class citizens within applications.
  • Provides a framework for existing encodings as well as future TDS and non-TDS tag encodings.

Encoding Tags

To use the encoding library, applications must reference the Globeranger.Core.Tag and Globeranger.Core.Tag.Epc assemblies.  You can select both assemblies from the list of available assemblies within the Add Reference dialog in Visual Studio if iMotion 5.1 is installed. After adding the references, you will need to import namespaces the Globeranger.Core.Tag, Globeranger.Core.Tag.Epc and the one referring to the TDS version you wish to target. Within 5.1, you can choose either 1.24 or 1.27 but unless you are supporting legacy applications you should always use 1.27 by importing Globeranger.Core.Tag.Epc._1_27.   Your imported namespaces should look like:

using Globeranger.Core.Tag;

using Globeranger.Core.Tag.Epc;

using Globeranger.Core.Tag.Epc._1_27;

After importing your namespaces, select an identity type, bit-level encoding and a constructor option for your selected tag type.  As noted in my previous post, you can select from one of the seven supported identity types within TDS 1.27: GID, SGTIN, SSCC, GRAI, GIAI, SGLN and DOD.  Each identity type within TDS 1.27, outside of GID, supports two bit-level encodings so select from one of the following: 64-bit or 96-bit.  For tag type construction, you have two options: 1) supply the UCC identity value if the identity type supports one or 2) supply all the encoding scheme’s required field values. Your code should look similar to the following if you're constructing a SGTIN 96 bit tag:

//
//Option 1
//
SgtinFilter filter = SgtinFilter.StandardTradeItemGrouping;
string companyPrefix = "0037000";
string itemReference = "012345";
long serialNumber = 1;

Sgtin96BitTag tag = new Sgtin96BitTag(filter,companyPrefix,itemReference,serialNumber);

//
//Option 2
//
SgtinFilter filter = SgtinFilter.StandardTradeItemGrouping;
string eanUccGtin = "00037000123453";
int companyPrefixLength = 7;
long serialNumber = 1;

Sgtin96BitTag tag = new Sgtin96BitTag(filter,eanUccGtin,companyPrefixLength,serialNumber);

Once the tag type is constructed successfully, you can access that tag's field values through properties:

SgtinFilter filter = tag.Filter;
string companyPrefix = tag.CompanyPrefix;
string itemReference = tag.ItemReference;
long serialNumber = tag.SerialNumber;

You can also serialize the tag type to any of its supported representations by invoking conversion methods:

string hex = tag.ToHex();
string pureUri = tag.ToPureUri();
string tagUri = tag.ToTagUri();
string rawUri = tag.ToRaw();
string decimalUri = tag.ToDecimal();

And finally, you can extract the EAN UCC elements from a tag type that represents a UCC identity:

string  gtin = tag.ToEanUccIdentity();
string  eanUccItemReference = tag.ToEanUccItemReference();              

Decoding Tags

There will be scenarios within you RFID application that require you extract field values from an encoded tag. You can do this by constructing a strongly typed representation from any well-formed tag representation (i.e., Tag URI, Raw URI, Decimal and Hex) by using EpcTagCreator:

string hex = "30740242200C0E4000000001";  //Could be any tag representation format
EpcTagCreator creator = new EpcTagCreator();
ITag tag = creator.CreateTag(hex);

if(tag is Sgtin96BitTag){
      //Do something interesting with tag
}

Posted on Tuesday, December 6, 2005 7:56 PM | Back to top


Comments on this post: Part Two - iMotion Encoding Adapters: RFID Tag Encoding and Decoding

# re: Part Two - iMotion Encoding Adapters: RFID Tag Encoding and Decoding
Requesting Gravatar...
I love the EpcTagCreator!
Left by Anthony Trudeau on Dec 30, 2005 7:04 AM

Your comment:
 (will show your gravatar)


Copyright © Daniel Hernandez | Powered by: GeeksWithBlogs.net