简体   繁体   English

在 Chrome Web Serial API 上获取串口信息

[英]Getting Serial port info on Chrome Web Serial API

I'm using the Chrome Web Serial API.我正在使用 Chrome Web 串行 API。 So far it's working fine, but now and I'm trying to get the (already opened) port metadata (port name, device ID, etc.) and I'm a bit lost.到目前为止,它运行良好,但现在我正在尝试获取(已打开)端口元数据(端口名称、设备 ID 等),但我有点迷茫。

Here are the steps to follow: https://wicg.github.io/serial/#getting-serial-port-metadata but so far I cannot get the information.以下是要遵循的步骤: https : //wicg.github.io/serial/#getting-serial-port-metadata但到目前为止我无法获取信息。

If I try by navigating the port class, the DevTools console trows "ƒ () { [native code] }".如果我尝试导航端口类,DevTools 控制台会显示“ƒ () { [native code] }”。

I cannot find a suitable example of how to implement this.我找不到一个合适的例子来说明如何实现这一点。 Does anyone have a hint?有人有提示吗? Thanks in advance!!提前致谢!!

Daniel.丹尼尔。

It seems like it hasn't been implemented in Chromium yet.似乎它还没有在 Chromium 中实现。 Keep in mind that the specs are sort of guides for vendors to follow when implementing a feature, but the actual shipped implementation can differ.请记住,规范是供应商在实现功能时遵循的某种指南,但实际交付的实现可能会有所不同。

If you check the Web Serial API's code in the Chromium repo for Chrome 80 (current version at the time of writing) and 84.0.4112.1 you'll see that they only include the following methods:如果您检查 Chrome 80 (撰写本文时的当前版本)和84.0.4112.1的 Chromium 存储库中的 Web 串行 API 代码,您将看到它们仅包含以下方法:

open
readable
writable
getSignals
setSignals
close

You can read the latest comments on this API here: https://bugs.chromium.org/p/chromium/issues/detail?id=884928您可以在此处阅读有关此 API 的最新评论: https : //bugs.chromium.org/p/chromium/issues/detail?id=884928

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Chrome 和 Web 串行 API。 如何在不询问的情况下获取端口 - Chrome & Web Serial API. How to get port without asking Chrome 中的串口通信 - Serial Port communication in Chrome 谷歌浏览器 Web 串行 API:意外行为 - Google Chrome Web Serial API: unexpected behaviour Web Serial Api ->{value,done} -> 即使在读取了串口设备发送的全部数据后,done 也没有变为 true - Web Serial Api ->{value,done} -> the done is not getting true even after reading the whole data sent by the serial port device Chrome Web Serial API 在 VueJs Web 应用程序中不起作用 - Chrome Web Serial API not working in VueJs Web app Web Serial API - Uncaught (in promise) DOMException: Failed to open serial port / required member baudRate is undefined - Web Serial API - Uncaught (in promise) DOMException: Failed to open serial port / required member baudRate is undefined 在 Chrome 上的 Web Serial API 中获取连接设备的名称 - Get name of connected device in Web Serial API on Chrome 网站上的谷歌浏览器扩展串口 - Google Chrome Extension serial port on website chrome扩展 - 从串口读取 - chrome extension - reading from serial port 编写Chrome扩展程序以控制串行端口 - Writing chrome extension to control serial port
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM