summaryrefslogtreecommitdiffstats
path: root/config.c
diff options
context:
space:
mode:
authorManuel Bachmann <manuel.bachmann@iot.bzh>2016-06-13 13:15:17 +0200
committerYannick Gicquel <yannick.gicquel@iot.bzh>2016-10-11 17:09:07 +0200
commit9dc64e1e291d6518da0a918105c5bf7b1c603dd5 (patch)
treeffc30b09fc92696376ce4a6dec1367201ab3c7d4 /config.c
parent6fc3e02df9de8347eb76fdfd26ed781686d37b6c (diff)
Add basic configuration logic, builtin configuration
There is now a default routing configuration provided at startup (config file parsing is stubbed, decide if we need it for routing purposes, or just for very basic things). Change-Id: Ib824b63c663355ed80d0e6823d5f9aec8cb093d5 Signed-off-by: Manuel Bachmann <manuel.bachmann@iot.bzh>
Diffstat (limited to 'config.c')
-rw-r--r--config.c121
1 files changed, 121 insertions, 0 deletions
diff --git a/config.c b/config.c
new file mode 100644
index 0000000..4c4ed7d
--- /dev/null
+++ b/config.c
@@ -0,0 +1,121 @@
+/*
+ * module-agl-audio -- PulseAudio module for providing audio routing support
+ * (forked from "module-murphy-ivi" - https://github.com/otcshare )
+ * Copyright (c) 2012, Intel Corporation.
+ * Copyright (c) 2016, IoT.bzh
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU Lesser General Public License,
+ * version 2.1, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St - Fifth Floor, Boston,
+ * MA 02110-1301 USA.
+ *
+ */
+#include "config.h"
+
+const char *pa_config_file_get_path (const char *dir, const char *file, char *buf, size_t len)
+{
+ pa_assert (file);
+ pa_assert (buf);
+ pa_assert (len > 0);
+
+ snprintf (buf, len, "%s/%s", dir, file);
+
+ return buf;
+}
+
+bool pa_config_parse_file (struct userdata *u, const char *path)
+{
+ bool success;
+
+ pa_assert (u);
+
+ if (!path)
+ return false;
+ else {
+ pa_log_info ("parsing configuration file '%s'", path);
+ success = pa_config_dofile (u, path);
+ }
+
+ if (!success) {
+ pa_log_info ("applying builtin default configuration");
+ //success = use_default_configuration (u);
+ }
+
+ return success;
+}
+
+bool pa_config_dofile (struct userdata *u, const char *path)
+{
+ /* TODO */
+ return false;
+}
+
+
+ /* DEFAULT CONFIGURATION PART */
+
+static zone_def zones[] = {
+ { "driver" },
+ { "passenger1" },
+ { "passenger2" },
+ { "passenger3" },
+ { "passenger4" },
+ { NULL }
+};
+
+
+static rtgroup_def rtgroups[] = {
+ { agl_input,
+ "phone",
+ agl_router_phone_accept,
+ agl_router_phone_compare
+ },
+
+ { 0, NULL, NULL, NULL }
+};
+
+static classmap_def classmap[] = {
+ { agl_phone, 0, agl_output, "phone" },
+ { agl_player, 0, agl_output, "default" },
+ { agl_radio, 0, agl_output, "default" },
+ { agl_navigator,0, agl_output, "default" },
+ { agl_event, 0, agl_output, "default" },
+ { agl_node_type_unknown, 0, agl_direction_unknown, NULL }
+};
+
+static typemap_def typemap[] = {
+ { "phone", agl_phone },
+ { "music", agl_player },
+ { "radio", agl_radio },
+ { "navi", agl_navigator },
+ { "event", agl_event },
+ { NULL, agl_node_type_unknown }
+};
+
+static prior_def priormap[] = {
+ { agl_event, 5 },
+ { agl_phone, 4 },
+ { agl_navigator, 2 },
+ { agl_radio, 1 },
+ { agl_player, 1 },
+ { agl_node_type_unknown, 0}
+};
+
+bool use_default_configuration (struct userdata *u)
+{
+ zone_def *z;
+ rtgroup_def *r;
+ classmap_def *c;
+ typemap_def *t;
+ prior_def *p;
+
+ return true;
+}