| 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" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 // Success and failure callbacks for requestDevice. | 24 // Success and failure callbacks for requestDevice. |
| 25 using WebBluetoothRequestDeviceCallbacks = WebCallbacks<std::unique_ptr<WebBluet
oothDevice>, const WebBluetoothError&>; | 25 using WebBluetoothRequestDeviceCallbacks = WebCallbacks<std::unique_ptr<WebBluet
oothDevice>, const WebBluetoothError&>; |
| 26 | 26 |
| 27 // Success and failure callbacks for connectGATT. | 27 // Success and failure callbacks for connectGATT. |
| 28 using WebBluetoothRemoteGATTServerConnectCallbacks = WebCallbacks<void, const We
bBluetoothError&>; | 28 using WebBluetoothRemoteGATTServerConnectCallbacks = WebCallbacks<void, const We
bBluetoothError&>; |
| 29 | 29 |
| 30 // Success and failure callbacks for getPrimaryService. | 30 // Success and failure callbacks for getPrimaryService. |
| 31 using WebBluetoothGetPrimaryServiceCallbacks = WebCallbacks<std::unique_ptr<WebB
luetoothRemoteGATTService>, const WebBluetoothError&>; | 31 using WebBluetoothGetPrimaryServiceCallbacks = WebCallbacks<std::unique_ptr<WebB
luetoothRemoteGATTService>, const WebBluetoothError&>; |
| 32 | 32 |
| 33 // Success and failure callbacks for getCharacteristic. | 33 // Success and failure callbacks for getCharacteristic(s). |
| 34 using WebBluetoothGetCharacteristicCallbacks = WebCallbacks<std::unique_ptr<WebB
luetoothRemoteGATTCharacteristicInit>, const WebBluetoothError&>; | 34 using WebBluetoothGetCharacteristicsCallbacks = WebCallbacks<const WebVector<Web
BluetoothRemoteGATTCharacteristicInit*>&, const WebBluetoothError&>; |
| 35 | |
| 36 // Success and failure callbacks for getCharacteristics. | |
| 37 using WebBluetoothGetCharacteristicsCallbacks = WebCallbacks<std::unique_ptr<Web
Vector<WebBluetoothRemoteGATTCharacteristicInit*>>, const WebBluetoothError&>; | |
| 38 | 35 |
| 39 // Success and failure callbacks for readValue. | 36 // Success and failure callbacks for readValue. |
| 40 using WebBluetoothReadValueCallbacks = WebCallbacks<const WebVector<uint8_t>&, c
onst WebBluetoothError&>; | 37 using WebBluetoothReadValueCallbacks = WebCallbacks<const WebVector<uint8_t>&, c
onst WebBluetoothError&>; |
| 41 | 38 |
| 42 // Success and failure callbacks for writeValue. | 39 // Success and failure callbacks for writeValue. |
| 43 using WebBluetoothWriteValueCallbacks = WebCallbacks<const WebVector<uint8_t>&,
const WebBluetoothError&>; | 40 using WebBluetoothWriteValueCallbacks = WebCallbacks<const WebVector<uint8_t>&,
const WebBluetoothError&>; |
| 44 | 41 |
| 45 // Success and failure callbacks for characteristic.startNotifications and | 42 // Success and failure callbacks for characteristic.startNotifications and |
| 46 // characteristic.stopNotifications. | 43 // characteristic.stopNotifications. |
| 47 using WebBluetoothNotificationsCallbacks = WebCallbacks<void, const WebBluetooth
Error&>; | 44 using WebBluetoothNotificationsCallbacks = WebCallbacks<void, const WebBluetooth
Error&>; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 62 virtual void connect(const WebString& deviceId, | 59 virtual void connect(const WebString& deviceId, |
| 63 WebBluetoothRemoteGATTServerConnectCallbacks*) { } | 60 WebBluetoothRemoteGATTServerConnectCallbacks*) { } |
| 64 virtual void disconnect(const WebString& deviceId) = 0; | 61 virtual void disconnect(const WebString& deviceId) = 0; |
| 65 virtual void getPrimaryService(const WebString& deviceId, | 62 virtual void getPrimaryService(const WebString& deviceId, |
| 66 const WebString& serviceUUID, | 63 const WebString& serviceUUID, |
| 67 WebBluetoothGetPrimaryServiceCallbacks*) { } | 64 WebBluetoothGetPrimaryServiceCallbacks*) { } |
| 68 // virtual void getPrimaryServices() { } | 65 // virtual void getPrimaryServices() { } |
| 69 | 66 |
| 70 // BluetoothRemoteGATTService methods: | 67 // BluetoothRemoteGATTService methods: |
| 71 // See https://webbluetoothchrome.github.io/web-bluetooth/#idl-def-bluetooth
gattservice | 68 // See https://webbluetoothchrome.github.io/web-bluetooth/#idl-def-bluetooth
gattservice |
| 72 virtual void getCharacteristic(const WebString& serviceInstanceID, | |
| 73 const WebString& characteristicUUID, | |
| 74 WebBluetoothGetCharacteristicCallbacks*) { } | |
| 75 virtual void getCharacteristics(const WebString& serviceInstanceID, | 69 virtual void getCharacteristics(const WebString& serviceInstanceID, |
| 70 bool singleCharacteristic, |
| 76 const WebString& characteristicsUUID, | 71 const WebString& characteristicsUUID, |
| 77 WebBluetoothGetCharacteristicsCallbacks*) = 0; | 72 WebBluetoothGetCharacteristicsCallbacks*) = 0; |
| 78 | 73 |
| 79 // BluetoothRemoteGATTCharacteristic methods: | 74 // BluetoothRemoteGATTCharacteristic methods: |
| 80 // See https://webbluetoothchrome.github.io/web-bluetooth/#bluetoothgattchar
acteristic | 75 // See https://webbluetoothchrome.github.io/web-bluetooth/#bluetoothgattchar
acteristic |
| 81 virtual void readValue(const WebString& characteristicInstanceID, | 76 virtual void readValue(const WebString& characteristicInstanceID, |
| 82 WebBluetoothReadValueCallbacks*) { } | 77 WebBluetoothReadValueCallbacks*) { } |
| 83 virtual void writeValue(const WebString& characteristicInstanceID, | 78 virtual void writeValue(const WebString& characteristicInstanceID, |
| 84 const WebVector<uint8_t>& value, | 79 const WebVector<uint8_t>& value, |
| 85 WebBluetoothWriteValueCallbacks*) {} | 80 WebBluetoothWriteValueCallbacks*) {} |
| 86 virtual void startNotifications(const WebString& characteristicInstanceID, | 81 virtual void startNotifications(const WebString& characteristicInstanceID, |
| 87 WebBluetoothNotificationsCallbacks*) {} | 82 WebBluetoothNotificationsCallbacks*) {} |
| 88 virtual void stopNotifications(const WebString& characteristicInstanceID, | 83 virtual void stopNotifications(const WebString& characteristicInstanceID, |
| 89 WebBluetoothNotificationsCallbacks*) {} | 84 WebBluetoothNotificationsCallbacks*) {} |
| 90 | 85 |
| 91 // Called when addEventListener is called on a characteristic. | 86 // Called when addEventListener is called on a characteristic. |
| 92 virtual void registerCharacteristicObject( | 87 virtual void registerCharacteristicObject( |
| 93 const WebString& characteristicInstanceID, | 88 const WebString& characteristicInstanceID, |
| 94 WebBluetoothRemoteGATTCharacteristic*) = 0; | 89 WebBluetoothRemoteGATTCharacteristic*) = 0; |
| 95 virtual void characteristicObjectRemoved( | 90 virtual void characteristicObjectRemoved( |
| 96 const WebString& characteristicInstanceID, | 91 const WebString& characteristicInstanceID, |
| 97 WebBluetoothRemoteGATTCharacteristic*) {} | 92 WebBluetoothRemoteGATTCharacteristic*) {} |
| 98 }; | 93 }; |
| 99 | 94 |
| 100 } // namespace blink | 95 } // namespace blink |
| 101 | 96 |
| 102 #endif // WebBluetooth_h | 97 #endif // WebBluetooth_h |
| OLD | NEW |