npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-zdh-bluetooth

v1.1.3

Published

[![npm version](https://img.shields.io/npm/v/react-native-zdh-bluetooth.svg?style=flat)](https://www.npmjs.com/package/react-native-zdh-bluetooth)

Downloads

10

Readme

react-native-zdh-bluetooth

npm version

Currently only support ios and require react-native >= 0.40.0

##Installation

  1. Install library from npm

    npm install react-native-zdh-bluetooth --save
  2. Link native code

    react-native link react-native-zdh-bluetooth

##Usage

import ble from 'react-native-zdh-bluetooth'

##Methods

scan(UUIDs,allowDuplicates,showPowerAlert)

Scaning peripherals. See method registerDiscoverPeripheral().

Arguments The parameter is optional the configuration keys are:

  • UUIDs - Array of String - [default empty] If you confirm the service UUID in the broadcast information,fill the UUID,block out you don't want, otherwise not.
  • allowDuplicates - Boolean - [default false] Allow scanning duplicates.
  • showPowerAlert - Boolean - [default true] Show or hide the alert if the bluetooth is turned off during initialization.

Examples

ble.scan();
// ble.scan(['XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX']);

stopScan()

Stop the scanning.

Examples

ble.stopScan();

connect(identifier)

Connect to a specified peripheral.

Arguments

  • identifier - String - Using the method you have to obtain the identifier before ,from method registerDiscoverPeripheral().

Examples

ble.connect('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX')

disconnect()

Disconnect from a peripheral.

Examples

ble.disconnect();

write(msg,UUID)

Write to the specified characteristic.

Returns a Promise object.

Arguments

  • msg - String - The data to write hexstring.(e.g. 'ABCDEF0123456789')
  • UUID - String - [default empty] If you confirm the write more than one characteristic,fill in your specified write characteristic UUID , otherwise not.

Examples

// ble.write('ABCDEF0123456789')
ble.write('ABCDEF0123456789','XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX')
  .then((result) =>{
    console.log(result.writeUUID+' : ' +result.message);
  })
  .catch((error) =>{
    console.log(error);
  })
  • result.writeUUID - String - write characteristic UUID.
  • result.message - String - write state message.
  • error - error.

read(UUID)

Read value for the specified characteristic.

Returns a Promise object.

Arguments

  • UUID - String - the UUID of the read characteristic.

Examples

ble.read('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX')
  .then((result) =>{
    console.log(result.readUUID+' : '+result.value);
  })
  .catch((error)=>{
    console.log(error);
  })
  • result.writeUUID - String - read characteristic UUID.
  • result.value - String - characteristic value.
  • error - error.

Events

registerUpdateConnectionStatus(callback)

Register a callback to monitor the connection status.

The status changed callback.

Examples

ble.registerUpdateConnectionStatus((param)=>{
  console.log(param.connect+','+param.desc);
});
  • param.connect - Boolean - Is connect or not.
  • param.desc - String - Error message description.

registerDiscoverPeripheral()

Register a callback to monitor discover peripherals.see method connect().

Once found a peripheral callback.

Examples

ble.registerDiscoverPeripheral((param)=>{
  console.log(param.name+','+param.identifier);
});
  • param.name - String - Peripheral's name.
  • param.identifier - String - Peripheral's identifier.Using connection,see method connect().
  • param.RSSI - Number - Peripheral received signal strength indicator.
  • ... - (broadcast information)

registerDidUpdateValueForCharacteristic()

Register a callback to monitor characteristic value.

Characteristic value did update callback.You can get all peripheral sending data from here.

Examples

ble.registerDidUpdateValueForCharacteristic((param)=>{
  console.log(param.UUID+' : ',param.value);
});
  • param.UUID - String - Characteristic UUID.
  • param.value - String - Characteristic value.