diff options
Diffstat (limited to 'src/sm-helper.c')
-rw-r--r-- | src/sm-helper.c | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/src/sm-helper.c b/src/sm-helper.c index 3300d67..02de95a 100644 --- a/src/sm-helper.c +++ b/src/sm-helper.c @@ -15,6 +15,7 @@ */ #include "sm-helper.h" +#include "sm-def.h" #include <stdlib.h> #include <string.h> #include <limits.h> @@ -111,7 +112,7 @@ void sm_add_object_to_json_object_func(struct json_object* j_obj, const char* ve { va_list args; va_start(args, count); - + json_object_object_add(j_obj,"verb", json_object_new_string(verb_name)); for(int i = 0; i < count; ++i ) @@ -157,9 +158,9 @@ int sm_search_routing_event_name_index(const char* value) } GVariant* create_source_data(guint16 sourceID, guint16 domainID, const char* appname, guint16 sourceClassID, - gint32 sourceState, gint16 volume, gboolean visible, struct availability_s availables, - guint16 interrupt, struct sound_property_s soundPropertyList, gint32 connectionFormatList, - struct main_sound_property_s mainPropertyList, struct notification_config_s NConfRouting, + gint32 sourceState, gint16 volume, gboolean visible, struct availability_s availables, + guint16 interrupt, struct sound_property_s soundPropertyList, gint32 connectionFormatList, + struct main_sound_property_s mainPropertyList, struct notification_config_s NConfRouting, struct notification_config_s NConfCommand) { GVariantBuilder builder; @@ -229,3 +230,29 @@ GVariant* create_domain_data(struct domain_data* data) AFB_DEBUG("created domainData %d", __LINE__); return g_variant_builder_end (&builder); } + +int get_sink_id(struct afb_req req, const char* key){ + const char* default_sink = afb_req_value (req, key); + int sink_id; + REQ_ERROR result = REQ_FAIL; + if(default_sink == NULL) { + afb_req_fail(req, "wrong request", NULL); + return -1; + } + else{ + if((strlen("default") == strlen(default_sink)) && + (0 == strncmp("default", default_sink, strlen("default")))){ + sink_id = DEFAULT_SINK; + result = REQ_OK; + } + else{ + result = get_value_uint16(req, key, &sink_id); + } + } + if(REQ_OK != result){ + AFB_INFO("can't parse %s, result %d", key, result); + afb_req_fail_f(req,"wrong-request","can't parse %s, result: %d", result); + return -1 + } + return sink_id; +}
\ No newline at end of file |