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

Unified Diff: device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.cc

Issue 1920693002: Complete //device/bt implementation for hosting local GATT attributes. (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 side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.cc
diff --git a/device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.cc b/device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.cc
index 267b04713e9daabd73653ff0815f1d5dc30f8cdf..0758cfbc0a38c125d80d15b1a55e412eb525128e 100644
--- a/device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.cc
+++ b/device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.cc
@@ -4,11 +4,8 @@
#include "device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.h"
-#include "base/callback.h"
-#include "base/guid.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
-#include "base/strings/string_util.h"
#include "dbus/object_path.h"
#include "device/bluetooth/bluez/bluetooth_adapter_bluez.h"
@@ -24,12 +21,7 @@ BluetoothLocalGattServiceBlueZ::BluetoothLocalGattServiceBlueZ(
is_primary_(is_primary),
delegate_(delegate),
weak_ptr_factory_(this) {
- // TODO(rkc): Move this code in a common location. It is used by
- // BluetoothAdvertisementBlueZ() also.
- std::string GuidString = base::GenerateGUID();
- base::RemoveChars(GuidString, "-", &GuidString);
- object_path_ = dbus::ObjectPath(adapter_->object_path().value() +
- "/service/" + GuidString);
+ object_path_ = GenerateAttributeObjectPath("service");
VLOG(1) << "Creating local GATT service with identifier: "
<< object_path_.value();
}
@@ -63,23 +55,24 @@ BluetoothLocalGattServiceBlueZ::Create(
void BluetoothLocalGattServiceBlueZ::Register(
const base::Closure& callback,
const ErrorCallback& error_callback) {
- // TODO(rkc): Call adapter_->RegisterGattService.
+ GetAdapter()->RegisterGattService(this, callback, error_callback);
}
void BluetoothLocalGattServiceBlueZ::Unregister(
const base::Closure& callback,
const ErrorCallback& error_callback) {
- // TODO(rkc): Call adapter_->UnregisterGattService.
+ DCHECK(GetAdapter());
+ GetAdapter()->UnregisterGattService(this, callback, error_callback);
}
-void BluetoothLocalGattServiceBlueZ::OnRegistrationError(
- const ErrorCallback& error_callback,
- const std::string& error_name,
- const std::string& error_message) {
- VLOG(1) << "[Un]Register Service failed: " << error_name
- << ", message: " << error_message;
- error_callback.Run(
- BluetoothGattServiceBlueZ::DBusErrorToServiceError(error_name));
+const std::vector<std::unique_ptr<BluetoothLocalGattCharacteristicBlueZ>>&
+BluetoothLocalGattServiceBlueZ::GetCharacteristics() const {
+ return characteristics_;
+}
+
+void BluetoothLocalGattServiceBlueZ::AddCharacteristic(
+ std::unique_ptr<BluetoothLocalGattCharacteristicBlueZ> characteristic) {
+ characteristics_.push_back(std::move(characteristic));
}
} // namespace bluez

Powered by Google App Engine
This is Rietveld 408576698