node-mavlink 1.1.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -1
- package/dist/lib/logger.d.ts +2 -1
- package/dist/lib/logger.d.ts.map +1 -0
- package/dist/lib/logger.js +119 -1
- package/dist/lib/mavesp.d.ts +3 -1
- package/dist/lib/mavesp.d.ts.map +1 -0
- package/dist/lib/mavesp.js +101 -1
- package/dist/lib/mavlink.d.ts +16 -9
- package/dist/lib/mavlink.d.ts.map +1 -0
- package/dist/lib/mavlink.js +704 -1
- package/dist/lib/serialization.d.ts +9 -49
- package/dist/lib/serialization.d.ts.map +1 -0
- package/dist/lib/serialization.js +184 -1
- package/dist/lib/utils.d.ts +5 -4
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +77 -1
- package/examples/parse-tlog-file.ts +43 -0
- package/examples/send-receive-file.ts +6 -2
- package/examples/vtol.tlog +0 -0
- package/package.json +11 -9
- package/sanity-check.cjs +8 -0
- package/sanity-check.mjs +8 -0
- package/.vscode/launch.json +0 -19
- package/.vscode/settings.json +0 -3
- package/coverage/coverage-final.json +0 -1
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -101
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/serialization.ts.html +0 -613
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov.info +0 -0
- package/index.ts +0 -5
- package/jest.config.js +0 -5
- package/lib/logger.ts +0 -128
- package/lib/mavesp.ts +0 -112
- package/lib/mavlink.ts +0 -796
- package/lib/serialization.test.ts +0 -256
- package/lib/serialization.ts +0 -176
- package/lib/utils.ts +0 -75
- package/tests/data.mavlink +0 -0
- package/tests/main.ts +0 -59
- package/tsconfig.json +0 -16
package/dist/index.d.ts
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA"}
|
package/dist/index.js
CHANGED
@@ -1 +1,21 @@
|
|
1
|
-
"use strict";
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("mavlink-mappings"), exports);
|
18
|
+
__exportStar(require("./lib/utils"), exports);
|
19
|
+
__exportStar(require("./lib/logger"), exports);
|
20
|
+
__exportStar(require("./lib/mavlink"), exports);
|
21
|
+
__exportStar(require("./lib/mavesp"), exports);
|
package/dist/lib/logger.d.ts
CHANGED
@@ -29,7 +29,7 @@ export declare class Logger {
|
|
29
29
|
* @param event event to react to
|
30
30
|
* @param handler event handler
|
31
31
|
*/
|
32
|
-
static on(event: LoggerEvents, handler: (context: any, level:
|
32
|
+
static on(event: LoggerEvents, handler: (context: any, level: LogLevel, message: string) => void): void;
|
33
33
|
/**
|
34
34
|
* Removes an event handler
|
35
35
|
*
|
@@ -82,3 +82,4 @@ export declare class Logger {
|
|
82
82
|
fatal(...args: any): void;
|
83
83
|
}
|
84
84
|
export {};
|
85
|
+
//# sourceMappingURL=logger.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../lib/logger.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,oBAAY,QAAQ;IAClB,KAAK,IAAQ;IACb,KAAK,IAAQ;IACb,IAAI,IAAS;IACb,IAAI,IAAS;IACb,KAAK,IAAQ;IACb,KAAK,IAAQ;CACd;AAGD,aAAK,YAAY,GAAG,KAAK,CAAA;AACzB,aAAK,kBAAkB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;AAEpF;;GAEG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAmC;IACjE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAqB;IAE5C;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG;IAY7B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI;IAIhG;;;;;OAKG;IACH,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,kBAAkB;IAI3D,OAAO,CAAC,OAAO,CAAQ;IAEvB;;;;OAIG;gBACS,OAAO,EAAE,MAAM;IAK3B;;;;OAIG;IACH,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG;IAIlB;;;;OAIG;IACH,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG;IAIlB;;;;OAIG;IACH,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG;IAIjB;;;;OAIG;IACH,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG;IAIjB;;;;OAIG;IACH,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG;IAIlB;;;;OAIG;IACH,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG;CAGnB"}
|
package/dist/lib/logger.js
CHANGED
@@ -1 +1,119 @@
|
|
1
|
-
"use strict";
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Logger = exports.LogLevel = void 0;
|
4
|
+
const events_1 = require("events");
|
5
|
+
/**
|
6
|
+
* Level of the log entry
|
7
|
+
*/
|
8
|
+
var LogLevel;
|
9
|
+
(function (LogLevel) {
|
10
|
+
LogLevel[LogLevel["trace"] = 5] = "trace";
|
11
|
+
LogLevel[LogLevel["debug"] = 4] = "debug";
|
12
|
+
LogLevel[LogLevel["info"] = 3] = "info";
|
13
|
+
LogLevel[LogLevel["warn"] = 2] = "warn";
|
14
|
+
LogLevel[LogLevel["error"] = 1] = "error";
|
15
|
+
LogLevel[LogLevel["fatal"] = 0] = "fatal";
|
16
|
+
})(LogLevel = exports.LogLevel || (exports.LogLevel = {}));
|
17
|
+
/**
|
18
|
+
* Simplified interface for logging facilities
|
19
|
+
*/
|
20
|
+
class Logger {
|
21
|
+
static events = new events_1.EventEmitter();
|
22
|
+
static registry = {};
|
23
|
+
/**
|
24
|
+
* Gets a logger by name
|
25
|
+
*
|
26
|
+
* @param context logger context
|
27
|
+
*/
|
28
|
+
static getLogger(context) {
|
29
|
+
let name = '';
|
30
|
+
if (typeof context === 'function')
|
31
|
+
name = context.name;
|
32
|
+
else if (typeof context === 'object')
|
33
|
+
name = context.constructor.name;
|
34
|
+
else if (typeof context === 'string')
|
35
|
+
name = context;
|
36
|
+
else
|
37
|
+
throw new Error(`Do not know how to get logger for ${context} (${typeof context})`);
|
38
|
+
if (!Logger.registry[name])
|
39
|
+
Logger.registry[name] = new Logger(name);
|
40
|
+
return Logger.registry[name];
|
41
|
+
}
|
42
|
+
/**
|
43
|
+
* Binds an event handler
|
44
|
+
*
|
45
|
+
* @param event event to react to
|
46
|
+
* @param handler event handler
|
47
|
+
*/
|
48
|
+
static on(event, handler) {
|
49
|
+
this.events.on(event, handler);
|
50
|
+
}
|
51
|
+
/**
|
52
|
+
* Removes an event handler
|
53
|
+
*
|
54
|
+
* @param event event to react to
|
55
|
+
* @param handler event handler
|
56
|
+
*/
|
57
|
+
static off(event, handler) {
|
58
|
+
this.events.off(event, handler);
|
59
|
+
}
|
60
|
+
context;
|
61
|
+
/**
|
62
|
+
* Constructs a new logger instance
|
63
|
+
*
|
64
|
+
* @param context logger context
|
65
|
+
*/
|
66
|
+
constructor(context) {
|
67
|
+
this.context = context;
|
68
|
+
Logger.events.emit('logger-created', Logger.registry[context]);
|
69
|
+
}
|
70
|
+
/**
|
71
|
+
* Sends a log message if the trace level is enabled for this logger
|
72
|
+
*
|
73
|
+
* @param args parameters for the log entry
|
74
|
+
*/
|
75
|
+
trace(...args) {
|
76
|
+
Logger.events.emit('log', { context: this.context, level: LogLevel.trace, message: args });
|
77
|
+
}
|
78
|
+
/**
|
79
|
+
* Sends a log message if the debug level is enabled for this logger
|
80
|
+
*
|
81
|
+
* @param args parameters for the log entry
|
82
|
+
*/
|
83
|
+
debug(...args) {
|
84
|
+
Logger.events.emit('log', { context: this.context, level: LogLevel.debug, message: args });
|
85
|
+
}
|
86
|
+
/**
|
87
|
+
* Sends a log message if the info level is enabled for this logger
|
88
|
+
*
|
89
|
+
* @param args parameters for the log entry
|
90
|
+
*/
|
91
|
+
info(...args) {
|
92
|
+
Logger.events.emit('log', { context: this.context, level: LogLevel.info, message: args });
|
93
|
+
}
|
94
|
+
/**
|
95
|
+
* Sends a log message if the warn level is enabled for this logger
|
96
|
+
*
|
97
|
+
* @param args parameters for the log entry
|
98
|
+
*/
|
99
|
+
warn(...args) {
|
100
|
+
Logger.events.emit('log', { context: this.context, level: LogLevel.warn, message: args });
|
101
|
+
}
|
102
|
+
/**
|
103
|
+
* Sends a log message if the error level is enabled for this logger
|
104
|
+
*
|
105
|
+
* @param args parameters for the log entry
|
106
|
+
*/
|
107
|
+
error(...args) {
|
108
|
+
Logger.events.emit('log', { context: this.context, level: LogLevel.error, message: args });
|
109
|
+
}
|
110
|
+
/**
|
111
|
+
* Sends a log message if the fatal level is enabled for this logger
|
112
|
+
*
|
113
|
+
* @param args parameters for the log entry
|
114
|
+
*/
|
115
|
+
fatal(...args) {
|
116
|
+
Logger.events.emit('log', { context: this.context, level: LogLevel.fatal, message: args });
|
117
|
+
}
|
118
|
+
}
|
119
|
+
exports.Logger = Logger;
|
package/dist/lib/mavesp.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
/// <reference types="node" />
|
2
|
+
/// <reference types="node" />
|
2
3
|
import { EventEmitter } from 'events';
|
3
4
|
import { uint8_t, MavLinkData } from 'mavlink-mappings';
|
4
5
|
/**
|
@@ -6,7 +7,7 @@ import { uint8_t, MavLinkData } from 'mavlink-mappings';
|
|
6
7
|
*/
|
7
8
|
export declare class MavEsp8266 extends EventEmitter {
|
8
9
|
private input;
|
9
|
-
private socket
|
10
|
+
private socket?;
|
10
11
|
private ip;
|
11
12
|
private sendPort;
|
12
13
|
private seq;
|
@@ -44,3 +45,4 @@ export declare class MavEsp8266 extends EventEmitter {
|
|
44
45
|
private processIncommingUDPData;
|
45
46
|
private processIncommingPacket;
|
46
47
|
}
|
48
|
+
//# sourceMappingURL=mavesp.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mavesp.d.ts","sourceRoot":"","sources":["../../lib/mavesp.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAOrC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEvD;;GAEG;AACH,qBAAa,UAAW,SAAQ,YAAY;IAC1C,OAAO,CAAC,KAAK,CAAU;IACvB,OAAO,CAAC,MAAM,CAAC,CAAQ;IACvB,OAAO,CAAC,EAAE,CAAa;IACvB,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,GAAG,CAAY;;IAmBvB;;;;;OAKG;IACG,KAAK,CAAC,WAAW,GAAE,MAAc,EAAE,QAAQ,GAAE,MAAc;IAmBjE;;;;;;OAMG;IACH,IAAI,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,GAAE,OAAgC,EAAE,MAAM,GAAE,OAAiC;IAOzG;;;;;;;OAOG;IACH,UAAU,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,OAAW,EAAE,KAAK,GAAE,OAAgC,EAAE,MAAM,GAAE,OAAiC;IAQjJ;;;;OAIG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM;IAIzB,OAAO,CAAC,uBAAuB;IAO/B,OAAO,CAAC,sBAAsB;CAI/B"}
|
package/dist/lib/mavesp.js
CHANGED
@@ -1 +1,101 @@
|
|
1
|
-
"use strict";
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.MavEsp8266 = void 0;
|
4
|
+
const events_1 = require("events");
|
5
|
+
const dgram_1 = require("dgram");
|
6
|
+
const stream_1 = require("stream");
|
7
|
+
const mavlink_1 = require("./mavlink");
|
8
|
+
const mavlink_2 = require("./mavlink");
|
9
|
+
const utils_1 = require("./utils");
|
10
|
+
/**
|
11
|
+
* Encapsulation of communication with MavEsp8266
|
12
|
+
*/
|
13
|
+
class MavEsp8266 extends events_1.EventEmitter {
|
14
|
+
input;
|
15
|
+
socket;
|
16
|
+
ip = '';
|
17
|
+
sendPort = 14555;
|
18
|
+
seq = 0;
|
19
|
+
constructor() {
|
20
|
+
super();
|
21
|
+
this.input = new stream_1.PassThrough();
|
22
|
+
this.processIncommingUDPData = this.processIncommingUDPData.bind(this);
|
23
|
+
this.processIncommingPacket = this.processIncommingPacket.bind(this);
|
24
|
+
// Create the reader as usual by piping the source stream through the splitter
|
25
|
+
// and packet parser
|
26
|
+
const reader = this.input
|
27
|
+
.pipe(new mavlink_1.MavLinkPacketSplitter())
|
28
|
+
.pipe(new mavlink_1.MavLinkPacketParser());
|
29
|
+
reader.on('data', this.processIncommingPacket);
|
30
|
+
}
|
31
|
+
/**
|
32
|
+
* Start communication with the controller via MAVESP2866
|
33
|
+
*
|
34
|
+
* @param receivePort port to receive messages on (default: 14550)
|
35
|
+
* @param sendPort port to send messages to (default: 14555)
|
36
|
+
*/
|
37
|
+
async start(receivePort = 14550, sendPort = 14555) {
|
38
|
+
this.sendPort = sendPort;
|
39
|
+
// Create a UDP socket
|
40
|
+
this.socket = (0, dgram_1.createSocket)({ type: 'udp4', reuseAddr: true });
|
41
|
+
this.socket.on('message', this.processIncommingUDPData);
|
42
|
+
// Start listening on the socket
|
43
|
+
return new Promise((resolve, reject) => {
|
44
|
+
this.socket?.bind(receivePort, () => {
|
45
|
+
// Wait for the first package to be returned to read the ip address
|
46
|
+
// of the controller
|
47
|
+
(0, utils_1.waitFor)(() => this.ip !== '')
|
48
|
+
.then(() => { resolve(this.ip); })
|
49
|
+
.catch(e => { reject(e); });
|
50
|
+
});
|
51
|
+
});
|
52
|
+
}
|
53
|
+
/**
|
54
|
+
* Send a packet
|
55
|
+
*
|
56
|
+
* @param msg message to send
|
57
|
+
* @param sysid system id
|
58
|
+
* @param compid component id
|
59
|
+
*/
|
60
|
+
send(msg, sysid = mavlink_2.MavLinkProtocol.SYS_ID, compid = mavlink_2.MavLinkProtocol.COMP_ID) {
|
61
|
+
const protocol = new mavlink_2.MavLinkProtocolV2(sysid, compid);
|
62
|
+
const buffer = protocol.serialize(msg, this.seq++);
|
63
|
+
this.seq &= 255;
|
64
|
+
this.sendBuffer(buffer);
|
65
|
+
}
|
66
|
+
/**
|
67
|
+
* Send a signed packet
|
68
|
+
*
|
69
|
+
* @param msg message to send
|
70
|
+
* @param sysid system id
|
71
|
+
* @param compid component id
|
72
|
+
* @param linkId link id for the signature
|
73
|
+
*/
|
74
|
+
sendSigned(msg, key, linkId = 1, sysid = mavlink_2.MavLinkProtocol.SYS_ID, compid = mavlink_2.MavLinkProtocol.COMP_ID) {
|
75
|
+
const protocol = new mavlink_2.MavLinkProtocolV2(sysid, compid, mavlink_2.MavLinkProtocolV2.IFLAG_SIGNED);
|
76
|
+
const b1 = protocol.serialize(msg, this.seq++);
|
77
|
+
this.seq &= 255;
|
78
|
+
const b2 = protocol.sign(b1, linkId, key);
|
79
|
+
this.sendBuffer(b2);
|
80
|
+
}
|
81
|
+
/**
|
82
|
+
* Send raw data over the socket. Useful for custom implementation of data sending
|
83
|
+
*
|
84
|
+
* @param buffer buffer to send
|
85
|
+
*/
|
86
|
+
sendBuffer(buffer) {
|
87
|
+
this.socket?.send(buffer, this.sendPort, this.ip);
|
88
|
+
}
|
89
|
+
processIncommingUDPData(buffer, metadata) {
|
90
|
+
// store the remote ip address
|
91
|
+
if (this.ip === '')
|
92
|
+
this.ip = metadata.address;
|
93
|
+
// pass on the data to the input stream
|
94
|
+
this.input.write(buffer);
|
95
|
+
}
|
96
|
+
processIncommingPacket(packet) {
|
97
|
+
// let the user know we received the packet
|
98
|
+
this.emit('data', packet);
|
99
|
+
}
|
100
|
+
}
|
101
|
+
exports.MavEsp8266 = MavEsp8266;
|
package/dist/lib/mavlink.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
/// <reference types="node" />
|
2
|
+
/// <reference types="node" />
|
2
3
|
import { Transform, TransformCallback, Readable, Writable } from 'stream';
|
3
4
|
import { uint8_t, uint16_t } from 'mavlink-mappings';
|
4
5
|
import { MavLinkData, MavLinkDataConstructor } from 'mavlink-mappings';
|
@@ -7,6 +8,7 @@ import { Logger } from './logger';
|
|
7
8
|
* Header definition of the MavLink packet
|
8
9
|
*/
|
9
10
|
export declare class MavLinkPacketHeader {
|
11
|
+
timestamp: bigint | null;
|
10
12
|
magic: number;
|
11
13
|
payloadLength: uint8_t;
|
12
14
|
incompatibilityFlags: uint8_t;
|
@@ -37,11 +39,11 @@ export declare abstract class MavLinkProtocol {
|
|
37
39
|
/**
|
38
40
|
* Deserialize packet header
|
39
41
|
*/
|
40
|
-
abstract header(buffer:
|
42
|
+
abstract header(buffer: Buffer, timestamp?: bigint): MavLinkPacketHeader;
|
41
43
|
/**
|
42
44
|
* Deserialize packet checksum
|
43
45
|
*/
|
44
|
-
abstract crc(buffer:
|
46
|
+
abstract crc(buffer: Buffer): uint16_t;
|
45
47
|
/**
|
46
48
|
* Extract payload buffer
|
47
49
|
*
|
@@ -66,7 +68,7 @@ export declare class MavLinkProtocolV1 extends MavLinkProtocol {
|
|
66
68
|
static PAYLOAD_OFFSET: number;
|
67
69
|
constructor(sysid?: uint8_t, compid?: uint8_t);
|
68
70
|
serialize(message: MavLinkData, seq: number): Buffer;
|
69
|
-
header(buffer: Buffer): MavLinkPacketHeader;
|
71
|
+
header(buffer: Buffer, timestamp?: bigint): MavLinkPacketHeader;
|
70
72
|
/**
|
71
73
|
* Deserialize packet checksum
|
72
74
|
*/
|
@@ -100,13 +102,13 @@ export declare class MavLinkProtocolV2 extends MavLinkProtocol {
|
|
100
102
|
*/
|
101
103
|
sign(buffer: Buffer, linkId: number, key: Buffer, timestamp?: number): Buffer;
|
102
104
|
private calculateTruncatedPayloadLength;
|
103
|
-
header(buffer: Buffer): MavLinkPacketHeader;
|
105
|
+
header(buffer: Buffer, timestamp?: bigint): MavLinkPacketHeader;
|
104
106
|
/**
|
105
107
|
* Deserialize packet checksum
|
106
108
|
*/
|
107
109
|
crc(buffer: Buffer): uint16_t;
|
108
110
|
payload(buffer: Buffer): Buffer;
|
109
|
-
signature(buffer: Buffer, header: MavLinkPacketHeader): MavLinkPacketSignature;
|
111
|
+
signature(buffer: Buffer, header: MavLinkPacketHeader): MavLinkPacketSignature | null;
|
110
112
|
}
|
111
113
|
/**
|
112
114
|
* MavLink packet signature definition
|
@@ -176,8 +178,8 @@ export declare class MavLinkPacket {
|
|
176
178
|
readonly payload: Buffer;
|
177
179
|
readonly crc: uint16_t;
|
178
180
|
readonly protocol: MavLinkProtocol;
|
179
|
-
readonly signature: MavLinkPacketSignature;
|
180
|
-
constructor(buffer: Buffer, header?: MavLinkPacketHeader, payload?: Buffer, crc?: uint16_t, protocol?: MavLinkProtocol, signature?: MavLinkPacketSignature);
|
181
|
+
readonly signature: MavLinkPacketSignature | null;
|
182
|
+
constructor(buffer: Buffer, header?: MavLinkPacketHeader, payload?: Buffer, crc?: uint16_t, protocol?: MavLinkProtocol, signature?: MavLinkPacketSignature | null);
|
181
183
|
/**
|
182
184
|
* Debug information about the packet
|
183
185
|
*
|
@@ -194,6 +196,7 @@ export declare class MavLinkPacketSplitter extends Transform {
|
|
194
196
|
protected readonly log: Logger;
|
195
197
|
private buffer;
|
196
198
|
private onCrcError;
|
199
|
+
private timestamp;
|
197
200
|
private _validPackagesCount;
|
198
201
|
private _unknownPackagesCount;
|
199
202
|
private _invalidPackagesCount;
|
@@ -203,7 +206,7 @@ export declare class MavLinkPacketSplitter extends Transform {
|
|
203
206
|
* @param onCrcError callback executed if there is a CRC error (mostly for debugging)
|
204
207
|
*/
|
205
208
|
constructor(opts?: {}, onCrcError?: BufferCallback);
|
206
|
-
_transform(chunk: Buffer, encoding:
|
209
|
+
_transform(chunk: Buffer, encoding: string, callback: TransformCallback): void;
|
207
210
|
private findStartOfPacket;
|
208
211
|
private getPacketProtocol;
|
209
212
|
private readPacketLength;
|
@@ -246,7 +249,10 @@ export declare class MavLinkPacketParser extends Transform {
|
|
246
249
|
protected readonly log: Logger;
|
247
250
|
constructor(opts?: {});
|
248
251
|
private getProtocol;
|
249
|
-
_transform(
|
252
|
+
_transform({ buffer, timestamp, ...rest }: {
|
253
|
+
buffer?: Buffer | undefined;
|
254
|
+
timestamp?: null | undefined;
|
255
|
+
} | undefined, encoding: string, callback: TransformCallback): void;
|
250
256
|
}
|
251
257
|
/**
|
252
258
|
* Creates a MavLink packet stream reader that is reading packets from the given input
|
@@ -277,3 +283,4 @@ export declare function send(stream: Writable, msg: MavLinkData, protocol?: MavL
|
|
277
283
|
*/
|
278
284
|
export declare function sendSigned(stream: Writable, msg: MavLinkData, key: Buffer, linkId?: uint8_t, sysid?: uint8_t, compid?: uint8_t, timestamp?: number): Promise<unknown>;
|
279
285
|
export {};
|
286
|
+
//# sourceMappingURL=mavlink.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mavlink.d.ts","sourceRoot":"","sources":["../../lib/mavlink.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAEzE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAU,MAAM,kBAAkB,CAAA;AAE5D,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AAGtE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAGjC;;GAEG;AACH,qBAAa,mBAAmB;IAC9B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAO;IAC/B,KAAK,EAAE,MAAM,CAAI;IACjB,aAAa,EAAE,OAAO,CAAI;IAC1B,oBAAoB,EAAE,OAAO,CAAI;IACjC,kBAAkB,EAAE,OAAO,CAAI;IAC/B,GAAG,EAAE,OAAO,CAAI;IAChB,KAAK,EAAE,OAAO,CAAI;IAClB,MAAM,EAAE,OAAO,CAAI;IACnB,KAAK,EAAE,OAAO,CAAI;CACnB;AAED;;;;;GAKG;AACH,8BAAsB,eAAe;IACnC,SAAS,CAAC,QAAQ,CAAC,GAAG,SAAyB;IAE/C,MAAM,CAAC,IAAI,SAAY;IACvB,MAAM,CAAC,UAAU,SAAI;IACrB,MAAM,CAAC,cAAc,SAAI;IACzB,MAAM,CAAC,eAAe,SAAI;IAE1B,MAAM,CAAC,MAAM,EAAE,OA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