GS1 Datamatrix Codes with Motorola EMDK for .Net

I've been trying to read GS1 data matrix codes with the "Motorola EMDK for .net v. 2.7".
For that I've been using the Symbol(v. 2.5.0.3) and Symbol.Barcode(v. 2.7.0.2) Assemblies and created the following sample code in a Windows Forms Application:

private global::Symbol.Barcode.Reader _reader;
  
private global::Symbol.Barcode.ReaderData _readerData;

  
public Form1()
  
{
       
InitializeComponent();

       _readerData
= new ReaderData(ReaderDataTypes.Text, ReaderDataLengths.DefaultText);

       
var device = Device.AvailableDevices.FirstOrDefault(d => d.DeviceName != Device.SIMULATE);
       
if (device == null)
       
{
            
throw new Exception("No Symbol scanner in the system."); //TODO //MSG
       
}

       
// Create the reader, based on selected device
       _reader
= new global::Symbol.Barcode.Reader(device);

       _reader
.Actions.Enable();

       _reader
.Changes.Save();

       _reader
.ReadNotify += new EventHandler(_reader_ReadNotify);

       
// Start a pending read.
       
try
       
{
            _reader
.Actions.Read(_readerData);
       
}
       
catch (global::Symbol.Exceptions.OperationFailureException)
       
{
            
//_logger.Error("Error, Reader is blocked", ex);,
       
}
  
}

       
private void _reader_ReadNotify(object sender, EventArgs e)
       
{
       _readerData
= _reader.GetNextReaderData();

       _reader
.Actions.Read(_readerData);
  
}

  
private void Form1_Closing(object sender, CancelEventArgs e)
  
{
       _reader
.Dispose();
  
}

 

 

 

I've analyzed the ouput via a breakpoint in the ReadNotify event but I don't get a reasonable result. Its always just the plain code string.
I would need some kind of indication (via the symbology indentifiers for example) that it is a gs1 datamatrix code or better a result in a useful format.

Anonymous (not verified)
Take a look at this post to

Take a look at this post to see where the help file and sample files are for the EMDK.

You are not using the latest by the way, and we recommend using Barcode2 instead of Barcode for new development. 

Looking at the help file,  there are some properties of your _readerData object that might help.  For instance _readerData.Type  should give you the decoder type (Symbology) of the barcode that was scanned.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments