MCP 3D Printer Server

by DMontgomery40
Verified
import EventEmitter from "node:events"; /** * A class for interfacing with a Bambu Lab printers over MQTT. * @emits update - Emitted when the printer's state is updated. * @emits connect - Emitted when the printer is connected. * @emits disconnect - Emitted when the printer is disconnected. */ export default class BambuMQTT extends EventEmitter { host: string; accessCode: string; serial: string; private client; /** * Create a new BambuMQTT instance. * @param host - The host of the printer. * @param accessCode - The access code for the printer. * @param serial - The serial number of the printer. */ constructor(host: string, accessCode: string, serial: string); /** * Connect to the printer. */ connect(): Promise<void>; /** * Disconnect from the printer. */ disconnect(): Promise<void>; /** * Send a request to the device. * @param payload - The payload to send to the device. */ sendRequest(payload: any): void; /** * Handle the connection event. */ private onConnect; /** * Handle the close event. */ private onClose; /** * Handle an incoming message. * @param topic - The topic the message was sent to. * @param message - The message payload. */ private onMessage; /** * Get the current connection status. */ get isConnected(): boolean; }