aboutsummaryrefslogtreecommitdiffstats
path: root/HAL-afb/HAL_MOST_UNICENS/hal_most_unicens.c
diff options
context:
space:
mode:
authorTobias Jahnke <tjahnk@users.noreply.github.com>2017-08-15 13:34:17 +0200
committerTobias Jahnke <tjahnk@users.noreply.github.com>2017-08-16 16:00:50 +0200
commit999340f641477f94e3730e53d8a8bf39fe93b0c4 (patch)
tree20fad1c4a16336e512a3035b51e9ac239dfb73eb /HAL-afb/HAL_MOST_UNICENS/hal_most_unicens.c
parent4aec17e1d42c1b0f3f628342bf24120299a0c819 (diff)
implemented listconfig in UNICENS wrapper
Diffstat (limited to 'HAL-afb/HAL_MOST_UNICENS/hal_most_unicens.c')
-rw-r--r--HAL-afb/HAL_MOST_UNICENS/hal_most_unicens.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/HAL-afb/HAL_MOST_UNICENS/hal_most_unicens.c b/HAL-afb/HAL_MOST_UNICENS/hal_most_unicens.c
index 2cffe8d..7240fe0 100644
--- a/HAL-afb/HAL_MOST_UNICENS/hal_most_unicens.c
+++ b/HAL-afb/HAL_MOST_UNICENS/hal_most_unicens.c
@@ -23,10 +23,12 @@
#include "wrap_unicens.h"
#include "wrap_volume.h"
-#define XML_CONFIG_PATH "/home/agluser/DEVELOPMENT/AGL/BINDING/unicens2-binding/data/config_multichannel_audio_kit.xml"
-#define ALSA_CARD_NAME "Microchip MOST:1"
+#ifndef UCS2_CFG_PATH
+# define UCS2_CFG_PATH "/home/agluser/DEVELOPMENT/AGL/BINDING/unicens2-binding/data"
+#endif
-#define PCM_MAX_CHANNELS 6
+#define ALSA_CARD_NAME "Microchip MOST:1"
+#define PCM_MAX_CHANNELS 6
static int master_volume;
static json_bool master_switch;
@@ -96,6 +98,7 @@ STATIC alsaHalSndCardT alsaHalSndCard = {
/* initializes ALSA sound card, UNICENS API */
STATIC int unicens_service_init() {
int err = 0;
+ char *config_file = NULL;
AFB_NOTICE("Initializing HAL-MOST-UNICENS-BINDING");
err = halServiceInit(afbBindingV2.api, &alsaHalSndCard);
@@ -110,13 +113,25 @@ STATIC int unicens_service_init() {
goto OnErrorExit;
}
+ err = wrap_ucs_getconfig_sync(UCS2_CFG_PATH, &config_file);
+ if (err || (config_file == NULL)) {
+ AFB_ERROR("Failed to retrieve configuration");
+ goto OnErrorExit;
+ }
+ else {
+ AFB_NOTICE("Found configuration: %s", config_file);
+ }
+
err = wrap_ucs_subscribe_sync();
if (err) {
AFB_ERROR("Failed to subscribe to UNICENS binding");
goto OnErrorExit;
}
- err = wrap_ucs_initialize_sync(XML_CONFIG_PATH);
+ err = wrap_ucs_initialize_sync(config_file);
+ free(config_file);
+ config_file = NULL;
+
if (err) {
AFB_ERROR("Failed to initialize UNICENS binding");
goto OnErrorExit;