#include "netdbus.h"
#include "netsupplicant.h"
-#define DBUS_OBJECT_PATH_MAX 150
-
-const char *netconfig_wifi_get_supplicant_interface(void)
+char *netconfig_wifi_get_supplicant_interface(void)
{
GVariant *message = NULL;
GVariant *params = NULL;
gchar *path = NULL;
- static char obj_path[DBUS_OBJECT_PATH_MAX] = { '\0', };
-
- if (obj_path[0] != '\0')
- return (const char *)obj_path;
params = g_variant_new("(s)", WIFI_IFNAME);
g_variant_get(message, "(o)", &path);
- g_strlcpy(obj_path, path, DBUS_OBJECT_PATH_MAX);
+ g_variant_unref(message);
+
+ return (char *)path;
+}
+
+char *netconfig_wifi_get_supplicant_p2p_interface(void)
+{
+ GVariant *message = NULL;
+ gchar *path = NULL;
+
+ message = netconfig_supplicant_invoke_dbus_method(
+ SUPPLICANT_SERVICE, SUPPLICANT_PATH,
+ SUPPLICANT_INTERFACE, "GetP2PInterface", NULL);
+
+ if (message == NULL) {
+ ERR("Failed to get object path");
+ return NULL;
+ }
+
+ g_variant_get(message, "(o)", &path);
- if (path)
- g_free(path);
g_variant_unref(message);
- return (const char *)obj_path;
+ return (char *)path;
}
GVariant *netconfig_supplicant_invoke_dbus_method(const char *dest, const char *path,
(GAsyncReadyCallback) notify_func,
NULL);
+ if (notify_func)
+ netconfig_gdbus_pending_call_ref();
+
return TRUE;
}
{
GVariant *params = NULL;
GVariant *reply = NULL;
- const char *path;
+ char *path;
ERR("[GDBUS] property_get : %s", key);
"Get",
params);
+ g_free(path);
if (reply == NULL) {
ERR("netconfig_supplicant_invoke_dbus_method() failed.");
return NULL;
{
gboolean result = FALSE;
GVariant *message = NULL;
- const char *path;
+ char *path;
DBG("[DBUS] property_set : %s", key);
message,
notify_func);
+ g_free(path);
if (result == FALSE) {
ERR("dbus_connection_send_with_reply() failed");