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

Side by Side Diff: device/bluetooth/bluetooth_device_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
« no previous file with comments | « device/bluetooth/bluetooth_device_mac.h ('k') | device/bluetooth/bluetooth_device_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_device_mac.h" 5 #include "device/bluetooth/bluetooth_device_mac.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/hash.h" 10 #include "base/hash.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 inType:power_level_type 245 inType:power_level_type
246 outTransmitPowerLevel:&power_level]; 246 outTransmitPowerLevel:&power_level];
247 if (result != kIOReturnSuccess) 247 if (result != kIOReturnSuccess)
248 return kUnknownPower; 248 return kUnknownPower;
249 249
250 return power_level; 250 return power_level;
251 } 251 }
252 252
253 // static 253 // static
254 std::string BluetoothDeviceMac::GetDeviceAddress(IOBluetoothDevice* device) { 254 std::string BluetoothDeviceMac::GetDeviceAddress(IOBluetoothDevice* device) {
255 return NormalizeAddress(base::SysNSStringToUTF8([device addressString])); 255 return CanonicalizeAddress(base::SysNSStringToUTF8([device addressString]));
256 }
257
258 // static
259 std::string BluetoothDeviceMac::NormalizeAddress(const std::string& address) {
260 std::string normalized;
261 base::ReplaceChars(address, "-", ":", &normalized);
262 // TODO(isherman): Restore StringToUpperASCII(&normalized) call for M37.
263 // http://crbug.com/371014
264 return normalized;
265 } 256 }
266 257
267 } // namespace device 258 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_device_mac.h ('k') | device/bluetooth/bluetooth_device_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698