@m-scan/device-kit-core
v0.0.1
Published
Core types, interfaces and contracts shared across all @m-scan/device-kit packages
Readme
@m-scan/device-kit-core
Types et interfaces partagés par tous les packages
@m-scan/device-kit — Device, Printer, DeviceScanner,
et les classes d'erreur. Ne contient aucune implémentation, juste le
contrat commun. Généralement pas installé directement par une application
(déjà réexporté par @m-scan/device-kit).
Contenu
interface Device {
id: string
name: string
type: 'printer' | 'scanner' | 'display' | 'cash-drawer' | 'unknown'
connection: 'usb' | 'bluetooth' | 'network' | 'serial' | 'agent'
status: 'online' | 'offline' | 'busy' | 'error' | 'unknown'
address?: string
vendor?: string
meta?: Record<string, unknown>
}
interface DeviceScanner {
scan(options?: { timeoutMs?: number }): Promise<Device[]>
}
interface Printer {
connect(): Promise<void>
disconnect(): Promise<void>
print(data: Uint8Array): Promise<void>
status(): Promise<{ online: boolean; paperOut?: boolean; coverOpen?: boolean; error?: string }>
}Plus DeviceKitError, DeviceNotFoundError, ConnectionError,
UnsupportedEnvironmentError.
Licence
MIT
