From: Patrik Flykt <[email protected]>

The main.conf 'PreferredTechnologies' is a list of service
type strings but converted to a list of service type enums.
Thus the configuration option is accessible via the function
connman_setting_get_uint_list().
---
 src/main.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/src/main.c b/src/main.c
index 354734d..828df54 100644
--- a/src/main.c
+++ b/src/main.c
@@ -46,10 +46,12 @@ static struct {
        connman_bool_t bg_scan;
        char **pref_timeservers;
        unsigned int *auto_connect;
+       unsigned int *preferred_techs;
 } connman_settings  = {
        .bg_scan = TRUE,
        .pref_timeservers = NULL,
        .auto_connect = NULL,
+       .preferred_techs = NULL,
 };
 
 static GKeyFile *load_config(const char *file)
@@ -146,6 +148,20 @@ static void parse_config(GKeyFile *config)
        g_strfreev(str_list);
 
        g_clear_error(&error);
+
+       str_list = g_key_file_get_string_list(config, "General",
+                       "PreferredTechnologies", &len, &error);
+
+       if (error == NULL)
+               connman_settings.preferred_techs =
+                       parse_service_types(str_list, len);
+       else
+               connman_settings.preferred_techs =
+                       parse_service_types(default_auto_connect, 3);
+
+       g_strfreev(str_list);
+
+       g_clear_error(&error);
 }
 
 static GMainLoop *main_loop = NULL;
@@ -309,6 +325,9 @@ unsigned int *connman_setting_get_uint_list(const char *key)
        if (g_str_equal(key, "DefaultAutoConnectTechnologies") == TRUE)
                return connman_settings.auto_connect;
 
+       if (g_str_equal(key, "PreferredTechnologies") == TRUE)
+               return connman_settings.preferred_techs;
+
        return NULL;
 }
 
@@ -497,6 +516,7 @@ int main(int argc, char *argv[])
                g_strfreev(connman_settings.pref_timeservers);
 
        g_free(connman_settings.auto_connect);
+       g_free(connman_settings.preferred_techs);
 
        g_free(option_debug);
 
-- 
1.7.9.1

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to