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" | 9 #include "public/platform/WebPassOwnPtr.h" |
10 #include "public/platform/WebString.h" | 10 #include "public/platform/WebString.h" |
11 #include "public/platform/WebVector.h" | 11 #include "public/platform/WebVector.h" |
12 #include "public/platform/modules/bluetooth/WebBluetoothError.h" | 12 #include "public/platform/modules/bluetooth/WebBluetoothError.h" |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 struct WebBluetoothDevice; | 17 struct WebBluetoothDevice; |
18 struct WebBluetoothGATTCharacteristic; | 18 struct WebBluetoothGATTCharacteristic; |
19 struct WebBluetoothGATTRemoteServer; | 19 struct WebBluetoothGATTRemoteServer; |
20 struct WebBluetoothGATTService; | 20 struct WebBluetoothGATTService; |
21 struct WebRequestDeviceOptions; | 21 struct WebRequestDeviceOptions; |
22 | 22 |
23 // Success and failure callbacks for requestDevice. | 23 // Success and failure callbacks for requestDevice. |
24 using WebBluetoothRequestDeviceCallbacks = WebCallbacks<WebPassOwnPtr<WebBluetoo
thDevice>, WebPassOwnPtr<WebBluetoothError>>; | 24 using WebBluetoothRequestDeviceCallbacks = WebCallbacks<WebPassOwnPtr<WebBluetoo
thDevice>, const WebBluetoothError&>; |
25 | 25 |
26 // Success and failure callbacks for connectGATT. | 26 // Success and failure callbacks for connectGATT. |
27 using WebBluetoothConnectGATTCallbacks = WebCallbacks<WebPassOwnPtr<WebBluetooth
GATTRemoteServer>, WebPassOwnPtr<WebBluetoothError>>; | 27 using WebBluetoothConnectGATTCallbacks = WebCallbacks<WebPassOwnPtr<WebBluetooth
GATTRemoteServer>, const WebBluetoothError&>; |
28 | 28 |
29 // Success and failure callbacks for getPrimaryService. | 29 // Success and failure callbacks for getPrimaryService. |
30 using WebBluetoothGetPrimaryServiceCallbacks = WebCallbacks<WebPassOwnPtr<WebBlu
etoothGATTService>, WebPassOwnPtr<WebBluetoothError>>; | 30 using WebBluetoothGetPrimaryServiceCallbacks = WebCallbacks<WebPassOwnPtr<WebBlu
etoothGATTService>, const WebBluetoothError&>; |
31 | 31 |
32 // Success and failure callbacks for getCharacteristic. | 32 // Success and failure callbacks for getCharacteristic. |
33 using WebBluetoothGetCharacteristicCallbacks = WebCallbacks<WebPassOwnPtr<WebBlu
etoothGATTCharacteristic>, WebPassOwnPtr<WebBluetoothError>>; | 33 using WebBluetoothGetCharacteristicCallbacks = WebCallbacks<WebPassOwnPtr<WebBlu
etoothGATTCharacteristic>, const WebBluetoothError&>; |
34 | 34 |
35 // Success and failure callbacks for readValue. | 35 // Success and failure callbacks for readValue. |
36 using WebBluetoothReadValueCallbacks = WebCallbacks<WebPassOwnPtr<WebVector<uint
8_t>>, WebPassOwnPtr<WebBluetoothError>>; | 36 using WebBluetoothReadValueCallbacks = WebCallbacks<const WebVector<uint8_t>&, c
onst WebBluetoothError&>; |
37 | 37 |
38 // Success and failure callbacks for writeValue. | 38 // Success and failure callbacks for writeValue. |
39 using WebBluetoothWriteValueCallbacks = WebCallbacks<void, WebPassOwnPtr<WebBlue
toothError>>; | 39 using WebBluetoothWriteValueCallbacks = WebCallbacks<void, const WebBluetoothErr
or&>; |
40 | 40 |
41 class WebBluetooth { | 41 class WebBluetooth { |
42 public: | 42 public: |
43 virtual ~WebBluetooth() { } | 43 virtual ~WebBluetooth() { } |
44 | 44 |
45 // Bluetooth Methods: | 45 // Bluetooth Methods: |
46 // See https://webbluetoothchrome.github.io/web-bluetooth/#device-discovery | 46 // See https://webbluetoothchrome.github.io/web-bluetooth/#device-discovery |
47 // WebBluetoothRequestDeviceCallbacks ownership transferred to the client. | 47 // WebBluetoothRequestDeviceCallbacks ownership transferred to the client. |
48 virtual void requestDevice(const WebRequestDeviceOptions&, WebBluetoothReque
stDeviceCallbacks*) { } | 48 virtual void requestDevice(const WebRequestDeviceOptions&, WebBluetoothReque
stDeviceCallbacks*) { } |
49 | 49 |
(...skipping 22 matching lines...) Expand all Loading... |
72 virtual void readValue(const WebString& characteristicInstanceID, | 72 virtual void readValue(const WebString& characteristicInstanceID, |
73 WebBluetoothReadValueCallbacks*) { } | 73 WebBluetoothReadValueCallbacks*) { } |
74 virtual void writeValue(const WebString& characteristicInstanceID, | 74 virtual void writeValue(const WebString& characteristicInstanceID, |
75 const std::vector<uint8_t>& value, | 75 const std::vector<uint8_t>& value, |
76 WebBluetoothWriteValueCallbacks*) { } | 76 WebBluetoothWriteValueCallbacks*) { } |
77 }; | 77 }; |
78 | 78 |
79 } // namespace blink | 79 } // namespace blink |
80 | 80 |
81 #endif // WebBluetooth_h | 81 #endif // WebBluetooth_h |
OLD | NEW |