/** * Printer Status Service * * Queries printer status including paper, battery, and error states. * Works with ESC/POS printers that support status commands. * * @example * ```typescript * const status = new PrinterStatus(printer); * const paperStatus = await status.getPaperStatus(); * console.log('Paper:', paperStatus); * ``` */ /** * Paper status */ export declare enum PaperStatus { /** Paper is present and OK */ OK = "ok", /** Paper is low */ LOW = "low", /** Paper is out */ OUT = "out", /** Paper status unknown */ UNKNOWN = "unknown" } /** * Printer status */ export interface PrinterStatusInfo { /** Paper status */ paper: PaperStatus; /** Cover open (if supported) */ coverOpen?: boolean; /** Cutter error (if supported) */ cutterError?: boolean; /** Motor error (if supported) */ motorError?: boolean; /** Temperature issue (if supported) */ overTemp?: boolean; /** Battery level (0-100, if supported) */ batteryLevel?: number; /** Timestamp of status check */ timestamp: number; /** Raw status bytes */ rawStatus?: Uint8Array; } /** * Status query options */ export interface StatusQueryOptions { /** Timeout for status query in ms */ timeout?: number; /** Include raw status bytes */ includeRaw?: boolean; } /** * Printer Status Service */ export declare class PrinterStatus { private readonly logger; /** * Creates a new PrinterStatus instance */ constructor(); /** * Get printer status * * Sends ESC/POS status query command and parses the response. * * @param writeFunc - Function to write data to printer * @param readFunc - Function to read response from printer * @param options - Query options * @returns Printer status info */ getStatus(writeFunc: (data: ArrayBuffer) => Promise, readFunc: () => Promise, options?: StatusQueryOptions): Promise; /** * Parse status bytes from printer * * Different printers return different status formats. * This implementation handles common ESC/POS status responses. */ private parseStatus; /** * Check if paper is available */ checkPaper(writeFunc: (data: ArrayBuffer) => Promise, readFunc: () => Promise): Promise; /** * Check if printer is ready */ isReady(writeFunc: (data: ArrayBuffer) => Promise, readFunc: () => Promise): Promise; /** * Get human-readable status string */ static toString(status: PrinterStatusInfo): string; } export declare const printerStatus: PrinterStatus;