| 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 | 10 |
| 10 namespace blink { | 11 namespace blink { |
| 11 | 12 |
| 12 struct WebBluetoothDevice; | 13 struct WebBluetoothDevice; |
| 13 struct WebBluetoothError; | 14 struct WebBluetoothError; |
| 15 struct WebBluetoothGATTRemoteServer; |
| 14 | 16 |
| 15 // Success and failure callbacks for requestDevice. | 17 // Success and failure callbacks for requestDevice. |
| 16 // WebBluetoothDevice and WebBluetoothError object ownership is transfered. | 18 // WebBluetoothDevice and WebBluetoothError object ownership is transfered. |
| 17 typedef WebCallbacks<WebBluetoothDevice, WebBluetoothError> WebBluetoothRequestD
eviceCallbacks; | 19 typedef WebCallbacks<WebBluetoothDevice, WebBluetoothError> WebBluetoothRequestD
eviceCallbacks; |
| 18 | 20 |
| 21 // Success and failure callbacks for connectGATT. |
| 22 typedef WebCallbacks<WebBluetoothGATTRemoteServer, WebBluetoothError> WebBluetoo
thConnectGATTCallbacks; |
| 23 |
| 19 class WebBluetooth { | 24 class WebBluetooth { |
| 20 public: | 25 public: |
| 21 virtual ~WebBluetooth() { } | 26 virtual ~WebBluetooth() { } |
| 22 | 27 |
| 23 // Requests a bluetooth device. | 28 // BluetoothDiscovery Methods: |
| 29 // See https://webbluetoothcg.github.io/web-bluetooth/#idl-def-bluetoothdisc
overy |
| 24 // WebBluetoothRequestDeviceCallbacks ownership transferred to the client. | 30 // WebBluetoothRequestDeviceCallbacks ownership transferred to the client. |
| 25 virtual void requestDevice(WebBluetoothRequestDeviceCallbacks*) = 0; | 31 virtual void requestDevice(WebBluetoothRequestDeviceCallbacks*) = 0; |
| 32 |
| 33 // BluetoothDevice methods: |
| 34 // See https://webbluetoothcg.github.io/web-bluetooth/#idl-def-bluetoothdevi
ce |
| 35 // WebBluetoothConnectGATTCallbacks ownership transferred to the callee. |
| 36 virtual void connectGATT(const WebString& /* deviceInstanceID */, |
| 37 WebBluetoothConnectGATTCallbacks*) { } |
| 38 |
| 39 // BluetoothGATTRemoteServer methods: |
| 40 // See https://webbluetoothcg.github.io/web-bluetooth/#idl-def-bluetoothgatt
remoteserver |
| 41 virtual void disconnect() { } |
| 42 // TODO(ortuno): Properly define these methods once WebBluetoothServiceUuid |
| 43 // and WebBluetoothGATTService are defined. |
| 44 // virtual void getPrimaryService() { } |
| 45 // virtual void getPrimaryServices() { } |
| 26 }; | 46 }; |
| 27 | 47 |
| 28 } // namespace blink | 48 } // namespace blink |
| 29 | 49 |
| 30 #endif // WebBluetooth_h | 50 #endif // WebBluetooth_h |
| OLD | NEW |