Add feature definition about background management
[platform/core/appfw/app-core.git] / src / base / appcore_base_private.h
1 /*
2  * Copyright (c) 2016 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 #pragma once
18
19 #define LOG_TAG "APP_CORE_BASE"
20
21 #include <stdio.h>
22 #include <stdbool.h>
23 #include <dlog.h>
24
25 typedef enum {
26         TIZEN_PROFILE_UNKNOWN = 0,
27         TIZEN_PROFILE_MOBILE = 0x1,
28         TIZEN_PROFILE_WEARABLE = 0x2,
29         TIZEN_PROFILE_TV = 0x4,
30         TIZEN_PROFILE_IVI = 0x8,
31         TIZEN_PROFILE_COMMON = 0x10,
32 } appcore_base_tizen_profile_t;
33
34 #ifndef EXPORT_API
35 #  define EXPORT_API __attribute__ ((visibility("default")))
36 #endif
37
38 #ifndef _DLOG_H_
39 #  define _ERR(fmt, arg...) \
40         do { fprintf(stderr, "appcore: "fmt"\n", ##arg); } while (0)
41
42 #  define _INFO(fmt, arg...) \
43         do { fprintf(stdout, fmt"\n", ##arg); } while (0)
44
45 #  define _DBG(fmt, arg...) \
46         do { \
47                 if (getenv("APPCORE_DEBUG")) { \
48                         fprintf(stdout, fmt"\n", ##arg); \
49                 } \
50         } while (0)
51 #else
52 #  define _ERR(fmt, arg...) \
53         do { \
54                 fprintf(stderr, "appcore: "fmt"\n", ##arg); \
55                 LOGE(fmt, ##arg); \
56         } while (0)
57 #  define _INFO(...) LOGI(__VA_ARGS__)
58 #  define _DBG(...) LOGD(__VA_ARGS__)
59 #endif
60
61 #define _warn_if(expr, fmt, arg...) do { \
62                 if (expr) { \
63                         _ERR(fmt, ##arg); \
64                 } \
65         } while (0)
66
67 #define _ret_if(expr) do { \
68                 if (expr) { \
69                         return; \
70                 } \
71         } while (0)
72
73 #define _retv_if(expr, val) do { \
74                 if (expr) { \
75                         return (val); \
76                 } \
77         } while (0)
78
79 #define _retm_if(expr, fmt, arg...) do { \
80                 if (expr) { \
81                         _ERR(fmt, ##arg); \
82                         return; \
83                 } \
84         } while (0)
85
86 #define _retvm_if(expr, val, fmt, arg...) do { \
87                 if (expr) { \
88                         _ERR(fmt, ##arg); \
89                         return (val); \
90                 } \
91         } while (0)
92
93 appcore_base_tizen_profile_t appcore_base_get_tizen_profile(void);
94
95 #define TIZEN_FEATURE_BACKGROUND_MANAGEMENT \
96         (!(appcore_base_get_tizen_profile() & TIZEN_PROFILE_TV))
97
98 extern void aul_finalize();
99