Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

sentienhq/react-native-blemulator

 
 

Repository files navigation

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();

About

BLE simulator for react-native-ble-plx

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 56.0%
  • Java 37.9%
  • Objective-C 5.5%
  • Other 0.6%