| 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/WebPrivateOwnPtr.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 // WebBluetoothDevice and WebBluetoothError object ownership is transferred. |
| 24 typedef WebCallbacks<WebBluetoothDevice*, WebBluetoothError*> WebBluetoothReques
tDeviceCallbacks; | 25 using WebBluetoothRequestDeviceCallbacks = WebCallbacks<WebPrivateOwnPtr<WebBlue
toothDevice>&&, WebPrivateOwnPtr<WebBluetoothError>&&>; |
| 25 | 26 |
| 26 // Success and failure callbacks for connectGATT. | 27 // Success and failure callbacks for connectGATT. |
| 27 // WebBluetoothGATTRemoteServer and WebBluetoothError object ownership is transf
erred. | 28 // WebBluetoothGATTRemoteServer and WebBluetoothError object ownership is transf
erred. |
| 28 typedef WebCallbacks<WebBluetoothGATTRemoteServer*, WebBluetoothError*> WebBluet
oothConnectGATTCallbacks; | 29 using WebBluetoothConnectGATTCallbacks = WebCallbacks<WebPrivateOwnPtr<WebBlueto
othGATTRemoteServer>&&, WebPrivateOwnPtr<WebBluetoothError>&&>; |
| 29 | 30 |
| 30 // Success and failure callbacks for getPrimaryService. | 31 // Success and failure callbacks for getPrimaryService. |
| 31 // WebBluetoothGATTService and WebBluetoothError object ownership is transferred
. | 32 // WebBluetoothGATTService and WebBluetoothError object ownership is transferred
. |
| 32 typedef WebCallbacks<WebBluetoothGATTService*, WebBluetoothError*> WebBluetoothG
etPrimaryServiceCallbacks; | 33 using WebBluetoothGetPrimaryServiceCallbacks = WebCallbacks<WebPrivateOwnPtr<Web
BluetoothGATTService>&&, WebPrivateOwnPtr<WebBluetoothError>&&>; |
| 33 | 34 |
| 34 // Success and failure callbacks for getCharacteristic. | 35 // Success and failure callbacks for getCharacteristic. |
| 35 // WebBluetoothCharacteristic and WebBluetoothError object ownership is transfer
red. | 36 // WebBluetoothCharacteristic and WebBluetoothError object ownership is transfer
red. |
| 36 typedef WebCallbacks<WebBluetoothGATTCharacteristic*, WebBluetoothError*> WebBlu
etoothGetCharacteristicCallbacks; | 37 using WebBluetoothGetCharacteristicCallbacks = WebCallbacks<WebPrivateOwnPtr<Web
BluetoothGATTCharacteristic>&&, WebPrivateOwnPtr<WebBluetoothError>&&>; |
| 37 | 38 |
| 38 // Success and failure callbacks for readValue. | 39 // Success and failure callbacks for readValue. |
| 39 // WebVector and WebBluetoothError object ownership is transferred. | 40 // WebVector and WebBluetoothError object ownership is transferred. |
| 40 typedef WebCallbacks<WebVector<uint8_t>*, WebBluetoothError*> WebBluetoothReadVa
lueCallbacks; | 41 using WebBluetoothReadValueCallbacks = WebCallbacks<WebPrivateOwnPtr<WebVector<u
int8_t>>&&, WebPrivateOwnPtr<WebBluetoothError>&&>; |
| 41 | 42 |
| 42 // Success and failure callbacks for writeValue. | 43 // Success and failure callbacks for writeValue. |
| 43 // WebBluetoothError object ownership is transferred. | 44 // WebBluetoothError object ownership is transferred. |
| 44 typedef WebCallbacks<void, WebBluetoothError*> WebBluetoothWriteValueCallbacks; | 45 using WebBluetoothWriteValueCallbacks = WebCallbacks<void, WebPrivateOwnPtr<WebB
luetoothError>&&>; |
| 45 | 46 |
| 46 class WebBluetooth { | 47 class WebBluetooth { |
| 47 public: | 48 public: |
| 48 virtual ~WebBluetooth() { } | 49 virtual ~WebBluetooth() { } |
| 49 | 50 |
| 50 // Bluetooth Methods: | 51 // Bluetooth Methods: |
| 51 // See https://webbluetoothchrome.github.io/web-bluetooth/#device-discovery | 52 // See https://webbluetoothchrome.github.io/web-bluetooth/#device-discovery |
| 52 // WebBluetoothRequestDeviceCallbacks ownership transferred to the client. | 53 // WebBluetoothRequestDeviceCallbacks ownership transferred to the client. |
| 53 virtual void requestDevice(const WebRequestDeviceOptions&, WebBluetoothReque
stDeviceCallbacks*) { } | 54 virtual void requestDevice(const WebRequestDeviceOptions&, WebBluetoothReque
stDeviceCallbacks*) { } |
| 54 | 55 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 77 virtual void readValue(const WebString& characteristicInstanceID, | 78 virtual void readValue(const WebString& characteristicInstanceID, |
| 78 WebBluetoothReadValueCallbacks*) { } | 79 WebBluetoothReadValueCallbacks*) { } |
| 79 virtual void writeValue(const WebString& characteristicInstanceID, | 80 virtual void writeValue(const WebString& characteristicInstanceID, |
| 80 const std::vector<uint8_t>& value, | 81 const std::vector<uint8_t>& value, |
| 81 WebBluetoothWriteValueCallbacks*) { } | 82 WebBluetoothWriteValueCallbacks*) { } |
| 82 }; | 83 }; |
| 83 | 84 |
| 84 } // namespace blink | 85 } // namespace blink |
| 85 | 86 |
| 86 #endif // WebBluetooth_h | 87 #endif // WebBluetooth_h |
| OLD | NEW |