import { BluetoothPrinter } from '../core/BluetoothPrinter'; import { EventEmitter } from '../core/EventEmitter'; /** * Printer connection info */ export interface PrinterConnection { /** Custom printer ID */ printerId: string; /** Device ID */ deviceId: string; /** Device name */ name: string; /** BluetoothPrinter instance */ printer: BluetoothPrinter; /** Connection timestamp */ connectedAt: number; /** Last activity timestamp */ lastActivity?: number; /** Error handler reference (for cleanup) */ errorHandler?: (error: Error) => void; } /** * Connection options */ export interface MultiConnectOptions { /** Custom printer ID (optional, auto-generated if not provided) */ printerId?: string; /** Device ID to connect */ deviceId: string; /** Connection timeout in ms */ timeout?: number; } /** * Broadcast options */ export interface BroadcastOptions { /** Parallel or sequential broadcast */ parallel?: boolean; /** Continue on individual failure */ continueOnError?: boolean; } /** * Multi Printer Manager Events */ export interface MultiPrinterManagerEvents { /** Emitted when a printer connects */ 'printer-connected': PrinterConnection; /** Emitted when a printer disconnects */ 'printer-disconnected': { printerId: string; deviceId: string; }; /** Emitted when a printer has an error */ 'printer-error': { printerId: string; error: Error; }; /** Emitted when broadcast completes */ 'broadcast-complete': { success: number; failed: number; }; } /** * Multi Printer Manager * * Manages multiple Bluetooth printer connections and supports: * - Concurrent connections to multiple printers * - Broadcasting print jobs to all printers * - Individual printer control * - Automatic reconnection */ export declare class MultiPrinterManager extends EventEmitter { protected readonly logger: { debug: (message: string, ...args: unknown[]) => void; info: (message: string, ...args: unknown[]) => void; warn: (message: string, ...args: unknown[]) => void; error: (message: string, ...args: unknown[]) => void; }; private readonly printers; private readonly deviceToPrinter; /** * Creates a new MultiPrinterManager instance */ constructor(); /** * Connect to a printer * * @param printerId - Custom ID for this printer (will be auto-generated if not provided) * @param deviceId - Bluetooth device ID * @param deviceName - Optional device name * @returns The printer ID used */ connect(printerIdOrDeviceId: string, deviceId?: string, deviceName?: string): Promise; /** * Disconnect a printer */ disconnect(printerId: string): Promise; /** * Disconnect all printers */ disconnectAll(): Promise; /** * Get a printer by ID */ getPrinter(printerId: string): BluetoothPrinter | undefined; /** * Get connection info for a printer */ getConnection(printerId: string): PrinterConnection | undefined; /** * Get all connected printers */ getAllPrinters(): PrinterConnection[]; /** * Get printer count */ get count(): number; /** * Check if a printer is connected */ isConnected(printerId: string): boolean; /** * Update last activity timestamp for a printer */ touch(printerId: string): void; /** * Print to a specific printer */ print(printerId: string, data: Uint8Array): void; /** * Broadcast data to all connected printers */ broadcast(data: Uint8Array, options?: BroadcastOptions): Promise<{ success: number; failed: number; }>; /** * Find idle printers (for load balancing) */ getIdlePrinters(): PrinterConnection[]; /** * Get printer statistics */ getStats(): { total: number; connected: number; byName: Record; }; /** * Clean up inactive printers (based on last activity) */ cleanupInactive(maxIdleMs?: number): Promise; /** * Destroy the manager and disconnect all printers */ destroy(): Promise; } export declare const multiPrinterManager: MultiPrinterManager;