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