#endif /* TIZEN_FEATURE_SERVICE_DISCOVERY */
static gboolean ws_event_handler(GIOChannel *source,
- GIOCondition condition,
- gpointer data);
+ GIOCondition condition,
+ gpointer data);
int wfd_plugin_load(wfd_oem_ops_s **ops)
{
GIOChannel *gio;
int gsource = 0;
gio = g_io_channel_unix_new(mon_sock);
- if (!strstr(ifname, GROUP_IFACE_PREFIX))
- gsource = g_io_add_watch(gio, G_IO_IN | G_IO_ERR | G_IO_HUP, (GIOFunc) ws_event_handler, sock);
+ gsource = g_io_add_watch(gio, G_IO_IN | G_IO_ERR | G_IO_HUP,
+ (GIOFunc) ws_event_handler, sock);
g_io_channel_unref(gio);
sock->gsource = gsource;
/* parsing event string */
for (i = 0; ws_event_strs[i].index < WS_EVENT_LIMIT; i++) {
- if (!strncmp(ws_event_strs[i].string, msg, strlen(ws_event_strs[i].string)))
+ if (!strncmp(ws_event_strs[i].string, msg,
+ strlen(ws_event_strs[i].string)))
break;
}
}
static gboolean ws_event_handler(GIOChannel *source,
- GIOCondition condition,
- gpointer data)
+ GIOCondition condition,
+ gpointer data)
{
__WDP_LOG_FUNC_ENTER__;
ws_sock_data_s * sd = (ws_sock_data_s*) data;
break;
case WS_EVENT_GROUP_STARTED:
event_id = WFD_OEM_EVENT_GROUP_CREATED;
- res = _connect_to_supplicant(GROUP_IFACE_NAME, &g_pd->group);
- if (res < 0) {
- WDP_LOGE("Failed to connect to group interface of supplicant");
- /* goto done; */
+ if (!g_strcmp0(GROUP_IFACE_NAME, COMMON_IFACE_NAME)) {
+ g_pd->group = g_pd->common;
+ } else {
+ res = _connect_to_supplicant(GROUP_IFACE_NAME,
+ &g_pd->group);
+ if (res < 0) {
+ WDP_LOGE("Failed to connect to group interface of supplicant");
+ /* goto done; */
+ }
}
break;
case WS_EVENT_GROUP_REMOVED:
event_id = WFD_OEM_EVENT_GROUP_DESTROYED;
- if (g_pd->group) {
- res = _disconnect_from_supplicant(GROUP_IFACE_NAME, g_pd->group);
- if (res < 0) {
- WDP_LOGE("Failed to disconnect from group interface of supplicant");
- /* goto done; */
- }
+ if (!g_strcmp0(GROUP_IFACE_NAME, COMMON_IFACE_NAME)) {
g_pd->group = NULL;
_ws_flush();
+ } else {
+ if (g_pd->group) {
+ res = _disconnect_from_supplicant(GROUP_IFACE_NAME,
+ g_pd->group);
+ if (res < 0) {
+ WDP_LOGE("Failed to disconnect from group interface of supplicant");
+ /* goto done; */
+ }
+ g_pd->group = NULL;
+ _ws_flush();
+ }
}
break;
case WS_EVENT_INVITATION_RECEIVED:
g_pd->concurrent = concurrent;
- if (g_pd->group) {
- _disconnect_from_supplicant(GROUP_IFACE_NAME, g_pd->group);
- g_pd->group = NULL;
+ if (g_strcmp0(GROUP_IFACE_NAME, COMMON_IFACE_NAME)) {
+ if (g_pd->group) {
+ _disconnect_from_supplicant(GROUP_IFACE_NAME,
+ g_pd->group);
+ g_pd->group = NULL;
+ }
}
/* terminate wpasupplicant */
return -1;
}
+ g_snprintf(cmd, sizeof(cmd), WS_CMD_P2P_GROUP_ADD);
+
if (param->persistent) {
if (param->persistent == 2)
- snprintf(cmd, sizeof(cmd), WS_CMD_P2P_GROUP_ADD WS_STR_PERSISTENT "=%d",
+ g_snprintf(cmd, sizeof(cmd), WS_STR_PERSISTENT "=%d",
param->persistent_group_id);
else
- snprintf(cmd, sizeof(cmd), WS_CMD_P2P_GROUP_ADD WS_STR_PERSISTENT);
+ g_snprintf(cmd, sizeof(cmd), WS_STR_PERSISTENT);
}
if (param->freq > 0) {
res = _ws_send_cmd(sock->ctrl_sock, cmd, reply, sizeof(reply));
if (res < 0) {
- WDP_LOGE("Failed to send command to wpa_supplicant");
- __WDP_LOG_FUNC_EXIT__;
- return -1;
+ WDP_LOGE("Failed to send command to wpa_supplicant");
+ __WDP_LOG_FUNC_EXIT__;
+ return -1;
}
if (strstr(reply, "FAIL")) {