[英]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.