From 1d678cbb93c01ebbcdaa59aa636197bc059e8466 Mon Sep 17 00:00:00 2001 From: Daehyeon Jung Date: Mon, 17 Feb 2020 14:49:18 +0900 Subject: [PATCH] Update watch-holder CAPI to design Change-Id: I6f47ce5f90c80021ff3866c94b3e146aa9bdab6a Signed-off-by: Daehyeon Jung --- watch-holder/api/watch_holder.cc | 24 +++++++++++++++++++++--- watch-holder/api/watch_holder.h | 12 ++++++++++-- widget_viewer_sdk/src/main.c | 2 +- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/watch-holder/api/watch_holder.cc b/watch-holder/api/watch_holder.cc index b21ced1..fb67728 100644 --- a/watch-holder/api/watch_holder.cc +++ b/watch-holder/api/watch_holder.cc @@ -15,6 +15,7 @@ */ #include +#include #include "watch_holder.h" #include "../src/watch_holder.hh" @@ -27,7 +28,7 @@ using namespace watch_holder; struct watch_holder_s : public WatchHolder { public: - watch_holder_s(Evas_Object* win, watch_lifecycle_st cb, void* cb_data) + watch_holder_s(Evas_Object* win, watch_holder_lifecycle_st cb, void* cb_data) : WatchHolder(win), cb_(cb), cb_data_(cb_data) {} void OnLaunched(const Watch& watch) override { @@ -60,12 +61,12 @@ struct watch_holder_s : public WatchHolder { cb_.watch_holder_lifecycle_removed_cb(reinterpret_cast(&w), cb_data_); } - watch_lifecycle_st cb_; + watch_holder_lifecycle_st cb_; void* cb_data_; }; C_EXPORT int watch_holder_create(Evas_Object *viewer_win, - watch_lifecycle_st lifecycle, void *user_data, watch_holder_h *handle) { + watch_holder_lifecycle_st lifecycle, void *user_data, watch_holder_h *handle) { if (viewer_win == nullptr) return WATCH_HOLDER_ERROR_INVALID_PARAMETER; @@ -122,3 +123,20 @@ C_EXPORT int watch_holder_get_current(watch_holder_h handle, watch_h *watch) { return WATCH_HOLDER_ERROR_NONE; } +C_EXPORT int watch_holder_foreach_watch(watch_holder_h handle, watch_holder_foreach_cb callback, void *user_data) { + std::list> list = handle->GetStack(); + for (std::shared_ptr wptr : list) { + callback(reinterpret_cast(wptr.get()), user_data); + } + + return WATCH_HOLDER_ERROR_NONE; +} + +C_EXPORT int watch_holder_monitor(watch_holder_h handle) { + return WATCH_HOLDER_ERROR_NONE; +} + +C_EXPORT int watch_holder_unmonitor(watch_holder_h handle) { + return WATCH_HOLDER_ERROR_NONE; +} + diff --git a/watch-holder/api/watch_holder.h b/watch-holder/api/watch_holder.h index 549fd3c..0bc204b 100644 --- a/watch-holder/api/watch_holder.h +++ b/watch-holder/api/watch_holder.h @@ -36,7 +36,9 @@ typedef struct { void (*watch_holder_lifecycle_removed_cb)(watch_h watch, void *data); void (*watch_holder_lifecycle_updated_cb)(watch_h watch, Evas_Object *image, void *data); void (*watch_holder_lifecycle_bound_cb)(watch_h watch, void *data); -} watch_lifecycle_st; +} watch_holder_lifecycle_st; + +typedef void (*watch_holder_foreach_cb)(watch_h watch, void *data); /** * @brief @@ -44,7 +46,7 @@ typedef struct { * @since_tizen 5.5 * @return @c 0 on success, otherwise a negative error value */ -int watch_holder_create(Evas_Object *viewer_win, watch_lifecycle_st lifecycle, void *user_data, watch_holder_h *handle); +int watch_holder_create(Evas_Object *viewer_win, watch_holder_lifecycle_st lifecycle, void *user_data, watch_holder_h *handle); int watch_holder_destroy(watch_holder_h handle); @@ -56,6 +58,12 @@ int watch_holder_disable_rendering(watch_holder_h handle, int timeout); int watch_holder_get_current(watch_holder_h handle, watch_h *watch); +int watch_holder_foreach_watch(watch_holder_h handle, watch_holder_foreach_cb cb, void *user_data); + +int watch_holder_monitor(watch_holder_h handle); + +int watch_holder_unmonitor(watch_holder_h handle); + #ifdef __cplusplus } #endif diff --git a/widget_viewer_sdk/src/main.c b/widget_viewer_sdk/src/main.c index 43b3946..b1567a1 100644 --- a/widget_viewer_sdk/src/main.c +++ b/widget_viewer_sdk/src/main.c @@ -855,7 +855,7 @@ static void _app_control(app_control_h service, void *data) evas_object_resize(s_info.win, s_info.w, s_info.h); - watch_lifecycle_st lifecycle; + watch_holder_lifecycle_st lifecycle; lifecycle.watch_holder_lifecycle_launched_cb = __watch_launched_cb; lifecycle.watch_holder_lifecycle_dead_cb = __watch_dead_cb; lifecycle.watch_holder_lifecycle_added_cb = __watch_added_cb; -- 2.7.4