Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1393)

Unified Diff: content/browser/bluetooth/web_bluetooth_service_impl.h

Issue 2466223002: Implement WebBluetooth getDescriptor[s] (Closed)
Patch Set: Ensure that we throw a kGattServerNotConnected error if getDescriptor[s] is called while not connec… Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/bluetooth/web_bluetooth_service_impl.h
diff --git a/content/browser/bluetooth/web_bluetooth_service_impl.h b/content/browser/bluetooth/web_bluetooth_service_impl.h
index 2f2de4299ba49b18e38ca1f28599fabdec613287..c35cd35654c4a38a650d752b9953e92307407add 100644
--- a/content/browser/bluetooth/web_bluetooth_service_impl.h
+++ b/content/browser/bluetooth/web_bluetooth_service_impl.h
@@ -96,6 +96,17 @@ class CONTENT_EXPORT WebBluetoothServiceImpl
const std::string& characteristic_instance_id,
std::vector<uint8_t> value);
+ void GattDescriptorValueChanged(
ortuno 2016/11/21 03:34:08 per comment in web_bluetooth.mojom, we don't need
dougt 2016/11/22 01:47:16 Acknowledged.
+ device::BluetoothAdapter* adapter,
+ device::BluetoothRemoteGattDescriptor* descriptor,
+ const std::vector<uint8_t>& value) override;
+
+ // Notifies the WebBluetoothServiceClient that descriptor
+ // |descriptor_instance_id| changed it's value. We only do this for
+ // descriptors that have been returned to the client in the past.
+ void NotifyDescriptorValueChanged(const std::string& descriptor_instance_id,
+ std::vector<uint8_t> value);
+
// WebBluetoothService methods:
void SetClient(
blink::mojom::WebBluetoothServiceClientAssociatedPtrInfo client) override;
@@ -128,6 +139,33 @@ class CONTENT_EXPORT WebBluetoothServiceImpl
void RemoteCharacteristicStopNotifications(
const mojo::String& characteristic_instance_id,
const RemoteCharacteristicStopNotificationsCallback& callback) override;
+ void RemoteCharacteristicGetDescriptors(
+ const mojo::String& service_instance_id,
+ blink::mojom::WebBluetoothGATTQueryQuantity quantity,
+ const base::Optional<device::BluetoothUUID>& characteristics_uuid,
+ const RemoteCharacteristicGetDescriptorsCallback& callback) override;
+ void RemoteDescriptorReadValue(
+ const mojo::String& descriptor_instance_id,
+ const RemoteDescriptorReadValueCallback& callback) override;
+ void RemoteDescriptorWriteValue(
+ const mojo::String& descriptor_instance_id,
+ mojo::Array<uint8_t> value,
+ const RemoteDescriptorWriteValueCallback& callback) override;
+
+ // Callbacks for BluetoothRemoteGattDescriptor::ReadRemoteDescriptor.
ortuno 2016/11/21 03:34:08 Move these down with the rest of the callbacks.
dougt 2016/11/22 01:47:16 Acknowledged.
+ void OnDescriptorReadValueSuccess(
+ const RemoteDescriptorReadValueCallback& callback,
+ const std::vector<uint8_t>& value);
+ void OnDescriptorReadValueFailed(
+ const RemoteDescriptorReadValueCallback& callback,
+ device::BluetoothRemoteGattService::GattErrorCode error_code);
+
+ // Callbacks for BluetoothRemoteGattDescriptor::WriteRemoteDescriptor.
+ void OnDescriptorWriteValueSuccess(
+ const RemoteDescriptorWriteValueCallback& callback);
+ void OnDescriptorWriteValueFailed(
+ const RemoteDescriptorWriteValueCallback& callback,
+ device::BluetoothRemoteGattService::GattErrorCode error_code);
void RequestDeviceImpl(
blink::mojom::WebBluetoothRequestDeviceOptionsPtr options,
@@ -163,16 +201,17 @@ class CONTENT_EXPORT WebBluetoothServiceImpl
device::BluetoothDevice::ConnectErrorCode error_code);
// Callbacks for BluetoothRemoteGattCharacteristic::ReadRemoteCharacteristic.
- void OnReadValueSuccess(const RemoteCharacteristicReadValueCallback& callback,
- const std::vector<uint8_t>& value);
- void OnReadValueFailed(
+ void OnCharacteristicReadValueSuccess(
+ const RemoteCharacteristicReadValueCallback& callback,
+ const std::vector<uint8_t>& value);
+ void OnCharacteristicReadValueFailed(
const RemoteCharacteristicReadValueCallback& callback,
device::BluetoothRemoteGattService::GattErrorCode error_code);
// Callbacks for BluetoothRemoteGattCharacteristic::WriteRemoteCharacteristic.
- void OnWriteValueSuccess(
+ void OnCharacteristicWriteValueSuccess(
const RemoteCharacteristicWriteValueCallback& callback);
- void OnWriteValueFailed(
+ void OnCharacteristicWriteValueFailed(
const RemoteCharacteristicWriteValueCallback& callback,
device::BluetoothRemoteGattService::GattErrorCode error_code);
@@ -211,6 +250,12 @@ class CONTENT_EXPORT WebBluetoothServiceImpl
CacheQueryResult QueryCacheForCharacteristic(
const std::string& characteristic_instance_id);
+ // Queries the platform cache for a descriptor with
+ // |descriptor_instance_id|. Fills in the |outcome| field, and |device|,
+ // |service| and |descriptor| fields if successful.
ortuno 2016/11/21 03:34:08 |service|, |characteristic|, and |descriptor|
dougt 2016/11/22 01:47:16 Acknowledged.
+ CacheQueryResult QueryCacheForDescriptor(
+ const std::string& descriptor_instance_id);
+
RenderProcessHost* GetRenderProcessHost();
device::BluetoothAdapter* GetAdapter();
url::Origin GetOrigin();
@@ -227,6 +272,8 @@ class CONTENT_EXPORT WebBluetoothServiceImpl
// Maps to get the object's parent based on its instanceID.
std::unordered_map<std::string, std::string> service_id_to_device_address_;
std::unordered_map<std::string, std::string> characteristic_id_to_service_id_;
+ std::unordered_map<std::string, std::string>
+ descriptor_id_to_characteristic_id_;
// Map to keep track of the connected Bluetooth devices.
std::unique_ptr<FrameConnectedBluetoothDevices> connected_devices_;

Powered by Google App Engine
This is Rietveld 408576698