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