d25af2f0b05b4db17f63649c94ff5504b050bbc9
[platform/core/connectivity/bluetooth-agent.git] / include / bluetooth-agent-profile.h
1 /*
2  * Bluetooth-agent-common
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact:     Hocheol Seo <hocheol.seo@samsung.com>
7  *              Girishashok Joshi <girish.joshi@samsung.com>
8  *              Chanyeol Park <chanyeol.park@samsung.com>
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  *              http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  */
23
24 #ifndef __DEF_BT_AGENT_PROFILE_H_
25 #define __DEF_BT_AGENT_PROFILE_H_
26
27 #include <sys/types.h>
28 #include <libintl.h>
29 #include <stdlib.h>
30 #include <system_info.h>
31
32 typedef enum {
33         _PROFILE_UNKNOWN = 0,
34         _PROFILE_MOBILE = 0x1,
35         _PROFILE_WEARABLE = 0x2,
36         _PROFILE_TV = 0x4,
37         _PROFILE_IVI = 0x8,
38         _PROFILE_COMMON = 0x10,
39 } tizen_profile_t;
40
41 /* For optimization, make this extern and define in a shared C file */
42 extern tizen_profile_t profile;
43
44 /* Accessing system info */
45 int system_info_get_platform_string(const char *key, char **value);
46
47 static inline tizen_profile_t get_tizen_profile()
48 {
49         char *profileName = NULL;
50
51         if (__builtin_expect(profile != _PROFILE_UNKNOWN, 1))
52                 return profile;
53
54         system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
55
56         /* To pass the checking of g_ir */
57         if (!profileName)
58                 return _PROFILE_UNKNOWN;
59
60         switch (*profileName) {
61         case 'm':
62         case 'M':
63                 profile = _PROFILE_MOBILE;
64                 break;
65         case 'w':
66         case 'W':
67                 profile = _PROFILE_WEARABLE;
68                 break;
69         case 't':
70         case 'T':
71                 profile = _PROFILE_TV;
72                 break;
73         case 'i':
74         case 'I':
75                 profile = _PROFILE_IVI;
76                 break;
77         default: // common or unknown ==> ALL ARE COMMON.
78                 profile = _PROFILE_COMMON;
79         }
80         free(profileName);
81
82         return profile;
83 }
84
85 #define TIZEN_PROFILE_WEARABLE (get_tizen_profile() == _PROFILE_WEARABLE)
86 #define TIZEN_PROFILE_IVI (get_tizen_profile() == _PROFILE_IVI)
87 #define TIZEN_PROFILE_TV (get_tizen_profile() == _PROFILE_TV)
88 #define TIZEN_PROFILE_MOBILE (get_tizen_profile() == _PROFILE_MOBILE)
89
90 #endif /* __DEF_BT_AGENT_PROFILE_H_ */