From 76dfeb2f8055c7a3de71bd97881cf4d780a2396e Mon Sep 17 00:00:00 2001 From: Youngjae Cho Date: Fri, 18 Aug 2023 19:49:41 +0900 Subject: [PATCH] display: Replace struct state with the libsyscommon Change-Id: I38890b7b0d1610b718299c4960d4915604fb5b2d Signed-off-by: Youngjae Cho --- plugins/iot-headed/display/core.c | 4 ++-- plugins/mobile/display/core.c | 4 ++-- plugins/tv/display/core.c | 4 ++-- plugins/wearable/display/core.c | 16 ++++++++-------- src/display/core.h | 17 ++--------------- src/display/display-plugin.h | 2 +- 6 files changed, 17 insertions(+), 30 deletions(-) diff --git a/plugins/iot-headed/display/core.c b/plugins/iot-headed/display/core.c index 38fc6de..9a4e228 100644 --- a/plugins/iot-headed/display/core.c +++ b/plugins/iot-headed/display/core.c @@ -56,7 +56,7 @@ static enum device_ops_status status = DEVICE_OPS_STATUS_UNINIT; -static struct state states[SYSCOMMON_DEVICED_DISPLAY_STATE_END] = { +static struct syscommon_deviced_display_state_info states[SYSCOMMON_DEVICED_DISPLAY_STATE_END] = { { SYSCOMMON_DEVICED_DISPLAY_STATE_START, "SYSCOMMON_DEVICED_DISPLAY_STATE_START", NULL, NULL, NULL, NULL }, { SYSCOMMON_DEVICED_DISPLAY_STATE_ON, "SYSCOMMON_DEVICED_DISPLAY_STATE_ON", NULL, NULL, NULL, NULL }, { SYSCOMMON_DEVICED_DISPLAY_STATE_DIM, "SYSCOMMON_DEVICED_DISPLAY_STATE_DIM", NULL, NULL, NULL, NULL }, @@ -102,7 +102,7 @@ inline const struct syscommon_deviced_display_config* get_var_display_config() return &display_conf; } -inline struct state* state_st(enum syscommon_deviced_display_state state) +inline struct syscommon_deviced_display_state_info* state_st(enum syscommon_deviced_display_state state) { return &states[state]; } diff --git a/plugins/mobile/display/core.c b/plugins/mobile/display/core.c index b284434..7a29b74 100644 --- a/plugins/mobile/display/core.c +++ b/plugins/mobile/display/core.c @@ -85,7 +85,7 @@ static struct display_backlight_ops *backlight_ops; static enum device_ops_status status = DEVICE_OPS_STATUS_UNINIT; -static struct state states[SYSCOMMON_DEVICED_DISPLAY_STATE_END] = { +static struct syscommon_deviced_display_state_info states[SYSCOMMON_DEVICED_DISPLAY_STATE_END] = { { SYSCOMMON_DEVICED_DISPLAY_STATE_START, "SYSCOMMON_DEVICED_DISPLAY_STATE_START", NULL, NULL, NULL, NULL }, { SYSCOMMON_DEVICED_DISPLAY_STATE_ON, "SYSCOMMON_DEVICED_DISPLAY_STATE_ON", NULL, NULL, NULL, NULL }, { SYSCOMMON_DEVICED_DISPLAY_STATE_DIM, "SYSCOMMON_DEVICED_DISPLAY_STATE_DIM", NULL, NULL, NULL, NULL }, @@ -131,7 +131,7 @@ inline const struct syscommon_deviced_display_config* get_var_display_config() return &display_conf; } -inline struct state* state_st(enum syscommon_deviced_display_state state) +inline struct syscommon_deviced_display_state_info* state_st(enum syscommon_deviced_display_state state) { return &states[state]; } diff --git a/plugins/tv/display/core.c b/plugins/tv/display/core.c index 80f1cbd..4d1080a 100644 --- a/plugins/tv/display/core.c +++ b/plugins/tv/display/core.c @@ -83,7 +83,7 @@ static struct display_backlight_ops *backlight_ops; static enum device_ops_status status = DEVICE_OPS_STATUS_UNINIT; -static struct state states[SYSCOMMON_DEVICED_DISPLAY_STATE_END] = { +static struct syscommon_deviced_display_state_info states[SYSCOMMON_DEVICED_DISPLAY_STATE_END] = { { SYSCOMMON_DEVICED_DISPLAY_STATE_START, "SYSCOMMON_DEVICED_DISPLAY_STATE_START", NULL, NULL, NULL, NULL }, { SYSCOMMON_DEVICED_DISPLAY_STATE_ON, "SYSCOMMON_DEVICED_DISPLAY_STATE_ON", NULL, NULL, NULL, NULL }, { SYSCOMMON_DEVICED_DISPLAY_STATE_DIM, "SYSCOMMON_DEVICED_DISPLAY_STATE_DIM", NULL, NULL, NULL, NULL }, @@ -129,7 +129,7 @@ inline const struct syscommon_deviced_display_config* get_var_display_config() return &display_conf; } -inline struct state* state_st(enum syscommon_deviced_display_state state) +inline struct syscommon_deviced_display_state_info* state_st(enum syscommon_deviced_display_state state) { return &states[state]; } diff --git a/plugins/wearable/display/core.c b/plugins/wearable/display/core.c index a48383c..fc5e4f8 100644 --- a/plugins/wearable/display/core.c +++ b/plugins/wearable/display/core.c @@ -106,7 +106,7 @@ static bool lcdon_broadcast = true; static int default_trans(int evt); static int default_action(int timeout); -static struct state states[SYSCOMMON_DEVICED_DISPLAY_STATE_END] = { +static struct syscommon_deviced_display_state_info states[SYSCOMMON_DEVICED_DISPLAY_STATE_END] = { { SYSCOMMON_DEVICED_DISPLAY_STATE_START, "SYSCOMMON_DEVICED_DISPLAY_STATE_START", NULL, NULL, NULL, NULL }, { SYSCOMMON_DEVICED_DISPLAY_STATE_ON, "SYSCOMMON_DEVICED_DISPLAY_STATE_ON", default_trans, default_action, NULL, NULL }, { SYSCOMMON_DEVICED_DISPLAY_STATE_DIM, "SYSCOMMON_DEVICED_DISPLAY_STATE_DIM", default_trans, default_action, NULL, NULL }, @@ -154,7 +154,7 @@ inline const struct syscommon_deviced_display_config *get_var_display_config() return &display_conf; } -inline struct state *state_st(enum syscommon_deviced_display_state state) +inline struct syscommon_deviced_display_state_info *state_st(enum syscommon_deviced_display_state state) { return &states[state]; } @@ -352,7 +352,7 @@ static inline bool check_lcd_is_on(void) static gboolean timer_refresh_cb(gpointer data) { - struct state *st; + struct syscommon_deviced_display_state_info *st; int v, ret; ret = vconf_get_int(VCONFKEY_HOMESCREEN_WATCHFACE_VISIBILITY, &v); @@ -382,7 +382,7 @@ static gboolean timer_refresh_cb(gpointer data) int custom_lcdon(int timeout) { - struct state *st; + struct syscommon_deviced_display_state_info *st; int ret, update; int tutorial = 0; @@ -423,7 +423,7 @@ int custom_lcdon(int timeout) int custom_lcdoff(enum device_flags flag) { - struct state *st; + struct syscommon_deviced_display_state_info *st; if (display_lock_is_state_locked(SYSCOMMON_DEVICED_DISPLAY_STATE_ON) || display_lock_is_state_locked(SYSCOMMON_DEVICED_DISPLAY_STATE_DIM)) { /* @@ -461,7 +461,7 @@ int custom_lcdoff(enum device_flags flag) int display_on_by_reason(const char *reason, int timeout) { - struct state *st; + struct syscommon_deviced_display_state_info *st; int flag; int str_len; @@ -502,7 +502,7 @@ int display_on_by_reason(const char *reason, int timeout) int display_off_by_reason(const char *reason) { - struct state *st; + struct syscommon_deviced_display_state_info *st; int flag; int str_len; @@ -600,7 +600,7 @@ static int default_proc_change_state(unsigned int cond, pid_t pid) */ static int default_trans(int evt) { - struct state *st = &states[get_pm_cur_state()]; + struct syscommon_deviced_display_state_info *st = &states[get_pm_cur_state()]; int ret; enum syscommon_deviced_display_state next_state; diff --git a/src/display/core.h b/src/display/core.h index 7122cf6..3d87ad4 100644 --- a/src/display/core.h +++ b/src/display/core.h @@ -51,20 +51,7 @@ #define MAX_LOG_COUNT 250 #endif -/* - * @brief State structure - */ -struct state { - enum syscommon_deviced_display_state state; /**< state number */ - const char *name; /**< state name (string) */ - int (*trans) (int evt); /**< transition function pointer */ - int (*action) (int timeout); /**< enter action */ - int (*check) (int curr, int next); /**< transition check function */ - GSourceFunc timeout_cb; - int timeout; -}; - -struct state *state_st(enum syscommon_deviced_display_state state); +struct syscommon_deviced_display_state_info *state_st(enum syscommon_deviced_display_state state); /* * Global variables @@ -79,7 +66,7 @@ typedef struct { unsigned int timeout2; } PMMsg; -extern struct state state[SYSCOMMON_DEVICED_DISPLAY_STATE_END]; +extern struct syscommon_deviced_display_state_info state[SYSCOMMON_DEVICED_DISPLAY_STATE_END]; /* setting.c */ int get_lock_screen_bg_state(void); diff --git a/src/display/display-plugin.h b/src/display/display-plugin.h index d690e1d..a543a5e 100644 --- a/src/display/display-plugin.h +++ b/src/display/display-plugin.h @@ -77,7 +77,7 @@ struct display_plugin { struct syscommon_deviced_display_config *config; struct display_backlight_ops *backlight; - struct state* display_states[SYSCOMMON_DEVICED_DISPLAY_STATE_END]; + struct syscommon_deviced_display_state_info* display_states[SYSCOMMON_DEVICED_DISPLAY_STATE_END]; }; extern struct display_plugin g_display_plugin; -- 2.7.4