| Index: device/bluetooth/bluetooth_local_gatt_service_bluez.cc
|
| diff --git a/device/bluetooth/bluetooth_local_gatt_service_bluez.cc b/device/bluetooth/bluetooth_local_gatt_service_bluez.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..548c7f172ea4a37521c8205662cdad5342293f89
|
| --- /dev/null
|
| +++ b/device/bluetooth/bluetooth_local_gatt_service_bluez.cc
|
| @@ -0,0 +1,66 @@
|
| +// Copyright 2014 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_local_gatt_service_bluez.h"
|
| +
|
| +#include "base/logging.h"
|
| +#include "base/strings/stringprintf.h"
|
| +#include "device/bluetooth/bluetooth_adapter_bluez.h"
|
| +#include "device/bluetooth/bluetooth_device_bluez.h"
|
| +#include "device/bluetooth/bluetooth_gatt_descriptor_bluez.h"
|
| +#include "device/bluetooth/bluetooth_local_gatt_characteristic_bluez.h"
|
| +#include "device/bluetooth/dbus/bluetooth_gatt_manager_client.h"
|
| +#include "device/bluetooth/dbus/bluetooth_gatt_service_client.h"
|
| +#include "device/bluetooth/dbus/bluez_dbus_manager.h"
|
| +
|
| +namespace bluez {
|
| +
|
| +BluetoothLocalGattServiceBlueZ::BluetoothLocalGattServiceBlueZ(
|
| + BluetoothAdapterBlueZ* adapter,
|
| + BluetoothDeviceBlueZ* device,
|
| + const dbus::ObjectPath& object_path)
|
| + : BluetoothGattServiceBlueZ(adapter, device, object_path),
|
| + weak_ptr_factory_(this) {
|
| + VLOG(1) << "Creating local GATT service with identifier: "
|
| + << object_path.value() << ", UUID: " << GetUUID().canonical_value();
|
| +}
|
| +
|
| +BluetoothLocalGattServiceBlueZ::~BluetoothLocalGattServiceBlueZ() {}
|
| +
|
| +bool BluetoothLocalGattServiceBlueZ::IsLocal() const {
|
| + return true;
|
| +}
|
| +
|
| +bool BluetoothLocalGattServiceBlueZ::AddCharacteristic(
|
| + device::BluetoothGattCharacteristic* characteristic) {
|
| + VLOG(1) << "Characteristics cannot be added to a remote GATT service.";
|
| + return false;
|
| +}
|
| +
|
| +bool BluetoothLocalGattServiceBlueZ::AddIncludedService(
|
| + device::BluetoothGattService* service) {
|
| + VLOG(1) << "Included services cannot be added to a remote GATT service.";
|
| + return false;
|
| +}
|
| +
|
| +void BluetoothLocalGattServiceBlueZ::Register(
|
| + const base::Closure& callback,
|
| + const ErrorCallback& error_callback) {
|
| + DCHECK(bluez::BluezDBusManager::Get());
|
| + bluez::BluezDBusManager::Get()
|
| + ->GetBluetoothGattManagerClient()
|
| + ->RegisterService(object_path(), BluetoothGattManagerClient::Options(),
|
| + callback, error_callback);
|
| +}
|
| +
|
| +void BluetoothLocalGattServiceBlueZ::Unregister(
|
| + const base::Closure& callback,
|
| + const ErrorCallback& error_callback) {
|
| + DCHECK(bluez::BluezDBusManager::Get());
|
| + bluez::BluezDBusManager::Get()
|
| + ->GetBluetoothGattManagerClient()
|
| + ->UnregisterService(object_path(), callback, error_callback);
|
| +}
|
| +
|
| +} // namespace bluez
|
|
|