Skip to content

Latest commit

 

History

History
58 lines (43 loc) · 1.13 KB

README.md

File metadata and controls

58 lines (43 loc) · 1.13 KB

react-native-blemulator library logo

react-native-blemulator

Getting started

$ npm install react-native-blemulator --save

Mostly automatic installation

$ react-native link react-native-blemulator

Usage

First, create simulated peripheral

import { SimulatedPeripheral, SimulatedService } from "react-native-blemulator";

const simulatedPeripheral = new SimulatedPeripheral({
  name: "My peripheral",
  localName: "My peripheral",
  id: "1234",
  advertisementInterval: 1000,
  isConnectable: true,
  serviceUuids: [],
  rssi: -90,
  services: [
    new SimulatedService({
      // ...
    }),
  ],
});

Second, register this peripheral and enable simulation

import { blemulator } from "react-native-blemulator";

blemulator.addPeripheral(simulatedPeripheral);
blemulator.simulate();

Finally, create BleManager instance and use it normally

import { BleManager } from "react-native-ble-plx";

const manager = new BleManager();