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

Unified Diff: device/bluetooth/bluetooth_remote_gatt_descriptor_mac.h

Issue 2595373003: Bluetooth: mac: Working on macOS descriptor implementation. (Closed)
Patch Set: Fixes Created 3 years, 11 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_remote_gatt_descriptor_mac.h
diff --git a/device/bluetooth/bluetooth_remote_gatt_descriptor_mac.h b/device/bluetooth/bluetooth_remote_gatt_descriptor_mac.h
new file mode 100644
index 0000000000000000000000000000000000000000..9749322a4d1b350d1cbbaedced94d55cef485d47
--- /dev/null
+++ b/device/bluetooth/bluetooth_remote_gatt_descriptor_mac.h
@@ -0,0 +1,65 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_MAC_H_
+#define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_MAC_H_
+
+#include "device/bluetooth/bluetooth_remote_gatt_descriptor.h"
+
+#include <vector>
+
+#include "base/mac/scoped_nsobject.h"
+#include "base/memory/weak_ptr.h"
+
+#if defined(__OBJC__)
+#import <CoreBluetooth/CoreBluetooth.h>
+#endif // defined(__OBJC__)
+
+namespace device {
+
+class BluetoothRemoteGattCharacteristicMac;
+
+// The BluetoothRemoteGattDescriptorMac class implements
+// BluetoothRemoteGattDescriptor for remote GATT services on macOS.
+class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattDescriptorMac
+ : public BluetoothRemoteGattDescriptor {
+ public:
+ BluetoothRemoteGattDescriptorMac(
+ BluetoothRemoteGattCharacteristicMac* characteristic,
+ CBDescriptor* descriptor);
+ ~BluetoothRemoteGattDescriptorMac() override;
+
+ // BluetoothGattDescriptor
+ std::string GetIdentifier() const override;
+ BluetoothUUID GetUUID() const override;
+ BluetoothGattCharacteristic::Permissions GetPermissions() const override;
+ // BluetoothRemoteGattDescriptor
+ const std::vector<uint8_t>& GetValue() const override;
+ BluetoothRemoteGattCharacteristic* GetCharacteristic() const override;
+ void ReadRemoteDescriptor(const ValueCallback& callback,
+ const ErrorCallback& error_callback) override;
+ void WriteRemoteDescriptor(const std::vector<uint8_t>& new_value,
+ const base::Closure& callback,
+ const ErrorCallback& error_callback) override;
+
+ private:
+ friend class BluetoothRemoteGattCharacteristicMac;
+
+ // Returns CoreBluetooth descriptor.
+ CBDescriptor* GetCBDescriptor() const;
+ // gatt_characteristic_ owns instances of this class.
+ BluetoothRemoteGattCharacteristicMac* gatt_characteristic_;
+ // Descriptor from CoreBluetooth.
+ base::scoped_nsobject<CBDescriptor> cb_descriptor_;
+ // Descriptor identifier.
+ std::string identifier_;
+ // Descriptor UUID.
+ BluetoothUUID uuid_;
+ // Descriptor value.
+ std::vector<uint8_t> value_;
+};
+
+} // namespace device
+
+#endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_MAC_H_

Powered by Google App Engine
This is Rietveld 408576698