matterbridge-roborock-vacuum-plugin
Version:
Matterbridge Roborock Vacuum Plugin
40 lines • 1.9 kB
TypeScript
import { B01MapInfo } from './types.js';
/**
* A single (x, y) coordinate pair from a Q10 trace packet. Trace packets do not carry heading
* (phi), so this interface omits it unlike B01Pose.
*/
export interface B01TracePoint {
x: number;
y: number;
}
/**
* Parse the header + point-pair body of a Q10 trace packet (marker 0x02 0x01), applying the
* stray-leading-point filter to remove an occasional outlier initial point caused by firmware
* timing.
*
* Throws a plain `Error` (message starting with `Q10 trace packet:`) on invalid marker/header or
* a malformed (non-multiple-of-4) point body — callers (via B01MapParser.parseTraceBinary) must
* catch and wraps with `{ cause: err }` to preserve the original error chain.
*
* @param payload Buffer containing the complete trace packet (header + body).
* @returns An object containing the session counter and the filtered list of trace points.
*/
export declare function parseTracePacket(payload: Buffer): {
sessionCounter: number;
points: B01TracePoint[];
};
/**
* Public entry point mirroring `parseQ10MapPacket` in `b01Q10MapParser.ts`. Wraps
* `parseTracePacket`, taking the last point (current robot position) into `B01MapInfo.currentPose`.
* `rooms` is always `[]` and `mapId`/`roomMatrix` are always `undefined` — trace packets carry no
* room, map ID, or matrix data.
*
* Throws (does not swallow) on malformed input, same as `parseQ10MapPacket` — the caller
* (B01MapParser.parseTraceBinary) is responsible for catching and wrapping with `{ cause: err }`.
*
* @param payload Buffer containing the complete Q10 trace packet.
* @returns A B01MapInfo object with rooms=[], mapId=undefined, currentPose set from the last
* point (if any), and roomMatrix=undefined.
*/
export declare function parseQ10TracePacket(payload: Buffer): B01MapInfo;
//# sourceMappingURL=b01Q10TraceParser.d.ts.map