Beta merge 2
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Bluetooth / BluetoothClass.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License. 
15  */
16
17  
18 #ifndef TIZENAPIS_TIZEN_BLUETOOTH_CLASS_H_
19 #define TIZENAPIS_TIZEN_BLUETOOTH_CLASS_H_
20
21 #include <dpl/shared_ptr.h>
22 #include <map>
23 #include <string>
24 #include <vector>
25
26 namespace TizenApis {
27 namespace Tizen1_0 {
28
29 class BluetoothClass;
30 typedef DPL::SharedPtr<BluetoothClass> BluetoothClassPtr;
31
32 #define MAJOR_SHIFT 7
33 #define MINOR_SHIFT 1
34 #define SERVICE_SHIFT 12
35
36 #define MAJOR_MASK_SHIFT(A) ((A & 0x00000F80) >> MAJOR_SHIFT)
37 #define MINOR_MASK_SHIFT(A) ((A & 0x0000007E) >> MINOR_SHIFT)
38 #define SERVICE_MASK_SHIFT(A) ((A & 0x007FF000) >> SERVICE_SHIFT)
39
40
41 class BluetoothClass
42 {
43 public: 
44         bool find(const std::string key, int &value);
45         int getMajor();
46         int getMinor();
47         std::vector<int> getServices();
48         void setServices(int device);
49         void setMajor(int major);
50         void setMinor(int minor);
51         void fromInt(unsigned long value);
52         void setReadOnly();
53         bool getReadOnly();
54         unsigned long toInt();
55         BluetoothClass();
56         ~BluetoothClass();
57 private:        
58         void initConstants();
59         static std::map<std::string,int> m_serviceConstants;
60         std::vector<int> m_services;
61         bool m_readOnly;
62         int m_major;
63         int m_minor;
64 };
65 }
66 }
67 #endif