import { buildTscLabelData, buildTscTestPrintData } from '../protocols/tscProtocol' import type { PrinterCandidate, PrinterDriver } from '../types/printer' const KEYWORDS = [ 'd320fax', 'virtual bt printer', 'gp-d320fax', ] function score (device: PrinterCandidate): number { const text = `${device.name || ''} ${device.deviceId || ''}`.toLowerCase() let total = 0 KEYWORDS.forEach((keyword) => { if (text.includes(keyword)) total += 40 }) return total } export const d320faxDriver: PrinterDriver = { key: 'd320fax', brand: 'Gprinter', model: 'D320FAX', displayName: 'Gprinter D320FAX', protocol: 'tsc', preferredConnection: 'classic', preferredBleMtu: 20, imageMaxWidthDots: 800, imageDpi: 203, keywords: KEYWORDS, matches (device) { return score(device) }, resolveConnectionType () { return 'classic' }, buildTestPrintData () { return buildTscTestPrintData() }, buildLabelData (payload) { return buildTscLabelData(payload) }, }