From 6524a71742ae367d619bfa76bd9681abd15316c4 Mon Sep 17 00:00:00 2001 From: yankun Date: Wed, 2 Sep 2026 16:16:54 +0800 Subject: [PATCH] chore(receipt-printer): upgrade provider to 0.2.1 --- capabilities/demo-receipt-printer/README.md | 2 +- capabilities/demo-receipt-printer/package-lock.json | 8 ++++---- capabilities/demo-receipt-printer/package.json | 2 +- capabilities/demo-receipt-printer/public/config.json | 4 ++-- capabilities/demo-receipt-printer/src/App.vue | 8 ++++++-- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/capabilities/demo-receipt-printer/README.md b/capabilities/demo-receipt-printer/README.md index 19ba296..754eab3 100644 --- a/capabilities/demo-receipt-printer/README.md +++ b/capabilities/demo-receipt-printer/README.md @@ -2,7 +2,7 @@ End-to-end LWA for `@cutos/device-receipt-printer` and the MS-MA90 Provider. -The Demo covers USB/serial connection, device information, styled text, QR code, paper feed, cutting, status, and Device events. Text and QR printing explicitly call `feed({ dots: 240 })` after printing so the result advances to the paper outlet. The standalone Feed action also defaults to 240 dots. Development uses CUTOS Mock through `.env.development`; deployed builds use CUTOS Runtime and the declared Provider dependency. +The Demo covers USB/serial connection, device information, styled text, QR code, paper feed, back feed, cutting, status, and Device events. Text and QR printing explicitly call `feed({ dots: 240 })` after printing so the result advances to the paper outlet. The standalone Feed action defaults to 240 dots, and Back feed defaults to 40 dots. Development uses CUTOS Mock through `.env.development`; deployed builds use CUTOS Runtime and the declared Provider dependency. The card grid is responsive: portrait displays use two columns, landscape displays use four columns, and narrow displays use one column. diff --git a/capabilities/demo-receipt-printer/package-lock.json b/capabilities/demo-receipt-printer/package-lock.json index 11c9e7c..7ca43c3 100644 --- a/capabilities/demo-receipt-printer/package-lock.json +++ b/capabilities/demo-receipt-printer/package-lock.json @@ -9,7 +9,7 @@ "version": "0.0.0", "dependencies": { "@cutos/core": "^4.0.8", - "@cutos/device-receipt-printer": "^4.0.0", + "@cutos/device-receipt-printer": "^4.1.0", "vue": "^3.4.31" }, "devDependencies": { @@ -113,9 +113,9 @@ } }, "node_modules/@cutos/device-receipt-printer": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@cutos/device-receipt-printer/-/device-receipt-printer-4.0.0.tgz", - "integrity": "sha512-rgY+/m1wcXSNB0Qc5JYlMIXlChE3GqPan9U+QOiIij60jJUWqPBEOyg34+zEggWJKTwKemXJ7/Zwf7dugHBQ2A==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@cutos/device-receipt-printer/-/device-receipt-printer-4.1.0.tgz", + "integrity": "sha512-qc5ROlG31bW2NB+yBvjePHgkLTFU2X64KU2IJrfrjTr8Fo4SKfPbL94U8Rj3LsOzPGTw3PM2QSQiOYqqZHk+Jw==", "license": "SipTimes", "peerDependencies": { "@cutos/core": "^4.0.8" diff --git a/capabilities/demo-receipt-printer/package.json b/capabilities/demo-receipt-printer/package.json index 2992ab4..4999573 100644 --- a/capabilities/demo-receipt-printer/package.json +++ b/capabilities/demo-receipt-printer/package.json @@ -13,7 +13,7 @@ }, "dependencies": { "@cutos/core": "^4.0.8", - "@cutos/device-receipt-printer": "^4.0.0", + "@cutos/device-receipt-printer": "^4.1.0", "vue": "^3.4.31" }, "devDependencies": { diff --git a/capabilities/demo-receipt-printer/public/config.json b/capabilities/demo-receipt-printer/public/config.json index 2541443..d9db9c1 100644 --- a/capabilities/demo-receipt-printer/public/config.json +++ b/capabilities/demo-receipt-printer/public/config.json @@ -1,12 +1,12 @@ { "name": "demo-receipt-printer", - "version": "0.1.3", + "version": "0.1.5", "description": "CUTOS 4.0 Receipt Printer end-to-end demo", "params": { "title": "CUTOS Receipt Printer", "host": "localhost" }, "drvDependencies": { - "device-receipt-printer-provider-ms-ma90": "0.1.0" + "device-receipt-printer-provider-ms-ma90": "0.2.1" } } diff --git a/capabilities/demo-receipt-printer/src/App.vue b/capabilities/demo-receipt-printer/src/App.vue index dd0bdef..0349aed 100644 --- a/capabilities/demo-receipt-printer/src/App.vue +++ b/capabilities/demo-receipt-printer/src/App.vue @@ -20,6 +20,7 @@ interface ReceiptPrinterClient { printText(params: { text: string; alignment?: Alignment; width?: number; height?: number; bold?: boolean }): Promise<{ success: boolean }> printQrCode(params: { content: string; size?: number; leftMargin?: number }): Promise<{ success: boolean }> feed(params?: { dots?: number }): Promise<{ success: boolean }> + backFeed(params?: { dots?: number }): Promise<{ success: boolean }> cut(params?: { mode?: 'full' | 'partial' }): Promise<{ success: boolean }> getStatus(): Promise onData(fn: (value: unknown) => void): () => void @@ -37,6 +38,7 @@ class MockReceiptPrinter implements ReceiptPrinterClient { async printText() { return this.complete('printText') } async printQrCode() { return this.complete('printQrCode') } async feed() { return this.complete('feed') } + async backFeed() { return this.complete('backFeed') } async cut() { return this.complete('cut') } async getStatus() { return { code: 0, state: 'ready' as const, ready: true, message: 'Printer is ready.' } } onData(fn: (v: unknown) => void) { return this.listen('data', fn) } @@ -73,6 +75,7 @@ const qrContent = ref('https://www.cut-os.com') const qrSize = ref(6) const qrLeftMargin = ref(0) const feedDots = ref(240) +const backFeedDots = ref(40) const cutMode = ref<'full' | 'partial'>('partial') const events = ref([]) const dataEvents = computed(() => events.value.filter(event => event.kind === 'data')) @@ -89,6 +92,7 @@ async function disconnect() { await run('disconnect', async () => { await device async function printText() { await run('printText', async () => { const printed = await device!.printText({ text: text.value, alignment: alignment.value, bold: bold.value, width: width.value, height: height.value }); const fed = await device!.feed({ dots: 240 }); result.value = { printed, fed, feedDots: 240 } }) } async function printQrCode() { await run('printQrCode', async () => { const printed = await device!.printQrCode({ content: qrContent.value, size: qrSize.value, leftMargin: qrLeftMargin.value }); const fed = await device!.feed({ dots: 240 }); result.value = { printed, fed, feedDots: 240 } }) } async function feed() { await run('feed', async () => { result.value = await device!.feed({ dots: feedDots.value }) }) } +async function backFeed() { await run('backFeed', async () => { result.value = await device!.backFeed({ dots: backFeedDots.value }) }) } async function cut() { await run('cut', async () => { result.value = await device!.cut({ mode: cutMode.value }) }) } async function refreshStatus() { await run('getStatus', async () => { printerStatus.value = await device!.getStatus() }) } @@ -123,13 +127,13 @@ onUnmounted(() => { unsubscribers.forEach(unsubscribe => unsubscribe()); device?
Operation failed{{ errorText }}
-
{{ host }}

Receipt Printer · MS-MA90

Capability: @cutos/device-receipt-printer 4.0.0Provider: device-receipt-printer-provider-ms-ma90 0.1.0
+
{{ host }}

Receipt Printer · MS-MA90

Capability: @cutos/device-receipt-printer 4.1.0Provider: device-receipt-printer-provider-ms-ma90 0.2.0

Connection

connect() / disconnect()
{{ connected ? 'online' : 'offline' }}

Device information

readDeviceInfo()
{{ format(deviceInfo) }}

Text

printText()

QR code

printQrCode()
-

Paper

feed() / cut()
+

Paper

feed() / backFeed() / cut()

Printer status

getStatus()
{{ format(printerStatus) }}

Operations

onData()
{{ format(event.value) }}

Waiting for operations…

Status / Errors

onStatus() / onError()
{{ format(event.value) }}

Waiting for status…