JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 109
  • Score
    100M100P100Q101634F
  • License MIT

React Native bridge for PointMobile RFID SDK on Android

Package Exports

  • react-native-pm-rfid-bridge
  • react-native-pm-rfid-bridge/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-native-pm-rfid-bridge) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-native-pm-rfid-bridge

React Native Android bridge for PointMobile RFID SDK (device.sdk).

Platform

  • Android only
  • Not supported in Expo Go (use development build / prebuild)

Installation

yarn add react-native-pm-rfid-bridge

If you are in an Expo managed project:

npx expo prebuild

Then rebuild Android app.

Usage

import RFID, { DeviceType, RfidEvent, addRfidListener } from 'react-native-pm-rfid-bridge';

const packetSub = addRfidListener(RfidEvent.PACKET, (payload) => {
  console.log('tag packet', payload);
});

const stateSub = addRfidListener(RfidEvent.STATE_CHANGED, (payload) => {
  console.log('rfid state', payload);
});

await RFID.connectBluetooth('AA:BB:CC:DD:EE:FF', 'RF300');
await RFID.open(DeviceType.BLUETOOTH);
await RFID.startInventory();

// later
await RFID.stopInventory();
await RFID.close();
packetSub.remove();
stateSub.remove();

API

  • isSdkAvailable(): Promise<boolean>
  • connectBluetooth(address: string, name?: string): Promise<boolean>
  • disconnectBluetooth(): Promise<boolean>
  • open(deviceType?: 'bluetooth' | 'usb' | 'uart'): Promise<number>
  • close(): Promise<boolean>
  • isOpened(): Promise<boolean>
  • startInventory(): Promise<number>
  • stopInventory(): Promise<number>
  • setResultType(resultType: number): Promise<boolean>
  • getBatteryLevel(): Promise<number>
  • beep(): Promise<boolean>

Events

  • rfid_state_changed: { state: number }
  • rfid_packet: { recvString: string }

Notes

  • This package compiles against android/libs/device.sdk.jar included in the package.
  • Runtime requires PointMobile-compatible device environment where device.sdk library/service is available.