int (*refresh) (void);
int (*save_config) (void);
+ int (*set_operating_channel)(int channel);
} wfd_oem_ops_s;
int ws_refresh();
int ws_save_config(void);
+int ws_set_operating_channel(int channel);
#endif /* __WFD_PLUGIN_WPASUPPLICANT_H__ */
.refresh = ws_refresh,
.save_config = ws_save_config,
+ .set_operating_channel = ws_set_operating_channel,
};
return res;
}
+int ws_set_operating_channel(int channel)
+{
+ __WDP_LOG_FUNC_ENTER__;
+ GDBusConnection *g_dbus = NULL;
+ GVariant *value = NULL;
+ GVariant *param = NULL;
+ GVariantBuilder *builder = NULL;
+ dbus_method_param_s params;
+ int res = 0;
+
+ g_dbus = g_pd->g_dbus;
+ if (!g_dbus) {
+ WDP_LOGE("DBus connection is NULL");
+ __WDP_LOG_FUNC_EXIT__;
+ return -1;
+ }
+
+ memset(¶ms, 0x0, sizeof(dbus_method_param_s));
+
+ dbus_set_method_param(¶ms, DBUS_PROPERTIES_METHOD_SET, g_pd->iface_path, g_dbus);
+
+ builder = g_variant_builder_new (G_VARIANT_TYPE ("a{sv}"));
+ g_variant_builder_add (builder, "{sv}", "OperChannel", g_variant_new_uint32(channel));
+ value = g_variant_new ("a{sv}", builder);
+ g_variant_builder_unref (builder);
+
+ param = g_variant_new("(ssv)", SUPPLICANT_P2PDEVICE, "P2PDeviceConfig", value);
+ params.params = param;
+
+ res = dbus_method_call(¶ms, DBUS_PROPERTIES_INTERFACE, NULL, NULL);
+ if (res < 0)
+ WDP_LOGE("Failed to send command to wpa_supplicant");
+ else
+ WDP_LOGD("Succeeded to set Operating Channel");
+
+ __WDP_LOG_FUNC_EXIT__;
+ return res;
+}
+
int ws_refresh();
int ws_save_config(void);
+int ws_set_operating_channel(int channel);
#endif /* __WFD_PLUGIN_WPASUPPLICANT_H__ */
.refresh = ws_refresh,
.save_config = ws_save_config,
+ .set_operating_channel = ws_set_operating_channel,
};
return 0;
}
+int ws_set_operating_channel(int channel)
+{
+ __WDP_LOG_FUNC_ENTER__;
+
+ char cmd[80] = {0, };
+ char reply[WS_REPLY_LEN] = {0, };
+ int res = 0;
+ ws_sock_data_s *sock = g_pd->common;
+
+ if (!sock) {
+ WDP_LOGE("Socket is NULL");
+ return -1;
+ }
+
+ snprintf(cmd, sizeof(cmd), WS_CMD_SET "p2p_oper_channel %d", channel);
+
+ 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;
+ }
+
+ if (strstr(reply, "FAIL")) {
+ WDP_LOGE("Failed to set Operating channel");
+ __WDP_LOG_FUNC_EXIT__;
+ return -1;
+ }
+
+ WDP_LOGD("Succeeded to set P2P Operating Channel");
+ __WDP_LOG_FUNC_EXIT__;
+ return 0;
+}
int ws_refresh();
int ws_save_config(void);
+int ws_set_operating_channel(int channel);
#endif /* __WFD_PLUGIN_WPASUPPLICANT_H__ */
.set_display = ws_set_display,
#endif /* TIZEN_FEATURE_WIFI_DISPLAY */
.save_config = ws_save_config,
+ .set_operating_channel = ws_set_operating_channel,
};
return -1;
}
+#endif /* TIZEN_FEATURE_WIFI_DISPLAY */
+
int ws_save_config(void)
{
__WDP_LOG_FUNC_ENTER__;
return -1;
}
-#endif /* TIZEN_FEATURE_WIFI_DISPLAY */
+int ws_set_operating_channel(int channel)
+{
+ __WDP_LOG_FUNC_ENTER__;
+
+ __WDP_LOG_FUNC_EXIT__;
+ return -1;
+}
+