| Index: device/bluetooth/bluez/bluetooth_remote_gatt_service_bluez.cc
|
| diff --git a/device/bluetooth/bluetooth_remote_gatt_service_bluez.cc b/device/bluetooth/bluez/bluetooth_remote_gatt_service_bluez.cc
|
| similarity index 82%
|
| rename from device/bluetooth/bluetooth_remote_gatt_service_bluez.cc
|
| rename to device/bluetooth/bluez/bluetooth_remote_gatt_service_bluez.cc
|
| index 98abdbb51a507809f87f37d295d73e569129b31c..d409a34f67f861afe4836b48b5650bea3cb11f43 100644
|
| --- a/device/bluetooth/bluetooth_remote_gatt_service_bluez.cc
|
| +++ b/device/bluetooth/bluez/bluetooth_remote_gatt_service_bluez.cc
|
| @@ -1,21 +1,17 @@
|
| -// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// 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_bluez.h"
|
| -
|
| #include <iterator>
|
|
|
| -#include "base/callback.h"
|
| -#include "base/callback_forward.h"
|
| #include "base/logging.h"
|
| #include "dbus/property.h"
|
| -#include "device/bluetooth/bluetooth_adapter_bluez.h"
|
| -#include "device/bluetooth/bluetooth_device_bluez.h"
|
| -#include "device/bluetooth/bluetooth_gatt_characteristic_bluez.h"
|
| -#include "device/bluetooth/bluetooth_gatt_descriptor_bluez.h"
|
| -#include "device/bluetooth/bluetooth_gatt_service.h"
|
| -#include "device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.h"
|
| +#include "device/bluetooth/bluez/bluetooth_adapter_bluez.h"
|
| +#include "device/bluetooth/bluez/bluetooth_device_bluez.h"
|
| +#include "device/bluetooth/bluez/bluetooth_gatt_characteristic_bluez.h"
|
| +#include "device/bluetooth/bluez/bluetooth_remote_gatt_characteristic_bluez.h"
|
| +#include "device/bluetooth/bluez/bluetooth_remote_gatt_descriptor_bluez.h"
|
| +#include "device/bluetooth/bluez/bluetooth_remote_gatt_service_bluez.h"
|
| #include "device/bluetooth/dbus/bluez_dbus_manager.h"
|
|
|
| namespace bluez {
|
| @@ -79,10 +75,6 @@ device::BluetoothUUID BluetoothRemoteGattServiceBlueZ::GetUUID() const {
|
| return device::BluetoothUUID(properties->uuid.value());
|
| }
|
|
|
| -bool BluetoothRemoteGattServiceBlueZ::IsLocal() const {
|
| - return false;
|
| -}
|
| -
|
| bool BluetoothRemoteGattServiceBlueZ::IsPrimary() const {
|
| bluez::BluetoothGattServiceClient::Properties* properties =
|
| bluez::BluezDBusManager::Get()
|
| @@ -96,30 +88,30 @@ device::BluetoothDevice* BluetoothRemoteGattServiceBlueZ::GetDevice() const {
|
| return device_;
|
| }
|
|
|
| -bool BluetoothRemoteGattServiceBlueZ::AddCharacteristic(
|
| - device::BluetoothGattCharacteristic* characteristic) {
|
| - VLOG(1) << "Characteristics cannot be added to a remote GATT service.";
|
| - return false;
|
| -}
|
| -
|
| -bool BluetoothRemoteGattServiceBlueZ::AddIncludedService(
|
| - device::BluetoothGattService* service) {
|
| - VLOG(1) << "Included services cannot be added to a remote GATT service.";
|
| - return false;
|
| +std::vector<device::BluetoothRemoteGattCharacteristic*>
|
| +BluetoothRemoteGattServiceBlueZ::GetCharacteristics() const {
|
| + std::vector<device::BluetoothRemoteGattCharacteristic*> characteristics;
|
| + for (CharacteristicMap::const_iterator iter = characteristics_.begin();
|
| + iter != characteristics_.end(); ++iter) {
|
| + characteristics.push_back(iter->second);
|
| + }
|
| + return characteristics;
|
| }
|
|
|
| -void BluetoothRemoteGattServiceBlueZ::Register(
|
| - const base::Closure& callback,
|
| - const ErrorCallback& error_callback) {
|
| - VLOG(1) << "A remote GATT service cannot be registered.";
|
| - error_callback.Run(GATT_ERROR_NOT_SUPPORTED);
|
| +std::vector<device::BluetoothRemoteGattService*>
|
| +BluetoothRemoteGattServiceBlueZ::GetIncludedServices() const {
|
| + // TODO(armansito): Return the actual included services here.
|
| + return std::vector<device::BluetoothRemoteGattService*>();
|
| }
|
|
|
| -void BluetoothRemoteGattServiceBlueZ::Unregister(
|
| - const base::Closure& callback,
|
| - const ErrorCallback& error_callback) {
|
| - VLOG(1) << "A remote GATT service cannot be unregistered.";
|
| - error_callback.Run(GATT_ERROR_NOT_SUPPORTED);
|
| +device::BluetoothRemoteGattCharacteristic*
|
| +BluetoothRemoteGattServiceBlueZ::GetCharacteristic(
|
| + const std::string& identifier) const {
|
| + CharacteristicMap::const_iterator iter =
|
| + characteristics_.find(dbus::ObjectPath(identifier));
|
| + if (iter == characteristics_.end())
|
| + return nullptr;
|
| + return iter->second;
|
| }
|
|
|
| void BluetoothRemoteGattServiceBlueZ::NotifyServiceChanged() {
|
| @@ -135,7 +127,7 @@ void BluetoothRemoteGattServiceBlueZ::NotifyServiceChanged() {
|
|
|
| void BluetoothRemoteGattServiceBlueZ::NotifyDescriptorAddedOrRemoved(
|
| BluetoothRemoteGattCharacteristicBlueZ* characteristic,
|
| - BluetoothGattDescriptorBlueZ* descriptor,
|
| + BluetoothRemoteGattDescriptorBlueZ* descriptor,
|
| bool added) {
|
| DCHECK(characteristic->GetService() == this);
|
| DCHECK(descriptor->GetCharacteristic() == characteristic);
|
| @@ -151,7 +143,7 @@ void BluetoothRemoteGattServiceBlueZ::NotifyDescriptorAddedOrRemoved(
|
|
|
| void BluetoothRemoteGattServiceBlueZ::NotifyDescriptorValueChanged(
|
| BluetoothRemoteGattCharacteristicBlueZ* characteristic,
|
| - BluetoothGattDescriptorBlueZ* descriptor,
|
| + BluetoothRemoteGattDescriptorBlueZ* descriptor,
|
| const std::vector<uint8_t>& value) {
|
| DCHECK(characteristic->GetService() == this);
|
| DCHECK(descriptor->GetCharacteristic() == characteristic);
|
| @@ -230,7 +222,7 @@ void BluetoothRemoteGattServiceBlueZ::GattCharacteristicRemoved(
|
| VLOG(1) << "Removing remote GATT characteristic from service: "
|
| << GetIdentifier() << ", UUID: " << GetUUID().canonical_value();
|
|
|
| - BluetoothGattCharacteristicBlueZ* characteristic = iter->second;
|
| + BluetoothRemoteGattCharacteristicBlueZ* characteristic = iter->second;
|
| DCHECK(characteristic->object_path() == object_path);
|
| characteristics_.erase(iter);
|
|
|
|
|