g_variant_get(message, "(a{sv})", &iter);
while (g_variant_iter_loop(iter, "{sv}", &field, &value)) {
- if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
- if (g_strcmp0(field, WIFI_CONFIG_NAME) == 0) {
- *name = g_strdup(g_variant_get_string(value, NULL));
- } else if (g_strcmp0(field, WIFI_CONFIG_PASSPHRASE) == 0) {
- *passphrase = g_strdup(g_variant_get_string(value, NULL));
- } else if (g_strcmp0(field, WIFI_CONFIG_SECURITY_TYPE) == 0) {
- *security_type = __net_wifi_security_type_to_int(g_variant_get_string(value, NULL));
- } else if (g_strcmp0(field, WIFI_CONFIG_HIDDEN) == 0) {
- const gchar *r_hidden = g_variant_get_string(value, NULL);
- if (g_strcmp0(r_hidden, "TRUE") == 0)
- *is_hidden = TRUE;
- else
- *is_hidden = FALSE;
- } else if (g_strcmp0(field, WIFI_CONFIG_FREQUENCY) == 0) {
- *frequency = g_variant_get_uint32(value);
- } else if (g_strcmp0(field, WIFI_CONFIG_PROXYADDRESS) == 0) {
- const gchar *r_proxy_address = g_variant_get_string(value, NULL);
- if (g_strcmp0(r_proxy_address, "NONE") == 0)
- *proxy_address = NULL;
- else
- *proxy_address = g_strdup(r_proxy_address);
- } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_METHOD) == 0) {
- const gchar *type = g_variant_get_string(value, NULL);
- if (g_strcmp0(type, "manual") == 0)
- (*ip_info)->ip_type = NET_IP_CONFIG_TYPE_STATIC;
- else if (g_strcmp0(type, "dhcp") == 0)
- (*ip_info)->ip_type = NET_IP_CONFIG_TYPE_DYNAMIC;
- } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_ADDRESS) == 0) {
- const gchar *ip_address = g_variant_get_string(value, NULL);
- (*ip_info)->ip_address = g_strdup(ip_address);
- } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_SUBNET_MASK) == 0) {
- const gchar *subnet_mask = g_variant_get_string(value, NULL);
- (*ip_info)->subnet_mask = g_strdup(subnet_mask);
- } else if (g_strcmp0(field, WIFI_CONFIG_IPV6_PREFIX_LEN) == 0) {
- int prefix_len = g_variant_get_int32(value);
- (*ip_info)->prefix_length = prefix_len;
- } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_GATEWAY_ADDRESS) == 0) {
- const gchar *gateway_address = g_variant_get_string(value, NULL);
- (*ip_info)->gateway_address = g_strdup(gateway_address);
- } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_DNS_METHOD) == 0) {
- const gchar *type = g_variant_get_string(value, NULL);
- if (g_strcmp0(type, "manual") == 0)
- (*ip_info)->dns_type = NET_DNS_CONFIG_TYPE_STATIC;
- else if (g_strcmp0(type, "dhcp") == 0)
- (*ip_info)->dns_type = NET_DNS_CONFIG_TYPE_DYNAMIC;
- } else if (g_strcmp0(field, WIFI_CONFIG_DNS_ADDRESS) == 0) {
- const gchar *dns_address = g_variant_get_string(value, NULL);
- (*ip_info)->dns_address[order] = g_strdup(dns_address);
- order += 1;
- (*ip_info)->dns_count = order;
- } else if (g_strcmp0(field, WIFI_CONFIG_FAILURE) == 0) {
- *wifi_last_error = __net_wifi_last_error_to_enum(g_variant_get_string(value, NULL));
- }
+ if (g_strcmp0(field, WIFI_CONFIG_NAME) == 0) {
+ *name = g_strdup(g_variant_get_string(value, NULL));
+ } else if (g_strcmp0(field, WIFI_CONFIG_PASSPHRASE) == 0) {
+ *passphrase = g_strdup(g_variant_get_string(value, NULL));
+ } else if (g_strcmp0(field, WIFI_CONFIG_SECURITY_TYPE) == 0) {
+ *security_type = __net_wifi_security_type_to_int(g_variant_get_string(value, NULL));
+ } else if (g_strcmp0(field, WIFI_CONFIG_HIDDEN) == 0) {
+ const gchar *r_hidden = g_variant_get_string(value, NULL);
+ if (g_strcmp0(r_hidden, "TRUE") == 0)
+ *is_hidden = TRUE;
+ else
+ *is_hidden = FALSE;
+ } else if (g_strcmp0(field, WIFI_CONFIG_FREQUENCY) == 0) {
+ *frequency = g_variant_get_uint32(value);
+ } else if (g_strcmp0(field, WIFI_CONFIG_PROXYADDRESS) == 0) {
+ const gchar *r_proxy_address = g_variant_get_string(value, NULL);
+ if (g_strcmp0(r_proxy_address, "NONE") == 0)
+ *proxy_address = NULL;
+ else
+ *proxy_address = g_strdup(r_proxy_address);
+ } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_METHOD) == 0) {
+ const gchar *type = g_variant_get_string(value, NULL);
+ if (g_strcmp0(type, "manual") == 0)
+ (*ip_info)->ip_type = NET_IP_CONFIG_TYPE_STATIC;
+ else if (g_strcmp0(type, "dhcp") == 0)
+ (*ip_info)->ip_type = NET_IP_CONFIG_TYPE_DYNAMIC;
+ } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_ADDRESS) == 0) {
+ const gchar *ip_address = g_variant_get_string(value, NULL);
+ (*ip_info)->ip_address = g_strdup(ip_address);
+ } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_SUBNET_MASK) == 0) {
+ const gchar *subnet_mask = g_variant_get_string(value, NULL);
+ (*ip_info)->subnet_mask = g_strdup(subnet_mask);
+ } else if (g_strcmp0(field, WIFI_CONFIG_IPV6_PREFIX_LEN) == 0) {
+ int prefix_len = g_variant_get_int32(value);
+ (*ip_info)->prefix_length = prefix_len;
+ } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_GATEWAY_ADDRESS) == 0) {
+ const gchar *gateway_address = g_variant_get_string(value, NULL);
+ (*ip_info)->gateway_address = g_strdup(gateway_address);
+ } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_DNS_METHOD) == 0) {
+ const gchar *type = g_variant_get_string(value, NULL);
+ if (g_strcmp0(type, "manual") == 0)
+ (*ip_info)->dns_type = NET_DNS_CONFIG_TYPE_STATIC;
+ else if (g_strcmp0(type, "dhcp") == 0)
+ (*ip_info)->dns_type = NET_DNS_CONFIG_TYPE_DYNAMIC;
+ } else if (g_strcmp0(field, WIFI_CONFIG_DNS_ADDRESS) == 0) {
+ const gchar *dns_address = g_variant_get_string(value, NULL);
+ (*ip_info)->dns_address[order] = g_strdup(dns_address);
+ order += 1;
+ (*ip_info)->dns_count = order;
+ } else if (g_strcmp0(field, WIFI_CONFIG_FAILURE) == 0) {
+ *wifi_last_error = __net_wifi_last_error_to_enum(g_variant_get_string(value, NULL));
}
}