0.2.6 • Published 9 months ago
react-native-rfid-hsbr v0.2.6
react-native-rfid-hsbr
Biblioteca desenvolvida utilizando o SDK da Zebra versão 2.0.2.114 para leitores RFD8500 e RFD40. Com ela é possivel listar dispositivos pareados, connectar e ler tags rid.
Installation
npm install react-native-rfid-hsbr
or
yarn add react-native-rfid-hsbr
O link com o código nativo é feito automaticamente pelo auto-link, é necessário apenas alterar allowBackup para true em: android/app/src/main/AndroidManifest.xml
<application
...
android:allowBackup="true"> // <-- change for true
...
</application>
Bluetooth
Listar dispositivos pareados
import { getAvailableDevices } from 'react-native-rfid-hsbr';
const devices = await getAvailableDevices();
console.log(devices);
// [
// {"address": "6C:B2:FD:94:E7:29", "name": "RFD850022259520102038"},
// {"address": "24:71:89:A8:27:49", "name": "RFD850018024523022658"}
// ]
Conectar dispotivo
import { connect } from 'react-native-rfid-hsbr';
const deviceName = 'RFD850022259520102038';
await connect(deviceName);
Usage
A biblioteca dispoe de um componente que captura os eventos do gatilho do leitor e recebe as tags quando lidas.
import { Receiver, startInventory, stopInventory } from 'react-native-rfid-hsbr';
function App () => {
return (
<Receiver
onRfidRead={(tags) => {
console.log('> Receive tags:', tags);
}}
onTriggerPressed={async () => {
console.log('> Start Inventory...');
await startInventory();
// await startLocateTag('B63012400000000000035105');
}}
onTriggerReleased={async () => {
console.log('> Stop Inventory!');
await stopInventory();
}}
onLocateTag={(distance) => {
console.log('> Distance: ' + distance);
}}
/>
)
}
export default App;
License
MIT