Created
October 5, 2016 20:40
-
-
Save adrianfaciu/d54e9f4f365b92bffede4dbfff19d0a4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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