OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/bluetooth/bluetooth_utils.h" | 5 #include "device/bluetooth/bluetooth_utils.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include <bluetooth/bluetooth.h> | 9 #include <bluetooth/bluetooth.h> |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 static const char* kCommonUuidPostfix = "-0000-1000-8000-00805f9b34fb"; | 16 static const char* kCommonUuidPostfix = "-0000-1000-8000-00805f9b34fb"; |
17 static const char* kCommonUuidPrefix = "0000"; | 17 static const char* kCommonUuidPrefix = "0000"; |
18 static const int kUuidSize = 36; | 18 static const int kUuidSize = 36; |
19 } // namespace | 19 } // namespace |
20 | 20 |
21 namespace chromeos { | 21 namespace device_bluetooth { |
22 namespace bluetooth_utils { | 22 namespace bluetooth_utils { |
23 | 23 |
24 bool str2ba(const std::string& in_address, bdaddr_t* out_address) { | 24 bool str2ba(const std::string& in_address, bdaddr_t* out_address) { |
25 if (!out_address) | 25 if (!out_address) |
26 return false; | 26 return false; |
27 | 27 |
28 memset(out_address, 0, sizeof(*out_address)); | 28 memset(out_address, 0, sizeof(*out_address)); |
29 | 29 |
30 if (in_address.size() != 17) | 30 if (in_address.size() != 17) |
31 return false; | 31 return false; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 } else { | 78 } else { |
79 if (!IsHexDigit(uuid[i])) | 79 if (!IsHexDigit(uuid[i])) |
80 return ""; | 80 return ""; |
81 uuid_result[i] = tolower(uuid[i]); | 81 uuid_result[i] = tolower(uuid[i]); |
82 } | 82 } |
83 } | 83 } |
84 return uuid_result; | 84 return uuid_result; |
85 } | 85 } |
86 | 86 |
87 } // namespace bluetooth_utils | 87 } // namespace bluetooth_utils |
88 } // namespace chromeos | 88 } // namespace device_bluetooth |
OLD | NEW |