OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_BLUEZ_BLUETOOTH_SERVICE_ATTRIBUTE_VALUE_BLUEZ_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_SERVICE_ATTRIBUTE_VALUE_BLUEZ_H_ |
6 #define DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_SERVICE_ATTRIBUTE_VALUE_BLUEZ_H_ | 6 #define DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_SERVICE_ATTRIBUTE_VALUE_BLUEZ_H_ |
7 | 7 |
8 #include <cstddef> | 8 #include <cstddef> |
9 #include <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
(...skipping 12 matching lines...) Expand all Loading... |
23 // For example, a UUID can have the sizes, 2, 4 or 16 bytes. | 23 // For example, a UUID can have the sizes, 2, 4 or 16 bytes. |
24 // value: This is the raw value of the attribute. For example, for a UUID, it | 24 // value: This is the raw value of the attribute. For example, for a UUID, it |
25 // will be the string representation of the UUID. For a sequence, it | 25 // will be the string representation of the UUID. For a sequence, it |
26 // will be an array of other attributes. | 26 // will be an array of other attributes. |
27 class DEVICE_BLUETOOTH_EXPORT BluetoothServiceAttributeValueBlueZ { | 27 class DEVICE_BLUETOOTH_EXPORT BluetoothServiceAttributeValueBlueZ { |
28 public: | 28 public: |
29 enum Type { NULLTYPE = 0, UINT, INT, UUID, STRING, BOOL, SEQUENCE, URL }; | 29 enum Type { NULLTYPE = 0, UINT, INT, UUID, STRING, BOOL, SEQUENCE, URL }; |
30 | 30 |
31 using Sequence = std::vector<BluetoothServiceAttributeValueBlueZ>; | 31 using Sequence = std::vector<BluetoothServiceAttributeValueBlueZ>; |
32 | 32 |
| 33 BluetoothServiceAttributeValueBlueZ(); |
33 BluetoothServiceAttributeValueBlueZ(Type type, | 34 BluetoothServiceAttributeValueBlueZ(Type type, |
34 size_t size, | 35 size_t size, |
35 std::unique_ptr<base::Value> value); | 36 std::unique_ptr<base::Value> value); |
36 BluetoothServiceAttributeValueBlueZ(std::unique_ptr<Sequence> sequence); | 37 explicit BluetoothServiceAttributeValueBlueZ( |
| 38 std::unique_ptr<Sequence> sequence); |
37 BluetoothServiceAttributeValueBlueZ( | 39 BluetoothServiceAttributeValueBlueZ( |
38 const BluetoothServiceAttributeValueBlueZ& attribute); | 40 const BluetoothServiceAttributeValueBlueZ& attribute); |
39 BluetoothServiceAttributeValueBlueZ operator=( | 41 BluetoothServiceAttributeValueBlueZ operator=( |
40 const BluetoothServiceAttributeValueBlueZ& attribute); | 42 const BluetoothServiceAttributeValueBlueZ& attribute); |
41 ~BluetoothServiceAttributeValueBlueZ(); | 43 ~BluetoothServiceAttributeValueBlueZ(); |
42 | 44 |
43 Type type() const { return type_; } | 45 Type type() const { return type_; } |
44 size_t size() const { return size_; } | 46 size_t size() const { return size_; } |
45 const Sequence& sequence() const { return *sequence_.get(); } | 47 const Sequence& sequence() const { return *sequence_.get(); } |
46 const base::Value& value() const { return *value_.get(); } | 48 const base::Value& value() const { return *value_.get(); } |
47 | 49 |
48 private: | 50 private: |
49 Type type_; | 51 Type type_; |
50 size_t size_; | 52 size_t size_; |
51 std::unique_ptr<base::Value> value_; | 53 std::unique_ptr<base::Value> value_; |
52 std::unique_ptr<Sequence> sequence_; | 54 std::unique_ptr<Sequence> sequence_; |
53 }; | 55 }; |
54 | 56 |
55 } // namespace bluez | 57 } // namespace bluez |
56 | 58 |
57 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_SERVICE_ATTRIBUTE_VALUE_BLUEZ_H_ | 59 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_SERVICE_ATTRIBUTE_VALUE_BLUEZ_H_ |
OLD | NEW |