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

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
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..7f32881689ae5839d7b6fca806708b1456c8dd01 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,20 @@ 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());
+ const NotificationType& value = characteristic_provider->sent_value();
+
+ std::string device_id;
+ bluez::BluetoothDeviceBlueZ* device =
+ adapter_bluez->GetDeviceWithPath(dbus::ObjectPath(std::get<0>(value)));
+ if (device)
+ device_id = device->GetIdentifier();
+
+ return make_tuple(device_id, std::get<1>(value), std::get<2>(value));
}
std::vector<BluetoothLocalGattService*>
« device/bluetooth/test/bluetooth_test.h ('K') | « 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