@blueyerobotics/protocol-definitions 3.2.0-0f5b72ba → 3.2.0-153cd3ce
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/package.json +1 -7
- package/README.md +0 -40
package/package.json
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blueyerobotics/protocol-definitions",
|
|
3
|
-
"version": "3.2.0-
|
|
4
|
-
"license": "LGPL-3.0-only",
|
|
5
|
-
"description": "TypeScript definitions for Blueye Robotics protocols",
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "https://github.com/BluEye-Robotics/ProtocolDefinitions.git"
|
|
9
|
-
},
|
|
3
|
+
"version": "3.2.0-153cd3ce",
|
|
10
4
|
"main": "dist/index.js",
|
|
11
5
|
"types": "dist/index.d.ts",
|
|
12
6
|
"files": ["dist"],
|
package/README.md
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# @blueyerobotics/protocol-definitions
|
|
2
|
-
|
|
3
|
-
TypeScript protobuf definitions for Blueye Robotics protocols generated using [ts-proto](https://github.com/stephenh/ts-proto).
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @blueyerobotics/protocol-definitions
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
import { blueye } from "@blueyerobotics/protocol-definitions";
|
|
15
|
-
|
|
16
|
-
// Create a new GetBatteryReq message
|
|
17
|
-
const request = blueye.protocol.GetBatteryReq.create();
|
|
18
|
-
|
|
19
|
-
// Serialize the message to a Uint8Array (binary)
|
|
20
|
-
const binary = blueye.protocol.GetBatteryReq.encode(request).finish();
|
|
21
|
-
|
|
22
|
-
// ...
|
|
23
|
-
|
|
24
|
-
// For demonstration, we will simulate a response from the device
|
|
25
|
-
const response = blueye.protocol.GetBatteryRep.create({
|
|
26
|
-
battery: {
|
|
27
|
-
level: 85,
|
|
28
|
-
voltage: 12.5,
|
|
29
|
-
temperature: 25,
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const binaryResponse = blueye.protocol.GetBatteryRep.encode(response).finish();
|
|
34
|
-
|
|
35
|
-
// Decode a binary response back into a message
|
|
36
|
-
const decoded = blueye.protocol.GetBatteryRep.decode(binaryResponse);
|
|
37
|
-
|
|
38
|
-
// Access fields
|
|
39
|
-
console.log(decoded.battery?.level);
|
|
40
|
-
```
|