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
3 // found in the LICENSE file.
8 #include "public/platform/WebCallbacks.h"
9 #include "public/platform/WebPassOwnPtr.h"
10 #include "public/platform/WebString.h"
11 #include "public/platform/WebVector.h"
12 #include "public/platform/modules/bluetooth/WebBluetoothError.h"
17 struct WebBluetoothDevice
;
18 struct WebBluetoothGATTCharacteristic
;
19 struct WebBluetoothGATTRemoteServer
;
20 struct WebBluetoothGATTService
;
21 struct WebRequestDeviceOptions
;
23 // Success and failure callbacks for requestDevice.
24 using WebBluetoothRequestDeviceCallbacks
= WebCallbacks
<WebPassOwnPtr
<WebBluetoothDevice
>, const WebBluetoothError
&>;
26 // Success and failure callbacks for connectGATT.
27 using WebBluetoothConnectGATTCallbacks
= WebCallbacks
<WebPassOwnPtr
<WebBluetoothGATTRemoteServer
>, const WebBluetoothError
&>;
29 // Success and failure callbacks for getPrimaryService.
30 using WebBluetoothGetPrimaryServiceCallbacks
= WebCallbacks
<WebPassOwnPtr
<WebBluetoothGATTService
>, const WebBluetoothError
&>;
32 // Success and failure callbacks for getCharacteristic.
33 using WebBluetoothGetCharacteristicCallbacks
= WebCallbacks
<WebPassOwnPtr
<WebBluetoothGATTCharacteristic
>, const WebBluetoothError
&>;
35 // Success and failure callbacks for readValue.
36 using WebBluetoothReadValueCallbacks
= WebCallbacks
<const WebVector
<uint8_t>&, const WebBluetoothError
&>;
38 // Success and failure callbacks for writeValue.
39 using WebBluetoothWriteValueCallbacks
= WebCallbacks
<void, const WebBluetoothError
&>;
43 virtual ~WebBluetooth() { }
46 // See https://webbluetoothchrome.github.io/web-bluetooth/#device-discovery
47 // WebBluetoothRequestDeviceCallbacks ownership transferred to the client.
48 virtual void requestDevice(const WebRequestDeviceOptions
&, WebBluetoothRequestDeviceCallbacks
*) { }
50 // BluetoothDevice methods:
51 // See https://webbluetoothchrome.github.io/web-bluetooth/#idl-def-bluetoothdevice
52 // WebBluetoothConnectGATTCallbacks ownership transferred to the callee.
53 virtual void connectGATT(const WebString
& /* deviceInstanceID */,
54 WebBluetoothConnectGATTCallbacks
*) { }
56 // BluetoothGATTRemoteServer methods:
57 // See https://webbluetoothchrome.github.io/web-bluetooth/#idl-def-bluetoothgattremoteserver
58 virtual void disconnect() { }
59 virtual void getPrimaryService(const WebString
& deviceInstanceID
,
60 const WebString
& serviceUUID
,
61 WebBluetoothGetPrimaryServiceCallbacks
*) { }
62 // virtual void getPrimaryServices() { }
64 // BluetoothGATTService methods:
65 // See https://webbluetoothchrome.github.io/web-bluetooth/#idl-def-bluetoothgattservice
66 virtual void getCharacteristic(const WebString
& serviceInstanceID
,
67 const WebString
& characteristicUUID
,
68 WebBluetoothGetCharacteristicCallbacks
*) { }
70 // BluetoothGATTCharacteristic methods:
71 // See https://webbluetoothchrome.github.io/web-bluetooth/#bluetoothgattcharacteristic
72 virtual void readValue(const WebString
& characteristicInstanceID
,
73 WebBluetoothReadValueCallbacks
*) { }
74 virtual void writeValue(const WebString
& characteristicInstanceID
,
75 const std::vector
<uint8_t>& value
,
76 WebBluetoothWriteValueCallbacks
*) { }
81 #endif // WebBluetooth_h