| 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 BluetoothRemoteGATTService_h | 5 #ifndef BluetoothRemoteGATTService_h |
| 6 #define BluetoothRemoteGATTService_h | 6 #define BluetoothRemoteGATTService_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptWrappable.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
| 9 #include "bindings/modules/v8/StringOrUnsignedLong.h" | 9 #include "bindings/modules/v8/StringOrUnsignedLong.h" |
| 10 #include "modules/bluetooth/BluetoothDevice.h" | 10 #include "modules/bluetooth/BluetoothDevice.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // Callbacks providing WebBluetoothRemoteGATTService objects are handled by | 26 // Callbacks providing WebBluetoothRemoteGATTService objects are handled by |
| 27 // CallbackPromiseAdapter templatized with this class. See this class's | 27 // CallbackPromiseAdapter templatized with this class. See this class's |
| 28 // "Interface required by CallbackPromiseAdapter" section and the | 28 // "Interface required by CallbackPromiseAdapter" section and the |
| 29 // CallbackPromiseAdapter class comments. | 29 // CallbackPromiseAdapter class comments. |
| 30 class BluetoothRemoteGATTService final | 30 class BluetoothRemoteGATTService final |
| 31 : public GarbageCollectedFinalized<BluetoothRemoteGATTService>, | 31 : public GarbageCollectedFinalized<BluetoothRemoteGATTService>, |
| 32 public ScriptWrappable { | 32 public ScriptWrappable { |
| 33 DEFINE_WRAPPERTYPEINFO(); | 33 DEFINE_WRAPPERTYPEINFO(); |
| 34 | 34 |
| 35 public: | 35 public: |
| 36 BluetoothRemoteGATTService(const String& serviceInstanceId, | 36 BluetoothRemoteGATTService(mojom::blink::WebBluetoothRemoteGATTServicePtr, |
| 37 const String& uuid, | |
| 38 bool isPrimary, | 37 bool isPrimary, |
| 39 const String& deviceInstanceId, | 38 const String& deviceInstanceId, |
| 40 BluetoothDevice*); | 39 BluetoothDevice*); |
| 41 | 40 |
| 42 // Interface required by garbage collection. | 41 // Interface required by garbage collection. |
| 43 DECLARE_VIRTUAL_TRACE(); | 42 DECLARE_VIRTUAL_TRACE(); |
| 44 | 43 |
| 45 // IDL exposed interface: | 44 // IDL exposed interface: |
| 46 String uuid() { return m_uuid; } | 45 String uuid() { return m_service->uuid; } |
| 47 bool isPrimary() { return m_isPrimary; } | 46 bool isPrimary() { return m_isPrimary; } |
| 48 BluetoothDevice* device() { return m_device; } | 47 BluetoothDevice* device() { return m_device; } |
| 49 ScriptPromise getCharacteristic(ScriptState*, | 48 ScriptPromise getCharacteristic(ScriptState*, |
| 50 const StringOrUnsignedLong& characteristic, | 49 const StringOrUnsignedLong& characteristic, |
| 51 ExceptionState&); | 50 ExceptionState&); |
| 52 ScriptPromise getCharacteristics(ScriptState*, | 51 ScriptPromise getCharacteristics(ScriptState*, |
| 53 const StringOrUnsignedLong& characteristic, | 52 const StringOrUnsignedLong& characteristic, |
| 54 ExceptionState&); | 53 ExceptionState&); |
| 55 ScriptPromise getCharacteristics(ScriptState*, ExceptionState&); | 54 ScriptPromise getCharacteristics(ScriptState*, ExceptionState&); |
| 56 | 55 |
| 57 private: | 56 private: |
| 58 void GetCharacteristicsCallback( | 57 void GetCharacteristicsCallback( |
| 59 const String& serviceInstanceId, | 58 const String& serviceInstanceId, |
| 60 mojom::blink::WebBluetoothGATTQueryQuantity, | 59 mojom::blink::WebBluetoothGATTQueryQuantity, |
| 61 ScriptPromiseResolver*, | 60 ScriptPromiseResolver*, |
| 62 mojom::blink::WebBluetoothResult, | 61 mojom::blink::WebBluetoothResult, |
| 63 Optional<Vector<mojom::blink::WebBluetoothRemoteGATTCharacteristicPtr>> | 62 Optional<Vector<mojom::blink::WebBluetoothRemoteGATTCharacteristicPtr>> |
| 64 services); | 63 characteristics); |
| 65 | 64 |
| 66 ScriptPromise getCharacteristicsImpl( | 65 ScriptPromise getCharacteristicsImpl( |
| 67 ScriptState*, | 66 ScriptState*, |
| 68 mojom::blink::WebBluetoothGATTQueryQuantity, | 67 mojom::blink::WebBluetoothGATTQueryQuantity, |
| 69 const String& characteristicUUID = String()); | 68 const String& characteristicUUID = String()); |
| 70 | 69 |
| 71 const String m_serviceInstanceId; | 70 mojom::blink::WebBluetoothRemoteGATTServicePtr m_service; |
| 72 const String m_uuid; | |
| 73 const bool m_isPrimary; | 71 const bool m_isPrimary; |
| 74 const String m_deviceInstanceId; | 72 const String m_deviceInstanceId; |
| 75 Member<BluetoothDevice> m_device; | 73 Member<BluetoothDevice> m_device; |
| 76 }; | 74 }; |
| 77 | 75 |
| 78 } // namespace blink | 76 } // namespace blink |
| 79 | 77 |
| 80 #endif // BluetoothRemoteGATTService_h | 78 #endif // BluetoothRemoteGATTService_h |
| OLD | NEW |