CONNMAN_ELEMENT_STATE_CLOSED = 3,
};
+enum connman_element_policy {
+ CONNMAN_ELEMENT_POLICY_UNKNOWN = 0,
+ CONNMAN_ELEMENT_POLICY_OFF = 1,
+ CONNMAN_ELEMENT_POLICY_AUTO = 2,
+ CONNMAN_ELEMENT_POLICY_IGNORE = 3,
+ CONNMAN_ELEMENT_POLICY_ASK = 4,
+};
+
enum connman_element_type {
CONNMAN_ELEMENT_TYPE_UNKNOWN = 0,
CONNMAN_ELEMENT_TYPE_ROOT = 1,
enum connman_element_type type;
enum connman_element_subtype subtype;
enum connman_element_state state;
+ enum connman_element_policy policy;
gboolean enabled;
guint16 priority;
return NULL;
}
+static const char *policy2string(enum connman_element_policy policy)
+{
+ switch (policy) {
+ case CONNMAN_ELEMENT_POLICY_UNKNOWN:
+ return "unknown";
+ case CONNMAN_ELEMENT_POLICY_OFF:
+ return "off";
+ case CONNMAN_ELEMENT_POLICY_AUTO:
+ return "auto";
+ case CONNMAN_ELEMENT_POLICY_IGNORE:
+ return "ignore";
+ case CONNMAN_ELEMENT_POLICY_ASK:
+ return "ask";
+ }
+
+ return NULL;
+}
+
static void append_property(DBusMessageIter *dict,
struct connman_property *property)
{
connman_dbus_dict_append_variant(&dict, "Type",
DBUS_TYPE_STRING, &str);
+ str = policy2string(element->policy);
+ if (str != NULL)
+ connman_dbus_dict_append_variant(&dict, "Policy",
+ DBUS_TYPE_STRING, &str);
+
connman_dbus_dict_append_variant(&dict, "Powered",
DBUS_TYPE_BOOLEAN, &element->enabled);
struct connman_element *element = data;
DBusMessage *reply;
DBusMessageIter array, dict;
+ const char *str;
DBG("conn %p", conn);
DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);
+ str = policy2string(element->policy);
+ if (str != NULL)
+ connman_dbus_dict_append_variant(&dict, "Policy",
+ DBUS_TYPE_STRING, &str);
+
connman_dbus_dict_append_variant(&dict, "Connected",
DBUS_TYPE_BOOLEAN, &element->enabled);
element->type = CONNMAN_ELEMENT_TYPE_UNKNOWN;
element->subtype = CONNMAN_ELEMENT_SUBTYPE_UNKNOWN;
element->state = CONNMAN_ELEMENT_STATE_CLOSED;
+ element->policy = CONNMAN_ELEMENT_POLICY_AUTO;
element->index = -1;
element->enabled = FALSE;