OLD | NEW |
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 CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ |
6 #define CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ | 6 #define CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 int32_t quantity /* Corresponds to WebBluetoothGATTQueryQuantity in | 57 int32_t quantity /* Corresponds to WebBluetoothGATTQueryQuantity in |
58 web_bluetooth.mojom */, | 58 web_bluetooth.mojom */, |
59 const blink::WebString& services_uuid, | 59 const blink::WebString& services_uuid, |
60 blink::WebBluetoothGetPrimaryServicesCallbacks* callbacks) override; | 60 blink::WebBluetoothGetPrimaryServicesCallbacks* callbacks) override; |
61 void getCharacteristics( | 61 void getCharacteristics( |
62 const blink::WebString& service_instance_id, | 62 const blink::WebString& service_instance_id, |
63 int32_t quantity /* Corresponds to WebBluetoothGATTQueryQuantity in | 63 int32_t quantity /* Corresponds to WebBluetoothGATTQueryQuantity in |
64 web_bluetooth.mojom */, | 64 web_bluetooth.mojom */, |
65 const blink::WebString& characteristics_uuid, | 65 const blink::WebString& characteristics_uuid, |
66 blink::WebBluetoothGetCharacteristicsCallbacks* callbacks) override; | 66 blink::WebBluetoothGetCharacteristicsCallbacks* callbacks) override; |
67 void readValue(const blink::WebString& characteristic_instance_id, | 67 void characteristicReadValue( |
68 blink::WebBluetoothReadValueCallbacks* callbacks) override; | 68 const blink::WebString& characteristic_instance_id, |
69 void writeValue(const blink::WebString& characteristic_instance_id, | 69 blink::WebBluetoothReadValueCallbacks* callbacks) override; |
70 const blink::WebVector<uint8_t>& value, | 70 void characteristicWriteValue( |
71 blink::WebBluetoothWriteValueCallbacks*) override; | 71 const blink::WebString& characteristic_instance_id, |
| 72 const blink::WebVector<uint8_t>& value, |
| 73 blink::WebBluetoothWriteValueCallbacks*) override; |
72 void startNotifications( | 74 void startNotifications( |
73 const blink::WebString& characteristic_instance_id, | 75 const blink::WebString& characteristic_instance_id, |
74 blink::WebBluetoothNotificationsCallbacks*) override; | 76 blink::WebBluetoothNotificationsCallbacks*) override; |
75 void stopNotifications( | 77 void stopNotifications( |
76 const blink::WebString& characteristic_instance_id, | 78 const blink::WebString& characteristic_instance_id, |
77 blink::WebBluetoothNotificationsCallbacks*) override; | 79 blink::WebBluetoothNotificationsCallbacks*) override; |
78 void characteristicObjectRemoved( | 80 void characteristicObjectRemoved( |
79 const blink::WebString& characteristic_instance_id, | 81 const blink::WebString& characteristic_instance_id, |
80 blink::WebBluetoothRemoteGATTCharacteristic* characteristic) override; | 82 blink::WebBluetoothRemoteGATTCharacteristic* characteristic) override; |
81 void registerCharacteristicObject( | 83 void registerCharacteristicObject( |
82 const blink::WebString& characteristic_instance_id, | 84 const blink::WebString& characteristic_instance_id, |
83 blink::WebBluetoothRemoteGATTCharacteristic* characteristic) override; | 85 blink::WebBluetoothRemoteGATTCharacteristic* characteristic) override; |
| 86 void getDescriptors( |
| 87 const blink::WebString& characteristic_instance_id, |
| 88 int32_t quantity /* Corresponds to WebBluetoothGATTQueryQuantity in |
| 89 web_bluetooth.mojom */, |
| 90 const blink::WebString& descriptor_uuid, |
| 91 blink::WebBluetoothGetDescriptorsCallbacks* callbacks) override; |
84 | 92 |
85 private: | 93 private: |
86 struct GetCharacteristicsCallback; | 94 struct GetCharacteristicsCallback; |
87 // WebBluetoothServiceClient methods: | 95 // WebBluetoothServiceClient methods: |
88 void RemoteCharacteristicValueChanged( | 96 void RemoteCharacteristicValueChanged( |
89 const std::string& characteristic_instance_id, | 97 const std::string& characteristic_instance_id, |
90 const std::vector<uint8_t>& value) override; | 98 const std::vector<uint8_t>& value) override; |
| 99 |
91 void GattServerDisconnected(const WebBluetoothDeviceId& device_id) override; | 100 void GattServerDisconnected(const WebBluetoothDeviceId& device_id) override; |
92 | 101 |
93 // Callbacks for WebBluetoothService calls: | 102 // Callbacks for WebBluetoothService calls: |
94 void OnRequestDeviceComplete( | 103 void OnRequestDeviceComplete( |
95 std::unique_ptr<blink::WebBluetoothRequestDeviceCallbacks> callbacks, | 104 std::unique_ptr<blink::WebBluetoothRequestDeviceCallbacks> callbacks, |
96 const blink::mojom::WebBluetoothResult result, | 105 const blink::mojom::WebBluetoothResult result, |
97 blink::mojom::WebBluetoothDevicePtr device); | 106 blink::mojom::WebBluetoothDevicePtr device); |
98 void OnConnectComplete( | 107 void OnConnectComplete( |
99 std::unique_ptr<blink::WebBluetoothRemoteGATTServerConnectCallbacks> | 108 std::unique_ptr<blink::WebBluetoothRemoteGATTServerConnectCallbacks> |
100 callbacks, | 109 callbacks, |
(...skipping 18 matching lines...) Expand all Loading... |
119 const base::Optional<std::vector<uint8_t>>& value); | 128 const base::Optional<std::vector<uint8_t>>& value); |
120 void OnWriteValueComplete( | 129 void OnWriteValueComplete( |
121 const blink::WebVector<uint8_t>& value, | 130 const blink::WebVector<uint8_t>& value, |
122 std::unique_ptr<blink::WebBluetoothWriteValueCallbacks> callbacks, | 131 std::unique_ptr<blink::WebBluetoothWriteValueCallbacks> callbacks, |
123 blink::mojom::WebBluetoothResult result); | 132 blink::mojom::WebBluetoothResult result); |
124 void OnStartNotificationsComplete( | 133 void OnStartNotificationsComplete( |
125 std::unique_ptr<blink::WebBluetoothNotificationsCallbacks> callbacks, | 134 std::unique_ptr<blink::WebBluetoothNotificationsCallbacks> callbacks, |
126 blink::mojom::WebBluetoothResult result); | 135 blink::mojom::WebBluetoothResult result); |
127 void OnStopNotificationsComplete( | 136 void OnStopNotificationsComplete( |
128 std::unique_ptr<blink::WebBluetoothNotificationsCallbacks> callbacks); | 137 std::unique_ptr<blink::WebBluetoothNotificationsCallbacks> callbacks); |
129 | 138 void OnGetDescriptorsComplete( |
| 139 const blink::WebString& service_instance_id, |
| 140 std::unique_ptr<blink::WebBluetoothGetDescriptorsCallbacks> callbacks, |
| 141 blink::mojom::WebBluetoothResult result, |
| 142 base::Optional< |
| 143 std::vector<blink::mojom::WebBluetoothRemoteGATTDescriptorPtr>> |
| 144 descriptors); |
130 void DispatchCharacteristicValueChanged( | 145 void DispatchCharacteristicValueChanged( |
131 const std::string& characteristic_instance_id, | 146 const std::string& characteristic_instance_id, |
132 const std::vector<uint8_t>& value); | 147 const std::vector<uint8_t>& value); |
133 | 148 |
134 blink::mojom::WebBluetoothService& GetWebBluetoothService(); | 149 blink::mojom::WebBluetoothService& GetWebBluetoothService(); |
135 service_manager::InterfaceProvider* const remote_interfaces_; | 150 service_manager::InterfaceProvider* const remote_interfaces_; |
136 blink::mojom::WebBluetoothServicePtr web_bluetooth_service_; | 151 blink::mojom::WebBluetoothServicePtr web_bluetooth_service_; |
137 | 152 |
138 // Map of characteristic_instance_ids to | 153 // Map of characteristic_instance_ids to |
139 // WebBluetoothRemoteGATTCharacteristics. When characteristicObjectRemoved is | 154 // WebBluetoothRemoteGATTCharacteristics. When characteristicObjectRemoved is |
(...skipping 12 matching lines...) Expand all Loading... |
152 | 167 |
153 // Binding associated with |web_bluetooth_service_|. | 168 // Binding associated with |web_bluetooth_service_|. |
154 mojo::AssociatedBinding<blink::mojom::WebBluetoothServiceClient> binding_; | 169 mojo::AssociatedBinding<blink::mojom::WebBluetoothServiceClient> binding_; |
155 | 170 |
156 DISALLOW_COPY_AND_ASSIGN(WebBluetoothImpl); | 171 DISALLOW_COPY_AND_ASSIGN(WebBluetoothImpl); |
157 }; | 172 }; |
158 | 173 |
159 } // namespace content | 174 } // namespace content |
160 | 175 |
161 #endif // CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ | 176 #endif // CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ |
OLD | NEW |