2 * Bluetooth-agent-common
4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Hocheol Seo <hocheol.seo@samsung.com>
7 * Girishashok Joshi <girish.joshi@samsung.com>
8 * Chanyeol Park <chanyeol.park@samsung.com>
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
14 * http://www.apache.org/licenses/LICENSE-2.0
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.
24 #ifndef __DEF_BT_AGENT_PROFILE_H_
25 #define __DEF_BT_AGENT_PROFILE_H_
27 #include <sys/types.h>
31 #include <system_info.h>
36 _PROFILE_MOBILE = 0x1,
37 _PROFILE_WEARABLE = 0x2,
41 _PROFILE_COMMON = 0x20,
44 /* For optimization, make this extern and define in a shared C file */
45 extern tizen_profile_t profile;
47 /* Accessing system info */
48 int system_info_get_platform_string(const char *key, char **value);
50 static inline tizen_profile_t get_tizen_profile()
52 char *profileName = NULL;
54 if (__builtin_expect(profile != _PROFILE_UNKNOWN, 1))
57 system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
59 /* To pass the checking of g_ir */
61 return _PROFILE_UNKNOWN;
63 switch (*profileName) {
66 profile = _PROFILE_MOBILE;
70 profile = _PROFILE_WEARABLE;
74 profile = _PROFILE_TV;
78 if (!strncasecmp(profileName, "ivi", 3))
79 profile = _PROFILE_IVI;
80 else if (!strncasecmp(profileName, "iot", 3))
81 profile = _PROFILE_IOT;
83 profile = _PROFILE_COMMON;
85 default: // common or unknown ==> ALL ARE COMMON.
86 profile = _PROFILE_COMMON;
101 } tizen_model_name_t;
103 extern tizen_model_name_t model_name;
105 /* LCOV_EXCL_START */
106 static inline tizen_model_name_t get_tizen_model_name()
108 char *modelName = NULL;
110 if (__builtin_expect(model_name != _MODEL_UNKNOWN, 1))
113 system_info_get_platform_string("http://tizen.org/system/model_name", &modelName);
115 /* To pass the checking of g_ir */
117 return _MODEL_UNKNOWN;
119 if (g_strcmp0(modelName, "TM1") == 0)
120 model_name = _MODEL_TM1;
121 else if (g_strcmp0(modelName, "TM2") == 0)
122 model_name = _MODEL_TM2;
123 else if (g_strcmp0(modelName, "TW1") == 0)
124 model_name = _MODEL_TW1;
125 else if (g_strcmp0(modelName, "TW2") == 0)
126 model_name = _MODEL_TW2;
127 else if (!strncasecmp(modelName, "Family Hub", 10))
128 model_name = _MODEL_FHUB;
129 else if (!strcasecmp(modelName, "Robot Vacuum Cleaner") ||
130 !strcasecmp(modelName, "Smart Dryer") ||
131 !strcasecmp(modelName, "Smart Washer") ||
132 !strcasecmp(modelName, "DDMS") ||
133 !strcasecmp(modelName, "Smart Cooktop") ||
134 !strcasecmp(modelName, "Smart Range") ||
135 !strcasecmp(modelName, "Refrigerator") ||
136 !strcasecmp(modelName, "Echo Heating System Controller") ||
137 !strcasecmp(modelName, "Bespoke Washer") ||
138 !strcasecmp(modelName, "Bespoke Dryer") ||
139 !strcasecmp(modelName, "Appliance Emulator"))
140 model_name = _MODEL_DA;
142 model_name = _MODEL_UNKNOWN;
150 #define TIZEN_PROFILE_WEARABLE (get_tizen_profile() == _PROFILE_WEARABLE)
151 #define TIZEN_PROFILE_IVI (get_tizen_profile() == _PROFILE_IVI)
152 #define TIZEN_PROFILE_TV (get_tizen_profile() == _PROFILE_TV)
153 #define TIZEN_PROFILE_MOBILE (get_tizen_profile() == _PROFILE_MOBILE)
155 #define TIZEN_MODEL_NAME_TM1 (get_tizen_model_name() == _MODEL_TM1)
156 #define TIZEN_MODEL_NAME_TM2 (get_tizen_model_name() == _MODEL_TM2)
157 #define TIZEN_MODEL_NAME_TW1 (get_tizen_model_name() == _MODEL_TW1)
158 #define TIZEN_MODEL_NAME_TW2 (get_tizen_model_name() == _MODEL_TW2)
159 #define TIZEN_MODEL_NAME_FHUB (get_tizen_model_name() == _MODEL_FHUB)
160 #define TIZEN_MODEL_NAME_DA (get_tizen_model_name() & (_MODEL_FHUB | _MODEL_DA))
162 #endif /* __DEF_BT_AGENT_PROFILE_H_ */