Add descriptions 54/208154/16
authorHwankyu Jhun <h.jhun@samsung.com>
Wed, 19 Jun 2019 04:44:38 +0000 (13:44 +0900)
committerInkyun Kil <inkyun.kil@samsung.com>
Wed, 10 Jul 2019 00:51:54 +0000 (09:51 +0900)
Change-Id: I0eae5438353c77b3a82fe5a815ee8dc7a8373b32
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
Signed-off-by: Inkyun Kil <inkyun.kil@samsung.com>
component_based/base/frame_component.cc
component_based/base/frame_component.h
component_based/efl_base/api/component_based_app.h
component_based/efl_base/api/component_common.h
component_based/efl_base/api/frame_component.h
component_based/efl_base/api/service_component.h
component_based/efl_base/stub.cc
doc/appfw_component_based_application_doc.h [new file with mode: 0755]
doc/images/frame_component_lifecycle.png [new file with mode: 0755]
doc/images/service_component_lifecycle.png [new file with mode: 0755]
unit_tests/src/base/test_component_based_component.cc

index 72157a5833c617e700b2cc4aabea4cead0696b7d..982e0be1f996932006218a608ba8da23cd16c11c 100644 (file)
@@ -31,18 +31,18 @@ FrameComponent::FrameComponent(std::string comp_id, std::string inst_id)
 
 FrameComponent::~FrameComponent() = default;
 
-FrameComponent::LCDStatus FrameComponent::GetLCDStatus() {
+FrameComponent::DisplayStatus FrameComponent::GetDisplayStatus() {
   app_display_state_e state;
   int r = app_get_display_state(&state);
   if (r != APP_ERROR_NONE) {
     LOGE("Failed to get display state. error(%d)", r);
-    return FrameComponent::LCDStatus::Unknown;
+    return FrameComponent::DisplayStatus::Unknown;
   }
 
   if (state == APP_DISPLAY_STATE_ON)
-    return FrameComponent::LCDStatus::On;
+    return FrameComponent::DisplayStatus::On;
 
-  return FrameComponent::LCDStatus::Off;
+  return FrameComponent::DisplayStatus::Off;
 }
 
 const IWindow* FrameComponent::GetWindow() {
index 3d52acc518c21ba946af04e3781a929d6f09d431..d8ebb44914039a1febcd2dbc26c16e8522819ba6 100644 (file)
@@ -40,7 +40,7 @@ class EXPORT_API FrameComponent : public Component {
     }
   };
 
-  enum class LCDStatus {
+  enum class DisplayStatus {
     Unknown,
     On,
     Off,
@@ -49,7 +49,7 @@ class EXPORT_API FrameComponent : public Component {
   FrameComponent(std::string comp_id, std::string inst_id);
   virtual ~FrameComponent();
 
-  LCDStatus GetLCDStatus();
+  DisplayStatus GetDisplayStatus();
   const IWindow* GetWindow();
 
   virtual std::unique_ptr<IWindow> OnCreate();
index b0409288ca7b6d5bdba39775b28546ac1850feca..a2e5b653c24512974eddd2fd5170432fba41d021 100644 (file)
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#ifndef CAPI_COMPONENT_BASED_APPLICATION_H_
-#define CAPI_COMPONENT_BASED_APPLICATION_H_
+#ifndef __TIZEN_COMPONENT_BASED_APPLICATION_H__
+#define __TIZEN_COMPONENT_BASED_APPLICATION_H__
 
 #include <app_common.h>
 
 extern "C" {
 #endif
 
+/**
+ * @addtogroup COMPONENT_BASED_APPLICATION_MODULE
+ * @{
+ */
+
+
+/**
+ * @brief Called when the application starts.
+ * @details The callback function is called before the main loop of the application starts.
+ *          In this callback, you can initialize resources which can be shared among component instances.
+ *          This function should return the handle for component class so that it will be used for making instances of component.
+ * @since_tizen 5.5
+ * @remarks The returned object is managed by platform. You should not release the object.
+ *
+ * @param[in]   user_data       The user data to be passed from the callback registration function
+ * @return      The object of component class
+ * @see component_based_app_main()
+ * @see component_based_app_add_frame_component()
+ * @see component_based_app_add_service_component()
+ */
 typedef component_class_h (*component_based_app_create_cb)(void *user_data);
 
+/**
+ * @brief Called when the main loop of the application exits.
+ * @details This callback function is called once after the main loop of the application exits.
+ *          You should release the resources of the application in this function.
+ * @since_tizen 5.5
+ *
+ * @param[in]   user_data       The user data to be passed from the callback registration function
+ * @see component_based_app_main()
+ */
 typedef void (*component_based_app_terminate_cb)(void *user_data);
 
+/**
+ * @brief The structure for lifecycle of a component based application.
+ * @since_tizen 5.5
+ */
 typedef struct {
-       component_based_app_create_cb create;
-       component_based_app_terminate_cb terminate;
+       component_based_app_create_cb create;           /**< The callback function is called before the main loop of the application starts. */
+       component_based_app_terminate_cb terminate;     /**< The callback function is called once after the main loop of the application exits. */
 } component_based_app_lifecycle_callback_s;
 
+/**
+ * @brief Runs the main loop of the application until component_based_app_exit() is called.
+ * @since_tizen 5.5
+ *
+ * @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 function
+ * @return      @c 0 on success,
+ *              otherwise a negative error value
+ * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see component_based_app_exit();
+ */
 int component_based_app_main(int argc, char **argv,
                component_based_app_lifecycle_callback_s *callback,
                void *user_data);
 
+/**
+ * @brief Exits the main loop of the application.
+ * @since_tizen 5.5
+ *
+ * @return      @c 0 on success,
+ *              otherwise a negative error value
+ * @retval #APP_ERROR_NONE Successful
+ */
 int component_based_app_exit(void);
 
+/**
+ * @brief Adds a new frame component to @a comp_class.
+ * @details Adds a new frame component with @a comp_id to @a comp_class.
+ *          If @a comp_class is null, the platform creates a #component_class_h and adds a new frame component with @a comp_id and then return the #component_class_h.
+ * @since_tizen 5.5
+ * @remarks The specific error code can be obtained using the get_last_result() function.
+ *          Error codes are described in Exception section.
+ * @remarks The returned value is managed by the platform and will be released when the component_based_app_create_cb() function returns it.
+ *
+ * @param[in]   comp_class      The component class
+ * @param[in]   comp_id         The ID of the frame component
+ * @param[in]   callback        The set of lifecycle callbacks of the frame component
+ * @param[in]   user_data       The user data to be passed to the callback functions
+ * @return      @a comp_class on success, otherwise NULL
+ * @exception #APP_ERROR_NONE Sucessful
+ * @exception #APP_ERROR_INVALID_PARAMETER Invalid parameter
+ * @exception #APP_ERROR_OUT_OF_MEMORY Out of memory
+ * @see get_last_result()
+ */
 component_class_h component_based_app_add_frame_component(
                component_class_h comp_class,
                const char *comp_id,
                frame_component_lifecycle_callback_s *callback,
                void *user_data);
 
+/**
+ * @brief Adds a service component to @a comp_class.
+ * @details Adds a new service component with @a comp_id to @a comp_class.
+ *          If @a comp_class is null, the platform creates a #component_class_h and adds a new service component with @a comp_id and then return the #component_class_h.
+ * @since_tizen 5.5
+ * @remarks The specific error code can be obtained using the get_last_result() function.
+ *          Error codes are described in Exception section.
+ * @remarks The returned value is managed by the platform and will be released when the component_based_app_create_cb() function returns it.
+ *
+ * @param[in]   comp_class      The component class
+ * @param[in]   comp_id         The ID of the service component
+ * @param[in]   callback        The set of lifecycle callbacks of the service component
+ * @param[in]   user_data       The user data to be passed to the callback functions
+ * @return      @a comp_class on success, otherwise NULL
+ * @exception #APP_ERROR_NONE Sucessful
+ * @exception #APP_ERROR_INVALID_PARAMETER Invalid parameter
+ * @exception #APP_ERROR_OUT_OF_MEMORY Out of memory
+ * @see get_last_result()
+ */
 component_class_h component_based_app_add_service_component(
                component_class_h comp_class,
                const char *comp_id,
                service_component_lifecycle_callback_s *callback,
                void *user_data);
 
+
+/**
+ * @}
+ */
+
 #ifdef __cplusplus
 }
 #endif
-#endif /* CAPI_COMPONENT_BASED_ELM_APPLICATION_BASE_H_ */
+#endif /* __TIZEN_COMPONENT_BASED_APPLICATION_H__ */
 
index 9f674b2fd693e24def226727e6ba2170613bd161..58aa6d3b67f4572073a338ddeff43123f0283402 100644 (file)
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#ifndef CAPI_COMPONENT_BASED_COMPONENT_COMMON_H_
-#define CAPI_COMPONENT_BASED_COMPONENT_COMMON_H_
+#ifndef __TIZEN_COMPONENT_BASED_COMPONENT_COMMON_H__
+#define __TIZEN_COMPONENT_BASED_COMPONENT_COMMON_H__
 
 #include <tizen.h>
 #include <app_control.h>
@@ -25,81 +25,245 @@ extern "C" {
 #endif
 
 #ifndef TIZEN_ERROR_COMPONENT
-#define TIZEN_ERROR_COMPONENT -0x03020000
+#define TIZEN_ERROR_COMPONENT -0x03030000
 #endif
 
+/**
+ * @addtogroup COMPONENT_BASED_COMPONENT_COMMON_MODULE
+ * @{
+ */
+
+
+/**
+ * @brief Enumeration for component error.
+ * @since_tizen 5.5
+ */
 typedef enum {
-       COMPONENT_ERROR_NONE = TIZEN_ERROR_NONE,
-       COMPONENT_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,
-       COMPONENT_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY,
-       COMPONENT_ERROR_INVALID_CONTEXT = TIZEN_ERROR_COMPONENT | 0x01,
-       COMPONENT_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED,
-       COMPONENT_ERROR_NOT_FOUND = TIZEN_ERROR_COMPONENT | 0x02,
-       COMPONENT_ERROR_LAUNCH_REJECTED = TIZEN_ERROR_COMPONENT | 0x03,
-       COMPONENT_ERROR_LAUNCH_FAILED = TIZEN_ERROR_COMPONENT | 0x04,
-       COMPONENT_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT,
-       COMPONENT_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED,
+       COMPONENT_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+       COMPONENT_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+       COMPONENT_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+       COMPONENT_ERROR_INVALID_CONTEXT = TIZEN_ERROR_COMPONENT | 0x01, /**< Invalid component context */
+       COMPONENT_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
+       COMPONENT_ERROR_NOT_FOUND = TIZEN_ERROR_COMPONENT | 0x02, /**< Not found */
+       COMPONENT_ERROR_LAUNCH_REJECTED = TIZEN_ERROR_COMPONENT | 0x03, /**< The application cannot be launched now */
+       COMPONENT_ERROR_LAUNCH_FAILED = TIZEN_ERROR_COMPONENT | 0x04, /**< Internal launch error */
+       COMPONENT_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT, /**< Time out */
+       COMPONENT_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
 } component_error_e;
 
+/**
+ * @brief Enumeration for device orientation.
+ * @since_tizen 5.5
+ */
 typedef enum {
-       COMPONENT_DEVICE_ORIENTATION_0 = 0,
-       COMPONENT_DEVICE_ORIENTATION_90 = 90,
-       COMPONENT_DEVICE_ORIENTATION_180 = 180,
-       COMPONENT_DEVICE_ORIENTATION_270 = 270,
+       COMPONENT_DEVICE_ORIENTATION_0 = 0, /**< The device is oriented in a natural position */
+       COMPONENT_DEVICE_ORIENTATION_90 = 90, /**< The device's left side is at the top */
+       COMPONENT_DEVICE_ORIENTATION_180 = 180, /**< The device is upside down */
+       COMPONENT_DEVICE_ORIENTATION_270 = 270, /**< The device's right side is at the top */
 } component_device_orientation_e;
 
+/**
+ * @brief Enumeration for low memory status.
+ * @since_tizen 5.5
+ */
 typedef enum {
-       COMPONENT_LOW_MEMORY_NONE = 0x00,
-       COMPONENT_LOW_MEMORY_NORMAL = 0x01,
-       COMPONENT_LOW_MEMORY_SOFT_WARNING = 0x02,
-       COMPONENT_LOW_MEMORY_HWARD_WARNING = 0x04,
+       COMPONENT_LOW_MEMORY_NONE = 0x00, /**< None */
+       COMPONENT_LOW_MEMORY_NORMAL = 0x01, /**< Normal status */
+       COMPONENT_LOW_MEMORY_SOFT_WARNING = 0x02, /**< Soft warning status */
+       COMPONENT_LOW_MEMORY_HARD_WARNING = 0x04, /**< Hard warning status */
 } component_low_memory_status_e;
 
+/**
+ * @brief Enumeration for battery status.
+ * @since_tizen 5.5
+ */
 typedef enum {
-       COMPONENT_LOW_BATTERY_NONE,
-       COMPONENT_LOW_BATTERY_POWER_OFF,
-       COMPONENT_LOW_BATTERY_CRITICAL_LOW,
+       COMPONENT_LOW_BATTERY_NONE, /**< None */
+       COMPONENT_LOW_BATTERY_POWER_OFF, /**< The battery status is under 1% */
+       COMPONENT_LOW_BATTERY_CRITICAL_LOW, /**< The battery status is under 5% */
 } component_low_battery_status_e;
 
+/**
+ * @brief Enumeration for suspended state.
+ * @since_tizen 5.5
+ */
 typedef enum {
-       COMPONENT_SUSPENDED_STATE_WILL_ENTER = 0,
-       COMPONENT_SUSPENDED_STATE_DID_EXIT,
+       COMPONENT_SUSPENDED_STATE_WILL_ENTER = 0, /**< The component will enter the suspended state */
+       COMPONENT_SUSPENDED_STATE_DID_EXIT, /**< The component did exit from the suspended state */
 } component_suspended_state_e;
 
+/**
+ * @brief Enumeration for display status.
+ * @since_tizen 5.5
+ */
 typedef enum {
-       COMPONENT_LCD_STATUS_UNKNOWN,
-        COMPONENT_LCD_STATUS_ON,
-        COMPONENT_LCD_STATUS_OFF,
-} component_lcd_status_e;
+        COMPONENT_DISPLAY_STATUS_ON, /**< The display status is on */
+        COMPONENT_DISPLAY_STATUS_OFF, /**< The display status is off */
+} component_display_status_e;
 
+/**
+ * @brief The component class handle.
+ * @since_tizen 5.5
+ */
 typedef void *component_class_h;
 
+/**
+ * @brief The component context handle.
+ * @since_tizen 5.5
+ */
 typedef void *component_h;
 
-int component_get_id(component_h component, char **id);
+/**
+ * @brief Gets the ID of the component.
+ * @since_tizen 5.5
+ * @remarks @c id must be released using free().
+ *
+ * @param[in]   context         The context of the component instance
+ * @param[out]  id              The ID of the component
+ * @return      @c 0 on success,
+ *              otherwise a negative error value
+ * @retval #COMPONENT_ERROR_NONE Successful
+ * @retval #COMPONENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #COMPONENT_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int component_get_id(component_h context, char **id);
 
-int component_get_instance_id(component_h component, char **instance_id);
+/**
+ * @brief Gets the instance ID of the component.
+ * @since_tizen 5.5
+ * @remarks @c instance_id must be released using free().
+ *
+ * @param[in]   context         The context of the component instance
+ * @param[out]  instance_id     The instance ID of the component
+ * @return      @c 0 on success,
+ *              otherwise a negative error value
+ * @retval #COMPONENT_ERROR_NONE Successful
+ * @retval #COMPONENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #COMPONENT_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int component_get_instance_id(component_h context, char **instance_id);
 
-int component_register_action(component_h component, const char *action);
+/**
+ * @brief Registers the app_control action.
+ * @details This function is for handling each application control action.
+ *          @a action must match id attribute of app_control element in the tizen-manifest.xml.
+ * @since_tizen 5.5
+ *
+ * @param[in]   context         The context of the component instance
+ * @param[in]   action          The name of the app_control action
+ *
+ * @return      @c 0 on success,
+ *              otherwise a negative error value
+ * @retval #COMPONENT_ERROR_NONE Successful
+ * @retval #COMPONENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see frame_component_action_cb()
+ * @see component_deregister_action()
+ */
+int component_register_action(component_h context, const char *action);
 
-int component_deregister_action(component_h component,
+/**
+ * @brief Deregisters the registered app_control action.
+ * @since_tizen 5.5
+ *
+ * @param[in]   context         The context of the component instance
+ * @param[in]   action          The name of the app_control action
+ *
+ * @return      @c 0 on success,
+ *              otherwise a negative error value
+ * @retval #COMPONENT_ERROR_NONE Successful
+ * @retval #COMPONENT_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int component_deregister_action(component_h context,
                const char *action);
 
-int component_send_launch_request_async(component_h component,
+/**
+ * @brief Sends the launch request asynchronously.
+ * @defails To use group mode, you must use this function instead of app_control_send_launch_request_async().
+ * @since_tizen 5.5
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/appmanager.launch
+ *
+ * @param[in]   context         The context of the component instance
+ * @param[in]   app_control     The app_control handle
+ * @param[in]   result_cb       The callback function to be called when the result is delivered
+ * @param[in]   reply_cb        The callback function to be called when the reply is delivered
+ * @param[in]   user_data       The user data to be passed to the callback function
+ *
+ * @return      @c 0 on success,
+ *              otherwise a negative error value
+ * @retval #COMPONENT_ERROR_NONE Successful
+ * @retval #COMPONENT_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #COMPONENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #COMPONENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #COMPONENT_ERROR_NOT_FOUND The application to run the given launch request is not found
+ * @retval #COMPONENT_ERROR_LAUNCH_REJECTED The application cannot be launched in current context
+ * @retval #COMPONENT_ERROR_LAUNCH_FAILED Failed to launch the application
+ * @retval #COMPONENT_ERROR_TIMED_OUT Failed due to timeout. The application that handles @a app_control may be busy
+ * @see app_control_result_cb()
+ * @see app_control_reply_to_launch_request()
+ * @see app_control_reply_cb()
+ * @see app_control_enable_app_started_result_event()
+ * @see app_control_send_launch_request_async()
+ */
+int component_send_launch_request_async(component_h context,
                app_control_h app_control,
                 app_control_result_cb result_cb,
                 app_control_reply_cb reply_cb,
                 void *user_data);
 
-int component_send_launch_request_sync(component_h component,
+/**
+ * @brief Sends the launch request synchronously.
+ * @details To use group mode, you must use this function instead of app_control_send_launch_request_sync().
+ * @since_tizen 5.5
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/appmanager.launch
+ * @remarks The @a reply must be released using app_control_destroy().
+ *
+ * @param[in]   context         The context of the component instance
+ * @param[in]   app_control     The app_control handle
+ * @param[out]  reply           The app_control handle in which the results of the callee are contained
+ * @param[out]  result          The result code of the launch request
+ *
+ * @return      @c 0 on success,
+ *              otherwise a negative error value
+ * @retval #COMPONENT_ERROR_NONE Successful
+ * @retval #COMPONENT_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #COMPONENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #COMPONENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #COMPONENT_ERROR_NOT_FOUND The application to run the given launch request is not found
+ * @retval #COMPONENT_ERROR_LAUNCH_REJECTED The application cannot be launched in current context
+ * @retval #COMPONENT_ERROR_LAUNCH_FAILED Failed to launch the application
+ * @retval #COMPONENT_ERROR_TIMED_OUT Failed due to timeout. The application that handles @a app_control may be busy
+ * @see app_control_destroy()
+ * @see app_control_send_launch_request_sync()
+ */
+int component_send_launch_request_sync(component_h context,
                 app_control_h app_control,
                 app_control_h *reply,
                app_control_result_e *result);
 
-int component_finish(component_h component);
+/**
+ * @brief Finishes the component instance.
+ * @since_tizen 5.5
+ *
+ * @param[in]   context         The context of the component instance
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #COMPONENT_ERROR_NONE Successful
+ * @retval #COMPONENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see frame_component_destroy_cb()
+ * @see service_component_destroy_cb()
+ */
+int component_finish(component_h context);
+
+
+/**
+ * @}
+ */
 
 #ifdef __cplusplus
 }
 #endif
-#endif /* CAPI_COMPONENT_BASED_COMPONENT_COMMON_H_ */
+#endif /* __TIZEN_COMPONENT_BASED_COMPONENT_COMMON_H__ */
 
index 974c827f541119f0314bf381d769c44d2d1dfe46..4f50acf645218afe07d31e21c36d2140eba0b799 100644 (file)
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#ifndef CAPI_COMPONENT_BASED_FRAME_COMPONENT_H_
-#define CAPI_COMPONENT_BASED_FRAME_COMPONENT_H_
+#ifndef __TIZEN_COMPONENT_BASED_FRAME_COMPONENT_H__
+#define __TIZEN_COMPONENT_BASED_FRAME_COMPONENT_H__
 
 #include <Elementary.h>
 #include <app_control.h>
 extern "C" {
 #endif
 
+/**
+ * @addtogroup COMPONENT_BASED_FRAME_COMPONENT_MODULE
+ * @{
+ */
+
+
+/**
+ * @brief Called when the frame component instance is created.
+ * @details The returned Evas_Object MUST NOT be released using evas_object_del(). The platform frees the window when the frame component instance is destroyed.
+ * @since_tizen 5.5
+ * @remarks The @a context should not be released. The @a context can be used only in the callback.
+ *
+ * @param[in]   context         The context of the frame component instance
+ * @param[in]   user_data       The user data passed from component_based_app_add_frame_component() function
+ *
+ * @return      The Evas object on success,
+ *              otherwise a null pointer on failure.
+ * @see frame_component_get_window()
+ */
 typedef Evas_Object *(*frame_component_create_cb)(
-               component_h component,
+               component_h context,
                void *user_data);
 
+/**
+ * @brief Called when the frame component instance is started.
+ * @since_tizen 5.5
+ * @remarks The @a context should not be released. The @a context can be used only in the callback.
+ * @reamrks The @a app_control should not be released. The @a app_control can be used only in the callback.
+ *          To use outside, make a copy using app_control_clone().
+ *
+ * @param[in]   context         The context of the frame component instance
+ * @param[in]   app_control     The app control handle
+ * @param[in]   restarted       @c true, if the instance is restarted
+ * @param[in]   user_data       The user data passed from component_based_app_add_frame_component() function
+ */
 typedef void (*frame_component_start_cb)(
-               component_h component,
+               component_h context,
                app_control_h app_control,
                bool restarted,
                void *user_data);
 
+/**
+ * @brief Called when the frame component becomes visible.
+ * @since_tizen 5.5
+ * @remarks The @a context should not be released. The @a context can be used only in the callback.
+ *
+ * @param[in]   context         The context of the frame component instance
+ * @param[in]   user_data       The user data passed from component_based_app_add_frame_component() function
+ */
 typedef void (*frame_component_resume_cb)(
-               component_h component,
+               component_h context,
                void *user_data);
 
+/**
+ * @brief Called when the frame component becomes invisible.
+ * @since_tizen 5.5
+ * @remarks The @a context should not be released. The @a context can be used only in the callback.
+ *
+ * @param[in]   context         The context of the frame component instance
+ * @param[in]   user_data       The user data passed from component_based_app_add_frame_component() function
+ */
 typedef void (*frame_component_pause_cb)(
-               component_h component,
+               component_h context,
                void *user_data);
 
+/**
+ * @brief Called before the frame component instance is stopped.
+ * @since_tizen 5.5
+ * @remarks The @a context should not be released. The @a context can be used only in the callback.
+ *
+ * @param[in]   context         The context of the frame component instance
+ * @param[in]   user_data       The user data passed from component_based_app_add_frame_component() function
+ */
 typedef void (*frame_component_stop_cb)(
-               component_h component,
+               component_h context,
                void *user_data);
 
+/**
+ * @brief Called before the frame component instance is destroyed.
+ * @since_tizen 5.5
+ * @remarks The @a context should not be released. The @a context can be used only in the callback.
+ *
+ * @param[in]   context         The context of the frame component instance
+ * @param[in]   user_data       The user data passed from component_based_app_add_frame_component() function
+ */
 typedef void (*frame_component_destroy_cb)(
-               component_h component,
+               component_h context,
                void *user_data);
 
+/**
+ * @brief Called after the content information of the frame component instance is restored.
+ * @since_tizen 5.5
+ * @reamrks The @a content should not be released. The @a content can be used only in the callback.
+ *          To use outside, make a copy using bundle_dup().
+ *
+ * @param[in]   context         The context of the frame component instance
+ * @param[in]   content         The content information
+ * @param[in]   user_data       The user data passed from component_based_app_add_frame_component() function
+ */
 typedef void (*frame_component_restore_content_cb)(
-               component_h component,
+               component_h context,
                bundle *content,
                void *user_data);
 
+/**
+ * @brief Called before the content information of the frame component instance is saved.
+ * @since_tizen 5.5
+ * @reamrks The @a content should not be released. The @a content can be used only in the callback.
+ *          To use outside, make a copy using bundle_dup().
+ *
+ * @param[in]   context         The context of the frame component instance
+ * @param[in]   content         The content information
+ * @param[in]   user_data       The user data passed from component_based_app_add_frame_component() function
+ */
 typedef void (*frame_component_save_content_cb)(
-               component_h component,
+               component_h context,
                bundle *content,
                void *user_data);
 
+/**
+ * @brief Called when another application sends a launch request to the component.
+ * @details Before calling frame_component_start_cb(), this callback function is called.
+ * @since_tizen 5.5
+ * @remarks After this callback function returns, the handle of the app_control is released.
+ *          Therefore, if you want to use the handle after returning this callback function, you MUST copy it by using app_control_clone() function.
+ * @remarks The @a action must not be deallocated by the component. The @a action is managed by the platform and will be released when the app_control action is unregistered.
+ * @remarks The @a context should not be released. The @a context can be used only in the callback.
+ * @remarks The @a app_control should not be released. The @a app_control can be used only in the callback.
+ *          To use outside, make a copy using app_control_clone().
+ *
+ * @param[in]   context         The context of the frame component instance
+ * @param[in]   action          The name of the app_control action
+ * @param[in]   app_control     The handle of the app_control
+ * @param[in]   user_data       The user data passed from component_based_app_add_frame_component() function
+ * @see component_register_action()
+ * @see component_deregister_action()
+ */
 typedef void (*frame_component_action_cb)(
-               component_h component,
+               component_h context,
                const char *action,
                app_control_h app_control,
                void *user_data);
 
+/**
+ * @brief Called when the device orientation is changed.
+ * @since_tizen 5.5
+ * @remarks The @a context should not be released. The @a context can be used only in the callback.
+ *
+ * @param[in]   context         The context of the frame component instance
+ * @param[in]   orientation     The device orientation
+ * @param[in]   user_data       The user data passed from component_based_app_add_frame_component() function
+ */
 typedef void (*frame_component_device_orientation_changed_cb)(
-               component_h component,
+               component_h context,
                component_device_orientation_e orientation,
                void *user_data);
 
+/**
+ * @brief Called when the system language is changed.
+ * @since_tizen 5.5
+ * @remarks The @a context should not be released. The @a context can be used only in the callback.
+ * @remarks The @a language must not be deallocated by the component. The @a language can be used only in the callback.
+ *
+ * @param[in]   context         The context of the frame component instance
+ * @param[in]   language        The language
+ * @param[in]   user_data       The user data passed from component_based_app_add_frame_component() function
+ */
 typedef void (*frame_component_language_changed_cb)(
-               component_h component,
+               component_h context,
                const char *language,
                void *user_data);
 
+/**
+ * @brief Called when the system region format is changed.
+ * @since_tizen 5.5
+ * @remarks The @a context should not be released. The @a context can be used only in the callback.
+ * @remarks The @a region must not be deallocated by the component. The @a region can be used only in the callback.
+ *
+ * @param[in]   context         The context of the frame component instance
+ * @param[in]   region          The region format
+ * @param[in]   user_data       The user data passed from component_based_app_add_frame_component() function
+ */
 typedef void (*frame_component_region_format_changed_cb)(
-               component_h component,
+               component_h context,
                const char *region,
                void *user_data);
 
+/**
+ * @brief Called when the battery status is changed.
+ * @since_tizen 5.5
+ * @remarks The @a context should not be released. The @a context can be used only in the callback.
+ *
+ * @param[in]   context         The context of the frame component instance
+ * @param[in]   status          The low battery status
+ * @param[in]   user_data       The user data passed from component_based_app_add_frame_component() function
+ */
 typedef void (*frame_component_low_battery_cb)(
-               component_h component,
+               component_h context,
                component_low_battery_status_e status,
                void *user_data);
 
+/**
+ * @brief Called when the memory status is changed.
+ * @since_tizen 5.5
+ * @remarks The @a context should not be released. The @a context can be used only in the callback.
+ *
+ * @param[in]   context         The context of the frame component instance
+ * @param[in]   status          The low memory status
+ * @param[in]   user_data       The user data passed from component_based_app_add_frame_component() function
+ */
 typedef void (*frame_component_low_memory_cb)(
-               component_h component,
+               component_h context,
                component_low_memory_status_e status,
                void *user_data);
 
+/**
+ * @brief Called when the suspended state of the frame component is changed.
+ * @since_tizen 5.5
+ * @remarks The @a context should not be released. The @a context can be used only in the callback.
+ *
+ * @param[in]   context         The context of the frame component instance
+ * @param[in]   state           The suspended state
+ * @param[in]   user_data       The user data passed from component_based_app_add_frame_component() function
+ */
 typedef void (*frame_component_suspended_state_changed_cb)(
-               component_h component,
+               component_h context,
                component_suspended_state_e state,
                void *user_data);
 
+/**
+ * @brief The structure type containing the set of callback functions for lifecycle of a frame component instance.
+ * @since_tizen 5.5
+ */
 typedef struct {
-       frame_component_create_cb create;
-       frame_component_start_cb start;
-       frame_component_resume_cb resume;
-       frame_component_pause_cb pause;
-       frame_component_stop_cb stop;
-       frame_component_destroy_cb destroy;
-       frame_component_restore_content_cb restore_content;
-       frame_component_save_content_cb save_content;
-       frame_component_action_cb action;
-       frame_component_device_orientation_changed_cb device_orientation_changed;
-       frame_component_language_changed_cb language_changed;
-       frame_component_region_format_changed_cb region_format_changed;
-       frame_component_low_battery_cb low_battery;
-       frame_component_low_memory_cb low_memory;
-       frame_component_suspended_state_changed_cb suspended_state_changed;
+       frame_component_create_cb create; /**< The callback function called after the frame component instance is created. */
+       frame_component_start_cb start; /**< The callback function called when the frame component instance is started. */
+       frame_component_resume_cb resume; /**< The callback function called when the frame component becomes visible. */
+       frame_component_pause_cb pause; /**< The callback function called when the frame component becomes invisible. */
+       frame_component_stop_cb stop; /**< The callback function called before the frame component instance is stopped. */
+       frame_component_destroy_cb destroy; /**< The callback function called before the frame component instance is destroyed. */
+       frame_component_restore_content_cb restore_content; /**< The callback function called when the content information of the frame component instance is restored. */
+       frame_component_save_content_cb save_content; /**< The callback function called before the content information of the frame component instance is saved. */
+       frame_component_action_cb action; /**< The callback function called when another application sends a launch request to the component. */
+       frame_component_device_orientation_changed_cb device_orientation_changed; /**< The callback function called when the device orientation is changed. */
+       frame_component_language_changed_cb language_changed; /**< The callback function called when the system language is changed */
+       frame_component_region_format_changed_cb region_format_changed; /**< The callback function called when the system region format is changed */
+       frame_component_low_battery_cb low_battery; /**< The callback function called when the battery status is changed. */
+       frame_component_low_memory_cb low_memory; /**< The callback function called when the memory status is changed */
+       frame_component_suspended_state_changed_cb suspended_state_changed; /**< The callback function called when the suspended state of the frame component is changed */
 } frame_component_lifecycle_callback_s;
 
-int frame_component_get_lcd_status(component_h component,
-               component_lcd_status_e *lcd_status);
+/**
+ * @brief Gets the display status.
+ * @since_tizen 5.5
+ *
+ * @param[in]   context         The context of the frame component instance
+ * @param[out]  display_status  The display status
+ *
+ * @return      @c 0 on success,
+ *              otherwise a negative error value
+ * @retval #COMPONENT_ERROR_NONE Successful
+ * @retval #COMPONENT_ERROR_NOT_SUPPORTED Not supported
+ * @retval #COMPONENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #COMPONENT_ERROR_INVALID_CONTEXT The display is in an unknown state.
+ */
+int frame_component_get_display_status(component_h context,
+               component_display_status_e *display_status);
 
-int frame_component_get_window(component_h component,
+/**
+ * @brief Gets an Evas object for the frame component.
+ * @since_tizen 5.5
+ * @remarks The @c window MUST NOT be released using evas_object_del().
+ *          The platform frees window when the frame component instance is destroyed.
+ *
+ * @param[in]   context         The context of the frame component instance
+ * @param[out]  window          The evas object for window
+ *
+ * @return      @c 0 on success,
+ *              otherwise a negative error value
+ * @retval #COMPONENT_ERROR_NONE Successful
+ * @retval #COMPONENT_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int frame_component_get_window(component_h context,
                Evas_Object **window);
 
+
+/**
+ * @}
+ */
+
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* CAPI_COMPONENT_BASED_FRAME_COMPONENT_H_ */
+#endif /* __TIZEN_COMPONENT_BASED_FRAME_COMPONENT_H__ */
 
index 03c280274bdd489cbc897ae429945b1dd3061460..68c069df11b8662e89895197ac77d1635b56dd38 100644 (file)
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#ifndef CAPI_COMPONENT_BASED_SERVICE_COMPONENT_H_
-#define CAPI_COMPONENT_BASED_SERVICE_COMPONENT_H_
+#ifndef __TIZEN_COMPONENT_BASED_SERVICE_COMPONENT_H__
+#define __TIZEN_COMPONENT_BASED_SERVICE_COMPONENT_H__
 
 #include <stdbool.h>
 
 extern "C" {
 #endif
 
+/**
+ * @addtogroup COMPONENT_BASED_SERVICE_COMPONENT_MODULE
+ * @{
+ */
+
+
+/**
+ * @brief Called when the service component instance is created.
+ * @since_tizen 5.5
+ * @remarks The @a context should not be released. The @a context can be used only in the callback.
+ *
+ * @param[in]   context         The context of the service component instance
+ * @param[in]   user_data       The user data passed from component_based_app_add_service_component() function
+ *
+ * @return      @c true on success,
+ *              otherwise @c false on failure.
+ */
 typedef bool(*service_component_create_cb)(
-               component_h component,
+               component_h context,
                void *user_data);
 
+/**
+ * @brief Called when the service component instance is started.
+ * @since_tizen 5.5
+ * @remarks The @a context should not be released. The @a context can be used only in the callback.
+ * @reamrks The @a app_control should not be released. The @a app_control can be used only in the callback.
+ *          To use outside, make a copy using app_control_clone().
+ *
+ * @param[in]   context         The context of the service component instance
+ * @param[in]   app_control     The app control handle
+ * @param[in]   restarted       @c true, if the instance is restarted
+ * @param[in]   user_data       The user data passed from component_based_app_add_service_component() function
+ */
 typedef void (*service_component_start_command_cb)(
-               component_h component,
+               component_h context,
                app_control_h app_control,
                bool restarted,
                void *user_data);
 
+/**
+ * @brief Called before the service component instance is destroyed.
+ * @since_tizen 5.5
+ * @remarks The @a context should not be released. The @a context can be used only in the callback.
+ *
+ * @param[in]   context         The context of the service component instance
+ * @param[in]   user_data       The user data passed from component_based_app_add_service_component() function
+ */
 typedef void (*service_component_destroy_cb)(
-               component_h component,
+               component_h context,
                void *user_data);
 
+/**
+ * @brief Called after the content information of the service component instance is restored.
+ * @since_tizen 5.5
+ * @reamrks The @a content should not be released. The @a content can be used only in the callback.
+ *          To use outside, make a copy using bundle_dup().
+ *
+ * @param[in]   context         The context of the service component instance
+ * @param[in]   content         The content information
+ * @param[in]   user_data       The user data passed from component_based_app_add_service_component() function
+ */
 typedef void (*service_component_restore_content_cb)(
-               component_h component,
+               component_h context,
                bundle *content,
                void *user_data);
 
+/**
+ * @brief Called before the content information of the service component instance is saved.
+ * @since_tizen 5.5
+ * @reamrks The @a content should not be released. The @a content can be used only in the callback.
+ *          To use outside, make a copy using bundle_dup().
+ *
+ * @param[in]   context         The context of the service component instance
+ * @param[in]   content         The content information
+ * @param[in]   user_data       The user data passed from component_based_app_add_service_component() function
+ */
 typedef void (*service_component_save_content_cb)(
-               component_h component,
+               component_h context,
                bundle *content,
                void *user_data);
 
+/**
+ * @brief Called when another application sends a launch request to the component.
+ * @details Before calling service_component_start_command_cb(), this callback function is called.
+ * @since_tizen 5.5
+ * @remarks After this callback function returns, the handler of the app_control is released.
+ *          Therefore, if you want to use the handle after returning this callback function, you MUST copy it by using app_control_clone() function.
+ * @remarks The @a action must not be deallocated by the component. The @a action is managed by the platform and will be released when the app_control action is unregistered.
+ * @remarks The @a context should not be released. The @a context can be used only in the callback.
+ * @reamrks The @a app_control should not be released. The @a app_control can be used only in the callback.
+ *          To use outside, make a copy using app_control_clone().
+ *
+ * @param[in]   context         The context of the service component instance
+ * @param[in]   action          The name of the app_control action
+ * @param[in]   app_control     The handle of the app_control
+ * @param[in]   user_data       The user data passed from component_based_app_add_service_component() function
+ * @see service_component_register_action()
+ * @see service_component_deregister_action()
+ */
 typedef void (*service_component_action_cb)(
-               component_h component,
+               component_h context,
                const char *action,
                app_control_h app_control,
                void *user_data);
 
+/**
+ * @brief Called when the device orientation is changed.
+ * @since_tizen 5.5
+ * @remarks The @a context should not be released. The @a context can be used only in the callback.
+ *
+ * @param[in]   context         The context of the service component instance
+ * @param[in]   orientation     The device orientation
+ * @param[in]   user_data       The user data passed from component_based_app_add_service_component() function
+ */
 typedef void (*service_component_device_orientation_changed_cb)(
-               component_h component,
+               component_h context,
                component_device_orientation_e orientation,
                void *user_data);
 
+/**
+ * @brief Called when the system language is changed.
+ * @since_tizen 5.5
+ * @remarks The @a context should not be released. The @a context can be used only in the callback.
+ * @remarks The @a language must not be deallocated by the component. The @a language can be used only in the callback.
+ *
+ * @param[in]   context         The context of the service component instance
+ * @param[in]   language        The langauge
+ * @param[in]   user_data       The user data passed from component_based_app_add_service_component() function
+ */
 typedef void (*service_component_language_changed_cb)(
-               component_h component,
+               component_h context,
                const char *language,
                void *user_data);
 
+/**
+ * @brief Called when the system region format is changed.
+ * @since_tizen 5.5
+ * @remarks The @a context should not be released. The @a context can be used only in the callback.
+ * @remarks The @a region must not be deallocated by the component. The @a region can be used only in the callback.
+ *
+ * @param[in]   context         The context of the service component instance
+ * @param[in]   region          The region format
+ * @param[in]   user_data       The user data passed from component_based_app_add_service_component() function
+ */
 typedef void (*service_component_region_format_changed_cb)(
-               component_h component,
+               component_h context,
                const char *region,
                void *user_data);
 
+/**
+ * @brief Called when the battery status is changed.
+ * @since_tizen 5.5
+ * @remarks The @a context should not be released. The @a context can be used only in the callback.
+ *
+ * @param[in]   context         The context of the service component instance
+ * @param[in]   status          The low battery status
+ * @param[in]   user_data       The user data passed from component_based_app_add_service_component() function
+ */
 typedef void (*service_component_low_battery_cb)(
-               component_h component,
+               component_h context,
                component_low_battery_status_e status,
                void *user_data);
 
+/**
+ * @brief Called when the memory status is changed.
+ * @since_tizen 5.5
+ * @remarks The @a context should not be released. The @a context can be used only in the callback.
+ *
+ * @param[in]   context         The context of the service component instance
+ * @param[in]   status          The low memory status
+ * @param[in]   user_data       The user data passed from component_based_app_add_service_component() function
+ */
 typedef void (*service_component_low_memory_cb)(
-               component_h component,
+               component_h context,
                component_low_memory_status_e status,
                void *user_data);
 
+/**
+ * @brief Called when the suspended state of the service component is changed.
+ * @since_tizen 5.5
+ * @remarks The @a context should not be released. The @a context can be used only in the callback.
+ *
+ * @param[in]   context         The context of the service component instance
+ * @param[in]   state           The suspended state
+ * @param[in]   user_data       The user data passed from component_based_app_add_service_component() function
+ */
 typedef void (*service_component_suspended_state_changed_cb)(
-               component_h component,
+               component_h context,
                component_suspended_state_e state,
                void *user_data);
 
+/**
+ * @brief The structure type containing the set of callback functions for lifecycle of a service component instance.
+ * @since_tizen 5.5
+ */
 typedef struct {
-       service_component_create_cb create;
-       service_component_start_command_cb start_command;
-       service_component_destroy_cb destroy;
-       service_component_restore_content_cb restore_content;
-       service_component_save_content_cb save_content;
-       service_component_action_cb action;
-       service_component_device_orientation_changed_cb device_orientation_changed;
-       service_component_language_changed_cb language_changed;
-       service_component_region_format_changed_cb region_format_changed;
-       service_component_low_battery_cb low_battery;
-       service_component_low_memory_cb low_memory;
-       service_component_suspended_state_changed_cb suspended_state_changed;
+       service_component_create_cb create; /**< The callback function called after the service component instance is created. */
+       service_component_start_command_cb start_command; /**< The callback function called when the service component instance is started. */
+       service_component_destroy_cb destroy; /**< The callback function called before the service component instance is destroyed. */
+       service_component_restore_content_cb restore_content; /**< The callback function called when the content inforamtion of the service component instance is restored. */
+       service_component_save_content_cb save_content; /**< The callback function called before the content information of the service component instance is saved. */
+       service_component_action_cb action; /**< The callback function called when another application sends a launch request to the component. */
+       service_component_device_orientation_changed_cb device_orientation_changed; /**< The callback function called when the device orientation is changed. */
+       service_component_language_changed_cb language_changed; /**< The callback function called when the system language is changed */
+       service_component_region_format_changed_cb region_format_changed; /**< The callback function called when the system region format is changed */
+       service_component_low_battery_cb low_battery; /**< The callback function called when the battery status is changed. */
+       service_component_low_memory_cb low_memory; /**< The callback function called when the memory status is changed */
+       service_component_suspended_state_changed_cb suspended_state_changed; /**< The callback function called when the suspended state of the service component is changed */
 } service_component_lifecycle_callback_s;
 
+
+/**
+ * @}
+ */
+
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* CAPI_COMPONENT_BASED_SERVICE_COMPONENT_H_ */
+#endif /* __TIZEN_COMPONENT_BASED_SERVICE_COMPONENT_H__ */
index ae6e3d7618825011e8cc8a31ce0d549faca83e2a..788187b17e46f053acb317c0fd99920af5b91ba7 100644 (file)
@@ -512,15 +512,15 @@ component_based_app_add_service_component(
   return comp_class;
 }
 
-extern "C" EXPORT_API int component_get_id(component_h h,
+extern "C" EXPORT_API int component_get_id(component_h context,
     char** id) {
-  if (h == nullptr || id == nullptr) {
+  if (context == nullptr || id == nullptr) {
     LOGE("Invalid parameter");
     return COMPONENT_ERROR_INVALID_PARAMETER;
   }
 
   component_based::Component* component =
-      static_cast<component_based::Component*>(h);
+      static_cast<component_based::Component*>(context);
   *id = strdup(component->GetComponentID().c_str());
   if (*id == nullptr) {
     LOGE("Out of memory");
@@ -530,15 +530,15 @@ extern "C" EXPORT_API int component_get_id(component_h h,
   return COMPONENT_ERROR_NONE;
 }
 
-extern "C" EXPORT_API int component_get_instance_id(component_h h,
+extern "C" EXPORT_API int component_get_instance_id(component_h context,
     char** instance_id) {
-  if (h == nullptr || instance_id == nullptr) {
+  if (context == nullptr || instance_id == nullptr) {
     LOGE("Invalid parameter");
     return COMPONENT_ERROR_INVALID_PARAMETER;
   }
 
   component_based::Component* component =
-      static_cast<component_based::Component*>(h);
+      static_cast<component_based::Component*>(context);
   *instance_id = strdup(component->GetInstanceID().c_str());
   if (*instance_id == nullptr) {
     LOGE("Out of memory");
@@ -548,15 +548,15 @@ extern "C" EXPORT_API int component_get_instance_id(component_h h,
   return COMPONENT_ERROR_NONE;
 }
 
-extern "C" EXPORT_API int component_register_action(component_h h,
+extern "C" EXPORT_API int component_register_action(component_h context,
     const char* action) {
-  if (h == nullptr || action == nullptr) {
+  if (context == nullptr || action == nullptr) {
     LOGE("Invalid parameter");
     return COMPONENT_ERROR_INVALID_PARAMETER;
   }
 
   component_based::Component* component =
-      static_cast<component_based::Component*>(h);
+      static_cast<component_based::Component*>(context);
   try {
     component->RegisterAction(action);
   } catch (component_based::Exception& ex) {
@@ -568,14 +568,14 @@ extern "C" EXPORT_API int component_register_action(component_h h,
 }
 
 extern "C" EXPORT_API int component_deregister_action(
-    component_h h, const char* action) {
-  if (h == nullptr || action == nullptr) {
+    component_h context, const char* action) {
+  if (context == nullptr || action == nullptr) {
     LOGE("Invalid parameter");
     return COMPONENT_ERROR_INVALID_PARAMETER;
   }
 
   component_based::Component* component =
-      static_cast<component_based::Component*>(h);
+      static_cast<component_based::Component*>(context);
   if (!component->DeregisterAction(action)) {
     LOGE("Deregister fail");
     return COMPONENT_ERROR_INVALID_PARAMETER;
@@ -647,18 +647,18 @@ static int __app_control_send_launch_request_sync(
 }
 
 extern "C" EXPORT_API int component_send_launch_request_async(
-    component_h h,
+    component_h context,
     app_control_h app_control,
     app_control_result_cb result_cb,
     app_control_reply_cb reply_cb,
     void* user_data) {
-  if (h == nullptr || app_control == nullptr || result_cb == nullptr) {
+  if (context == nullptr || app_control == nullptr || result_cb == nullptr) {
     LOGE("Invalid parameter");
     return COMPONENT_ERROR_INVALID_PARAMETER;
   }
 
   component_based::Component* component =
-      static_cast<component_based::Component*>(h);
+      static_cast<component_based::Component*>(context);
   int r = __app_control_send_launch_request_async(
       component->GetInstanceID().c_str(), app_control, result_cb, reply_cb,
       user_data);
@@ -671,17 +671,17 @@ extern "C" EXPORT_API int component_send_launch_request_async(
 }
 
 extern "C" EXPORT_API int component_send_launch_request_sync(
-    component_h h,
+    component_h context,
     app_control_h app_control,
     app_control_h* reply, app_control_result_e* result) {
-  if (h == nullptr || app_control == nullptr || reply == nullptr ||
+  if (context == nullptr || app_control == nullptr || reply == nullptr ||
       result == nullptr) {
     LOGE("Invalid parameter");
     return COMPONENT_ERROR_INVALID_PARAMETER;
   }
 
   component_based::Component* component =
-      static_cast<component_based::Component*>(h);
+      static_cast<component_based::Component*>(context);
   int r = __app_control_send_launch_request_sync(
       component->GetInstanceID().c_str(), app_control, reply, result);
   if (r != COMPONENT_ERROR_NONE) {
@@ -692,61 +692,62 @@ extern "C" EXPORT_API int component_send_launch_request_sync(
   return COMPONENT_ERROR_NONE;
 }
 
-extern "C" EXPORT_API int component_finish(component_h h) {
-  if (h == nullptr) {
+extern "C" EXPORT_API int component_finish(component_h context) {
+  if (context == nullptr) {
     LOGE("Invalid parameter");
     return COMPONENT_ERROR_INVALID_PARAMETER;
   }
 
-  ::StubFrameComponent* component = static_cast<::StubFrameComponent*>(h);
+  ::StubFrameComponent* component = static_cast<::StubFrameComponent*>(context);
   component->Finish();
 
   return COMPONENT_ERROR_NONE;
 }
 
-extern "C" EXPORT_API int frame_component_get_lcd_status(
-    component_h h, component_lcd_status_e* lcd_status) {
-  if (h == nullptr || lcd_status == nullptr) {
+extern "C" EXPORT_API int frame_component_get_display_status(
+    component_h context, component_display_status_e* display_status) {
+  if (context == nullptr || display_status == nullptr) {
     LOGE("Invalid parameter");
     return COMPONENT_ERROR_INVALID_PARAMETER;
   }
 
   component_based::Component* component =
-      static_cast<component_based::Component*>(h);
+      static_cast<component_based::Component*>(context);
   if (component->GetType() != component_based::Component::Type::Frame) {
     LOGE("Invalid parameter");
     return COMPONENT_ERROR_INVALID_PARAMETER;
   }
 
   ::StubFrameComponent* frame_component =
-    static_cast<::StubFrameComponent*>(h);
-  auto status = frame_component->GetLCDStatus();
-  if (status == component_based::FrameComponent::LCDStatus::Unknown) {
-    LOGE("Invalid h");
+    static_cast<::StubFrameComponent*>(context);
+  auto status = frame_component->GetDisplayStatus();
+  if (status == component_based::FrameComponent::DisplayStatus::Unknown) {
+    LOGE("Invalid context");
     return COMPONENT_ERROR_INVALID_CONTEXT;
   }
 
-  *lcd_status = static_cast<component_lcd_status_e>(status);
+  *display_status = static_cast<component_display_status_e>(status);
 
   return COMPONENT_ERROR_NONE;
 }
 
 extern "C" EXPORT_API int frame_component_get_window(
-    component_h h, Evas_Object** window) {
-  if (h == nullptr || window == nullptr) {
+    component_h context,
+    Evas_Object** window) {
+  if (context == nullptr || window == nullptr) {
     LOGE("Invalid parameter");
     return COMPONENT_ERROR_INVALID_PARAMETER;
   }
 
   component_based::Component* component =
-      static_cast<component_based::Component*>(h);
+      static_cast<component_based::Component*>(context);
   if (component->GetType() != component_based::Component::Type::Frame) {
     LOGE("Invalid parameter");
     return COMPONENT_ERROR_INVALID_PARAMETER;
   }
 
   ::StubFrameComponent* frame_component =
-      static_cast<::StubFrameComponent*>(h);
+      static_cast<::StubFrameComponent*>(context);
   const component_based::ElmWindow* win =
       static_cast<const component_based::ElmWindow*>(
           frame_component->GetWindow());
diff --git a/doc/appfw_component_based_application_doc.h b/doc/appfw_component_based_application_doc.h
new file mode 100755 (executable)
index 0000000..02984be
--- /dev/null
@@ -0,0 +1,256 @@
+/*
+ * Copyright (c) 2019 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_COMPONENT_BASED_APPLICATION_DOC_H__
+#define __TIZEN_APPFW_COMPONENT_BASED_APPLICATION_DOC_H__
+
+/**
+ * @defgroup COMPONENT_BASED_APPLICATION_MODULE Component Based Application
+ * @ingroup CAPI_APPLICATION_FRAMEWORK
+ * @brief Component based application API.
+ *
+ * @section COMPONENT_BASED_APPLICATION_MODULE_HEADER Required Header
+ * \#include <component_based_app.h>
+ *
+ * @section COMPONENT_BASED_APPLICATION_MODULE_OVERVIEW Overview
+ * The @ref COMPONENT_BASED_APPLICATION_MODULE API provides functions for starting and exiting Tizen component based application. Tizen component based application can consist of frame_component and service_component.
+ * This API supports making multiple frame_components and service_components per an application.
+ *
+ * @subsection COMPONENT_BASED_APPLICATION_MODULE_STATE_CHANGE_EVENT Registering Callbacks for Application State Change Events
+ * As for Tizen component based application states, it is very simple and somewhat similar to Tizen widget application states.
+ * <p>
+ * <table>
+ * <tr>
+ *   <th> Callback </th>
+ *   <th> Description </th>
+ * </tr>
+ * <tr>
+ *   <td> component_based_app_create_cb() </td>
+ *   <td> The callback function is called before the main loop of the application starts.
+ *   In this callback, you can initialize resources which can be shared among component instances.
+ *   This function should return the handle for component class so that it will be used for making instances of component.
+ *   </td>
+ * </tr>
+ * <tr>
+ *   <td> component_based_app_terminate_cb() </td>
+ *   <td> This callback function is called once after the main loop of the application exits.
+ *   You should release the resources of the application in this function.
+ *   </td>
+ * </tr>
+ * </table>
+ * </p>
+ */
+
+/**
+ * @defgroup COMPONENT_BASED_COMPONENT_COMMON_MODULE Component Based Common
+ * @ingroup COMPONENT_BASED_APPLICATION_MODULE
+ * @brief The @ref COMPONENT_BASED_COMPONENT_COMMON_MODULE Registering action for Application Control and Launching request for Application Control.
+ *
+ * @section COMPONENT_BASED_COMPONENT_COMMON_MODULE_HEADER Required Header
+ *   \#include <component_common.h>
+ *
+ * @section COMPONENT_BASED_COMPONENT_COMMON_MODULE_OVERVIEW Overview
+ * The @ref COMPONENT_BASED_COMPONENT_COMMON_MODULE API provides functions for registering and deregistering action for app-control and provides functions for launching request with the app-control synchronous or asynchronous.
+ */
+
+/**
+ * @defgroup COMPONENT_BASED_FRAME_COMPONENT_MODULE Frame Component
+ * @ingroup COMPONENT_BASED_APPLICATION_MODULE
+ * @brief The @ref COMPONENT_BASED_FRAME_COMPONENT_MODULE API provides functions for handling Frame Component state changes or system events, and get information about the Frame Component
+ *
+ * @section COMPONENT_BASED_FRAME_COMPONENT_MODULE_HEADER Required Header
+ *   \#include <frame_component.h>
+ *
+ * @section COMPONENT_BASED_FRAME_COMPONENT_MODULE_OVERVIEW Overview
+ * The @ref COMPONENT_BASED_FRAME_COMPONENT_MODULE API provides functions for handling Frame Component of Component Based Application state changes or system events.
+ *
+ * @subsection COMPONENT_BASED_FRAME_COMPONENT_MODULE_STATE_CHANGE_EVENT Registering Callbacks for Frame Component State Change Events
+ * The frame component state change events include the following:
+ * <p>
+ * <table>
+ * <tr>
+ *  <th> State </th>
+ *  <th> Description </th>
+ * </tr>
+ * <tr>
+ *  <td> frame_component_create_cb() </td>
+ *  <td> The callback function called after the frame component instance is created.
+ * </td>
+ * </tr>
+ * <tr>
+ *  <td> frame_component_start_cb() </td>
+ *  <td> The callback function called when the frame component instance is started.
+ * </td>
+ * </tr>
+ * <tr>
+ *  <td> frame_component_resume_cb() </td>
+ *  <td> The callback function called when the frame component becomes visible.
+ *  </td>
+ * </tr>
+ * <tr>
+ *  <td> frame_component_pause_cb() </td>
+ *  <td> The callback function called when the frame component becomes invisible.
+ *  </td>
+ * </tr>
+ * <tr>
+ *  <td> frame_component_stop_cb() </td>
+ *  <td> The callback function called before the frame component instance is stopped.
+ *  </td>
+ * </tr>
+ * <tr>
+ *  <td> frame_component_destroy_cb() </td>
+ *  <td> The callback function called before the frame component instance is destroyed.
+ *  </td>
+ * </tr>
+ * <tr>
+ *  <td> frame_component_restore_content_cb() </td>
+ *  <td> The callback function called when the content information of the frame component instance is restored.
+ *  </td>
+ * </tr>
+ * <tr>
+ *  <td> frame_component_save_content_cb() </td>
+ *  <td> The callback function called before the content information of the frame component instance is saved.
+ *  </td>
+ * </tr>
+ * <tr>
+ *  <td> frame_component_action_cb() </td>
+ *  <td> The callback function called when another application sends a launch request to the component.
+ *  </td>
+ * </tr>
+ * <tr>
+ *  <td> frame_component_device_orientation_changed_cb() </td>
+ *  <td> The callback function called when the device orientation is changed.
+ *  </td>
+ * </tr>
+ * <tr>
+ *  <td> frame_component_language_changed_cb() </td>
+ *  <td> The callback function called when the system language is changed.
+ *  </td>
+ * </tr>
+ * <tr>
+ *  <td> frame_component_region_format_changed_cb() </td>
+ *  <td> The callback function called when the system region format is changed.
+ *  </td>
+ * </tr>
+ * <tr>
+ *  <td> frame_component_low_battery_cb() </td>
+ *  <td> The callback function called when the battery status is changed.
+ *  </td>
+ * </tr>
+ * <tr>
+ *  <td> frame_component_low_memory_cb() </td>
+ *  <td> The callback function called when the memory status is changed.
+ *  </td>
+ * </tr>
+ * <tr>
+ *  <td> frame_component_suspended_state_changed_cb() </td>
+ *  <td> The callback function called when the suspended state of the frame component is changed.
+ *  </td>
+ * </tr>
+ * </table>
+ * </p>
+ * Please refer to the following state diagram to see the possible transitions and callbacks that are called while transition.
+ *
+ * @image html frame_component_lifecycle.png "Frame Component States"
+ */
+
+/**
+ * @defgroup COMPONENT_BASED_SERVICE_COMPONENT_MODULE Service Component
+ * @ingroup COMPONENT_BASED_APPLICATION_MODULE
+ * @brief The @ref COMPONENT_BASED_SERVICE_COMPONENT_MODULE API provides functions for handling Service Component state changes or system events.
+ *
+ * @section COMPONENT_BASED_SERVICE_COMPONENT_MODULE_HEADER Required Header
+ *   \#include <service_component.h>
+ *
+ * @section COMPONENT_BASED_SERVICE_COMPONENT_MODULE_OVERVIEW Overview
+ * The @ref COMPONENT_BASED_SERVICE_COMPONENT_MODULE API provides functions for handling Service Component of Component Based Application state changes or system events.
+ *
+ * @subsection COMPONENT_BASED_SERVICE_COMPONENT_MODULE_STATE_CHANGE_EVENT Registering Callbacks for Service Component State Change Events
+ * The service component state change events include the following:
+ * <p>
+ * <table>
+ * <tr>
+ *  <th> State </th>
+ *  <th> Description </th>
+ * </tr>
+ * <tr>
+ *  <td> service_component_create_cb() </td>
+ *  <td> The callback function called after the service component instance is created.
+ * </td>
+ * </tr>
+ * <tr>
+ *  <td> service_component_start_command_cb() </td>
+ *  <td> The callback function called when the service component instance is started.
+ * </td>
+ * </tr>
+ * <tr>
+ *  <td> service_component_destroy_cb() </td>
+ *  <td> The callback function called before the service component instance is destroyed.
+ *  </td>
+ * </tr>
+ * <tr>
+ *  <td> service_component_restore_content_cb() </td>
+ *  <td> The callback function called when the content information of the service component instance is restored.
+ *  </td>
+ * </tr>
+ * <tr>
+ *  <td> service_component_save_content_cb() </td>
+ *  <td> The callback function called before the content information of the service component instance is saved.
+ *  </td>
+ * </tr>
+ * <tr>
+ *  <td> service_component_action_cb() </td>
+ *  <td> The callback function called when another application sends a launch request to the component.
+ *  </td>
+ * </tr>
+ * <tr>
+ *  <td> service_component_device_orientation_changed_cb() </td>
+ *  <td> The callback function called when the device orientation is changed.
+ *  </td>
+ * </tr>
+ * <tr>
+ *  <td> service_component_language_changed_cb() </td>
+ *  <td> The callback function called when the system language is changed.
+ *  </td>
+ * </tr>
+ * <tr>
+ *  <td> service_component_region_format_changed_cb() </td>
+ *  <td> The callback function called when the system region format is changed.
+ *  </td>
+ * </tr>
+ * <tr>
+ *  <td> service_component_low_battery_cb() </td>
+ *  <td> The callback function called when the battery status is changed.
+ *  </td>
+ * </tr>
+ * <tr>
+ *  <td> service_component_low_memory_cb() </td>
+ *  <td> The callback function called when the memory status is changed.
+ *  </td>
+ * </tr>
+ * <tr>
+ *  <td> service_component_suspended_state_changed_cb() </td>
+ *  <td> The callback function called when the suspended state of the service component is changed.
+ *  </td>
+ * </tr>
+ * </table>
+ * </p>
+ * Please refer to the following state diagram to see the possible transitions and callbacks that are called while transition.
+ *
+ * @image html service_component_lifecycle.png "Service Component States"
+ */
+
+#endif /* __TIZEN_APPFW_COMPONENT_BASED_APPLICATION_DOC_H__ */
diff --git a/doc/images/frame_component_lifecycle.png b/doc/images/frame_component_lifecycle.png
new file mode 100755 (executable)
index 0000000..1721406
Binary files /dev/null and b/doc/images/frame_component_lifecycle.png differ
diff --git a/doc/images/service_component_lifecycle.png b/doc/images/service_component_lifecycle.png
new file mode 100755 (executable)
index 0000000..c5a1f98
Binary files /dev/null and b/doc/images/service_component_lifecycle.png differ
index fbc2f961e7d76de4eda72ce5fc627b986aee0771..7454e34ad5ca9f0999555f00366f0ac055558e5d 100644 (file)
@@ -88,8 +88,9 @@ TEST_F(ComponentTest, TestFrameComponentClass) {
   fc->OnStop();
   fc->OnDestroy();
 
-  component_based::FrameComponent::LCDStatus status = fc->GetLCDStatus();
-  EXPECT_EQ(status, component_based::FrameComponent::LCDStatus::On);
+  component_based::FrameComponent::DisplayStatus status =
+      fc->GetDisplayStatus();
+  EXPECT_EQ(status, component_based::FrameComponent::DisplayStatus::On);
   fc->GetWindow();
 }