SET(CAPI_LIB "capi-network-softap")
SET(TC_SOURCES
utc-network-softap.c
+ utc-network-softap-utils.c
)
PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED
ELSE()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g -fPIE -Wall")
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib -pie")
-ENDIF()
\ No newline at end of file
+ENDIF()
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "utc-network-softap-utils.h"
+
+#include <system_info.h>
+
+#define SYSTEM_INFO_FEATURE_PROFILE "http://tizen.org/feature/profile"
+
+int softap_utils_check_profile(const char *profile)
+{
+ int check = 0;
+ char *current_profile = NULL;
+ int ret = system_info_get_platform_string(SYSTEM_INFO_FEATURE_PROFILE, ¤t_profile);
+ if (ret == SYSTEM_INFO_ERROR_NONE && profile && current_profile) {
+ if (!strncmp(profile, current_profile, strlen(profile)))
+ check = 1;
+ }
+
+ if (current_profile)
+ free(current_profile);
+
+ return check;
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __UTC_SOFTAP_UTILS_H__
+#define __UTC_SOFTAP_UTILS_H__
+
+#define MOBILE_PROFILE "mobile"
+
+int softap_utils_check_profile(const char *profile);
+
+#endif // __UTC_SOFTAP_UTILS_H__
#include "assert.h"
+#include "utc-network-softap-utils.h"
+
#include <softap.h>
#include <glib.h>
#include <time.h>
return 0;
}
-#if defined(MOBILE)
- assert_eq(ret, SOFTAP_ERROR_OPERATION_FAILED);
-#else
- assert_eq(ret, SOFTAP_ERROR_NOT_PERMITTED);
-#endif
+ if (softap_utils_check_profile(MOBILE_PROFILE))
+ assert_eq(ret, SOFTAP_ERROR_OPERATION_FAILED);
+ else
+ assert_eq(ret, SOFTAP_ERROR_NOT_PERMITTED);
+
ret = softap_push_wps_button(NULL);
assert_eq(ret, SOFTAP_ERROR_INVALID_PARAMETER);
return 0;
}
-#if defined(MOBILE)
- assert_eq(ret, SOFTAP_ERROR_OPERATION_FAILED);
-#else
- assert_eq(ret, SOFTAP_ERROR_NOT_PERMITTED);
-#endif
+ if (softap_utils_check_profile(MOBILE_PROFILE))
+ assert_eq(ret, SOFTAP_ERROR_OPERATION_FAILED);
+ else
+ assert_eq(ret, SOFTAP_ERROR_NOT_PERMITTED);
+
ret = softap_set_wps_pin(NULL, pin);
assert_eq(ret, SOFTAP_ERROR_INVALID_PARAMETER);
ret = softap_set_wps_pin(handle, NULL);