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({
name: 'BT_NAME',
});
ble.connect();
Send data to device after connected.
ble.on('connected', function() {
ble.send('EE');
});
Reconnect the device.
ble.disconnected();
ble.on('disconnected', function() {
ble.connect();
})