1 /*
2  * Copyright (C) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * @addtogroup Bluetooth
18  * @{
19  *
20  * @brief Defines data structure functions.
21  *
22  */
23 
24 /**
25  * @file classic_data_structure.h
26  *
27  * @brief Data structure.
28  *
29  */
30 
31 #ifndef CLASSIC_DATA_STRUCTURE_H
32 #define CLASSIC_DATA_STRUCTURE_H
33 
34 #include <stdint.h>
35 #include <vector>
36 
37 namespace OHOS {
38 namespace bluetooth {
39 /**
40  * @brief Represents data structure.
41  *
42  */
43 class ClassicDataStructure {
44 public:
45     /**
46      * @brief A constructor used to create a <b>ClassicDataStructure</b> instance.
47      *
48      */
49     ClassicDataStructure();
50 
51     /**
52      * @brief A constructor used to create a <b>ClassicDataStructure</b> instance.
53      *
54      * @param dataLength Data length.
55      * @param type Data type.
56      * @param value Data value.
57      */
58     ClassicDataStructure(uint8_t dataLength, int type, const std::vector<uint8_t> &value);
59 
60     /**
61      * @brief A destructor used to delete the <b>ClassicDataStructure</b> instance.
62      *
63      */
64     ~ClassicDataStructure();
65 
66     /**
67      * @brief Get data length.
68      *
69      * @return Returns data length.
70      */
71     uint8_t GetLength() const;
72 
73     /**
74      * @brief Get data value.
75      *
76      * @return Returns data value.
77      */
78     std::vector<uint8_t> GetDataValue() const;
79 
80     /**
81      * @brief Get data tyoe.
82      *
83      * @return Returns data type.
84      */
85     int GetType() const;
86 
87 private:
88     uint8_t length_ {};
89     int type_ {};
90     std::vector<uint8_t> data_ {};
91 };
92 }  // namespace bluetooth
93 }  // namespace OHOS
94 #endif  /// CLASSIC_DATA_STRUCTURE_H