Chromium Code Reviews| Index: device/bluetooth/bluetooth_remote_gatt_service_mac.mm |
| diff --git a/device/bluetooth/bluetooth_remote_gatt_service_mac.mm b/device/bluetooth/bluetooth_remote_gatt_service_mac.mm |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d95ddf23a48463e47b20cdab7102934fe5cda4f1 |
| --- /dev/null |
| +++ b/device/bluetooth/bluetooth_remote_gatt_service_mac.mm |
| @@ -0,0 +1,73 @@ |
| +// 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. |
| + |
| +#include "device/bluetooth/bluetooth_remote_gatt_service_mac.h" |
| + |
| +#import <CoreBluetooth/CoreBluetooth.h> |
| +#include <vector> |
| + |
| +#include "base/logging.h" |
| +#include "device/bluetooth/bluetooth_adapter_mac.h" |
| +#include "device/bluetooth/bluetooth_low_energy_device_mac.h" |
| +#include "device/bluetooth/bluetooth_uuid.h" |
| + |
| +namespace device { |
| + |
| +BluetoothRemoteGattServiceMac::BluetoothRemoteGattServiceMac( |
| + BluetoothLowEnergyDeviceMac* bluetooth_device_mac, |
| + CBService* service, |
| + bool is_primary) |
| + : bluetooth_device_mac_(bluetooth_device_mac), |
| + service_(service, base::scoped_policy::RETAIN), |
| + is_primary_(is_primary) { |
| + uuid_ = BluetoothAdapterMac::BluetoothUUIDWithCBUUID([service_.get() UUID]); |
| + const std::string string_uuid( |
|
ortuno
2016/05/09 19:54:01
You already have a BluetoothUUID so you can just g
jlebel
2016/05/09 23:05:59
Done.
|
| + BluetoothAdapterMac::StringWithCBUUID([service_.get() UUID])); |
| + identifier_ = |
| + [NSString stringWithFormat:@"%s-%p", string_uuid.c_str(), (void*)service_] |
| + .UTF8String; |
| +} |
| + |
| +BluetoothRemoteGattServiceMac::~BluetoothRemoteGattServiceMac() {} |
| + |
| +std::string BluetoothRemoteGattServiceMac::GetIdentifier() const { |
| + return identifier_; |
| +} |
| + |
| +BluetoothUUID BluetoothRemoteGattServiceMac::GetUUID() const { |
| + return uuid_; |
| +} |
| + |
| +bool BluetoothRemoteGattServiceMac::IsPrimary() const { |
| + return is_primary_; |
| +} |
| + |
| +BluetoothDevice* BluetoothRemoteGattServiceMac::GetDevice() const { |
| + return bluetooth_device_mac_; |
| +} |
| + |
| +std::vector<BluetoothRemoteGattCharacteristic*> |
| +BluetoothRemoteGattServiceMac::GetCharacteristics() const { |
| + NOTIMPLEMENTED(); |
| + return std::vector<BluetoothRemoteGattCharacteristic*>(); |
| +} |
| + |
| +std::vector<BluetoothRemoteGattService*> |
| +BluetoothRemoteGattServiceMac::GetIncludedServices() const { |
| + NOTIMPLEMENTED(); |
| + return std::vector<BluetoothRemoteGattService*>(); |
| +} |
| + |
| +BluetoothRemoteGattCharacteristic* |
| +BluetoothRemoteGattServiceMac::GetCharacteristic( |
| + const std::string& identifier) const { |
| + NOTIMPLEMENTED(); |
| + return nullptr; |
| +} |
| + |
| +CBService* BluetoothRemoteGattServiceMac::GetService() const { |
| + return service_.get(); |
| +} |
| + |
| +} // namespace device |