OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 DEVICE_BLUETOOTH_BLUETOOTH_UUID_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_UUID_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_UUID_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_UUID_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "device/bluetooth/bluetooth_export.h" | |
11 | |
12 namespace device { | 10 namespace device { |
13 | 11 |
14 // Opaque wrapper around a Bluetooth UUID. Instances of UUID represent the | 12 // Opaque wrapper around a Bluetooth UUID. Instances of UUID represent the |
15 // 128-bit universally unique identifiers (UUIDs) of profiles and attributes | 13 // 128-bit universally unique identifiers (UUIDs) of profiles and attributes |
16 // used in Bluetooth based communication, such as a peripheral's services, | 14 // used in Bluetooth based communication, such as a peripheral's services, |
17 // characteristics, and characteristic descriptors. An instance are | 15 // characteristics, and characteristic descriptors. An instance are |
18 // constructed using a string representing 16, 32, or 128 bit UUID formats. | 16 // constructed using a string representing 16, 32, or 128 bit UUID formats. |
19 class DEVICE_BLUETOOTH_EXPORT BluetoothUUID { | 17 class BluetoothUUID { |
20 public: | 18 public: |
21 // Possible representation formats used during construction. | 19 // Possible representation formats used during construction. |
22 enum Format { | 20 enum Format { |
23 kFormatInvalid, | 21 kFormatInvalid, |
24 kFormat16Bit, | 22 kFormat16Bit, |
25 kFormat32Bit, | 23 kFormat32Bit, |
26 kFormat128Bit | 24 kFormat128Bit |
27 }; | 25 }; |
28 | 26 |
29 // Single argument constructor. |uuid| can be a 16, 32, or 128 bit UUID | 27 // Single argument constructor. |uuid| can be a 16, 32, or 128 bit UUID |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // - 32 bit: xxxxxxxx | 83 // - 32 bit: xxxxxxxx |
86 // - 128 bit: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | 84 // - 128 bit: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
87 Format format_; | 85 Format format_; |
88 std::string value_; | 86 std::string value_; |
89 | 87 |
90 // The 128-bit string representation of the UUID. | 88 // The 128-bit string representation of the UUID. |
91 std::string canonical_value_; | 89 std::string canonical_value_; |
92 }; | 90 }; |
93 | 91 |
94 // This is required by gtest to print a readable output on test failures. | 92 // This is required by gtest to print a readable output on test failures. |
95 void DEVICE_BLUETOOTH_EXPORT | 93 void PrintTo(const BluetoothUUID& uuid, std::ostream* out); |
96 PrintTo(const BluetoothUUID& uuid, std::ostream* out); | |
97 | 94 |
98 } // namespace device | 95 } // namespace device |
99 | 96 |
100 #endif // DEVICE_BLUETOOTH_BLUETOOTH_UUID_H_ | 97 #endif // DEVICE_BLUETOOTH_BLUETOOTH_UUID_H_ |
OLD | NEW |