Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
|
scheib
2017/01/09 21:07:37
2017
jlebel
2017/01/09 22:58:32
Done.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_MAC_H_ | |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_MAC_H_ | |
| 7 | |
| 8 #include "device/bluetooth/bluetooth_remote_gatt_descriptor.h" | |
| 9 | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "base/mac/scoped_nsobject.h" | |
| 13 #include "base/memory/weak_ptr.h" | |
| 14 | |
| 15 #if defined(__OBJC__) | |
| 16 #import <CoreBluetooth/CoreBluetooth.h> | |
| 17 #endif // defined(__OBJC__) | |
| 18 | |
| 19 namespace device { | |
| 20 | |
| 21 class BluetoothRemoteGattCharacteristicMac; | |
| 22 | |
| 23 // The BluetoothRemoteGattDescriptorMac class implements | |
| 24 // BluetoothRemoteGattDescriptor for remote GATT services on macOS. | |
| 25 class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattDescriptorMac | |
| 26 : public BluetoothRemoteGattDescriptor { | |
| 27 public: | |
| 28 BluetoothRemoteGattDescriptorMac( | |
| 29 BluetoothRemoteGattCharacteristicMac* characteristic, | |
| 30 CBDescriptor* descriptor); | |
| 31 ~BluetoothRemoteGattDescriptorMac() override; | |
| 32 | |
| 33 // BluetoothGattDescriptor | |
| 34 std::string GetIdentifier() const override; | |
| 35 BluetoothUUID GetUUID() const override; | |
| 36 BluetoothGattCharacteristic::Permissions GetPermissions() const override; | |
| 37 // BluetoothRemoteGattDescriptor | |
| 38 const std::vector<uint8_t>& GetValue() const override; | |
| 39 BluetoothRemoteGattCharacteristic* GetCharacteristic() const override; | |
| 40 void ReadRemoteDescriptor(const ValueCallback& callback, | |
| 41 const ErrorCallback& error_callback) override; | |
| 42 void WriteRemoteDescriptor(const std::vector<uint8_t>& new_value, | |
| 43 const base::Closure& callback, | |
| 44 const ErrorCallback& error_callback) override; | |
| 45 | |
| 46 private: | |
| 47 friend class BluetoothRemoteGattCharacteristicMac; | |
| 48 | |
| 49 // Returns CoreBluetooth descriptor. | |
| 50 CBDescriptor* GetCBDescriptor() const; | |
| 51 // gatt_characteristic_ owns instances of this class. | |
| 52 BluetoothRemoteGattCharacteristicMac* gatt_characteristic_; | |
| 53 // Descriptor from CoreBluetooth. | |
| 54 base::scoped_nsobject<CBDescriptor> cb_descriptor_; | |
| 55 // Descriptor identifier. | |
| 56 std::string identifier_; | |
| 57 // Descriptor UUID. | |
| 58 BluetoothUUID uuid_; | |
| 59 // Descriptor value. | |
| 60 std::vector<uint8_t> value_; | |
| 61 }; | |
| 62 | |
| 63 } // namespace device | |
| 64 | |
| 65 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_MAC_H_ | |
| OLD | NEW |