Chrome 扩展:如何使用串口(现在应用程序正在日落)? [英] Chrome extension: how to use serial port (now that apps are sunsetting)?

查看:157
本文介绍了Chrome 扩展:如何使用串口(现在应用程序正在日落)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目标:我正在尝试编写一个可以从我的浏览器与 Arduino 的 COM 端口通信的小东西".

Aim: I am attempting to write a little "thing" that can talk from my browser to the COM port of an Arduino.

问题:我的第一次尝试是写一个扩展.因此,我在清单文件中请求 serial 的权限.通过开发人员模式加载未打包的扩展时,我收到以下错误:'serial' is allowed for packaged apps, but this is an extension.

Issue: My first attempt is to write an extension. Therefore I am requesting permission for serial in my manifest file. When loading the unpackaged extension via developer mode I receive the following error: 'serial' is only allowed for packaged apps, but this is a extension.

我在这里看到 packaged app 是一个过时的术语,并且我猜他们只是指 Chrome 应用程序.现在不幸的是,Chrome 似乎也将这些 Chrome 应用程序作为 在这里讨论.

I see here that packaged app is an outdated term and I guess they just mean Chrome app. Now unfortunately it seems that Chrome is also discontinuing these Chrome apps as discussed here.

问题:那么我应该如何访问 Chrome 应用程序/扩展程序/您想出的任何新名称的 serial 功能?

Question: So how should I access the serial functionality of Chrome apps/extensions/whatever new name you come up with?

推荐答案

Web Serial API",navigator.serial,可能是最好的期待方式.自 chrome 77 以来,它已在 chrome://flags 中的 #enable-experimental-web-platform-features 标志后面可用.它将进入 Origin 试验 80-82 然后在 83 发货.

"Web Serial API", navigator.serial, may be the best way looking forward. It has been available behind the #enable-experimental-web-platform-features flag in chrome://flags since chrome 77. It is due to go to Origin trials 80-82 then ship in 83.

Web Serial API 允许直接来自渐进式 Web 应用的串行接口.https://codelabs.developers.google.com 有一个很好的教程/codelabs/web-serial/#0

Web Serial API allows serial interface directly from a progressive web app. There is a good tutorial at https://codelabs.developers.google.com/codelabs/web-serial/#0

您应该避免使用仅在 chrome 应用中可用的旧版 chrome.serial,因为从 2020 年 6 月起,Windows、Mac 和 Linux 上的 Chrome 应用将不再受支持.

You should probably avoid the older chrome.serial, available only in chrome apps, because from June 2020 Chrome Apps on Windows, Mac, and Linux will no longer be supported.

这篇关于Chrome 扩展:如何使用串口(现在应用程序正在日落)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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