| 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 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 struct WebBluetoothDevice; | 14 struct WebBluetoothDevice; |
| 15 struct WebBluetoothError; | 15 struct WebBluetoothError; |
| 16 struct WebBluetoothGATTCharacteristic; | 16 struct WebBluetoothGATTCharacteristic; |
| 17 struct WebBluetoothGATTRemoteServer; | 17 struct WebBluetoothGATTRemoteServer; |
| 18 struct WebBluetoothGATTService; | 18 struct WebBluetoothGATTService; |
| 19 struct WebRequestDeviceOptions; |
| 19 | 20 |
| 20 // Success and failure callbacks for requestDevice. | 21 // Success and failure callbacks for requestDevice. |
| 21 // WebBluetoothDevice and WebBluetoothError object ownership is transferred. | 22 // WebBluetoothDevice and WebBluetoothError object ownership is transferred. |
| 22 typedef WebCallbacks<WebBluetoothDevice, WebBluetoothError> WebBluetoothRequestD
eviceCallbacks; | 23 typedef WebCallbacks<WebBluetoothDevice, WebBluetoothError> WebBluetoothRequestD
eviceCallbacks; |
| 23 | 24 |
| 24 // Success and failure callbacks for connectGATT. | 25 // Success and failure callbacks for connectGATT. |
| 25 // WebBluetoothGATTRemoteServer and WebBluetoothError object ownership is transf
erred. | 26 // WebBluetoothGATTRemoteServer and WebBluetoothError object ownership is transf
erred. |
| 26 typedef WebCallbacks<WebBluetoothGATTRemoteServer, WebBluetoothError> WebBluetoo
thConnectGATTCallbacks; | 27 typedef WebCallbacks<WebBluetoothGATTRemoteServer, WebBluetoothError> WebBluetoo
thConnectGATTCallbacks; |
| 27 | 28 |
| 28 // Success and failure callbacks for getPrimaryService. | 29 // Success and failure callbacks for getPrimaryService. |
| 29 // WebBluetoothGATTService and WebBluetoothError object ownership is transferred
. | 30 // WebBluetoothGATTService and WebBluetoothError object ownership is transferred
. |
| 30 typedef WebCallbacks<WebBluetoothGATTService, WebBluetoothError> WebBluetoothGet
PrimaryServiceCallbacks; | 31 typedef WebCallbacks<WebBluetoothGATTService, WebBluetoothError> WebBluetoothGet
PrimaryServiceCallbacks; |
| 31 | 32 |
| 32 // Success and failure callbacks for getCharacteristic. | 33 // Success and failure callbacks for getCharacteristic. |
| 33 // WebBluetoothCharacteristic and WebBluetoothError object ownership is transfer
red. | 34 // WebBluetoothCharacteristic and WebBluetoothError object ownership is transfer
red. |
| 34 typedef WebCallbacks<WebBluetoothGATTCharacteristic, WebBluetoothError> WebBluet
oothGetCharacteristicCallbacks; | 35 typedef WebCallbacks<WebBluetoothGATTCharacteristic, WebBluetoothError> WebBluet
oothGetCharacteristicCallbacks; |
| 35 | 36 |
| 36 // Success and failure callbacks for readValue. | 37 // Success and failure callbacks for readValue. |
| 37 // WebVector and WebBluetoothError object ownership is transferred. | 38 // WebVector and WebBluetoothError object ownership is transferred. |
| 38 typedef WebCallbacks<WebVector<uint8_t>, WebBluetoothError> WebBluetoothReadValu
eCallbacks; | 39 typedef WebCallbacks<WebVector<uint8_t>, WebBluetoothError> WebBluetoothReadValu
eCallbacks; |
| 39 | 40 |
| 40 class WebBluetooth { | 41 class WebBluetooth { |
| 41 public: | 42 public: |
| 42 virtual ~WebBluetooth() { } | 43 virtual ~WebBluetooth() { } |
| 43 | 44 |
| 44 // BluetoothDiscovery Methods: | 45 // BluetoothDiscovery Methods: |
| 45 // See https://webbluetoothcg.github.io/web-bluetooth/#idl-def-bluetoothdisc
overy | 46 // See https://webbluetoothcg.github.io/web-bluetooth/#idl-def-bluetoothdisc
overy |
| 46 // WebBluetoothRequestDeviceCallbacks ownership transferred to the client. | 47 // WebBluetoothRequestDeviceCallbacks ownership transferred to the client. |
| 47 virtual void requestDevice(WebBluetoothRequestDeviceCallbacks*) = 0; | 48 virtual void requestDevice(const WebRequestDeviceOptions&, WebBluetoothReque
stDeviceCallbacks* callbacks) { requestDevice(callbacks); } |
| 49 // TODO(jyasskin): Remove this overload after |
| 50 // https://codereview.chromium.org/1172853004/ lands. |
| 51 virtual void requestDevice(WebBluetoothRequestDeviceCallbacks*) { } |
| 48 | 52 |
| 49 // BluetoothDevice methods: | 53 // BluetoothDevice methods: |
| 50 // See https://webbluetoothcg.github.io/web-bluetooth/#idl-def-bluetoothdevi
ce | 54 // See https://webbluetoothcg.github.io/web-bluetooth/#idl-def-bluetoothdevi
ce |
| 51 // WebBluetoothConnectGATTCallbacks ownership transferred to the callee. | 55 // WebBluetoothConnectGATTCallbacks ownership transferred to the callee. |
| 52 virtual void connectGATT(const WebString& /* deviceInstanceID */, | 56 virtual void connectGATT(const WebString& /* deviceInstanceID */, |
| 53 WebBluetoothConnectGATTCallbacks*) { } | 57 WebBluetoothConnectGATTCallbacks*) { } |
| 54 | 58 |
| 55 // BluetoothGATTRemoteServer methods: | 59 // BluetoothGATTRemoteServer methods: |
| 56 // See https://webbluetoothcg.github.io/web-bluetooth/#idl-def-bluetoothgatt
remoteserver | 60 // See https://webbluetoothcg.github.io/web-bluetooth/#idl-def-bluetoothgatt
remoteserver |
| 57 virtual void disconnect() { } | 61 virtual void disconnect() { } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 68 | 72 |
| 69 // BluetoothGATTCharacteristic methods: | 73 // BluetoothGATTCharacteristic methods: |
| 70 // See https://webbluetoothcg.github.io/web-bluetooth/#bluetoothgattcharacte
ristic | 74 // See https://webbluetoothcg.github.io/web-bluetooth/#bluetoothgattcharacte
ristic |
| 71 virtual void readValue(const WebString& characteristicInstanceID, | 75 virtual void readValue(const WebString& characteristicInstanceID, |
| 72 WebBluetoothReadValueCallbacks*) { } | 76 WebBluetoothReadValueCallbacks*) { } |
| 73 }; | 77 }; |
| 74 | 78 |
| 75 } // namespace blink | 79 } // namespace blink |
| 76 | 80 |
| 77 #endif // WebBluetooth_h | 81 #endif // WebBluetooth_h |
| OLD | NEW |