Index: device/bluetooth/bluetooth_remote_gatt_characteristic_mac.h |
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.h b/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..57d0aad0b74492e02831ff2231fc8368d49b88b2 |
--- /dev/null |
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.h |
@@ -0,0 +1,72 @@ |
+// Copyright 2016 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_CHARACTERISTIC_MAC_H_ |
+#define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_MAC_H_ |
+ |
+#include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" |
+ |
+#include "base/mac/scoped_nsobject.h" |
+ |
+@class CBCharacteristic; |
+ |
+namespace device { |
+ |
+class BluetoothRemoteGattServiceMac; |
+ |
+// The BluetoothRemoteGattCharacteristicMac class implements |
+// BluetoothRemoteGattCharacteristic for remote GATT services on OS X. |
+class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattCharacteristicMac |
+ : public BluetoothRemoteGattCharacteristic { |
+ public: |
+ BluetoothRemoteGattCharacteristicMac( |
+ BluetoothRemoteGattServiceMac* gatt_service, |
+ CBCharacteristic* cb_characteristic); |
+ ~BluetoothRemoteGattCharacteristicMac() override; |
+ |
+ // Override BluetoothGattCharacteristic methods. |
+ std::string GetIdentifier() const override; |
+ BluetoothUUID GetUUID() const override; |
+ Properties GetProperties() const override; |
+ Permissions GetPermissions() const override; |
+ |
+ // Override BluetoothRemoteGattCharacteristic methods. |
+ const std::vector<uint8_t>& GetValue() const override; |
+ BluetoothRemoteGattService* GetService() const override; |
+ bool IsNotifying() const override; |
+ std::vector<BluetoothRemoteGattDescriptor*> GetDescriptors() const override; |
+ BluetoothRemoteGattDescriptor* GetDescriptor( |
+ const std::string& identifier) const override; |
+ void StartNotifySession(const NotifySessionCallback& callback, |
+ const ErrorCallback& error_callback) override; |
+ void ReadRemoteCharacteristic(const ValueCallback& callback, |
+ const ErrorCallback& error_callback) override; |
+ void WriteRemoteCharacteristic(const std::vector<uint8_t>& new_value, |
+ const base::Closure& callback, |
+ const ErrorCallback& error_callback) override; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicMac); |
+ |
+ private: |
+ friend class BluetoothRemoteGattServiceMac; |
+ friend class BluetoothTestMac; |
+ |
+ // Returns CoreBluetooth characteristic. |
+ CBCharacteristic* GetCBCharacteristic() const; |
+ |
+ // gatt_service_ owns instances of this class. |
+ BluetoothRemoteGattServiceMac* gatt_service_; |
+ // A characteristic from CBPeripheral.services.characteristics. |
+ base::scoped_nsobject<CBCharacteristic> cb_characteristic_; |
+ // Characteristic identifier. |
+ std::string identifier_; |
+ // Service UUID. |
+ BluetoothUUID uuid_; |
+ // Characteristic value. |
+ std::vector<uint8_t> value_; |
+}; |
+ |
+} // namespace device |
+ |
+#endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_MAC_H_ |