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 CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ |
6 #define CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ | 6 #define CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 const blink::WebRequestDeviceOptions& options, | 47 const blink::WebRequestDeviceOptions& options, |
48 blink::WebBluetoothRequestDeviceCallbacks* callbacks) override; | 48 blink::WebBluetoothRequestDeviceCallbacks* callbacks) override; |
49 void connect( | 49 void connect( |
50 const blink::WebString& device_id, | 50 const blink::WebString& device_id, |
51 blink::WebBluetoothRemoteGATTServerConnectCallbacks* callbacks) override; | 51 blink::WebBluetoothRemoteGATTServerConnectCallbacks* callbacks) override; |
52 void disconnect(const blink::WebString& device_id) override; | 52 void disconnect(const blink::WebString& device_id) override; |
53 void getPrimaryService( | 53 void getPrimaryService( |
54 const blink::WebString& device_id, | 54 const blink::WebString& device_id, |
55 const blink::WebString& service_uuid, | 55 const blink::WebString& service_uuid, |
56 blink::WebBluetoothGetPrimaryServiceCallbacks* callbacks) override; | 56 blink::WebBluetoothGetPrimaryServiceCallbacks* callbacks) override; |
57 void getCharacteristic( | |
58 const blink::WebString& service_instance_id, | |
59 const blink::WebString& characteristic_uuid, | |
60 blink::WebBluetoothGetCharacteristicCallbacks* callbacks) override; | |
61 void getCharacteristics( | 57 void getCharacteristics( |
62 const blink::WebString& service_instance_id, | 58 const blink::WebString& service_instance_id, |
| 59 bool single_characteristic, |
63 const blink::WebString& characteristics_uuid, | 60 const blink::WebString& characteristics_uuid, |
64 blink::WebBluetoothGetCharacteristicsCallbacks* callbacks) override; | 61 blink::WebBluetoothGetCharacteristicsCallbacks* callbacks) override; |
65 void readValue(const blink::WebString& characteristic_instance_id, | 62 void readValue(const blink::WebString& characteristic_instance_id, |
66 blink::WebBluetoothReadValueCallbacks* callbacks) override; | 63 blink::WebBluetoothReadValueCallbacks* callbacks) override; |
67 void writeValue(const blink::WebString& characteristic_instance_id, | 64 void writeValue(const blink::WebString& characteristic_instance_id, |
68 const blink::WebVector<uint8_t>& value, | 65 const blink::WebVector<uint8_t>& value, |
69 blink::WebBluetoothWriteValueCallbacks*) override; | 66 blink::WebBluetoothWriteValueCallbacks*) override; |
70 void startNotifications( | 67 void startNotifications( |
71 const blink::WebString& characteristic_instance_id, | 68 const blink::WebString& characteristic_instance_id, |
72 blink::WebBluetoothNotificationsCallbacks*) override; | 69 blink::WebBluetoothNotificationsCallbacks*) override; |
73 void stopNotifications( | 70 void stopNotifications( |
74 const blink::WebString& characteristic_instance_id, | 71 const blink::WebString& characteristic_instance_id, |
75 blink::WebBluetoothNotificationsCallbacks*) override; | 72 blink::WebBluetoothNotificationsCallbacks*) override; |
76 void characteristicObjectRemoved( | 73 void characteristicObjectRemoved( |
77 const blink::WebString& characteristic_instance_id, | 74 const blink::WebString& characteristic_instance_id, |
78 blink::WebBluetoothRemoteGATTCharacteristic* characteristic) override; | 75 blink::WebBluetoothRemoteGATTCharacteristic* characteristic) override; |
79 void registerCharacteristicObject( | 76 void registerCharacteristicObject( |
80 const blink::WebString& characteristic_instance_id, | 77 const blink::WebString& characteristic_instance_id, |
81 blink::WebBluetoothRemoteGATTCharacteristic* characteristic) override; | 78 blink::WebBluetoothRemoteGATTCharacteristic* characteristic) override; |
82 | 79 |
83 private: | 80 private: |
| 81 struct GetCharacteristicsCallback; |
84 // WebBluetoothServiceClient methods: | 82 // WebBluetoothServiceClient methods: |
85 void RemoteCharacteristicValueChanged( | 83 void RemoteCharacteristicValueChanged( |
86 const mojo::String& characteristic_instance_id, | 84 const mojo::String& characteristic_instance_id, |
87 mojo::Array<uint8_t> value) override; | 85 mojo::Array<uint8_t> value) override; |
88 | 86 |
89 // Callbacks for WebBluetoothService calls: | 87 // Callbacks for WebBluetoothService calls: |
| 88 void OnGetCharacteristicsComplete( |
| 89 const blink::WebString& service_instance_id, |
| 90 const blink::WebString& characteristic_uuid, |
| 91 std::unique_ptr<blink::WebBluetoothGetCharacteristicsCallbacks> callbacks, |
| 92 blink::mojom::WebBluetoothError error, |
| 93 mojo::Array<blink::mojom::WebBluetoothRemoteGATTCharacteristicPtr> |
| 94 characteristics); |
90 void OnReadValueComplete( | 95 void OnReadValueComplete( |
91 std::unique_ptr<blink::WebBluetoothReadValueCallbacks> callbacks, | 96 std::unique_ptr<blink::WebBluetoothReadValueCallbacks> callbacks, |
92 blink::mojom::WebBluetoothError error, | 97 blink::mojom::WebBluetoothError error, |
93 mojo::Array<uint8_t> value); | 98 mojo::Array<uint8_t> value); |
94 void OnWriteValueComplete( | 99 void OnWriteValueComplete( |
95 const blink::WebVector<uint8_t>& value, | 100 const blink::WebVector<uint8_t>& value, |
96 std::unique_ptr<blink::WebBluetoothWriteValueCallbacks> callbacks, | 101 std::unique_ptr<blink::WebBluetoothWriteValueCallbacks> callbacks, |
97 blink::mojom::WebBluetoothError error); | 102 blink::mojom::WebBluetoothError error); |
98 void OnStartNotificationsComplete( | 103 void OnStartNotificationsComplete( |
99 std::unique_ptr<blink::WebBluetoothNotificationsCallbacks> callbacks, | 104 std::unique_ptr<blink::WebBluetoothNotificationsCallbacks> callbacks, |
(...skipping 23 matching lines...) Expand all Loading... |
123 | 128 |
124 const scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 129 const scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
125 const int frame_routing_id_; | 130 const int frame_routing_id_; |
126 | 131 |
127 DISALLOW_COPY_AND_ASSIGN(WebBluetoothImpl); | 132 DISALLOW_COPY_AND_ASSIGN(WebBluetoothImpl); |
128 }; | 133 }; |
129 | 134 |
130 } // namespace content | 135 } // namespace content |
131 | 136 |
132 #endif // CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ | 137 #endif // CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ |
OLD | NEW |