| 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 BluetoothGATTService_h | 5 #ifndef BluetoothGATTService_h |
| 6 #define BluetoothGATTService_h | 6 #define BluetoothGATTService_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptWrappable.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
| 9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
| 10 #include "public/platform/modules/bluetooth/WebBluetoothGATTService.h" | 10 #include "public/platform/modules/bluetooth/WebBluetoothGATTService.h" |
| 11 #include "wtf/text/WTFString.h" | 11 #include "wtf/text/WTFString.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 class ScriptPromise; |
| 15 class ScriptPromiseResolver; | 16 class ScriptPromiseResolver; |
| 17 class ScriptState; |
| 16 | 18 |
| 17 // Represents a GATT Service within a Bluetooth Peripheral, a collection of | 19 // Represents a GATT Service within a Bluetooth Peripheral, a collection of |
| 18 // characteristics and relationships to other services that encapsulate the | 20 // characteristics and relationships to other services that encapsulate the |
| 19 // behavior of part of a device. | 21 // behavior of part of a device. |
| 20 // | 22 // |
| 21 // Callbacks providing WebBluetoothGATTService objects are handled by | 23 // Callbacks providing WebBluetoothGATTService objects are handled by |
| 22 // CallbackPromiseAdapter templatized with this class. See this class's | 24 // CallbackPromiseAdapter templatized with this class. See this class's |
| 23 // "Interface required by CallbackPromiseAdapter" section and the | 25 // "Interface required by CallbackPromiseAdapter" section and the |
| 24 // CallbackPromiseAdapter class comments. | 26 // CallbackPromiseAdapter class comments. |
| 25 class BluetoothGATTService final | 27 class BluetoothGATTService final |
| 26 : public GarbageCollectedFinalized<BluetoothGATTService> | 28 : public GarbageCollectedFinalized<BluetoothGATTService> |
| 27 , public ScriptWrappable { | 29 , public ScriptWrappable { |
| 28 DEFINE_WRAPPERTYPEINFO(); | 30 DEFINE_WRAPPERTYPEINFO(); |
| 29 public: | 31 public: |
| 30 explicit BluetoothGATTService(const WebBluetoothGATTService&); | 32 explicit BluetoothGATTService(const WebBluetoothGATTService&); |
| 31 | 33 |
| 32 // Interface required by CallbackPromiseAdapter: | 34 // Interface required by CallbackPromiseAdapter: |
| 33 typedef WebBluetoothGATTService WebType; | 35 typedef WebBluetoothGATTService WebType; |
| 34 static BluetoothGATTService* take(ScriptPromiseResolver*, WebBluetoothGATTSe
rvice*); | 36 static BluetoothGATTService* take(ScriptPromiseResolver*, WebBluetoothGATTSe
rvice*); |
| 35 static void dispose(WebBluetoothGATTService*); | 37 static void dispose(WebBluetoothGATTService*); |
| 36 | 38 |
| 37 // Interface required by garbage collection. | 39 // Interface required by garbage collection. |
| 38 DEFINE_INLINE_TRACE() { } | 40 DEFINE_INLINE_TRACE() { } |
| 39 | 41 |
| 40 // IDL exposed interface: | 42 // IDL exposed interface: |
| 41 String uuid() { return m_webService.uuid; } | 43 String uuid() { return m_webService.uuid; } |
| 42 bool isPrimary() { return m_webService.isPrimary; } | 44 bool isPrimary() { return m_webService.isPrimary; } |
| 45 ScriptPromise getCharacteristic(ScriptState*, String characteristicUUID); |
| 43 | 46 |
| 44 private: | 47 private: |
| 45 WebBluetoothGATTService m_webService; | 48 WebBluetoothGATTService m_webService; |
| 46 }; | 49 }; |
| 47 | 50 |
| 48 } // namespace blink | 51 } // namespace blink |
| 49 | 52 |
| 50 #endif // BluetoothGATTService_h | 53 #endif // BluetoothGATTService_h |
| OLD | NEW |