bluetooth-helper
v0.0.7
Published
A wrapper for BLE APIs in FxOS. It help developers handle BLE things easier.
Downloads
6
Readme
bluetooth-helper
A wrapper for BLE APIs in FxOS. It help developers handle BLE things easier.
How to Install
- Declare bluetooth-helper as dependency module in
bower.json
. Please check bower.json. - Download the module:
bower install
. - Import the module in
<head>
in HTML file.html<script src="bower_components/bluetooth-helper/lib/bluetooth_helper.js"></script>
- 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();
})