@v5x/serial 0.5.2 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1 +1,50 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @v5x/serial
|
|
2
|
+
|
|
3
|
+
TypeScript implementation of the VEX V5 serial protocol.
|
|
4
|
+
|
|
5
|
+
This package provides helpers for connecting to V5 devices over the Web Serial
|
|
6
|
+
API, reading device state, transferring files, and working with protocol
|
|
7
|
+
packets.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
bun add @v5x/serial
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { V5SerialConnection } from "@v5x/serial";
|
|
19
|
+
|
|
20
|
+
const connection = new V5SerialConnection(navigator.serial);
|
|
21
|
+
|
|
22
|
+
const connected = await connection.open();
|
|
23
|
+
|
|
24
|
+
if (connected) {
|
|
25
|
+
const status = await connection.getSystemStatus();
|
|
26
|
+
console.log(status);
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Web Serial is browser-only and requires a secure context, such as HTTPS or
|
|
31
|
+
`localhost`. The user must grant access to a serial device before the connection
|
|
32
|
+
can open.
|
|
33
|
+
|
|
34
|
+
## Common Exports
|
|
35
|
+
|
|
36
|
+
- `V5SerialConnection` for opening and managing a serial connection.
|
|
37
|
+
- `V5SerialDevice` for higher-level device operations.
|
|
38
|
+
- `PacketEncoder`, `DeviceBoundPacket`, and `HostBoundPacket` for low-level
|
|
39
|
+
protocol work.
|
|
40
|
+
- `ProgramIniConfig` for creating VEX program metadata.
|
|
41
|
+
- Protocol enums and types from `Vex.ts`.
|
|
42
|
+
|
|
43
|
+
## Build
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
bun run build
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The build emits JavaScript bundles to `dist/` and TypeScript declarations to
|
|
50
|
+
`dts/` and `index.d.ts`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v5x/serial",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"description": "implementation of the v5 serial protocol",
|
|
5
5
|
"main": "dist/v5-serial-protocol.cjs.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"repository": {
|
|
30
30
|
"type": "git",
|
|
31
|
-
"url": "https://github.com/
|
|
31
|
+
"url": "https://github.com/beanarchystudios/v5x.git"
|
|
32
32
|
},
|
|
33
33
|
"files": [
|
|
34
34
|
"dts/*",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"README.md"
|
|
40
40
|
],
|
|
41
41
|
"keywords": [],
|
|
42
|
-
"author": "
|
|
42
|
+
"author": "qainguin <slimaster14@gmail.com>",
|
|
43
43
|
"license": "MIT",
|
|
44
44
|
"bugs": {
|
|
45
|
-
"url": "https://github.com/
|
|
45
|
+
"url": "https://github.com/beanarchystudios/v5x/issues"
|
|
46
46
|
},
|
|
47
|
-
"homepage": "https://github.com/
|
|
47
|
+
"homepage": "https://github.com/beanarchystudios/v5x#readme",
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@babel/core": "^7.18.2",
|
|
50
50
|
"@babel/preset-env": "^7.18.2",
|