Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
136 additions
and
34 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<title>Request All Devices</title> | ||
<body> | ||
<button type="button" onclick="onButtonClick()">Request All Devices</button> | ||
<pre id="log"></pre> | ||
<script src="bluetooth_functions.js"></script> | ||
<script> | ||
function onButtonClick() { | ||
clear(); | ||
var options = {optionalServices: ['generic_access'], acceptAllDevices:true}; | ||
try { | ||
log('Requesting Bluetooth Device...'); | ||
var bluetooth = window.navigator.bluetooth; | ||
var device = bluetooth.requestDevice(options); | ||
|
||
log('Connecting to GATT Server on device...'); | ||
var server = device.gatt.connect(); | ||
|
||
log('Getting Generic Access Service...'); | ||
var service = server.getPrimaryService('generic_access'); | ||
} catch(err) { | ||
log(err); | ||
} | ||
} | ||
</script> | ||
</body> | ||
</html> |