Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Unified Diff: Source/modules/bluetooth/BluetoothGATTService.cpp

Issue 1146163005: bluetooth: Blink-side implementation of getCharacteristic. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@bluetooth-characteristic-interface
Patch Set: Merged with TOT Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/bluetooth/BluetoothGATTService.h ('k') | Source/modules/bluetooth/BluetoothGATTService.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/bluetooth/BluetoothGATTService.cpp
diff --git a/Source/modules/bluetooth/BluetoothGATTService.cpp b/Source/modules/bluetooth/BluetoothGATTService.cpp
index bbe5c0d7c54819e2a3362cb7e067272944072fa1..3bf710aa89b67c56c763e0c6639c18a8b5d45394 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 {
@@ -28,4 +36,16 @@ void BluetoothGATTService::dispose(WebBluetoothGATTService* webService)
delete webService;
}
+ScriptPromise BluetoothGATTService::getCharacteristic(ScriptState* scriptState,
+ String characteristicUUID)
+{
+ WebBluetooth* webbluetooth = Platform::current()->bluetooth();
+
+ 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
« no previous file with comments | « Source/modules/bluetooth/BluetoothGATTService.h ('k') | Source/modules/bluetooth/BluetoothGATTService.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698