diff options
author | Patrik Flykt <patrik.flykt@linux.intel.com> | 2012-04-05 22:38:40 +0300 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2012-04-11 15:25:29 +0300 |
commit | eba34e417eed53447b02e8194e2455b84d8d9fbe (patch) | |
tree | 583edfac3fb7be8f78bdadb2aac5e90cda2f1601 /src/main.c | |
parent | 167aab8ef44d0a601d20f7f77e5e969689582ca8 (diff) | |
download | connman-eba34e417eed53447b02e8194e2455b84d8d9fbe.tar.gz connman-eba34e417eed53447b02e8194e2455b84d8d9fbe.tar.bz2 connman-eba34e417eed53447b02e8194e2455b84d8d9fbe.zip |
main: Add 'PreferredTechnologies' configuration file option
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().
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -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,17 @@ 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); + + g_strfreev(str_list); + + g_clear_error(&error); } static GMainLoop *main_loop = NULL; @@ -309,6 +322,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 +513,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); |