checkLanguage method

Future<PrinterIdentity?> checkLanguage(
  1. TargetPrinter printer
)

Only the printer's own status reply (no paper, no table): what it says it speaks, or null when it is silent.

Implementation

Future<PrinterIdentity?> checkLanguage(TargetPrinter printer) async {
  try {
    final p = await sp.SPrint.probeLanguage(printer.toSprint());
    if (p == null || !PrinterLanguage.all.contains(p.language)) return null;
    return PrinterIdentity(language: p.language, source: PrinterIdentity.sourceStatus);
  } catch (_) {
    return null;
  }
}