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

Side by Side Diff: device/bluetooth/bluetooth_low_energy_device_mac.mm

Issue 1842223003: Remove outdated devices from Android device chooser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverted two small unnecessary changes. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "device/bluetooth/bluetooth_low_energy_device_mac.h" 5 #include "device/bluetooth/bluetooth_low_energy_device_mac.h"
6 6
7 #import <CoreFoundation/CoreFoundation.h> 7 #import <CoreFoundation/CoreFoundation.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
(...skipping 28 matching lines...) Expand all
39 } 39 }
40 40
41 BluetoothLowEnergyDeviceMac::~BluetoothLowEnergyDeviceMac() { 41 BluetoothLowEnergyDeviceMac::~BluetoothLowEnergyDeviceMac() {
42 if (IsGattConnected()) { 42 if (IsGattConnected()) {
43 GetMacAdapter()->DisconnectGatt(this); 43 GetMacAdapter()->DisconnectGatt(this);
44 } 44 }
45 } 45 }
46 46
47 void BluetoothLowEnergyDeviceMac::Update(NSDictionary* advertisement_data, 47 void BluetoothLowEnergyDeviceMac::Update(NSDictionary* advertisement_data,
48 int rssi) { 48 int rssi) {
49 last_update_time_.reset([[NSDate date] retain]); 49 UpdateTimestamp();
50 rssi_ = rssi; 50 rssi_ = rssi;
51 NSNumber* connectable = 51 NSNumber* connectable =
52 [advertisement_data objectForKey:CBAdvertisementDataIsConnectable]; 52 [advertisement_data objectForKey:CBAdvertisementDataIsConnectable];
53 connectable_ = [connectable boolValue]; 53 connectable_ = [connectable boolValue];
54 ClearServiceData(); 54 ClearServiceData();
55 NSDictionary* service_data = 55 NSDictionary* service_data =
56 [advertisement_data objectForKey:CBAdvertisementDataServiceDataKey]; 56 [advertisement_data objectForKey:CBAdvertisementDataServiceDataKey];
57 for (CBUUID* uuid in service_data) { 57 for (CBUUID* uuid in service_data) {
58 NSData* data = [service_data objectForKey:uuid]; 58 NSData* data = [service_data objectForKey:uuid];
59 BluetoothUUID service_uuid = 59 BluetoothUUID service_uuid =
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 NOTIMPLEMENTED(); 211 NOTIMPLEMENTED();
212 } 212 }
213 213
214 void BluetoothLowEnergyDeviceMac::ConnectToServiceInsecurely( 214 void BluetoothLowEnergyDeviceMac::ConnectToServiceInsecurely(
215 const device::BluetoothUUID& uuid, 215 const device::BluetoothUUID& uuid,
216 const ConnectToServiceCallback& callback, 216 const ConnectToServiceCallback& callback,
217 const ConnectToServiceErrorCallback& error_callback) { 217 const ConnectToServiceErrorCallback& error_callback) {
218 NOTIMPLEMENTED(); 218 NOTIMPLEMENTED();
219 } 219 }
220 220
221 NSDate* BluetoothLowEnergyDeviceMac::GetLastUpdateTime() const {
222 return last_update_time_.get();
223 }
224
225 std::string BluetoothLowEnergyDeviceMac::GetDeviceName() const { 221 std::string BluetoothLowEnergyDeviceMac::GetDeviceName() const {
226 return base::SysNSStringToUTF8([peripheral_ name]); 222 return base::SysNSStringToUTF8([peripheral_ name]);
227 } 223 }
228 224
229 void BluetoothLowEnergyDeviceMac::CreateGattConnectionImpl() { 225 void BluetoothLowEnergyDeviceMac::CreateGattConnectionImpl() {
230 if (!IsGattConnected()) { 226 if (!IsGattConnected()) {
231 GetMacAdapter()->CreateGattConnection(this); 227 GetMacAdapter()->CreateGattConnection(this);
232 } 228 }
233 } 229 }
234 230
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 GattServiceMap gatt_services_swapped; 358 GattServiceMap gatt_services_swapped;
363 gatt_services_swapped.swap(gatt_services_); 359 gatt_services_swapped.swap(gatt_services_);
364 gatt_services_swapped.clear(); 360 gatt_services_swapped.clear();
365 if (create_gatt_connection_error_callbacks_.empty()) { 361 if (create_gatt_connection_error_callbacks_.empty()) {
366 // TODO(http://crbug.com/585897): Need to pass the error. 362 // TODO(http://crbug.com/585897): Need to pass the error.
367 DidDisconnectGatt(); 363 DidDisconnectGatt();
368 } else { 364 } else {
369 DidFailToConnectGatt(error_code); 365 DidFailToConnectGatt(error_code);
370 } 366 }
371 } 367 }
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_low_energy_device_mac.h ('k') | device/bluetooth/test/bluetooth_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698