static struct netconfig_headed_plugin_t *headed_plugin;
static struct netconfig_telephony_plugin_t *telephony_plugin;
+static bool is_feature_checked[NETCONFIG_SUPPORTED_FEATURE_MAX] = {0, };
+static bool feature_supported[NETCONFIG_SUPPORTED_FEATURE_MAX] = {0, };
+
gboolean netconfig_check_passphrase(const gchar *service, const char *passphrase)
{
gsize length;
gboolean netconfig_is_wifi_direct_on(void)
{
- if (!netconfig_check_feature_supported(WIFI_DIRECT_FEATURE))
+ if (!netconfig_check_feature_supported(NETCONFIG_SUPPORTED_FEATURE_WIFI_DIRECT))
return FALSE;
int wifi_direct_state = 0;
gboolean netconfig_is_wifi_tethering_on(void)
{
- if (netconfig_check_feature_supported(TETHERING_FEATURE)) {
+ if (netconfig_check_feature_supported(NETCONFIG_SUPPORTED_FEATURE_TETHERING)) {
int wifi_tethering_state = 0;
netconfig_vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_MODE, &wifi_tethering_state);
struct sigaction act;
int state = 0;
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
act.sa_handler = no_wait_signal_handler;
sigemptyset(&act.sa_mask);
errno = 0;
if (execvp(file_path, args) == -1) {
- ERR("Fail to execute command (%s)", strerror(errno));
+ ERR("Fail to execute command (%s)",
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER));
return -1;
}
} else if (pid > 0) {
return rv;
}
- DBG("failed to fork(%s)", strerror(errno));
+ DBG("failed to fork(%s)",
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER));
return -EIO;
}
gboolean handle_launch_direct(Wifi *wifi, GDBusMethodInvocation *context)
{
- if (!netconfig_check_feature_supported(WIFI_DIRECT_FEATURE)) {
+ if (!netconfig_check_feature_supported(NETCONFIG_SUPPORTED_FEATURE_WIFI_DIRECT)) {
wifi_complete_launch_direct(wifi, context);
- return FALSE;
+ return TRUE;
}
int ret = 0;
if (ret < 0) {
ERR("Failed to launch Wi-Fi direct daemon");
netconfig_error_wifi_direct_failed(context);
- return FALSE;
+ return TRUE;
}
wifi_complete_launch_direct(wifi, context);
if (execute_mdnsd_script("start") < 0) {
ERR("Failed to launch mdnsresponder daemon");
netconfig_error_invalid_parameter(context);
- return FALSE;
+ return TRUE;
}
mdnsd_ref_count++;
return profile;
}
-bool netconfig_check_feature_supported(const char *feature)
-{
- bool is_supported = false;
-
- if (!system_info_get_platform_bool(feature, &is_supported)) {
- if (is_supported != TRUE)
- DBG("%s is not supported", feature);
- else
- DBG("%s is supported", feature);
- } else {
- ERR("Error - Feature getting from System Info");
- }
-
- return is_supported;
-}
-
void netconfig_plugin_init()
{
handle_headed = dlopen(HEADED_PLUGIN_FILEPATH, RTLD_NOW);
return netconfig_plugin_telephony_enabled;
}
+bool netconfig_check_feature_supported(netconfig_supported_feature_e feature)
+{
+ const char *key = NULL;
+
+ if (!is_feature_checked[feature]) {
+ switch (feature) {
+ case NETCONFIG_SUPPORTED_FEATURE_ETHERNET:
+ key = ETHERNET_FEATURE;
+ break;
+ case NETCONFIG_SUPPORTED_FEATURE_TETHERING:
+ key = TETHERING_FEATURE;
+ break;
+ case NETCONFIG_SUPPORTED_FEATURE_WIFI_DIRECT:
+ key = WIFI_DIRECT_FEATURE;
+ break;
+ case NETCONFIG_SUPPORTED_FEATURE_WIFI_SOFTAP:
+ key = WIFI_SOFTAP_FEATURE;
+ break;
+ default:
+ ERR("Uknown feature");
+ return false;
+ }
+
+ if (system_info_get_platform_bool(key, &feature_supported[feature]) < 0) {
+ ERR("Get feature is failed");
+ return false;
+ }
+ is_feature_checked[feature] = true;
+ }
+ return feature_supported[feature];
+}