sdk-t6
v0.1.8
Published
React native port for pos t6
Maintainers
Readme
sdk-t6
sdk-t6 is an Expo module for T6 POS device integrations.
It currently provides:
- Magnetic card reader APIs
- Customer aid screen (top small screen) APIs
- Built-in thermal printer APIs
- Device info APIs (terminal serial number)
Platform support
- Android: supported
- iOS: not supported for hardware APIs (throws platform-not-supported errors)
- Web: not supported for hardware APIs (throws platform-not-supported errors)
- Expo Go: not supported (requires native module in a development build)
Installation
npm install sdk-t6Important: vendor SDK binaries are not bundled
This package intentionally does not publish vendor .jar/.aar files to npm.
For Android hardware features to work, add the vendor JAR manually after install:
- Obtain vendor SDK JAR from your device/vendor package.
- Copy it to:
node_modules/sdk-t6/android/libs/T1_V2_20250826.jar
- Rebuild your Android development client.
Android setup checklist
- Use a development build (
expo run:android), not Expo Go. - Ensure vendor JAR exists under
node_modules/sdk-t6/android/libs/. - Rebuild after adding/replacing the JAR.
- Run Metro with dev client:
npx expo start --dev-client -cThe module manifest includes required permissions:
android.permission.CLOUDPOS_MAGCARDandroid.permission.CLOUDPOS_MAGCARD_GETTRACKDATAandroid.permission.CLOUDPOS_EMVL2android.permission.CLOUDPOS_PRINTERandroid.permission.CLOUDPOS_SYSTEMDEV
Quick usage
import SdkT6 from 'sdk-t6';
import type { MagCardEvent } from 'sdk-t6';
import { useEvent } from 'expo';
const event = useEvent(SdkT6, 'onMagCardEvent') as MagCardEvent | undefined;
await SdkT6.magOpenAsync();
const card = await SdkT6.readMagCardAsync(60_000);
await SdkT6.magCloseAsync();Aid screen example:
await SdkT6.smallScreenWakeAsync();
await SdkT6.smallScreenSetBrightnessAsync(80);
await SdkT6.smallScreenDisplayTextAsync('USD 123.45', 'xlarge', 'center');
// Mixed sizes in one update (label + amount) — no flicker from sequential replace calls
await SdkT6.smallScreenDisplayRichTextAsync(
[
{ text: 'Amount', textSize: 'normal', align: 'center' },
{ text: '\n\n' },
{ text: '1,250.00', textSize: 'xlarge', align: 'center' },
],
'center',
{
fontFamily: 'sans-serif', // or 'fonts/Brand.ttf' in APK assets
textColor: '#FFFFFF',
backgroundColor: '#001122',
}
);Printer example:
await SdkT6.printTextAsync([
{ text: 'MY STORE', fontSize: 28, bold: true, align: 'center' },
{ text: 'TOTAL $42.00', bold: true },
{ text: '\n\n' },
]);
await SdkT6.printCutPaperAsync('halt');Device serial number:
const serialNo = await SdkT6.getSerialNoAsync();API overview
Magnetic card:
readMagCardAsync(timeoutMs?)cancelReadMagCardAsync()magOpenAsync()magCloseAsync()magSearchAsync(timeoutMs)magStopSearchAsync()- event:
onMagCardEvent
Aid screen:
smallScreenWakeAsync()smallScreenSleepAsync()smallScreenSetBrightnessAsync(brightness)smallScreenGetBrightnessAsync()smallScreenGetSizeAsync()smallScreenDisplayTextAsync(text, textSize?, displayMode?)smallScreenDisplayRichTextAsync(items, displayMode?, options?)— mixed text sizes in one updatesmallScreenDisplayImageBase64Async(imageBase64, align?, options?)smallScreenStopAppControlAsync()
Rich text options (Android; whole-screen, not per item):
fontFamily: system name (e.g.sans-serif) or asset path (e.g.fonts/Brand.ttf)textColor: CSS hex (#RGB/#RRGGBB/#AARRGGBB), default#FFFFFFbackgroundColor: same hex formats, default#000000
Image options (Android):
width,height(target image box size in pixels)padding,paddingHorizontal,paddingVertical,paddingLeft,paddingTop,paddingRight,paddingBottomcontentFit:contain|cover|fill|none
Printer:
printResetQueueAsync()printEnqueueTextAsync(items)printEnqueueImageBase64Async(imageBase64, align?)printEnqueueBarcodeAsync(content, width, height, align?)printEnqueueQrCodeAsync(content, size, align?)printFlushAsync()printTextAsync(items)(enqueue + flush)printEnhancedTextAsync(items)printOpenAsync()printCloseAsync()printGetStatusAsync()printGetMessageAsync()printSetGrayAsync(gray)printGetGrayAsync()printLineFeedAsync(lines)printCutPaperAsync(mode?)
Device info:
getSerialNoAsync()
Module docs
- Magnetic card guide:
docs/Magnet_card_module.md - Aid screen guide:
docs/Aid_screen_module.md - Printer guide:
docs/Printer_module.md - Device info guide:
docs/Device_info_module.md
Local example app
From this repository:
cd example
npx expo run:android
npx expo start --dev-client -cTry these example screens:
example/MagnetCardScreen.tsxexample/AidScreen.tsxexample/PrinterScreen.tsxexample/DeviceInfoScreen.tsx
Troubleshooting
ERR_MAG_SERVICE_UNAVAILABLEorERR_SMALL_SCREEN_SERVICE_UNAVAILABLEorERR_PRINTER_SERVICE_UNAVAILABLEorERR_DEVICE_INFO_SERVICE_UNAVAILABLE:- vendor JAR missing, wrong path, or app not rebuilt
ERR_MAG_BUSY:- another magnetic operation is already active
- Platform-not-supported error:
- running on iOS/web or Expo Go
License
MIT
