• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 bluetooth {
38 /**
39  * @brief Represents data structure.
40  *
41  */
42 class ClassicDataStructure {
43 public:
44     /**
45      * @brief A constructor used to create a <b>ClassicDataStructure</b> instance.
46      *
47      */
48     ClassicDataStructure();
49 
50     /**
51      * @brief A constructor used to create a <b>ClassicDataStructure</b> instance.
52      *
53      * @param dataLength Data length.
54      * @param type Data type.
55      * @param value Data value.
56      */
57     ClassicDataStructure(uint8_t dataLength, int type, const std::vector<uint8_t> &value);
58 
59     /**
60      * @brief A destructor used to delete the <b>ClassicDataStructure</b> instance.
61      *
62      */
63     ~ClassicDataStructure();
64 
65     /**
66      * @brief Get data length.
67      *
68      * @return Returns data length.
69      */
70     uint8_t GetLength() const;
71 
72     /**
73      * @brief Get data value.
74      *
75      * @return Returns data value.
76      */
77     std::vector<uint8_t> GetDataValue() const;
78 
79     /**
80      * @brief Get data tyoe.
81      *
82      * @return Returns data type.
83      */
84     int GetType() const;
85 
86 private:
87     uint8_t length_ {};
88     int type_ {};
89     std::vector<uint8_t> data_ {};
90 };
91 }  // namespace bluetooth
92 #endif  /// CLASSIC_DATA_STRUCTURE_H