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

Unified Diff: device/bluetooth/bluetooth_low_energy_device_mac.mm

Issue 1246913006: Bringing 4 more BluetoothTest.* unit tests to Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scheibtest
Patch Set: Created 5 years, 5 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/bluetooth_low_energy_device_mac.mm
diff --git a/device/bluetooth/bluetooth_low_energy_device_mac.mm b/device/bluetooth/bluetooth_low_energy_device_mac.mm
index 4e4ca6431bebfecc47f1db275726866868109c78..a3c1b99208ed52ecc02582d518450cae57f4766d 100644
--- a/device/bluetooth/bluetooth_low_energy_device_mac.mm
+++ b/device/bluetooth/bluetooth_low_energy_device_mac.mm
@@ -31,33 +31,40 @@ device::BluetoothUUID BluetoothUUIDWithCBUUID(CBUUID* uuid) {
BluetoothLowEnergyDeviceMac::BluetoothLowEnergyDeviceMac(
CBPeripheral* peripheral,
- NSDictionary* advertisementData,
+ NSDictionary* advertisement_data,
int rssi) {
DCHECK(BluetoothAdapterMac::IsLowEnergyAvailable());
identifier_ = GetPeripheralIdentifier(peripheral);
hash_address_ = GetPeripheralHashAddress(peripheral);
- Update(peripheral, advertisementData, rssi);
+ Update(peripheral, advertisement_data, rssi);
}
BluetoothLowEnergyDeviceMac::~BluetoothLowEnergyDeviceMac() {
}
void BluetoothLowEnergyDeviceMac::Update(CBPeripheral* peripheral,
- NSDictionary* advertisementData,
+ NSDictionary* advertisement_data,
int rssi) {
last_update_time_.reset([[NSDate date] retain]);
peripheral_.reset([peripheral retain]);
rssi_ = rssi;
ClearServiceData();
- NSNumber* nbConnectable =
- [advertisementData objectForKey:CBAdvertisementDataIsConnectable];
- connectable_ = [nbConnectable boolValue];
- NSDictionary* serviceData =
- [advertisementData objectForKey:CBAdvertisementDataServiceDataKey];
- for (CBUUID* uuid in serviceData) {
- NSData* data = [serviceData objectForKey:uuid];
- BluetoothUUID serviceUUID = BluetoothUUIDWithCBUUID(uuid);
- SetServiceData(serviceUUID, (const char*)[data bytes], [data length]);
+ NSNumber* connectable =
+ [advertisement_data objectForKey:CBAdvertisementDataIsConnectable];
+ connectable_ = [connectable boolValue];
+ NSDictionary* service_data =
+ [advertisement_data objectForKey:CBAdvertisementDataServiceDataKey];
+ for (CBUUID* uuid in service_data) {
scheib 2015/07/23 18:15:25 ClearServiceData(); before setting values, so that
krstnmnlsn 2015/07/23 22:03:29 The call was further above. Moved it down for cla
scheib 2015/07/23 22:15:39 Oh! great. Hmm, yeah, line breaks for sections wou
+ NSData* data = [service_data objectForKey:uuid];
+ BluetoothUUID service_UUID = BluetoothUUIDWithCBUUID(uuid);
+ SetServiceData(service_UUID, (const char*)[data bytes], [data length]);
+ }
+ uuids_.clear();
+ NSArray* service_uuids =
+ [advertisement_data objectForKey:@"CBAdvertisementDataServiceUUIDsKey"];
+ for (CBUUID* uuid in service_uuids) {
+ uuids_.push_back(
+ BluetoothUUID(std::string([[uuid UUIDString] UTF8String])));
}
}
@@ -111,7 +118,7 @@ bool BluetoothLowEnergyDeviceMac::IsConnecting() const {
}
BluetoothDevice::UUIDList BluetoothLowEnergyDeviceMac::GetUUIDs() const {
- return std::vector<device::BluetoothUUID>();
+ return uuids_;
}
int16 BluetoothLowEnergyDeviceMac::GetInquiryRSSI() const {

Powered by Google App Engine
This is Rietveld 408576698