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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698