react-native-felica

0.4.0 • Public • Published

react-native-felica

NPM

Getting started

$ npm install react-native-felica --save

Mostly automatic installation

$ react-native link react-native-felica

TypeDoc Document

TypeDoc Document is bellow https://goroya.github.io/react-native-felica/

API Document

Usage

// Require the module
import RNFelica from 'react-native-felica';
import RNAndroidLifeCycle from 'react-native-android-lifecycle';
 
RNFelica.on(RNFelica.EVENT.FELICA_DISCOVER, async (event) => {
  console.log("FELICA_DISCOVER", event);
  try{
    await RNFelica.connect();
 
    const polling = await RNFelica.polling(0xFFFF, 0x01, 0);
    console.log("0 polling", polling);
    const requestService = await RNFelica.requestService(event.idm, [0x000F]);
    console.log("1 requestService", requestService);
    const requestResponse = await RNFelica.requestResponse(event.idm);
    console.log("2 requestResponse", requestResponse);
    const readWithoutEncryption = await RNFelica.readWithoutEncryption(event.idm, [0x000F], [0, 0], [0, 1]);
    console.log("3 readWithoutEncryption", readWithoutEncryption);
    const searchServiceCode = await RNFelica.searchServiceCode(event.idm, 0);
    console.log("4 searchServiceCode", searchServiceCode);
    const requestSystemCode = await RNFelica.requestSystemCode(event.idm);
    console.log("5 requestSystemCode", requestSystemCode);
 
    await RNFelica.close();
  }catch(e){
    console.error("error", e);
  }
});
 
RNAndroidLifeCycle.on(RNAndroidLifeCycle.EVENT.ON_HOST_RESUME, async () => {
  console.log("EVENT ANDROID_ON_HOST_RESUME");
  await RNFelica.enableForegroundDispatch().catch(err => {
    console.info(err);
  })
});
RNAndroidLifeCycle.on(RNAndroidLifeCycle.EVENT.ON_HOST_PAUSE, async () => {
  console.log("EVENT ANDROID_ON_HOST_PAUSE");
  await RNFelica.disableForegroundDispatch().catch(err => {
    console.info(err);
  })
});

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.4.00latest

Version History

VersionDownloads (Last 7 Days)Published
0.4.00
0.3.10
0.2.70
0.3.00
0.2.60
0.2.50
0.2.40
0.2.30
0.2.20
0.2.10
0.2.00
0.1.00
0.0.51
0.0.40
0.0.30
0.0.20
0.0.10

Package Sidebar

Install

npm i react-native-felica

Weekly Downloads

1

Version

0.4.0

License

MIT

Unpacked Size

26.3 MB

Total Files

1939

Last publish

Collaborators

  • goroya.io