0.1.10 • Published 2 years ago

dv-rn-sunmi-devices v0.1.10

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

dv-rn-sunmi-devices

Module for controlling part of system functions of Sunmi T2 mini and P2 pro

Installation

npm install dv-rn-sunmi-devices

Usage

import SunmiPrinter from 'dv-rn-sunmi-devices';

Print Custom HTML

Automatically cuts paper after print

const printHTML = async () => {

  await SunmiPrinter.printCustomHTMl("Test tisku")
    .then(res => {
      console.error(res)
    }).catch(err => {
      console.error(err)
    })
};

Show text on 2 line display

const showTwoLineText = async () => {
  await SunmiPrinter.showTwoLineText("Test","Dvou řádků")
    .then(res => {
      console.error(res)
    }).catch(err => {
      console.error(err)
    })
};

Write NFC data to Tag

const writeChip = async () => {
  let data = {
    "user":"test",
    "password":"test2",
    "domain":"test3"
  }
  await SunmiPrinter.writeNFCTag(data)
    .then(res => {
      console.error(res)
    }).catch(err => {
      console.error(err)
    })
};

Read printer status

const getPrinterStatus = async () => {
    await SunmiPrinter.getPrinterStatus()
      .then((res) => {
        console.error(res);
      })
      .catch((err) => {
        console.error(err);
      });
  };

Event listener

For listening when Tag get nears device.

const chipLoad = async ( data: string ) =>{
  console.error(data)
}

useEffect(()=>{
  DeviceEventEmitter.addListener("CHIP_LOADED",chipLoad)
},[])

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

0.1.10

2 years ago

0.1.8

2 years ago

0.1.9

2 years ago

0.1.7

2 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago