change service_cb to app_control_cb 56/36156/2 accepted/tizen/mobile/20150313.083934 accepted/tizen/tv/20150313.083812 accepted/tizen/wearable/20150313.083842 submit/tizen/20150304.022845 submit/tizen_mobile/20150313.022842 submit/tizen_tv/20150313.022842 submit/tizen_wearable/20150313.022842
authorJiwoong Im <jiwoong.im@samsung.com>
Tue, 3 Mar 2015 06:11:05 +0000 (15:11 +0900)
committerJiwoong Im <jiwoong.im@samsung.com>
Wed, 4 Mar 2015 01:56:53 +0000 (10:56 +0900)
JIRA ticket : TC-2314

Change-Id: I0e8b468fca78a8206c01589c89ef1840c541b17e
Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
include/appcore-agent.h
include/service_app.h
src/appcore-agent.c
src/service_app_main.c

index 59c1ce0..0a40349 100755 (executable)
@@ -28,7 +28,7 @@
 #include <libintl.h>
 #include <bundle.h>
 
-#include "app_service.h"
+#include "app_control.h"
 
 
 #ifdef __cplusplus
@@ -38,9 +38,9 @@ extern "C" {
 struct agentcore_ops {
        void *data;
            /**< Callback data */
-       int (*create) (void *);
-       int (*terminate) (void *);
-       int (*service) (service_h, void *);
+       int (*create) (void *); /**< This callback function is called at the start of the application. */
+       int (*terminate) (void *); /**< This callback function is called once after the main loop of application exits. */
+       int (*app_control) (app_control_h, void *); /**< This callback function is called when other application send the launch request to the application. */
 
        void *reserved[6];
                   /**< Reserved */
index 7e2a829..631a2c7 100755 (executable)
@@ -19,7 +19,7 @@
 #define __TIZEN_APPFW_SERVICE_APP_H__
 
 #include <tizen.h>
-#include <app_service.h>
+#include <app_control.h>
 #include <app.h>
 
 
@@ -72,13 +72,13 @@ 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]  app_control     The handle to the app_control
  * @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);
+typedef void (*service_app_control_cb) (app_control_h app_control, void *user_data);
 
 
 /**
@@ -108,13 +108,13 @@ typedef void (*service_app_low_battery_cb) (void *user_data);
  * @see service_app_main()
  * @see service_app_create_cb()
  * @see service_app_terminate_cb()
- * @see service_app_service_cb()
+ * @see service_app_control_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 the application exits. */
-       service_app_service_cb service; /**< This callback function is called when another application sends the launch request to the application. */
+       service_app_control_cb app_control; /**< This callback function is called when another application sends the launch request to the application. */
 } service_app_lifecycle_callback_s;
 
 
@@ -169,7 +169,7 @@ int service_app_remove_event_handler(app_event_handler_h event_handler);
  *
  * @see service_app_create_cb()
  * @see service_app_terminate_cb()
- * @see service_app_service_cb()
+ * @see service_app_control_cb()
  * @see service_app_exit()
  * @see #service_app_lifecycle_callback_s
  */
index e787d14..87f6f7a 100755 (executable)
@@ -32,6 +32,7 @@
 #include <sysman.h>
 #include "aul.h"
 #include "appcore-agent.h"
+#include <app_control_internal.h>
 #include <dlog.h>
 #include <vconf.h>
 
@@ -174,7 +175,6 @@ struct agent_appcore {
 static struct agent_appcore core;
 
 
-extern int service_create_request(bundle *data, service_h *service);
 static int __sys_lowmem_post(void *data, void *evt);
 static int __sys_lowmem(void *data, void *evt);
 static int __sys_lowbatt(void *data, void *evt);
@@ -204,7 +204,7 @@ static void __do_app(enum agent_event event, void *data, bundle * b)
 {
        int r = 0;
        struct agent_priv *svc = data;
-       service_h service = NULL;
+       app_control_h app_control = NULL;
 
        _ret_if(svc == NULL);
 
@@ -216,15 +216,15 @@ static void __do_app(enum agent_event event, void *data, bundle * b)
 
        _ret_if(svc->ops == NULL);
 
-       if (service_create_event(b, &service) != 0)
+       if (app_control_create_event(b, &app_control) != 0)
        {
                return;
        }
 
        switch (event) {
        case AGE_REQUEST:
-               if (svc->ops->service)
-                       r = svc->ops->service(service, svc->ops->data);
+               if (svc->ops->app_control)
+                       r = svc->ops->app_control(app_control, svc->ops->data);
                svc->state = AGS_RUNNING;
                break;
 /*     case AGE_STOP:
@@ -238,7 +238,7 @@ static void __do_app(enum agent_event event, void *data, bundle * b)
                /* do nothing */
                break;
        }
-       service_destroy(service);
+       app_control_destroy(app_control);
 }
 
 static struct agent_ops s_ops = {
index 34ea510..3da99da 100755 (executable)
@@ -68,7 +68,7 @@ typedef service_app_context_s *service_app_context_h;
 
 static int service_app_create(void *data);
 static int service_app_terminate(void *data);
-static int service_app_reset(service_h service, void *data);
+static int service_app_reset(app_control_h app_control, void *data);
 static int service_app_low_memory(void *event_info, void *data);
 static int service_app_low_battery(void *event_info, void *data);
 
@@ -103,7 +103,7 @@ EXPORT_API int service_app_main(int argc, char **argv, service_app_lifecycle_cal
                .data = &service_app_context,
                .create = service_app_create,
                .terminate = service_app_terminate,
-               .service = service_app_reset,
+               .app_control = service_app_reset,
        };
 
        if (argc <= 0 || argv == NULL || callback == NULL)
@@ -249,21 +249,21 @@ int service_app_terminate(void *data)
 }
 
 
-int service_app_reset(service_h service, void *data)
+int service_app_reset(app_control_h app_control, void *data)
 {
        service_app_context_h service_app_context = data;
-       service_app_service_cb service_cb;
+       service_app_control_cb app_control_cb;
 
        if (service_app_context == NULL)
        {
                return service_app_error(SERVICE_APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
        }
 
-       service_cb = service_app_context->callback->service;
+       app_control_cb = service_app_context->callback->app_control;
 
-       if (service_cb != NULL)
+       if (app_control_cb != NULL)
        {
-               service_cb(service, service_app_context->data);
+               app_control_cb(app_control, service_app_context->data);
        }
 
        return SERVICE_APP_ERROR_NONE;