| 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/WebString.h" | 9 #include "public/platform/WebString.h" |
| 10 #include "public/platform/WebVector.h" | 10 #include "public/platform/WebVector.h" |
| 11 | 11 |
| 12 #include <memory> | 12 #include <memory> |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 class WebBluetoothDevice; | 16 class WebBluetoothDevice; |
| 17 class WebBluetoothRemoteGATTCharacteristic; | 17 class WebBluetoothRemoteGATTCharacteristic; |
| 18 | 18 |
| 19 struct WebBluetoothDeviceInit; | 19 struct WebBluetoothDeviceInit; |
| 20 struct WebBluetoothRemoteGATTCharacteristicInit; | 20 struct WebBluetoothRemoteGATTCharacteristicInit; |
| 21 struct WebBluetoothRemoteGATTService; | 21 struct WebBluetoothRemoteGATTService; |
| 22 struct WebRequestDeviceOptions; | 22 struct WebRequestDeviceOptions; |
| 23 | 23 |
| 24 // Success and failure callbacks for requestDevice. | 24 // Success and failure callbacks for requestDevice. |
| 25 using WebBluetoothRequestDeviceCallbacks = WebCallbacks< | 25 using WebBluetoothRequestDeviceCallbacks = WebCallbacks< |
| 26 std::unique_ptr<WebBluetoothDeviceInit>, | 26 std::unique_ptr<WebBluetoothDeviceInit>, |
| 27 int32_t /* Corresponds to WebBluetoothError in web_bluetooth.mojom */>; | 27 int32_t /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */>; |
| 28 | 28 |
| 29 // Success and failure callbacks for GattServer.connect(). | 29 // Success and failure callbacks for GattServer.connect(). |
| 30 using WebBluetoothRemoteGATTServerConnectCallbacks = WebCallbacks< | 30 using WebBluetoothRemoteGATTServerConnectCallbacks = WebCallbacks< |
| 31 void, | 31 void, |
| 32 int32_t /* Corresponds to WebBluetoothError in web_bluetooth.mojom */>; | 32 int32_t /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */>; |
| 33 | 33 |
| 34 // Success and failure callbacks for getPrimaryService(s). | 34 // Success and failure callbacks for getPrimaryService(s). |
| 35 using WebBluetoothGetPrimaryServicesCallbacks = WebCallbacks< | 35 using WebBluetoothGetPrimaryServicesCallbacks = WebCallbacks< |
| 36 const WebVector<WebBluetoothRemoteGATTService*>&, | 36 const WebVector<WebBluetoothRemoteGATTService*>&, |
| 37 int32_t /* Corresponds to WebBluetoothError in web_bluetooth.mojom */>; | 37 int32_t /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */>; |
| 38 | 38 |
| 39 // Success and failure callbacks for getCharacteristic(s). | 39 // Success and failure callbacks for getCharacteristic(s). |
| 40 using WebBluetoothGetCharacteristicsCallbacks = WebCallbacks< | 40 using WebBluetoothGetCharacteristicsCallbacks = WebCallbacks< |
| 41 const WebVector<WebBluetoothRemoteGATTCharacteristicInit*>&, | 41 const WebVector<WebBluetoothRemoteGATTCharacteristicInit*>&, |
| 42 int32_t /* Corresponds to WebBluetoothError in web_bluetooth.mojom */>; | 42 int32_t /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */>; |
| 43 | 43 |
| 44 // Success and failure callbacks for readValue. | 44 // Success and failure callbacks for readValue. |
| 45 using WebBluetoothReadValueCallbacks = WebCallbacks< | 45 using WebBluetoothReadValueCallbacks = WebCallbacks< |
| 46 const WebVector<uint8_t>&, | 46 const WebVector<uint8_t>&, |
| 47 int32_t /* Corresponds to WebBluetoothError in web_bluetooth.mojom */>; | 47 int32_t /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */>; |
| 48 | 48 |
| 49 // Success and failure callbacks for writeValue. | 49 // Success and failure callbacks for writeValue. |
| 50 using WebBluetoothWriteValueCallbacks = WebCallbacks< | 50 using WebBluetoothWriteValueCallbacks = WebCallbacks< |
| 51 const WebVector<uint8_t>&, | 51 const WebVector<uint8_t>&, |
| 52 int32_t /* Corresponds to WebBluetoothError in web_bluetooth.mojom */>; | 52 int32_t /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */>; |
| 53 | 53 |
| 54 // Success and failure callbacks for characteristic.startNotifications and | 54 // Success and failure callbacks for characteristic.startNotifications and |
| 55 // characteristic.stopNotifications. | 55 // characteristic.stopNotifications. |
| 56 using WebBluetoothNotificationsCallbacks = WebCallbacks< | 56 using WebBluetoothNotificationsCallbacks = WebCallbacks< |
| 57 void, | 57 void, |
| 58 int32_t /* Corresponds to WebBluetoothError in web_bluetooth.mojom */>; | 58 int32_t /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */>; |
| 59 | 59 |
| 60 class WebBluetooth { | 60 class WebBluetooth { |
| 61 public: | 61 public: |
| 62 virtual ~WebBluetooth() {} | 62 virtual ~WebBluetooth() {} |
| 63 | 63 |
| 64 // Bluetooth Methods: | 64 // Bluetooth Methods: |
| 65 // See https://webbluetoothchrome.github.io/web-bluetooth/#device-discovery | 65 // See https://webbluetoothchrome.github.io/web-bluetooth/#device-discovery |
| 66 // WebBluetoothRequestDeviceCallbacks ownership transferred to the client. | 66 // WebBluetoothRequestDeviceCallbacks ownership transferred to the client. |
| 67 virtual void requestDevice(const WebRequestDeviceOptions&, | 67 virtual void requestDevice(const WebRequestDeviceOptions&, |
| 68 WebBluetoothRequestDeviceCallbacks*) {} | 68 WebBluetoothRequestDeviceCallbacks*) {} |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 const WebString& characteristicInstanceID, | 111 const WebString& characteristicInstanceID, |
| 112 WebBluetoothRemoteGATTCharacteristic*) = 0; | 112 WebBluetoothRemoteGATTCharacteristic*) = 0; |
| 113 virtual void characteristicObjectRemoved( | 113 virtual void characteristicObjectRemoved( |
| 114 const WebString& characteristicInstanceID, | 114 const WebString& characteristicInstanceID, |
| 115 WebBluetoothRemoteGATTCharacteristic*) {} | 115 WebBluetoothRemoteGATTCharacteristic*) {} |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 } // namespace blink | 118 } // namespace blink |
| 119 | 119 |
| 120 #endif // WebBluetooth_h | 120 #endif // WebBluetooth_h |
| OLD | NEW |