On Thu, 2014-06-05 at 15:38 +0300, Jukka Rissanen wrote:
> This is used by the config provision file support. It needs some
> initial values from settings file, like AutoConnect flag value.

More prose what this commit does, as it loads the very few user/system
modifiable values for all services, also the immutable ones coming from
a .config file.

> ---
>  src/connman.h |  1 +
>  src/service.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 49 insertions(+)
> 
> diff --git a/src/connman.h b/src/connman.h
> index cc5b445..9683451 100644
> --- a/src/connman.h
> +++ b/src/connman.h
> @@ -634,6 +634,7 @@ int __connman_provider_init(void);
>  
>  int __connman_service_init(void);
>  void __connman_service_cleanup(void);
> +int __connman_service_load_minimal(struct connman_service *service);

This function name should be more descriptive. How about _modifiable,
_user_modifiable or _common instead of minimal?

>  void __connman_service_list_struct(DBusMessageIter *iter);
>  
> diff --git a/src/service.c b/src/service.c
> index a40ac3e..48b0609 100644
> --- a/src/service.c
> +++ b/src/service.c
> @@ -342,6 +342,54 @@ static enum connman_service_proxy_method 
> string2proxymethod(const char *method)
>               return CONNMAN_SERVICE_PROXY_METHOD_UNKNOWN;
>  }
>  
> +int __connman_service_load_minimal(struct connman_service *service)
> +{
> +     GKeyFile *keyfile;
> +     GError *error = NULL;
> +     gchar *str;
> +     bool autoconnect;
> +
> +     DBG("service %p", service);
> +
> +     keyfile = connman_storage_load_service(service->identifier);
> +     if (!keyfile)
> +             return -EIO;
> +
> +     switch (service->type) {
> +     case CONNMAN_SERVICE_TYPE_UNKNOWN:
> +     case CONNMAN_SERVICE_TYPE_SYSTEM:
> +     case CONNMAN_SERVICE_TYPE_GPS:
> +     case CONNMAN_SERVICE_TYPE_P2P:
> +             break;
> +     case CONNMAN_SERVICE_TYPE_VPN:
> +             service->do_split_routing = g_key_file_get_boolean(keyfile,
> +                             service->identifier, "SplitRouting", NULL);
> +             /* fall through */
> +     case CONNMAN_SERVICE_TYPE_WIFI:
> +     case CONNMAN_SERVICE_TYPE_GADGET:
> +     case CONNMAN_SERVICE_TYPE_BLUETOOTH:
> +     case CONNMAN_SERVICE_TYPE_CELLULAR:
> +     case CONNMAN_SERVICE_TYPE_ETHERNET:
> +             autoconnect = g_key_file_get_boolean(keyfile,
> +                             service->identifier, "AutoConnect", &error);
> +             if (!error)
> +                     service->autoconnect = autoconnect;
> +             g_clear_error(&error);
> +             break;
> +     }
> +
> +     str = g_key_file_get_string(keyfile,
> +                             service->identifier, "Modified", NULL);
> +     if (str) {
> +             g_time_val_from_iso8601(str, &service->modified);
> +             g_free(str);
> +     }
> +
> +     g_key_file_free(keyfile);
> +
> +     return 0;
> +}
> +
>  static int service_load(struct connman_service *service)
>  {
>       GKeyFile *keyfile;


Cheers,

        Patrik


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

Reply via email to