summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt7
-rw-r--r--src/soundmanager.c74
2 files changed, 79 insertions, 2 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1ec3336..7a29782 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -27,6 +27,13 @@ set(binding_sm_sources
sm-helper.c
dbus/audio_manager_interface.c)
+option(ENABLE_AGL_AHL "Implement AGL High Level API" ON)
+
+if(ENABLE_AGL_AHL)
+ message(STATUS "Adopt high level API of AGL")
+ add_definitions(-DENABLE_AGL_AHL)
+endif()
+
include_directories(dbus)
link_libraries(-Wl,--as-needed -Wl,--gc-sections -Wl,--no-undefined)
diff --git a/src/soundmanager.c b/src/soundmanager.c
index bc7c6e8..3719ff9 100644
--- a/src/soundmanager.c
+++ b/src/soundmanager.c
@@ -1032,6 +1032,66 @@ static void unsubscribe(struct afb_req request)
afb_req_success(request, res, info);
}
+/**
+ * Application High Level API for AGL
+ * This function opens "stream".
+ * "stream" means the routing from source to sink.
+ * This function calls registerSource and register the endpoint.
+ * If the endpoint is not registered in AudioManager, Sound Manager uses default value.
+ * audio_role will be translated to "sourceID", and "endpoint_id" will be translated to "sinkID".
+ *
+ * #### Parameters
+ * - audio_role : audio role such like entertainment, emergency.
+ * This name is depends on the system architect.
+ * The name will be application name or will be the group(role) of application.
+ * - endpoint_id : Same as sinkID in Sound Manager.
+ *
+ * #### 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.
+ * - stream_id : Same as sourceID but the key is different. This is for AHL.
+ * #### Note
+ * TODO : write note
+ */
+static void streamOpen(struct afb_req req){
+// TODO : wtite function
+}
+
+/**
+ * Application High Level API for AGL
+ * This function closes "stream".
+ * This function calls disconnect with registered connectionID translated with requested connection_id.
+ * If the connection is not created in Sound Manager, Sound Manager just returns with error message.
+ *
+ * #### Parameters
+ * - stream_id : Stream id which is returned in stream_open.
+ *
+ * #### 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.
+ * #### Note
+ * TODO : write note
+ */
+static void streamClose(struct afb_req req){
+// TODO : wtite function
+}
+
+/**
+ * Application High Level API for AGL
+ * This function set stream state.
+ * This function set the availability and calls connect function of Audio Manager
+ * and returns the result of policy check.
+ *
+ * #### Parameters
+ * - stream_id : Stream id which is returned in stream_open.
+ * - mute : Stream state as int
+ * #### 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.
+ * #### Note
+ * TODO : write note
+ */
+static void setStreamState(struct afb_req req){
+// TODO : wtite function
+}
+
/*
********** Callback Function invoked by Audio Manager **********
*/
@@ -1272,6 +1332,16 @@ static gboolean on_async_set_source_state(
* array of the verbs exported to afb-daemon
*/
static const struct afb_verb_v2 binding_verbs[]= {
+#ifdef ENABLE_AGL_AHL
+// High level API of AGL
+{ .verb = "stream_open", .callback = streamOpen, .auth = NULL,
+ .info = "Open stream." , .session = AFB_SESSION_NONE},
+{ .verb = "stream_close", .callback = streamClose, .auth = NULL,
+ .info = "Close stream" , .session = AFB_SESSION_NONE},
+{ .verb = "set_stream_state", .callback = setStreamState, .auth = NULL,
+ .info = "Set stream state" , .session = AFB_SESSION_NONE},
+#endif
+// Adaption API of Audio Manager
{ .verb = "connect", .callback = connect, .auth = NULL,
.info = "Connect source id and sink id" , .session = AFB_SESSION_NONE},
{ .verb = "disconnect", .callback = disconnect, .auth = NULL,
@@ -1287,9 +1357,9 @@ static const struct afb_verb_v2 binding_verbs[]= {
{ .verb = "getListMainSinks", .callback = getListMainSinks, .auth = NULL,
.info = "Get MainSink List" , .session = AFB_SESSION_NONE},
{ .verb = "registerSource", .callback = registerSource, .auth = NULL,
- .info = "Register Application" , .session = AFB_SESSION_NONE},
+ .info = "Register audio role" , .session = AFB_SESSION_NONE},
{ .verb = "deregisterSource", .callback = deregisterSource, .auth = NULL,
- .info = "Deregister Application" , .session = AFB_SESSION_NONE},
+ .info = "Deregister audio role" , .session = AFB_SESSION_NONE},
{ .verb = "ackConnect", .callback = ackConnect, .auth = NULL,
.info = "Acknowledge of asyncConnect" , .session = AFB_SESSION_NONE},
{ .verb = "ackDisconnect", .callback = ackDisconnect, .auth = NULL,