int wfd_manager_set_display_device(int type, int port, int hdcp);
int wfd_manager_set_session_availability(int availability);
#endif /* TIZEN_FEATURE_WIFI_DISPLAY */
-int wfd_manager_start_discovery(wfd_manager_s *manager, int mode, int timeout, const char* type, int channel);
+int wfd_manager_start_discovery(wfd_manager_s *manager, int mode, int timeout,
+ const char* type, int channel, int frequency);
int wfd_manager_cancel_discovery(wfd_manager_s *manager);
#if defined(TIZEN_FEATURE_ASP)
wfd_device_s *wfd_manager_get_connected_peer_by_addr(wfd_manager_s *manager, unsigned char *peer_addr);
}
#endif /* TIZEN_FEATURE_ASP */
+int wfd_oem_add_vsie(wfd_oem_ops_s *ops, wfd_oem_vsie_frames_e frame_id,
+ const char* vsie)
+{
+ if (!ops || !ops->add_vsie)
+ return -1;
+
+ return ops->add_vsie(frame_id, vsie);
+}
+
+int wfd_oem_get_vsie(wfd_oem_ops_s *ops, wfd_oem_vsie_frames_e frame_id,
+ char **vsie)
+{
+ if (!ops || !ops->get_vsie)
+ return -1;
+
+ return ops->get_vsie(frame_id, vsie);
+}
+
+int wfd_oem_remove_vsie(wfd_oem_ops_s *ops, wfd_oem_vsie_frames_e frame_id,
+ const char *vsie)
+{
+ if (!ops || !ops->remove_vsie)
+ return -1;
+
+ return ops->remove_vsie(frame_id, vsie);
+}
+
#if defined TIZEN_ENABLE_PRD
int wfd_oem_prd_init(wfd_oem_ops_s *ops)
{
WFD_OEM_EVENT_MAX,
} wfd_oem_event_e;
+/**
+ * This enumeration is used in frame id value in vsie method calls
+ */
+typedef enum {
+ WFD_OEM_VSIE_FRAME_P2P_PROBE_REQ = 0,
+ WFD_OEM_VSIE_FRAME_P2P_PROBE_RESP = 1,
+ WFD_OEM_VSIE_FRAME_P2P_GO_PROBE_RESP = 2,
+ WFD_OEM_VSIE_FRAME_P2P_GO_BEACON = 3,
+ WFD_OEM_VSIE_FRAME_P2P_PD_REQ = 4,
+ WFD_OEM_VSIE_FRAME_P2P_PD_RESP = 5,
+ WFD_OEM_VSIE_FRAME_P2P_GO_NEG_REQ = 6,
+ WFD_OEM_VSIE_FRAME_P2P_GO_NEG_RESP = 7,
+ WFD_OEM_VSIE_FRAME_P2P_GO_NEG_CONF = 8,
+ WFD_OEM_VSIE_FRAME_P2P_INV_REQ = 9,
+ WFD_OEM_VSIE_FRAME_P2P_INV_RESP = 10,
+ WFD_OEM_VSIE_FRAME_P2P_ASSOC_REQ = 11,
+ WFD_OEM_VSIE_FRAME_P2P_ASSOC_RESP = 12,
+ WFD_OEM_VSIE_FRAME_ASSOC_REQ = 13,
+ WFD_OEM_VSIE_FRAME_MAX
+} wfd_oem_vsie_frames_e;
+
#ifdef TIZEN_FEATURE_WIFI_DISPLAY
typedef enum {
WFD_OEM_DISPLAY_TYPE_SOURCE,
int (*asp_prov_disc_req)(wfd_oem_asp_prov_s *params);
#endif /* TIZEN_FEATURE_ASP */
+ int (*add_vsie)(wfd_oem_vsie_frames_e frame_id, const char* vsie);
+ int (*get_vsie)(wfd_oem_vsie_frames_e frame_id, char **vsie);
+ int (*remove_vsie)(wfd_oem_vsie_frames_e frame_id, const char *vsie);
+
void *extra_data;
} wfd_oem_ops_s;
int wfd_oem_asp_prov_disc_req(wfd_oem_ops_s *ops, wfd_oem_asp_prov_s *params);
#endif /* TIZEN_FEATURE_ASP */
+int wfd_oem_add_vsie(wfd_oem_ops_s *ops, wfd_oem_vsie_frames_e frame_id,
+ const char* vsie);
+int wfd_oem_get_vsie(wfd_oem_ops_s *ops, wfd_oem_vsie_frames_e frame_id,
+ char **vsie);
+int wfd_oem_remove_vsie(wfd_oem_ops_s *ops, wfd_oem_vsie_frames_e frame_id,
+ const char *vsie);
+
#if defined TIZEN_ENABLE_PRD
typedef struct {
void (*prd_example_cb) (wfd_oem_event_s *event);
Name: wifi-direct-manager
Summary: Wi-Fi Direct manger
-Version: 1.2.221
+Version: 1.2.222
Release: 1
Group: Network & Connectivity/Wireless
License: Apache-2.0
int ws_asp_prov_disc_req(wfd_oem_asp_prov_s *asp_params);
#endif /* TIZEN_FEATURE_ASP */
+int ws_add_vsie(wfd_oem_vsie_frames_e frame_id, const char* vsie);
+int ws_get_vsie(wfd_oem_vsie_frames_e frame_id, char **vsie);
+int ws_remove_vsie(wfd_oem_vsie_frames_e frame_id, const char *vsie);
+
#endif /* __WFD_PLUGIN_WPASUPPLICANT_H__ */
#include "wifi-direct-oem.h"
#include "wfd-plugin-log.h"
-#include "wfd-plugin-wpasupplicant.h"
#include "dbus/wfd-plugin-supplicant-dbus.h"
+#include "wfd-plugin-wpasupplicant.h"
#if defined(TIZEN_FEATURE_ASP)
#define GLIST_ITER_START(arg_list, elem)\
.asp_prov_disc_req = ws_asp_prov_disc_req,
#endif /* TIZEN_FEATURE_ASP */
+ .add_vsie = ws_add_vsie,
+ .get_vsie = ws_get_vsie,
+ .remove_vsie = ws_remove_vsie,
+
.extra_data = NULL
};
return "";
}
}
+
+static int __ws_hex_char_to_num(char c)
+{
+ if (c >= '0' && c <= '9')
+ return c - '0';
+
+ if (c >= 'a' && c <= 'f')
+ return c - 'a' + 10;
+
+ if (c >= 'A' && c <= 'F')
+ return c - 'A' + 10;
+
+ return -1;
+}
+
+static int __ws_hex_to_byte(const char *hex)
+{
+ int a, b;
+
+ a = __ws_hex_char_to_num(*hex++);
+ if (a < 0)
+ return -1;
+
+ b = __ws_hex_char_to_num(*hex++);
+ if (b < 0)
+ return -1;
+
+ return (a << 4) | b;
+}
+
+static int __ws_hex_str_to_bin(const char *hex, unsigned char *buf, size_t len)
+{
+ size_t i;
+ int a;
+ const char *ipos = hex;
+ unsigned char *opos = buf;
+
+ for (i = 0; i < len; i++) {
+ a = __ws_hex_to_byte(ipos);
+ if (a < 0)
+ return -1;
+
+ *opos++ = a;
+ ipos += 2;
+ }
+
+ return 0;
+}
+
#ifdef TIZEN_FEATURE_SERVICE_DISCOVERY
static int __ws_byte_to_hex(char *buf, int buf_size, unsigned char *data, int data_len)
{
return res;
}
+static int __ws_byte_to_txt(const unsigned char *src, char **dst, int src_len)
+{
+ __WDP_LOG_FUNC_ENTER__;
+
+ int dst_length = 0;
+ int i = 0;
+ char *buf = NULL;
+
+ if (src_len <= 0) {
+ WDP_LOGE("Invalid parameter.");
+ __WDP_LOG_FUNC_EXIT__;
+ return -1;
+ }
+
+ *dst = (char *) g_try_malloc0((2*src_len)+1);
+ if (!(*dst)) {
+ WDP_LOGE("failed to allocate memory to buffer.");
+ __WDP_LOG_FUNC_EXIT__;
+ return -1;
+ }
+
+ buf = (*dst);
+
+ for (i = 0; i < src_len; i++) {
+ snprintf(buf, 3, "%02x", src[i]);
+ buf += 2;
+ dst_length += 2;
+ }
+
+ __WDP_LOG_FUNC_EXIT__;
+ return dst_length;
+}
+
+static int __ws_unpack_ay_malloc(unsigned char **dst, GVariantIter *iter)
+{
+ GVariantIter *iter_copy = NULL;
+ int length = 0;
+ char tmp = 0;
+ unsigned char *tmp_dst = NULL;
+
+ if (!dst || *dst || !iter) {
+ WDP_LOGE("Invalid parameter");
+ return 0;
+ }
+
+ iter_copy = g_variant_iter_copy(iter);
+
+ while (g_variant_iter_loop(iter, "y", &tmp))
+ length++;
+ g_variant_iter_free(iter);
+
+ tmp_dst = (unsigned char *)g_try_malloc0(length + 1);
+ if (!tmp_dst) {
+ WDP_LOGE("failed to allocate memory");
+ return 0;
+ }
+
+ length = 0;
+ while (g_variant_iter_loop(iter_copy, "y", &tmp_dst[length]))
+ length++;
+ g_variant_iter_free(iter_copy);
+
+ if (length == 0) {
+ g_free(tmp_dst);
+ tmp_dst = NULL;
+ } else {
+ tmp_dst[length] = '\0';
+ }
+
+ *dst = tmp_dst;
+ WDP_LOGD("Length [%d]", length);
+ return length;
+}
+
#ifdef TIZEN_FEATURE_WIFI_DISPLAY
static int __parsing_wfd_info(unsigned char *wfd_dev_info,
wfd_oem_display_s* display)
return res;
}
#endif /* TIZEN_FEATURE_ASP */
+
+int ws_add_vsie(wfd_oem_vsie_frames_e frame_id, const char* vsie)
+{
+ __WDP_LOG_FUNC_ENTER__;
+ GDBusConnection *g_dbus = NULL;
+ GVariant *value = NULL;
+ GVariantBuilder *bytearray_builder = NULL;
+ dbus_method_param_s params;
+ int res = 0;
+ int i = 0;
+ size_t vsie_len = 0;
+
+ unsigned char *bytearray = NULL;
+ size_t bytearray_len = 0;
+
+ if (frame_id < 0 || frame_id >= WFD_OEM_VSIE_FRAME_MAX ||
+ vsie == NULL) {
+ WDP_LOGE("Invalid parameter");
+ return -1;
+ }
+
+ if (!g_pd) {
+ WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
+ return -1;
+ }
+
+ g_dbus = g_pd->g_dbus;
+ if (!g_dbus) {
+ WDP_LOGE("DBus connection is NULL");
+ __WDP_LOG_FUNC_EXIT__;
+ return -1;
+ }
+
+ vsie_len = strlen(vsie);
+ if (vsie_len == 0) {
+ WDP_LOGE("vsie length is zero");
+ __WDP_LOG_FUNC_EXIT__;
+ return -1;
+ }
+
+ bytearray_len = (vsie_len % 2) ? ((vsie_len / 2) + 1) : (vsie_len / 2);
+
+ bytearray = (unsigned char *) g_try_malloc0(bytearray_len);
+ if (bytearray == NULL) {
+ WDP_LOGE("Failed to allocate memory to bytearray");
+ __WDP_LOG_FUNC_EXIT__;
+ return -1;
+ }
+
+ if (__ws_hex_str_to_bin(vsie, bytearray, bytearray_len) < 0) {
+ WDP_LOGE("invalid vsie string");
+ g_free(bytearray);
+ __WDP_LOG_FUNC_EXIT__;
+ return -1;
+ }
+
+ memset(¶ms, 0x0, sizeof(dbus_method_param_s));
+ dbus_set_method_param(¶ms, "VendorElemAdd", g_pd->iface_path,
+ g_dbus);
+
+ bytearray_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+ for (i = 0; i < bytearray_len; i++)
+ g_variant_builder_add(bytearray_builder, "y", bytearray[i]);
+
+ value = g_variant_new("(iay)", frame_id, bytearray_builder);
+ g_variant_builder_unref(bytearray_builder);
+
+ params.params = value;
+
+ res = dbus_method_call(¶ms, SUPPLICANT_IFACE, NULL, NULL);
+ if (res < 0) {
+ WDP_LOGE("Failed to send command to wpa_supplicant");
+ g_free(bytearray);
+ __WDP_LOG_FUNC_EXIT__;
+ return -1;
+ }
+
+ WDP_LOGD("Succeeded to add vsie: Frame ID [%d], VSIE [%s]", frame_id,
+ vsie);
+
+ g_free(bytearray);
+ __WDP_LOG_FUNC_EXIT__;
+ return 0;
+}
+
+int ws_get_vsie(wfd_oem_vsie_frames_e frame_id, char **vsie)
+{
+ __WDP_LOG_FUNC_ENTER__;
+ GDBusConnection *g_dbus = NULL;
+ GVariant *param = NULL;
+ GVariant *reply = NULL;
+ GError *error = NULL;
+
+ if (frame_id < 0 || frame_id >= WFD_OEM_VSIE_FRAME_MAX ||
+ vsie == NULL) {
+ WDP_LOGE("Invalid parameter");
+ __WDP_LOG_FUNC_EXIT__;
+ return -1;
+ }
+
+ if (!g_pd) {
+ WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
+ return -1;
+ }
+
+ g_dbus = g_pd->g_dbus;
+ if (!g_dbus) {
+ WDP_LOGE("DBus connection is NULL");
+ __WDP_LOG_FUNC_EXIT__;
+ return -1;
+ }
+
+ param = g_variant_new("(i)", frame_id);
+
+ reply = g_dbus_connection_call_sync(
+ g_pd->g_dbus,
+ SUPPLICANT_SERVICE, /* bus name */
+ g_pd->iface_path, /* object path */
+ SUPPLICANT_IFACE, /* interface name */
+ "VendorElemGet", /* method name */
+ param, /* GVariant *params */
+ NULL, /* reply_type */
+ G_DBUS_CALL_FLAGS_NONE, /* flags */
+ SUPPLICANT_TIMEOUT, /* timeout */
+ NULL, /* cancellable */
+ &error); /* error */
+
+ if (error != NULL) {
+ WDP_LOGE("Error! Failed to get vsie: [%s]", error->message);
+ g_error_free(error);
+ if (reply)
+ g_variant_unref(reply);
+ __WDP_LOG_FUNC_EXIT__;
+ return -1;
+ }
+
+ if (reply != NULL) {
+ DEBUG_G_VARIANT("Reply : ", reply);
+
+ GVariantIter *iter = NULL;
+ unsigned char *vsie_bytes = NULL;
+ int vsie_len = 0;
+
+ g_variant_get(reply, "(ay)", &iter);
+ if (iter == NULL) {
+ WDP_LOGD("vsie is not present");
+ __WDP_LOG_FUNC_EXIT__;
+ return -1;
+ }
+
+ vsie_len = __ws_unpack_ay_malloc(&vsie_bytes, iter);
+ if (vsie_bytes == NULL) {
+ WDP_LOGD("vsie_bytes not allocated");
+ __WDP_LOG_FUNC_EXIT__;
+ return -1;
+ }
+
+ __ws_byte_to_txt(vsie_bytes, vsie, vsie_len);
+ if (!vsie) {
+ g_free(vsie_bytes);
+ WDP_LOGE("vsie not allocated.");
+ __WDP_LOG_FUNC_EXIT__;
+ return -1;
+ }
+
+ g_free(vsie_bytes);
+ }
+
+ WDP_LOGD("Succeeded to get vsie: Frame ID [%d], VSIE [%s]", frame_id,
+ *vsie);
+ __WDP_LOG_FUNC_EXIT__;
+ return 0;
+}
+
+int ws_remove_vsie(wfd_oem_vsie_frames_e frame_id, const char *vsie)
+{
+ __WDP_LOG_FUNC_ENTER__;
+ GDBusConnection *g_dbus = NULL;
+ GVariantBuilder *bytearray_builder = NULL;
+ GVariant *value = NULL;
+ dbus_method_param_s params;
+ int res = 0;
+ int i = 0;
+ size_t vsie_len = 0;
+
+ unsigned char *bytearray = NULL;
+ size_t bytearray_len = 0;
+
+ if (frame_id < 0 || frame_id >= WFD_OEM_VSIE_FRAME_MAX ||
+ vsie == NULL) {
+ WDP_LOGE("Invalid parameter");
+ return -1;
+ }
+
+ if (!g_pd) {
+ WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
+ return -1;
+ }
+
+ g_dbus = g_pd->g_dbus;
+ if (!g_dbus) {
+ WDP_LOGE("DBus connection is NULL");
+ __WDP_LOG_FUNC_EXIT__;
+ return -1;
+ }
+
+ vsie_len = strlen(vsie);
+ if (vsie_len == 0) {
+ WDP_LOGE("vsie length is zero");
+ __WDP_LOG_FUNC_EXIT__;
+ return -1;
+ }
+
+ bytearray_len = (vsie_len % 2) ? ((vsie_len / 2) + 1) : (vsie_len / 2);
+
+ bytearray = (unsigned char *) g_try_malloc0(bytearray_len);
+ if (bytearray == NULL) {
+ WDP_LOGE("Failed to allocate memory to bytearray");
+ __WDP_LOG_FUNC_EXIT__;
+ return -1;
+ }
+
+ if (__ws_hex_str_to_bin(vsie, bytearray, bytearray_len) < 0) {
+ WDP_LOGE("invalid vsie string");
+ g_free(bytearray);
+ __WDP_LOG_FUNC_EXIT__;
+ return -1;
+ }
+
+ memset(¶ms, 0x0, sizeof(dbus_method_param_s));
+ dbus_set_method_param(¶ms, "VendorElemRem", g_pd->iface_path,
+ g_dbus);
+
+ bytearray_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+ for (i = 0; i < bytearray_len; i++)
+ g_variant_builder_add(bytearray_builder, "y", bytearray[i]);
+
+ value = g_variant_new("(iay)", frame_id, bytearray_builder);
+ g_variant_builder_unref(bytearray_builder);
+
+ params.params = value;
+
+ res = dbus_method_call(¶ms, SUPPLICANT_IFACE, NULL, NULL);
+ if (res < 0) {
+ WDP_LOGE("Failed to send command to wpa_supplicant");
+ g_free(bytearray);
+ __WDP_LOG_FUNC_EXIT__;
+ return -1;
+ }
+
+ WDP_LOGD("Succeeded to remove vsie: Frame ID [%d], VSIE [%s]", frame_id,
+ vsie);
+ g_free(bytearray);
+ __WDP_LOG_FUNC_EXIT__;
+ return 0;
+}
int ws_cancel_seek_service(wfd_oem_asp_service_s *service);
int ws_asp_prov_disc_req(wfd_oem_asp_prov_s *asp_params);
#endif /* TIZEN_FEATURE_ASP */
+
+int ws_add_vsie(wfd_oem_vsie_frames_e frame_id, const char* vsie);
+int ws_get_vsie(wfd_oem_vsie_frames_e frame_id, char **vsie);
+int ws_remove_vsie(wfd_oem_vsie_frames_e frame_id, const char *vsie);
+
#endif /* __WFD_PLUGIN_WPASUPPLICANT_H__ */
.cancel_seek_service = ws_cancel_seek_service,
.asp_prov_disc_req = ws_asp_prov_disc_req,
#endif /* TIZEN_FEATURE_ASP */
+
+ .add_vsie = ws_add_vsie,
+ .get_vsie = ws_get_vsie,
+ .remove_vsie = ws_remove_vsie,
+
};
static ws_plugin_data_s *g_pd;
return -1;
}
#endif /* TIZEN_FEATURE_ASP */
+
+int ws_add_vsie(wfd_oem_vsie_frames_e frame_id, const char* vsie)
+{
+ __WDP_LOG_FUNC_ENTER__;
+
+ __WDP_LOG_FUNC_EXIT__;
+ return 0;
+}
+
+int ws_get_vsie(wfd_oem_vsie_frames_e frame_id, char **vsie)
+{
+ __WDP_LOG_FUNC_ENTER__;
+
+ __WDP_LOG_FUNC_EXIT__;
+ return 0;
+}
+
+int ws_remove_vsie(wfd_oem_vsie_frames_e frame_id, const char *vsie)
+{
+ __WDP_LOG_FUNC_ENTER__;
+
+ __WDP_LOG_FUNC_EXIT__;
+ return 0;
+}
int ws_cancel_seek_service(wfd_oem_asp_service_s *service);
int ws_asp_prov_disc_req(wfd_oem_asp_prov_s *asp_params);
#endif /* TIZEN_FEATURE_ASP */
+
+int ws_add_vsie(wfd_oem_vsie_frames_e frame_id, const char* vsie);
+int ws_get_vsie(wfd_oem_vsie_frames_e frame_id, char **vsie);
+int ws_remove_vsie(wfd_oem_vsie_frames_e frame_id, const char *vsie);
+
#endif /* __WFD_PLUGIN_WPASUPPLICANT_H__ */
.cancel_seek_service = ws_cancel_seek_service,
.asp_prov_disc_req = ws_asp_prov_disc_req,
#endif /* TIZEN_FEATURE_ASP */
+
+ .add_vsie = ws_add_vsie,
+ .get_vsie = ws_get_vsie,
+ .remove_vsie = ws_remove_vsie,
+
};
int wfd_plugin_load(wfd_oem_ops_s **ops)
return -1;
}
#endif /* TIZEN_FEATURE_ASP */
+
+int ws_add_vsie(wfd_oem_vsie_frames_e frame_id, const char* vsie)
+{
+ __WDP_LOG_FUNC_ENTER__;
+
+ __WDP_LOG_FUNC_EXIT__;
+ return -1;
+}
+
+int ws_get_vsie(wfd_oem_vsie_frames_e frame_id, char **vsie)
+{
+ __WDP_LOG_FUNC_ENTER__;
+
+ __WDP_LOG_FUNC_EXIT__;
+ return -1;
+}
+
+int ws_remove_vsie(wfd_oem_vsie_frames_e frame_id, const char *vsie)
+{
+ __WDP_LOG_FUNC_ENTER__;
+
+ __WDP_LOG_FUNC_EXIT__;
+ return -1;
+}
"<arg type='i' name='error_code' direction='out'/>"
"<arg type='aa{sv}' name='peer_details_list' direction='out'/>"
"</method>"
+ "<method name='GetConnectingPeer'>"
+ "<arg type='i' name='error_code' direction='out'/>"
+ "<arg type='a{sv}' name='peer_details' direction='out'/>"
+ "</method>"
"<method name='IsDiscoverable'>"
"<arg type='b' name='result' direction='out'/>"
"</method>"
"<arg type='i' name='error_code' direction='out'/>"
"<arg type='i' name='rssi' direction='out'/>"
"</method>"
+ "<method name='AddVsie'>"
+ "<arg type='i' name='frame_id' direction='in'/>"
+ "<arg type='s' name='vsie' direction='in'/>"
+ "<arg type='i' name='error_code' direction='out'/>"
+ "</method>"
+ "<method name='GetVsie'>"
+ "<arg type='i' name='frame_id' direction='in'/>"
+ "<arg type='i' name='error_code' direction='out'/>"
+ "<arg type='s' name='vsie' direction='out'/>"
+ "</method>"
+ "<method name='RemoveVsie'>"
+ "<arg type='i' name='frame_id' direction='in'/>"
+ "<arg type='s' name='vsie' direction='in'/>"
+ "<arg type='i' name='error_code' direction='out'/>"
+ "</method>"
"</interface>"
#ifdef TIZEN_FEATURE_SERVICE_DISCOVERY
"<interface name='net.wifidirect.service'>"
} else if (!g_strcmp0(method_name, "StartDiscovery")) {
gboolean mode = FALSE;
gint32 timeout = 0;
- guint32 channel = 0;
+ gint32 channel = 0;
+ gint32 frequency = 0;
const gchar *type = NULL;
GVariantIter *iter = NULL;
gchar *key = NULL;
g_variant_get(var, "&s", &type);
else if (!g_strcmp0(key, "Channel"))
g_variant_get(var, "i", &channel);
+ else if (!g_strcmp0(key, "Frequency"))
+ g_variant_get(var, "i", &frequency);
else
;/* Do Nothing */
}
WFD_DBUS_REPLY_ERROR_NONE(invocation);
- ret = wfd_manager_start_discovery(manager, mode, timeout, type, channel);
+ ret = wfd_manager_start_discovery(manager, mode, timeout, type,
+ channel, frequency);
if (ret == WIFI_DIRECT_ERROR_NONE) {
if (mode == WFD_OEM_SCAN_MODE_PASSIVE) {
wfd_manager_dbus_emit_signal(WFD_MANAGER_MANAGE_INTERFACE,
g_variant_builder_unref(builder_peers);
goto done;
+ } else if (!g_strcmp0(method_name, "GetConnectingPeer")) {
+ wfd_session_s *session;
+ wfd_device_s *peer = NULL;
+ wfd_discovery_entry_s *connecting_peer = NULL;
+ GVariantBuilder *builder_peer = NULL;
+
+ if (!manager->session ||
+ manager->state != WIFI_DIRECT_STATE_CONNECTING) {
+ ret = WIFI_DIRECT_ERROR_NOT_PERMITTED;
+ goto failed;
+ }
+
+ session = manager->session;
+ if (!session->peer) {
+ ret = WIFI_DIRECT_ERROR_OPERATION_FAILED;
+ goto failed;
+ }
+ peer = session->peer;
+
+ connecting_peer = (wfd_discovery_entry_s *)
+ g_try_malloc0(sizeof(wfd_discovery_entry_s));
+ if (!connecting_peer) {
+ WDS_LOGF("Failed to allocate memory for peer data.");
+ ret = WIFI_DIRECT_ERROR_OUT_OF_MEMORY;
+ goto failed;
+ }
+
+ builder_peer = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
+
+ g_variant_builder_add(builder_peer, "{sv}",
+ "DeviceName",
+ g_variant_new_string(peer->dev_name));
+ g_variant_builder_add(builder_peer, "{sv}",
+ "DeviceAddress",
+ wfd_manager_dbus_pack_ay(peer->dev_addr,
+ MACADDR_LEN));
+ g_variant_builder_add(builder_peer, "{sv}",
+ "InterfaceAddress",
+ wfd_manager_dbus_pack_ay(peer->intf_addr,
+ MACADDR_LEN));
+ g_variant_builder_add(builder_peer, "{sv}",
+ "Channel",
+ g_variant_new_uint16(peer->channel));
+ g_variant_builder_add(builder_peer, "{sv}",
+ "IsConnected",
+ g_variant_new_boolean(peer->dev_role == WFD_DEV_ROLE_GC));
+ g_variant_builder_add(builder_peer, "{sv}",
+ "IsGroupOwner",
+ g_variant_new_boolean(peer->dev_role == WFD_OEM_DEV_ROLE_GO));
+ g_variant_builder_add(builder_peer, "{sv}",
+ "IsPersistentGO",
+ g_variant_new_boolean(peer->group_flags & WFD_OEM_GROUP_FLAG_PERSISTENT_GROUP));
+ g_variant_builder_add(builder_peer, "{sv}",
+ "Category",
+ g_variant_new_uint16(peer->pri_dev_type));
+ g_variant_builder_add(builder_peer, "{sv}",
+ "SubCategory",
+ g_variant_new_uint16(peer->sec_dev_type));
+ g_variant_builder_add(builder_peer, "{sv}",
+ "WpsCfgMethods",
+ g_variant_new_uint16(peer->config_methods));
+#ifdef TIZEN_FEATURE_WIFI_DISPLAY
+ g_variant_builder_add(builder_peer, "{sv}",
+ "IsWfdDevice",
+ g_variant_new_boolean(false));
+#endif /* TIZEN_FEATURE_WIFI_DISPLAY */
+
+ ret = WIFI_DIRECT_ERROR_NONE;
+ return_parameters = g_variant_new("(ia{sv})", ret,
+ builder_peer);
+ g_variant_builder_unref(builder_peer);
+ g_free(connecting_peer);
+ goto done;
+
} else if (!g_strcmp0(method_name, "IsDiscoverable")) {
ret = WIFI_DIRECT_ERROR_NONE;
return_parameters = g_variant_new("(b)",
return_parameters = g_variant_new("(ii)", ret, peer->rssi);
goto done;
+ } else if (!g_strcmp0(method_name, "AddVsie")) {
+ const char *vsie = NULL;
+ int frame_id = 0;
+
+ g_variant_get(parameters, "(i&s)", &frame_id, &vsie);
+
+ if (manager->state < WIFI_DIRECT_STATE_ACTIVATED) {
+ ret = WIFI_DIRECT_ERROR_NOT_PERMITTED;
+ goto failed;
+ }
+
+ if (wfd_oem_add_vsie(manager->oem_ops, frame_id, vsie) < 0) {
+ WDS_LOGE("Failed to add vsie");
+ ret = WIFI_DIRECT_ERROR_OPERATION_FAILED;
+ goto failed;
+ }
+
+ ret = WIFI_DIRECT_ERROR_NONE;
+ return_parameters = g_variant_new("(i)", ret);
+ goto done;
+
+ } else if (!g_strcmp0(method_name, "GetVsie")) {
+ char *vsie = NULL;
+ int frame_id = 0;
+
+ g_variant_get(parameters, "(i)", &frame_id);
+
+ if (manager->state < WIFI_DIRECT_STATE_ACTIVATED) {
+ ret = WIFI_DIRECT_ERROR_NOT_PERMITTED;
+ goto failed;
+ }
+
+ if (wfd_oem_get_vsie(manager->oem_ops, frame_id, &vsie) < 0) {
+ WDS_LOGE("Failed to get vsie");
+ ret = WIFI_DIRECT_ERROR_OPERATION_FAILED;
+ goto failed;
+ }
+
+ WDS_LOGD("Received VSIE [%s]", vsie);
+
+ ret = WIFI_DIRECT_ERROR_NONE;
+ return_parameters = g_variant_new("(is)", ret, vsie);
+
+ g_free(vsie);
+ goto done;
+
+ } else if (!g_strcmp0(method_name, "RemoveVsie")) {
+ const char *vsie = NULL;
+ int frame_id = 0;
+
+ g_variant_get(parameters, "(i&s)", &frame_id, &vsie);
+
+ if (manager->state < WIFI_DIRECT_STATE_ACTIVATED) {
+ ret = WIFI_DIRECT_ERROR_NOT_PERMITTED;
+ goto failed;
+ }
+
+ if (wfd_oem_remove_vsie(manager->oem_ops, frame_id, vsie) < 0) {
+ WDS_LOGE("Failed to remove vsie");
+ ret = WIFI_DIRECT_ERROR_OPERATION_FAILED;
+ goto failed;
+ }
+
+ ret = WIFI_DIRECT_ERROR_NONE;
+ return_parameters = g_variant_new("(i)", ret);
+ goto done;
+
} else {
WDS_LOGE("method not handled");
ret = WIFI_DIRECT_ERROR_OPERATION_FAILED;
goto done;
}
- ret = wfd_manager_start_discovery(manager, WFD_OEM_SCAN_MODE_PASSIVE, 0, 0, 0);
+ ret = wfd_manager_start_discovery(manager,
+ WFD_OEM_SCAN_MODE_PASSIVE, 0,
+ 0, 0, 0);
if (ret == WIFI_DIRECT_ERROR_NONE) {
wfd_manager_dbus_emit_signal(WFD_MANAGER_MANAGE_INTERFACE,
"ListenStarted",
WDS_LOGD("search_id [%x]", service.search_id);
- ret = wfd_manager_start_discovery(manager, WFD_OEM_SCAN_MODE_ACTIVE, 0, 0, 0);
+ ret = wfd_manager_start_discovery(manager,
+ WFD_OEM_SCAN_MODE_ACTIVE, 0,
+ 0, 0, 0);
if (ret == WIFI_DIRECT_ERROR_NONE) {
wfd_manager_dbus_emit_signal(WFD_MANAGER_MANAGE_INTERFACE,
"DiscoveryStarted",
#endif /* TIZEN_FEATURE_WIFI_DISPLAY */
int wfd_manager_start_discovery(wfd_manager_s *manager, int mode, int timeout,
- const char* type, int channel)
+ const char* type, int channel, int frequency)
{
__WDS_LOG_FUNC_ENTER__;
int res = WIFI_DIRECT_ERROR_OPERATION_FAILED;
wfd_oem_scan_param_s param;
memset(¶m, 0x0, sizeof(wfd_oem_scan_param_s));
- WDS_LOGI("Mode: [%d], Timeout: [%d], type: [%s], channel: [%d]", mode, timeout, type, channel);
+ WDS_LOGI("Mode [%d], Timeout [%d], type [%s], channel [%d], frequency [%d]",
+ mode, timeout, type, channel, frequency);
if (manager->local->dev_role == WFD_DEV_ROLE_GO)
param.scan_type = WFD_OEM_SCAN_TYPE_SOCIAL;
- if (channel == WFD_DISCOVERY_FULL_SCAN) {
+ switch (channel) {
+ case WFD_DISCOVERY_FULL_SCAN:
param.scan_type = WFD_OEM_SCAN_TYPE_FULL;
- } else if (channel == WFD_DISCOVERY_SOCIAL_CHANNEL) {
+ break;
+ case WFD_DISCOVERY_SOCIAL_CHANNEL:
param.scan_type = WFD_OEM_SCAN_TYPE_SOCIAL;
- } else if (channel == WFD_DISCOVERY_CHANNEL1) {
+ break;
+ case WFD_DISCOVERY_CHANNEL1:
param.scan_type = WFD_OEM_SCAN_TYPE_CHANNEL1;
param.freq = 2412;
- } else if (channel == WFD_DISCOVERY_CHANNEL6) {
+ break;
+ case WFD_DISCOVERY_CHANNEL6:
param.scan_type = WFD_OEM_SCAN_TYPE_CHANNEL6;
param.freq = 2437;
- } else if (channel == WFD_DISCOVERY_CHANNEL11) {
+ break;
+ case WFD_DISCOVERY_CHANNEL11:
param.scan_type = WFD_OEM_SCAN_TYPE_CHANNEL11;
param.freq = 2462;
- } else {
+ break;
+ default:
param.scan_type = WFD_OEM_SCAN_TYPE_SPECIFIC;
- param.freq = wfd_util_channel_to_freq(channel);
+ if (frequency > 0)
+ param.freq = frequency;
+ else
+ param.freq = wfd_util_channel_to_freq(channel);
}
if (mode)