Rename all internal pa_ definitions to agl_
[staging/agl-audio-plugin.git] / config.c
1 /*
2  * module-agl-audio -- PulseAudio module for providing audio routing support
3  * (forked from "module-murphy-ivi" - https://github.com/otcshare )
4  * Copyright (c) 2012, Intel Corporation.
5  * Copyright (c) 2016, IoT.bzh
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms and conditions of the GNU Lesser General Public License,
9  * version 2.1, as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the
18  * Free Software Foundation, Inc., 51 Franklin St - Fifth Floor, Boston,
19  * MA 02110-1301 USA.
20  *
21  */
22 #include "config.h"
23
24 const char *agl_config_file_get_path (const char *dir, const char *file, char *buf, size_t len)
25 {
26         pa_assert (file);
27         pa_assert (buf);
28         pa_assert (len > 0);
29
30         snprintf (buf, len, "%s/%s", dir, file);
31
32         return buf;
33 }
34
35 bool agl_config_parse_file (struct userdata *u, const char *path)
36 {
37         bool success;
38
39         pa_assert (u);
40
41         if (!path)
42                 return false;
43         else {
44                 pa_log_info ("parsing configuration file '%s'", path);
45                 success = agl_config_dofile (u, path);
46         }
47
48         if (!success) {
49                 pa_log_info ("applying builtin default configuration");
50                 //success = use_default_configuration (u);
51         }
52
53         return success;
54 }
55
56 bool agl_config_dofile (struct userdata *u, const char *path)
57 {
58         /* TODO */
59         return false;
60 }
61
62
63  /* DEFAULT CONFIGURATION PART */
64
65 static zone_def zones[] = {
66         { "driver" },
67         { "passenger1" },
68         { "passenger2" },
69         { "passenger3" },
70         { "passenger4" },
71         { NULL }
72 };
73
74
75 static rtgroup_def rtgroups[] = {
76         { agl_input,
77           "phone",
78           agl_router_phone_accept,
79           agl_router_phone_compare
80         },
81
82         { 0, NULL, NULL, NULL }
83 };
84
85 static classmap_def classmap[] = {
86         { agl_phone,    0, agl_output, "phone" },
87         { agl_player,   0, agl_output, "default" },
88         { agl_radio,    0, agl_output, "default" },
89         { agl_navigator,0, agl_output, "default" },
90         { agl_event,    0, agl_output, "default" },
91         { agl_node_type_unknown, 0, agl_direction_unknown, NULL }
92 };
93
94 static typemap_def typemap[] = {
95         { "phone", agl_phone },
96         { "music", agl_player },
97         { "radio", agl_radio },
98         { "navi", agl_navigator },
99         { "event", agl_event },
100         { NULL, agl_node_type_unknown }
101 };
102
103 static prior_def priormap[] = {
104         { agl_event,     5 },
105         { agl_phone,     4 },
106         { agl_navigator, 2 },
107         { agl_radio,     1 },
108         { agl_player,    1 },
109         { agl_node_type_unknown, 0}
110 };
111
112 bool use_default_configuration (struct userdata *u)
113 {
114         zone_def *z;
115         rtgroup_def *r;
116         classmap_def *c;
117         typemap_def *t;
118         prior_def *p;
119
120         return true;
121 }