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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 int32_t quantity /* Corresponds to WebBluetoothGATTQueryQuantity in | 57 int32_t quantity /* Corresponds to WebBluetoothGATTQueryQuantity in |
58 web_bluetooth.mojom */, | 58 web_bluetooth.mojom */, |
59 const blink::WebString& services_uuid, | 59 const blink::WebString& services_uuid, |
60 blink::WebBluetoothGetPrimaryServicesCallbacks* callbacks) override; | 60 blink::WebBluetoothGetPrimaryServicesCallbacks* callbacks) override; |
61 void getCharacteristics( | 61 void getCharacteristics( |
62 const blink::WebString& service_instance_id, | 62 const blink::WebString& service_instance_id, |
63 int32_t quantity /* Corresponds to WebBluetoothGATTQueryQuantity in | 63 int32_t quantity /* Corresponds to WebBluetoothGATTQueryQuantity in |
64 web_bluetooth.mojom */, | 64 web_bluetooth.mojom */, |
65 const blink::WebString& characteristics_uuid, | 65 const blink::WebString& characteristics_uuid, |
66 blink::WebBluetoothGetCharacteristicsCallbacks* callbacks) override; | 66 blink::WebBluetoothGetCharacteristicsCallbacks* callbacks) override; |
67 void readValue(const blink::WebString& characteristic_instance_id, | 67 void characteristicReadValue( |
68 blink::WebBluetoothReadValueCallbacks* callbacks) override; | 68 const blink::WebString& characteristic_instance_id, |
69 void writeValue(const blink::WebString& characteristic_instance_id, | 69 blink::WebBluetoothReadValueCallbacks* callbacks) override; |
70 const blink::WebVector<uint8_t>& value, | 70 void characteristicWriteValue( |
71 blink::WebBluetoothWriteValueCallbacks*) override; | 71 const blink::WebString& characteristic_instance_id, |
72 const blink::WebVector<uint8_t>& value, | |
73 blink::WebBluetoothWriteValueCallbacks*) override; | |
72 void startNotifications( | 74 void startNotifications( |
73 const blink::WebString& characteristic_instance_id, | 75 const blink::WebString& characteristic_instance_id, |
74 blink::WebBluetoothNotificationsCallbacks*) override; | 76 blink::WebBluetoothNotificationsCallbacks*) override; |
75 void stopNotifications( | 77 void stopNotifications( |
76 const blink::WebString& characteristic_instance_id, | 78 const blink::WebString& characteristic_instance_id, |
77 blink::WebBluetoothNotificationsCallbacks*) override; | 79 blink::WebBluetoothNotificationsCallbacks*) override; |
78 void characteristicObjectRemoved( | 80 void characteristicObjectRemoved( |
79 const blink::WebString& characteristic_instance_id, | 81 const blink::WebString& characteristic_instance_id, |
80 blink::WebBluetoothRemoteGATTCharacteristic* characteristic) override; | 82 blink::WebBluetoothRemoteGATTCharacteristic* characteristic) override; |
81 void registerCharacteristicObject( | 83 void registerCharacteristicObject( |
82 const blink::WebString& characteristic_instance_id, | 84 const blink::WebString& characteristic_instance_id, |
83 blink::WebBluetoothRemoteGATTCharacteristic* characteristic) override; | 85 blink::WebBluetoothRemoteGATTCharacteristic* characteristic) override; |
86 void getDescriptors( | |
87 const blink::WebString& characteristic_instance_id, | |
88 int32_t quantity /* Corresponds to WebBluetoothGATTQueryQuantity in | |
89 web_bluetooth.mojom */, | |
90 const blink::WebString& descriptor_uuid, | |
91 blink::WebBluetoothGetDescriptorsCallbacks* callbacks) override; | |
92 void descriptorReadValue( | |
ortuno
2016/12/02 06:14:50
No need for these since we don't implement it yet.
dougt
2016/12/02 18:31:28
Done.
| |
93 const blink::WebString& descriptor_instance_id, | |
94 blink::WebBluetoothReadValueCallbacks* callbacks) override; | |
95 void descriptorWriteValue(const blink::WebString& descriptor_instance_id, | |
96 const blink::WebVector<uint8_t>& value, | |
97 blink::WebBluetoothWriteValueCallbacks*) override; | |
84 | 98 |
85 private: | 99 private: |
86 struct GetCharacteristicsCallback; | 100 struct GetCharacteristicsCallback; |
87 // WebBluetoothServiceClient methods: | 101 // WebBluetoothServiceClient methods: |
88 void RemoteCharacteristicValueChanged( | 102 void RemoteCharacteristicValueChanged( |
89 const std::string& characteristic_instance_id, | 103 const std::string& characteristic_instance_id, |
90 const std::vector<uint8_t>& value) override; | 104 const std::vector<uint8_t>& value) override; |
105 | |
91 void GattServerDisconnected(const WebBluetoothDeviceId& device_id) override; | 106 void GattServerDisconnected(const WebBluetoothDeviceId& device_id) override; |
92 | 107 |
93 // Callbacks for WebBluetoothService calls: | 108 // Callbacks for WebBluetoothService calls: |
94 void OnRequestDeviceComplete( | 109 void OnRequestDeviceComplete( |
95 std::unique_ptr<blink::WebBluetoothRequestDeviceCallbacks> callbacks, | 110 std::unique_ptr<blink::WebBluetoothRequestDeviceCallbacks> callbacks, |
96 const blink::mojom::WebBluetoothResult result, | 111 const blink::mojom::WebBluetoothResult result, |
97 blink::mojom::WebBluetoothDevicePtr device); | 112 blink::mojom::WebBluetoothDevicePtr device); |
98 void OnConnectComplete( | 113 void OnConnectComplete( |
99 std::unique_ptr<blink::WebBluetoothRemoteGATTServerConnectCallbacks> | 114 std::unique_ptr<blink::WebBluetoothRemoteGATTServerConnectCallbacks> |
100 callbacks, | 115 callbacks, |
101 blink::mojom::WebBluetoothResult result); | 116 blink::mojom::WebBluetoothResult result); |
102 void OnGetPrimaryServicesComplete( | 117 void OnGetPrimaryServicesComplete( |
103 const blink::WebString& device_id, | 118 const blink::WebString& device_id, |
104 std::unique_ptr<blink::WebBluetoothGetPrimaryServicesCallbacks> callbacks, | 119 std::unique_ptr<blink::WebBluetoothGetPrimaryServicesCallbacks> callbacks, |
105 blink::mojom::WebBluetoothResult result, | 120 blink::mojom::WebBluetoothResult result, |
106 base::Optional< | 121 base::Optional< |
107 std::vector<blink::mojom::WebBluetoothRemoteGATTServicePtr>> | 122 std::vector<blink::mojom::WebBluetoothRemoteGATTServicePtr>> |
108 services); | 123 services); |
109 void OnGetCharacteristicsComplete( | 124 void OnGetCharacteristicsComplete( |
110 const blink::WebString& service_instance_id, | 125 const blink::WebString& characteristic_instance_id, |
ortuno
2016/12/02 06:14:50
I think it was correct before i.e. service_instanc
dougt
2016/12/02 18:31:28
Done.
| |
111 std::unique_ptr<blink::WebBluetoothGetCharacteristicsCallbacks> callbacks, | 126 std::unique_ptr<blink::WebBluetoothGetCharacteristicsCallbacks> callbacks, |
112 blink::mojom::WebBluetoothResult result, | 127 blink::mojom::WebBluetoothResult result, |
113 base::Optional< | 128 base::Optional< |
114 std::vector<blink::mojom::WebBluetoothRemoteGATTCharacteristicPtr>> | 129 std::vector<blink::mojom::WebBluetoothRemoteGATTCharacteristicPtr>> |
115 characteristics); | 130 characteristics); |
116 void OnReadValueComplete( | 131 void OnReadValueComplete( |
117 std::unique_ptr<blink::WebBluetoothReadValueCallbacks> callbacks, | 132 std::unique_ptr<blink::WebBluetoothReadValueCallbacks> callbacks, |
118 blink::mojom::WebBluetoothResult result, | 133 blink::mojom::WebBluetoothResult result, |
119 const base::Optional<std::vector<uint8_t>>& value); | 134 const base::Optional<std::vector<uint8_t>>& value); |
120 void OnWriteValueComplete( | 135 void OnWriteValueComplete( |
121 const blink::WebVector<uint8_t>& value, | 136 const blink::WebVector<uint8_t>& value, |
122 std::unique_ptr<blink::WebBluetoothWriteValueCallbacks> callbacks, | 137 std::unique_ptr<blink::WebBluetoothWriteValueCallbacks> callbacks, |
123 blink::mojom::WebBluetoothResult result); | 138 blink::mojom::WebBluetoothResult result); |
124 void OnStartNotificationsComplete( | 139 void OnStartNotificationsComplete( |
125 std::unique_ptr<blink::WebBluetoothNotificationsCallbacks> callbacks, | 140 std::unique_ptr<blink::WebBluetoothNotificationsCallbacks> callbacks, |
126 blink::mojom::WebBluetoothResult result); | 141 blink::mojom::WebBluetoothResult result); |
127 void OnStopNotificationsComplete( | 142 void OnStopNotificationsComplete( |
128 std::unique_ptr<blink::WebBluetoothNotificationsCallbacks> callbacks); | 143 std::unique_ptr<blink::WebBluetoothNotificationsCallbacks> callbacks); |
129 | 144 void OnGetDescriptorsComplete( |
145 const blink::WebString& service_instance_id, | |
146 std::unique_ptr<blink::WebBluetoothGetDescriptorsCallbacks> callbacks, | |
147 blink::mojom::WebBluetoothResult result, | |
148 base::Optional< | |
149 std::vector<blink::mojom::WebBluetoothRemoteGATTDescriptorPtr>> | |
150 descriptors); | |
130 void DispatchCharacteristicValueChanged( | 151 void DispatchCharacteristicValueChanged( |
131 const std::string& characteristic_instance_id, | 152 const std::string& characteristic_instance_id, |
132 const std::vector<uint8_t>& value); | 153 const std::vector<uint8_t>& value); |
133 | 154 |
134 blink::mojom::WebBluetoothService& GetWebBluetoothService(); | 155 blink::mojom::WebBluetoothService& GetWebBluetoothService(); |
135 service_manager::InterfaceProvider* const remote_interfaces_; | 156 service_manager::InterfaceProvider* const remote_interfaces_; |
136 blink::mojom::WebBluetoothServicePtr web_bluetooth_service_; | 157 blink::mojom::WebBluetoothServicePtr web_bluetooth_service_; |
137 | 158 |
138 // Map of characteristic_instance_ids to | 159 // Map of characteristic_instance_ids to |
139 // WebBluetoothRemoteGATTCharacteristics. When characteristicObjectRemoved is | 160 // WebBluetoothRemoteGATTCharacteristics. When characteristicObjectRemoved is |
(...skipping 12 matching lines...) Expand all Loading... | |
152 | 173 |
153 // Binding associated with |web_bluetooth_service_|. | 174 // Binding associated with |web_bluetooth_service_|. |
154 mojo::AssociatedBinding<blink::mojom::WebBluetoothServiceClient> binding_; | 175 mojo::AssociatedBinding<blink::mojom::WebBluetoothServiceClient> binding_; |
155 | 176 |
156 DISALLOW_COPY_AND_ASSIGN(WebBluetoothImpl); | 177 DISALLOW_COPY_AND_ASSIGN(WebBluetoothImpl); |
157 }; | 178 }; |
158 | 179 |
159 } // namespace content | 180 } // namespace content |
160 | 181 |
161 #endif // CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ | 182 #endif // CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ |
OLD | NEW |