Fix packet parser utility scrips

This commit is contained in:
MultiMote 2025-01-15 22:42:19 +03:00
parent ea2a5e5a03
commit 074b132703
2 changed files with 7 additions and 7 deletions

@ -1,4 +1,4 @@
import { Utils, NiimbotPacket, RequestCommandId, ResponseCommandId } from "../dist/index.js";
import { Utils, NiimbotPacket, RequestCommandId, ResponseCommandId, PacketParser } from "../dist/index.js";
import fs from "fs";
// usage: yarn parse-text-dump <path> [data | min | min-out | print-task]
@ -29,8 +29,8 @@ for (const line of lines) {
let comment = "";
try {
const data = Utils.hexToBuf(hexData);
const packets = NiimbotPacket.fromBytesMultiPacket(data);
const data = Utils.hexToBuf(hexData.startsWith("03") ? hexData.substring(2) : hexData);
const packets = PacketParser.parsePacketBundle(data);
if (packets.length === 0) {
comment = "Parse error (no packets found)";

@ -1,4 +1,4 @@
import { Utils, NiimbotPacket, RequestCommandId, ResponseCommandId } from "../dist/index.js";
import { Utils, NiimbotPacket, RequestCommandId, ResponseCommandId, PacketParser } from "../dist/index.js";
import { spawn } from "child_process";
const TSHARK_PATH = "C:\\Program Files\\Wireshark\\tshark.exe";
@ -54,8 +54,8 @@ spawned.on("close", (code) => {
let comment = "";
try {
const data = Utils.hexToBuf(hexData);
const packets = NiimbotPacket.fromBytesMultiPacket(data);
const data = Utils.hexToBuf(hexData.startsWith("03") ? hexData.substring(2) : hexData);
const packets = PacketParser.parsePacketBundle(data);
if (packets.length === 0) {
comment = "Parse error (no packets found)";