Skip to content

core/src

Interfaces

InterfaceDescription
LetraTagMediaDYMO LetraTag media descriptor.
LetraTagPrintOptionsPublic LetraTag print options.

Type Aliases

Type AliasDescription
LetraTagDeviceDYMO LetraTag device entry. Alias for the contracts DeviceEntry narrowed to family: 'letratag'.
LetraTagMaterialLT cassette substrate family. Picker / preview UX hint — the rasterizer does not branch on this.

Variables

VariableDescription
BODY_CHUNKProtocol-level upper bound on body bytes per BLE write. Used as the ceiling when no mtu is provided to chunkPayload; effective chunk size is min(BODY_CHUNK, mtu - 1).
CUT_AT_ENDCUT command byte for "cut at the end of this copy".
CUT_SUPPRESSCUT command byte for "suppress cut (intermediate copy)".
DEFAULT_MEDIA-
DEVICE_REGISTRY_DATACompiled DeviceRegistry for the LetraTag driver. Source of truth lives in packages/core/data/devices/<KEY>.json5; scripts/compile-data.mjs aggregates them into the generated TS module imported here.
DEVICESRegistry of supported LetraTag devices, keyed by the device's stable key field (LT_200B). Values are the full contracts DeviceEntry.
END[0x1B, 0x51] — end of job marker.
FORM_FEED[0x1B, 0x45] — paper feed. Not emitted on the LT-200B path.
LT_PAPER_WHITECanonical default — the white-paper cassette ships in the box with every LT-200B. Single named const, not a per-cassette export.
MAGICMagic bytes appended to the last chunk of a print payload.
MEDIAIndexed registry of every LT cassette SKU the driver knows about, keyed by entry id (e.g. MEDIA['lt-paper-white']).
MEDIA_LIST-
PRINTABLE_DOTSConventional "printable rows" — the height we recommend authoring to so labels survive any chassis-mechanical clipping. The wire format does not enforce this; it's a media-side fact.
PROTOCOL_HEAD_FRAMEWire-format frame height — PRINT_DATA.height is always 32. The encoder centres shorter source bitmaps within these 32 rows by inserting zero-rasterlines top and bottom.
PROTOCOLSWire protocols this core's encoder produces correct bytes for. Pair with DEVICE_REGISTRY_DATA and resolveSupportedDevices from @thermal-label/contracts to filter a device list to what this runtime can drive.
ROTATE_DIRECTIONDirection the LetraTag print head rotates landscape input.
START[0x1B, 0x73, 154, 2, 0, 0] — start of a print job.
STATUS[0x1B, 0x41] — request a status notification.
STATUS_NOTIFICATION_LENGTHLength in bytes of a well-formed RX status notification frame.
STATUS_REQUESTStatus request directive — [0x1B, 0x41]. Embedded in every print payload between CUT and END; on-the-wire observation does not show it sent stand-alone.

Functions

FunctionDescription
buildCut[0x1B, 0x70, command] — cut directive.
buildHeader9-byte header. Layout:
buildMediaType[0x1B, 0x4D, mediaId, 0x00, 0x00, 0x00] — set cassette type. 6 bytes total; the trailing three zeros are part of the observed wire format.
buildNumberOfCopies[0x1B, 0x23, copies] — number of copies for this job.
buildPrintData[0x1B, 0x44, 0x81, 0x02, ...u32le(width), ...u32le(height), ...image]
buildPrintPayloadBuild the print payload (everything after the 9-byte header): START + [MEDIA_TYPE] + NUMBER_OF_COPIES + PRINT_DATA + CUT + STATUS + END.
chunkPayloadSlice an assembled payload into the ordered list of BLE writes.
createPreviewOfflineGenerate an offline preview without a live printer connection.
encodeBitmapEncode a head-aligned bitmap into the column-major 4-bytes-per-feed stream the LT-200B expects.
encodeLabelEncode a complete LetraTag print job into the ordered list of BLE writes. The transport calls write() with each entry in turn.
encodeSetCassetteTypeBuild the stand-alone MEDIA_TYPE-only write list. Used by the driver's setCassetteType() path (writes to the printShortCommandUUID characteristic).
findMediaBySkuFind a media entry by vendor SKU. LT cassettes ship under many regional part numbers (US 91XXX vs EU S07XXXXX); this helper does the lookup against MediaDescriptor.skus.
parseStatusParse a 3-byte status notification frame from the printer.