Initialize Tizen 2.3
[framework/osp/env-config.git] / appinfo / appinfo.h
1 //
2 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
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 #ifndef _APP_INFO_H_
18 #define _APP_INFO_H_
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
24 /**
25  * @brief       Enumeration of API version
26  */
27 typedef enum
28 {
29         APP_INFO_VERSION_INVALID = -1,
30         APP_INFO_VERSION_1_0 = 100,
31         APP_INFO_VERSION_1_0_2 = 102,
32         APP_INFO_VERSION_1_1 = 110,
33         APP_INFO_VERSION_1_2 = 120,
34         APP_INFO_VERSION_2_0 = 200,
35         APP_INFO_VERSION_2_1 = 210,
36         APP_INFO_VERSION_2_2 = 220,
37         APP_INFO_VERSION_3_0 = 300,
38         APP_INFO_VERSION_MAX = 65535,
39 } app_info_version_e;
40
41
42 /**
43  * @brief       Enumerations of error code
44  */
45 typedef enum
46 {
47         APP_INFO_ERROR_NONE = 0,        /**< Successful */
48         APP_INFO_ERROR_INVALID_ARG = -1,        /**< Invalid argument */
49 } app_info_error_e;
50
51 /**
52  * @brief       Initializes the appinfo structure
53  *
54  * @param[in] appid     The application id to initialize
55  * @param[in] is_invalid_appid  @c 1 for invalid appid compatibility mode, @c 0 otherwise
56  * @return      0 on success, otherwise a negative error value
57  * @retval      APP_INFO_ERROR_NONE Succesful
58  * @retval      APP_INFO_ERROR_INVALID_ARG The appid is invalid
59  * @remarks     It initialize the platform API version to APP_INFO_VERSION_3_0 and compat mode 0.
60  */
61 int appinfo_init(const char* appid, int is_invalid_appid);
62
63 /**
64  * @brief       Returns the API version
65  *
66  * @return      app_info_version_e value
67  */
68 int appinfo_get_api_version(void);
69
70 /**
71  * @brief       Sets the API version for the current process
72  *
73  * @param[in]   ver Given API version
74  * @return      0 on success, otherwise a negative error value
75  * @retval      APP_INFO_ERROR_NONE Succesful
76  */
77 //int appinfo_set_api_version(int ver);
78 int appinfo_set_api_version(app_info_version_e ver);
79
80 /**
81  * @brief       Returns the API version string by given API version
82  *
83  * @param[in]   ver Given API version
84  * @return      the API version string by the given version
85  */
86 const char* appinfo_get_api_str_by_version(int ver);
87
88 /**
89  * @brief       Returns the API version by given version string
90  *
91  * @param[in]   ver_str Given version string
92  * @return      the API version
93  */
94 app_info_version_e appinfo_get_api_version_from_str(const char* ver_str);
95
96 /**
97  * @brief       Returns whether the application is compat mode or not
98  *
99  * @return      @c 1 for compat mode, @c 0 otherwise
100  */
101 int appinfo_is_compat(void);
102
103 /**
104  * @brief       Sets the application compat mode
105  *
106  * @param[in]   the compatibility mode
107  * @return      0 on success, otherwise a negative error value
108  * @retval      APP_INFO_ERROR_NONE Succesful
109  * @retval      APP_INFO_ERROR_INVALID_ARG compat should be either @c 0 or @c 1.
110  */
111 int appinfo_set_compat(int compat);
112
113 /**
114  * @brief       Returns the appid for the application
115  *
116  * @retval      application ID if valid, @c NULL otherwise
117  */
118 const char* appinfo_get_appid(void);
119
120 /**
121  * @brief       Returns the exec name for the application
122  *
123  * @retval      application exec name if valid, empty string otherwise
124  */
125 const char* appinfo_get_execname(void);
126
127 /**
128  * @brief       Returns the packageid for the application
129  *
130  * @retval      package ID if valid, @c NULL otherwise
131  */
132 const char* appinfo_get_packageid(void);
133
134 /**
135  * @brief       Returns whether the appinfo is initialized or not
136  *
137  * @return      @c 1 if initialized, @c 0 otherwise
138  */
139 int appinfo_is_initialized(void);
140
141 int appinfo_set_argv(int argc, char** argv);
142
143 int appinfo_get_argv(int* argc, char*** argv);
144
145 int appinfo_update_submode_execname_and_appid(const char* execname);
146
147 int appinfo_update_submode_appid(const char* appid);
148
149 #ifdef __cplusplus
150 }
151 #endif
152
153 #endif //_APP_INFO_H_
154