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

Unified Diff: device/bluetooth/bluetooth_low_energy_device_mac.mm

Issue 2767813002: Bluetooth: macOS: Implementing read/write for descriptors (Closed)
Patch Set: . Created 3 years, 8 months 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: device/bluetooth/bluetooth_low_energy_device_mac.mm
diff --git a/device/bluetooth/bluetooth_low_energy_device_mac.mm b/device/bluetooth/bluetooth_low_energy_device_mac.mm
index b5777bed5d8de949320ac3022b50065c2ec2c682..20694e4953b97d7ca5d4edc882a0a4b0aab06864 100644
--- a/device/bluetooth/bluetooth_low_energy_device_mac.mm
+++ b/device/bluetooth/bluetooth_low_energy_device_mac.mm
@@ -16,6 +16,8 @@
#include "device/bluetooth/bluetooth_adapter_mac.h"
#include "device/bluetooth/bluetooth_device.h"
#include "device/bluetooth/bluetooth_low_energy_peripheral_delegate.h"
+#include "device/bluetooth/bluetooth_remote_gatt_characteristic_mac.h"
+#include "device/bluetooth/bluetooth_remote_gatt_descriptor_mac.h"
#include "device/bluetooth/bluetooth_remote_gatt_service_mac.h"
using device::BluetoothDevice;
@@ -332,6 +334,24 @@ void BluetoothLowEnergyDeviceMac::DidDiscoverDescriptors(
SendNotificationIfDiscoveryComplete();
}
+void BluetoothLowEnergyDeviceMac::DidUpdateValueForDescriptor(
+ CBDescriptor* cb_descriptor,
+ NSError* error) {
+ BluetoothRemoteGattDescriptorMac* gatt_descriptor =
+ GetBluetoothRemoteGattDescriptor(cb_descriptor);
+ DCHECK(gatt_descriptor);
+ gatt_descriptor->DidUpdateValueForDescriptor(error);
+}
+
+void BluetoothLowEnergyDeviceMac::DidWriteValueForDescriptor(
+ CBDescriptor* cb_descriptor,
+ NSError* error) {
+ BluetoothRemoteGattDescriptorMac* gatt_descriptor =
+ GetBluetoothRemoteGattDescriptor(cb_descriptor);
+ DCHECK(gatt_descriptor);
+ gatt_descriptor->DidWriteValueForDescriptor(error);
+}
+
// static
std::string BluetoothLowEnergyDeviceMac::GetPeripheralIdentifier(
CBPeripheral* peripheral) {
@@ -400,6 +420,20 @@ BluetoothLowEnergyDeviceMac::GetBluetoothRemoteGattService(
return nullptr;
}
+device::BluetoothRemoteGattDescriptorMac*
+BluetoothLowEnergyDeviceMac::GetBluetoothRemoteGattDescriptor(
+ CBDescriptor* cb_descriptor) const {
+ CBCharacteristic* cb_characteristic = cb_descriptor.characteristic;
+ device::BluetoothRemoteGattServiceMac* gatt_service =
+ GetBluetoothRemoteGattService(cb_characteristic.service);
+ DCHECK(gatt_service);
+ device::BluetoothRemoteGattCharacteristicMac* gatt_characteristic =
+ gatt_service->GetBluetoothRemoteGattCharacteristicMac(cb_characteristic);
+ DCHECK(gatt_characteristic);
+ return gatt_characteristic->GetBluetoothRemoteGattDescriptorMac(
+ cb_descriptor);
+}
+
void BluetoothLowEnergyDeviceMac::DidDisconnectPeripheral(NSError* error) {
VLOG(1) << *this << ": Disconnected from peripheral.";
if (error) {
« no previous file with comments | « device/bluetooth/bluetooth_low_energy_device_mac.h ('k') | device/bluetooth/bluetooth_low_energy_peripheral_delegate.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698