}
#if defined TIZEN_EXT
+static DBusMessage *get_interfaces(DBusConnection *conn, DBusMessage *msg, void *data)
+{
+ DBusMessage *reply;
+ DBusMessageIter iter, array;
+ const char *default_interface = connman_option_get_string("DefaultWifiInterface");
+
+ DBG("DefaultWifiInterface %s", default_interface);
+
+ reply = dbus_message_new_method_return(msg);
+ if (!reply)
+ return NULL;
+
+ dbus_message_iter_init_append(reply, &iter);
+ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+ DBUS_TYPE_STRING_AS_STRING, &array);
+
+ dbus_message_iter_append_basic(&array,
+ DBUS_TYPE_STRING, &default_interface);
+
+ __connman_technology_append_interfaces(&array,
+ CONNMAN_SERVICE_TYPE_WIFI, default_interface);
+
+ dbus_message_iter_close_container(&iter, &array);
+ return reply;
+}
+
static DBusMessage *get_default_service(DBusConnection *conn,
DBusMessage *msg, void *data)
{
NULL, GDBUS_ARGS({ "services", "a(oa{sv})" }),
get_services) },
#if defined TIZEN_EXT
+ { GDBUS_METHOD("GetInterfaces",
+ NULL, GDBUS_ARGS({ "interface_list", "as" }),
+ get_interfaces) },
{ GDBUS_METHOD("GetDefaultService",
NULL, GDBUS_ARGS({ "service", "oa{sv}" }),
get_default_service) },
DBUS_TYPE_STRING, &str);
}
}
+
+void __connman_technology_append_interfaces(DBusMessageIter *array,
+ enum connman_service_type type, const char *ifname)
+{
+ GSList *list;
+ struct connman_technology *technology = NULL;
+
+ for (list = technology_list; list; list = list->next) {
+ struct connman_technology *local_tech = list->data;
+
+ if (local_tech->type != type)
+ continue;
+
+ technology = local_tech;
+ break;
+ }
+
+ if (!technology)
+ return;
+
+ for (list = technology->device_list; list; list = list->next) {
+ struct connman_device *device = list->data;
+ const char *str = connman_device_get_string(device, "Interface");
+
+ if (g_strcmp0(ifname, str) == 0)
+ continue;
+
+ dbus_message_iter_append_basic(array,
+ DBUS_TYPE_STRING, &str);
+ }
+}
#endif
static void append_properties(DBusMessageIter *iter,
return reply;
}
-static DBusMessage *get_interfaces(DBusConnection *conn, DBusMessage *msg, void *data)
-{
- DBusMessage *reply;
- DBusMessageIter iter, array;
- GSList *list;
- struct connman_technology *technology = data;
- const char *default_interface = connman_option_get_string("DefaultWifiInterface");
-
- DBG("technology %p", technology);
-
- reply = dbus_message_new_method_return(msg);
- if (!reply)
- return NULL;
-
- if (technology->type != CONNMAN_SERVICE_TYPE_WIFI)
- return NULL;
-
- dbus_message_iter_init_append(reply, &iter);
- dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
- DBUS_TYPE_STRING_AS_STRING, &array);
-
- dbus_message_iter_append_basic(&array,
- DBUS_TYPE_STRING, &default_interface);
-
- for (list = technology->device_list; list; list = list->next) {
- struct connman_device *device = list->data;
- const char *str = connman_device_get_string(device, "Interface");
-
- if (g_strcmp0(default_interface, str) == 0)
- continue;
-
- dbus_message_iter_append_basic(&array,
- DBUS_TYPE_STRING, &str);
- }
-
- dbus_message_iter_close_container(&iter, &array);
- return reply;
-}
-
static int technology_enable_device(struct connman_technology *technology,
bool enable_device, const char *ifname, struct connman_device **device_out)
{
get_5ghz_supported) },
{ GDBUS_METHOD("GetMaxScanSsid", NULL, GDBUS_ARGS({ "maxscanssid", "a{sv}" }),
get_max_scan_ssid) },
- { GDBUS_METHOD("GetInterfaces", NULL, GDBUS_ARGS({ "interface_list", "as" }),
- get_interfaces) },
{ GDBUS_ASYNC_METHOD("SetDevicePower",
GDBUS_ARGS({ "ifname", "s" }, { "value", "b" }),
NULL, set_device_power) },