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

Side by Side Diff: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.h

Issue 2615093002: Typemap WebBluetoothDeviceId to WTF::String (Closed)
Patch Set: merge master Created 3 years, 11 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 unified diff | Download patch
OLDNEW
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 BluetoothRemoteGATTCharacteristic_h 5 #ifndef BluetoothRemoteGATTCharacteristic_h
6 #define BluetoothRemoteGATTCharacteristic_h 6 #define BluetoothRemoteGATTCharacteristic_h
7 7
8 #include "bindings/core/v8/ScriptWrappable.h" 8 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "core/dom/ContextLifecycleObserver.h" 9 #include "core/dom/ContextLifecycleObserver.h"
10 #include "core/dom/DOMArrayPiece.h" 10 #include "core/dom/DOMArrayPiece.h"
(...skipping 24 matching lines...) Expand all
35 class BluetoothRemoteGATTCharacteristic final 35 class BluetoothRemoteGATTCharacteristic final
36 : public EventTargetWithInlineData, 36 : public EventTargetWithInlineData,
37 public ContextLifecycleObserver { 37 public ContextLifecycleObserver {
38 USING_PRE_FINALIZER(BluetoothRemoteGATTCharacteristic, dispose); 38 USING_PRE_FINALIZER(BluetoothRemoteGATTCharacteristic, dispose);
39 DEFINE_WRAPPERTYPEINFO(); 39 DEFINE_WRAPPERTYPEINFO();
40 USING_GARBAGE_COLLECTED_MIXIN(BluetoothRemoteGATTCharacteristic); 40 USING_GARBAGE_COLLECTED_MIXIN(BluetoothRemoteGATTCharacteristic);
41 41
42 public: 42 public:
43 explicit BluetoothRemoteGATTCharacteristic( 43 explicit BluetoothRemoteGATTCharacteristic(
44 ExecutionContext*, 44 ExecutionContext*,
45 const String& characteristicInstanceId,
46 const String& serviceInstanceId, 45 const String& serviceInstanceId,
47 const String& uuid, 46 mojom::blink::WebBluetoothRemoteGATTCharacteristicPtr,
48 uint32_t characteristicProperties,
49 BluetoothRemoteGATTService*, 47 BluetoothRemoteGATTService*,
50 BluetoothDevice*); 48 BluetoothDevice*);
51 49
52 static BluetoothRemoteGATTCharacteristic* create( 50 static BluetoothRemoteGATTCharacteristic* create(
53 ExecutionContext*, 51 ExecutionContext*,
54 const String& characteristicInstanceId,
55 const String& serviceInstanceId, 52 const String& serviceInstanceId,
56 const String& uuid, 53 mojom::blink::WebBluetoothRemoteGATTCharacteristicPtr,
57 uint32_t characteristicProperties,
58 BluetoothRemoteGATTService*, 54 BluetoothRemoteGATTService*,
59 BluetoothDevice*); 55 BluetoothDevice*);
60 56
61 // Save value. 57 // Save value.
62 void setValue(DOMDataView*); 58 void setValue(DOMDataView*);
63 59
64 void dispatchCharacteristicValueChanged(const Vector<uint8_t>& value); 60 void dispatchCharacteristicValueChanged(const Vector<uint8_t>& value);
65 61
66 // ContextLifecycleObserver interface. 62 // ContextLifecycleObserver interface.
67 void contextDestroyed() override; 63 void contextDestroyed() override;
68 64
69 // USING_PRE_FINALIZER interface. 65 // USING_PRE_FINALIZER interface.
70 // Called before the object gets garbage collected. 66 // Called before the object gets garbage collected.
71 void dispose(); 67 void dispose();
72 68
73 // Notify our embedder that we should stop any notifications. 69 // Notify our embedder that we should stop any notifications.
74 // The function only notifies the embedder once. 70 // The function only notifies the embedder once.
75 void notifyCharacteristicObjectRemoved(); 71 void notifyCharacteristicObjectRemoved();
76 72
77 // EventTarget methods: 73 // EventTarget methods:
78 const AtomicString& interfaceName() const override; 74 const AtomicString& interfaceName() const override;
79 ExecutionContext* getExecutionContext() const; 75 ExecutionContext* getExecutionContext() const;
80 76
81 // Interface required by garbage collection. 77 // Interface required by garbage collection.
82 DECLARE_VIRTUAL_TRACE(); 78 DECLARE_VIRTUAL_TRACE();
83 79
84 // IDL exposed interface: 80 // IDL exposed interface:
85 BluetoothRemoteGATTService* service() { return m_service; } 81 BluetoothRemoteGATTService* service() { return m_service; }
86 String uuid() { return m_uuid; } 82 String uuid() { return m_characteristic->uuid; }
87 BluetoothCharacteristicProperties* properties() { return m_properties; } 83 BluetoothCharacteristicProperties* properties() { return m_properties; }
88 DOMDataView* value() const { return m_value; } 84 DOMDataView* value() const { return m_value; }
89 ScriptPromise readValue(ScriptState*); 85 ScriptPromise readValue(ScriptState*);
90 ScriptPromise writeValue(ScriptState*, const DOMArrayPiece&); 86 ScriptPromise writeValue(ScriptState*, const DOMArrayPiece&);
91 ScriptPromise startNotifications(ScriptState*); 87 ScriptPromise startNotifications(ScriptState*);
92 ScriptPromise stopNotifications(ScriptState*); 88 ScriptPromise stopNotifications(ScriptState*);
93 89
94 DEFINE_ATTRIBUTE_EVENT_LISTENER(characteristicvaluechanged); 90 DEFINE_ATTRIBUTE_EVENT_LISTENER(characteristicvaluechanged);
95 91
96 protected: 92 protected:
97 // EventTarget overrides. 93 // EventTarget overrides.
98 void addedEventListener(const AtomicString& eventType, 94 void addedEventListener(const AtomicString& eventType,
99 RegisteredEventListener&) override; 95 RegisteredEventListener&) override;
100 96
101 private: 97 private:
102 BluetoothRemoteGATTServer* gatt() { return m_service->device()->gatt(); } 98 BluetoothRemoteGATTServer* gatt() { return m_service->device()->gatt(); }
103 99
104 void ReadValueCallback(ScriptPromiseResolver*, 100 void ReadValueCallback(ScriptPromiseResolver*,
105 mojom::blink::WebBluetoothResult, 101 mojom::blink::WebBluetoothResult,
106 const Optional<Vector<uint8_t>>& value); 102 const Optional<Vector<uint8_t>>& value);
107 void WriteValueCallback(ScriptPromiseResolver*, 103 void WriteValueCallback(ScriptPromiseResolver*,
108 const Vector<uint8_t>& value, 104 const Vector<uint8_t>& value,
109 mojom::blink::WebBluetoothResult); 105 mojom::blink::WebBluetoothResult);
110 void NotificationsCallback(ScriptPromiseResolver*, 106 void NotificationsCallback(ScriptPromiseResolver*,
111 mojom::blink::WebBluetoothResult); 107 mojom::blink::WebBluetoothResult);
112 108
113 const String m_characteristicInstanceId;
114 const String m_serviceInstanceId; 109 const String m_serviceInstanceId;
115 const String m_uuid; 110 mojom::blink::WebBluetoothRemoteGATTCharacteristicPtr m_characteristic;
116 const uint32_t m_characteristicProperties;
117 Member<BluetoothRemoteGATTService> m_service; 111 Member<BluetoothRemoteGATTService> m_service;
118 bool m_stopped; 112 bool m_stopped;
119 Member<BluetoothCharacteristicProperties> m_properties; 113 Member<BluetoothCharacteristicProperties> m_properties;
120 Member<DOMDataView> m_value; 114 Member<DOMDataView> m_value;
121 Member<BluetoothDevice> m_device; 115 Member<BluetoothDevice> m_device;
122 }; 116 };
123 117
124 } // namespace blink 118 } // namespace blink
125 119
126 #endif // BluetoothRemoteGATTCharacteristic_h 120 #endif // BluetoothRemoteGATTCharacteristic_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698