PROJECT(wfd-manager C)
INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED capi-network-wifi-direct glib-2.0 gio-2.0 gobject-2.0 dlog libnl-2.0 capi-appfw-application vconf aul libsystemd-login libtzplatform-config ${MDM_REQUIRED_PKGS})
+pkg_check_modules(pkgs REQUIRED capi-network-wifi-direct glib-2.0 gio-2.0 gobject-2.0 dlog libnl-2.0 capi-appfw-application vconf aul libsystemd-login capi-system-info libtzplatform-config ${MDM_REQUIRED_PKGS})
FOREACH(flag ${pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
#ifndef __WIFI_DIRECT_UTIL_H__
#define __WIFI_DIRECT_UTIL_H__
-
+#define TETHERING_WIFI_DIRECT_FEATURE "http://tizen.org/feature/network.tethering.wifi.direct"
#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
#define IP2STR(a) (a)[0], (a)[1], (a)[2], (a)[3]
int wfd_util_set_country();
int wfd_util_check_wifi_state();
+int wfd_util_check_p2p_hotspot_state(void);
int wfd_util_check_mobile_ap_state();
int wfd_util_wifi_direct_activatable();
#if 0
Name: wifi-direct-manager
Summary: Wi-Fi Direct manger
-Version: 1.2.222
+Version: 1.2.223
Release: 1
Group: Network & Connectivity/Wireless
License: Apache-2.0
BuildRequires: pkgconfig(libnl-2.0)
BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(aul)
+BuildRequires: pkgconfig(capi-system-info)
BuildRequires: pkgconfig(capi-appfw-application)
BuildRequires: pkgconfig(libsystemd-login)
#endif/* TIZEN_FEATURE_WIFI_DIRECT_ON_DEMAND */
} else if (!g_strcmp0(method_name, "Deactivate")) {
+ ret = wfd_util_check_p2p_hotspot_state();
+ if (ret > 0) {
+ ret = WIFI_DIRECT_ERROR_NOT_PERMITTED;
+ goto failed;
+ }
+
if (manager->state < WIFI_DIRECT_STATE_ACTIVATED) {
WDS_LOGE("Already deactivated");
ret = WIFI_DIRECT_ERROR_NOT_PERMITTED;
goto failed;
}
+ ret = wfd_util_check_p2p_hotspot_state();
+ if (ret > 0) {
+ ret = WIFI_DIRECT_ERROR_NOT_PERMITTED;
+ goto failed;
+ }
+
if (group->pending == FALSE) {
ret = wfd_oem_destroy_group(manager->oem_ops, group->ifname);
if (ret < 0) {
#include <vconf.h>
#include <tzplatform_config.h>
+#include <system_info.h>
#if defined(TIZEN_FEATURE_DEFAULT_CONNECTION_AGENT)
#include <systemd/sd-login.h>
#include <aul.h>
return 0;
}
+static void __check_feature_supported(const char *key,
+ bool *feature_supported)
+{
+ if (system_info_get_platform_bool(key, feature_supported) < 0) {
+ WDS_LOGE("system-info failed to get feature supported flag");
+ return;
+ }
+}
+
+int wfd_util_check_p2p_hotspot_state(void)
+{
+ __WDS_LOG_FUNC_ENTER__;
+ int hotspot_state = 0;
+ int res = 0;
+ bool supported = false;
+
+ __check_feature_supported(TETHERING_WIFI_DIRECT_FEATURE, &supported);
+ if (!supported) {
+ __WDS_LOG_FUNC_EXIT__;
+ return -1;
+ }
+
+ res = vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_MODE, &hotspot_state);
+ if (res < 0) {
+ WDS_LOGE("Failed to get vconf value[%s]", VCONFKEY_MOBILE_HOTSPOT_MODE);
+ __WDS_LOG_FUNC_EXIT__;
+ return -1;
+ }
+
+ if (hotspot_state & VCONFKEY_MOBILE_HOTSPOT_MODE_P2P) {
+ WDS_LOGD("P2P Hotspot is on");
+ __WDS_LOG_FUNC_EXIT__;
+ return 1;
+ }
+
+ WDS_LOGD("P2P Hotspot is off");
+ __WDS_LOG_FUNC_EXIT__;
+ return 0;
+}
+
int wfd_util_wifi_direct_activatable()
{
__WDS_LOG_FUNC_ENTER__;