OLD | NEW |
| (Empty) |
1 // Copyright 2016 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_CHARACTERISTIC_MAC_H_ | |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_MAC_H_ | |
7 | |
8 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" | |
9 | |
10 #include "base/mac/scoped_nsobject.h" | |
11 | |
12 @class CBCharacteristic; | |
13 | |
14 namespace device { | |
15 | |
16 class BluetoothRemoteGattServiceMac; | |
17 | |
18 // The BluetoothRemoteGattCharacteristicMac class implements | |
19 // BluetoothRemoteGattCharacteristic for remote GATT services on OS X. | |
20 class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattCharacteristicMac | |
21 : public BluetoothRemoteGattCharacteristic { | |
22 public: | |
23 BluetoothRemoteGattCharacteristicMac( | |
24 BluetoothRemoteGattServiceMac* gatt_service, | |
25 CBCharacteristic* cb_characteristic); | |
26 ~BluetoothRemoteGattCharacteristicMac() override; | |
27 | |
28 // Override BluetoothGattCharacteristic methods. | |
29 std::string GetIdentifier() const override; | |
30 BluetoothUUID GetUUID() const override; | |
31 Properties GetProperties() const override; | |
32 Permissions GetPermissions() const override; | |
33 | |
34 // Override BluetoothRemoteGattCharacteristic methods. | |
35 const std::vector<uint8_t>& GetValue() const override; | |
36 BluetoothRemoteGattService* GetService() const override; | |
37 bool IsNotifying() const override; | |
38 std::vector<BluetoothRemoteGattDescriptor*> GetDescriptors() const override; | |
39 BluetoothRemoteGattDescriptor* GetDescriptor( | |
40 const std::string& identifier) const override; | |
41 void StartNotifySession(const NotifySessionCallback& callback, | |
42 const ErrorCallback& error_callback) override; | |
43 void ReadRemoteCharacteristic(const ValueCallback& callback, | |
44 const ErrorCallback& error_callback) override; | |
45 void WriteRemoteCharacteristic(const std::vector<uint8_t>& new_value, | |
46 const base::Closure& callback, | |
47 const ErrorCallback& error_callback) override; | |
48 | |
49 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicMac); | |
50 | |
51 private: | |
52 friend class BluetoothRemoteGattServiceMac; | |
53 friend class BluetoothTestMac; | |
54 | |
55 // Returns CoreBluetooth characteristic. | |
56 CBCharacteristic* GetCBCharacteristic() const; | |
57 | |
58 // gatt_service_ owns instances of this class. | |
59 BluetoothRemoteGattServiceMac* gatt_service_; | |
60 // A characteristic from CBPeripheral.services.characteristics. | |
61 base::scoped_nsobject<CBCharacteristic> cb_characteristic_; | |
62 // Characteristic identifier. | |
63 std::string identifier_; | |
64 // Service UUID. | |
65 BluetoothUUID uuid_; | |
66 // Characteristic value. | |
67 std::vector<uint8_t> value_; | |
68 }; | |
69 | |
70 } // namespace device | |
71 | |
72 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_MAC_H_ | |
OLD | NEW |