Add get display status api for base frame comp 01/212201/4
authorhyunho <hhstark.kang@samsung.com>
Mon, 19 Aug 2019 01:30:55 +0000 (10:30 +0900)
committerHyunho Kang <hhstark.kang@samsung.com>
Wed, 21 Aug 2019 04:59:48 +0000 (04:59 +0000)
- base_frame_get_display_status

Change-Id: I2e212d5692d40b3ee40f50f88f42fcae7bfc1257
Signed-off-by: hyunho <hhstark.kang@samsung.com>
component_based/base/api/base_frame_component.h
component_based/base/stub.cc

index 3ba90e585303637a350e6ea6127476e88c9f5bb0..bf5cc1c5e26ec7128a70130144defedfe4435ba8 100644 (file)
@@ -31,6 +31,8 @@ typedef struct frame_window_s *frame_window_h;
 int base_frame_create_window(frame_window_h *handle, int id, void *raw);
 int base_frame_window_get_id(frame_window_h handle, int *id);
 int base_frame_window_get_raw(frame_window_h handle, void **raw);
+int base_frame_get_display_status(
+               component_h context, component_display_status_e *display_status);
 
 typedef frame_window_h (*base_frame_component_create_cb)(
                component_h context,
index 8e2690a48a4c5f51dffcf6a1699752d8a2a3937e..fcc157814bed82bc8b41ddd74cb8870fb3f35478 100644 (file)
@@ -545,6 +545,38 @@ extern "C" EXPORT_API int base_frame_window_get_raw(frame_window_h handle,
   return COMPONENT_ERROR_NONE;
 }
 
+extern "C" EXPORT_API int base_frame_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*>(context);
+  if (component->GetType() != component_based::Component::Type::Frame) {
+    LOGE("Invalid parameter");
+    return COMPONENT_ERROR_INVALID_PARAMETER;
+  }
+
+  ::StubFrameComponent* frame_component =
+    dynamic_cast<::StubFrameComponent*>(component);
+  if (frame_component == nullptr) {
+    LOGE("Invalid parameter");
+    return COMPONENT_ERROR_INVALID_PARAMETER;
+  }
+
+  auto status = frame_component->GetDisplayStatus();
+  if (status == component_based::FrameComponent::DisplayStatus::Unknown) {
+    LOGE("Invalid context");
+    return COMPONENT_ERROR_INVALID_CONTEXT;
+  }
+
+  *display_status = static_cast<component_display_status_e>(status);
+
+  return COMPONENT_ERROR_NONE;
+}
+
 extern "C" EXPORT_API int component_based_app_base_main(int argc, char** argv,
     component_based_app_base_lifecycle_callback_s *callback, void* user_data) {
   if (argc < 1 || argv == nullptr || !callback || !callback->create) {