summaryrefslogtreecommitdiff
path: root/chromium/device/bluetooth/bluetooth_remote_gatt_service.cc
blob: 1df683b80d1cc7d98d158a275310f05dfd6c8f29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// 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.h"

#include "device/bluetooth/bluetooth_remote_gatt_characteristic.h"
#include "device/bluetooth/bluetooth_uuid.h"

namespace device {

BluetoothRemoteGattService::BluetoothRemoteGattService() = default;

BluetoothRemoteGattService::~BluetoothRemoteGattService() = default;

std::vector<BluetoothRemoteGattCharacteristic*>
BluetoothRemoteGattService::GetCharacteristicsByUUID(
    const BluetoothUUID& characteristic_uuid) {
  std::vector<BluetoothRemoteGattCharacteristic*> result;
  std::vector<BluetoothRemoteGattCharacteristic*> characteristics =
      GetCharacteristics();
  for (auto* characteristic : characteristics) {
    if (characteristic->GetUUID() == characteristic_uuid) {
      result.push_back(characteristic);
    }
  }
  return result;
}

bool BluetoothRemoteGattService::IsDiscoveryComplete() const {
  return discovery_complete_;
}

void BluetoothRemoteGattService::SetDiscoveryComplete(bool complete) {
  discovery_complete_ = complete;
}

}  // namespace device