A Node.js Stream for getting heart rate from Bluetooth Low Energy devices. This is experimental and tested only with the Wahoo Blue HR device.
npm install --save heartrate
var BleHR = require('heartrate');
var stream = new BleHR('foo12345bar1234fo12345bar1234123');
stream.pipe(process.stdout);
Parameter: UUID
is string with the UUID.
Returns: BleHR
instance
Parameter: option
is object of options.
Returns: BleHR
instance
Defaults:
{
"log": false,
"uuid": undefined
}
uuid
is required
Parameter: Function
callback with the location in string format
Returns: BleHR
instance (it self)
Get string representation of body sensor location. E.g. Chest
, Ear Lobe
.
Either get data by using the callback or listening to the bodyLocation
event.
Example:
var stream = new BleHR('foo12345bar1234fo12345bar1234123');
stream.getBodyLocation().on('bodyLocation', function (error, location) {
console.log("Location:", location); // Chest
});
Parameter: Function
callback with the current battery level in percentage
Returns: BleHR
instance (it self)
Get battery level of device in percentage. Interval 0
- 100
.
Either get data by using the callback or listening to the batteryLevel
event.
Example:
var stream = new BleHR('foo12345bar1234fo12345bar1234123');
stream.getBatteryLevel(function (err, level) {
console.log("BatteryLevel:", level); // BatteryLevel: 47
});
Returns: EventEmitter
instance
Emits all discovered devices on data
event.
Example:
BleHR.list().on('data', function (device) {
console.log(device.uuid);
});
Sugar for printing all devices found.
Example:
BleHR.list.print();
// UUID: foo12345bar1234fo12345bar1234123
// Local Name = Wahoo HRM v2.1
// Service Data =
// Service UUIDs = 180d