return data.count;
}
+static struct connman_network *__connman_element_get_network(struct connman_element *element)
+{
+ if (element->type == CONNMAN_ELEMENT_TYPE_NETWORK &&
+ element->network != NULL)
+ return element->network;
+
+ if (element->parent == NULL)
+ return NULL;
+
+ return __connman_element_get_network(element->parent);
+}
+
struct connman_service *__connman_element_get_service(struct connman_element *element)
{
struct connman_service *service;
+ struct connman_network *network;
struct connman_device *device;
enum connman_device_type type;
switch (type) {
case CONNMAN_DEVICE_TYPE_UNKNOWN:
case CONNMAN_DEVICE_TYPE_VENDOR:
- case CONNMAN_DEVICE_TYPE_WIFI:
- case CONNMAN_DEVICE_TYPE_WIMAX:
case CONNMAN_DEVICE_TYPE_BLUETOOTH:
case CONNMAN_DEVICE_TYPE_GPS:
case CONNMAN_DEVICE_TYPE_HSO:
case CONNMAN_DEVICE_TYPE_ETHERNET:
service = __connman_service_lookup_from_device(device);
break;
+ case CONNMAN_DEVICE_TYPE_WIFI:
+ case CONNMAN_DEVICE_TYPE_WIMAX:
+ network = __connman_element_get_network(element);
+ if (network == NULL)
+ return NULL;
+ service = __connman_service_lookup_from_network(network);
+ break;
}
return service;