OLD | NEW |
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 "chromeos/dbus/bluetooth_gatt_characteristic_service_provider.h" | 5 #include "chromeos/dbus/bluetooth_gatt_characteristic_service_provider.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 object_path_(object_path), | 45 object_path_(object_path), |
46 service_path_(service_path), | 46 service_path_(service_path), |
47 weak_ptr_factory_(this) { | 47 weak_ptr_factory_(this) { |
48 VLOG(1) << "Created Bluetooth GATT characteristic: " << object_path.value() | 48 VLOG(1) << "Created Bluetooth GATT characteristic: " << object_path.value() |
49 << " UUID: " << uuid; | 49 << " UUID: " << uuid; |
50 DCHECK(bus_); | 50 DCHECK(bus_); |
51 DCHECK(delegate_); | 51 DCHECK(delegate_); |
52 DCHECK(!uuid_.empty()); | 52 DCHECK(!uuid_.empty()); |
53 DCHECK(object_path_.IsValid()); | 53 DCHECK(object_path_.IsValid()); |
54 DCHECK(service_path_.IsValid()); | 54 DCHECK(service_path_.IsValid()); |
55 DCHECK(StartsWithASCII( | 55 DCHECK(base::StartsWithASCII(object_path_.value(), |
56 object_path_.value(), service_path_.value() + "/", true)); | 56 service_path_.value() + "/", true)); |
57 | 57 |
58 exported_object_ = bus_->GetExportedObject(object_path_); | 58 exported_object_ = bus_->GetExportedObject(object_path_); |
59 | 59 |
60 exported_object_->ExportMethod( | 60 exported_object_->ExportMethod( |
61 dbus::kDBusPropertiesInterface, | 61 dbus::kDBusPropertiesInterface, |
62 dbus::kDBusPropertiesGet, | 62 dbus::kDBusPropertiesGet, |
63 base::Bind(&BluetoothGattCharacteristicServiceProviderImpl::Get, | 63 base::Bind(&BluetoothGattCharacteristicServiceProviderImpl::Get, |
64 weak_ptr_factory_.GetWeakPtr()), | 64 weak_ptr_factory_.GetWeakPtr()), |
65 base::Bind(&BluetoothGattCharacteristicServiceProviderImpl::OnExported, | 65 base::Bind(&BluetoothGattCharacteristicServiceProviderImpl::OnExported, |
66 weak_ptr_factory_.GetWeakPtr())); | 66 weak_ptr_factory_.GetWeakPtr())); |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 const dbus::ObjectPath& service_path) { | 466 const dbus::ObjectPath& service_path) { |
467 if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) { | 467 if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) { |
468 return new BluetoothGattCharacteristicServiceProviderImpl( | 468 return new BluetoothGattCharacteristicServiceProviderImpl( |
469 bus, object_path, delegate, uuid, flags, permissions, service_path); | 469 bus, object_path, delegate, uuid, flags, permissions, service_path); |
470 } | 470 } |
471 return new FakeBluetoothGattCharacteristicServiceProvider( | 471 return new FakeBluetoothGattCharacteristicServiceProvider( |
472 object_path, delegate, uuid, flags, permissions, service_path); | 472 object_path, delegate, uuid, flags, permissions, service_path); |
473 } | 473 } |
474 | 474 |
475 } // namespace chromeos | 475 } // namespace chromeos |
OLD | NEW |