const char *__connman_element_subtype2string(enum connman_element_subtype type);
const char *__connman_element_policy2string(enum connman_element_policy policy);
+enum connman_element_policy __connman_element_string2policy(const char *policy);
int __connman_element_load(struct connman_element *element);
int __connman_element_store(struct connman_element *element);
return NULL;
}
+enum connman_element_policy __connman_element_string2policy(const char *policy)
+{
+ if (strcasecmp(policy, "off") == 0)
+ return CONNMAN_ELEMENT_POLICY_OFF;
+ else if (strcasecmp(policy, "ignore") == 0)
+ return CONNMAN_ELEMENT_POLICY_IGNORE;
+ else if (strcasecmp(policy, "auto") == 0)
+ return CONNMAN_ELEMENT_POLICY_AUTO;
+ else if (strcasecmp(policy, "ask") == 0)
+ return CONNMAN_ELEMENT_POLICY_ASK;
+ else
+ return CONNMAN_ELEMENT_POLICY_UNKNOWN;
+}
+
static void append_property(DBusMessageIter *dict,
struct connman_property *property)
{
DBG("element %p name %s", element, element->name);
value = g_key_file_get_string(keyfile, element->path,
+ "Policy", NULL);
+ if (value != NULL)
+ element->policy = __connman_element_string2policy(value);
+
+ value = g_key_file_get_string(keyfile, element->path,
"WiFi.Security", NULL);
if (value != NULL)
connman_element_set_property(element,
{
GSList *list;
char *value;
+ const char *str;
DBG("element %p name %s", element, element->name);
g_key_file_set_string(keyfile, element->path, "Name", element->name);
- value = __connman_element_policy2string(element->policy);
- if (value != NULL)
- g_key_file_set_string(keyfile, element->path, "Policy", value);
+ str = __connman_element_policy2string(element->policy);
+ if (str != NULL)
+ g_key_file_set_string(keyfile, element->path, "Policy", str);
g_key_file_set_boolean(keyfile, element->path, "Enabled",
element->enabled);