bluetooth-helper

0.0.7 • Public • Published

bluetooth-helper

A wrapper for BLE APIs in FxOS. It help developers handle BLE things easier.

How to Install

  1. Declare bluetooth-helper as dependency module in bower.json. Please check bower.json.
  2. Download the module: bower install.
  3. Import the module in <head> in HTML file. html<script src="bower_components/bluetooth-helper/lib/bluetooth_helper.js"></script>
  4. Done.

How to Use

Connect the device.

var ble = new BluetoothHelper({
  // Need BLE device's name or address to connect it.
  name: 'BT_NAME',
  // address: 'e4:a9:35:a4:ee:10'
});
ble.connect();

Send data to device after connected.

ble.on('connected', function() {
  // You need to send one byte or more data in HEX format at one time.
  ble.send('EE');
});

Reconnect the device.

ble.disconnected();
ble.on('disconnected', function() {
  ble.connect();
})

Readme

Keywords

Package Sidebar

Install

npm i bluetooth-helper

Weekly Downloads

0

Version

0.0.7

License

Apache License 2.0

Last publish

Collaborators

  • evanxd