Chromium Code Reviews| 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 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.
| |
| 26 BluetoothAdapterMac::StringWithCBUUID([service_.get() UUID])); | |
| 27 identifier_ = | |
| 28 [NSString stringWithFormat:@"%s-%p", string_uuid.c_str(), (void*)service_] | |
| 29 .UTF8String; | |
| 30 } | |
| 31 | |
| 32 BluetoothRemoteGattServiceMac::~BluetoothRemoteGattServiceMac() {} | |
| 33 | |
| 34 std::string BluetoothRemoteGattServiceMac::GetIdentifier() const { | |
| 35 return identifier_; | |
| 36 } | |
| 37 | |
| 38 BluetoothUUID BluetoothRemoteGattServiceMac::GetUUID() const { | |
| 39 return uuid_; | |
| 40 } | |
| 41 | |
| 42 bool BluetoothRemoteGattServiceMac::IsPrimary() const { | |
| 43 return is_primary_; | |
| 44 } | |
| 45 | |
| 46 BluetoothDevice* BluetoothRemoteGattServiceMac::GetDevice() const { | |
| 47 return bluetooth_device_mac_; | |
| 48 } | |
| 49 | |
| 50 std::vector<BluetoothRemoteGattCharacteristic*> | |
| 51 BluetoothRemoteGattServiceMac::GetCharacteristics() const { | |
| 52 NOTIMPLEMENTED(); | |
| 53 return std::vector<BluetoothRemoteGattCharacteristic*>(); | |
| 54 } | |
| 55 | |
| 56 std::vector<BluetoothRemoteGattService*> | |
| 57 BluetoothRemoteGattServiceMac::GetIncludedServices() const { | |
| 58 NOTIMPLEMENTED(); | |
| 59 return std::vector<BluetoothRemoteGattService*>(); | |
| 60 } | |
| 61 | |
| 62 BluetoothRemoteGattCharacteristic* | |
| 63 BluetoothRemoteGattServiceMac::GetCharacteristic( | |
| 64 const std::string& identifier) const { | |
| 65 NOTIMPLEMENTED(); | |
| 66 return nullptr; | |
| 67 } | |
| 68 | |
| 69 CBService* BluetoothRemoteGattServiceMac::GetService() const { | |
| 70 return service_.get(); | |
| 71 } | |
| 72 | |
| 73 } // namespace device | |
| OLD | NEW |