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

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

Issue 1872943002: Add support for local services/characteristics/descriptors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "device/bluetooth/bluetooth_local_gatt_service_bluez.h"
6
7 #include "base/logging.h"
8 #include "base/strings/stringprintf.h"
9 #include "device/bluetooth/bluetooth_adapter_bluez.h"
10 #include "device/bluetooth/bluetooth_device_bluez.h"
11 #include "device/bluetooth/bluetooth_gatt_descriptor_bluez.h"
12 #include "device/bluetooth/bluetooth_local_gatt_characteristic_bluez.h"
13 #include "device/bluetooth/dbus/bluetooth_gatt_manager_client.h"
14 #include "device/bluetooth/dbus/bluetooth_gatt_service_client.h"
15 #include "device/bluetooth/dbus/bluez_dbus_manager.h"
16
17 namespace bluez {
18
19 BluetoothLocalGattServiceBlueZ::BluetoothLocalGattServiceBlueZ(
20 BluetoothAdapterBlueZ* adapter,
21 BluetoothDeviceBlueZ* device,
22 const dbus::ObjectPath& object_path)
23 : BluetoothGattServiceBlueZ(adapter, device, object_path),
24 weak_ptr_factory_(this) {
25 VLOG(1) << "Creating local GATT service with identifier: "
26 << object_path.value() << ", UUID: " << GetUUID().canonical_value();
27 }
28
29 BluetoothLocalGattServiceBlueZ::~BluetoothLocalGattServiceBlueZ() {}
30
31 bool BluetoothLocalGattServiceBlueZ::IsLocal() const {
32 return true;
33 }
34
35 bool BluetoothLocalGattServiceBlueZ::AddCharacteristic(
36 device::BluetoothGattCharacteristic* characteristic) {
37 VLOG(1) << "Characteristics cannot be added to a remote GATT service.";
38 return false;
39 }
40
41 bool BluetoothLocalGattServiceBlueZ::AddIncludedService(
42 device::BluetoothGattService* service) {
43 VLOG(1) << "Included services cannot be added to a remote GATT service.";
44 return false;
45 }
46
47 void BluetoothLocalGattServiceBlueZ::Register(
48 const base::Closure& callback,
49 const ErrorCallback& error_callback) {
50 DCHECK(bluez::BluezDBusManager::Get());
51 bluez::BluezDBusManager::Get()
52 ->GetBluetoothGattManagerClient()
53 ->RegisterService(object_path(), BluetoothGattManagerClient::Options(),
54 callback, error_callback);
55 }
56
57 void BluetoothLocalGattServiceBlueZ::Unregister(
58 const base::Closure& callback,
59 const ErrorCallback& error_callback) {
60 DCHECK(bluez::BluezDBusManager::Get());
61 bluez::BluezDBusManager::Get()
62 ->GetBluetoothGattManagerClient()
63 ->UnregisterService(object_path(), callback, error_callback);
64 }
65
66 } // namespace bluez
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698