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