0

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.

Charlie
  • 11
  • 4

1 Answers1

0

The EMDK examples shows how you can use the barcode library.

switch (_readerData .Result)
     {
          case Symbol.Results.SUCCESS:
                 HandleData(_readerData)
             break;

     }

_readerData.Text is the text in the barcode and you have to split the text at the function code in the GS1 Matrix Code to get AI values _readerData.Type is the type of barcode and you can check for the matrix barcode

You may also need to change ReaderDataLengths.DefaultText (55) to ReaderDataLengths.MaximumLabel

nekomatic
  • 5,988
  • 1
  • 20
  • 27
Eva
  • 1
  • 1