diff options
author | Fulup Ar Foll <fulup@iot.bzh> | 2017-08-03 21:56:01 +0200 |
---|---|---|
committer | Fulup Ar Foll <fulup@iot.bzh> | 2017-08-03 21:56:01 +0200 |
commit | 33c2cd0236823d108cbb21af34b8d7843d117ac1 (patch) | |
tree | d206f292a0ec54beb0af54dbedf66da85f0f0e39 | |
parent | 070ccac33d65c651c972dfab9c6148e43d8d5d8e (diff) |
Initial version of Policy Control
-rw-r--r-- | Alsa-Plugin/Alsa-Policy-Hook/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Alsa-Plugin/Alsa-Policy-Hook/PolicyHookCb.c (renamed from Alsa-Plugin/Alsa-Policy-Hook/AlsaHookCb.c) | 151 | ||||
-rw-r--r-- | Alsa-Plugin/Alsa-Policy-Hook/README.md | 34 | ||||
-rw-r--r-- | PolicyCtl-afb/CMakeLists.txt | 58 | ||||
-rw-r--r-- | PolicyCtl-afb/polctl-apidef.h | 90 | ||||
-rw-r--r-- | PolicyCtl-afb/polctl-apidef.json | 175 | ||||
-rw-r--r-- | PolicyCtl-afb/polctl-binding.c | 174 | ||||
-rw-r--r-- | conf.d/alsa/asoundrc.sample | 38 | ||||
-rw-r--r-- | nbproject/configurations.xml | 242 | ||||
-rw-r--r-- | nbproject/project.xml | 2 |
10 files changed, 806 insertions, 162 deletions
diff --git a/Alsa-Plugin/Alsa-Policy-Hook/CMakeLists.txt b/Alsa-Plugin/Alsa-Policy-Hook/CMakeLists.txt index 3780ee5..e8342a1 100644 --- a/Alsa-Plugin/Alsa-Policy-Hook/CMakeLists.txt +++ b/Alsa-Plugin/Alsa-Policy-Hook/CMakeLists.txt @@ -20,10 +20,10 @@ add_compile_options(-DPIC) -PROJECT_TARGET_ADD(alsa_hook_cb) +PROJECT_TARGET_ADD(policy_hook_cb) # Define targets - ADD_LIBRARY(${TARGET_NAME} MODULE AlsaHookCb.c) + ADD_LIBRARY(${TARGET_NAME} MODULE PolicyHookCb.c) # Alsa Plugin properties SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES diff --git a/Alsa-Plugin/Alsa-Policy-Hook/AlsaHookCb.c b/Alsa-Plugin/Alsa-Policy-Hook/PolicyHookCb.c index 2675805..ae2a5a3 100644 --- a/Alsa-Plugin/Alsa-Policy-Hook/AlsaHookCb.c +++ b/Alsa-Plugin/Alsa-Policy-Hook/PolicyHookCb.c @@ -50,6 +50,12 @@ // this should be more than enough #define MAX_API_CALL 10 + +// timeout in ms +#define REQUEST_DEFAULT_TIMEOUT 100 +#ifndef MAINLOOP_WATCHDOG +#define MAINLOOP_WATCHDOG 60000 +#endif // Currently not implemented #define UNUSED(x) UNUSED_ ## x __attribute__((__unused__)) @@ -81,7 +87,7 @@ typedef struct { static void *LoopInThread(void *handle) { afbClientT *afbClient = (afbClientT*) handle; int count=0; - int watchdog= 60 *1000000; + int watchdog= MAINLOOP_WATCHDOG *1000; /* loop until end */ for (;;) { @@ -97,35 +103,93 @@ static void *LoopInThread(void *handle) { static void OnHangupCB(void *handle, struct afb_wsj1 *wsj1) { afbClientT *afbClient = (afbClientT*) handle; - snd_pcm_close (afbClient->pcm); - SNDERR("(Hoops) Lost Connection to %s", afbClient->uri); - exit(0); + + // try to close PCM when impossible terminate client + int err = snd_pcm_close (afbClient->pcm); + if (err) exit(1); +} + +// supported action +typedef enum { + ACTION_PAUSE, + ACTION_START, + ACTION_STOP, + ACTION_RESUME, + + ACTION_NONE +} evtActionEnumT; + +// action label/enum map +const char *evtActionLabels[] ={ + [ACTION_PAUSE] = "pause", + [ACTION_START] = "start", + [ACTION_STOP] = "stop", + [ACTION_RESUME]= "resume", + + [ACTION_NONE]=NULL +}; + +static evtActionEnumT getActionEnum (const char *label) { + int idx; + + if (!label) return ACTION_NONE; + + for (idx = 0; evtActionLabels[idx] != NULL; idx++) { + if (! strcmp(evtActionLabels[idx], label)) break; + } + + if (evtActionLabels[idx]) return idx; + else return ACTION_NONE; } void OnEventCB(void *handle, const char *event, struct afb_wsj1_msg *msg) { afbClientT *afbClient = (afbClientT*) handle; - int err; + json_object *eventJ, *tmpJ, *dataJ; + const char *action; + int err, value, done; - printf("ON-EVENT %s(%s)\n", event, afb_wsj1_msg_object_s(msg)); - // pause PCM until request call succeed - err = snd_pcm_pause (afbClient->pcm, 1); - if (err < 0) { - fprintf (stderr, "PCM Fail to pause\n"); + eventJ = afb_wsj1_msg_object_j(msg); + done= json_object_object_get_ex(eventJ,"data", &dataJ); + if (!done) { + SNDERR ("PCM_HOOK: uri=%s empty event action", afbClient->uri); goto OnErrorExit; - } + } + + json_object_object_get_ex(dataJ,"action", &tmpJ); + action=json_object_get_string(tmpJ); - // wait on a semaphore until request return or timeout - err = snd_pcm_pause (afbClient->pcm, 0); - if (err < 0) { - fprintf (stderr, "PCM Fail to resume\n"); - goto OnErrorExit; + json_object_object_get_ex(dataJ,"value", &tmpJ); + value=json_object_get_int(tmpJ); + + switch (getActionEnum(action)) { + case ACTION_PAUSE: + err = snd_pcm_pause (afbClient->pcm, value); + if (err < 0) SNDERR ("PCM_HOOK: Fail to pause value=%d\n", value); + break; + + case ACTION_STOP: + err = snd_pcm_drop (afbClient->pcm); + if (err < 0) SNDERR ("PCM_HOOK: Fail to close\n"); + break; + + case ACTION_START: + err = snd_pcm_resume (afbClient->pcm); + if (err < 0) SNDERR ("PCM_HOOK: Fail to start\n"); + break; + + default: + SNDERR ("PCM_HOOK: Unsupported Event uri=%s action=%s", afbClient->uri, action); + goto OnErrorExit; } -OnErrorExit: + if (afbClient->verbose) printf("ON-EVENT action=%s value=%d\n", action, value); return; +OnErrorExit: + SNDERR("ON-EVENT %s(%s)\n", event, afb_wsj1_msg_object_s(msg)); + return; } // callback interface for wsj1 @@ -135,11 +199,6 @@ static struct afb_wsj1_itf itf = { .on_event = OnEventCB }; -void OnAbortPcm (afbClientT *afbClient) { - printf("ON-ABORT-PCM PCM=%s URI=%s\n", snd_pcm_name(afbClient->pcm), afbClient->uri); - snd_pcm_close (afbClient->pcm); -} - void OnResponseCB(void *handle, struct afb_wsj1_msg *msg) { afbRequestT *afbRequest= (afbRequestT*)handle; @@ -148,10 +207,7 @@ void OnResponseCB(void *handle, struct afb_wsj1_msg *msg) { // Cancel timeout for this request sd_event_source_unref(afbRequest->evtSource); - if (! afb_wsj1_msg_is_reply_ok(msg)) { - fprintf(stderr, "ON-RESPONSE ERROR call=%s response=%s\n", afbRequest->callIdTag, afb_wsj1_msg_object_s(msg)); - OnAbortPcm (afbRequest->afbClient); - } + if (! afb_wsj1_msg_is_reply_ok(msg)) goto OnErrorExit; // When not more waiting call release semaphore afbRequest->afbClient->count--; @@ -160,12 +216,18 @@ void OnResponseCB(void *handle, struct afb_wsj1_msg *msg) { afbRequest->afbClient->error=0; sem_post (&afbRequest->afbClient->semaphore); } + return; + +OnErrorExit: + fprintf(stderr, "ON-RESPONSE ERROR call=%s response=%s\n", afbRequest->callIdTag, afb_wsj1_msg_object_s(msg)); + afbRequest->afbClient->error=1; + sem_post (&afbRequest->afbClient->semaphore); } int OnTimeoutCB (sd_event_source* source, uint64_t timer, void* handle) { afbClientT *afbClient= (afbClientT*)handle; - fprintf(stderr, "ON-TIMEOUT Call Request Fail URI=%s\n", afbClient->uri); + SNDERR("\nON-TIMEOUT Call Request Fail URI=%s\n", afbClient->uri); // Close PCM and release waiting client afbClient->error=1; @@ -181,14 +243,14 @@ static int CallWithTimeout(afbClientT *afbClient, afbRequestT *afbRequest, int c // create a unique tag for request (void) asprintf(&afbRequest->callIdTag, "%d:%s/%s", count, afbRequest->api, afbRequest->verb); - - err = afb_wsj1_call_s(afbClient->wsj1, afbRequest->api, afbRequest->verb, afbRequest->query, OnResponseCB, afbRequest); - if (err) goto OnErrorExit; // create a timer with ~250us accuracy sd_event_now(afbClient->sdLoop, CLOCK_MONOTONIC, &usec); sd_event_add_time(afbClient->sdLoop, &afbRequest->evtSource, CLOCK_MONOTONIC, usec+afbRequest->timeout*1000, 250, OnTimeoutCB, afbClient); + err = afb_wsj1_call_s(afbClient->wsj1, afbRequest->api, afbRequest->verb, afbRequest->query, OnResponseCB, afbRequest); + if (err) goto OnErrorExit; + // save client handle in request afbRequest->afbClient = afbClient; afbClient->count ++; @@ -204,6 +266,11 @@ static int LaunchCallRequest(afbClientT *afbClient, afbRequestT **afbRequest) { pthread_t tid; int err, idx; + // init waiting counting semaphore + if (sem_init(&afbClient->semaphore, 1, 0) == -1) { + fprintf(stderr, "LaunchCallRequest: Fail Semaphore Init: %s\n", afbClient->uri); + } + // Create a main loop err = sd_event_default(&afbClient->sdLoop); if (err < 0) { @@ -211,10 +278,9 @@ static int LaunchCallRequest(afbClientT *afbClient, afbRequestT **afbRequest) { goto OnErrorExit; } - // init waiting counting semaphore - if (sem_init(&afbClient->semaphore, 1, 0) == -1) { - fprintf(stderr, "LaunchCallRequest: Fail Semaphore Init: %s\n", afbClient->uri); - } + // start a thread with a mainloop to monitor Audio-Agent + err = pthread_create(&tid, NULL, &LoopInThread, afbClient); + if (err) goto OnErrorExit; // connect the websocket wsj1 to the uri given by the first argument afbClient->wsj1 = afb_ws_client_connect_wsj1(afbClient->sdLoop, afbClient->uri, &itf, afbClient); @@ -235,10 +301,6 @@ static int LaunchCallRequest(afbClientT *afbClient, afbRequestT **afbRequest) { // launch counter to keep track of waiting request call afbClient->count=idx; - // start a thread with a mainloop to monitor Audio-Agent - err = pthread_create(&tid, NULL, &LoopInThread, afbClient); - if (err) goto OnErrorExit; - return 0; OnErrorExit: @@ -249,7 +311,7 @@ static int AlsaCloseHook(snd_pcm_hook_t *hook) { afbClientT *afbClient = (afbClientT*) snd_pcm_hook_get_private (hook); - if (afbClient->verbose) fprintf(stdout, "\nAlsaCloseHook pcm=%s uri=%s\n", snd_pcm_name(afbClient->pcm), afbClient->uri); + if (afbClient->verbose) fprintf(stdout, "\nAlsaCloseHook pcm=%s\n", snd_pcm_name(afbClient->pcm)); return 0; } @@ -277,10 +339,12 @@ int PLUGIN_ENTRY_POINT (snd_pcm_t *pcm, snd_config_t *conf) { if (strcmp(id, "comment") == 0 || strcmp(id, "hint") == 0) continue; if (strcmp(id, "uri") == 0) { - if (snd_config_get_string(node, &afbClient->uri) < 0) { + const char *uri; + if (snd_config_get_string(node, &uri) < 0) { SNDERR("Invalid String for %s", id); goto OnErrorExit; } + afbClient->uri=strdup(uri); continue; } @@ -324,10 +388,7 @@ int PLUGIN_ENTRY_POINT (snd_pcm_t *pcm, snd_config_t *conf) { } // allocate an empty call request - afbRequest[callCount] = malloc(sizeof (afbRequestT)); - afbRequest[callCount]->api=NULL; - afbRequest[callCount]->verb=NULL; - afbRequest[callCount]->query=NULL; + afbRequest[callCount] = calloc(1, sizeof (afbRequestT)); err = snd_config_search(ctlconfig, "api", &itemConf); @@ -376,7 +437,7 @@ int PLUGIN_ENTRY_POINT (snd_pcm_t *pcm, snd_config_t *conf) { // Simple check on call request validity if (!afbRequest[callCount]->query) afbRequest[callCount]->query= ""; - if (!afbRequest[callCount]->timeout) afbRequest[callCount]->timeout=100; + if (!afbRequest[callCount]->timeout) afbRequest[callCount]->timeout=REQUEST_DEFAULT_TIMEOUT ; if (!afbRequest[callCount]->verb || !afbRequest[callCount]->api) { SNDERR("Missing api/verb %s in asoundrc", callLabel); goto OnErrorExit; diff --git a/Alsa-Plugin/Alsa-Policy-Hook/README.md b/Alsa-Plugin/Alsa-Policy-Hook/README.md index 108c2b5..ce0553c 100644 --- a/Alsa-Plugin/Alsa-Policy-Hook/README.md +++ b/Alsa-Plugin/Alsa-Policy-Hook/README.md @@ -27,27 +27,33 @@ pcm_hook_type.MyHookPlugin { # -------------------------------------------------------------------- pcm.MyNavigationHook { type hooks - slave.pcm "MyMixerPCM" # Target PCM to effectively play sound + slave.pcm "MyMixerPCM" - # Call request that should succeed before accessing slave PCM + # Defined used hook sharelib and provide arguments/config to install func hooks.0 { - type "MyHookPlugin" # Name=xxxx should match with pcm_hook_type.xxxx + type "MyHookPlugin" hook_args { + verbose true # print few log messages (default false); - # URI to AGL-Advance-Audio-Agent binder + # Every Call should return OK in order PCM to open (default timeout 100ms) uri "ws://localhost:1234/api?token='audio-agent-token'" - - # Call request to send to binder (initial label is free, query is optional) request { - MyFirstCheck { - api "alsacore" - verb "ping" + # Request autorisation to write on navigation + RequestNavigation { + api "polctl" + verb "navigation" } - MySecondCheck { - api "alsacore" - verb "ucmset" - query "{'devid':'hw:v1340','verb':'Navigation','dev':'speakers'}" - } + # subscribe to Audio Agent Event + SubscriveEvents { + api "polctl" + verb "monitor" + } + # force PCM stop after 10s + TestAutoStop { + api "polctl" + verb "event_test" + query "{'label':'stop', 'delay':10000}" + } } } } diff --git a/PolicyCtl-afb/CMakeLists.txt b/PolicyCtl-afb/CMakeLists.txt new file mode 100644 index 0000000..d9776df --- /dev/null +++ b/PolicyCtl-afb/CMakeLists.txt @@ -0,0 +1,58 @@ +########################################################################### +# Copyright 2015, 2016, 2017 IoT.bzh +# +# author: Fulup Ar Foll <fulup@iot.bzh> +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +########################################################################### + + +# Generate API-v2 hat from OpenAPI json definition +macro(SET_TARGET_GENSKEL TARGET_NAME API_DEF_NAME) + add_custom_command(OUTPUT ${API_DEF_NAME}.h + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS ${API_DEF_NAME}.json + COMMAND afb-genskel ${API_DEF_NAME}.json >${API_DEF_NAME}.h + ) + add_custom_target(${API_DEF_NAME}_OPENAPI DEPENDS ${API_DEF_NAME}.h) + add_dependencies(${TARGET_NAME} ${API_DEF_NAME}_OPENAPI) + +endmacro(SET_TARGET_GENSKEL) + +# Add target to project dependency list +PROJECT_TARGET_ADD(polctl-afb) + + # Define project Targets + ADD_LIBRARY(${TARGET_NAME} MODULE polctl-binding.c ) + + # Generate API-v2 hat from OpenAPI json definition + SET_TARGET_GENSKEL(${TARGET_NAME} polctl-apidef) + + # Binder exposes a unique public entry point + SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES + PREFIX "afb-" + LABELS "BINDING" + LINK_FLAGS ${BINDINGS_LINK_FLAG} + OUTPUT_NAME polctl + + ) + + # Library dependencies (include updates automatically) + TARGET_LINK_LIBRARIES(${TARGET_NAME} + audio-interface + ) + + # installation directory + INSTALL(TARGETS ${TARGET_NAME} + LIBRARY DESTINATION ${BINDINGS_INSTALL_DIR}) + diff --git a/PolicyCtl-afb/polctl-apidef.h b/PolicyCtl-afb/polctl-apidef.h new file mode 100644 index 0000000..9e2b1a7 --- /dev/null +++ b/PolicyCtl-afb/polctl-apidef.h @@ -0,0 +1,90 @@ + +static const char _afb_description_v2_polctl[] = + "{\"openapi\":\"3.0.0\",\"$schema\":\"http:iot.bzh/download/openapi/schem" + "a-3.0/default-schema.json\",\"info\":{\"description\":\"\",\"title\":\"p" + "olctl\",\"version\":\"1.0\",\"x-binding-c-generator\":{\"api\":\"polctl\"" + ",\"version\":2,\"prefix\":\"polctl_\",\"postfix\":\"\",\"start\":null,\"" + "onevent\":null,\"init\":\"polctl_init\",\"scope\":\"\",\"private\":false" + "}},\"servers\":[{\"url\":\"ws://{host}:{port}/api/polctl\",\"description" + "\":\"Unicens2 API.\",\"variables\":{\"host\":{\"default\":\"localhost\"}" + ",\"port\":{\"default\":\"1234\"}},\"x-afb-events\":[{\"$ref\":\"#/compon" + "ents/schemas/afb-event\"}]}],\"components\":{\"schemas\":{\"afb-reply\":" + "{\"$ref\":\"#/components/schemas/afb-reply-v2\"},\"afb-event\":{\"$ref\"" + ":\"#/components/schemas/afb-event-v2\"},\"afb-reply-v2\":{\"title\":\"Ge" + "neric response.\",\"type\":\"object\",\"required\":[\"jtype\",\"request\"" + "],\"properties\":{\"jtype\":{\"type\":\"string\",\"const\":\"afb-reply\"" + "},\"request\":{\"type\":\"object\",\"required\":[\"status\"],\"propertie" + "s\":{\"status\":{\"type\":\"string\"},\"info\":{\"type\":\"string\"},\"t" + "oken\":{\"type\":\"string\"},\"uuid\":{\"type\":\"string\"},\"reqid\":{\"" + "type\":\"string\"}}},\"response\":{\"type\":\"object\"}}},\"afb-event-v2" + "\":{\"type\":\"object\",\"required\":[\"jtype\",\"event\"],\"properties\"" + ":{\"jtype\":{\"type\":\"string\",\"const\":\"afb-event\"},\"event\":{\"t" + "ype\":\"string\"},\"data\":{\"type\":\"object\"}}}},\"x-permissions\":{\"" + "monitor\":{\"permission\":\"urn:AGL:permission:audio:public:monitor\"},\"" + "multimedia\":{\"permission\":\"urn:AGL:permission:audio:public:monitor\"" + "},\"navigation\":{\"permission\":\"urn:AGL:permission:audio:public:monit" + "or\"},\"emergency\":{\"permission\":\"urn:AGL:permission:audio:public:em" + "ergency\"}},\"responses\":{\"200\":{\"description\":\"A complex object a" + "rray response\",\"content\":{\"application/json\":{\"schema\":{\"$ref\":" + "\"#/components/schemas/afb-reply\"}}}}}},\"paths\":{\"/monitor\":{\"desc" + "ription\":\"Subcribe Audio Agent Policy Control End\",\"get\":{\"x-permi" + "ssions\":{\"$ref\":\"#/components/x-permissions/monitor\"},\"parameters\"" + ":[{\"in\":\"query\",\"name\":\"event_patern\",\"required\":true,\"schema" + "\":{\"type\":\"string\"}}],\"responses\":{\"200\":{\"$ref\":\"#/componen" + "ts/responses/200\"}}}},\"/event_test\":{\"description\":\"Pause Resume T" + "est\",\"get\":{\"x-permissions\":{\"$ref\":\"#/components/x-permissions/" + "monitor\"},\"parameters\":[{\"in\":\"query\",\"name\":\"delay\",\"requir" + "ed\":false,\"schema\":{\"type\":\"interger\"}},{\"in\":\"query\",\"name\"" + ":\"count\",\"required\":false,\"schema\":{\"type\":\"interger\"}}],\"res" + "ponses\":{\"200\":{\"$ref\":\"#/components/responses/200\"}}}},\"/naviga" + "tion\":{\"description\":\"Request Access to Navigation Audio Channel.\"," + "\"get\":{\"x-permissions\":{\"$ref\":\"#/components/x-permissions/naviga" + "tion\"},\"parameters\":[{\"in\":\"query\",\"name\":\"zone\",\"required\"" + ":false,\"schema\":{\"type\":\"string\"}}],\"responses\":{\"200\":{\"$ref" + "\":\"#/components/responses/200\"}}}}}}" +; + +static const struct afb_auth _afb_auths_v2_polctl[] = { + { .type = afb_auth_Permission, .text = "urn:AGL:permission:audio:public:monitor" } +}; + + void polctl_monitor(struct afb_req req); + void polctl_event_test(struct afb_req req); + void polctl_navigation(struct afb_req req); + +static const struct afb_verb_v2 _afb_verbs_v2_polctl[] = { + { + .verb = "monitor", + .callback = polctl_monitor, + .auth = &_afb_auths_v2_polctl[0], + .info = NULL, + .session = AFB_SESSION_NONE_V2 + }, + { + .verb = "event_test", + .callback = polctl_event_test, + .auth = &_afb_auths_v2_polctl[0], + .info = NULL, + .session = AFB_SESSION_NONE_V2 + }, + { + .verb = "navigation", + .callback = polctl_navigation, + .auth = &_afb_auths_v2_polctl[0], + .info = NULL, + .session = AFB_SESSION_NONE_V2 + }, + { .verb = NULL } +}; + +const struct afb_binding_v2 afbBindingV2 = { + .api = "polctl", + .specification = _afb_description_v2_polctl, + .info = NULL, + .verbs = _afb_verbs_v2_polctl, + .preinit = NULL, + .init = polctl_init, + .onevent = NULL, + .noconcurrency = 0 +}; + diff --git a/PolicyCtl-afb/polctl-apidef.json b/PolicyCtl-afb/polctl-apidef.json new file mode 100644 index 0000000..65fe0ec --- /dev/null +++ b/PolicyCtl-afb/polctl-apidef.json @@ -0,0 +1,175 @@ +{ + "openapi": "3.0.0", + "$schema": "http:iot.bzh/download/openapi/schema-3.0/default-schema.json", + "info": { + "description": "", + "title": "polctl", + "version": "1.0", + "x-binding-c-generator": { + "api": "polctl", + "version": 2, + "prefix": "polctl_", + "postfix": "", + "start": null , + "onevent": null, + "init": "polctl_init", + "scope": "", + "private": false + } + }, + "servers": [ + { + "url": "ws://{host}:{port}/api/polctl", + "description": "Unicens2 API.", + "variables": { + "host": { + "default": "localhost" + }, + "port": { + "default": "1234" + } + }, + "x-afb-events": [ + { + "$ref": "#/components/schemas/afb-event" + } + ] + } + ], + "components": { + "schemas": { + "afb-reply": { + "$ref": "#/components/schemas/afb-reply-v2" + }, + "afb-event": { + "$ref": "#/components/schemas/afb-event-v2" + }, + "afb-reply-v2": { + "title": "Generic response.", + "type": "object", + "required": [ "jtype", "request" ], + "properties": { + "jtype": { + "type": "string", + "const": "afb-reply" + }, + "request": { + "type": "object", + "required": [ "status" ], + "properties": { + "status": { "type": "string" }, + "info": { "type": "string" }, + "token": { "type": "string" }, + "uuid": { "type": "string" }, + "reqid": { "type": "string" } + } + }, + "response": { "type": "object" } + } + }, + "afb-event-v2": { + "type": "object", + "required": [ "jtype", "event" ], + "properties": { + "jtype": { + "type": "string", + "const": "afb-event" + }, + "event": { "type": "string" }, + "data": { "type": "object" } + } + } + }, + "x-permissions": { + "monitor": { + "permission": "urn:AGL:permission:audio:public:monitor" + }, + "multimedia": { + "permission": "urn:AGL:permission:audio:public:monitor" + }, + "navigation": { + "permission": "urn:AGL:permission:audio:public:monitor" + }, + "emergency": { + "permission": "urn:AGL:permission:audio:public:emergency" + } + }, + "responses": { + "200": { + "description": "A complex object array response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/afb-reply" + } + } + } + } + } + }, + "paths": { + "/monitor": { + "description": "Subcribe Audio Agent Policy Control End", + "get": { + "x-permissions": { + "$ref": "#/components/x-permissions/monitor" + }, + "parameters": [ + { + "in": "query", + "name": "event_patern", + "required": true, + "schema": { "type": "string" } + } + ], + "responses": { + "200": {"$ref": "#/components/responses/200"} + } + } + }, + "/event_test": { + "description": "Pause Resume Test", + "get": { + "x-permissions": { + "$ref": "#/components/x-permissions/monitor" + }, + "parameters": [ + { + "in": "query", + "name": "delay", + "required": false, + "schema": { "type": "interger" } + }, + { + "in": "query", + "name": "count", + "required": false, + "schema": { "type": "interger" } + } + ], + "responses": { + "200": {"$ref": "#/components/responses/200"} + } + } + }, + "/navigation": { + "description": "Request Access to Navigation Audio Channel.", + "get": { + "x-permissions": { + "$ref": "#/components/x-permissions/navigation" + }, + "parameters": [ + { + "in": "query", + "name": "zone", + "required": false, + "schema": { "type": "string" } + } + ], + "responses": { + "200": {"$ref": "#/components/responses/200"} + } + } + } + } +} diff --git a/PolicyCtl-afb/polctl-binding.c b/PolicyCtl-afb/polctl-binding.c new file mode 100644 index 0000000..d24b036 --- /dev/null +++ b/PolicyCtl-afb/polctl-binding.c @@ -0,0 +1,174 @@ +/* + * Copyright (C) 2016 "IoT.bzh" + * Author Fulup Ar Foll <fulup@iot.bzh> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define _GNU_SOURCE +#include <stdio.h> +#include <string.h> +#include <time.h> +#include <systemd/sd-event.h> + +#include "audio-interface.h" + +STATIC int polctl_init (); + +// Include Binding Stub generated from Json OpenAPI +#include "polctl-apidef.h" + +#define DEFAULT_PAUSE_DELAY 3000 +#define DEFAULT_TEST_COUNT 1 + +typedef int (*timerCallbackT)(void *context); + + +typedef struct { + int value; + const char *label; +} AutoTestCtxT; + +typedef struct TimerHandleS { + int count; + int delay; + AutoTestCtxT *context; + timerCallbackT callback; + sd_event_source *evtSource; +} TimerHandleT; + +static afb_event afbevt; + + +STATIC int TimerNext (sd_event_source* source, uint64_t timer, void* handle) { + TimerHandleT *timerHandle = (TimerHandleT*) handle; + int done; + uint64_t usec; + + // Rearm timer if needed + timerHandle->count --; + if (timerHandle->count == 0) sd_event_source_unref(source); + else { + // otherwise validate timer for a new run + sd_event_now(afb_daemon_get_event_loop(), CLOCK_MONOTONIC, &usec); + sd_event_source_set_enabled(source, SD_EVENT_ONESHOT); + sd_event_source_set_time(source, usec + timerHandle->delay); + } + + done= timerHandle->callback(timerHandle->context); + if (!done) goto OnErrorExit; + + return 0; + +OnErrorExit: + AFB_WARNING("TimerNext Fail tag=%s", timerHandle->context->label); + return -1; +} + +STATIC void TimerStart(TimerHandleT *timerHandle, timerCallbackT callback, void *context) { + uint64_t usec; + + // populate CB handle + timerHandle->callback=callback; + timerHandle->context=context; + + // set a timer with ~250us accuracy + sd_event_now(afb_daemon_get_event_loop(), CLOCK_MONOTONIC, &usec); + sd_event_add_time(afb_daemon_get_event_loop(), &timerHandle->evtSource, CLOCK_MONOTONIC, usec+timerHandle->delay, 250, TimerNext, timerHandle); +} + +STATIC int DoPauseResumeCB (void *context) { + AutoTestCtxT *ctx= (AutoTestCtxT*)context; + json_object *ctlEventJ; + + if (ctx->value) ctx->value =0; + else ctx->value =1; + + ctlEventJ = json_object_new_object(); + json_object_object_add(ctlEventJ,"action", json_object_new_string(ctx->label)); + json_object_object_add(ctlEventJ,"value" , json_object_new_int(ctx->value)); + int done = afb_event_push(afbevt, ctlEventJ); + + AFB_NOTICE ("DoPauseResumeCB {action: '%s', value:%d} status=%d", ctx->label, ctx->value, done); + + return (done); +} + +PUBLIC void polctl_event_test (afb_req request) { + json_object *queryJ, *tmpJ; + TimerHandleT *timerHandle = malloc (sizeof (TimerHandleT)); + AutoTestCtxT *context = calloc (1, sizeof (AutoTestCtxT)); + int done; + + queryJ= afb_req_json(request); + done=json_object_object_get_ex(queryJ, "label", &tmpJ); + if (!done) { + afb_req_fail_f(request, "TEST-LABEL-MISSING", "label is mandatory for event_test"); + goto OnErrorExit; + } + context->label = strdup(json_object_get_string (tmpJ)); + + json_object_object_get_ex(queryJ, "delay", &tmpJ); + timerHandle->delay = json_object_get_int (tmpJ) * 1000; + if (timerHandle->delay == 0) timerHandle->delay=DEFAULT_PAUSE_DELAY * 1000; + + json_object_object_get_ex(queryJ, "count", &tmpJ); + timerHandle->count = json_object_get_int (tmpJ); + if (timerHandle->count == 0) timerHandle->count=DEFAULT_TEST_COUNT; + + // start a lool timer + TimerStart (timerHandle, DoPauseResumeCB, context); + + afb_req_success(request, NULL, NULL); + return; + + OnErrorExit: + return; +} + + +PUBLIC void polctl_navigation (afb_req request) { + + AFB_NOTICE ("Enter polctl_navigation"); + afb_req_success(request, NULL, NULL); +} + +PUBLIC void polctl_monitor (afb_req request) { + + // subscribe Client to event + int err = afb_req_subscribe(request, afbevt); + if (err != 0) { + afb_req_fail_f(request, "register-event", "Fail to subscribe binder event"); + goto OnErrorExit; + } + + afb_req_success(request, NULL, NULL); + + OnErrorExit: + return; +} + +// Create Binding Event at Init +PUBLIC int polctl_init () { + AFB_DEBUG ("Audio Policy Control Binding Init"); + + // create binder event to send test pause/resume + afbevt = afb_daemon_make_event("request"); + if (!afb_event_is_valid(afbevt)) { + AFB_ERROR ("POLCTL_INIT: Cannot register polctl event"); + return (1); + } + + return 0; +} + diff --git a/conf.d/alsa/asoundrc.sample b/conf.d/alsa/asoundrc.sample index 2611478..1786c46 100644 --- a/conf.d/alsa/asoundrc.sample +++ b/conf.d/alsa/asoundrc.sample @@ -46,7 +46,7 @@ pcm.MyMixerPCM { # ------------------------------------------- pcm_hook_type.MyHookPlugin { install "AlsaInstallHook" - lib "/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/build/Alsa-Plugin/Alsa-Hook-Callback/alsa_hook_cb.so" + lib "/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/build/Alsa-Plugin/Alsa-Policy-Hook/policy_hook_cb.so" } # Define a HookedPCM that point to Hook_type sharelib @@ -59,19 +59,37 @@ pcm.MyNavigationHook { hooks.0 { type "MyHookPlugin" hook_args { + verbose true # print few log messages (default false); - # Every Call should return OK in order PCM to open + # Every Call should return OK in order PCM to open (default timeout 100ms) uri "ws://localhost:1234/api?token='audio-agent-token'" request { - CallPing { - api "alsacore" - verb "ping" + # Request autorisation to write on navigation + RequestNavigation { + api "polctl" + verb "navigation" + } + # subscribe to Audio Agent Event + SubscriveEvents { + api "polctl" + verb "monitor" + } + TestAutoStop { + api "polctl" + verb "event_test" + query "{'label':'stop', 'delay':10000}" + } + TestAutoStart { + api "polctl" + verb "event_test" + query "{'label':'stop', 'delay':20000}" + } + # start a test pause/resume not supported by every hardware + TestPauseResume { + api "polctl" + verb "event_test" + query "{'label':'pause', 'delay':3000, 'count':10}" } - CallUCM { - api "alsacore" - verb "ping" - query "{'devid':'hw:v1340','verb':'Navigation','dev':'speakers'}" - } } } } diff --git a/nbproject/configurations.xml b/nbproject/configurations.xml index 186abf5..e955bcb 100644 --- a/nbproject/configurations.xml +++ b/nbproject/configurations.xml @@ -18,7 +18,7 @@ <in>AlsaHookPlug.c</in> </df> <df name="Alsa-Policy-Hook"> - <in>AlsaHookCb.c</in> + <in>PolicyHookCb.c</in> </df> </df> <df name="build"> @@ -83,6 +83,9 @@ <in>Mediator.cpp</in> <in>libmostvolume.cpp</in> </df> + <df name="PolicyCtl-afb"> + <in>polctl-binding.c</in> + </df> <df name="Shared-Interface"> <in>audio-interface.c</in> </df> @@ -109,9 +112,10 @@ </toolsSet> <flagsDictionary> <element flagsID="0" commonFlags="-g -fPIC -fPIC -g"/> - <element flagsID="1" commonFlags="-mtune=generic -march=x86-64 -g -fPIC"/> - <element flagsID="2" commonFlags="-mtune=generic -march=x86-64 -g -g -fPIC"/> - <element flagsID="3" + <element flagsID="1" commonFlags="-g -ggdb -fPIC -fPIC -g -ggdb"/> + <element flagsID="2" commonFlags="-mtune=generic -march=x86-64 -g -fPIC"/> + <element flagsID="3" commonFlags="-mtune=generic -march=x86-64 -g -g -fPIC"/> + <element flagsID="4" commonFlags="-mtune=generic -march=x86-64 -g -ggdb -g -ggdb -fPIC"/> </flagsDictionary> <codeAssistance> @@ -123,7 +127,7 @@ <buildCommand>${MAKE} -f Makefile install</buildCommand> <cleanCommand>${MAKE} -f Makefile clean</cleanCommand> <executablePath>build/CMakeFiles/feature_tests.bin</executablePath> - <cTool flags="3"> + <cTool flags="4"> </cTool> </makeTool> <preBuild> @@ -133,61 +137,30 @@ </preBuild> </makefileType> <item path="ALSA-afb/Alsa-AddCtl.c" ex="false" tool="0" flavor2="3"> - <cTool flags="3"> - <incDir> - <pElem>../../../opt/include/alsa</pElem> - <pElem>/usr/include/json-c</pElem> - <pElem>Shared-Interface</pElem> - <pElem>../../../opt/include</pElem> - <pElem>build/ALSA-afb</pElem> - </incDir> + <cTool flags="1"> </cTool> </item> <item path="ALSA-afb/Alsa-ApiHat.c" ex="false" tool="0" flavor2="3"> - <cTool flags="3"> - <incDir> - <pElem>build/ALSA-afb</pElem> - </incDir> + <cTool flags="1"> </cTool> </item> <item path="ALSA-afb/Alsa-RegEvt.c" ex="false" tool="0" flavor2="3"> - <cTool flags="3"> - <incDir> - <pElem>../../../opt/include/alsa</pElem> - <pElem>/usr/include/json-c</pElem> - <pElem>Shared-Interface</pElem> - <pElem>../../../opt/include</pElem> - <pElem>build/ALSA-afb</pElem> - </incDir> + <cTool flags="1"> </cTool> </item> <item path="ALSA-afb/Alsa-SetGet.c" ex="false" tool="0" flavor2="3"> - <cTool flags="3"> - <incDir> - <pElem>../../../opt/include/alsa</pElem> - <pElem>/usr/include/json-c</pElem> - <pElem>Shared-Interface</pElem> - <pElem>../../../opt/include</pElem> - <pElem>build/ALSA-afb</pElem> - </incDir> + <cTool flags="1"> </cTool> </item> <item path="ALSA-afb/Alsa-Ucm.c" ex="false" tool="0" flavor2="3"> - <cTool flags="3"> - <incDir> - <pElem>../../../opt/include/alsa</pElem> - <pElem>/usr/include/json-c</pElem> - <pElem>Shared-Interface</pElem> - <pElem>../../../opt/include</pElem> - <pElem>build/ALSA-afb</pElem> - </incDir> + <cTool flags="1"> </cTool> </item> - <item path="Alsa-Plugin/Alsa-Policy-Hook/AlsaHookCb.c" + <item path="Alsa-Plugin/Alsa-Policy-Hook/PolicyHookCb.c" ex="false" tool="0" flavor2="3"> - <cTool flags="3"> + <cTool flags="1"> </cTool> </item> <item path="Common/AudioCommonLib.c" ex="false" tool="0" flavor2="2"> @@ -198,56 +171,44 @@ ex="false" tool="0" flavor2="3"> - <cTool flags="3"> - <incDir> - <pElem>Shared-Interface</pElem> - <pElem>../../../opt/include</pElem> - <pElem>build/HAL-afb/HAL-interface</pElem> - </incDir> + <cTool flags="1"> </cTool> </item> <item path="HAL-afb/HAL-interface/hal-volramp.c" ex="false" tool="0" flavor2="3"> - <cTool flags="3"> - <incDir> - <pElem>Shared-Interface</pElem> - <pElem>build/HAL-afb/HAL-interface</pElem> - </incDir> + <cTool flags="1"> </cTool> </item> <item path="HAL-afb/HAL-interface/hal-volume.c" ex="false" tool="0" flavor2="3"> - <cTool flags="3"> - <incDir> - <pElem>build/HAL-afb/HAL-interface</pElem> - </incDir> + <cTool flags="1"> </cTool> </item> <item path="HAL-afb/HAL-plugin/HalPlugPcm.c" ex="false" tool="0" flavor2="3"> - <cTool flags="1"> + <cTool flags="2"> </cTool> </item> <item path="HAL-afb/HDA-intel/IntelHdaHAL.c" ex="false" tool="0" flavor2="3"> - <cTool flags="3"> + <cTool flags="1"> </cTool> </item> <item path="HAL-afb/Jabra-Solemate/JabraUsbHAL.c" ex="false" tool="0" flavor2="3"> - <cTool flags="3"> + <cTool flags="1"> </cTool> </item> <item path="HAL-afb/Scarlett-Focusrite/ScarlettUsbHAL.c" ex="false" tool="0" flavor2="3"> - <cTool flags="3"> + <cTool flags="1"> </cTool> </item> <item path="HAL-afb/Unicens-USB/UnicensHAL.c" ex="false" tool="0" flavor2="3"> - <cTool flags="3"> + <cTool flags="4"> <incDir> <pElem>Shared-Interface</pElem> <pElem>HAL-afb/HAL-interface</pElem> @@ -257,7 +218,7 @@ </cTool> </item> <item path="HAL-afb/Unicens-USB/UnicensVol.c" ex="false" tool="0" flavor2="3"> - <cTool flags="3"> + <cTool flags="4"> <incDir> <pElem>HAL-afb/HAL-interface</pElem> <pElem>build/HAL-afb/Unicens-USB</pElem> @@ -265,7 +226,7 @@ </cTool> </item> <item path="HighLevel-afb/HighLevelApiConf.c" ex="false" tool="0" flavor2="3"> - <cTool flags="2"> + <cTool flags="3"> <incDir> <pElem>Shared-Interface</pElem> <pElem>../../../opt/include</pElem> @@ -274,7 +235,7 @@ </cTool> </item> <item path="HighLevel-afb/HighLevelBinding.c" ex="false" tool="0" flavor2="3"> - <cTool flags="2"> + <cTool flags="3"> <incDir> <pElem>/usr/include/json-c</pElem> <pElem>Shared-Interface</pElem> @@ -317,36 +278,53 @@ </item> <item path="MostVolume/libmostvolume.cpp" ex="false" tool="1" flavor2="4"> </item> + <item path="PolicyCtl-afb/polctl-binding.c" ex="false" tool="0" flavor2="3"> + <cTool flags="1"> + </cTool> + </item> <item path="Shared-Interface/audio-interface.c" ex="false" tool="0" flavor2="3"> - <cTool flags="3"> + <cTool flags="1"> </cTool> </item> <folder path="0/ALSA-afb"> <cTool> <incDir> - <pElem>../../../opt/include/afb</pElem> - <pElem>ALSA-afb</pElem> + <pElem>../../../opt/include</pElem> + <pElem>../../../opt/include/alsa</pElem> + <pElem>/usr/include/p11-kit-1</pElem> + <pElem>/usr/include/json-c</pElem> + <pElem>Shared-Interface</pElem> + <pElem>build/ALSA-afb</pElem> </incDir> + <preprocessorList> + <Elem>CONTROL_CDEV_RX="/dev/inic-usb-crx"</Elem> + <Elem>CONTROL_CDEV_TX="/dev/inic-usb-ctx"</Elem> + <Elem>MAX_LINEAR_DB_SCALE=24</Elem> + <Elem>MAX_SND_CARD=16</Elem> + <Elem>NATIVE_LINUX</Elem> + <Elem>TLV_BYTE_SIZE=256</Elem> + <Elem>alsa_lowlevel_EXPORTS</Elem> + </preprocessorList> </cTool> </folder> <folder path="0/Alsa-Plugin"> <cTool> <incDir> - <pElem>../../../opt/include/afb</pElem> - <pElem>Alsa-Plugin/Alsa-Hook-Callback</pElem> + <pElem>../../../opt/include</pElem> <pElem>../../../opt/include/alsa</pElem> + <pElem>/usr/include/p11-kit-1</pElem> <pElem>/usr/include/json-c</pElem> - <pElem>../../../opt/include</pElem> - <pElem>build/Alsa-Plugin/Alsa-Hook-Callback</pElem> + <pElem>build/Alsa-Plugin/Alsa-Policy-Hook</pElem> </incDir> <preprocessorList> <Elem>CONTROL_CDEV_RX="/dev/inic-usb-crx"</Elem> <Elem>CONTROL_CDEV_TX="/dev/inic-usb-ctx"</Elem> <Elem>MAX_LINEAR_DB_SCALE=24</Elem> <Elem>MAX_SND_CARD=16</Elem> + <Elem>NATIVE_LINUX</Elem> <Elem>PIC</Elem> <Elem>TLV_BYTE_SIZE=256</Elem> - <Elem>alsa_hook_cb_EXPORTS</Elem> + <Elem>policy_hook_cb_EXPORTS</Elem> </preprocessorList> </cTool> </folder> @@ -382,10 +360,19 @@ <folder path="0/HAL-afb/HAL-interface"> <cTool> <incDir> - <pElem>HAL-afb/HAL-interface</pElem> + <pElem>../../../opt/include</pElem> <pElem>../../../opt/include/alsa</pElem> + <pElem>/usr/include/p11-kit-1</pElem> <pElem>/usr/include/json-c</pElem> + <pElem>HAL-afb/HAL-interface</pElem> + <pElem>Shared-Interface</pElem> + <pElem>build/HAL-afb/HAL-interface</pElem> </incDir> + <preprocessorList> + <Elem>MAX_LINEAR_DB_SCALE=24</Elem> + <Elem>NATIVE_LINUX</Elem> + <Elem>TLV_BYTE_SIZE=256</Elem> + </preprocessorList> </cTool> </folder> <folder path="0/HAL-afb/HAL-plugin"> @@ -399,40 +386,58 @@ <folder path="0/HAL-afb/HDA-intel"> <cTool> <incDir> - <pElem>HAL-afb/HDA-intel</pElem> + <pElem>../../../opt/include</pElem> <pElem>../../../opt/include/alsa</pElem> + <pElem>/usr/include/p11-kit-1</pElem> <pElem>/usr/include/json-c</pElem> - <pElem>Shared-Interface</pElem> <pElem>HAL-afb/HAL-interface</pElem> - <pElem>../../../opt/include</pElem> + <pElem>Shared-Interface</pElem> <pElem>build/HAL-afb/HDA-intel</pElem> </incDir> + <preprocessorList> + <Elem>MAX_LINEAR_DB_SCALE=24</Elem> + <Elem>NATIVE_LINUX</Elem> + <Elem>TLV_BYTE_SIZE=256</Elem> + <Elem>hal_intel_hda_EXPORTS</Elem> + </preprocessorList> </cTool> </folder> <folder path="0/HAL-afb/Jabra-Solemate"> <cTool> <incDir> - <pElem>HAL-afb/Jabra-Solemate</pElem> + <pElem>../../../opt/include</pElem> <pElem>../../../opt/include/alsa</pElem> + <pElem>/usr/include/p11-kit-1</pElem> <pElem>/usr/include/json-c</pElem> - <pElem>Shared-Interface</pElem> <pElem>HAL-afb/HAL-interface</pElem> - <pElem>../../../opt/include</pElem> + <pElem>Shared-Interface</pElem> <pElem>build/HAL-afb/Jabra-Solemate</pElem> </incDir> + <preprocessorList> + <Elem>MAX_LINEAR_DB_SCALE=24</Elem> + <Elem>NATIVE_LINUX</Elem> + <Elem>TLV_BYTE_SIZE=256</Elem> + <Elem>hal_jabra_usb_EXPORTS</Elem> + </preprocessorList> </cTool> </folder> <folder path="0/HAL-afb/Scarlett-Focusrite"> <cTool> <incDir> - <pElem>HAL-afb/Scarlett-Focusrite</pElem> + <pElem>../../../opt/include</pElem> <pElem>../../../opt/include/alsa</pElem> + <pElem>/usr/include/p11-kit-1</pElem> <pElem>/usr/include/json-c</pElem> - <pElem>Shared-Interface</pElem> <pElem>HAL-afb/HAL-interface</pElem> - <pElem>../../../opt/include</pElem> + <pElem>Shared-Interface</pElem> <pElem>build/HAL-afb/Scarlett-Focusrite</pElem> </incDir> + <preprocessorList> + <Elem>MAX_LINEAR_DB_SCALE=24</Elem> + <Elem>NATIVE_LINUX</Elem> + <Elem>TLV_BYTE_SIZE=256</Elem> + <Elem>hal_scalett_usb_EXPORTS</Elem> + </preprocessorList> </cTool> </folder> <folder path="0/HAL-afb/Unicens-USB"> @@ -459,14 +464,45 @@ </incDir> </cTool> </folder> - <folder path="0/Shared-Interface"> + <folder path="0/PolicyCtl-afb"> <cTool> <incDir> - <pElem>../../../opt/include/afb</pElem> + <pElem>../../../opt/include</pElem> + <pElem>../../../opt/include/alsa</pElem> + <pElem>/usr/include/p11-kit-1</pElem> + <pElem>/usr/include/json-c</pElem> <pElem>Shared-Interface</pElem> + <pElem>build/PolicyCtl-afb</pElem> + </incDir> + <preprocessorList> + <Elem>CONTROL_CDEV_RX="/dev/inic-usb-crx"</Elem> + <Elem>CONTROL_CDEV_TX="/dev/inic-usb-ctx"</Elem> + <Elem>MAX_LINEAR_DB_SCALE=24</Elem> + <Elem>MAX_SND_CARD=16</Elem> + <Elem>NATIVE_LINUX</Elem> + <Elem>TLV_BYTE_SIZE=256</Elem> + <Elem>polctl_afb_EXPORTS</Elem> + </preprocessorList> + </cTool> + </folder> + <folder path="0/Shared-Interface"> + <cTool> + <incDir> + <pElem>../../../opt/include</pElem> + <pElem>../../../opt/include/alsa</pElem> + <pElem>/usr/include/p11-kit-1</pElem> <pElem>/usr/include/json-c</pElem> + <pElem>Shared-Interface</pElem> <pElem>build/Shared-Interface</pElem> </incDir> + <preprocessorList> + <Elem>CONTROL_CDEV_RX="/dev/inic-usb-crx"</Elem> + <Elem>CONTROL_CDEV_TX="/dev/inic-usb-ctx"</Elem> + <Elem>MAX_LINEAR_DB_SCALE=24</Elem> + <Elem>MAX_SND_CARD=16</Elem> + <Elem>NATIVE_LINUX</Elem> + <Elem>TLV_BYTE_SIZE=256</Elem> + </preprocessorList> </cTool> </folder> </conf> @@ -552,7 +588,7 @@ </incDir> </cTool> </item> - <item path="Alsa-Plugin/Alsa-Policy-Hook/AlsaHookCb.c" + <item path="Alsa-Plugin/Alsa-Policy-Hook/PolicyHookCb.c" ex="false" tool="0" flavor2="3"> @@ -831,7 +867,7 @@ </cTool> </folder> </conf> - <conf name="AplayHook" type="0"> + <conf name="Aplay_Multimedia" type="0"> <toolsSet> <compilerSet>default</compilerSet> <dependencyChecking>false</dependencyChecking> @@ -908,7 +944,7 @@ </incDir> </cTool> </item> - <item path="Alsa-Plugin/Alsa-Policy-Hook/AlsaHookCb.c" + <item path="Alsa-Plugin/Alsa-Policy-Hook/PolicyHookCb.c" ex="false" tool="0" flavor2="3"> @@ -1038,6 +1074,10 @@ </item> <item path="MostVolume/libmostvolume.cpp" ex="false" tool="1" flavor2="4"> </item> + <item path="PolicyCtl-afb/polctl-binding.c" ex="false" tool="0" flavor2="3"> + <cTool flags="0"> + </cTool> + </item> <item path="Shared-Interface/audio-interface.c" ex="false" tool="0" flavor2="3"> <cTool flags="1"> </cTool> @@ -1078,9 +1118,10 @@ <Elem>CONTROL_CDEV_TX="/dev/inic-usb-ctx"</Elem> <Elem>MAX_LINEAR_DB_SCALE=24</Elem> <Elem>MAX_SND_CARD=16</Elem> + <Elem>NATIVE_LINUX</Elem> <Elem>PIC</Elem> <Elem>TLV_BYTE_SIZE=256</Elem> - <Elem>alsa_hook_cb_EXPORTS</Elem> + <Elem>policy_hook_cb_EXPORTS</Elem> </preprocessorList> </cTool> </folder> @@ -1146,6 +1187,27 @@ </incDir> </cTool> </folder> + <folder path="0/PolicyCtl-afb"> + <cTool> + <incDir> + <pElem>../../../opt/include</pElem> + <pElem>../../../opt/include/alsa</pElem> + <pElem>/usr/include/p11-kit-1</pElem> + <pElem>/usr/include/json-c</pElem> + <pElem>Shared-Interface</pElem> + <pElem>build/PolicyCtl-afb</pElem> + </incDir> + <preprocessorList> + <Elem>CONTROL_CDEV_RX="/dev/inic-usb-crx"</Elem> + <Elem>CONTROL_CDEV_TX="/dev/inic-usb-ctx"</Elem> + <Elem>MAX_LINEAR_DB_SCALE=24</Elem> + <Elem>MAX_SND_CARD=16</Elem> + <Elem>NATIVE_LINUX</Elem> + <Elem>TLV_BYTE_SIZE=256</Elem> + <Elem>polctl_afb_EXPORTS</Elem> + </preprocessorList> + </cTool> + </folder> <folder path="0/Shared-Interface"> <cTool> <incDir> diff --git a/nbproject/project.xml b/nbproject/project.xml index 859334c..988f845 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -22,7 +22,7 @@ <type>0</type> </confElem> <confElem> - <name>AplayHook</name> + <name>Aplay_Multimedia</name> <type>0</type> </confElem> </confList> |