|
|
(One intermediate revision by one other user not shown) |
Line 1: |
Line 1: |
| WebSerial is a suggested API that would provide a way for websites to to read and write from a serial device through Javascript.
| | This has moved to [https://github.com/whatwg/serial/wiki the WHATWG's Serial API repo] on GitHub. |
|
| |
|
| The idea behind it is to bridge the web and the physical world, and communicate with devices such as Arduinos, 3D printers, and other Serial devices. This is currently only available to desktop apps, or to websites through the use of insecure and outdated technologies (Java Applets, NPAPI plugins).
| | [[Category:Web APIs]] |
| | |
| Chrome already has an [http://developer.chrome.com/apps/serial.html implementation] available for Chrome Apps, but by being available only for packaged chrome apps, it's moving further away from the idea of the open web and the idea that the web is the platform.
| |
| | |
| == Security Implications ==
| |
| One needs to consider the security implications of giving access to hardware and connected devices to websites. The solution should not be any different than the geolocation and camera APIs, as in asking the user to give access to each particular website, but it should be investigated nonetheless.
| |
| | |
| == Suggested API ==
| |
| Serial communication APIs are generally pretty straightforward. Chrome's API is actually quite a good reference API, and there are more provided below. Here is a (very early) draft of the suggested API.
| |
| * getPorts()
| |
| * open()
| |
| * close()
| |
| * read()
| |
| * write()
| |
| * flush()
| |
| * getControlSignals()
| |
| * setControlSignals()
| |
| | |
| == Implementation ==
| |
| The WebSerial API could be implemented using the [https://github.com/wjwwood/serial serial] library by wjwwood, also used in [http://wiki.ros.org/ ROS]. It's a very good, open-source, stable C++ library with a clear documentation, and it's MIT-licensed.
| |
| | |
| == Reference APIs ==
| |
| * [https://github.com/voodootikigod/node-serialport node-serialport (Node.js SerialPort API)] (most widely used JavaScript-centric serialport API)
| |
| * [http://developer.chrome.com/apps/serial.html chrome.serial (Serial API for Chrome Apps)]
| |
| * [http://pyserial.sourceforge.net/pyserial_api.html pySerial]
| |
| * [http://williamjwoodall.com/serial/doc/1.1.0/classserial_1_1_serial.html serial (c++ library for ROS)]
| |
| * [http://www.boost.org/doc/libs/1_40_0/doc/html/boost_asio/overview/serial_ports.html Boost's Serial API]
| |