You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(A clear and concise description of what the proposal is.)
I will implement functions that exist on the WebSerial API on this Project as also Port the most API's of this project to WebSerial.
I want to enable Easyer Code ReUse between the both API's so that serialport and webSerialApi can be used with the same code.
Will Allow people to use node-serialport as normal with NodeJS while allowing to switch to WebSerialAPI when running in Electron or NW.JS or the Browser.
Implementation State
Adding API to node-serialport
Properties
SerialPort.readable// Read only Returns a ReadableStream for receiving data from the device connected to the port.SerialPort.writable// Read only Returns a WritableStream for sending data to the device connected to the port.
Event handlers
SerialPort.onconnect//An event handler called when the port has connected to the device.SerialPort.ondisconnect//An event handler called when the port has disconnected from the device.
Methods
SerialPort.getInfo()// Returns a Promise that resolves with an object containing properties of the port.SerialPort.open()// Returns a Promise that resolves when the port is opened. By default the port is opened with 8 data bits, 1 stop bit and no parity checking.SerialPort.setSignals()SetscontrolsignalsontheportandreturnsaPromisethatresolveswhentheyareset.SerialPort.getSignals()ReturnsaPromisethatresolveswithanobjectcontainingthecurrentstateoftheport's control signals.
SerialPort.close()ReturnsaPromisethatresolveswhentheportcloses.SerialPort.getPorts().then((ports)// a alias of SerialPort.list()SerialPort.requestPort({filters: [{ usbVendorId }]}).then((ports)// a alias of SerialPort.list().then(filter)SerialPort.pipeThrough(newTextDecoderStream())// alias pipe()SerialPort.pipeTo(appendStream);//alias pipe()
filters supports
usbVendorId: An unsigned short integer that identifies a USB device vendor.
usbProductId: An unsigned short integer that identiffies a USB device.
// TODO: event.port || event.target
navigator.serial.addEventListener("connect", (event) => {
// TODO: Automatically open event.target or warn user a port is available.
});
navigator.serial.addEventListener("disconnect", (event) => {
// TODO: Remove |event.target| from the UI.
// If the serial port was opened, a stream error would be observed as well.
});
💥 Proposal
(A clear and concise description of what the proposal is.)
I will implement functions that exist on the WebSerial API on this Project as also Port the most API's of this project to WebSerial.
I want to enable Easyer Code ReUse between the both API's so that serialport and webSerialApi can be used with the same code.
Will Allow people to use node-serialport as normal with NodeJS while allowing to switch to WebSerialAPI when running in Electron or NW.JS or the Browser.
Implementation State
Adding API to node-serialport
Properties
Event handlers
Methods
filters supports
usbVendorId: An unsigned short integer that identifies a USB device vendor.
usbProductId: An unsigned short integer that identiffies a USB device.
Web StreamAPI
Break Able Read maybe implement able via https://github.com/MattiasBuelens/web-streams-polyfill
Connect disconnect aliases open close?
Related Issues
The text was updated successfully, but these errors were encountered: