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/WebPassOwnPtr.h" | |
10 #include "public/platform/WebString.h" | 9 #include "public/platform/WebString.h" |
11 #include "public/platform/WebVector.h" | 10 #include "public/platform/WebVector.h" |
12 #include "public/platform/modules/bluetooth/WebBluetoothError.h" | 11 #include "public/platform/modules/bluetooth/WebBluetoothError.h" |
13 | 12 |
| 13 #include <memory> |
| 14 |
14 namespace blink { | 15 namespace blink { |
15 | 16 |
16 class WebBluetoothRemoteGATTCharacteristic; | 17 class WebBluetoothRemoteGATTCharacteristic; |
17 | 18 |
18 struct WebBluetoothDevice; | 19 struct WebBluetoothDevice; |
19 struct WebBluetoothRemoteGATTCharacteristicInit; | 20 struct WebBluetoothRemoteGATTCharacteristicInit; |
20 struct WebBluetoothRemoteGATTService; | 21 struct WebBluetoothRemoteGATTService; |
21 struct WebRequestDeviceOptions; | 22 struct WebRequestDeviceOptions; |
22 | 23 |
23 // Success and failure callbacks for requestDevice. | 24 // Success and failure callbacks for requestDevice. |
24 using WebBluetoothRequestDeviceCallbacks = WebCallbacks<WebPassOwnPtr<WebBluetoo
thDevice>, const WebBluetoothError&>; | 25 using WebBluetoothRequestDeviceCallbacks = WebCallbacks<std::unique_ptr<WebBluet
oothDevice>, const WebBluetoothError&>; |
25 | 26 |
26 // Success and failure callbacks for connectGATT. | 27 // Success and failure callbacks for connectGATT. |
27 using WebBluetoothRemoteGATTServerConnectCallbacks = WebCallbacks<void, const We
bBluetoothError&>; | 28 using WebBluetoothRemoteGATTServerConnectCallbacks = WebCallbacks<void, const We
bBluetoothError&>; |
28 | 29 |
29 // Success and failure callbacks for getPrimaryService. | 30 // Success and failure callbacks for getPrimaryService. |
30 using WebBluetoothGetPrimaryServiceCallbacks = WebCallbacks<WebPassOwnPtr<WebBlu
etoothRemoteGATTService>, const WebBluetoothError&>; | 31 using WebBluetoothGetPrimaryServiceCallbacks = WebCallbacks<std::unique_ptr<WebB
luetoothRemoteGATTService>, const WebBluetoothError&>; |
31 | 32 |
32 // Success and failure callbacks for getCharacteristic. | 33 // Success and failure callbacks for getCharacteristic. |
33 using WebBluetoothGetCharacteristicCallbacks = WebCallbacks<WebPassOwnPtr<WebBlu
etoothRemoteGATTCharacteristicInit>, const WebBluetoothError&>; | 34 using WebBluetoothGetCharacteristicCallbacks = WebCallbacks<std::unique_ptr<WebB
luetoothRemoteGATTCharacteristicInit>, const WebBluetoothError&>; |
34 | 35 |
35 // Success and failure callbacks for getCharacteristics. | 36 // Success and failure callbacks for getCharacteristics. |
36 using WebBluetoothGetCharacteristicsCallbacks = | 37 using WebBluetoothGetCharacteristicsCallbacks = WebCallbacks<std::unique_ptr<Web
Vector<WebBluetoothRemoteGATTCharacteristicInit*>>, const WebBluetoothError&>; |
37 WebCallbacks<WebPassOwnPtr<WebVector<WebBluetoothRemoteGATTCharacteristicIni
t*>>, const WebBluetoothError&>; | |
38 | 38 |
39 // Success and failure callbacks for readValue. | 39 // Success and failure callbacks for readValue. |
40 using WebBluetoothReadValueCallbacks = WebCallbacks<const WebVector<uint8_t>&, c
onst WebBluetoothError&>; | 40 using WebBluetoothReadValueCallbacks = WebCallbacks<const WebVector<uint8_t>&, c
onst WebBluetoothError&>; |
41 | 41 |
42 // Success and failure callbacks for writeValue. | 42 // Success and failure callbacks for writeValue. |
43 using WebBluetoothWriteValueCallbacks = WebCallbacks<const WebVector<uint8_t>&,
const WebBluetoothError&>; | 43 using WebBluetoothWriteValueCallbacks = WebCallbacks<const WebVector<uint8_t>&,
const WebBluetoothError&>; |
44 | 44 |
45 // Success and failure callbacks for characteristic.startNotifications and | 45 // Success and failure callbacks for characteristic.startNotifications and |
46 // characteristic.stopNotifications. | 46 // characteristic.stopNotifications. |
47 using WebBluetoothNotificationsCallbacks = WebCallbacks<void, const WebBluetooth
Error&>; | 47 using WebBluetoothNotificationsCallbacks = WebCallbacks<void, const WebBluetooth
Error&>; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 const WebString& characteristicInstanceID, | 95 const WebString& characteristicInstanceID, |
96 WebBluetoothRemoteGATTCharacteristic*) = 0; | 96 WebBluetoothRemoteGATTCharacteristic*) = 0; |
97 virtual void characteristicObjectRemoved( | 97 virtual void characteristicObjectRemoved( |
98 const WebString& characteristicInstanceID, | 98 const WebString& characteristicInstanceID, |
99 WebBluetoothRemoteGATTCharacteristic*) {} | 99 WebBluetoothRemoteGATTCharacteristic*) {} |
100 }; | 100 }; |
101 | 101 |
102 } // namespace blink | 102 } // namespace blink |
103 | 103 |
104 #endif // WebBluetooth_h | 104 #endif // WebBluetooth_h |
OLD | NEW |