node-mavlink 1.5.0 → 1.5.1
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 +13 -6
- package/examples/send-receive-udp.ts +14 -7
- package/package.json +1 -1
package/README.md
CHANGED
@@ -68,15 +68,22 @@ Sending messages is also very easy. One example that is very useful is to send t
|
|
68
68
|
```javascript
|
69
69
|
import { MavLinkProtocolV2, send } from 'node-mavlink'
|
70
70
|
|
71
|
-
// Create an instance of of the `
|
72
|
-
// for containing the command data
|
73
|
-
|
74
|
-
|
75
|
-
|
71
|
+
// Create an instance of of the `RequestProtocolVersionCommand`
|
72
|
+
// class that will be the vessel for containing the command data.
|
73
|
+
// Underneath the cover it uses CommandLong to convert the data.
|
74
|
+
//
|
75
|
+
// By convention the intermediate fields that are then serialized
|
76
|
+
// are named with `_` (underscore) prefix and should not be used
|
77
|
+
// directly. That doesn't mean you can't use them, but if there
|
78
|
+
// is a equivalend Command class it is just a lot easier and every
|
79
|
+
// parameter not only has a more descriptive names but also in-line
|
80
|
+
// documentation.
|
81
|
+
const command = new common.RequestProtocolVersionCommand()
|
82
|
+
command.confirmation = 1
|
76
83
|
|
77
84
|
port.on('open', async () => {
|
78
85
|
// the port is open - we're ready to send data
|
79
|
-
await send(port,
|
86
|
+
await send(port, command, new MavLinkProtocolV2())
|
80
87
|
})
|
81
88
|
```
|
82
89
|
|
@@ -37,13 +37,20 @@ async function main() {
|
|
37
37
|
}
|
38
38
|
})
|
39
39
|
|
40
|
-
//
|
41
|
-
//
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
40
|
+
// Create an instance of of the `RequestProtocolVersionCommand`
|
41
|
+
// class that will be the vessel for containing the command data.
|
42
|
+
// Underneath the cover it uses CommandLong to convert the data.
|
43
|
+
//
|
44
|
+
// By convention the intermediate fields that are then serialized
|
45
|
+
// are named with `_` (underscore) prefix and should not be used
|
46
|
+
// directly. That doesn't mean you can't use them, but if there
|
47
|
+
// is a equivalend Command class it is just a lot easier and every
|
48
|
+
// parameter not only has a more descriptive names but also in-line
|
49
|
+
// documentation.
|
50
|
+
const command = new common.RequestProtocolVersionCommand()
|
51
|
+
command.confirmation = 1
|
52
|
+
|
53
|
+
await port.send(command)
|
47
54
|
|
48
55
|
// Give the system time to process any incoming acknowledges
|
49
56
|
const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms))
|