Implement OPOS Device in C#
Asked Answered
I

1

9

For some interop with a legacy POS application, I was wondering if it was possible to implement a phony OPOS device in C#.

Basically I would implement a phony keyboard that took web requests and passed on key presses to the legacy application.

Does anyone know if this is possible or where to get documentation? I figured OPOS just called COM objects which are configured by registry keys. All of which should be implementable in C#.

Immediately answered 2/7, 2009 at 18:52 Comment(1)
did you ever get this to work. I've just done the same my C# interface can be instantiated by some Common Control Objects but not others. Thanks.Sulph
O
14

Yes it's certainly possible.

You can develop an OPOS SO (Service Object) which implements the COM interface expected by OPOS in C#. This can then implement the API in any way you want.

I suggest you download Curtiss Monroe's OPOS Common Control Objects from http://monroecs.com/oposccos.htm.

This will give you the type libraries you need to implement for your Service object(s), and probably has some links to the OPOS documentation. NB I think OPOS uses late-binding so you will need to implement a dual interface.

A caveat: IMHO OPOS is technically a horrible API, designed by a committee peripheral vendors to expose the capabilities of their peripherals rather than to provide a useful abstraction for POS application developers.

A particularly striking example of this is the so-called ToneIndicator device, which exposes the capabilities of a tone generator in a Fujitsu keyboard to sound a repeated sequence of two tones of different pitch and volume.

UPDATE

I have implemented OPOS Service Objects before, but it's been a long time. Here's some more info to get you started on a POSKeyboard SO.

  • The Control object (CO) will load your Service Object (SO) using late-binding. So in fact there is no COM IID or type library that you implement. Instead you need to implement all the required methods and events defined in the appropriate version of the OPOS specs (e.g. one of the docs on this page: http://monroecs.com/oposreleases.htm). The info below is based on the 1.6 Control Programer's Guide (CPG) linked on this page.

  • Chapter 2 of the CPG describes what you need to implement. Note that OPOS uses a weird method for getting/setting properties. Whereas the Control Object (CO) exposes properties with sensible names (e.g. DeviceEnabled, DeviceName, DeviceDescription), these all call into the same methods GetPropertyString (for string properties) or GetPropertyNumber (for integer properties), passing an integer "property index" as an argument that defines which property is to be retrieved. The "property indexes" are all defined in header files supplied with the OPOS standard.

  • From a quick glance at the CCO PosKeyboard source, the method names you need to implement are listed in s_SOMethodNames in the source file POSKeyboardImpl.cpp.

  • The registry entries you need to set up are defined in the OPOS Application Programmer's Guide (APG) appendix "OPOS Registry Usage". In your case you will need to create a registry key HKLM\OleForRetail\ServiceOPOS\POSKeyboard\DefaultPOSKeyboard (where DefaultPOSKeyboard is the device name you are passing the Open method). This registry key needs to have a default value which is the ProgId of your SO class. You can also store other values there (e.g. configuration information used by your SO).

Good luck with this - it will be a painful process with plenty of WTF's.

Outleap answered 2/7, 2009 at 20:5 Comment(8)
Great! I thought my question might not get answered, since OPOS is quite old... I have been looking at this monroecs site for a while, it has lots of information (and is a bit confusing), but not what I specifically need. I have not exactly figured out: a) Which COM interface to implement from which dll (I assume POSKeyboard of some kind) b) How to register my dll for OPOS to use (I know HKLM\OleForRetail\ServiceObjects is the place, just need a doc on it) d) I finally want to load up the POS app (it just uses the LDN of DefaultPOSKeyboard), and see my C# code pop up some MessageBoxesImmediately
PS - it would be nice to implement the test feature a lot of devices implement from the OPOS config app.Immediately
"the OPOS config app" - which config app?Outleap
As excellent of an answer as I could get. This is something interesting to me, and if it works out I may post my results on codeplex.Immediately
Oh, the opos config app, is All-Programs->OPOS->SetupOPOS. It's under the Program Files\OPOS\Epson folder on my computer. Might be specific to Epson printers.Immediately
"Might be specific to Epson printers". Yes it is Epson-specific. Another weakness of OPOS is that it doesn't provide a standard way to configure service objects...Outleap
@Immediately Hey Jon I have the exact same questions you listed above, a,b, and d except for a Scale. Started implementing a ScaleSO with the OPOSScale as my interface but not sure what it should look like or where to put the dll afterwards. Lastly need to test that it actually works but again wish I could find a useful example out there or understand the ones that are out there better. If you did every post your results somewhere I'd love to see it. Kinda lost and I know this is old but hopefully you will see and be able to start these old connections you made :)Bair
We got this stuff to work with the keyboard OPOS interface, and had our self-checkout system talking to existing POS software via a self-hosted WCF service inside the COM interface. Sadly all I can do to help you is to offer our consulting services. It is really time consuming to figure this out. But if you have some money to pay for outsourced development on this, contact me at jonathan dot peppers at gmail dot com.Immediately

© 2022 - 2024 — McMap. All rights reserved.