| Index: Source/modules/bluetooth/BluetoothGATTService.cpp
|
| diff --git a/Source/modules/bluetooth/BluetoothGATTService.cpp b/Source/modules/bluetooth/BluetoothGATTService.cpp
|
| index 620b1bce5d390a9052d02a5dfc1e901028dadfa5..d8be80a21a4883d607027e21ceecc7ad86343071 100644
|
| --- a/Source/modules/bluetooth/BluetoothGATTService.cpp
|
| +++ b/Source/modules/bluetooth/BluetoothGATTService.cpp
|
| @@ -5,7 +5,15 @@
|
| #include "config.h"
|
| #include "modules/bluetooth/BluetoothGATTService.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/BluetoothGATTCharacteristic.h"
|
| +#include "public/platform/Platform.h"
|
| +#include "public/platform/modules/bluetooth/WebBluetooth.h"
|
| #include "wtf/OwnPtr.h"
|
|
|
| namespace blink {
|
| @@ -29,4 +37,16 @@ void BluetoothGATTService::dispose(WebBluetoothGATTService* webService)
|
| delete webService;
|
| }
|
|
|
| +ScriptPromise BluetoothGATTService::getCharacteristic(ScriptState* scriptState,
|
| + String characteristicUUID)
|
| +{
|
| + WebBluetooth* webbluetooth = Platform::current()->bluetooth();
|
| + if (!webbluetooth)
|
| + return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(NotSupportedError));
|
| + RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scriptState);
|
| + ScriptPromise promise = resolver->promise();
|
| + webbluetooth->getCharacteristic(m_webService.serviceInstanceID, characteristicUUID, new CallbackPromiseAdapter<BluetoothGATTCharacteristic, BluetoothError>(resolver));
|
| + return promise;
|
| +}
|
| +
|
| } // namespace blink
|
|
|