# com.mutualmobile.cordova.bluetoothle

> Connect with devices using Bluetooth Low Energy communication

Latest version **1.2.0** (published 2016-11-16) · Apache 2.0 license · 0 weekly downloads

## Install

```sh
npm install com.mutualmobile.cordova.bluetoothle
pnpm add com.mutualmobile.cordova.bluetoothle
yarn add com.mutualmobile.cordova.bluetoothle
bun add com.mutualmobile.cordova.bluetoothle
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2016-11-16 |
| First published | 2015-11-03 |
| Weekly downloads | 0 |
| License | Apache 2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Maintainers | david_bsx, zship |
| Keywords | bluetooth, low energy, smart, ecosystem:cordova, cordova-android, cordova-ios |

## Links

- npm: https://www.npmjs.com/package/com.mutualmobile.cordova.bluetoothle
- Repository: https://github.com/mutualmobile/cordova-bluetoothle
- Homepage: https://github.com/mutualmobile/cordova-bluetoothle#readme
- Issues: https://github.com/mutualmobile/cordova-bluetoothle/issues
- npm.io page: https://npm.io/package/com.mutualmobile.cordova.bluetoothle

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2016-11-16
- 1.1.1 — 2016-11-15
- 1.1.0 — 2016-11-15
- 1.0.8 — 2016-02-15
- 1.0.7 — 2016-02-15
- 1.0.6 — 2016-01-04
- 1.0.5 — 2015-12-04
- 1.0.4 — 2015-11-03
- 1.0.3 — 2015-11-03

## README

Mutual Mobile Bluetooth LE Plugin
=================================

This is a Cordova Bluetooth LE plugin based on
[randdusing/BluetoothLE](https://github.com/randdusing/BluetoothLE), but
rewritten to be more robust, support multiple devices, and have a more
comfortable API (Promise-based, each method does exactly one thing). The API is
based on the Chrome Bluetooth low energy API. Some signatures have been
modified because:

1. We like the Promise API for asynchronous code
2. I couldn't tell why many methods don't reference the device address in
   Chrome's API. It seems pretty necessary to me to distinguish between
   multiple devices.

There are two parts of Chrome's API needed to interact with Bluetooth low
energy devices:


[chrome.bluetooth](https://developer.chrome.com/apps/bluetooth)
---------------------------------------------------------------


### Methods

* getAdapterState () : AdapterState
* getDevice (String deviceAddress) : Device
* getDevices () : [Device]
* startDiscovery () : void
* stopDiscovery () : void

### Types

#### AdapterState

* address : String
* name : String
* enabled : boolean
* discovering : boolean

#### Device

* address : String
* name : String
* rssi : int
* connected : boolean
* uuids : [Service]
  - list of services either from advertisement data during a scan or from
    discovered services on connected devices

### Events

* 'onDeviceAdded' : Device
  - called when a device has been discovered
* 'onDeviceDropped' : Device
  - (not in Chrome) called when a connected Device is disconnected, e.g. going
    out of range. Boils down to "a device disconnected, but nobody asked for it
    to be"
* 'onAdapterStateChanged' : AdapterState
  - called when the Bluetooth adapter turns on or off



[chrome.bluetoothLowEnergy](https://developer.chrome.com/apps/bluetoothLowEnergy)
---------------------------------------------------------------------------------


### Methods

* connect (String deviceAddress) : Device
* disconnect (String deviceAddress) : void
* getService (String deviceAddress, String serviceId) : Service
* getServices (String deviceAddress) : [Service]
* getCharacteristic (String deviceAddress, String serviceId, String characteristicId) : Characteristic
* getCharacteristics (String deviceAddress, String serviceId) : [Characteristic]
* getIncludedServices (String deviceAddress, String serviceId) : [Service]
* getDescriptor (String deviceAddress, String serviceId, String characteristicId, String descriptorId) : Descriptor
* getDescriptors (String deviceAddress, String serviceId, String characteristicId) : [Descriptor]
* readCharacteristicValue (String deviceAddress, String serviceId, String characteristicId) : ArrayBuffer
* writeCharacteristicValue (String deviceAddress, String serviceId, String characteristicId, ArrayBuffer value) : void
* startCharacteristicNotifications (String deviceAddress, String serviceId, String characteristicId) : void
* stopCharacteristicNotifications (String deviceAddress, String serviceId, String characteristicId) : void
* readDescriptorValue (String deviceAddress, String serviceId, String characteristicId, String descriptorId) : ArrayBuffer
* writeDescriptorValue (String deviceAddress, String serviceId, String characteristicId, String descriptorId, ArrayBuffer value) : Descriptor

### Types

#### Service

* uuid : String
* isPrimary : boolean
* instanceId : String
* deviceAddress : String

#### Characteristic

* uuid : String
* service : String
  - UUID of the parent Service
* properties : Array
  - one or more of: "broadcast", "read", "writeWithoutResponse", "write",
    "notify", "indicate", "authenticatedSignedWrites", "extendedProperties",
    "reliableWrite", or "writableAuxiliaries"
* instanceId : String
* value : ArrayBuffer

#### Descriptor

* uuid : String
* characteristic : String
  - UUID of the parent Characteristic
* value : ArrayBuffer

### Events

* 'onCharacteristicValueChanged' : Characteristic
  - callback for a Characteristic notification/indication
* 'onDescriptorValueChanged' : Descriptor
  - callback for a Descriptor notification/indication


Extras
------

* isSupported () : boolean
  - `true` if the current device supports Bluetooth LE communication
* isConnected (String deviceAddress) : boolean
  - `true` if the specified device is connected to the phone's bluetooth adapter


Hacking/Contributing
--------------------

See CONTRIBUTING.md!


License
-------

[Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.html)

A derivative work of [randdusing/BluetoothLE](https://github.com/randdusing/BluetoothLE)

---
_Source: https://npm.io/package/com.mutualmobile.cordova.bluetoothle · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
