| Index: Source/modules/bluetooth/BluetoothDevice.cpp
|
| diff --git a/Source/modules/bluetooth/BluetoothDevice.cpp b/Source/modules/bluetooth/BluetoothDevice.cpp
|
| index e80113dd7315222be8502d53f324e5db2fee847d..0e8fba200326ab3b2619856050341a314e32c9bd 100644
|
| --- a/Source/modules/bluetooth/BluetoothDevice.cpp
|
| +++ b/Source/modules/bluetooth/BluetoothDevice.cpp
|
| @@ -5,6 +5,15 @@
|
| #include "config.h"
|
| #include "modules/bluetooth/BluetoothDevice.h"
|
|
|
| +#include "bindings/core/v8/CallbackPromiseAdapter.h"
|
| +#include "bindings/core/v8/ScriptPromise.h"
|
| +#include "bindings/core/v8/ScriptPromiseResolver.h"
|
| +#include "core/dom/DOMException.h"
|
| +#include "core/dom/ExceptionCode.h"
|
| +#include "modules/bluetooth/BluetoothError.h"
|
| +#include "modules/bluetooth/BluetoothGATTRemoteServer.h"
|
| +#include "public/platform/Platform.h"
|
| +#include "public/platform/modules/bluetooth/WebBluetooth.h"
|
| #include "wtf/OwnPtr.h"
|
|
|
| namespace blink {
|
| @@ -86,5 +95,15 @@ Vector<String> BluetoothDevice::uuids(bool& isNull)
|
| return uuids;
|
| }
|
|
|
| -} // namespace blink
|
| +ScriptPromise BluetoothDevice::connectGATT(ScriptState* scriptState)
|
| +{
|
| + WebBluetooth* webbluetooth = Platform::current()->bluetooth();
|
| + if (!webbluetooth)
|
| + return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(NotSupportedError));
|
| + RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scriptState);
|
| + ScriptPromise promise = resolver->promise();
|
| + webbluetooth->connectGATT(instanceID(), new CallbackPromiseAdapter<BluetoothGATTRemoteServer, BluetoothError>(resolver));
|
| + return promise;
|
| +}
|
|
|
| +} // namespace blink
|
|
|