| 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 #include "device/bluetooth/bluetooth_remote_gatt_service_mac.h" |
| 6 |
| 7 #import <CoreBluetooth/CoreBluetooth.h> |
| 8 #include <vector> |
| 9 |
| 10 #include "base/logging.h" |
| 11 #include "device/bluetooth/bluetooth_adapter_mac.h" |
| 12 #include "device/bluetooth/bluetooth_low_energy_device_mac.h" |
| 13 #include "device/bluetooth/bluetooth_uuid.h" |
| 14 |
| 15 namespace device { |
| 16 |
| 17 BluetoothRemoteGattServiceMac::BluetoothRemoteGattServiceMac( |
| 18 BluetoothLowEnergyDeviceMac* bluetooth_device_mac, |
| 19 CBService* service, |
| 20 bool is_primary) |
| 21 : bluetooth_device_mac_(bluetooth_device_mac), |
| 22 service_(service, base::scoped_policy::RETAIN), |
| 23 is_primary_(is_primary) { |
| 24 uuid_ = BluetoothAdapterMac::BluetoothUUIDWithCBUUID([service_.get() UUID]); |
| 25 identifier_ = |
| 26 [NSString stringWithFormat:@"%s-%p", uuid_.canonical_value().c_str(), |
| 27 (void*)service_] |
| 28 .UTF8String; |
| 29 } |
| 30 |
| 31 BluetoothRemoteGattServiceMac::~BluetoothRemoteGattServiceMac() {} |
| 32 |
| 33 std::string BluetoothRemoteGattServiceMac::GetIdentifier() const { |
| 34 return identifier_; |
| 35 } |
| 36 |
| 37 BluetoothUUID BluetoothRemoteGattServiceMac::GetUUID() const { |
| 38 return uuid_; |
| 39 } |
| 40 |
| 41 bool BluetoothRemoteGattServiceMac::IsPrimary() const { |
| 42 return is_primary_; |
| 43 } |
| 44 |
| 45 BluetoothDevice* BluetoothRemoteGattServiceMac::GetDevice() const { |
| 46 return bluetooth_device_mac_; |
| 47 } |
| 48 |
| 49 std::vector<BluetoothRemoteGattCharacteristic*> |
| 50 BluetoothRemoteGattServiceMac::GetCharacteristics() const { |
| 51 NOTIMPLEMENTED(); |
| 52 return std::vector<BluetoothRemoteGattCharacteristic*>(); |
| 53 } |
| 54 |
| 55 std::vector<BluetoothRemoteGattService*> |
| 56 BluetoothRemoteGattServiceMac::GetIncludedServices() const { |
| 57 NOTIMPLEMENTED(); |
| 58 return std::vector<BluetoothRemoteGattService*>(); |
| 59 } |
| 60 |
| 61 BluetoothRemoteGattCharacteristic* |
| 62 BluetoothRemoteGattServiceMac::GetCharacteristic( |
| 63 const std::string& identifier) const { |
| 64 NOTIMPLEMENTED(); |
| 65 return nullptr; |
| 66 } |
| 67 |
| 68 CBService* BluetoothRemoteGattServiceMac::GetService() const { |
| 69 return service_.get(); |
| 70 } |
| 71 |
| 72 } // namespace device |
| OLD | NEW |