react-native-hm-feitian-reader
v1.3.0
Published
React native plugin to read via BLE/USB Feitian readers
Downloads
186
Readme
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