Implementing a Custom DLL

In this article

OPOS

Source Code

Error handling

Prerequisites to start a custom implementation

How to create and implement a custom device

When implementing a custom DLL for the Hardware Station, it is important to configure your environment in a proper way so that everything will work well together. Go through all the sections here below, and make sure that you have everything set up and configured.

Note: These instructions are for programmers with knowledge and experience of development in LS Central, .NET/C#, and Visual Studio.

This article explains what the OPOS Device Implementation Source Code is, and shows you how you can create your own device implementation class or modify an existing one.

OPOS

LS Central uses Curtis Monroe’s Common Control Objects to communicate with Service Objects (Device Drivers). This way of using Control Object and Service Objects that communicate with COM, is called OPOS (Ole for POS). You can find more information on this on Curtis Monroe’s website www.monroecs.com.

We stretch the “OPOS” word a bit in this context, because some devices like the Generic Serial Device and the Dallas Key Device are not part of the official OPOS Standard but, in LS Central, we still put them under the group of OPOS Devices.

Source Code

The source code for the standard device implementation in the Hardware Station is included in the Hardware Station installer and can be found at C:\Program Files (x86)\LS Retail\LSHardwareStation\Devices\Source.

This folder has a specific folder for each device type, and in each of those folders you will find a .NET Class Library Project as well as a separate folder for the LSOposControls.DLL.

LS OPOS Controls

The LSOposControls is a special folder only to contain the LSOposControl.DLL that should be referenced when doing creating projects (see more details here). This DLL contains the Device base class and all the interfaces that you need to be able to create a custom solution (IPrinter, IScanner, and so on).

The Device class contains implementation of basic OPOS Functions, such as OpenDevice, ClaimDevice, ReleaseDevice, CloseDevice, and so on, that are common to all OPOS Devices.

The Interfaces are specific for each device type, and are used in the LS Central POS “Add-in” (and the Hardware Station) to access and invoke functions and properties in the implementation classes.

Note: The Hardware Station installer includes the source code for the OPOS Device Class Implementations from version 7.1

Device Class Project

Each project folder contains a C# Project (.csproj) file that opens with Visual Studio. One class file (.cs) is usually in the project that contains the implementation for the specified device.

It is possible to run the device implementation in debug mode to see how the Hardware Station is communicating with the DLL. The article How to: Debug Existing Device Implementation Using Hardware Station has all the configurations regarding how to run the Hardware Station using a code within a solution.

Error handling

Generally, all functions that can fail return a Boolean value to indicate success or failure of the function call. If the result is a failure, the function GetLastError should return a description of the error that occurred.

 

Prerequisites to start a custom implementation

The Hardware Station is developed in Visual Studio 2019 or later using .NET framework 4.0 and later versions as well.
The Hardware Station needs to be installed on the computer where the development is being done. Please see more detailed information on How to install the Hardware Station.

How to create and implement a custom device

Follow instructions in How to: Create a Custom Solution for Hardware Station to create a new solution for your customization and to learn how to run it using the installed Hardware Station.
Follow instructions in How to: Debug Existing Device Implementation Using Hardware Station to see how you can debug the standard Hardware Station functionality for each device.
Follow instructions in How to: Implement a Custom Device for Hardware Station on how to start implementing a custom device functionality.
Click here to see how to create a device in the Management Portal and configure it to use the customized DLL.