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 device class.
21  *
22  * @since 1.0
23  * @version 1.0
24  */
25 
26 /**
27  * @file bluetooth_device_class.h
28  *
29  * @brief Bluetooth device class.
30  *
31  * @since 1.0
32  * @version 1.0
33  */
34 
35 #ifndef BLUETOOTH_DEVICE_CLASS_H
36 #define BLUETOOTH_DEVICE_CLASS_H
37 
38 #include "bluetooth_def.h"
39 
40 namespace OHOS {
41 namespace Bluetooth {
42 /**
43  * @brief Represents device class.
44  *
45  * @since 1.0
46  * @version 1.0
47  */
48 class BLUETOOTH_API BluetoothDeviceClass {
49 public:
50     /**
51      * @brief A constructor used to create a <b>BluetoothDeviceClass</b> instance.
52      *
53      * @since 1.0
54      * @version 1.0
55      */
56     BluetoothDeviceClass();
57 
58     /**
59      * @brief A constructor used to create a <b>BluetoothDeviceClass</b> instance.
60      *
61      * @param deviceClass Device class to create an <b>BluetoothDeviceClass</b> instance.
62      * @since 1.0
63      * @version 1.0
64      */
65     explicit BluetoothDeviceClass(int deviceClass);
66 
67     /**
68      * @brief A destructor used to delete the <b>BluetoothDeviceClass</b> instance.
69      *
70      * @since 1.0
71      * @version 1.0
72      */
73     ~BluetoothDeviceClass();
74 
75     /**
76      * @brief Get major class.
77      *
78      * @return Returns device major class.
79      * @since 1.0
80      * @version 1.0
81      */
82     int GetMajorClass() const;
83 
84     /**
85      * @brief Get major minor class.
86      *
87      * @return Returns device major minor class.
88      * @since 1.0
89      * @version 1.0
90      */
91     int GetMajorMinorClass() const;
92 
93     /**
94      * @brief Get class of device.
95      *
96      * @return Returns the class of device.
97      * @since 1.0
98      * @version 1.0
99      */
100     int GetClassOfDevice() const;
101 
102     /**
103      * @brief Check if device supporte some profiles.
104      *
105      * @param profileId Profile Id.
106      * @return Returns <b>true</b> if device supported this profile;
107      *         returns <b>false</b> if device did not support this profile.
108      * @since 1.0
109      * @version 1.0
110      */
111     bool IsProfileSupported(int profileId) const;
112 
113     /**
114      * @brief Check if device supporte some services.
115      *
116      * @param profileId Profile Id.
117      * @return Returns <b>true</b> if device supported this service;
118      *         returns <b>false</b> if device did not support this service.
119      * @since 1.0
120      * @version 1.0
121      */
122     bool IsServiceSupported(int service) const;
123 
124 private:
125     bool IsA2dpSupported() const;
126     bool IsA2dpSinkSupported() const;
127     bool IsHeadSetSupported() const;
128     bool IsOppSupported() const;
129     int class_;
130 };
131 } // namespace Bluetooth
132 } // namespace OHOS
133 
134 #endif  // BLUETOOTH_DEVICE_CLASS_H
135