From: Youngjae Cho Date: Thu, 15 Dec 2022 06:45:11 +0000 (+0900) Subject: power: change function/parameter name and callback type X-Git-Tag: accepted/tizen/7.0/unified/20221220.180244~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=badff288e79d7a0ac03cda466479dc8123ddd685;p=platform%2Fcore%2Fapi%2Fdevice.git 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 --- 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,