aboutsummaryrefslogtreecommitdiffstats
path: root/src/soundmanager.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/soundmanager.c')
-rw-r--r--src/soundmanager.c82
1 files changed, 17 insertions, 65 deletions
diff --git a/src/soundmanager.c b/src/soundmanager.c
index 2c67f83..d8df22e 100644
--- a/src/soundmanager.c
+++ b/src/soundmanager.c
@@ -101,11 +101,7 @@ void connect (struct afb_req request)
&main_connectionID,
NULL, &err);
- if(err != NULL)
- {
- afb_req_fail_f(request, "failed", "Unable to call %s", __FUNCTION__);
- return;
- }
+ if(!SEND_RESULT(err, request)) return;
/* ToDo Remember appname(key) and tie to sourceID(value) */
@@ -142,11 +138,7 @@ void disconnect (struct afb_req request)
NULL, &err);
AFB_DEBUG( "ret = %d", ret);
- if(err != NULL)
- {
- afb_req_fail_f(request, "failed", "Unable to call %s", __FUNCTION__);
- return;
- }
+ if(!SEND_RESULT(err, request)) return;
struct json_object* res_obj = json_object_new_object();
sm_add_object_to_json_object_func(res_obj, __FUNCTION__, 2,
@@ -182,11 +174,7 @@ void setVolume (struct afb_req request)
NULL, &err);
AFB_DEBUG( "ret = %d", ret);
- if(err != NULL)
- {
- afb_req_fail_f(request, "failed", "Unable to call %s", __FUNCTION__);
- return;
- }
+ if(!SEND_RESULT(err, request)) return;
struct json_object* res_obj = json_object_new_object();
sm_add_object_to_json_object_func(res_obj, __FUNCTION__, 2,
@@ -222,11 +210,7 @@ void volumeStep (struct afb_req request)
NULL, &err);
AFB_DEBUG( "ret = %d", ret);
- if(err != NULL)
- {
- afb_req_fail_f(request, "failed", "Unable to call %s", __FUNCTION__);
- return;
- }
+ if(!SEND_RESULT(err, request)) return;
struct json_object* res_obj = json_object_new_object();
sm_add_object_to_json_object_func(res_obj, __FUNCTION__, 2,
@@ -263,11 +247,7 @@ void setSinkMuteState(struct afb_req request)
NULL, &err);
AFB_DEBUG( "ret = %d", ret);
- if(err != NULL)
- {
- afb_req_fail_f(request, "failed", "Unable to call %s", __FUNCTION__);
- return;
- }
+ if(!SEND_RESULT(err, request)) return;
struct json_object* res_obj = json_object_new_object();
sm_add_object_to_json_object_func(res_obj, __FUNCTION__, 2,
@@ -292,11 +272,7 @@ void getListMainConnections(struct afb_req request)
&err
);
- if(err != NULL)
- {
- afb_req_fail_f(request, "failed", "Unable to call %s", __FUNCTION__);
- return;
- }
+ if(!SEND_RESULT(err, request)) return;
/* create response */
struct json_object *array_res = json_object_new_array();
@@ -349,11 +325,7 @@ void getListMainSources(struct afb_req request)
&err
);
- if(err != NULL)
- {
- afb_req_fail_f(request, "failed", "Unable to call %s", __FUNCTION__);
- return;
- }
+ if(!SEND_RESULT(err, request)) return;
/* create response */
struct json_object *response = json_object_new_object();
@@ -411,11 +383,7 @@ void getListMainSinks(struct afb_req request)
&err
);
- if(err != NULL)
- {
- afb_req_fail_f(request, "failed", "Unable to call %s", __FUNCTION__);
- return;
- }
+ if(!SEND_RESULT(err, request)) return;
/* create response */
struct json_object *response = json_object_new_object();
@@ -498,11 +466,8 @@ void ackConnect(struct afb_req request)
error,
NULL, &err);
- if(err != NULL)
- {
- afb_req_fail_f(request, "failed", "Unable to call %s", __FUNCTION__);
- return;
- }
+ if(!SEND_RESULT(err, request)) return;
+
/*create response json object*/
struct json_object *res = json_object_new_object();
sm_add_object_to_json_object_func(res, __FUNCTION__, 2,
@@ -541,11 +506,8 @@ void ackDisconnect(struct afb_req request)
error,
NULL, &err);
- if(err != NULL)
- {
- afb_req_fail_f(request, "failed", "Unable to call %s", __FUNCTION__);
- return;
- }
+ if(!SEND_RESULT(err, request)) return;
+
/*create response json object*/
struct json_object *res = json_object_new_object();
sm_add_object_to_json_object_func(res, __FUNCTION__, 2,
@@ -578,11 +540,8 @@ void ackSetSourceState(struct afb_req request)
error,
NULL, &err);
- if(err != NULL)
- {
- afb_req_fail_f(request, "failed", "Unable to call %s", __FUNCTION__);
- return;
- }
+ if(!SEND_RESULT(err, request)) return;
+
/*create response json object*/
struct json_object *res = json_object_new_object();
sm_add_object_to_json_object_func(res, __FUNCTION__, 2,
@@ -684,11 +643,7 @@ void registerSource(struct afb_req request)
NULL, &err);
g_variant_unref(input);
- if(err != NULL)
- {
- afb_req_fail_f(request, "failed", "Unable to call %s", __FUNCTION__);
- return;
- }
+ if(!SEND_RESULT(err, request)) return;
/*create response json object*/
struct json_object *res = json_object_new_object();
@@ -715,11 +670,8 @@ void deregisterSource(struct afb_req request)
&ret,
NULL, &err
);
- if(err != NULL)
- {
- afb_req_fail_f(request, "failed", "Unable to call %s", __FUNCTION__);
- return;
- }
+ if(!SEND_RESULT(err, request)) return;
+
/*create response json object*/
struct json_object *res = json_object_new_object();
sm_add_object_to_json_object_func(res, __FUNCTION__, 2,