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

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

Issue 2248033006: bluetooth: Return false for IsPresent only when bluetooth is not supported (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test Created 4 years, 3 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
« no previous file with comments | « no previous file | device/bluetooth/bluetooth_adapter_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_adapter_mac.h" 5 #include "device/bluetooth/bluetooth_adapter_mac.h"
6 6
7 #import <IOBluetooth/objc/IOBluetoothDevice.h> 7 #import <IOBluetooth/objc/IOBluetoothDevice.h>
8 #import <IOBluetooth/objc/IOBluetoothHostController.h> 8 #import <IOBluetooth/objc/IOBluetoothHostController.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 NOTIMPLEMENTED(); 121 NOTIMPLEMENTED();
122 } 122 }
123 123
124 bool BluetoothAdapterMac::IsInitialized() const { 124 bool BluetoothAdapterMac::IsInitialized() const {
125 return true; 125 return true;
126 } 126 }
127 127
128 bool BluetoothAdapterMac::IsPresent() const { 128 bool BluetoothAdapterMac::IsPresent() const {
129 bool is_present = !address_.empty(); 129 bool is_present = !address_.empty();
130 if (IsLowEnergyAvailable()) { 130 if (IsLowEnergyAvailable()) {
131 is_present = is_present || ([low_energy_central_manager_ state] == 131 is_present = is_present || ([low_energy_central_manager_ state] !=
132 CBCentralManagerStatePoweredOn); 132 CBCentralManagerStateUnsupported);
133 } 133 }
134 return is_present; 134 return is_present;
135 } 135 }
136 136
137 bool BluetoothAdapterMac::IsPowered() const { 137 bool BluetoothAdapterMac::IsPowered() const {
138 bool is_powered = classic_powered_; 138 bool is_powered = classic_powered_;
139 if (IsLowEnergyAvailable()) { 139 if (IsLowEnergyAvailable()) {
140 is_powered = is_powered || ([low_energy_central_manager_ state] == 140 is_powered = is_powered || ([low_energy_central_manager_ state] ==
141 CBCentralManagerStatePoweredOn); 141 CBCentralManagerStatePoweredOn);
142 } 142 }
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 std::string device_address = 591 std::string device_address =
592 BluetoothLowEnergyDeviceMac::GetPeripheralHashAddress(peripheral); 592 BluetoothLowEnergyDeviceMac::GetPeripheralHashAddress(peripheral);
593 DevicesMap::const_iterator iter = devices_.find(device_address); 593 DevicesMap::const_iterator iter = devices_.find(device_address);
594 if (iter == devices_.end()) { 594 if (iter == devices_.end()) {
595 return nil; 595 return nil;
596 } 596 }
597 return static_cast<BluetoothLowEnergyDeviceMac*>(iter->second); 597 return static_cast<BluetoothLowEnergyDeviceMac*>(iter->second);
598 } 598 }
599 599
600 } // namespace device 600 } // namespace device
OLDNEW
« no previous file with comments | « no previous file | device/bluetooth/bluetooth_adapter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698