Upload Tizen2.0 source
[framework/appfw/app-core.git] / include / appcore-efl.h
1 /*
2  *  app-core
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22
23
24 #ifndef __APPCORE_ELF_H__
25 #define __APPCORE_ELF_H__
26
27 /**
28  * @file    appcore-efl.h
29  * @version 1.1
30  * @brief   This file contains APIs of the Appcore EFL library
31  */
32
33 /**
34  * @addtogroup APPLICATION_FRAMEWORK
35  * @{
36  *
37  * @defgroup Appcore_EFL Appcore EFL
38  * @version  1.1
39  * @brief    A base library for EFL application based on Appcore
40  *
41  */
42
43 /**
44  * @addtogroup Appcore_EFL
45  * @{
46  */
47
48 #include <stdbool.h>
49 #include <appcore-common.h>
50
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54
55 /**
56  * @par Description:
57  * This is a main function for EFL application on SLP platform. \n
58  * Refer to programming guide for the details.
59  *
60  * @par Purpose:
61  * To develop an application using EFL on this platform.
62  *
63  * @par Method of function operation:
64  * Initialize the EFL, internationalization, and notifications 
65  * for receiving system events such as rotation, low battery, etc.\n
66  * And, start an ecore mainloop.
67  *
68  * @param[in] name Application name
69  * @param[in] argc A count of the arguments
70  * @param[in] argv An array of pointers to the strings which are those arguments
71  * @param[in] ops Appcore operations
72  *
73  * @return 0 on success, -1 on error (<I>errno</I> set)
74  *
75  * @par Errors:
76  * EALREADY - mainloop already started \n
77  * EINVAL - one of parameters is NULL \n
78  * ECANCELED - create() callback returns error (none zero value) \n
79  *
80  * @par Corner cases/exceptions:
81  * If <I>ops</I> has no callback function, this function just starts a mainloop.
82  *
83  * @par Known issues/bugs:
84  * If <I>errno</I> set another value, check the <I>dlog</I> message.
85  * This doesn't care internal <I>errno</I> set.
86  *
87  * @pre None.
88  * @post None.
89  * @see None.
90  * @remarks None.
91  *
92  * @par Sample code:
93  * @code
94 #include <appcore-efl.h>
95
96 static int _create(void *);
97 static int _reset(bundle *, void *);
98
99 int main(int argc, char *argv[])
100 {
101         int r;
102         const char *name;
103         struct appcore_ops ops = {
104                 .create = _create,
105                 .reset = _reset,
106                 ...
107         };
108
109         ...
110
111         r = appcore_efl_main(name, &argc, &argv, &ops);
112         if (r) {
113                 // add exception handling
114                 perror("Appcore EFL main");
115         }
116 }
117  * @endcode
118  *
119  */
120 int appcore_efl_main(const char *name, int *argc, char ***argv,
121                      struct appcore_ops *ops);
122
123 /**
124  * @par Description:
125  * This API sets system resource reclaiming.
126  *
127  * @par Purpose:
128  * When this is not enabled, the application doesn't reclaim system resource.
129  *
130  * @param[in] enable Application name
131  *
132  * @return 0 on success, -1 on error (<I>errno</I> set)
133  *
134  *
135  * @pre None.
136  * @post None.
137  * @see None.
138  * @remarks None.
139  *
140  * @par Sample code:
141  * @code
142 #include <appcore-efl.h>
143
144 int _create(void *data)
145 {
146         int r;
147
148         ...
149         r = appcore_set_system_resource_reclaiming(FALSE);
150         if (r) {
151                 // add exception handling
152                 perror("appcore_set_system_resource_reclaiming");
153         }
154         ...
155 }
156  * @endcode
157  *
158  */
159 int appcore_set_system_resource_reclaiming(bool enable);
160
161 #ifdef __cplusplus
162 }
163 #endif
164 /**
165  * @}
166  */
167 /**
168  * @}
169  */
170 #endif                          /* __APPCORE_ELF_H__ */