Commit 6692d892 authored by Guido Gunther's avatar Guido Gunther Committed by Guido Gunther
Browse files

feedback-manager: Add hint to select feedback profile per event

This e.g. allows events that are meant for haptic only to avoid
emitting a sound by omitting the 'full' level and using "quiet"
instead.

Closes: #7
parent 421c163b
......@@ -224,6 +224,21 @@ get_max_level (FbdFeedbackProfileLevel global_level,
return level;
}
static gboolean
parse_hints (GVariant *hints, FbdFeedbackProfileLevel *level)
{
const gchar *profile;
gboolean found;
g_auto (GVariantDict) dict = G_VARIANT_DICT_INIT (NULL);
g_variant_dict_init (&dict, hints);
found = g_variant_dict_lookup (&dict, "profile", "&s", &profile);
if (level && found)
*level = fbd_feedback_profile_level (profile);
return TRUE;
}
static gboolean
fbd_feedback_manager_handle_trigger_feedback (LfbGdbusFeedback *object,
GDBusMethodInvocation *invocation,
......@@ -259,6 +274,13 @@ fbd_feedback_manager_handle_trigger_feedback (LfbGdbusFeedback *object,
return TRUE;
}
if (!parse_hints (arg_hints, &hint_level)) {
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
G_DBUS_ERROR_INVALID_ARGS,
"Invalid hints");
return TRUE;
}
if (arg_timeout < -1)
arg_timeout = -1;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment