| Index: Source/modules/bluetooth/BluetoothGATTRemoteServer.cpp
|
| diff --git a/Source/modules/bluetooth/BluetoothGATTRemoteServer.cpp b/Source/modules/bluetooth/BluetoothGATTRemoteServer.cpp
|
| index 994af71eaa41d426dd3fa97196b48d167569e1b6..b2a55a09286a3cc57ac09cd736205fe1a48c0fe5 100644
|
| --- a/Source/modules/bluetooth/BluetoothGATTRemoteServer.cpp
|
| +++ b/Source/modules/bluetooth/BluetoothGATTRemoteServer.cpp
|
| @@ -5,7 +5,15 @@
|
| #include "config.h"
|
| #include "modules/bluetooth/BluetoothGATTRemoteServer.h"
|
|
|
| -#include "public/platform/modules/bluetooth/WebBluetoothGATTRemoteServer.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/BluetoothGATTService.h"
|
| +#include "public/platform/Platform.h"
|
| +#include "public/platform/modules/bluetooth/WebBluetooth.h"
|
| #include "wtf/OwnPtr.h"
|
|
|
| namespace blink {
|
| @@ -26,5 +34,17 @@ void BluetoothGATTRemoteServer::dispose(WebBluetoothGATTRemoteServer* webGATTRaw
|
| delete webGATTRaw;
|
| }
|
|
|
| +ScriptPromise BluetoothGATTRemoteServer::getPrimaryService(ScriptState* scriptState, String serviceUUID)
|
| +{
|
| + // TODO(ortuno): BluetoothUUID.getService(serviceUUID)
|
| + // https://crbug.com/491441
|
| + WebBluetooth* webbluetooth = Platform::current()->bluetooth();
|
| +
|
| + RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scriptState);
|
| + ScriptPromise promise = resolver->promise();
|
| + webbluetooth->getPrimaryService(m_webGATT.deviceInstanceID, serviceUUID, new CallbackPromiseAdapter<BluetoothGATTService, BluetoothError>(resolver));
|
| +
|
| + return promise;
|
| +}
|
|
|
| } // namespace blink
|
|
|