diff options
author | Fulup Ar Foll <fulup@iot.bzh> | 2017-11-05 13:01:07 +0100 |
---|---|---|
committer | Fulup Ar Foll <fulup@iot.bzh> | 2017-11-05 13:01:07 +0100 |
commit | 2e2cf0b8f97c8a72255ab0b977f94bd6c684b203 (patch) | |
tree | 79300297cb13c7be472663841be1ffd9e8177e04 | |
parent | 68f1187061c28ecf6439b4dd465f4d256529dc55 (diff) |
Added few protection again invalid config
-rw-r--r-- | ahl-binding/ahl-apidef.h | 222 | ||||
-rw-r--r-- | ahl-binding/ahl-apidef.json | 3 | ||||
-rw-r--r-- | ahl-binding/ahl-binding.h | 3 | ||||
-rw-r--r-- | ahl-binding/ahl-config.c | 6 | ||||
-rw-r--r-- | ahl-policy/ahl-policy.c | 9 | ||||
-rw-r--r-- | conf.d/cmake/config.cmake | 2 | ||||
-rw-r--r-- | conf.d/project/.asounrc-fulup | 198 | ||||
-rw-r--r-- | conf.d/project/ahl-audio4a-config.json (renamed from conf.d/project/ahl-aaaa-config.json) | 2 | ||||
-rw-r--r-- | conf.d/project/ahl-fulup4a-config.json | 8 | ||||
-rw-r--r-- | conf.d/project/asoundrc-audio4a (renamed from conf.d/project/.asoundrc) | 0 | ||||
-rw-r--r-- | conf.d/project/asoundrc-fulup4a | 81 | ||||
-rw-r--r-- | nbproject/configurations.xml | 63 | ||||
-rw-r--r-- | nbproject/project.xml | 6 |
13 files changed, 277 insertions, 326 deletions
diff --git a/ahl-binding/ahl-apidef.h b/ahl-binding/ahl-apidef.h index 2c77827..a9cb6dd 100644 --- a/ahl-binding/ahl-apidef.h +++ b/ahl-binding/ahl-apidef.h @@ -4,118 +4,118 @@ static const char _afb_description_v2_ahl_4a[] = "for AGL applications\",\"title\":\"audiohighlevel\",\"version\":\"1.0\"," "\"x-binding-c-generator\":{\"api\":\"ahl-4a\",\"version\":2,\"prefix\":\"" "audiohlapi_\",\"postfix\":\"\",\"start\":null,\"onevent\":\"AhlOnEvent\"" - ",\"init\":\"AhlBindingInit\",\"scope\":\"\",\"private\":false}},\"server" - "s\":[{\"url\":\"ws://{host}:{port}/api/audiohl\",\"description\":\"Audio" - " high level API for AGL applications.\",\"variables\":{\"host\":{\"defau" - "lt\":\"localhost\"},\"port\":{\"default\":\"1234\"}},\"x-afb-events\":[{" - "\"$ref\":\"#/components/schemas/afb-event\"}]}],\"components\":{\"schema" - "s\":{\"afb-reply\":{\"$ref\":\"#/components/schemas/afb-reply-v2\"},\"af" - "b-event\":{\"$ref\":\"#/components/schemas/afb-event-v2\"},\"afb-reply-v" - "2\":{\"title\":\"Generic response.\",\"type\":\"object\",\"required\":[\"" - "jtype\",\"request\"],\"properties\":{\"jtype\":{\"type\":\"string\",\"co" - "nst\":\"afb-reply\"},\"request\":{\"type\":\"object\",\"required\":[\"st" - "atus\"],\"properties\":{\"status\":{\"type\":\"string\"},\"info\":{\"typ" - "e\":\"string\"},\"token\":{\"type\":\"string\"},\"uuid\":{\"type\":\"str" - "ing\"},\"reqid\":{\"type\":\"string\"}}},\"response\":{\"type\":\"object" - "\"}}},\"afb-event-v2\":{\"type\":\"object\",\"required\":[\"jtype\",\"ev" - "ent\"],\"properties\":{\"jtype\":{\"type\":\"string\",\"const\":\"afb-ev" - "ent\"},\"event\":{\"type\":\"string\"},\"data\":{\"type\":\"object\"}}}," - "\"endpoint_info\":{\"type\":\"object\",\"required\":[\"endpoint_id\",\"t" - "ype\",\"device_name\",\"device_uri\"],\"properties\":{\"endpoint_id\":{\"" - "type\":\"int\"},\"type\":{\"type\":\"enum\"},\"device_name\":{\"type\":\"" - "string\"},\"device_uri_type\":{\"type\":\"string\"}}},\"stream_info\":{\"" - "type\":\"object\",\"required\":[\"stream_id\",\"state\",\"mute\",\"endpo" - "int_info\"],\"properties\":{\"stream_id\":{\"type\":\"int\"},\"state\":{" - "\"type\":\"int\"},\"mute\":{\"type\":\"int\"},\"device_uri\":{\"type\":\"" - "string\"},\"$ref\":\"#/components/schemas/endpoint_info\"}}},\"x-permiss" - "ions\":{\"streamcontrol\":{\"permission\":\"urn:AGL:permission:audio:pub" - "lic:streamcontrol\"},\"endpointcontrol\":{\"permission\":\"urn:AGL:permi" - "ssion:audio:public:endpointcontrol\"},\"audiostream\":{\"permission\":\"" - "urn:AGL:permission:audio:public:audiostream\"},\"soundevent\":{\"permiss" - "ion\":\"urn:AGL:permission:audio:public:soundevent\"}},\"responses\":{\"" - "200\":{\"description\":\"A complex object array response\",\"content\":{" - "\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/afb-re" - "ply\"}}}},\"400\":{\"description\":\"Invalid arguments\"}}},\"paths\":{\"" - "/get_endpoints\":{\"description\":\"Retrieve array of available audio en" - "dpoints\",\"get\":{\"parameters\":[{\"in\":\"query\",\"name\":\"audio_ro" - "le\",\"required\":true,\"schema\":{\"type\":\"string\"}},{\"in\":\"query" - "\",\"name\":\"endpoint_type\",\"required\":true,\"schema\":{\"type\":\"e" - "num\"}}],\"responses\":{\"200\":{\"$ref\":\"#/components/responses/200\"" - ",\"response\":{\"description\":\"Array of endpoint info structures\",\"t" - "ype\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/endpoint_info" - "\"}}},\"400\":{\"$ref\":\"#/components/responses/400\"}}}},\"/stream_ope" - "n\":{\"description\":\"Request opening a stream\",\"get\":{\"x-permissio" - "ns\":{\"$ref\":\"#/components/x-permissions/audiostream\"},\"parameters\"" - ":[{\"in\":\"query\",\"name\":\"audio_role\",\"required\":true,\"schema\"" - ":{\"type\":\"string\"}},{\"in\":\"query\",\"name\":\"endpoint_type\",\"r" - "equired\":true,\"schema\":{\"type\":\"enum\"}},{\"in\":\"query\",\"name\"" - ":\"endpoint_id\",\"required\":false,\"schema\":{\"type\":\"int\"}}],\"re" - "sponses\":{\"200\":{\"$ref\":\"#/components/responses/200\",\"response\"" - ":{\"description\":\"Stream information structure\",\"$ref\":\"#/componen" - "ts/schemas/stream_info\"}},\"400\":{\"$ref\":\"#/components/responses/40" - "0\"}}}},\"/stream_close\":{\"description\":\"Request closing a stream\"," - "\"get\":{\"x-permissions\":{\"$ref\":\"#/components/x-permissions/audios" - "tream\"},\"parameters\":[{\"in\":\"query\",\"name\":\"stream_id\",\"requ" - "ired\":false,\"schema\":{\"type\":\"int\"}}],\"responses\":{\"200\":{\"$" - "ref\":\"#/components/responses/200\"},\"400\":{\"$ref\":\"#/components/r" - "esponses/400\"}}}},\"/set_stream_state\":{\"description\":\"Change strea" - "m active and/or mute state\",\"get\":{\"x-permissions\":{\"$ref\":\"#/co" - "mponents/x-permissions/streamcontrol\"},\"parameters\":[{\"in\":\"query\"" - ",\"name\":\"stream_id\",\"required\":false,\"schema\":{\"type\":\"int\"}" - "},{\"in\":\"query\",\"name\":\"state\",\"required\":false,\"schema\":{\"" - "type\":\"int\"}},{\"in\":\"query\",\"name\":\"mute\",\"required\":false," - "\"schema\":{\"type\":\"int\"}}],\"responses\":{\"200\":{\"$ref\":\"#/com" - "ponents/responses/200\"},\"400\":{\"$ref\":\"#/components/responses/400\"" - "}}}},\"/get_stream_info\":{\"description\":\"Retrieve stream information" - "\",\"get\":{\"parameters\":[{\"in\":\"query\",\"name\":\"stream_id\",\"r" - "equired\":true,\"schema\":{\"type\":\"int\"}}],\"responses\":{\"200\":{\"" - "$ref\":\"#/components/responses/200\",\"response\":{\"description\":\"St" - "ream information structure\",\"$ref\":\"#/components/schemas/stream_info" - "\"}},\"400\":{\"$ref\":\"#/components/responses/400\"}}}},\"/volume\":{\"" - "description\":\"Set or get volume on endpoint\",\"get\":{\"x-permissions" - "\":{\"$ref\":\"#/components/x-permissions/endpointcontrol\"},\"parameter" - "s\":[{\"in\":\"query\",\"name\":\"endpoint_type\",\"required\":true,\"sc" - "hema\":{\"type\":\"enum\"}},{\"in\":\"query\",\"name\":\"endpoint_id\",\"" - "required\":true,\"schema\":{\"type\":\"int\"}},{\"in\":\"query\",\"name\"" - ":\"volume\",\"required\":false,\"schema\":{\"type\":\"string\"}}],\"resp" - "onses\":{\"200\":{\"$ref\":\"#/components/responses/200\"},\"400\":{\"$r" - "ef\":\"#/components/responses/400\"}}}},\"/get_endpoint_info\":{\"descri" - "ption\":\"Retrieve endpoint information including its properties\",\"get" - "\":{\"parameters\":[{\"in\":\"query\",\"name\":\"endpoint_type\",\"requi" + ",\"init\":\"AhlBindingInit\",\"scope\":\"\",\"private\":false,\"noconcur" + "rency\":false}},\"servers\":[{\"url\":\"ws://{host}:{port}/api/audiohl\"" + ",\"description\":\"Audio high level API for AGL applications.\",\"variab" + "les\":{\"host\":{\"default\":\"localhost\"},\"port\":{\"default\":\"1234" + "\"}},\"x-afb-events\":[{\"$ref\":\"#/components/schemas/afb-event\"}]}]," + "\"components\":{\"schemas\":{\"afb-reply\":{\"$ref\":\"#/components/sche" + "mas/afb-reply-v2\"},\"afb-event\":{\"$ref\":\"#/components/schemas/afb-e" + "vent-v2\"},\"afb-reply-v2\":{\"title\":\"Generic response.\",\"type\":\"" + "object\",\"required\":[\"jtype\",\"request\"],\"properties\":{\"jtype\":" + "{\"type\":\"string\",\"const\":\"afb-reply\"},\"request\":{\"type\":\"ob" + "ject\",\"required\":[\"status\"],\"properties\":{\"status\":{\"type\":\"" + "string\"},\"info\":{\"type\":\"string\"},\"token\":{\"type\":\"string\"}" + ",\"uuid\":{\"type\":\"string\"},\"reqid\":{\"type\":\"string\"}}},\"resp" + "onse\":{\"type\":\"object\"}}},\"afb-event-v2\":{\"type\":\"object\",\"r" + "equired\":[\"jtype\",\"event\"],\"properties\":{\"jtype\":{\"type\":\"st" + "ring\",\"const\":\"afb-event\"},\"event\":{\"type\":\"string\"},\"data\"" + ":{\"type\":\"object\"}}},\"endpoint_info\":{\"type\":\"object\",\"requir" + "ed\":[\"endpoint_id\",\"type\",\"device_name\",\"device_uri\"],\"propert" + "ies\":{\"endpoint_id\":{\"type\":\"int\"},\"type\":{\"type\":\"enum\"},\"" + "device_name\":{\"type\":\"string\"},\"device_uri_type\":{\"type\":\"stri" + "ng\"}}},\"stream_info\":{\"type\":\"object\",\"required\":[\"stream_id\"" + ",\"state\",\"mute\",\"endpoint_info\"],\"properties\":{\"stream_id\":{\"" + "type\":\"int\"},\"state\":{\"type\":\"int\"},\"mute\":{\"type\":\"int\"}" + ",\"device_uri\":{\"type\":\"string\"},\"$ref\":\"#/components/schemas/en" + "dpoint_info\"}}},\"x-permissions\":{\"streamcontrol\":{\"permission\":\"" + "urn:AGL:permission:audio:public:streamcontrol\"},\"endpointcontrol\":{\"" + "permission\":\"urn:AGL:permission:audio:public:endpointcontrol\"},\"audi" + "ostream\":{\"permission\":\"urn:AGL:permission:audio:public:audiostream\"" + "},\"soundevent\":{\"permission\":\"urn:AGL:permission:audio:public:sound" + "event\"}},\"responses\":{\"200\":{\"description\":\"A complex object arr" + "ay response\",\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"" + "#/components/schemas/afb-reply\"}}}},\"400\":{\"description\":\"Invalid " + "arguments\"}}},\"paths\":{\"/get_endpoints\":{\"description\":\"Retrieve" + " array of available audio endpoints\",\"get\":{\"parameters\":[{\"in\":\"" + "query\",\"name\":\"audio_role\",\"required\":true,\"schema\":{\"type\":\"" + "string\"}},{\"in\":\"query\",\"name\":\"endpoint_type\",\"required\":tru" + "e,\"schema\":{\"type\":\"enum\"}}],\"responses\":{\"200\":{\"$ref\":\"#/" + "components/responses/200\",\"response\":{\"description\":\"Array of endp" + "oint info structures\",\"type\":\"array\",\"items\":{\"$ref\":\"#/compon" + "ents/schemas/endpoint_info\"}}},\"400\":{\"$ref\":\"#/components/respons" + "es/400\"}}}},\"/stream_open\":{\"description\":\"Request opening a strea" + "m\",\"get\":{\"x-permissions\":{\"$ref\":\"#/components/x-permissions/au" + "diostream\"},\"parameters\":[{\"in\":\"query\",\"name\":\"audio_role\",\"" + "required\":true,\"schema\":{\"type\":\"string\"}},{\"in\":\"query\",\"na" + "me\":\"endpoint_type\",\"required\":true,\"schema\":{\"type\":\"enum\"}}" + ",{\"in\":\"query\",\"name\":\"endpoint_id\",\"required\":false,\"schema\"" + ":{\"type\":\"int\"}}],\"responses\":{\"200\":{\"$ref\":\"#/components/re" + "sponses/200\",\"response\":{\"description\":\"Stream information structu" + "re\",\"$ref\":\"#/components/schemas/stream_info\"}},\"400\":{\"$ref\":\"" + "#/components/responses/400\"}}}},\"/stream_close\":{\"description\":\"Re" + "quest closing a stream\",\"get\":{\"x-permissions\":{\"$ref\":\"#/compon" + "ents/x-permissions/audiostream\"},\"parameters\":[{\"in\":\"query\",\"na" + "me\":\"stream_id\",\"required\":false,\"schema\":{\"type\":\"int\"}}],\"" + "responses\":{\"200\":{\"$ref\":\"#/components/responses/200\"},\"400\":{" + "\"$ref\":\"#/components/responses/400\"}}}},\"/set_stream_state\":{\"des" + "cription\":\"Change stream active and/or mute state\",\"get\":{\"x-permi" + "ssions\":{\"$ref\":\"#/components/x-permissions/streamcontrol\"},\"param" + "eters\":[{\"in\":\"query\",\"name\":\"stream_id\",\"required\":false,\"s" + "chema\":{\"type\":\"int\"}},{\"in\":\"query\",\"name\":\"state\",\"requi" + "red\":false,\"schema\":{\"type\":\"int\"}},{\"in\":\"query\",\"name\":\"" + "mute\",\"required\":false,\"schema\":{\"type\":\"int\"}}],\"responses\":" + "{\"200\":{\"$ref\":\"#/components/responses/200\"},\"400\":{\"$ref\":\"#" + "/components/responses/400\"}}}},\"/get_stream_info\":{\"description\":\"" + "Retrieve stream information\",\"get\":{\"parameters\":[{\"in\":\"query\"" + ",\"name\":\"stream_id\",\"required\":true,\"schema\":{\"type\":\"int\"}}" + "],\"responses\":{\"200\":{\"$ref\":\"#/components/responses/200\",\"resp" + "onse\":{\"description\":\"Stream information structure\",\"$ref\":\"#/co" + "mponents/schemas/stream_info\"}},\"400\":{\"$ref\":\"#/components/respon" + "ses/400\"}}}},\"/volume\":{\"description\":\"Set or get volume on endpoi" + "nt\",\"get\":{\"x-permissions\":{\"$ref\":\"#/components/x-permissions/e" + "ndpointcontrol\"},\"parameters\":[{\"in\":\"query\",\"name\":\"endpoint_" + "type\",\"required\":true,\"schema\":{\"type\":\"enum\"}},{\"in\":\"query" + "\",\"name\":\"endpoint_id\",\"required\":true,\"schema\":{\"type\":\"int" + "\"}},{\"in\":\"query\",\"name\":\"volume\",\"required\":false,\"schema\"" + ":{\"type\":\"string\"}}],\"responses\":{\"200\":{\"$ref\":\"#/components" + "/responses/200\"},\"400\":{\"$ref\":\"#/components/responses/400\"}}}},\"" + "/get_endpoint_info\":{\"description\":\"Retrieve endpoint information in" + "cluding its properties\",\"get\":{\"parameters\":[{\"in\":\"query\",\"na" + "me\":\"endpoint_type\",\"required\":true,\"schema\":{\"type\":\"enum\"}}" + ",{\"in\":\"query\",\"name\":\"endpoint_id\",\"required\":true,\"schema\"" + ":{\"type\":\"int\"}}],\"responses\":{\"200\":{\"$ref\":\"#/components/re" + "sponses/200\"},\"400\":{\"$ref\":\"#/components/responses/400\"}}}},\"/p" + "roperty\":{\"description\":\"Set/get endpoint property value\",\"get\":{" + "\"x-permissions\":{\"$ref\":\"#/components/x-permissions/endpointcontrol" + "\"},\"parameters\":[{\"in\":\"query\",\"name\":\"endpoint_type\",\"requi" "red\":true,\"schema\":{\"type\":\"enum\"}},{\"in\":\"query\",\"name\":\"" - "endpoint_id\",\"required\":true,\"schema\":{\"type\":\"int\"}}],\"respon" - "ses\":{\"200\":{\"$ref\":\"#/components/responses/200\"},\"400\":{\"$ref" - "\":\"#/components/responses/400\"}}}},\"/property\":{\"description\":\"S" - "et/get endpoint property value\",\"get\":{\"x-permissions\":{\"$ref\":\"" - "#/components/x-permissions/endpointcontrol\"},\"parameters\":[{\"in\":\"" - "query\",\"name\":\"endpoint_type\",\"required\":true,\"schema\":{\"type\"" - ":\"enum\"}},{\"in\":\"query\",\"name\":\"endpoint_id\",\"required\":true" - ",\"schema\":{\"type\":\"int\"}},{\"in\":\"query\",\"name\":\"property_na" - "me\",\"required\":true,\"schema\":{\"type\":\"string\"}},{\"in\":\"query" - "\",\"name\":\"value\",\"required\":false,\"schema\":{\"type\":\"string\"" - "}}],\"responses\":{\"200\":{\"$ref\":\"#/components/responses/200\"},\"4" - "00\":{\"$ref\":\"#/components/responses/400\"}}}},\"/get_list_actions\":" - "{\"description\":\"Retrieve a list of supported actions for a particular" - " audio role\",\"get\":{\"parameters\":[{\"in\":\"query\",\"name\":\"audi" - "o_role\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"response" - "s\":{\"200\":{\"$ref\":\"#/components/responses/200\"},\"400\":{\"$ref\"" - ":\"#/components/responses/400\"}}}},\"/post_action\":{\"description\":\"" - "Post sound or audio device related action event (extendable mechanism)\"" - ",\"get\":{\"x-permissions\":{\"$ref\":\"#/components/x-permissions/sound" - "event\"},\"parameters\":[{\"in\":\"query\",\"name\":\"action_name\",\"re" - "quired\":true,\"schema\":{\"type\":\"string\"}},{\"in\":\"query\",\"name" - "\":\"audio_role\",\"required\":true,\"schema\":{\"type\":\"string\"}},{\"" - "in\":\"query\",\"name\":\"media_name\",\"required\":false,\"schema\":{\"" - "type\":\"string\"}},{\"in\":\"query\",\"name\":\"action_context\",\"requ" - "ired\":false,\"schema\":{\"type\":\"object\"}}],\"responses\":{\"200\":{" - "\"$ref\":\"#/components/responses/200\"},\"400\":{\"$ref\":\"#/component" - "s/responses/400\"}}}},\"/event_subscription\":{\"description\":\"Subscri" - "be to audio high level events\",\"get\":{\"parameters\":[{\"in\":\"query" - "\",\"name\":\"events\",\"required\":true,\"schema\":{\"type\":\"array\"," - "\"items\":{\"type\":\"string\"}}},{\"in\":\"query\",\"name\":\"subscribe" - "\",\"required\":true,\"schema\":{\"type\":\"int\"}}],\"responses\":{\"20" - "0\":{\"$ref\":\"#/components/responses/200\"},\"400\":{\"$ref\":\"#/comp" - "onents/responses/400\"}}}}}}" + "endpoint_id\",\"required\":true,\"schema\":{\"type\":\"int\"}},{\"in\":\"" + "query\",\"name\":\"property_name\",\"required\":true,\"schema\":{\"type\"" + ":\"string\"}},{\"in\":\"query\",\"name\":\"value\",\"required\":false,\"" + "schema\":{\"type\":\"string\"}}],\"responses\":{\"200\":{\"$ref\":\"#/co" + "mponents/responses/200\"},\"400\":{\"$ref\":\"#/components/responses/400" + "\"}}}},\"/get_list_actions\":{\"description\":\"Retrieve a list of suppo" + "rted actions for a particular audio role\",\"get\":{\"parameters\":[{\"i" + "n\":\"query\",\"name\":\"audio_role\",\"required\":true,\"schema\":{\"ty" + "pe\":\"string\"}}],\"responses\":{\"200\":{\"$ref\":\"#/components/respo" + "nses/200\"},\"400\":{\"$ref\":\"#/components/responses/400\"}}}},\"/post" + "_action\":{\"description\":\"Post sound or audio device related action e" + "vent (extendable mechanism)\",\"get\":{\"x-permissions\":{\"$ref\":\"#/c" + "omponents/x-permissions/soundevent\"},\"parameters\":[{\"in\":\"query\"," + "\"name\":\"action_name\",\"required\":true,\"schema\":{\"type\":\"string" + "\"}},{\"in\":\"query\",\"name\":\"audio_role\",\"required\":true,\"schem" + "a\":{\"type\":\"string\"}},{\"in\":\"query\",\"name\":\"media_name\",\"r" + "equired\":false,\"schema\":{\"type\":\"string\"}},{\"in\":\"query\",\"na" + "me\":\"action_context\",\"required\":false,\"schema\":{\"type\":\"object" + "\"}}],\"responses\":{\"200\":{\"$ref\":\"#/components/responses/200\"},\"" + "400\":{\"$ref\":\"#/components/responses/400\"}}}},\"/event_subscription" + "\":{\"description\":\"Subscribe to audio high level events\",\"get\":{\"" + "parameters\":[{\"in\":\"query\",\"name\":\"events\",\"required\":true,\"" + "schema\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},{\"in\":\"" + "query\",\"name\":\"subscribe\",\"required\":true,\"schema\":{\"type\":\"" + "int\"}}],\"responses\":{\"200\":{\"$ref\":\"#/components/responses/200\"" + "},\"400\":{\"$ref\":\"#/components/responses/400\"}}}}}}" ; static const struct afb_auth _afb_auths_v2_ahl_4a[] = { diff --git a/ahl-binding/ahl-apidef.json b/ahl-binding/ahl-apidef.json index 59f7a32..35ffae6 100644 --- a/ahl-binding/ahl-apidef.json +++ b/ahl-binding/ahl-apidef.json @@ -13,7 +13,8 @@ "onevent": "AhlOnEvent", "init": "AhlBindingInit", "scope": "", - "private": false + "private": false, + "noconcurrency": false } }, "servers": [ diff --git a/ahl-binding/ahl-binding.h b/ahl-binding/ahl-binding.h index 405144d..161c07b 100644 --- a/ahl-binding/ahl-binding.h +++ b/ahl-binding/ahl-binding.h @@ -31,7 +31,8 @@ #endif #define AHL_SUCCESS 0 -#define AHL_FAIL 1 +#define AHL_WARNING 1 +#define AHL_FAIL -1 #define AHL_ACCESS_CONTROL_GRANTED 1 #define AHL_ACCESS_CONTROL_DENIED 0 diff --git a/ahl-binding/ahl-config.c b/ahl-binding/ahl-config.c index c0854a8..0817c25 100644 --- a/ahl-binding/ahl-config.c +++ b/ahl-binding/ahl-config.c @@ -46,7 +46,7 @@ static json_object* CtlConfigScan(const char *dirList, const char *prefix) { strncat(controlFile, GetBinderName(), CONTROL_MAXPATH_LEN); // search for default dispatch config file - json_object* responseJ = ScanForConfig(dirList, CTL_SCAN_RECURSIVE, controlFile, ".json"); + json_object* responseJ = ScanForConfig(dirList, CTL_SCAN_RECURSIVE, controlFile, "-config.json"); return responseJ; } @@ -94,10 +94,10 @@ int ParseHLBConfig() { const char *configfile_path =CtlConfigSearch(dirList, "ahl-"); if (!configfile_path) { AFB_ERROR("Error: No control-* config found invalid JSON %s ", dirList); - return 1; + return AHL_FAIL; } - AFB_INFO("High-level config file -> %s\n", configfile_path); + AFB_NOTICE("High-level config file -> %s\n", configfile_path); // Open configuration file json_object *config_JFile=json_object_from_file(configfile_path); diff --git a/ahl-policy/ahl-policy.c b/ahl-policy/ahl-policy.c index 78e99ae..4fb75c7 100644 --- a/ahl-policy/ahl-policy.c +++ b/ahl-policy/ahl-policy.c @@ -1183,24 +1183,25 @@ void Policy_Term() g_ptr_array_free(g_PolicyCtx.pHALList,TRUE); g_PolicyCtx.pHALList = NULL; } + - for(int i=0; i<g_PolicyCtx.pSourceEndpoints->len; i++) + if (g_PolicyCtx.pSourceEndpoints) for(int i=0; i<g_PolicyCtx.pSourceEndpoints->len; i++) { EndPointPolicyInfoT * pCurEndpoint = &g_array_index(g_PolicyCtx.pSourceEndpoints,EndPointPolicyInfoT,i); g_array_free(pCurEndpoint->streamInfo,TRUE); pCurEndpoint->streamInfo= NULL; } - for(int i=0; i<g_PolicyCtx.pSinkEndpoints->len; i++) + if (g_PolicyCtx.pSinkEndpoints) for(int i=0; i<g_PolicyCtx.pSinkEndpoints->len; i++) { EndPointPolicyInfoT * pCurEndpoint = &g_array_index(g_PolicyCtx.pSinkEndpoints,EndPointPolicyInfoT,i); g_array_free(pCurEndpoint->streamInfo,TRUE); pCurEndpoint->streamInfo = NULL; } - g_array_free(g_PolicyCtx.pSourceEndpoints,TRUE); + if (g_PolicyCtx.pSourceEndpoints) g_array_free(g_PolicyCtx.pSourceEndpoints,TRUE); g_PolicyCtx.pSourceEndpoints = NULL; - g_array_free(g_PolicyCtx.pSinkEndpoints,TRUE); + if (g_PolicyCtx.pSinkEndpoints) g_array_free(g_PolicyCtx.pSinkEndpoints,TRUE); g_PolicyCtx.pSinkEndpoints = NULL; } diff --git a/conf.d/cmake/config.cmake b/conf.d/cmake/config.cmake index 5f84437..e168060 100644 --- a/conf.d/cmake/config.cmake +++ b/conf.d/cmake/config.cmake @@ -100,7 +100,7 @@ if(IS_DIRECTORY $ENV{HOME}/opt/afb-monitoring) set(MONITORING_ALIAS "--alias=/monitoring:$ENV{HOME}/opt/afb-monitoring") endif() -set(CLOSING_MESSAGE "Debug: afb-daemon --name=afb-audiok4a --port=1234 --ws-server=unix:/var/tmp/ahl-4a --cntxtimeout=1 ${MONITORING_ALIAS} --binding=package/lib/afb-audiohighlevel.so --ldpaths=../../alsa-4a/build/package/lib:../../hal-sample-4a/build/package/lib --workdir=. --roothttp=../htdocs --token= --verbose ") +set(CLOSING_MESSAGE "Debug: afb-daemon --name=afb-audio4a --port=1234 --ws-server=unix:/var/tmp/ahl-4a --cntxtimeout=1 ${MONITORING_ALIAS} --binding=package/lib/afb-audiohighlevel.so --ldpaths=../../alsa-4a/build/package/lib:../../hal-sample-4a/build/package/lib --workdir=. --roothttp=../htdocs --token= --verbose ") # Optional location for config.xml.in diff --git a/conf.d/project/.asounrc-fulup b/conf.d/project/.asounrc-fulup deleted file mode 100644 index c98d5a8..0000000 --- a/conf.d/project/.asounrc-fulup +++ /dev/null @@ -1,198 +0,0 @@ -# -# Author: Fulup Ar Foll -# Object: PCM hook type -# -# Test : Note: Jabra_USB=hw:v1340 -# Check SoundCard ==> speaker-test -Dhw:v1340 -c2 -twav -# Check MixerPCM ==> speaker-test -DSpeakers -c2 -twav -# Check SoftVol ==> speaker-test -DMusicPCM -c2 -twav -# Check Plugin ==> speaker-test -DMultimedia -c2 -twav -# Check Plugin ==> speaker-test -DNavigation -c2 -twav -# -# MultiMedia aplay -DDMyNavPCM /usr/share/sounds/alsa/test.wav -# -# Bug/Feature: when softvol control is initialised from plugin and not -# from AGL binding. At 1st run ctl has invalid TLV and cannot be -# use. Bypass Solution: -# * start audio-binder before playing sound (binding create control before softvol plugin) -# * run a dummy aplay -DMyNavPCM "" to get a clean control -# -# References: https://www.spinics.net/lists/alsa-devel/msg54235.html -# -------------------------------------------------------------------- - -# ------------------------------------------------------ -# Mixer PCM allow to play multiple stream simultaneously -# ------------------------------------------------------ -pcm.Speakers { - type dmix - slave {pcm "hw:v1340"} #Jabra Solmate 1 - ipc_key 1001 # ipc_key should be unique to each dmix -} - -# ----------------------------------------------------- -# Register ControllerHookPlugin (ToiBeFix fullpath) -# ----------------------------------------------------- -pcm_hook_type.CtlHookPlugin { - install "AlsaInstallHook" - lib "/home/fulup/Workspace/Audio-4a/alsa-4a/build/alsa-hook/policy_alsa_hook.so" -} - - -# ------------------------------------------------------- -# Define one Audio Virtual Channel per Audio Roles -# ------------------------------------------------------- -pcm.MusicPCM { - type softvol - - # Point Slave on HOOK for policies control - slave.pcm "Speakers" - - # name should match with HAL definition - control.name "Playback Multimedia" -} - -pcm.NaviPCM { - type softvol - - # Point Slave on HOOK for policies control - slave.pcm "Speakers" - - # name should match with HAL definition - control.name "Playback Navigation" -} - -pcm.UrgentPCM { - type softvol - - # Point Slave on HOOK for policies control - slave.pcm "Speakers" - - # name should match with HAL definition - control.name "Playback Emergency" -} - -# ---------------------------------------------------- -# Define one hooked PCM channel per Audio Roles -# ---------------------------------------------------- -pcm.Multimedia { - type hooks - slave {pcm "MusicPCM"} - hooks.0 { - comment "Defined used hook sharelib and provide arguments/config to install func" - type "CtlHookPlugin" - hook_args { - - # print few log messages (default false) - verbose true - - # uri to audio-4a policy engine - uri="unix:/var/tmp/ahl-4a" - - # timeout in ms (default 500) - timeout 5000 - - # force API synchronous mode - synchronous true - - # api subcall to request a role - request { - stream_open "{'audio_role':'Entertainment', 'endpoint_type': 'sink'}" - set_stream_state "{'state': 'running'}" - } - - # api subcall to request a role - release { - stream_close "{}" - } - - # map AGL event on Unix signal. Search in event for json key=value - events { - sig-02 {search music, value quit} - sig-31 {search event, value start} - sig-32 {search event, value start} - } - } - } -} - -pcm.Navigation { - type hooks - slave {pcm "NaviPCM"} - hooks.0 { - comment "Defined used hook sharelib and provide arguments/config to install func" - type "CtlHookPlugin" - hook_args { - - # print few log messages (default false) - verbose true - - # uri to audio-4a policy engine - uri="unix:/var/tmp/ahl-4a" - - # timeout in ms (default 500) - timeout 5000 - - # force API synchronous mode - synchronous true - - # api subcall to request a role - request { - stream_open "{'audio_role':'Guidance', 'endpoint_type': 'sink'}" - set_stream_state "{'state': 'running'}" - } - - # api subcall to request a role - release { - release-role "{'uid':'alsa-hook-client'}" - } - - # map AGL event on Unix signal. Search in event for json key=value - events { - sig-02 {search navi, value quit} - sig-31 {search event, value start} - sig-32 {search event, value start} - } - } - } -} - -pcm.Emergency { - type hooks - slave {pcm "UrgentPCM"} - hooks.0 { - comment "Defined used hook sharelib and provide arguments/config to install func" - type "CtlHookPlugin" - hook_args { - - # print few log messages (default false) - verbose true - - # uri to audio-4a policy engine - uri="unix:/var/tmp/ahl-4a" - - # timeout in ms (default 500) - timeout 5000 - - # force API synchronous mode - synchronous true - - # api subcall to request a role - request { - stream_open "{'audio_role':'Emergency', 'endpoint_type': 'sink'}" - set_stream_state "{'state': 'running'}" - } - - # api subcall to request a role - release { - release-role "{'uid':'alsa-hook-client'}" - } - - # map AGL event on Unix signal. Search in event for json key=value - events { - sig-02 {search navi, value quit} - sig-31 {search event, value start} - sig-32 {search event, value start} - } - } - } -} diff --git a/conf.d/project/ahl-aaaa-config.json b/conf.d/project/ahl-audio4a-config.json index 5f24b00..64c8141 100644 --- a/conf.d/project/ahl-aaaa-config.json +++ b/conf.d/project/ahl-audio4a-config.json @@ -3,7 +3,7 @@ "policy_module": "AudioPolicy_v1", "description": "High-level binding configuration file", "note": "Devices and routings are always listed in order of priority (for device selection rules)", - "hal_list": ["ensoniq","usbaudio"], + "hal_list": ["ensoniq","usb-audio"], "audio_roles": [ { "name": "Warning", diff --git a/conf.d/project/ahl-fulup4a-config.json b/conf.d/project/ahl-fulup4a-config.json index 4f418e2..da7d93c 100644 --- a/conf.d/project/ahl-fulup4a-config.json +++ b/conf.d/project/ahl-fulup4a-config.json @@ -3,14 +3,14 @@ "policy_module": "AudioPolicy_v1", "description": "High-level binding configuration file", "note": "Devices and routings are always listed in order of priority (for device selection rules)", - "hal_list": ["jabra-usb"], + "hal_list": ["usb-jabra"], "audio_roles": [ { "name": "Guidance", "description": "Important user information where user action is expected (e.g. navigation instruction)", "priority": 25, "output": [ - "alsa.plug:NaviPCM" + "alsa.plug:Guidance_Main" ], "interupt_behavior": "continue" }, @@ -19,7 +19,7 @@ "description": "HMI or else notifications (e.g. touchscreen events, speech recognition on/off,...)", "priority": 100, "output": [ - "alsa.plug:UrgentPCM" + "alsa.plug:Notification_Main" ], "interupt_behavior": "pause" }, @@ -28,7 +28,7 @@ "description": "Multimedia content (e.g. tuner, media player, etc.)", "priority": 0, "output": [ - "alsa.plug:MusicPCM" + "alsa.plug:Entertainment_Main" ], "interupt_behavior": "pause" } diff --git a/conf.d/project/.asoundrc b/conf.d/project/asoundrc-audio4a index 8dde445..8dde445 100644 --- a/conf.d/project/.asoundrc +++ b/conf.d/project/asoundrc-audio4a diff --git a/conf.d/project/asoundrc-fulup4a b/conf.d/project/asoundrc-fulup4a new file mode 100644 index 0000000..d500f5a --- /dev/null +++ b/conf.d/project/asoundrc-fulup4a @@ -0,0 +1,81 @@ +#AGL Audio High Level ALSA configuration +#This define 2 sounds card with 8 audio roles each +#The alsa soft volume control name must match with the HAL Control Name + +pcm.SoftMixer { + type dmix + slave {pcm "hw:v1340"} #Jabra Solmate 1 + ipc_key 1001 # ipc_key should be unique to each dmix +} + +# ----------------------------------------------------- +# Register ControllerHookPlugin (ToiBeFix fullpath) +# ----------------------------------------------------- +pcm_hook_type.CtlHookPlugin { + install "AlsaInstallHook" + lib "/home/fulup/Workspace/Audio-4a/alsa-4a/build/alsa-hook/policy_alsa_hook.so" +} + +pcm.Entertainment_Main { + type softvol + slave.pcm "SoftMixer" + control{ + name "Entertainment_Volume" + } +} + +pcm.Guidance_Main { + type softvol + slave.pcm "SoftMixer" + control{ + name "Guidance_Volume" + } +} + +pcm.Communications_Main { + type softvol + slave.pcm "SoftMixer" + control{ + name "Communications_Volume" + } +} + +pcm.Notification_Main { + type softvol + slave.pcm "SoftMixer" + control{ + name "Notification_Volume" + } +} + +pcm.Warning_Main { + type softvol + slave.pcm "SoftMixer" + control{ + name "Warning_Volume" + } +} + +pcm.System_Main { + type softvol + slave.pcm "SoftMixer" + control{ + name "System_Volume" + } +} + +pcm.Startup_Main { + type softvol + slave.pcm "SoftMixer" + control{ + name "Startup_Volume" + } +} + +pcm.Shutdown_Main { + type softvol + slave.pcm "SoftMixer" + control{ + name "Shutdown_Volume" + } +} diff --git a/nbproject/configurations.xml b/nbproject/configurations.xml index 93a17f5..c696790 100644 --- a/nbproject/configurations.xml +++ b/nbproject/configurations.xml @@ -44,7 +44,68 @@ </sourceRootList> <projectmakefile>build/Makefile</projectmakefile> <confs> - <conf name="Default" type="0"> + <conf name="AHL-fulup4a" type="0"> + <toolsSet> + <compilerSet>default</compilerSet> + <dependencyChecking>false</dependencyChecking> + <rebuildPropChanged>false</rebuildPropChanged> + </toolsSet> + <codeAssistance> + <buildAnalyzer>false</buildAnalyzer> + </codeAssistance> + <makefileType> + <makeTool> + <buildCommandWorkingDir>build</buildCommandWorkingDir> + <buildCommand>${MAKE} -f Makefile</buildCommand> + <cleanCommand>${MAKE} -f Makefile clean</cleanCommand> + <executablePath></executablePath> + <cTool> + <incDir> + <pElem>.</pElem> + </incDir> + </cTool> + <ccTool> + <incDir> + <pElem>.</pElem> + </incDir> + </ccTool> + </makeTool> + <preBuild> + <preBuildCommandWorkingDir>build</preBuildCommandWorkingDir> + <preBuildCommand>cmake ..</preBuildCommand> + <preBuildFirst>true</preBuildFirst> + </preBuild> + </makefileType> + <item path="afb-utilities/filescan-utils.c" ex="false" tool="0" flavor2="0"> + </item> + <item path="afb-utilities/wrap-json.c" ex="false" tool="0" flavor2="0"> + </item> + <item path="ahl-binding/ahl-binding.c" ex="false" tool="0" flavor2="0"> + </item> + <item path="ahl-binding/ahl-config.c" ex="false" tool="0" flavor2="0"> + </item> + <item path="ahl-binding/ahl-deviceenum.c" ex="false" tool="0" flavor2="0"> + </item> + <item path="ahl-utilities/ahl-policy-utils.c" ex="false" tool="0" flavor2="0"> + </item> + <item path="ahl-utilities/ahl-policy-utils.h" ex="false" tool="3" flavor2="0"> + </item> + <item path="build/CMakeFiles/3.5.2/CompilerIdC/CMakeCCompilerId.c" + ex="false" + tool="0" + flavor2="0"> + </item> + <item path="build/CMakeFiles/3.5.2/CompilerIdCXX/CMakeCXXCompilerId.cpp" + ex="false" + tool="1" + flavor2="0"> + </item> + <item path="build/CMakeFiles/feature_tests.c" ex="false" tool="0" flavor2="0"> + </item> + <item path="build/CMakeFiles/feature_tests.cxx" ex="false" tool="1" flavor2="0"> + </item> + </conf> + <conf name="AHL-audio4a" type="0"> <toolsSet> <compilerSet>default</compilerSet> <dependencyChecking>false</dependencyChecking> diff --git a/nbproject/project.xml b/nbproject/project.xml index 3e0cffd..c1d2e8a 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -14,7 +14,11 @@ </sourceRootList> <confList> <confElem> - <name>Default</name> + <name>AHL-fulup4a</name> + <type>0</type> + </confElem> + <confElem> + <name>AHL-audio4a</name> <type>0</type> </confElem> </confList> |