| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BluetoothGATTRemoteServer_h | 5 #ifndef BluetoothGATTRemoteServer_h |
| 6 #define BluetoothGATTRemoteServer_h | 6 #define BluetoothGATTRemoteServer_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptWrappable.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
| 9 #include "platform/heap/Heap.h" | 9 #include "platform/heap/Heap.h" |
| 10 #include "public/platform/modules/bluetooth/WebBluetoothGATTRemoteServer.h" | 10 #include "public/platform/modules/bluetooth/WebBluetoothGATTRemoteServer.h" |
| 11 #include "wtf/text/WTFString.h" |
| 11 | 12 |
| 12 namespace blink { | 13 namespace blink { |
| 13 | 14 |
| 15 class ScriptPromise; |
| 14 class ScriptPromiseResolver; | 16 class ScriptPromiseResolver; |
| 17 class ScriptState; |
| 15 | 18 |
| 16 // BluetoothGATTRemoteServer provides a way to interact with a connected bluetoo
th peripheral. | 19 // BluetoothGATTRemoteServer provides a way to interact with a connected bluetoo
th peripheral. |
| 17 // | 20 // |
| 18 // Callbacks providing WebBluetoothGATTRemoteServer objects are handled by | 21 // Callbacks providing WebBluetoothGATTRemoteServer objects are handled by |
| 19 // CallbackPromiseAdapter templatized with this class. See this class's | 22 // CallbackPromiseAdapter templatized with this class. See this class's |
| 20 // "Interface required by CallbackPromiseAdapter" section and the | 23 // "Interface required by CallbackPromiseAdapter" section and the |
| 21 // CallbackPromiseAdapter class comments. | 24 // CallbackPromiseAdapter class comments. |
| 22 class BluetoothGATTRemoteServer final | 25 class BluetoothGATTRemoteServer final |
| 23 : public GarbageCollectedFinalized<BluetoothGATTRemoteServer> | 26 : public GarbageCollectedFinalized<BluetoothGATTRemoteServer> |
| 24 , public ScriptWrappable { | 27 , public ScriptWrappable { |
| 25 DEFINE_WRAPPERTYPEINFO(); | 28 DEFINE_WRAPPERTYPEINFO(); |
| 26 public: | 29 public: |
| 27 BluetoothGATTRemoteServer(const WebBluetoothGATTRemoteServer&); | 30 BluetoothGATTRemoteServer(const WebBluetoothGATTRemoteServer&); |
| 28 | 31 |
| 29 // Interface required by CallbackPromiseAdapter: | 32 // Interface required by CallbackPromiseAdapter: |
| 30 typedef WebBluetoothGATTRemoteServer WebType; | 33 typedef WebBluetoothGATTRemoteServer WebType; |
| 31 static BluetoothGATTRemoteServer* take(ScriptPromiseResolver*, WebBluetoothG
ATTRemoteServer*); | 34 static BluetoothGATTRemoteServer* take(ScriptPromiseResolver*, WebBluetoothG
ATTRemoteServer*); |
| 32 static void dispose(WebBluetoothGATTRemoteServer*); | 35 static void dispose(WebBluetoothGATTRemoteServer*); |
| 33 | 36 |
| 34 // Interface required by Garbage Collectoin: | 37 // Interface required by Garbage Collectoin: |
| 35 DEFINE_INLINE_TRACE() { } | 38 DEFINE_INLINE_TRACE() { } |
| 36 | 39 |
| 37 // IDL exposed interface: | 40 // IDL exposed interface: |
| 38 bool connected() { return m_webGATT.connected; } | 41 bool connected() { return m_webGATT.connected; } |
| 42 ScriptPromise getPrimaryService(ScriptState*, String serviceUUID); |
| 39 | 43 |
| 40 private: | 44 private: |
| 41 WebBluetoothGATTRemoteServer m_webGATT; | 45 WebBluetoothGATTRemoteServer m_webGATT; |
| 42 }; | 46 }; |
| 43 | 47 |
| 44 } // namespace blink | 48 } // namespace blink |
| 45 | 49 |
| 46 #endif // BluetoothDevice_h | 50 #endif // BluetoothDevice_h |
| OLD | NEW |