我的Web应用程序如何与串行端口通信 [英] How can my web app communicate with serial port

查看:180
本文介绍了我的Web应用程序如何与串行端口通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用ASP Web API和Angle的云Web应用程序.两者都托管在天蓝色.我需要我的角度应用程序才能与串行端口通信(读/写).我该怎么办?

I have a cloud web app using asp web api and angular. Both hosted on azure. I need my angular app to be able to communicate to serial port (read/write). How can I do this?

我已经读过chrome应用程序可以连接到usb/serial,但是我仍然对其工作方式感到困惑.我应该将我的应用程序重建为chrome应用程序,还是应该创建一个单独的应用程序,还是可以编写可以打开实际网络并从当前应用程序访问序列的chrome应用程序?

I've read that chrome apps can connect to usb/serial, but i'm still confused of how it works. Should i rebuild my apps to chrome apps, or should i create a seperate apps or can i just write chrome apps that open my actual web and access the serial from my current app?

推荐答案

您不必重写应用程序.只需创建一个chrome应用程序,然后将webview用于您的实际云应用程序即可.基本上,您必须在chrome应用程序上下文中编写串行端口通信,并将数据传递到chrome应用程序(实际上是从cload加载的应用程序)中的webview上下文中.

You don't have to rewrite your app. Just create a chrome app and use webview for your actual cloud app. Basicaly you have to write the serial port communication in the chrome app context and pass the data to your webview context in your chrome app which is actually the app loaded from your cload.

其他方法是将整个应用程序编写在脱机chrome应用程序中,并与经过ajax或websocket处理的云服务器进行通信.

Other approach is to write your whole application in an offline chrome app and communicate with your cloud server trought ajax or websocket.

另一件事可能是nw.js.借助此工具,您可以使用网络技术创建类似桌面的应用程序.基本上,在您的nw.js应用中,您将使用node.js串行模块进行串行通信.

Another thing might help is nw.js. With this you can create desktop like apps with web technology. Basicaly in your nw.js app you will use a node.js serial modul for serial communication.

或结合使用这些方法.

我建议使用一种chrome应用程序方式,因为我对它的串行模块有很好的经验.

I suggest one of the chrome app way cuz I have good experience with its serial module.

这篇关于我的Web应用程序如何与串行端口通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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