diff options
author | Jinkun Jang <jinkun.jang@samsung.com> | 2013-03-13 01:46:30 +0900 |
---|---|---|
committer | Jinkun Jang <jinkun.jang@samsung.com> | 2013-03-13 01:46:30 +0900 |
commit | 067936003d16246cf33456c9d13d0d4dd0bd55a4 (patch) | |
tree | 2b59cf4e1e0a4952ee799b2101b6d305ec2f2002 /include | |
parent | b1de06bc31aada55b92d65f959243798e21e6cc7 (diff) | |
download | appcore-agent-067936003d16246cf33456c9d13d0d4dd0bd55a4.tar.gz appcore-agent-067936003d16246cf33456c9d13d0d4dd0bd55a4.tar.bz2 appcore-agent-067936003d16246cf33456c9d13d0d4dd0bd55a4.zip |
Tizen 2.1 basesubmit/tizen_2.1/20130424.230754submit/tizen/20130517.044800accepted/tizen_2.1/20130425.035458accepted/tizen/20130520.1009102.1b_releasetizen_2.1
Diffstat (limited to 'include')
-rwxr-xr-x | include/appcore-agent.h | 69 | ||||
-rwxr-xr-x | include/service_app.h | 167 | ||||
-rwxr-xr-x | include/service_app_private.h | 36 |
3 files changed, 272 insertions, 0 deletions
diff --git a/include/appcore-agent.h b/include/appcore-agent.h new file mode 100755 index 0000000..e1c6080 --- /dev/null +++ b/include/appcore-agent.h @@ -0,0 +1,69 @@ +/* + * app-core + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + + + +#ifndef __AGENT_APPCORE_H__ +#define __AGENT_APPCORE_H__ + + +#include <libintl.h> +#include <bundle.h> + +#include "app_service.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +struct agentcore_ops { + void *data; + /**< Callback data */ + int (*create) (void *); + int (*terminate) (void *); + int (*service) (service_h, void *); + + void *reserved[6]; + /**< Reserved */ +}; + +enum appcore_agent_event { + APPCORE_AGENT_EVENT_UNKNOWN, + /**< Unknown event */ + APPCORE_AGENT_EVENT_LOW_MEMORY, + /**< Low memory */ + APPCORE_AGENT_EVENT_LOW_BATTERY, + /**< Low battery */ +}; + +int appcore_agent_main(int argc, char **argv, struct agentcore_ops *ops); + +int appcore_agent_terminate(); + +int appcore_agent_set_event_callback(enum appcore_agent_event event, + int (*cb) (void *), void *data); + +#ifdef __cplusplus +} +#endif + +#endif /* __AGENT_APPCORE_H__ */ diff --git a/include/service_app.h b/include/service_app.h new file mode 100755 index 0000000..2f3098c --- /dev/null +++ b/include/service_app.h @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef __TIZEN_APPFW_SERVICE_APP_H__ +#define __TIZEN_APPFW_SERVICE_APP_H__ + +#include <tizen.h> +#include <app_service.h> + + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup CAPI_APPLICATION_MODULE + * @{ + */ + + +/** + * @brief Enumerations of error code for Application. + */ +typedef enum +{ + SERVICE_APP_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ + SERVICE_APP_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ + SERVICE_APP_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */ + SERVICE_APP_ERROR_INVALID_CONTEXT = TIZEN_ERROR_NOT_PERMITTED, /**< Invalid application context */ + SERVICE_APP_ERROR_NO_SUCH_FILE = TIZEN_ERROR_NO_SUCH_FILE, /**< No such file or directory */ + SERVICE_APP_ERROR_ALREADY_RUNNING = TIZEN_ERROR_ALREADY_IN_PROGRESS, /**< Application is already running */ +} service_app_error_e; + + +/** + * @brief Called at the start of the agent application. + * + * @param[in] user_data The user data passed from the callback registration function + * @return @c true on success, otherwise @c false + * @pre service_app_main() will invoke this callback function. + * @see service_app_main() + * @see #service_app_event_callback_s + */ +typedef bool (*service_app_create_cb) (void *user_data); + + +/** + * @brief Called once after the main loop of agent application exits. + * + * @param[in] user_data The user data passed from the callback registration function + * @see service_app_main() + * @see #service_app_event_callback_s + */ +typedef void (*service_app_terminate_cb) (void *user_data); + + +/** + * @brief Called when other application send the launch request to the agent application. + * + * @param[in] service The handle to the service + * @param[in] user_data The user data passed from the callback registration function + * @see service_app_main() + * @see #service_app_event_callback_s + * @see @ref CAPI_SERVICE_MODULE API + */ +typedef void (*service_app_service_cb) (service_h service, void *user_data); + + +/** + * @brief Called when the system memory is running low. + * + * @param[in] user_data The user data passed from the callback registration function + * @see service_app_main() + * @see #service_app_event_callback_s + */ +typedef void (*service_app_low_memory_cb) (void *user_data); + + +/** + * @brief Called when the battery power is running low. + * + * @param[in] user_data The user data passed from the callback registration function + * @see service_app_main() + * @see #service_app_event_callback_s + */ +typedef void (*service_app_low_battery_cb) (void *user_data); + + +/** + * @brief The structure type to contain the set of callback functions for handling application events. + * @details It is one of the input parameters of the service_app_efl_main() function. + * + * @see service_app_main() + * @see service_app_create_cb() + * @see service_app_terminate_cb() + * @see service_app_service_cb() + * @see service_app_low_memory_cb() + * @see service_app_low_battery_cb() + */ +typedef struct +{ + service_app_create_cb create; /**< This callback function is called at the start of the application. */ + service_app_terminate_cb terminate; /**< This callback function is called once after the main loop of application exits. */ + service_app_service_cb service; /**< This callback function is called when other application send the launch request to the application. */ + service_app_low_memory_cb low_memory; /**< The registered callback function is called when the system runs low on memory. */ + service_app_low_battery_cb low_battery; /**< The registered callback function is called when battery is low. */ +} service_app_event_callback_s; + + +/** + * @brief Runs the main loop of application until service_app_exit() is called + * + * @param [in] argc The argument count + * @param [in] argv The argument vector + * @param [in] callback The set of callback functions to handle application events + * @param [in] user_data The user data to be passed to the callback functions + * + * @return 0 on success, otherwise a negative error value. + * @retval #SERVICE_APP_ERROR_NONE Successful + * @retval #SERVICE_APP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #SERVICE_APP_ERROR_INVALID_CONTEXT The application is illegally launched, not launched by the launch system. + * @retval #SERVICE_APP_ERROR_ALREADY_RUNNING The main loop already starts + * + * @see service_app_create_cb() + * @see service_app_terminate_cb() + * @see service_app_service_cb() + * @see service_app_low_memory_cb() + * @see service_app_low_battery_cb() + * @see service_app_exit() + * @see #service_app_event_callback_s + */ +int service_app_main(int argc, char **argv, service_app_event_callback_s *callback, void *user_data); + + +/** + * @brief Exits the main loop of application. + * + * @details The main loop of application stops and service_app_terminate_cb() is invoked + * @see service_app_main() + * @see service_app_terminate_cb() + */ +void service_app_exit(void); + + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __TIZEN_APPFW_SERVICE_APP_H__ */ diff --git a/include/service_app_private.h b/include/service_app_private.h new file mode 100755 index 0000000..0f44311 --- /dev/null +++ b/include/service_app_private.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef __TIZEN_APPFW_SERVICE_APP_PRIVATE_H__ +#define __TIZEN_APPFW_SERVICE_APP_PRIVATE_H__ + +#include <appcore-agent.h> +#include <service_app.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define TIZEN_PATH_MAX 1024 + +int service_app_error(service_app_error_e error, const char* function, const char *description); + +#ifdef __cplusplus +} +#endif + +#endif /* __TIZEN_APPFW_SERVICE_APP_PRIVATE_H__ */ |