在2017年,如何从用户的串行端口读取网页? [英] How can a web page read from the user's serial port - in the year 2017?

查看:80
本文介绍了在2017年,如何从用户的串行端口读取网页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须从头开始重新实现现有系统。

I have to re-implement an existing system from scratch.

有一次,当用户导航到某个网页时,服务器必须从用户的串行端口读取数据。

At one point, when the user navigates to a certain web page the server must read data from the user's serial port.

当前,该网页具有ActiveX控件;当页面加载完成后,ActiveX控件会调用用户PC上的COM DLL,该COM DLL从串行端口读取数据。

Currently, the web page has an ActiveX control; when the page is loaded the ActiveX control calls into a COM DLL on the user's PC which reads data from the serial port.

该系统已有10年的历史了。有什么更好的方法可以实现这一目标?

The system is 10 years old. Is there any "better" way that I could implement this?

例如,过去十年来技术一直在进步。而且该解决方案似乎仅在MS IE中有效,MS IE现在的市场份额约为26%(在2013年,当我上次更新此问题时,它的市场份额已经达​​到了。截至2107年2月,MS IE的市场份额为3-4%,Edge的市场份额为2%)。 1-2%。由于Edge也是MS产品,它 可能 支持Active X-我没有尝试过,Otoh,因为它是全新的,所以

For instance, technology has move on in the last ten years. And this solution seems only to work in MS IE, which now has a market share of about 26% (it had, in 2013, when I last updated this question. As of Feb 2107, MS IE has 3-4% and Edge has 1-2%. As Edge is also a MS product, it might support Active X - I have not tried. Otoh, since it is new from the ground up, there is a good chance that it does not).

HTML 5是否提供了任何新的可能性?像 Cordova 这样的产品呢?

Did HTML 5 offer any new possibilities? What about products like Cordova?

还有其他可能性吗?

我可以添加Raspberry Pi来通过串行端口&并让浏览器应用程序通过RESTful服务与之通信?

Could I add a Raspberry Pi to do the reading over serial port & and have the browser app communicate with that over a RESTful service?

[更新] @ EuroMicelli说:我认为您有很好的理由来运行应用程序通过网络浏览器,而不是本地应用。我不知道我是不是在什么时候计划了原始项目(以及设计该项目的公司现在已经不存在了)。

[Update] @ EuroMicelli said "I'm going to assume that you have a very good reason to run your app from a web browser, instead of a native app". I don't know as I wasn't around when the original project was planned (and the company which designed it is now defunct).

也许他们不想要最终用户直接与数据库接口?也许基于浏览器的当时是一个新的流行词?我个人而言,桌面应用程序没有问题(因为我发现它们更易于实现),但也许我们应该考虑保留基于浏览器的功能? (此外,我可以自己处理桌面应用程序;只有从COM端口进行的基于浏览器的读取才能使我提供奖励;-)

Perhaps they didn't want the end user interfacing directly with the database? Perhaps "browser based" was a new buzzword back then? I, personally, have no problem with a desktop app (as I find them easier to implement), but maybe we should consider remaining browser based? (besides, I can handle the desktop app myself; it's only browser based reading from the COM port that leads me to offer a bonus ;-)

推荐答案

只是命名另一个(更像是物联网)选项:外部硬件。

Just to name another (more like "web-of-things") option: external hardware.

根据使用情况,您可以使用外部低成本设备,例如arduino微控制器或树莓派嵌入式PC。

Depending on the use-case you COULD use an external low cost device like an arduino microcontroller or raspberry-pi embedded pc.

在这类设备上构建简单的串行到Web服务的桥梁并不是很困难。您可以使用一些类似这样的项目: https://code.google.com/p/serwebproxy/

It's not very difficult to build a simple serial to web-service bridge upon these kind of devices. You could use some projects like this e.g. : https://code.google.com/p/serwebproxy/

在这种情况下,所有低级别的东西都由外部硬件处理,并通过诸如接口(通过get / post)之类的Web服务提供给您。

In such a scenario all the low level stuff is handled by the external hardware and is offered to you by a web-service like interface (via get/post).

进一步的优势在于,运行应用程序的PC不需要串行端口(在某些系统上这种情况很少见)。

Further advantage is that the pc, where you application runs on, doesn't need a serial port (which becomes quite rare on some systems).

从浏览器应用程序中,您可以通过简单的ajax调用查询嵌入式设备上的Web服务。该浏览器根本不需要任何插件,该解决方案可以跨平台运行,并且通用且独立于不久的将来浏览器技术的发展。

From your browser application you could query the web-service on the embedded device with a simple ajax call. The browser wouldn't need any plugin at all, the solution works cross plattform and is generic and independent from the development of browser-technologies in the near future.

这篇关于在2017年,如何从用户的串行端口读取网页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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