OLD | NEW |
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_socket_mac.h" | 5 #include "device/bluetooth/bluetooth_socket_mac.h" |
6 | 6 |
7 #import <IOBluetooth/IOBluetooth.h> | 7 #import <IOBluetooth/IOBluetooth.h> |
| 8 #include <stdint.h> |
8 | 9 |
9 #include <limits> | 10 #include <limits> |
10 #include <sstream> | 11 #include <sstream> |
11 #include <string> | 12 #include <string> |
12 | 13 |
13 #include "base/basictypes.h" | |
14 #include "base/bind.h" | 14 #include "base/bind.h" |
15 #include "base/callback.h" | 15 #include "base/callback.h" |
16 #include "base/callback_helpers.h" | 16 #include "base/callback_helpers.h" |
17 #include "base/mac/scoped_cftyperef.h" | 17 #include "base/mac/scoped_cftyperef.h" |
18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
19 #include "base/numerics/safe_conversions.h" | 19 #include "base/numerics/safe_conversions.h" |
20 #include "base/strings/string_number_conversions.h" | 20 #include "base/strings/string_number_conversions.h" |
21 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
22 #include "base/strings/sys_string_conversions.h" | 22 #include "base/strings/sys_string_conversions.h" |
23 #include "base/threading/thread_restrictions.h" | 23 #include "base/threading/thread_restrictions.h" |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 DCHECK_EQ(uuid_str.size(), 36U); | 246 DCHECK_EQ(uuid_str.size(), 36U); |
247 DCHECK_EQ(uuid_str[8], '-'); | 247 DCHECK_EQ(uuid_str[8], '-'); |
248 DCHECK_EQ(uuid_str[13], '-'); | 248 DCHECK_EQ(uuid_str[13], '-'); |
249 DCHECK_EQ(uuid_str[18], '-'); | 249 DCHECK_EQ(uuid_str[18], '-'); |
250 DCHECK_EQ(uuid_str[23], '-'); | 250 DCHECK_EQ(uuid_str[23], '-'); |
251 std::string numbers_only = uuid_str; | 251 std::string numbers_only = uuid_str; |
252 numbers_only.erase(23, 1); | 252 numbers_only.erase(23, 1); |
253 numbers_only.erase(18, 1); | 253 numbers_only.erase(18, 1); |
254 numbers_only.erase(13, 1); | 254 numbers_only.erase(13, 1); |
255 numbers_only.erase(8, 1); | 255 numbers_only.erase(8, 1); |
256 std::vector<uint8> uuid_bytes_vector; | 256 std::vector<uint8_t> uuid_bytes_vector; |
257 base::HexStringToBytes(numbers_only, &uuid_bytes_vector); | 257 base::HexStringToBytes(numbers_only, &uuid_bytes_vector); |
258 DCHECK_EQ(uuid_bytes_vector.size(), 16U); | 258 DCHECK_EQ(uuid_bytes_vector.size(), 16U); |
259 | 259 |
260 return [IOBluetoothSDPUUID uuidWithBytes:&uuid_bytes_vector.front() | 260 return [IOBluetoothSDPUUID uuidWithBytes:&uuid_bytes_vector.front() |
261 length:uuid_bytes_vector.size()]; | 261 length:uuid_bytes_vector.size()]; |
262 } | 262 } |
263 | 263 |
264 // Converts the given |integer| to a string. | 264 // Converts the given |integer| to a string. |
265 NSString* IntToNSString(int integer) { | 265 NSString* IntToNSString(int integer) { |
266 return [[NSNumber numberWithInt:integer] stringValue]; | 266 return [[NSNumber numberWithInt:integer] stringValue]; |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 rfcomm_connection_listener_.reset(); | 941 rfcomm_connection_listener_.reset(); |
942 l2cap_connection_listener_.reset(); | 942 l2cap_connection_listener_.reset(); |
943 | 943 |
944 // Destroying the listener above prevents the callback delegate from being | 944 // Destroying the listener above prevents the callback delegate from being |
945 // called so it is now safe to release all callback state. | 945 // called so it is now safe to release all callback state. |
946 accept_request_.reset(); | 946 accept_request_.reset(); |
947 empty_queue(accept_queue_); | 947 empty_queue(accept_queue_); |
948 } | 948 } |
949 | 949 |
950 } // namespace device | 950 } // namespace device |
OLD | NEW |