- From: Kazuya Matsumoto via GitHub <sysbot+gh@w3.org>
- Date: Tue, 13 Feb 2018 08:54:33 +0000
- To: public-web-bluetooth-log@w3.org
kazuooooo has just created a new issue for https://github.com/WebBluetoothCG/web-bluetooth:
== can not find requestLEScan() method ==
Hi, I want to use requestLEScan method to scan ble peripheral devices, but I cannot find requestLEScan method.
I wrote below following [this doc](https://webbluetoothcg.github.io/web-bluetooth/scanning.html)
```
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<title></title>
</head>
<body>
<button id="test" onclick="onButtonClick()">test</button>
<script>
function onButtonClick() {
navigator.bluetooth.requestLEScan({
filters: [{manufacturerData: {0x004C: {dataPrefix: new Uint8Array([
0x02, 0x15, // iBeacon identifier.
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 // My beacon UUID.
])}}}],
options: {
keepRepeatedDevices: true,
}
}).then(() => {
navigator.bluetooth.addEventListener('advertisementreceived', event => {
let appleData = event.manufacturerData.get(0x004C);
if (appleData.byteLength != 23) {
// Isn’t an iBeacon.
return;
}
let major = appleData.getUint16(18, false);
let minor = appleData.getUint16(20, false);
let txPowerAt1m = -appleData.getInt8(22);
let pathLossVs1m = txPowerAt1m - event.rssi;
});
})
}
</script>
</body>
</html>
```
but it cause error like this.

Also, I checked object and it only has requestDevice() method

Please view or discuss this issue at https://github.com/WebBluetoothCG/web-bluetooth/issues/386 using your GitHub account
Received on Tuesday, 13 February 2018 08:55:17 UTC