summaryrefslogtreecommitdiffstats
path: root/src/soundmanager.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/soundmanager.c')
-rw-r--r--src/soundmanager.c314
1 files changed, 157 insertions, 157 deletions
diff --git a/src/soundmanager.c b/src/soundmanager.c
index a6da6a5..b46b6ff 100644
--- a/src/soundmanager.c
+++ b/src/soundmanager.c
@@ -120,23 +120,23 @@ static struct afb_event ev_async_set_source_state;
* Call "connect" function of Audio Manager.
* Getting resource right to output audio stream.
* Please input following keys with value into json string object in argument.
- * In case of using libsoundmanager,
+ * In case of using libsoundmanager,
* json_object *jobj = json_object_new_object();
* json_object_object_add(jobj, "sourceID", json_object_new_int(100));
* json_object_object_add(jobj, "sinkID", json_object_new_int(100));
* call("connect", jobj);
*
* The order of arguments is not important.
- *
+ *
* #### Parameters
* Request key
- * - sourceID : Source ID getting in return value in registerSource or appname.
+ * - sourceID : Source ID getting in return value in registerSource or appname.
* - sinkID : Sink ID. This should be more than 0. If no request, defalut value is set by sound manager
*
* This will be changed in near future because these arguments should be aliased like
* sinkID:100 -> sinkID:"speaker"
*
- * This will be modified after integrating
+ * This will be modified after integrating
*
* #### Rreturn
* - error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message.
@@ -145,7 +145,7 @@ static struct afb_event ev_async_set_source_state;
* sourceID and sinkID should be more than 0
*
*/
-static void connect (struct afb_req request)
+static void connect (struct afb_req request)
{
AFB_DEBUG("call %s", __FUNCTION__);
guint16 source_id = 0, sink_id = 0;
@@ -154,11 +154,11 @@ static void connect (struct afb_req request)
REQ_ERROR req_err1 = REQ_FAIL;
REQ_ERROR req_err2 = REQ_FAIL;
GError *err = NULL;
-
+
req_err1 = get_value_uint16(request, _SOURCE_ID, &source_id);
- /* ToDo: Hardware abstraction for application user is needed.
+ /* ToDo: Hardware abstraction for application user is needed.
select appname(speaker) or sourceID(sinkID). If appname is desired, it changes to sourceID(sinkID) */
-
+
const char* default_sink = afb_req_value (request, _SINK_ID);
if(default_sink != NULL){
if((strlen("default") == strlen(default_sink)) &&
@@ -170,7 +170,7 @@ static void connect (struct afb_req request)
req_err2 = get_value_uint16(request, _SINK_ID, &sink_id);
}
}
-
+
if((req_err1 != REQ_OK) || (req_err2 != REQ_OK))
{
AFB_INFO("get_value_uint16 source ret = %d,sink ret = %d", source_id, sink_id);
@@ -189,12 +189,12 @@ static void connect (struct afb_req request)
if(err != NULL)
{
- afb_req_fail_f(request, "failed", "Unable to call %s", __FUNCTION__);
+ afb_req_fail_f(request, "failed", "Unable to call %s", __FUNCTION__);
return;
}
/* ToDo Remember appname(key) and tie to sourceID(value) */
-
+
/*create response json object*/
struct json_object *res = json_object_new_object();
sm_add_object_to_json_object_func(res, __FUNCTION__, 4,
@@ -207,10 +207,10 @@ static void connect (struct afb_req request)
/**
* Call "disconnect" function of Audio Manager.
* Release resource right to output audio stream.
- *
+ *
* #### Parameters
* Request key
- * - sourceID : Source ID getting in return value in registerSource or appname.
+ * - sourceID : Source ID getting in return value in registerSource or appname.
*
*
* #### Rreturn
@@ -220,18 +220,18 @@ static void connect (struct afb_req request)
* sourceID should be more than 0
*
*/
-static void disconnect (struct afb_req request)
+static void disconnect (struct afb_req request)
{
AFB_DEBUG("call %s", __FUNCTION__);
-
+
guint16 id;
gint16 ret;
REQ_ERROR req_err;
GError *err = NULL;
-
+
req_err = get_value_uint16(request, _MAIN_CONNECTION_ID, &id);
AFB_DEBUG( "requested %s = %d", _MAIN_CONNECTION_ID, id);
-
+
if(req_err != REQ_OK)
{
afb_req_fail(request,"wrong-request",afb_req_value (request, _MAIN_CONNECTION_ID));
@@ -246,7 +246,7 @@ static void disconnect (struct afb_req request)
if(err != NULL)
{
- afb_req_fail_f(request, "failed", "Unable to call %s", __FUNCTION__);
+ afb_req_fail_f(request, "failed", "Unable to call %s", __FUNCTION__);
return;
}
@@ -261,10 +261,10 @@ static void disconnect (struct afb_req request)
/**
* Call "setVolume" function of Audio Manager.
* Set sink volume.
- *
+ *
* #### Parameters
* Request key
- * - volume : volume value. The range of value should be [0-100]
+ * - volume : volume value. The range of value should be [0-100]
* - sinkID : sinkID you would like to change volume at
*
* #### Rreturn
@@ -273,15 +273,15 @@ static void disconnect (struct afb_req request)
* #### Note
*
*/
-static void setVolume (struct afb_req request)
+static void setVolume (struct afb_req request)
{
AFB_DEBUG("call %s", __FUNCTION__);
-
+
guint16 sink_id, vol;
gint16 ret;
REQ_ERROR req_err1, req_err2;
GError *err = NULL;
-
+
req_err1 = get_value_uint16(request, _SINK_ID, &sink_id);
req_err2 = get_value_int16(request, _VOLUME, &vol);
AFB_DEBUG( "requested %s = %d, %s = %d",_SINK_ID, sink_id, _VOLUME, vol);
@@ -301,7 +301,7 @@ static void setVolume (struct afb_req request)
if(err != NULL)
{
- afb_req_fail_f(request, "failed", "Unable to call %s", __FUNCTION__);
+ afb_req_fail_f(request, "failed", "Unable to call %s", __FUNCTION__);
return;
}
@@ -316,7 +316,7 @@ static void setVolume (struct afb_req request)
/**
* Call "volumeStep" function of Audio Manager.
* Change volume step of sink
- *
+ *
* #### Parameters
* Request key
* - sinkID : sinkID you would to change volume step
@@ -329,15 +329,15 @@ static void setVolume (struct afb_req request)
* #### Note
*
*/
-static void volumeStep (struct afb_req request)
+static void volumeStep (struct afb_req request)
{
AFB_DEBUG("call %s", __FUNCTION__);
-
+
guint16 sink_id, vol;
gint16 ret;
REQ_ERROR req_err1, req_err2;
GError *err = NULL;
-
+
req_err1 = get_value_uint16(request, _SINK_ID, &sink_id);
req_err2 = get_value_int16(request, _VOLUME_STEP, &vol);
AFB_DEBUG( "requested %s = %d, %s = %d",_SINK_ID, sink_id, _VOLUME_STEP, vol);
@@ -357,7 +357,7 @@ static void volumeStep (struct afb_req request)
if(err != NULL)
{
- afb_req_fail_f(request, "failed", "Unable to call %s", __FUNCTION__);
+ afb_req_fail_f(request, "failed", "Unable to call %s", __FUNCTION__);
return;
}
@@ -372,7 +372,7 @@ static void volumeStep (struct afb_req request)
/**
* Call "volumeStep" function of Audio Manager.
* Change volume step of sink
- *
+ *
* #### Parameters
* Request key
* - sinkID : sinkID you would like to change mute state
@@ -383,17 +383,17 @@ static void volumeStep (struct afb_req request)
* - error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message.
*
* #### Note
- *
+ *
*/
static void setSinkMuteState(struct afb_req request)
{
AFB_DEBUG("call %s", __FUNCTION__);
-
+
guint16 sink_id, mute;
gint16 ret;
REQ_ERROR req_err1, req_err2;
GError *err = NULL;
-
+
req_err1 = get_value_uint16(request, _SINK_ID, &sink_id);
req_err2 = get_value_int16(request, _MUTE_STATE, &mute);
AFB_DEBUG( "requested %s = %d, %s = %d",_SINK_ID, sink_id, _MUTE_STATE, mute);
@@ -413,7 +413,7 @@ static void setSinkMuteState(struct afb_req request)
if(err != NULL)
{
- afb_req_fail_f(request, "failed", "Unable to call %s", __FUNCTION__);
+ afb_req_fail_f(request, "failed", "Unable to call %s", __FUNCTION__);
return;
}
@@ -422,13 +422,13 @@ static void setSinkMuteState(struct afb_req request)
"error", ret);
char *info = get_response_audiomanager_massage_error(ret);
- afb_req_success(request, res_obj, info); /* return error num as status */
+ afb_req_success(request, res_obj, info); /* return error num as status */
}
/**
* Call "getListMainConnections" function of Audio Manager.
* Get mainc connection list
- *
+ *
* #### Parameters
* Request key
* None
@@ -436,10 +436,10 @@ static void setSinkMuteState(struct afb_req request)
*
* #### Rreturn
* - error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message. Even if there is no connection list,
- * Sound Manager return success.
+ * Sound Manager return success.
*
* #### Note
- *
+ *
*/
static void getListMainConnections(struct afb_req request)
{
@@ -458,7 +458,7 @@ static void getListMainConnections(struct afb_req request)
if(err != NULL)
{
- afb_req_fail_f(request, "failed", "Unable to call %s", __FUNCTION__);
+ afb_req_fail_f(request, "failed", "Unable to call %s", __FUNCTION__);
return;
}
@@ -479,7 +479,7 @@ static void getListMainConnections(struct afb_req request)
guint16 mcid, srcid, sinkid;
gint16 delay, constate;
g_variant_get_child(
- mainConnectionList,i,"(qqqnn)",
+ mainConnectionList,i,"(qqqnn)",
&mcid, &srcid, &sinkid, &delay, &constate
);
@@ -501,7 +501,7 @@ static void getListMainConnections(struct afb_req request)
/**
* Call "getListMainSinks" function of Audio Manager.
* Get main sink list
- *
+ *
* #### Parameters
* Request key
* None
@@ -509,10 +509,10 @@ static void getListMainConnections(struct afb_req request)
*
* #### Rreturn
* - error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message. Even if there is no connection list,
- * Sound Manager return success.
+ * Sound Manager return success.
*
* #### Note
- *
+ *
*/
static void getListMainSinks(struct afb_req request)
{
@@ -531,7 +531,7 @@ static void getListMainSinks(struct afb_req request)
if(err != NULL)
{
- afb_req_fail_f(request, "failed", "Unable to call %s", __FUNCTION__);
+ afb_req_fail_f(request, "failed", "Unable to call %s", __FUNCTION__);
return;
}
@@ -556,7 +556,7 @@ static void getListMainSinks(struct afb_req request)
gint16 volume, mutestate;
GVariant* child = g_variant_get_child_value(mainSinkList, i);
g_variant_get(
- child,"(qs(nn)nnq)",
+ child,"(qs(nn)nnq)",
&sinkid, &sinkname, &av, &avr, &volume, &mutestate, &sinkclassid);
AFB_DEBUG( "sinkID: %d, sinkName: %s, availability: %d, available_reason: %d, volume: %d, muteState: %d, sinkClassID: %d",
sinkid, sinkname, av, avr, volume, mutestate, sinkclassid);
@@ -588,12 +588,12 @@ static void getListMainSinks(struct afb_req request)
/**
* Call "ackConnect" function of Audio Manager.
* Return acknowledge of connect against asyncConnect
- *
+ *
* #### Parameters
* - handle : Handle id when you get on asyncConnect
* - connectionID : connection id when you got on connect return value
* - error : Error Number you would like to send. If error is 0, it means OK.
- * If an application has some error, send error number in function then AM release
+ * If an application has some error, send error number in function then AM release
* resources the application got in connect.
*
*
@@ -602,7 +602,7 @@ static void getListMainSinks(struct afb_req request)
* Sound Manager return success. So you should check the contents size of return json object
*
* #### Note
- *
+ *
*/
static void ackConnect(struct afb_req request)
{
@@ -612,11 +612,11 @@ static void ackConnect(struct afb_req request)
guint16 ret = 0;
REQ_ERROR req_err1, req_err2 , req_err3;
GError *err = NULL;
-
+
req_err1 = get_value_uint16(request, _HANDLE, &handle);
req_err2 = get_value_uint16(request, _CONNECTION_ID, &connection_id);
req_err3 = get_value_uint16(request, _ERROR, &error);
-
+
if((req_err1 != REQ_OK) || (req_err2 != REQ_OK) || (req_err3 != REQ_OK))
{
afb_req_fail(request,"wrong-request", NULL);
@@ -627,7 +627,7 @@ static void ackConnect(struct afb_req request)
afb_req_fail(request,"wrong-request", "connectionID is more than 0");
return;
}
-
+
audiomanager_routinginterface_call_ack_connect_sync(
am_route_bus,
handle,
@@ -643,7 +643,7 @@ static void ackConnect(struct afb_req request)
/*create response json object*/
struct json_object *res = json_object_new_object();
sm_add_object_to_json_object_func(res, __FUNCTION__, 2,
- _ERROR, ret);
+ _ERROR, ret);
char *info = get_response_audiomanager_massage_error(ret);
afb_req_success(request, res, info);
}
@@ -651,7 +651,7 @@ static void ackConnect(struct afb_req request)
/**
* Call "ackDisconnect" function of Audio Manager.
* Return acknowledge of disconnect against asyncDisconnect
- *
+ *
* #### Parameters
* - handle : Handle id when you get on asyncDisconnect
* - connectionID : connection id when you got on connect return value
@@ -664,7 +664,7 @@ static void ackConnect(struct afb_req request)
* Sound Manager return success. So you should check the contents size of return json object
*
* #### Note
- *
+ *
*/
static void ackDisconnect(struct afb_req request)
{
@@ -674,14 +674,14 @@ static void ackDisconnect(struct afb_req request)
guint16 ret = 0;
REQ_ERROR req_err1, req_err2 , req_err3;
GError *err = NULL;
-
+
req_err1 = get_value_uint16(request, _HANDLE, &handle);
req_err2 = get_value_uint16(request, _CONNECTION_ID, &connection_id);
req_err3 = get_value_uint16(request, _ERROR, &error);
-
+
if((req_err1 != REQ_OK) || (req_err2 != REQ_OK) || (req_err3 != REQ_OK))
{
- afb_req_fail(request,"wrong-request", "connectionID is more than 0");
+ afb_req_fail(request,"wrong-request", "connectionID is more than 0");
return;
}
if(connection_id == 0)
@@ -705,7 +705,7 @@ static void ackDisconnect(struct afb_req request)
/*create response json object*/
struct json_object *res = json_object_new_object();
sm_add_object_to_json_object_func(res, __FUNCTION__, 2,
- _ERROR, ret);
+ _ERROR, ret);
char *info = get_response_audiomanager_massage_error(ret);
afb_req_success(request, res, info);
}
@@ -720,12 +720,12 @@ static void ackDisconnect(struct afb_req request)
* If an application has some errors, send error number in function
*
* #### Rreturn
- * - error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message.
+ * - error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message.
*
* #### Note
* This function is very important for applications to realise the sequence of Audio Management.
* An Application which matches with sourceID in the parameter of asyncSetSourceState has to return ack to use this function
- *
+ *
*/
static void ackSetSourceState(struct afb_req request)
{
@@ -734,14 +734,14 @@ static void ackSetSourceState(struct afb_req request)
guint16 ret = 0;
REQ_ERROR req_err1, req_err2;
GError *err = NULL;
-
+
req_err1 = get_value_uint16(request, _HANDLE, &handle);
req_err2 = get_value_uint16(request, _ERROR, &error);
-
+
if((req_err1 != REQ_OK) || (req_err2 != REQ_OK))
{
AFB_DEBUG("wrong request");
- afb_req_fail(request,"wrong-request", NULL);
+ afb_req_fail(request,"wrong-request", NULL);
return;
}
@@ -759,7 +759,7 @@ static void ackSetSourceState(struct afb_req request)
/*create response json object*/
struct json_object *res = json_object_new_object();
sm_add_object_to_json_object_func(res, __FUNCTION__, 2,
- _ERROR, ret);
+ _ERROR, ret);
char *info = get_response_audiomanager_massage_error(ret);
afb_req_success(request, res, info);
}
@@ -768,33 +768,33 @@ static void ackSetSourceState(struct afb_req request)
* Call "registerSource" function of Audio Manager.
* Register source(application) to Audio Manager Policy Management
* Application must call this function on its initialization
- *
+ *
* #### Parameters
* - appname : Application unieque name
* [Option]
* It is not necessary to designate following argument, because these are default value is selected y soundmanager
* If you would like to set value, please input the following key and value
- * - sourceClassID :
+ * - sourceClassID :
* - sourceState :
*
* #### Return
- * - error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message.
+ * - error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message.
*
* #### Note
- *
+ *
*/
static void registerSource(struct afb_req request)
{
AFB_DEBUG("call %s", __FUNCTION__);
GError *err = NULL;
-
+
guint16 source_id; /* q 0 is for dynamic id*/
guint16 domain_id; /* q */
guint16 source_class_id; /* q */
gint32 source_state; /* i */
gint16 volume; /* n */
-
+
if(REQ_OK != get_value_uint16(request, _SOURCE_ID, &source_id)){
source_id = DYNAMIC_SOURCE_ID; /* if 0, dynamic source id will be applied */
}
@@ -842,7 +842,7 @@ static void registerSource(struct afb_req request)
struct sound_property_s sound_property_list; /* a(in) */
sound_property_list.type = 0;
sound_property_list.value = 0; /* in reality, this is array of struct */
-
+
gint32 connection_format_list = DEFAULT_CONNECTION_FORMAT; /* ai */
struct main_sound_property_s main_property_list; /* a(in) */
main_property_list.type = 0;
@@ -862,7 +862,7 @@ static void registerSource(struct afb_req request)
guint16 acquire_source_id;
guint16 ret;
- GVariant* sourceData = create_source_data (source_id, domain_id, name, source_class_id,
+ GVariant* sourceData = create_source_data (source_id, domain_id, name, source_class_id,
source_state, volume, visible, available, interrupt,
sound_property_list, connection_format_list, main_property_list,
nconf_routing, nconf_command);
@@ -894,23 +894,23 @@ static void registerSource(struct afb_req request)
/**
* Call "deregisterSource" function of Audio Manager.
* Deregister source(application) to Audio Manager Policy Management
- *
+ *
* #### Parameters
* - sourceID : sourceID returned in resisterSource
*
* #### Rreturn
- * - error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message.
+ * - error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message.
*
* #### Note
- *
+ *
*/
static void deregisterSource(struct afb_req request)
{
guint16 source_id;
guint16 ret;
-
+
GError *err = NULL;
-
+
if(REQ_OK != get_value_uint16(request, _SOURCE_ID, &source_id)){
afb_req_fail(request, "wrong-request", NULL);
}
@@ -936,39 +936,39 @@ static void deregisterSource(struct afb_req request)
/**
* Subscribe event
- *
+ *
* #### Parameters
* - event : Event name. Event list is written in libsoundmanager.hpp
*
* #### Rreturn
- * - error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message.
+ * - error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message.
*
* #### Note
- *
+ *
*/
static void subscribe(struct afb_req request)
{
const char *value = afb_req_value(request, "event");
AFB_DEBUG( "value is %s", value);
int ret = 0;
- if(value) {
+ if(value) {
int index = sm_search_event_name_index(value);
if(index < 0)
{
index = sm_search_routing_event_name_index(value);
if(index < 0)
{
- AFB_NOTICE( "dedicated event doesn't exist");
+ AFB_NOTICE( "dedicated event doesn't exist");
ret = EVENT_SUBSCRIBE_ERROR_CODE;
}
else
{
afb_req_subscribe(request, *routing_event_list[index].event);
- }
+ }
}
else
{
- afb_req_subscribe(request, *command_event_list[index].event);
+ afb_req_subscribe(request, *command_event_list[index].event);
}
}
else{
@@ -978,46 +978,46 @@ static void subscribe(struct afb_req request)
/*create response json object*/
struct json_object *res = json_object_new_object();
sm_add_object_to_json_object_func(res, __FUNCTION__, 2,
- _ERROR, ret);
+ _ERROR, ret);
char *info = get_response_audiomanager_massage_error(ret);
afb_req_success(request, res, info);
}
/**
* Unsubscribe event
- *
+ *
* #### Parameters
* - event : Event name. Event list is written in libsoundmanager.hpp
*
* #### Rreturn
- * - error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message.
+ * - error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message.
*
* #### Note
- *
+ *
*/
static void unsubscribe(struct afb_req request)
{
const char *value = afb_req_value(request, "event");
AFB_DEBUG( "value is %s", value);
int ret = 0;
- if(value) {
+ if(value) {
int index = sm_search_event_name_index(value);
if(index < 0)
{
index = sm_search_routing_event_name_index(value);
if(index < 0)
{
- AFB_NOTICE( "dedicated event doesn't exist");
+ AFB_NOTICE( "dedicated event doesn't exist");
ret = EVENT_SUBSCRIBE_ERROR_CODE;
}
else
{
afb_req_unsubscribe(request, *routing_event_list[index].event);
- }
+ }
}
else
{
- afb_req_unsubscribe(request, *command_event_list[index].event);
+ afb_req_unsubscribe(request, *command_event_list[index].event);
}
}
else{
@@ -1027,7 +1027,7 @@ static void unsubscribe(struct afb_req request)
/*create response json object*/
struct json_object *res = json_object_new_object();
sm_add_object_to_json_object_func(res, __FUNCTION__, 2,
- _ERROR, ret);
+ _ERROR, ret);
char *info = get_response_audiomanager_massage_error(ret);
afb_req_success(request, res, info);
}
@@ -1045,7 +1045,7 @@ static void on_new_main_connection(AudiomanagerCommandinterface* interface,
gint16 delay, constate;
g_variant_get(
mainConnection,"(qqqnn)", &mcid, &srcid, &sinkid, &delay, &constate);
-
+
struct json_object* res_obj = json_object_new_object();
sm_add_object_to_json_object(res_obj,10,
_MAIN_CONNECTION_ID, mcid,
@@ -1063,9 +1063,9 @@ static void on_removed_main_connection(
AudiomanagerCommandinterface* interface, guint16 mainConnectionID)
{
AFB_DEBUG("%s is called",__FUNCTION__);
-
+
struct json_object* res_obj = json_object_new_object();
- sm_add_object_to_json_object(res_obj, 2,
+ sm_add_object_to_json_object(res_obj, 2,
_MAIN_CONNECTION_ID, mainConnectionID);
afb_event_push(ev_removed_main_connection, res_obj);
}
@@ -1076,7 +1076,7 @@ static void on_main_connection_state_changed(
AFB_DEBUG("%s is called",__FUNCTION__);
struct json_object* res_obj = json_object_new_object();
- sm_add_object_to_json_object(res_obj, 4,
+ sm_add_object_to_json_object(res_obj, 4,
_CONNECTION_ID, connectionID,
_CONNECTION_STATE, connectionState);
afb_event_push(ev_main_connection_state_changed, res_obj);
@@ -1135,7 +1135,7 @@ static gboolean on_async_abort(
GDBusMethodInvocation *invocation,
guint16 arg_handle)
{
- AFB_DEBUG( "%s called", __FUNCTION__);
+ AFB_DEBUG( "%s called", __FUNCTION__);
/* Nothing To Do. If it is better to implement something, I will implement */
return TRUE;
}
@@ -1160,7 +1160,7 @@ static gboolean on_async_connect(
_CONNECTION_FORMAT, arg_connectionFormat);
afb_event_push(ev_async_connect, ev_obj);
- /* GError must be initialized here because it is same as grobal errno,
+ /* GError must be initialized here because it is same as grobal errno,
so if afb_event_push is failed due to something, number will be changed */
GError* err = NULL;
audiomanager_routinginterface_call_ack_connect_sync(
@@ -1174,7 +1174,7 @@ static gboolean on_async_connect(
AFB_ERROR( "Can't send ack to sound manager adapter %s", __FUNCTION__);
return FALSE;
}
- return TRUE;
+ return TRUE;
}
static gboolean on_async_disconnect(
@@ -1224,7 +1224,7 @@ static gboolean on_async_set_sink_volume(
AFB_ERROR( "Can't send ack to sound manager adapter %s", __FUNCTION__);
return FALSE;
}
- return TRUE;
+ return TRUE;
}
/**
@@ -1234,7 +1234,7 @@ static gboolean on_async_set_sink_volume(
* #### Parameters
* Request key
* - sourceID : sourceID to be commanded by Audio Manager. The contents of command is sourceState
- * - handle : handle is the dynamic number managed by Audio Manager. Please return this parameter to input ackSetSourceState as is
+ * - handle : handle is the dynamic number managed by Audio Manager. Please return this parameter to input ackSetSourceState as is
* - sourceState : "on" is the instruction that application can output sound
* "off" is the instruction that application sound right will be removed_main_connection
* "pause" is the instruction that application must stop output sound because other applications temporaly got sound right and will output sound
@@ -1251,7 +1251,7 @@ static gboolean on_async_set_source_state(
guint16 arg_sourceID,
gint arg_sourceState)
{
- AFB_DEBUG( "%s called", __FUNCTION__);
+ AFB_DEBUG( "%s called", __FUNCTION__);
struct json_object* ev_obj = json_object_new_object();
char* ss_key = get_source_state_key(arg_sourceState);
sm_add_object_to_json_object(ev_obj, 4,
@@ -1272,33 +1272,33 @@ static gboolean on_async_set_source_state(
* array of the verbs exported to afb-daemon
*/
static const struct afb_verb_v2 binding_verbs[]= {
-{ .verb = "connect", .callback = connect, .auth = NULL,
+{ .verb = "connect", .callback = connect, .auth = NULL,
.info = "Connect source id and sink id" , .session = AFB_SESSION_NONE},
-{ .verb = "disconnect", .callback = disconnect, .auth = NULL,
+{ .verb = "disconnect", .callback = disconnect, .auth = NULL,
.info = "Disconnect source id and sink id" , .session = AFB_SESSION_NONE},
-{ .verb = "setVolume", .callback = setVolume, .auth = NULL,
+{ .verb = "setVolume", .callback = setVolume, .auth = NULL,
.info = "Set volume value" , .session = AFB_SESSION_NONE}, /* it is better to show the range*/
-{ .verb = "volumeStep", .callback = volumeStep, .auth = NULL,
+{ .verb = "volumeStep", .callback = volumeStep, .auth = NULL,
.info = "Set volume step range" , .session = AFB_SESSION_NONE},
-{ .verb = "setSinkMuteState", .callback = setSinkMuteState, .auth = NULL,
+{ .verb = "setSinkMuteState", .callback = setSinkMuteState, .auth = NULL,
.info = "Set Mute state: 1 means mute, 2 means umute. Others are invalid" ,.session = AFB_SESSION_NONE},
-{ .verb = "getListMainConnections", .callback = getListMainConnections, .auth = NULL,
+{ .verb = "getListMainConnections", .callback = getListMainConnections, .auth = NULL,
.info = "Get MainConnection List" , .session = AFB_SESSION_NONE},
-{ .verb = "getListMainSinks", .callback = getListMainSinks, .auth = NULL,
+{ .verb = "getListMainSinks", .callback = getListMainSinks, .auth = NULL,
.info = "Get MainSink List" , .session = AFB_SESSION_NONE},
-{ .verb = "registerSource", .callback = registerSource, .auth = NULL,
+{ .verb = "registerSource", .callback = registerSource, .auth = NULL,
.info = "Register Application" , .session = AFB_SESSION_NONE},
-{ .verb = "deregisterSource", .callback = deregisterSource, .auth = NULL,
+{ .verb = "deregisterSource", .callback = deregisterSource, .auth = NULL,
.info = "Deregister Application" , .session = AFB_SESSION_NONE},
-{ .verb = "ackConnect", .callback = ackConnect, .auth = NULL,
+{ .verb = "ackConnect", .callback = ackConnect, .auth = NULL,
.info = "Acknowledge of asyncConnect" , .session = AFB_SESSION_NONE},
-{ .verb = "ackDisconnect", .callback = ackDisconnect, .auth = NULL,
+{ .verb = "ackDisconnect", .callback = ackDisconnect, .auth = NULL,
.info = "Acknowledge of asyncConnect" , .session = AFB_SESSION_NONE},
-{ .verb = "ackSetSourceState", .callback = ackSetSourceState, .auth = NULL,
+{ .verb = "ackSetSourceState", .callback = ackSetSourceState, .auth = NULL,
.info = "Acknowledge of asyncSetSourceState" , .session = AFB_SESSION_NONE},
-{ .verb = "subscribe", .callback = subscribe, .auth = NULL,
+{ .verb = "subscribe", .callback = subscribe, .auth = NULL,
.info = "Subscribe event" , .session = AFB_SESSION_NONE},
-{ .verb = "unsubscribe", .callback = unsubscribe, .auth = NULL,
+{ .verb = "unsubscribe", .callback = unsubscribe, .auth = NULL,
.info = "Unsubscribe event" , .session = AFB_SESSION_NONE},
{ .verb = NULL } /* marker for end of the array */};
@@ -1335,11 +1335,11 @@ static int registerDomain()
guint16 error;
audiomanager_routinginterface_call_register_domain_sync(
- am_route_bus,
+ am_route_bus,
domainData,
- retBusName,
+ retBusName,
retPath,
- retInterface,
+ retInterface,
&domain_id, &error,
NULL, &err);
if(err != NULL){
@@ -1437,7 +1437,7 @@ static int create_adapter()
static void on_name_lost(GDBusServer *server, GDBusConnection *conn, gpointer data)
{
- AFB_WARNING("%s called", __FUNCTION__);
+ AFB_WARNING("%s called", __FUNCTION__);
}
@@ -1457,33 +1457,33 @@ static int sm_event_init()
ev_removed_main_connection = afb_daemon_make_event(cmd_evlist[2]);
ev_sink_mute_state_changed = afb_daemon_make_event(cmd_evlist[3]);
ev_main_connection_state_changed = afb_daemon_make_event(cmd_evlist[4]);
- command_event_list[0].name = cmd_evlist[0];
+ command_event_list[0].name = cmd_evlist[0];
command_event_list[0].event = &ev_volume_changed;
- command_event_list[1].name = cmd_evlist[1];
+ command_event_list[1].name = cmd_evlist[1];
command_event_list[1].event = &ev_new_connection;
- command_event_list[2].name = cmd_evlist[2];
+ command_event_list[2].name = cmd_evlist[2];
command_event_list[2].event = &ev_removed_main_connection;
- command_event_list[3].name = cmd_evlist[3];
+ command_event_list[3].name = cmd_evlist[3];
command_event_list[3].event = &ev_sink_mute_state_changed;
- command_event_list[4].name = cmd_evlist[4];
+ command_event_list[4].name = cmd_evlist[4];
command_event_list[4].event = &ev_main_connection_state_changed;
/* create routing event */
ev_set_routing_ready = afb_daemon_make_event(route_evlist[0]);
- ev_set_routing_rundown = afb_daemon_make_event(route_evlist[1]);
+ ev_set_routing_rundown = afb_daemon_make_event(route_evlist[1]);
ev_async_connect = afb_daemon_make_event(route_evlist[2]);
ev_async_set_source_state = afb_daemon_make_event(route_evlist[3]);
ev_async_disconnect = afb_daemon_make_event(route_evlist[4]);
-
- routing_event_list[0].name = route_evlist[0];
+
+ routing_event_list[0].name = route_evlist[0];
routing_event_list[0].event = &ev_set_routing_ready;
- routing_event_list[1].name = route_evlist[1];
+ routing_event_list[1].name = route_evlist[1];
routing_event_list[1].event = &ev_set_routing_rundown;
- routing_event_list[2].name = route_evlist[2];
+ routing_event_list[2].name = route_evlist[2];
routing_event_list[2].event = &ev_async_connect;
- routing_event_list[3].name = route_evlist[3];
+ routing_event_list[3].name = route_evlist[3];
routing_event_list[3].event = &ev_async_set_source_state;
- routing_event_list[4].name = route_evlist[4];
+ routing_event_list[4].name = route_evlist[4];
routing_event_list[4].event = &ev_async_disconnect;
/*for(size_t i = 0; i < size; ++i)
{
@@ -1496,7 +1496,7 @@ static int sm_event_init()
command_event_list[i] = ev;
search_result = hsearch(entry, FIND);
if(search_result)
- AFB_NOTICE( "event name is %s", search_result->key);
+ AFB_NOTICE( "event name is %s", search_result->key);
}*/
/* Initialize dbus event thread */
@@ -1511,33 +1511,33 @@ static int sm_event_init()
goto ev_init_out;
}
/* initialize signal from audio manager command interface */
- g_signal_connect(am_cmd_bus,
- "volume_changed",
- G_CALLBACK(on_volume_changed),
+ g_signal_connect(am_cmd_bus,
+ "volume_changed",
+ G_CALLBACK(on_volume_changed),
NULL);
- g_signal_connect(am_cmd_bus,
- "new_main_connection",
- G_CALLBACK(on_new_main_connection),
+ g_signal_connect(am_cmd_bus,
+ "new_main_connection",
+ G_CALLBACK(on_new_main_connection),
NULL);
- g_signal_connect(am_cmd_bus,
- "removed_main_connection",
- G_CALLBACK(on_removed_main_connection),
+ g_signal_connect(am_cmd_bus,
+ "removed_main_connection",
+ G_CALLBACK(on_removed_main_connection),
NULL);
- g_signal_connect(am_cmd_bus,
- "sink_mute_state_changed",
- G_CALLBACK(on_sink_mute_state_changed),
+ g_signal_connect(am_cmd_bus,
+ "sink_mute_state_changed",
+ G_CALLBACK(on_sink_mute_state_changed),
NULL);
- g_signal_connect(am_cmd_bus,
- "main_connection_state_changed",
- G_CALLBACK(on_main_connection_state_changed),
+ g_signal_connect(am_cmd_bus,
+ "main_connection_state_changed",
+ G_CALLBACK(on_main_connection_state_changed),
NULL);
- g_signal_connect(am_route_bus,
- "set_routing_ready",
- G_CALLBACK(on_set_routing_ready),
+ g_signal_connect(am_route_bus,
+ "set_routing_ready",
+ G_CALLBACK(on_set_routing_ready),
NULL);
- g_signal_connect(am_route_bus,
- "set_routing_rundown",
- G_CALLBACK(on_set_routing_rundown),
+ g_signal_connect(am_route_bus,
+ "set_routing_rundown",
+ G_CALLBACK(on_set_routing_rundown),
NULL);
/* Get soundmanager adapter bus */
@@ -1547,14 +1547,14 @@ static int sm_event_init()
ret = create_adapter();
if(ret != 0)
{
- goto ev_init_out;
+ goto ev_init_out;
}
ret = registerDomain();
if(ret != 0)
{
AFB_ERROR("registerDomain error: %s",get_response_audiomanager_massage_error(ret));
- goto ev_init_out;
+ goto ev_init_out;
}
AFB_INFO("Finish Initialize event receive setting");