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

Unified Diff: device/bluetooth/test/bluetooth_test_bluez.cc

Issue 2039773005: Add support in Chrome to send notifications to a specific device. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « device/bluetooth/test/bluetooth_test_bluez.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/test/bluetooth_test_bluez.cc
diff --git a/device/bluetooth/test/bluetooth_test_bluez.cc b/device/bluetooth/test/bluetooth_test_bluez.cc
index f1188ed64b99d7093cc892d977671510eaadb123..537da559c8f3ecb21b4e11c07eb4d697db2bb569 100644
--- a/device/bluetooth/test/bluetooth_test_bluez.cc
+++ b/device/bluetooth/test/bluetooth_test_bluez.cc
@@ -5,6 +5,7 @@
#include "device/bluetooth/test/bluetooth_test_bluez.h"
#include <string>
+#include <tuple>
#include <utility>
#include "base/bind.h"
@@ -278,7 +279,8 @@ bool BluetoothTestBlueZ::SimulateLocalGattCharacteristicNotificationsRequest(
return characteristic_provider->NotificationsChange(start);
}
-std::vector<uint8_t> BluetoothTestBlueZ::LastNotifactionValueForCharacteristic(
+BluetoothTestBase::NotificationType
+BluetoothTestBlueZ::LastNotifactionValueForCharacteristic(
BluetoothLocalGattCharacteristic* characteristic) {
bluez::BluetoothLocalGattCharacteristicBlueZ* characteristic_bluez =
static_cast<bluez::BluetoothLocalGattCharacteristicBlueZ*>(
@@ -291,8 +293,22 @@ std::vector<uint8_t> BluetoothTestBlueZ::LastNotifactionValueForCharacteristic(
fake_bluetooth_gatt_manager_client->GetCharacteristicServiceProvider(
characteristic_bluez->object_path());
- return characteristic_provider ? characteristic_provider->sent_value()
- : std::vector<uint8_t>();
+ if (!characteristic_provider)
+ return NotificationType();
+
+ bluez::BluetoothAdapterBlueZ* adapter_bluez =
+ static_cast<bluez::BluetoothAdapterBlueZ*>(adapter_.get());
+
+ std::string device_id;
+ bluez::BluetoothDeviceBlueZ* device = adapter_bluez->GetDeviceWithPath(
+ characteristic_provider->last_device_path());
+ if (device)
+ device_id = device->GetIdentifier();
+
+ NotificationType notification = {
+ device_id, characteristic_provider->last_value(),
+ characteristic_provider->last_indicate_flag()};
+ return notification;
}
std::vector<BluetoothLocalGattService*>
« no previous file with comments | « device/bluetooth/test/bluetooth_test_bluez.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698