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 WebBluetooth_h | 5 #ifndef WebBluetooth_h |
6 #define WebBluetooth_h | 6 #define WebBluetooth_h |
7 | 7 |
8 #include "public/platform/WebCallbacks.h" | 8 #include "public/platform/WebCallbacks.h" |
9 #include "public/platform/WebString.h" | 9 #include "public/platform/WebString.h" |
10 #include "public/platform/WebVector.h" | 10 #include "public/platform/WebVector.h" |
11 #include "public/platform/modules/bluetooth/WebBluetoothError.h" | |
12 #include "public/platform/modules/bluetooth/web_bluetooth.mojom.h" | 11 #include "public/platform/modules/bluetooth/web_bluetooth.mojom.h" |
13 | 12 |
14 #include <memory> | 13 #include <memory> |
15 | 14 |
16 namespace blink { | 15 namespace blink { |
17 | 16 |
18 class WebBluetoothRemoteGATTCharacteristic; | 17 class WebBluetoothRemoteGATTCharacteristic; |
19 | 18 |
20 struct WebBluetoothDevice; | 19 struct WebBluetoothDevice; |
21 struct WebBluetoothRemoteGATTCharacteristicInit; | 20 struct WebBluetoothRemoteGATTCharacteristicInit; |
22 struct WebBluetoothRemoteGATTService; | 21 struct WebBluetoothRemoteGATTService; |
23 struct WebRequestDeviceOptions; | 22 struct WebRequestDeviceOptions; |
24 | 23 |
25 // Success and failure callbacks for requestDevice. | 24 // Success and failure callbacks for requestDevice. |
26 using WebBluetoothRequestDeviceCallbacks = WebCallbacks<std::unique_ptr<WebBluet
oothDevice>, const WebBluetoothError&>; | 25 using WebBluetoothRequestDeviceCallbacks = WebCallbacks<std::unique_ptr<WebBluet
oothDevice>, const mojom::WebBluetoothError&>; |
27 | 26 |
28 // Success and failure callbacks for connectGATT. | 27 // Success and failure callbacks for connectGATT. |
29 using WebBluetoothRemoteGATTServerConnectCallbacks = WebCallbacks<void, const We
bBluetoothError&>; | 28 using WebBluetoothRemoteGATTServerConnectCallbacks = WebCallbacks<void, const mo
jom::WebBluetoothError&>; |
30 | 29 |
31 // Success and failure callbacks for getPrimaryService. | 30 // Success and failure callbacks for getPrimaryService. |
32 using WebBluetoothGetPrimaryServiceCallbacks = WebCallbacks<std::unique_ptr<WebB
luetoothRemoteGATTService>, const WebBluetoothError&>; | 31 using WebBluetoothGetPrimaryServiceCallbacks = WebCallbacks<std::unique_ptr<WebB
luetoothRemoteGATTService>, const mojom::WebBluetoothError&>; |
33 | 32 |
34 // Success and failure callbacks for getCharacteristic(s). | 33 // Success and failure callbacks for getCharacteristic(s). |
35 using WebBluetoothGetCharacteristicsCallbacks = WebCallbacks<const WebVector<Web
BluetoothRemoteGATTCharacteristicInit*>&, const WebBluetoothError&>; | 34 using WebBluetoothGetCharacteristicsCallbacks = WebCallbacks<const WebVector<Web
BluetoothRemoteGATTCharacteristicInit*>&, const mojom::WebBluetoothError&>; |
36 | 35 |
37 // Success and failure callbacks for readValue. | 36 // Success and failure callbacks for readValue. |
38 using WebBluetoothReadValueCallbacks = WebCallbacks<const WebVector<uint8_t>&, c
onst WebBluetoothError&>; | 37 using WebBluetoothReadValueCallbacks = WebCallbacks<const WebVector<uint8_t>&, c
onst mojom::WebBluetoothError&>; |
39 | 38 |
40 // Success and failure callbacks for writeValue. | 39 // Success and failure callbacks for writeValue. |
41 using WebBluetoothWriteValueCallbacks = WebCallbacks<const WebVector<uint8_t>&,
const WebBluetoothError&>; | 40 using WebBluetoothWriteValueCallbacks = WebCallbacks<const WebVector<uint8_t>&,
const mojom::WebBluetoothError&>; |
42 | 41 |
43 // Success and failure callbacks for characteristic.startNotifications and | 42 // Success and failure callbacks for characteristic.startNotifications and |
44 // characteristic.stopNotifications. | 43 // characteristic.stopNotifications. |
45 using WebBluetoothNotificationsCallbacks = WebCallbacks<void, const WebBluetooth
Error&>; | 44 using WebBluetoothNotificationsCallbacks = WebCallbacks<void, const mojom::WebBl
uetoothError&>; |
46 | 45 |
47 class WebBluetooth { | 46 class WebBluetooth { |
48 public: | 47 public: |
49 virtual ~WebBluetooth() { } | 48 virtual ~WebBluetooth() { } |
50 | 49 |
51 // Bluetooth Methods: | 50 // Bluetooth Methods: |
52 // See https://webbluetoothchrome.github.io/web-bluetooth/#device-discovery | 51 // See https://webbluetoothchrome.github.io/web-bluetooth/#device-discovery |
53 // WebBluetoothRequestDeviceCallbacks ownership transferred to the client. | 52 // WebBluetoothRequestDeviceCallbacks ownership transferred to the client. |
54 virtual void requestDevice(const WebRequestDeviceOptions&, WebBluetoothReque
stDeviceCallbacks*) { } | 53 virtual void requestDevice(const WebRequestDeviceOptions&, WebBluetoothReque
stDeviceCallbacks*) { } |
55 | 54 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 const WebString& characteristicInstanceID, | 88 const WebString& characteristicInstanceID, |
90 WebBluetoothRemoteGATTCharacteristic*) = 0; | 89 WebBluetoothRemoteGATTCharacteristic*) = 0; |
91 virtual void characteristicObjectRemoved( | 90 virtual void characteristicObjectRemoved( |
92 const WebString& characteristicInstanceID, | 91 const WebString& characteristicInstanceID, |
93 WebBluetoothRemoteGATTCharacteristic*) {} | 92 WebBluetoothRemoteGATTCharacteristic*) {} |
94 }; | 93 }; |
95 | 94 |
96 } // namespace blink | 95 } // namespace blink |
97 | 96 |
98 #endif // WebBluetooth_h | 97 #endif // WebBluetooth_h |
OLD | NEW |