@blueyerobotics/blueye-ts 3.9.0 → 3.10.0
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/dist/src/binlog-parser.d.ts +14 -0
- package/dist/src/binlog-parser.js +22 -1
- package/package.json +1 -1
|
@@ -35,4 +35,18 @@ export declare const parseMessages: (decompressed: Uint8Array, fixTimes?: boolea
|
|
|
35
35
|
* @param messages The messages to fix the times for.
|
|
36
36
|
* @returns The messages with corrected times.
|
|
37
37
|
*/
|
|
38
|
+
/**
|
|
39
|
+
* Parse a single varint-prefixed BinlogRecord from raw (uncompressed) bytes.
|
|
40
|
+
* Used for streaming playback where individual frames are fetched via HTTP Range requests.
|
|
41
|
+
* @param bytes Raw bytes containing a single varint-length-prefixed BinlogRecord.
|
|
42
|
+
* @returns The parsed message, or null if the record is not a known protocol type.
|
|
43
|
+
*/
|
|
44
|
+
export declare const parseFrame: (bytes: Uint8Array) => Message | null;
|
|
45
|
+
/**
|
|
46
|
+
* Parse multiple contiguous varint-prefixed BinlogRecords from raw (uncompressed) bytes.
|
|
47
|
+
* Used for streaming playback where frame batches are fetched via HTTP Range requests.
|
|
48
|
+
* @param bytes Raw bytes containing one or more varint-length-prefixed BinlogRecords.
|
|
49
|
+
* @returns An array of parsed messages.
|
|
50
|
+
*/
|
|
51
|
+
export declare const parseFrames: (bytes: Uint8Array) => Message[];
|
|
38
52
|
export declare const fixMessageTimes: (messages: Message[]) => Message[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fixMessageTimes = exports.parseMessages = exports.decompress = exports.parse = void 0;
|
|
3
|
+
exports.fixMessageTimes = exports.parseFrames = exports.parseFrame = exports.parseMessages = exports.decompress = exports.parse = void 0;
|
|
4
4
|
const protocol_definitions_1 = require("@blueyerobotics/protocol-definitions");
|
|
5
5
|
const wire_1 = require("@bufbuild/protobuf/wire");
|
|
6
6
|
const buffer_1 = require("buffer");
|
|
@@ -115,6 +115,27 @@ exports.parseMessages = parseMessages;
|
|
|
115
115
|
* @param messages The messages to fix the times for.
|
|
116
116
|
* @returns The messages with corrected times.
|
|
117
117
|
*/
|
|
118
|
+
/**
|
|
119
|
+
* Parse a single varint-prefixed BinlogRecord from raw (uncompressed) bytes.
|
|
120
|
+
* Used for streaming playback where individual frames are fetched via HTTP Range requests.
|
|
121
|
+
* @param bytes Raw bytes containing a single varint-length-prefixed BinlogRecord.
|
|
122
|
+
* @returns The parsed message, or null if the record is not a known protocol type.
|
|
123
|
+
*/
|
|
124
|
+
const parseFrame = (bytes) => {
|
|
125
|
+
const messages = (0, exports.parseFrames)(bytes);
|
|
126
|
+
return messages.length > 0 ? messages[0] : null;
|
|
127
|
+
};
|
|
128
|
+
exports.parseFrame = parseFrame;
|
|
129
|
+
/**
|
|
130
|
+
* Parse multiple contiguous varint-prefixed BinlogRecords from raw (uncompressed) bytes.
|
|
131
|
+
* Used for streaming playback where frame batches are fetched via HTTP Range requests.
|
|
132
|
+
* @param bytes Raw bytes containing one or more varint-length-prefixed BinlogRecords.
|
|
133
|
+
* @returns An array of parsed messages.
|
|
134
|
+
*/
|
|
135
|
+
const parseFrames = (bytes) => {
|
|
136
|
+
return (0, exports.parseMessages)(bytes, false);
|
|
137
|
+
};
|
|
138
|
+
exports.parseFrames = parseFrames;
|
|
118
139
|
const fixMessageTimes = (messages) => {
|
|
119
140
|
if (messages.length === 0)
|
|
120
141
|
return messages;
|