Skip to content

Instantly share code, notes, and snippets.

@adrianfaciu
Created October 5, 2016 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adrianfaciu/d54e9f4f365b92bffede4dbfff19d0a4 to your computer and use it in GitHub Desktop.
Save adrianfaciu/d54e9f4f365b92bffede4dbfff19d0a4 to your computer and use it in GitHub Desktop.
getMagicBlue(): BleDevice {
return this.bluetoothService.bleDevicesAround
.filter(d => d.name && d.name.indexOf('LEDBLE') > -1)[0];
}
connectToMagicBlue() {
this.bluetoothService.scan().then(() => {
this.magicBlue = this.getMagicBlue();
if (this.magicBlue) {
this.bluetoothService.connect(this.magicBlue.UUID)
.then((device) => console.log('Connected: ' + JSON.stringify(device)));
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment