int device_power_confirm_wait_callback(uint64_t wait_callback_id);
/**
+ * @brief Notify the deviced that it needs undoing the current transition.
+ * @details Notify the deviced that the current transition should be rewinded. \n
+ * This function only works on the id received from device_power_state_wait_callback() and device_power_transient_state_wait_callback().
+ * @since_tizen 7.0
+ * @param[in] wait_callback_id Wait callback id to cancel
+ * @return 0 on success,
+ * otherwise a negative error value
+ * @retval #DEVICE_ERROR_NONE Successful
+ * @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed
+ * @see device_power_state_wait_callback()
+ * @see device_power_transient_state_wait_callback()
+ */
+int device_power_cancel_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.
return DEVICE_ERROR_NONE;
}
+int device_power_cancel_wait_callback(uint64_t wait_callback_id)
+{
+ GDBusConnection *connection;
+ GVariant *retgv;
+ GError *err = NULL;
+ int ret;
+
+ connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
+ if (!connection) {
+ _E("Failed to get dbus connection, %s", err->message);
+ g_clear_error(&err);
+ return DEVICE_ERROR_OPERATION_FAILED;
+ }
+
+ retgv = g_dbus_connection_call_sync(connection,
+ DEVICED_BUS_NAME,
+ DEVICED_PATH_POWER,
+ DEVICED_INTERFACE_POWER,
+ "CancelChangeStateWait",
+ g_variant_new("(t)", wait_callback_id),
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ DBUS_METHOD_SYNC_CALL_TIMEOUT_MS,
+ NULL,
+ &err);
+ if (!retgv || err) {
+ _E("Failed to request ConfirmChangeStateWait, %s", err->message);
+ g_error_free(err);
+ return DEVICE_ERROR_OPERATION_FAILED;
+ }
+
+ g_variant_get(retgv, "(i)", &ret);
+ g_variant_unref(retgv);
+ if (ret != 0)
+ return DEVICE_ERROR_OPERATION_FAILED;
+
+ return DEVICE_ERROR_NONE;
+}
+
static void __unregister_state_signal_callback(GDBusConnection *connection, int index)
{
if (state_signal_id[index] == 0)