Skip to content

Commit

Permalink
Updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
eleroy committed Jun 15, 2024
1 parent cf983af commit 72f3b0a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ A lot of the API is similar, but it differs on few aspects:
- list_available_ports returns a rich structure including vid, pid, serial number
- The reading section has been reworked so that it can read long messages before sending them to the frontend resulting overall on faster read time

## Why another tauri serial plugin ?

There are two other repo for a tauri serial plugin on github:
- https://github.com/lzhida/tauri-plugin-serialport
- https://github.com/deid84/tauri-plugin-serialport

The first one is the one I forked initially, it was not compatible with tauri v2 and it was missing some features I needed (serial port details when listing them and support for DTR). The second one is very similar to the one lzhida developped but with updated dependencies and translated messages.

I reworked the source code to simplify the plugin, make it compatible with tauri v2 and added a few features.

## Installation

Expand Down Expand Up @@ -69,5 +78,7 @@ const serialPort = new SerialPort(
dtr:true
})
await serialPort.open()
await serialPort.read({timeout:10})
serialPort.listen((data) => console.log(data), decode=true)
await serialPort.write("Hello world")
```
4 changes: 2 additions & 2 deletions guest-js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class SerialPort {
parity: options.parity || "None",
stopBits: options.stopBits || "Two",
dtr: options.dtr || false,
timeout: options.timeout || 200,
timeout: options.timeout || 200,
};
}

Expand Down Expand Up @@ -217,7 +217,7 @@ export class SerialPort {
parity: this.options.parity,
stopBits: this.options.stopBits,
dtr: this.options.dtr,
timeout: this.options.timeout,
timeout: this.options.timeout,
});
this.isOpen = true;
return Promise.resolve(res);
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
},
"devDependencies": {
"@rollup/plugin-node-resolve": "13.3.0",
"@rollup/plugin-typescript": "8.3.3",
"@rollup/plugin-terser": "^0.4.4",
"rollup": "2.75.6",
"typescript": "4.7.3",
"@rollup/plugin-typescript": "8.3.3",
"prettier": "3.3.2",
"tslib": "2.6.3"
"rollup": "2.75.6",
"tslib": "2.6.3",
"typescript": "4.7.3"
},
"dependencies": {
"@tauri-apps/api": "^2.0.0-beta.13"
Expand Down

0 comments on commit 72f3b0a

Please sign in to comment.