| 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 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 struct WebBluetoothDevice; | 13 struct WebBluetoothDevice; |
| 14 struct WebBluetoothError; | 14 struct WebBluetoothError; |
| 15 struct WebBluetoothGATTCharacteristic; |
| 15 struct WebBluetoothGATTRemoteServer; | 16 struct WebBluetoothGATTRemoteServer; |
| 16 struct WebBluetoothGATTService; | 17 struct WebBluetoothGATTService; |
| 17 | 18 |
| 18 // Success and failure callbacks for requestDevice. | 19 // Success and failure callbacks for requestDevice. |
| 19 // WebBluetoothDevice and WebBluetoothError object ownership is transfered. | 20 // WebBluetoothDevice and WebBluetoothError object ownership is transferred. |
| 20 typedef WebCallbacks<WebBluetoothDevice, WebBluetoothError> WebBluetoothRequestD
eviceCallbacks; | 21 typedef WebCallbacks<WebBluetoothDevice, WebBluetoothError> WebBluetoothRequestD
eviceCallbacks; |
| 21 | 22 |
| 22 // Success and failure callbacks for connectGATT. | 23 // Success and failure callbacks for connectGATT. |
| 24 // WebBluetoothGATTRemoteServer and WebBluetoothError object ownership is transf
erred. |
| 23 typedef WebCallbacks<WebBluetoothGATTRemoteServer, WebBluetoothError> WebBluetoo
thConnectGATTCallbacks; | 25 typedef WebCallbacks<WebBluetoothGATTRemoteServer, WebBluetoothError> WebBluetoo
thConnectGATTCallbacks; |
| 24 | 26 |
| 25 // Success and failure callbacks for getPrimaryService. | 27 // Success and failure callbacks for getPrimaryService. |
| 28 // WebBluetoothGATTService and WebBluetoothError object ownership is transferred
. |
| 26 typedef WebCallbacks<WebBluetoothGATTService, WebBluetoothError> WebBluetoothGet
PrimaryServiceCallbacks; | 29 typedef WebCallbacks<WebBluetoothGATTService, WebBluetoothError> WebBluetoothGet
PrimaryServiceCallbacks; |
| 27 | 30 |
| 31 // Success and failure callbacks for getCharacteristic. |
| 32 // WebBluetoothCharacteristic and WebBluetoothError object ownership is transfer
red. |
| 33 typedef WebCallbacks<WebBluetoothGATTCharacteristic, WebBluetoothError> WebBluet
oothGetCharacteristicCallbacks; |
| 34 |
| 28 class WebBluetooth { | 35 class WebBluetooth { |
| 29 public: | 36 public: |
| 30 virtual ~WebBluetooth() { } | 37 virtual ~WebBluetooth() { } |
| 31 | 38 |
| 32 // BluetoothDiscovery Methods: | 39 // BluetoothDiscovery Methods: |
| 33 // See https://webbluetoothcg.github.io/web-bluetooth/#idl-def-bluetoothdisc
overy | 40 // See https://webbluetoothcg.github.io/web-bluetooth/#idl-def-bluetoothdisc
overy |
| 34 // WebBluetoothRequestDeviceCallbacks ownership transferred to the client. | 41 // WebBluetoothRequestDeviceCallbacks ownership transferred to the client. |
| 35 virtual void requestDevice(WebBluetoothRequestDeviceCallbacks*) = 0; | 42 virtual void requestDevice(WebBluetoothRequestDeviceCallbacks*) = 0; |
| 36 | 43 |
| 37 // BluetoothDevice methods: | 44 // BluetoothDevice methods: |
| 38 // See https://webbluetoothcg.github.io/web-bluetooth/#idl-def-bluetoothdevi
ce | 45 // See https://webbluetoothcg.github.io/web-bluetooth/#idl-def-bluetoothdevi
ce |
| 39 // WebBluetoothConnectGATTCallbacks ownership transferred to the callee. | 46 // WebBluetoothConnectGATTCallbacks ownership transferred to the callee. |
| 40 virtual void connectGATT(const WebString& /* deviceInstanceID */, | 47 virtual void connectGATT(const WebString& /* deviceInstanceID */, |
| 41 WebBluetoothConnectGATTCallbacks*) { } | 48 WebBluetoothConnectGATTCallbacks*) { } |
| 42 | 49 |
| 43 // BluetoothGATTRemoteServer methods: | 50 // BluetoothGATTRemoteServer methods: |
| 44 // See https://webbluetoothcg.github.io/web-bluetooth/#idl-def-bluetoothgatt
remoteserver | 51 // See https://webbluetoothcg.github.io/web-bluetooth/#idl-def-bluetoothgatt
remoteserver |
| 45 virtual void disconnect() { } | 52 virtual void disconnect() { } |
| 46 virtual void getPrimaryService(const WebString& deviceInstanceID, | 53 virtual void getPrimaryService(const WebString& deviceInstanceID, |
| 47 const WebString& serviceUUID, | 54 const WebString& serviceUUID, |
| 48 WebBluetoothGetPrimaryServiceCallbacks*) { } | 55 WebBluetoothGetPrimaryServiceCallbacks*) { } |
| 49 // virtual void getPrimaryServices() { } | 56 // virtual void getPrimaryServices() { } |
| 57 |
| 58 // BluetoothGATTService methods: |
| 59 // See https://webbluetoothcg.github.io/web-bluetooth/#idl-def-bluetoothgatt
service |
| 60 virtual void getCharacteristic(const WebString& serviceInstanceID, |
| 61 const WebString& characteristicUUID, |
| 62 WebBluetoothGetCharacteristicCallbacks*) { } |
| 50 }; | 63 }; |
| 51 | 64 |
| 52 } // namespace blink | 65 } // namespace blink |
| 53 | 66 |
| 54 #endif // WebBluetooth_h | 67 #endif // WebBluetooth_h |
| OLD | NEW |