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