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

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

Issue 1973703002: Implement //device/bt changes for notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@notifications_dbus
Patch Set: Created 4 years, 7 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_characteristic_bluez.cc
diff --git a/device/bluetooth/bluez/bluetooth_local_gatt_characteristic_bluez.cc b/device/bluetooth/bluez/bluetooth_local_gatt_characteristic_bluez.cc
index c43f5c7e899c84cb06315ec65375a1df2027d769..343df50e2bb3a09d619df6893458babba6dd5486 100644
--- a/device/bluetooth/bluez/bluetooth_local_gatt_characteristic_bluez.cc
+++ b/device/bluetooth/bluez/bluetooth_local_gatt_characteristic_bluez.cc
@@ -8,6 +8,10 @@
#include "base/logging.h"
#include "base/memory/ptr_util.h"
+#include "dbus/object_path.h"
+#include "device/bluetooth/bluetooth_gatt_characteristic.h"
+#include "device/bluetooth/bluez/bluetooth_adapter_bluez.h"
+#include "device/bluetooth/bluez/bluetooth_gatt_service_bluez.h"
#include "device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.h"
namespace device {
@@ -67,6 +71,20 @@ BluetoothLocalGattCharacteristicBlueZ::GetPermissions() const {
return Permissions();
}
+device::BluetoothLocalGattCharacteristic::NotificationStatus
+BluetoothLocalGattCharacteristicBlueZ::NotifyValueChanged(
+ const std::vector<uint8_t>& new_value,
+ bool indicate) {
+ if (indicate && !(properties_ & PROPERTY_INDICATE))
+ return INDICATE_PROPERTY_NOT_SET;
+ if (!indicate && !(properties_ & PROPERTY_NOTIFY))
+ return NOTIFY_PROPERTY_NOT_SET;
+ DCHECK(service_);
+ return service_->GetAdapter()->SendValueChanged(this, new_value)
+ ? NOTIFICATION_SUCCESS
+ : SERVICE_NOT_REGISTERED;
+}
+
BluetoothLocalGattServiceBlueZ*
BluetoothLocalGattCharacteristicBlueZ::GetService() {
return service_;

Powered by Google App Engine
This is Rietveld 408576698