Skip to main content

Datalogic OPOS Examples on GitHub

Building the Datalogic OPOS sample programs

The sample programs require Datalogic's OPOS to be installed. The latest release of OPOS can be downloaded via Datalogic OPOS, Overview, Releases

The Datalogic OPOSSamples repository contains C++ and C# projects (for Visual Studio 2019) demonstrating the connection to, and use of, scanners and scales. These projects do not rely upon MFC.

Steps to build and run these sample programs:

  1. Install Datalogic OPOS. This step installs the control objects required by the sample programs. This step also installs Datalogic's DualTest application.
  2. Use the DualTest application to ensure Datalogic OPOS works with your device(s). A user manual describing the operation of DualTest is included with the installation and is located in the Documentation folder. The sections Testing a Scanner and Testing a Scale will be of interest.
  3. Clone or download the Datalogic OPOSSamples repository.
  4. Build the project of interest.
  5. Run the sample application from the IDE or from an Administrator Command Prompt window. Failure to run as administrator will prevent log files from being properly recorded.

Sample program output

The output seen in the following sections was generated by the C++ sample applications and is essentially identical to that generated by the C# sample applications. Upon running the applications, assuming an unmodified installation of Datalogic's OPOS, log files capturing OPOS activity will be recorded in C:\ProgramData\Datalogic\Logs. The log files provide significant data not presented by the sample applications.

OPOSScannerSample output

OutputExplanation
Connected to:The application cycles through the commonly used scanner profiles and
displays the scanner (if any) that successfully connected.
GoodBeep( )Output reflecting example use of a DirectIO command.
DirectIOEvent(...)Related to the use of GoodBeep( ).
Data: 071357903405Retrieved ScanDataLabel.

NOTE: If the OPOSScannerSample connects to a RS232Imager and you don't see Data: when scanning, you are most likely scanning a UPC-A barcode. This issue can be solved by changing the following Windows registry entry

KeyValue NameValue
HKLM\SOFTWARE\WOW6432Node\OLEforRetail\ServiceOPOS\SCANNER\RS232ImagerTransmitUnknown1

OPOSScaleSample output

OutputExplanation
Connected to:The application cycles through the commonly used scale profiles and
displays the scale (if any) that successfully connected.
Live weighing enabled.We successfully enabled live weighing.
0.00 lb.Nothing is on the scale platter.
Scale under zero weight.The scale platter has been lifted or removed.
Scale weight unstable.The scale platter is in motion.
0.54 lb.An item is being weighed.