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

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

Issue 2466223002: Implement WebBluetooth getDescriptor[s] (Closed)
Patch Set: Removing BDH_INVALID_DESCRIPTOR_ID Created 4 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 BluetoothDevice_h 5 #ifndef BluetoothDevice_h
6 #define BluetoothDevice_h 6 #define BluetoothDevice_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 "modules/EventTargetModules.h" 10 #include "modules/EventTargetModules.h"
11 #include "modules/bluetooth/BluetoothRemoteGATTServer.h" 11 #include "modules/bluetooth/BluetoothRemoteGATTServer.h"
12 #include "platform/heap/Heap.h" 12 #include "platform/heap/Heap.h"
13 #include "public/platform/modules/bluetooth/WebBluetoothDevice.h" 13 #include "public/platform/modules/bluetooth/WebBluetoothDevice.h"
14 #include "public/platform/modules/bluetooth/WebBluetoothDeviceInit.h" 14 #include "public/platform/modules/bluetooth/WebBluetoothDeviceInit.h"
15 #include "wtf/text/WTFString.h" 15 #include "wtf/text/WTFString.h"
16 #include <memory> 16 #include <memory>
17 17
18 namespace blink { 18 namespace blink {
19 19
20 class BluetoothAttributeInstanceMap; 20 class BluetoothAttributeInstanceMap;
21 class BluetoothRemoteGATTCharacteristic; 21 class BluetoothRemoteGATTCharacteristic;
22 class BluetoothRemoteGATTDescriptor;
22 class BluetoothRemoteGATTServer; 23 class BluetoothRemoteGATTServer;
23 class BluetoothRemoteGATTService; 24 class BluetoothRemoteGATTService;
24 class ScriptPromiseResolver; 25 class ScriptPromiseResolver;
25 26
26 struct WebBluetoothRemoteGATTCharacteristicInit; 27 struct WebBluetoothRemoteGATTCharacteristicInit;
28 struct WebBluetoothRemoteGATTDescriptorInit;
27 struct WebBluetoothRemoteGATTService; 29 struct WebBluetoothRemoteGATTService;
28 30
29 // BluetoothDevice represents a physical bluetooth device in the DOM. See IDL. 31 // BluetoothDevice represents a physical bluetooth device in the DOM. See IDL.
30 // 32 //
31 // Callbacks providing WebBluetoothDevice objects are handled by 33 // Callbacks providing WebBluetoothDevice objects are handled by
32 // CallbackPromiseAdapter templatized with this class. See this class's 34 // CallbackPromiseAdapter templatized with this class. See this class's
33 // "Interface required by CallbackPromiseAdapter" section and the 35 // "Interface required by CallbackPromiseAdapter" section and the
34 // CallbackPromiseAdapter class comments. 36 // CallbackPromiseAdapter class comments.
35 class BluetoothDevice final : public EventTargetWithInlineData, 37 class BluetoothDevice final : public EventTargetWithInlineData,
36 public ContextLifecycleObserver, 38 public ContextLifecycleObserver,
(...skipping 14 matching lines...) Expand all
51 std::unique_ptr<WebBluetoothRemoteGATTService>); 53 std::unique_ptr<WebBluetoothRemoteGATTService>);
52 bool isValidService(const String& serviceInstanceId); 54 bool isValidService(const String& serviceInstanceId);
53 55
54 BluetoothRemoteGATTCharacteristic* 56 BluetoothRemoteGATTCharacteristic*
55 getOrCreateBluetoothRemoteGATTCharacteristic( 57 getOrCreateBluetoothRemoteGATTCharacteristic(
56 ExecutionContext*, 58 ExecutionContext*,
57 std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit>, 59 std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit>,
58 BluetoothRemoteGATTService*); 60 BluetoothRemoteGATTService*);
59 bool isValidCharacteristic(const String& characteristicInstanceId); 61 bool isValidCharacteristic(const String& characteristicInstanceId);
60 62
63 BluetoothRemoteGATTDescriptor* getOrCreateBluetoothRemoteGATTDescriptor(
64 std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit>,
65 BluetoothRemoteGATTCharacteristic*);
66 bool isValidDescriptor(const String& descriptorInstanceId);
dcheng 2016/12/09 08:17:57 I might be missing something, but this doesn't app
dougt 2016/12/09 19:20:06 removed. this is work for descriptor readValue/wr
67
61 // We should disconnect from the device in all of the following cases: 68 // We should disconnect from the device in all of the following cases:
62 // 1. When the object gets GarbageCollected e.g. it went out of scope. 69 // 1. When the object gets GarbageCollected e.g. it went out of scope.
63 // dispose() is called in this case. 70 // dispose() is called in this case.
64 // 2. When the parent document gets detached e.g. reloading a page. 71 // 2. When the parent document gets detached e.g. reloading a page.
65 // stop() is called in this case. 72 // stop() is called in this case.
66 // TODO(ortuno): Users should be able to turn on notifications for 73 // TODO(ortuno): Users should be able to turn on notifications for
67 // events on navigator.bluetooth and still remain connected even if the 74 // events on navigator.bluetooth and still remain connected even if the
68 // BluetoothDevice object is garbage collected. 75 // BluetoothDevice object is garbage collected.
69 76
70 // USING_PRE_FINALIZER interface. 77 // USING_PRE_FINALIZER interface.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // Holds all GATT Attributes associated with this BluetoothDevice. 112 // Holds all GATT Attributes associated with this BluetoothDevice.
106 Member<BluetoothAttributeInstanceMap> m_attributeInstanceMap; 113 Member<BluetoothAttributeInstanceMap> m_attributeInstanceMap;
107 114
108 std::unique_ptr<WebBluetoothDeviceInit> m_webDevice; 115 std::unique_ptr<WebBluetoothDeviceInit> m_webDevice;
109 Member<BluetoothRemoteGATTServer> m_gatt; 116 Member<BluetoothRemoteGATTServer> m_gatt;
110 }; 117 };
111 118
112 } // namespace blink 119 } // namespace blink
113 120
114 #endif // BluetoothDevice_h 121 #endif // BluetoothDevice_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698