react-native-hm-feitian-reader
TypeScript icon, indicating that this package has built-in type declarations

1.1.6 • Public • Published

react-native-hm-feitian-reader

React native plugin to read via BLE/USB Feitian readers

Installation

npm install react-native-hm-feitian-reader
Pour IOS mettre ces infos dans Info.plist
<key>UISupportedExternalAccessoryProtocols</key>
<array>
    <string>com.ftsafe.bR301</string>
    <string>com.ftsafe.iR301</string>
</array>

Usage

import { readerFind, readerClose } from "react-native-hm-feitian-reader";

// ...

const result = await readerFind();

React.useEffect(() => {
    const eventEmitter = new NativeEventEmitter(NativeModules.HmFeitianReader);
    eventEmitter.addListener('NewDevice', (event) => {
        console.log(event) // "someValue"
        result.indexOf(event.name) === -1 ? setResult(result => [...result,event.name]) : null;

    });

    eventEmitter.addListener('CardPoweredOn', (event) => {
      console.log(event) // "someValue"
    });

    eventEmitter.addListener('CardPoweredOnFailed', (event) => {
      console.log('CardPoweredOn', event) // "someValue"
    });


    eventEmitter.addListener('Error', (event) => {
      console.log(event) // "someValue"
    });

    eventEmitter.addListener('ReaderDisconnected', (event) => {
        console.log(event) // "someValue"
    });

    eventEmitter.addListener('LogMessage', (event) => {
        console.log(event) // "someValue"
    });


    //scan(4, 7).then(retour => console.log("after"));


    return () => {
        //this.eventListener.remove(); //Removes the listener
    } 
}, []);

Contributing

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

License

MIT

Package Sidebar

Install

npm i react-native-hm-feitian-reader

Weekly Downloads

0

Version

1.1.6

License

MIT

Unpacked Size

2.98 MB

Total Files

49

Last publish

Collaborators

  • nmauffre