From 62b4ec330b0509b7aa8c46aa3133b5a8efb577fa Mon Sep 17 00:00:00 2001 From: Youngjae Cho Date: Thu, 15 Dec 2022 15:45:11 +0900 Subject: [PATCH] power: change function/parameter name and callback type The device_power_state_wait_callback has changed to provide an additional parameter, prev_state, which denotes where a transition has started. Change-Id: Iab68154064dfeb64000a43e3961925a3d35524af Signed-off-by: Youngjae Cho --- include/power-internal.h | 17 +++++++++-------- src/power-internal.c | 6 +++--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/power-internal.h b/include/power-internal.h index bf6989a..3e6651d 100644 --- a/include/power-internal.h +++ b/include/power-internal.h @@ -91,7 +91,7 @@ typedef enum { * @details Notify the deviced that it is ok to take an actual action of change state. \n * This function only works on the id received from device_power_state_wait_callback() and device_power_transient_state_wait_callback(). * @since_tizen 6.5 - * @param[in] wait_done_id Change state id to confirm waiting + * @param[in] wait_callback_id Wait callback id to confirm * @return 0 on success, * otherwise a negative error value * @retval #DEVICE_ERROR_NONE Successful @@ -99,20 +99,21 @@ typedef enum { * @see device_power_state_wait_callback() * @see device_power_transient_state_wait_callback() */ -int device_power_wait_done(uint64_t wait_done_id); +int device_power_confirm_wait_callback(uint64_t wait_callback_id); /** * @brief Called when a device power state is changed. * @details If both device_power_state_wait_callback() and device_power_change_state_callback() have registered to the same power state, \n * then the device_power_state_wait_callback() will be invoked first and the device_power_change_state_callback() will follow. * @since_tizen 6.5 - * @param[out] state Power state to be changed by the transition - * @param[out] wait_done_id Transition id + * @param[out] prev_state Power state where transition has started + * @param[out] next_state Power state to be changed by transition + * @param[out] wait_callback_id Unique id for each callback invocation * @param[out] transition_reason Reason for what triggered the transition * @param[out] user_data User data passed from the callback registration */ -typedef void (*device_power_state_wait_callback) (device_power_state_e state, - uint64_t wait_done_id, device_power_transition_reason_e transition_reason, void *user_data); +typedef void (*device_power_state_wait_callback) (device_power_state_e prev_state, device_power_state_e next_state, + uint64_t wait_callback_id, device_power_transition_reason_e transition_reason, void *user_data); /** * @brief Add a callback to observe power state change. @@ -144,12 +145,12 @@ void device_power_remove_state_wait_callback(device_power_state_e state_bits); * @brief Called when a device power state is changed. * @since_tizen 6.5 * @param[out] transient_state Transient state to be changed by the transition - * @param[out] wait_done_id Transition id + * @param[out] wait_callback_id Unique id for each callback invocation * @param[out] transition_reason Reason for what triggered the transition * @param[out] user_data User data passed from the callback registration */ typedef void (*device_power_transient_state_wait_callback) (device_power_transient_state_e transient_state, - uint64_t wait_done_id, device_power_transition_reason_e transition_reason, void *user_data); + uint64_t wait_callback_id, device_power_transition_reason_e transition_reason, void *user_data); /** * @brief Add a callback to observe transient power state. diff --git a/src/power-internal.c b/src/power-internal.c index f74604c..1997ca8 100644 --- a/src/power-internal.c +++ b/src/power-internal.c @@ -88,7 +88,7 @@ static void state_signal_callback(GDBusConnection *connection, g_variant_get(parameters, "(ttti)", &prev_state, &next_state, &id, &reason); - h->state_wait_callback(next_state, id, reason, h->user_data); + h->state_wait_callback(prev_state, next_state, id, reason, h->user_data); } static int __register_state_signal_callback(GDBusConnection *connection, @@ -292,7 +292,7 @@ int device_power_add_transient_state_wait_callback(device_power_transient_state_ return register_transient_state_signal_callback(transient_bits, cb, data); } -int device_power_wait_done(uint64_t id) +int device_power_confirm_wait_callback(uint64_t wait_callback_id) { GDBusConnection *connection; GVariant *retgv; @@ -311,7 +311,7 @@ int device_power_wait_done(uint64_t id) DEVICED_PATH_POWER, DEVICED_INTERFACE_POWER, "ConfirmChangeStateWait", - g_variant_new("(t)", id), + g_variant_new("(t)", wait_callback_id), NULL, G_DBUS_CALL_FLAGS_NONE, DBUS_METHOD_SYNC_CALL_TIMEOUT_MS, -- 2.7.4