C#实现OPOS设备 [英] Implement OPOS Device in C#

查看:514
本文介绍了C#实现OPOS设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于一些互操作与传统POS应用,我想知道是否有可能实现在C#中的虚假OPOS设备。

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

基本上,我会实现一个假键盘即把Web请求,并通过了按键的传统应用程序。

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

有谁知道这是可能的,或者从哪里得到的文档?我想只是叫这是由注册表项配置的COM对象OPOS。所有这些都应该在C#实现的。

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#.

推荐答案

是的,它当然有可能。

您可以开发一个实现在C#OPOS预期的COM接口的OPOS SO(服务对象)。那么这可以实现任何你想要的API。

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.

我建议你下载柯蒂斯梦露的OPOS共同控制从的http://monroecs.com/oposccos.htm

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

这会给你你需要实现类型库的服务对象上,可能还有一些链接到OPOS文档。特别注意:我认为OPOS使用后期绑定,所以你将需要实现双界面

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.

一个警告:恕我直言OPOS是技术上可怕API,由一个委员会外设厂商设计揭露他们的外设功能,而不是提供POS应用程序开发人员有用的抽象。

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.

一个这样特别突出的例子是所谓的ToneIndicator装置,它公开音频发生器在富士通键盘的功能,以声音的不同音调和音量的两个音重复序列。

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.

更新

我已经实现OPOS服务对象前,但它是一个漫长的时间。这里有一些更多的信息,让你开始在POSKeyboard左右。

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.


  • 控制对象(CO)将加载您服务对象( SO)使用后期绑定。所以其实没有你实现COM IID或类型库。相反,你需要实现所有在OPOS规格(相应版本中定义的所需的方法和事件,如在此页面上的文档之一: HTTP: //monroecs.com/oposreleases.htm )。下面的信息是基于此页面上链接的1.6控制PROGRAMER指南(CPG)。

  • 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.

中央人民政府2章描述您需要实现什么。需要注意的是使用OPOS获取/设置属性的一个奇怪的方法。而控制对象(CO)公开了与明智的名称属性(例如DeviceEnabled,设备名称,DeviceDescription),这些都调用到同样的方法GetPropertyString(字符串属性)或GetPropertyNumber(整数性能),传递一个整数性能指标为定义其属性的参数是要检索。在性能指标均符合OPOS标准提供的头文件中的定义。

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.

这在CCO PosKeyboard源快速浏览,该方法需要名落实在源文件中POSKeyboardImpl.cpp s_SOMethodNames上市。

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.

您需要设置的OPOS应用程序程序员指南中定义的注册表项(APG )附录OPOS注册表用法。在你的情况,你需要创建一个注册表项HKLM\OleForRetail\ServiceOPOS\POSKeyboard\DefaultPOSKeyboard(其中DefaultPOSKeyboard是设备名称要传递Open方法)。此注册表项需要有一个默认值,它是你的爱人类的ProgID。您还可以将其他值有(由你这样用如配置信息)

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).

祝你好运与此 - 它将用大量WTF的一个痛苦的过程。

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

这篇关于C#实现OPOS设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆