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

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

Issue 288903003: [Bluetooth] Standardize Bluetooth device address format to XX:XX:XX:XX:XX:XX. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ChromeOS tests too Created 6 years, 7 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 | Annotate | Revision Log
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/IOBluetoothDeviceInquiry.h> 8 #import <IOBluetooth/objc/IOBluetoothDeviceInquiry.h>
9 #import <IOBluetooth/objc/IOBluetoothHostController.h> 9 #import <IOBluetooth/objc/IOBluetoothHostController.h>
10 10
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 void BluetoothAdapterMac::PollAdapter() { 242 void BluetoothAdapterMac::PollAdapter() {
243 bool was_present = IsPresent(); 243 bool was_present = IsPresent();
244 std::string name; 244 std::string name;
245 std::string address; 245 std::string address;
246 bool powered = false; 246 bool powered = false;
247 IOBluetoothHostController* controller = 247 IOBluetoothHostController* controller =
248 [IOBluetoothHostController defaultController]; 248 [IOBluetoothHostController defaultController];
249 249
250 if (controller != nil) { 250 if (controller != nil) {
251 name = base::SysNSStringToUTF8([controller nameAsString]); 251 name = base::SysNSStringToUTF8([controller nameAsString]);
252 address = BluetoothDeviceMac::NormalizeAddress( 252 address = BluetoothDevice::CanonicalizeAddress(
253 base::SysNSStringToUTF8([controller addressAsString])); 253 base::SysNSStringToUTF8([controller addressAsString]));
254 powered = ([controller powerState] == kBluetoothHCIPowerStateON); 254 powered = ([controller powerState] == kBluetoothHCIPowerStateON);
255 } 255 }
256 256
257 bool is_present = !address.empty(); 257 bool is_present = !address.empty();
258 name_ = name; 258 name_ = name;
259 address_ = address; 259 address_ = address;
260 260
261 if (was_present != is_present) { 261 if (was_present != is_present) {
262 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, 262 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 iter != callback_list.end(); 379 iter != callback_list.end();
380 ++iter) { 380 ++iter) {
381 if (success) 381 if (success)
382 ui_task_runner_->PostTask(FROM_HERE, iter->first); 382 ui_task_runner_->PostTask(FROM_HERE, iter->first);
383 else 383 else
384 ui_task_runner_->PostTask(FROM_HERE, iter->second); 384 ui_task_runner_->PostTask(FROM_HERE, iter->second);
385 } 385 }
386 } 386 }
387 387
388 } // namespace device 388 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_adapter_chromeos.cc ('k') | device/bluetooth/bluetooth_adapter_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698