struct wifi_data {
GSList *list;
gchar *identifier;
+ gboolean connected;
};
static int network_probe(struct connman_element *element)
if (element->parent != NULL) {
struct wifi_data *data = connman_element_get_data(element->parent);
+ if (data->connected == TRUE)
+ return -EBUSY;
+
if (data != NULL) {
g_free(data->identifier);
data->identifier = g_strdup(identifier);
if (state == STATE_COMPLETED) {
struct connman_element *dhcp;
+ data->connected = TRUE;
+
dhcp = connman_element_create(NULL);
dhcp->type = CONNMAN_ELEMENT_TYPE_DHCP;
dhcp->index = element->index;
connman_element_register(dhcp, element);
- }
+ } else if (state == STATE_DISCONNECTED || state == STATE_INACTIVE)
+ data->connected = FALSE;
}
static void scan_result(struct connman_element *parent,
temp = g_strdup(network->identifier);
for (i = 0; i < strlen(temp); i++) {
- if (temp[i] == ' ' || temp[i] == '.' || temp[i] == '-')
+ if (temp[i] == ' ' || temp[i] == '.')
+ temp[i] = '_';
+ else if (temp[i] == '-' || temp[i] == '+')
+ temp[i] = '_';
+ else if (temp[i] == '!' || temp[i] == '?')
temp[i] = '_';
else if (temp[i] == '(' || temp[i] == ')')
temp[i] = '_';
strength = network->quality;
- //connman_element_add_static_property(element, "WiFi.Strength",
- // DBUS_TYPE_BYTE, &strength);
+ connman_element_add_static_property(element, "WiFi.Strength",
+ DBUS_TYPE_BYTE, &strength);
//connman_element_add_static_property(element, "WiFi.Noise",
// DBUS_TYPE_INT32, &network->noise);
if (data == NULL)
return -ENOMEM;
+ data->connected = FALSE;
+
connman_element_set_data(element, data);
return 0;
dbus_connection_unref(connection);
}
-CONNMAN_PLUGIN_DEFINE("wifi", "WiFi interface plugin", VERSION,
+CONNMAN_PLUGIN_DEFINE(wifi, "WiFi interface plugin", VERSION,
wifi_init, wifi_exit)