You are on page 1of 14

SCANNING & MOBILITY

White Paper – Configuring, testing and writing applications with


the Honeywell OPOS suite
The Honeywell OPOS suite provides point of sale service object drivers, configuration and
validation utilities. This allows a Honeywell scanner to be configured and tested prior to being
integrated with a UPOS (Unified Point of Sale) application.

This white paper covers the Honeywell OPOS suite which supports the following products:

Xenon 1500, 1900,1902, Voyager 1200, 1202, Hyperion 1300, VuQuest 3310g.

Installation.
Download and install the OPOS Suite from the Honeywell Scanning & Mobility website. This
installation provides everything required to configure and test as well as provides ActiveX
components for developing a custom application.

Getting Started.

Honeywell provides a graphical environment in the OPOS Suite which allows straightforward
configuration and testing of a scanning device prior to commencing any development work. This
is a good starting point as the validation tools use the same class libraries and UPOS functions
that a finished POS application will use.
It also allows you to set up a scanner profile and create the correct registry profile entries.

Open the configuration utility and with the flag set to ‘Add device’ enter a profile name.

Set the Auto port detect to ‘true’ or ‘false’ (If false, select the port the device is connected to)
and click the ‘Add Device’ button to save the profile.

This is an entry from the Honeywell Imaging and Mobility Knowledge base. As part of our ongoing effort to improve and enhance the quality of
the solutions, we ask you to inform us if you feel that we can improve on the content of this solution.
For North America: natechsupport@honeywell.com or EMEA: HSMeurosupport@honeywell.com

Document Revision: 1.0


Last updated 26 March 2010
SCANNING & MOBILITY

The Validation Utility allows us to test our configuration

Select the profile created in the Configuration Utility and click the red icon to verify the device

Once the icon turns green, scan an item to verify the connection within 10 seconds.

The Advanced View provides step by step UPOS testing for both the basic and more advanced
UPOS functionality.

This is an entry from the Honeywell Imaging and Mobility Knowledge base. As part of our ongoing effort to improve and enhance the quality of
the solutions, we ask you to inform us if you feel that we can improve on the content of this solution.
For North America: natechsupport@honeywell.com or EMEA: HSMeurosupport@honeywell.com

Document Revision: 1.0


Last updated 26 March 2010
SCANNING & MOBILITY

To test basic OPOS operation, follow the sequence below

1. Select the OPOS profile and click ‘Open’


2. Click ‘ClaimDevice’
3. Under ‘Properties and Methods’ set the drop down combo boxes to true for
‘SetDeviceEnable’ and ‘SetDataEventEnabled’

This is an entry from the Honeywell Imaging and Mobility Knowledge base. As part of our ongoing effort to improve and enhance the quality of
the solutions, we ask you to inform us if you feel that we can improve on the content of this solution.
For North America: natechsupport@honeywell.com or EMEA: HSMeurosupport@honeywell.com

Document Revision: 1.0


Last updated 26 March 2010
SCANNING & MOBILITY

4. Click the ‘SetDeviceEnable’ and ‘SetDataEventEnabled’ buttons


5. Scan a bar code – the data should appear in the text area below complete with the AIM
ID.
6. Repeat steps 3 and 4 for further scans or you can keep the data event enabled by
selecting ‘Re-Enable DataEvent’ from the file menu.

7. Click the ‘ReleaseDevice’ button to release the OPOS connection when testing is
complete
8. Click ‘Close’ to close the connection.

The buttons in the ‘Properties and Methods’ frame echo the actual properties and methods
used in the driver ActiveX control so can be used to test individual functions when developing
an OPOS application. Full details can be found in the OPOS Suite help files.

Developing the application


Now the device configuration has been tested with the OPOS utilities we can move on to look at
the software development.

The following assumes that Microsoft Visual Studio .Net is being used. Any illustrations shown
below are taken from Visual Studio 2008.

The following examples and the linked source code samples illustrate the basic UPOS
functionality to open, claim & enable a connection, receive barcode data and to release and
close the connection. The first example is written in C#.

1. Create a new C# project in Visual Studio. The example code here is a Windows form
application with buttons for each of the three open and close steps. A label control displays the
bar code data.

This is an entry from the Honeywell Imaging and Mobility Knowledge base. As part of our ongoing effort to improve and enhance the quality of
the solutions, we ask you to inform us if you feel that we can improve on the content of this solution.
For North America: natechsupport@honeywell.com or EMEA: HSMeurosupport@honeywell.com

Document Revision: 1.0


Last updated 26 March 2010
SCANNING & MOBILITY

2. Add the following references to your project:

HWOPOSIMAGESCANNER.OCX and HWOPOSSCANNER.OCX – These can be found in the


C:\Program Files\Honeywell\UPOS Suite\OPOS Suite\Control Objects\.
Note: the HWOPOSIMAGESCANNER.OCX is only required for handling image capture.

5. Add the namespaces for the OPOS Scanner to your program as shown here.

6. Add code as follows:

- Declare the HandHeldScanner object and create a new instance of the object.
- Also create an event handler which will fire when the host receives data from the scanner

This is an entry from the Honeywell Imaging and Mobility Knowledge base. As part of our ongoing effort to improve and enhance the quality of
the solutions, we ask you to inform us if you feel that we can improve on the content of this solution.
For North America: natechsupport@honeywell.com or EMEA: HSMeurosupport@honeywell.com

Document Revision: 1.0


Last updated 26 March 2010
SCANNING & MOBILITY

- Add the data event code

- Add code for the Open / Claim / Enable routines. It’s a good idea to check the status of
the connection before opening it.

- Note the ‘AssignLogicalName’ and the ‘XenonP4N’ name we wish to assign. This was
the profile we created with the configuration utility earlier and saved in the Config.xml file
in the POS4NET\bin folder. If there are likely to be other scanning devices used, it would
make sense to assign the logical name dynamically rather than hard code it as here.
- The ‘control.enabled’ properties included here are merely to prevent other buttons on the
sample form being clicked out of sequence.

- Add further code to claim the scanner.

- And to enable the device and the data event

This is an entry from the Honeywell Imaging and Mobility Knowledge base. As part of our ongoing effort to improve and enhance the quality of
the solutions, we ask you to inform us if you feel that we can improve on the content of this solution.
For North America: natechsupport@honeywell.com or EMEA: HSMeurosupport@honeywell.com

Document Revision: 1.0


Last updated 26 March 2010
SCANNING & MOBILITY

- Add further code to Disable, Release and Close the connection.

Testing the application

Ensure the scanner is connected, the interface is configured correctly, and an OPOS profile has
been established.
If the source code entered is correct, it should be possible to load the application, click Open,
Claim & Enable, scan a bar code and see the scanned data appear in the ‘lblBarcode’ object.
If that’s the case then the OPOS application has been successfully created.

Further assistance for developing an application with the Honeywell OPOS driver can be found
in the help files accessed from the validation utility. This includes methods & properties for
adding additional OPOS functionality.

For full listings of the sample source code for both C# and VB.Net see the appendix section of
this document. Bear in mind that these are only samples and your application will need to be
fully error trapped and thoroughly tested in the context of your own application.

This is an entry from the Honeywell Imaging and Mobility Knowledge base. As part of our ongoing effort to improve and enhance the quality of
the solutions, we ask you to inform us if you feel that we can improve on the content of this solution.
For North America: natechsupport@honeywell.com or EMEA: HSMeurosupport@honeywell.com

Document Revision: 1.0


Last updated 26 March 2010
SCANNING & MOBILITY

Appendix 1 – C# Code listing

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using OposScanner_CCO;

namespace OPOS_Suite_Csharp
{
public partial class frmTestOPOS : Form
{
public OPOSScanner mScanner; //declare OPOSscanner object

public frmTestOPOS()
{
InitializeComponent();
mScanner = new OPOSScanner(); //create new scanner object instance
mScanner.DataEvent += new
_IOPOSScannerEvents_DataEventEventHandler(mScanner_DataEvent); //create data event

void mScanner_DataEvent(int Status) //data event


{
string sBarcode = "";

sBarcode = mScanner.ScanData;
lblData.Text = "Scan Data: " + sBarcode;

mScanner.DataEventEnabled = true;

private void btnOpen_Click(object sender, EventArgs e)


{

This is an entry from the Honeywell Imaging and Mobility Knowledge base. As part of our ongoing effort to improve and enhance the quality of
the solutions, we ask you to inform us if you feel that we can improve on the content of this solution.
For North America: natechsupport@honeywell.com or EMEA: HSMeurosupport@honeywell.com

Document Revision: 1.0


Last updated 26 March 2010
SCANNING & MOBILITY

try
{
if (txtProfile.Text == "")
{
MessageBox.Show("Please Enter a Profile Name"); //make sure a
profile name is entered
return;
}
//check if connection is open and if not open it
if (mScanner.State == 1) // 1=closed
{
mScanner.Open(txtProfile.Text);
btnClaim.Enabled = true;
btnOpen.Enabled = false;
btnClose.Enabled = true;
return;
}
}
catch (Exception Ex)
{
MessageBox.Show(Ex.Message);
btnClaim.Enabled = false;
return;
}

private void btnClaim_Click(object sender, EventArgs e)


{

try
{
if (mScanner.Claimed == false)
{
mScanner.ClaimDevice(5000); //claim device with timeout

btnEnable.Enabled = true;
btnClaim.Enabled = false;
btnRelease.Enabled = true;
lblData.Text = "Scan Data: ";
return;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
btnEnable.Enabled = false;
return;
}
}

private void btnEnable_Click(object sender, EventArgs e)


{
try
{
if (mScanner.DeviceEnabled == false) //if not already enabled then
enable it
{
mScanner.DeviceEnabled = true;
This is an entry from the Honeywell Imaging and Mobility Knowledge base. As part of our ongoing effort to improve and enhance the quality of
the solutions, we ask you to inform us if you feel that we can improve on the content of this solution.
For North America: natechsupport@honeywell.com or EMEA: HSMeurosupport@honeywell.com

Document Revision: 1.0


Last updated 26 March 2010
SCANNING & MOBILITY

mScanner.DataEventEnabled = true;
btnDisable.Enabled = true;
btnEnable.Enabled = false;
btnClose.Enabled = false;
btnRelease.Enabled = false;
}
}
catch (Exception Ex)
{
MessageBox.Show(Ex.Message);
btnDisable.Enabled = false;
return;
}

private void btnDisable_Click(object sender, EventArgs e)


{
try
{
if (mScanner.DeviceEnabled == true) //if not already disabled,
disable it
{
mScanner.DeviceEnabled = false;
}
mScanner.DataEventEnabled = false;
btnEnable.Enabled = true;
btnRelease.Enabled = true;
btnDisable.Enabled = false;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void btnRelease_Click(object sender, EventArgs e)


{
try
{
if (mScanner.Claimed == true)
{
mScanner.ReleaseDevice(); //Release device

btnRelease.Enabled = false;
btnClose.Enabled = true;
btnClaim.Enabled = true;
btnEnable.Enabled = false;
lblData.Text = "Scan Data: ";
return;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
btnRelease.Enabled = false;
return;
}
}
This is an entry from the Honeywell Imaging and Mobility Knowledge base. As part of our ongoing effort to improve and enhance the quality of
the solutions, we ask you to inform us if you feel that we can improve on the content of this solution.
For North America: natechsupport@honeywell.com or EMEA: HSMeurosupport@honeywell.com

Document Revision: 1.0


Last updated 26 March 2010
SCANNING & MOBILITY

private void btnClose_Click(object sender, EventArgs e)


{
try
{
if (mScanner.State == 2) //2=open - if its 2 then close it.
{
mScanner.Close();
btnClose.Enabled = false;
btnClaim.Enabled = false;
btnOpen.Enabled = true;
lblData.Text = "Scan Data: ";
return;
}
}
catch (Exception Ex)
{
MessageBox.Show(Ex.Message);
btnClose.Enabled = false;
return;
}
}

}
}

Appendix 2 – VB.Net Code listing

Imports OposScanner_CCO
Imports OposImageScanner_CCO

Public Class frmVBtest


Private WithEvents mScanner As New OPOSScanner

Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnOpen.Click
Try
If txtProfile.Text = "" Then
MsgBox("Please Enter a Profile Name", MsgBoxStyle.Exclamation +
MsgBoxStyle.OkOnly, "OPOS")
This is an entry from the Honeywell Imaging and Mobility Knowledge base. As part of our ongoing effort to improve and enhance the quality of
the solutions, we ask you to inform us if you feel that we can improve on the content of this solution.
For North America: natechsupport@honeywell.com or EMEA: HSMeurosupport@honeywell.com

Document Revision: 1.0


Last updated 26 March 2010
SCANNING & MOBILITY

Exit Sub
End If
If mScanner.State = 1 Then
mScanner = New OPOSScanner

mScanner.Open(txtProfile.Text)
btnClaim.Enabled = True
btnOpen.Enabled = False
btnClose.Enabled = True

End If

Catch ex As Exception
MsgBox(ex.Message)
btnClaim.Enabled = False
Exit Sub
End Try
End Sub

Private Sub btnClaim_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnClaim.Click
Try
If Not mScanner.Claimed Then
mScanner.Claim(5000)

End If
btnEnable.Enabled = True
btnClaim.Enabled = False
btnRelease.Enabled = True
Catch ex As Exception
MsgBox(ex.Message)
btnEnable.Enabled = False
Exit Sub
End Try
End Sub

Private Sub btnEnable_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnEnable.Click
Try
If Not mScanner.DeviceEnabled Then 'If scanner not enabled already then
enable it
mScanner.DeviceEnabled = True
End If

btnDisable.Enabled = True
btnEnable.Enabled = False
btnClose.Enabled = False
btnRelease.Enabled = False
'enable data event
mScanner.DataEventEnabled = True

Catch ex As Exception
MsgBox(ex.Message)
btnDisable.Enabled = False
End Try
End Sub

Private Sub btnDisable_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnDisable.Click
This is an entry from the Honeywell Imaging and Mobility Knowledge base. As part of our ongoing effort to improve and enhance the quality of
the solutions, we ask you to inform us if you feel that we can improve on the content of this solution.
For North America: natechsupport@honeywell.com or EMEA: HSMeurosupport@honeywell.com

Document Revision: 1.0


Last updated 26 March 2010
SCANNING & MOBILITY

Try
If mScanner.DeviceEnabled Then
mScanner.DeviceEnabled = False
End If

btnEnable.Enabled = True
btnRelease.Enabled = True
btnDisable.Enabled = False
lblBarcode.Text = "Scan Data: "
Catch ex As Exception
MsgBox(ex.Message)
btnEnable.Enabled = False

End Try

End Sub

Private Sub mScanner_DataEvent(ByVal Status As Integer) Handles


mScanner.DataEvent
Dim sBarcode As String = ""
Dim sPrefix As String = ""

'Dim txtEnc As System.Text.Encoding = New System.Text.ASCIIEncoding

sBarcode = mScanner.ScanData
sPrefix = Strings.Left(sBarcode, 4)
sBarcode = Mid(sBarcode, 5)

mScanner.DataEventEnabled = True
lblBarcode.Text = "Scan Data: " & sBarcode
End Sub

Private Sub btnRelease_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnRelease.Click
Try
If mScanner.Claimed Then
mScanner.Release()

End If
btnRelease.Enabled = False
btnClose.Enabled = True
btnClaim.Enabled = True
btnEnable.Enabled = False
lblBarcode.Text = "Scan Data: "
Catch ex As Exception
MsgBox(ex.Message)
btnRelease.Enabled = False
End Try
End Sub

Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnClose.Click
Try
If mScanner.State = 2 Then
mScanner.Close()

End If
btnClose.Enabled = False
This is an entry from the Honeywell Imaging and Mobility Knowledge base. As part of our ongoing effort to improve and enhance the quality of
the solutions, we ask you to inform us if you feel that we can improve on the content of this solution.
For North America: natechsupport@honeywell.com or EMEA: HSMeurosupport@honeywell.com

Document Revision: 1.0


Last updated 26 March 2010
SCANNING & MOBILITY

btnClaim.Enabled = False
btnOpen.Enabled = True
lblBarcode.Text = "Scan Data: "
Catch ex As Exception
MsgBox(ex.Message)
btnClose.Enabled = False
End Try
End Sub

End Class

Revision History
Rev Date Changed by: Details / Comments
V1.0 03/09/2011 Chris Ingram Document created

This is an entry from the Honeywell Imaging and Mobility Knowledge base. As part of our ongoing effort to improve and enhance the quality of
the solutions, we ask you to inform us if you feel that we can improve on the content of this solution.
For North America: natechsupport@honeywell.com or EMEA: HSMeurosupport@honeywell.com

Document Revision: 1.0


Last updated 26 March 2010