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 #ifndef CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_UTILS_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_UTILS_H_ |
6 #define CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_UTILS_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_UTILS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include <bluetooth/bluetooth.h> | 10 #include <bluetooth/bluetooth.h> |
11 | 11 |
12 namespace chromeos { | 12 namespace device_bluetooth { |
13 namespace bluetooth_utils { | 13 namespace bluetooth_utils { |
keybuk
2012/10/08 17:21:59
ugh,
namespace bluetooth {
namespace utils {
wou
youngki
2012/10/09 14:37:54
Done.
| |
14 | 14 |
15 // Converts a bluetooth address in the format "B0:D0:9C:0F:3A:2D" into a | 15 // Converts a bluetooth address in the format "B0:D0:9C:0F:3A:2D" into a |
16 // bdaddr_t struct. Returns true on success, false on failure. The contents | 16 // bdaddr_t struct. Returns true on success, false on failure. The contents |
17 // of |out_address| are zeroed on failure. | 17 // of |out_address| are zeroed on failure. |
18 // Note that the order is reversed upon conversion. For example, | 18 // Note that the order is reversed upon conversion. For example, |
19 // "B0:D0:9C:0F:3A:2D" -> {"0x2d", "0x3a", "0x0f", "0x9c", "0xd0", "0xb0"} | 19 // "B0:D0:9C:0F:3A:2D" -> {"0x2d", "0x3a", "0x0f", "0x9c", "0xd0", "0xb0"} |
20 bool str2ba(const std::string& in_address, bdaddr_t* out_address); | 20 bool str2ba(const std::string& in_address, bdaddr_t* out_address); |
21 | 21 |
22 // Takes a 4, 8 or 36 character UUID, validates it and returns it in 36 | 22 // Takes a 4, 8 or 36 character UUID, validates it and returns it in 36 |
23 // character format with all hex digits lower case. If |uuid| is invalid, the | 23 // character format with all hex digits lower case. If |uuid| is invalid, the |
24 // empty string is returned. | 24 // empty string is returned. |
25 // | 25 // |
26 // Valid inputs are: | 26 // Valid inputs are: |
27 // XXXX | 27 // XXXX |
28 // 0xXXXX | 28 // 0xXXXX |
29 // XXXXXXXX | 29 // XXXXXXXX |
30 // 0xXXXXXXXX | 30 // 0xXXXXXXXX |
31 // XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX | 31 // XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX |
32 std::string CanonicalUuid(std::string uuid); | 32 std::string CanonicalUuid(std::string uuid); |
33 | 33 |
34 } // namespace bluetooth_utils | 34 } // namespace bluetooth_utils |
35 } // namespace chromeos | 35 } // namespace device_bluetooth |
36 | 36 |
37 #endif // CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_UTILS_H_ | 37 #endif // DEVICE_BLUETOOTH_BLUETOOTH_UTILS_H_ |
38 | 38 |
OLD | NEW |