Chromium Code Reviews| 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 transfered. |
| 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. |
| 23 typedef WebCallbacks<WebBluetoothGATTRemoteServer, WebBluetoothError> WebBluetoo thConnectGATTCallbacks; | 24 typedef WebCallbacks<WebBluetoothGATTRemoteServer, WebBluetoothError> WebBluetoo thConnectGATTCallbacks; |
| 24 | 25 |
| 25 // Success and failure callbacks for getPrimaryService. | 26 // Success and failure callbacks for getPrimaryService. |
| 26 typedef WebCallbacks<WebBluetoothGATTService, WebBluetoothError> WebBluetoothGet PrimaryServiceCallbacks; | 27 typedef WebCallbacks<WebBluetoothGATTService, WebBluetoothError> WebBluetoothGet PrimaryServiceCallbacks; |
| 27 | 28 |
| 29 // Success and failure callbacks for getCharacteristic. | |
|
scheib
2015/06/03 02:52:18
Add:
// WebBluetoothGATTCharacteristic and WebBlue
ortuno
2015/06/03 19:30:45
Done.
| |
| 30 typedef WebCallbacks<WebBluetoothGATTCharacteristic, WebBluetoothError> WebBluet oothGetCharacteristicCallbacks; | |
| 31 | |
| 28 class WebBluetooth { | 32 class WebBluetooth { |
| 29 public: | 33 public: |
| 30 virtual ~WebBluetooth() { } | 34 virtual ~WebBluetooth() { } |
| 31 | 35 |
| 32 // BluetoothDiscovery Methods: | 36 // BluetoothDiscovery Methods: |
| 33 // See https://webbluetoothcg.github.io/web-bluetooth/#idl-def-bluetoothdisc overy | 37 // See https://webbluetoothcg.github.io/web-bluetooth/#idl-def-bluetoothdisc overy |
| 34 // WebBluetoothRequestDeviceCallbacks ownership transferred to the client. | 38 // WebBluetoothRequestDeviceCallbacks ownership transferred to the client. |
| 35 virtual void requestDevice(WebBluetoothRequestDeviceCallbacks*) = 0; | 39 virtual void requestDevice(WebBluetoothRequestDeviceCallbacks*) = 0; |
| 36 | 40 |
| 37 // BluetoothDevice methods: | 41 // BluetoothDevice methods: |
| 38 // See https://webbluetoothcg.github.io/web-bluetooth/#idl-def-bluetoothdevi ce | 42 // See https://webbluetoothcg.github.io/web-bluetooth/#idl-def-bluetoothdevi ce |
| 39 // WebBluetoothConnectGATTCallbacks ownership transferred to the callee. | 43 // WebBluetoothConnectGATTCallbacks ownership transferred to the callee. |
| 40 virtual void connectGATT(const WebString& /* deviceInstanceID */, | 44 virtual void connectGATT(const WebString& /* deviceInstanceID */, |
| 41 WebBluetoothConnectGATTCallbacks*) { } | 45 WebBluetoothConnectGATTCallbacks*) { } |
| 42 | 46 |
| 43 // BluetoothGATTRemoteServer methods: | 47 // BluetoothGATTRemoteServer methods: |
| 44 // See https://webbluetoothcg.github.io/web-bluetooth/#idl-def-bluetoothgatt remoteserver | 48 // See https://webbluetoothcg.github.io/web-bluetooth/#idl-def-bluetoothgatt remoteserver |
| 45 virtual void disconnect() { } | 49 virtual void disconnect() { } |
| 46 virtual void getPrimaryService(const WebString& deviceInstanceID, | 50 virtual void getPrimaryService(const WebString& deviceInstanceID, |
| 47 const WebString& serviceUUID, | 51 const WebString& serviceUUID, |
| 48 WebBluetoothGetPrimaryServiceCallbacks*) { } | 52 WebBluetoothGetPrimaryServiceCallbacks*) { } |
| 49 // virtual void getPrimaryServices() { } | 53 // virtual void getPrimaryServices() { } |
| 54 | |
| 55 // BluetoothGATTService methods: | |
| 56 // See https://webbluetoothcg.github.io/web-bluetooth/#idl-def-bluetoothgatt service | |
| 57 virtual void getCharacteristic(const WebString& serviceInstanceID, | |
| 58 const WebString& characteristicUUID, | |
| 59 WebBluetoothGetCharacteristicCallbacks*) { } | |
| 50 }; | 60 }; |
| 51 | 61 |
| 52 } // namespace blink | 62 } // namespace blink |
| 53 | 63 |
| 54 #endif // WebBluetooth_h | 64 #endif // WebBluetooth_h |
| OLD | NEW |