| 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 BluetoothGATTCharacteristic_h | 5 #ifndef BluetoothGATTCharacteristic_h |
| 6 #define BluetoothGATTCharacteristic_h | 6 #define BluetoothGATTCharacteristic_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/WebBluetoothGATTCharacteristic.h" | 10 #include "public/platform/modules/bluetooth/WebBluetoothGATTCharacteristic.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 // BluetoothGATTCharacteristic represents a GATT Characteristic, which is a | 19 // BluetoothGATTCharacteristic represents a GATT Characteristic, which is a |
| 18 // basic data element that provides further information about a peripheral's | 20 // basic data element that provides further information about a peripheral's |
| 19 // service. | 21 // service. |
| 20 // | 22 // |
| 21 // Callbacks providing WebBluetoothGATTCharacteristic objects are handled by | 23 // Callbacks providing WebBluetoothGATTCharacteristic 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 BluetoothGATTCharacteristic final | 27 class BluetoothGATTCharacteristic final |
| 26 : public GarbageCollectedFinalized<BluetoothGATTCharacteristic> | 28 : public GarbageCollectedFinalized<BluetoothGATTCharacteristic> |
| 27 , public ScriptWrappable { | 29 , public ScriptWrappable { |
| 28 DEFINE_WRAPPERTYPEINFO(); | 30 DEFINE_WRAPPERTYPEINFO(); |
| 29 public: | 31 public: |
| 30 explicit BluetoothGATTCharacteristic(PassOwnPtr<WebBluetoothGATTCharacterist
ic>); | 32 explicit BluetoothGATTCharacteristic(PassOwnPtr<WebBluetoothGATTCharacterist
ic>); |
| 31 | 33 |
| 32 // Interface required by CallbackPromiseAdapter. | 34 // Interface required by CallbackPromiseAdapter. |
| 33 typedef WebBluetoothGATTCharacteristic WebType; | 35 typedef WebBluetoothGATTCharacteristic WebType; |
| 34 static BluetoothGATTCharacteristic* take(ScriptPromiseResolver* , WebBluetoo
thGATTCharacteristic*); | 36 static BluetoothGATTCharacteristic* take(ScriptPromiseResolver* , WebBluetoo
thGATTCharacteristic*); |
| 35 static void dispose(WebBluetoothGATTCharacteristic*); | 37 static void dispose(WebBluetoothGATTCharacteristic*); |
| 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_webCharacteristic->uuid; } | 43 String uuid() { return m_webCharacteristic->uuid; } |
| 44 ScriptPromise readValue(ScriptState*); |
| 42 | 45 |
| 43 private: | 46 private: |
| 44 OwnPtr<WebBluetoothGATTCharacteristic> m_webCharacteristic; | 47 OwnPtr<WebBluetoothGATTCharacteristic> m_webCharacteristic; |
| 45 }; | 48 }; |
| 46 | 49 |
| 47 } // namespace blink | 50 } // namespace blink |
| 48 | 51 |
| 49 #endif // BluetoothGATTCharacteristic_h | 52 #endif // BluetoothGATTCharacteristic_h |
| OLD | NEW |