Implementing a Custom DLL
In this article
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 is no longer included in the Hardware Station installer. It is available in the LS-HardwareStation-OPOS repository on GitHub. Access to this repository must be requested by submitting a support ticket to LS Retail; it is not provided through the installer.
The repository has a specific folder for each device type, and in each of those folders you find a .NET Class Library Project. The LSOposControls.DLL and LSOposDevicesUtils.DLL that you reference when building a project are still included in the Hardware Station installer, in the C:\Program Files (x86)\LS Retail\LSHardwareStation\Devices\OPOS folder.
LS OPOS Controls and Devices Utils
The LSOposControls.DLL and LSOposDevicesUtils.DLL should be referenced when creating projects (see more details here). They are located in the C:\Program Files (x86)\LS Retail\LSHardwareStation\Devices\OPOS folder of the installation. These DLLs contain 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 LSOposControls.DLL and LSOposDevicesUtils.DLL reference assemblies. The source code for the OPOS Device Class Implementations is not installed with the product and must be requested from the LS-HardwareStation-OPOS repository on GitHub.
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.8 and later versions as well. |
|
|
The Hardware Station needs to be installed on the computer where the development is being done. For more detailed information see 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. |