Click here to Skip to main content
15,353,783 members
Articles / Programming Languages / C#
Posted 3 May 2012

Tagged as


12 bookmarked

Barcode Scanning on Motorola, Intermec and Psion

3 May 2012CPOL2 min read
Resco offers classes that create universal interface that can access barcode scanners of various devices. This means that one application will be able to scan barcodes from different devices.

This article is in the Product Showcase section for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers.

In the earlier days the logistics and warehouseing was much simpler than today. Each item was handpicked and moved to another location. People were using standard cashiers or just a pen and a piece of paper to keep the lists of inventories. Those days are just gone!

Today everything needs to be done quickly. Customer places order and items need to be shipped almost immediately. Goods arrive to warehouse and warehouse manager needs to know where to place them. He also needs to add them to his inventory. Barcodes can rapidly speed up the logistics of the company. You simply scan a single code and you will access various information that you need to make the decision.

Until now the developers needed to create separate application for each device. Now, Resco offers classes that create universal interface that can access barcode scanners of various devices. This means that one application will be able to scan barcodes from different devices. We support:

  • Symbol - Motorola
  • Intermec
  • Psion

All you need to do is to download SDK of device manufacturers. You can find them here:

Here is the sample code that will help you to handle the barcode scanning on any type of device:

private TagReader m_tagReader = null;

//new TagReader instance for current DeviceType
m_tagReader = BarcodeMgr.CreateInstance();

//this event triggered when a barcode is read
m_tagReader.TagRead += new EventHandler<TagEventArgs>(m_tagReader_TagRead);

private void m_tagReader_TagRead(object sender, TagEventArgs e)
	//statement to call if the HandleBarCode method is in the same thread
	if (this.InvokeRequired)
	this.Invoke(new Action(m_tagReader_TagRead), sender, e);

private void HandleBarCode(string code)
	//TO DO: Here you can add a code for the barcode handling 
	uiTextBoxProductID.Text = code;

How to add another miscellaneous scanning devices

If you need to add another type of device that is not yet supported by our barcode scanning interface, you can simply follow these steps (Please note that just for an example, we demonstrated how to add Opticon device):

  1. Open the BarCodeMgr class.
  2. Add to the BarCodeReaderDeviceType enum new "Opticon" option.
  3. Add into the CreateInstance method new Opticon deviceType. It should look as follows:
/// <summary>
/// Creates and initializes a new <see cref="TagReader"/> instance.
/// </summary>
public static TagReader CreateInstance()
	BarCodeReaderDeviceType deviceType = BarCodeReaderDeviceType.None;
	if (BarCodeUtil.IsSymbolDevice())
		deviceType = BarCodeReaderDeviceType.Symbol;
	else if (BarCodeUtil.IsIngenicoDevice())
		deviceType = BarCodeReaderDeviceType.Ingenico;
	else if (BarCodeUtil.IsPsionDevice())
		deviceType = BarCodeReaderDeviceType.Psion;
	// ******************** START Custom Code
	else if (BarCodeUtil.IsOpticonDevice())
		deviceType = BarCodeReaderDeviceType.Opticon;
	// ******************** END Custom Code
		deviceType = BarCodeReaderDeviceType.Intermec;
	string className = null;
	// ******************** START Custom Code
		case BarCodeReaderDeviceType.Opticon:
        	className = "UIOptionView.BarCodeReaderOpticon";
	// ******************** END Custom Code

		case BarCodeReaderDeviceType.Symbol:
			className = "UIOptionView.BarCodeReaderSymbol";
		case BarCodeReaderDeviceType.Intermec:
			className = "UIOptionView.BarCodeReaderIntermec";
		case BarCodeReaderDeviceType.Ingenico:
			className = "UIOptionView.BarCodeReaderIngenico";
		case BarCodeReaderDeviceType.Psion:
			className = "UIOptionView.BarCodeReaderPsion";
			case BarCodeReaderDeviceType.None:

	// if no device detected return null
	if (string.IsNullOrEmpty(className))
		return null; //throw new NotSupportedException("BarCode Reader not supported on that device");
	// get device bar code reader
	#if DEBUG
	TagReader reader;
		reader = (TagReader)Activator.CreateInstance(Type.GetType(className));
		reader = new BarCodeReaderDebug();
	reader.IsEnabled = true;
	var reader = (TagReader)Activator.CreateInstance(Type.GetType(className));
	reader.IsEnabled = true;
	return reader;
  1. Add into the BarCodeUtil class new IsOpticonDevice method to get whether the device is Opticon.
  2. Now, you need to create your own BarCodeReaderOpticon class. This new class is inherited from the TagReader object.
  3. In this class, you need to override the IsEnabled property to get or set whether barcode reading is enabled.
  4. E.g. check the BarCodeReaderPsion.cs where you can find how to do that.
  5. Into the event, which fires when the device is reading a barcode, call the OnTagRead method.
  6. E.g. check the BarCodeReaderPsion.cs where you can find how to do that.

Barcode scanner sample will be accessible only for users with active subscription.

Product info:


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Peter Hanustiak
No Biography provided

Comments and Discussions

Questiongood idea and a question Pin
Nicola Tesla22-Jun-17 11:58
MemberNicola Tesla22-Jun-17 11:58 
Questiongreat idea Pin
RescoDeveloper.Net3-Oct-12 23:56
MemberRescoDeveloper.Net3-Oct-12 23:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.