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 // WebBluetoothDevice and WebBluetoothError object ownership is transferred. | 24 // WebBluetoothDevice and WebBluetoothError object ownership is transferred. |
25 using WebBluetoothRequestDeviceCallbacks = WebCallbacks<WebPassOwnPtr<WebBluetoo
thDevice>, WebPassOwnPtr<WebBluetoothError>>; | 25 using WebBluetoothRequestDeviceCallbacks = WebCallbacks<WebPassOwnPtr<WebBluetoo
thDevice>, const WebBluetoothError&>; |
26 | 26 |
27 // Success and failure callbacks for connectGATT. | 27 // Success and failure callbacks for connectGATT. |
28 // WebBluetoothGATTRemoteServer and WebBluetoothError object ownership is transf
erred. | 28 // WebBluetoothGATTRemoteServer and WebBluetoothError object ownership is transf
erred. |
29 using WebBluetoothConnectGATTCallbacks = WebCallbacks<WebPassOwnPtr<WebBluetooth
GATTRemoteServer>, WebPassOwnPtr<WebBluetoothError>>; | 29 using WebBluetoothConnectGATTCallbacks = WebCallbacks<WebPassOwnPtr<WebBluetooth
GATTRemoteServer>, const WebBluetoothError&>; |
30 | 30 |
31 // Success and failure callbacks for getPrimaryService. | 31 // Success and failure callbacks for getPrimaryService. |
32 // WebBluetoothGATTService and WebBluetoothError object ownership is transferred
. | 32 // WebBluetoothGATTService and WebBluetoothError object ownership is transferred
. |
33 using WebBluetoothGetPrimaryServiceCallbacks = WebCallbacks<WebPassOwnPtr<WebBlu
etoothGATTService>, WebPassOwnPtr<WebBluetoothError>>; | 33 using WebBluetoothGetPrimaryServiceCallbacks = WebCallbacks<WebPassOwnPtr<WebBlu
etoothGATTService>, const WebBluetoothError&>; |
34 | 34 |
35 // Success and failure callbacks for getCharacteristic. | 35 // Success and failure callbacks for getCharacteristic. |
36 // WebBluetoothCharacteristic and WebBluetoothError object ownership is transfer
red. | 36 // WebBluetoothCharacteristic and WebBluetoothError object ownership is transfer
red. |
37 using WebBluetoothGetCharacteristicCallbacks = WebCallbacks<WebPassOwnPtr<WebBlu
etoothGATTCharacteristic>, WebPassOwnPtr<WebBluetoothError>>; | 37 using WebBluetoothGetCharacteristicCallbacks = WebCallbacks<WebPassOwnPtr<WebBlu
etoothGATTCharacteristic>, const WebBluetoothError&>; |
38 | 38 |
39 // Success and failure callbacks for readValue. | 39 // Success and failure callbacks for readValue. |
40 // WebVector and WebBluetoothError object ownership is transferred. | 40 // WebVector and WebBluetoothError object ownership is transferred. |
41 using WebBluetoothReadValueCallbacks = WebCallbacks<WebPassOwnPtr<WebVector<uint
8_t>>, WebPassOwnPtr<WebBluetoothError>>; | 41 using WebBluetoothReadValueCallbacks = WebCallbacks<const WebVector<uint8_t>&, c
onst WebBluetoothError&>; |
42 | 42 |
43 // Success and failure callbacks for writeValue. | 43 // Success and failure callbacks for writeValue. |
44 // WebBluetoothError object ownership is transferred. | 44 // WebBluetoothError object ownership is transferred. |
45 using WebBluetoothWriteValueCallbacks = WebCallbacks<void, WebPassOwnPtr<WebBlue
toothError>>; | 45 using WebBluetoothWriteValueCallbacks = WebCallbacks<void, const WebBluetoothErr
or&>; |
46 | 46 |
47 class WebBluetooth { | 47 class WebBluetooth { |
48 public: | 48 public: |
49 virtual ~WebBluetooth() { } | 49 virtual ~WebBluetooth() { } |
50 | 50 |
51 // Bluetooth Methods: | 51 // Bluetooth Methods: |
52 // See https://webbluetoothchrome.github.io/web-bluetooth/#device-discovery | 52 // See https://webbluetoothchrome.github.io/web-bluetooth/#device-discovery |
53 // WebBluetoothRequestDeviceCallbacks ownership transferred to the client. | 53 // WebBluetoothRequestDeviceCallbacks ownership transferred to the client. |
54 virtual void requestDevice(const WebRequestDeviceOptions&, WebBluetoothReque
stDeviceCallbacks*) { } | 54 virtual void requestDevice(const WebRequestDeviceOptions&, WebBluetoothReque
stDeviceCallbacks*) { } |
55 | 55 |
(...skipping 22 matching lines...) Expand all Loading... |
78 virtual void readValue(const WebString& characteristicInstanceID, | 78 virtual void readValue(const WebString& characteristicInstanceID, |
79 WebBluetoothReadValueCallbacks*) { } | 79 WebBluetoothReadValueCallbacks*) { } |
80 virtual void writeValue(const WebString& characteristicInstanceID, | 80 virtual void writeValue(const WebString& characteristicInstanceID, |
81 const std::vector<uint8_t>& value, | 81 const std::vector<uint8_t>& value, |
82 WebBluetoothWriteValueCallbacks*) { } | 82 WebBluetoothWriteValueCallbacks*) { } |
83 }; | 83 }; |
84 | 84 |
85 } // namespace blink | 85 } // namespace blink |
86 | 86 |
87 #endif // WebBluetooth_h | 87 #endif // WebBluetooth_h |
OLD | NEW |