Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: device/bluetooth/bluetooth_gatt_characteristic.cc

Issue 1765773002: bluetooth: Refactor GetDescriptorForUUID to GetDescriptorsForUUID. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bta-notify-tommyt-
Patch Set: addressed ortuno's comments Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "device/bluetooth/bluetooth_gatt_characteristic.h" 5 #include "device/bluetooth/bluetooth_gatt_characteristic.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "device/bluetooth/bluetooth_gatt_descriptor.h" 8 #include "device/bluetooth/bluetooth_gatt_descriptor.h"
9 9
10 namespace device { 10 namespace device {
11 11
12 BluetoothGattCharacteristic::BluetoothGattCharacteristic() { 12 BluetoothGattCharacteristic::BluetoothGattCharacteristic() {
13 } 13 }
14 14
15 BluetoothGattCharacteristic::~BluetoothGattCharacteristic() { 15 BluetoothGattCharacteristic::~BluetoothGattCharacteristic() {
16 } 16 }
17 17
18 // static 18 // static
19 BluetoothGattCharacteristic* BluetoothGattCharacteristic::Create( 19 BluetoothGattCharacteristic* BluetoothGattCharacteristic::Create(
20 const BluetoothUUID& uuid, 20 const BluetoothUUID& uuid,
21 const std::vector<uint8_t>& value, 21 const std::vector<uint8_t>& value,
22 Properties properties, 22 Properties properties,
23 Permissions permissions) { 23 Permissions permissions) {
24 LOG(ERROR) << "Creating local GATT characteristics currently not supported."; 24 LOG(ERROR) << "Creating local GATT characteristics currently not supported.";
25 return NULL; 25 return NULL;
26 } 26 }
27 27
28 BluetoothGattDescriptor* BluetoothGattCharacteristic::GetDescriptorForUUID( 28 std::vector<BluetoothGattDescriptor*>
29 const BluetoothUUID& uuid) { 29 BluetoothGattCharacteristic::GetDescriptorsByUUID(const BluetoothUUID& uuid) {
30 std::vector<BluetoothGattDescriptor*> descriptors;
30 for (BluetoothGattDescriptor* descriptor : GetDescriptors()) { 31 for (BluetoothGattDescriptor* descriptor : GetDescriptors()) {
31 if (descriptor->GetUUID() == uuid) { 32 if (descriptor->GetUUID() == uuid) {
32 return descriptor; 33 descriptors.push_back(descriptor);
33 } 34 }
34 } 35 }
35 return NULL; 36 return descriptors;
36 } 37 }
37 38
38 } // namespace device 39 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_gatt_characteristic.h ('k') | device/bluetooth/bluetooth_gatt_characteristic_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698