+++ /dev/null
-Jeik Jaehyun Kim <jeik01.kim@samsung.com>
-ByungWoo Lee <bw1212.lee@samsung.com>
PROJECT(${fw_name})
-SET(CMAKE_INSTALL_PREFIX /usr)
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(LIB ${LIB_PATH})
+SET(LIBDIR ${PREFIX}/${LIB_PATH})
+
SET(INC_DIR include)
INCLUDE_DIRECTORIES(${INC_DIR})
-SET(dependents "dlog vconf capi-base-common glib-2.0 network")
+SET(dependents "dlog vconf capi-base-common glib-2.0 network capi-system-info")
SET(pc_dependents "capi-base-common")
+IF(TIZEN_DUALSIM_ENABLE)
+ ADD_DEFINITIONS(-DTIZEN_DUALSIM_ENABLE)
+ENDIF(TIZEN_DUALSIM_ENABLE)
+IF(TIZEN_WEARABLE)
+ ADD_DEFINITIONS(-DTIZEN_WEARABLE)
+ENDIF(TIZEN_WEARABLE)
+IF(TIZEN_MOBILE)
+ ADD_DEFINITIONS(-DTIZEN_MOBILE)
+ENDIF(TIZEN_MOBILE)
+
+IF(TIZEN_TV)
+ ADD_DEFINITIONS(-DTIZEN_TV)
+ENDIF(TIZEN_TV)
+
INCLUDE(FindPkgConfig)
-pkg_check_modules(${fw_name} REQUIRED ${dependents})
+pkg_check_modules(${fw_name} REQUIRED ${dependents} ${APPFW_REQUIRED_PKGS})
FOREACH(flag ${${fw_name}_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -fvisibility=hidden")
+#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -fvisibility=hidden")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall")
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
IF("${ARCH}" STREQUAL "arm")
ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
ADD_DEFINITIONS("-DTIZEN_DEBUG")
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIBDIR}")
aux_source_directory(src SOURCES)
ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
CLEAN_DIRECT_OUTPUT 1
)
-INSTALL(TARGETS ${fw_name} DESTINATION ${LIB_INSTALL_DIR})
+INSTALL(TARGETS ${fw_name} DESTINATION ${LIB})
INSTALL(
DIRECTORY ${INC_DIR}/ DESTINATION include/network
FILES_MATCHING
${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
@ONLY
)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB}/pkgconfig)
ADD_SUBDIRECTORY(test)
+Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. All rights reserved.
Apache License
Version 2.0, January 2004
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.
+
Copyright (c) Samsung Electronics Co., Ltd. All rights reserved.
Except as noted, this software is licensed under Apache License, Version 2.
-Please, see the LICENSE.APLv2 file for Apache License terms and conditions.
+Please, see the LICENSE file for Apache License terms and conditions.
--- /dev/null
+<manifest>
+ <assign>
+ <filesystem path="/usr/bin/wifi_test" exec_label="connman"/>
+ </assign>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
+++ /dev/null
-/usr/include/*
-/usr/include/*/*
-/usr/lib/pkgconfig/*.pc
-
+++ /dev/null
-/usr/lib/lib*.so*
+++ /dev/null
-capi-network-wifi (0.1.2-24) unstable; urgency=low
-
- * Clean the unnecessary things up
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.2-24
-
- -- Taesub Kim <taesub.kim@samsung.com> Fri, 29 Nov 2013 14:50:46 +0900
-
-capi-network-wifi (0.1.2-23) unstable; urgency=low
-
- * Use 'Already exists' error msg if applicable
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.2-23
-
- -- Taesub Kim <taesub.kim@samsung.com> Fri, 29 Nov 2013 14:35:46 +0900
-
-capi-network-wifi (0.1.2-22) unstable; urgency=low
-
- * Revise wifi_ap_set_eap_private_key_info() - admit to set without password
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.2-22
-
- -- Taesub Kim <taesub.kim@samsung.com> Fri, 29 Nov 2013 14:05:46 +0900
-
-capi-network-wifi (0.1.2-21) unstable; urgency=low
-
- * Avoid resetting IP, subnet mask and gateway to 0 in case of static type
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.2-21
-
- -- Taesub Kim <taesub.kim@samsung.com> Fri, 29 Nov 2013 13:52:46 +0900
-
-capi-network-wifi (0.1.2-20) unstable; urgency=low
-
- * Set CFLAGS fvisibility hidden
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.2-20
-
- -- Taesub Kim <taesub.kim@samsung.com> Fri, 29 Nov 2013 13:31:46 +0900
-
-capi-network-wifi (0.1.2-19) unstable; urgency=low
-
- * Fix Wi-Fi open connection
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.2-19
-
- -- Taesub Kim <taesub.kim@samsung.com> Fri, 29 Nov 2013 12:04:46 +0900
-
-capi-network-wifi (0.1.2-17) unstable; urgency=low
-
- * Handle NET_ERR_ACTIVE_CONNECTION_EXISTS event and correct the unit of data transfer rate
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.2-17
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Fri, 22 Mar 2013 18:30:06 +0900
-
-capi-network-wifi (0.1.2-16) unstable; urgency=low
-
- * Revise wifi_is_activated() to fix performance issue
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.2-16
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Tue, 19 Mar 2013 01:01:15 +0900
-
-capi-network-wifi (0.1.2-15) unstable; urgency=low
-
- * Added specific(hidden) scan support
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.2-15
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Tue, 26 Feb 2013 11:19:52 +0900
-
-capi-network-wifi (0.1.2-14) unstable; urgency=low
-
- * Fix memory corruption
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.2-14
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Mon, 28 Jan 2013 21:04:51 +0900
-
-capi-network-wifi (0.1.2-13) unstable; urgency=low
-
- * Set default address if there is no manual proxy to be restored
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.2-13
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Wed, 23 Jan 2013 12:17:18 +0900
-
-capi-network-wifi (0.1.2-12) unstable; urgency=low
-
- * Revise wifi_ap_is_passphrase_required() to fit connman 1.3
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.2-12
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Wed, 16 Jan 2013 17:15:16 +0900
-
-capi-network-wifi (0.1.2-11) unstable; urgency=low
-
- * Use libnet-client API instead of vconf value to get Wi-Fi state in wifi_is_activated() API
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.2-11
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Tue, 15 Jan 2013 00:07:57 +0900
-
-capi-network-wifi (0.1.2-10) unstable; urgency=low
-
- * Add WIFI_ERROR_SECURITY_RESTRICTED
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.2-10
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Fri, 04 Jan 2013 14:19:09 +0900
-
-capi-network-wifi (0.1.2-9) unstable; urgency=low
-
- * In case of setting IP address, Gateway, Subnet and proxy, it is allowed that a value is set to NULL
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.2-9
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Fri, 04 Jan 2013 13:43:46 +0900
-
-capi-network-wifi (0.1.2-8) unstable; urgency=low
-
- * Fix a bug, the api for dns setting is not work properly
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.2-8
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Thu, 13 Dec 2012 19:48:24 +0900
-
-capi-network-wifi (0.1.2-7) unstable; urgency=low
-
- * Fix a bug, the list handle not reset to NULL after clearing the AP list.
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.2-7
-
- -- Praveen C <pravin.c@samsung.com> Sat, 01 Dec 2012 18:56:38 +0530
-
-capi-network-wifi (0.1.2-6) unstable; urgency=low
-
- * Fix a bug, the setters of proxy/ip method are not work properly
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.2-6
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Fri, 23 Nov 2012 17:33:40 +0900
-
-capi-network-wifi (0.1.2-5) unstable; urgency=low
-
- * Revise minor things
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.2-5
-
- -- Danny Jeongseok Seo <s.seo@samsung.com> Tue, 13 Nov 2012 14:14:26 +0900
-
-capi-network-wifi (0.1.2-4) unstable; urgency=low
-
- * Revise test code
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.2-4
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Tue, 06 Nov 2012 20:31:31 +0900
-
-capi-network-wifi (0.1.2-3) unstable; urgency=low
-
- * Add wifi_ap_get_eap_passphrase()
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.2-3
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Mon, 15 Oct 2012 17:07:31 +0900
-
-capi-network-wifi (0.1.2-2) unstable; urgency=low
-
- * Install license
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.2-2
-
- -- Danny Jeongseok Seo <s.seo@samsung.com> Thu, 11 Oct 2012 19:06:52 +0900
-
-capi-network-wifi (0.1.2-1) unstable; urgency=low
-
- * Extend some APIs to fit requirements from osp
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.2-1
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Thu, 27 Sep 2012 17:25:19 +0900
-
-capi-network-wifi (0.1.1-4) unstable; urgency=low
-
- * Update manifest
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.1-4
-
- -- Danny Jeongseok Seo <s.seo@samsung.com> Fri, 21 Sep 2012 15:54:22 +0900
-
-capi-network-wifi (0.1.1-3) unstable; urgency=low
-
- * Remove unused codes from the UTC file
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.1-3
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Tue, 04 Sep 2012 16:21:28 +0900
-
-capi-network-wifi (0.1.1-2) unstable; urgency=low
-
- * Add UTC files
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.1-2
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Wed, 04 Jul 2012 11:41:10 +0900
-
-capi-network-wifi (0.1.1-1) unstable; urgency=low
-
- * Add AP initialization functions for user creation
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.1-1
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Mon, 02 Jul 2012 11:01:10 +0900
-
-capi-network-wifi (0.1.1-0) unstable; urgency=low
-
- * Package implementation
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.1-0
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Mon, 21 May 2012 19:31:01 +0900
-
-capi-network-wifi (0.1.0-1) unstable; urgency=low
-
- * Initial Upload
- * Git: framework/api/wifi
- * Tag: capi-network-wifi_0.1.0-1
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Mon, 09 Apr 2012 20:54:57 +0900
+++ /dev/null
-Source: capi-network-wifi
-Section: libs
-Priority: extra
-Maintainer: JaeHyun Kim <jeik01.kim@samsung.com>
-Build-Depends: debhelper (>= 5), dlog-dev, capi-base-common-dev, libvconf-dev, libglib2.0-dev, libdbus-glib-1-dev, libnetwork-dev
-
-Package: capi-network-wifi
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: Network Wi-Fi library in TIZEN C API
-
-Package: capi-network-wifi-dev
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, capi-network-wifi (= ${Source-Version}), capi-base-common-dev
-Description: Network Wi-Fi library in TIZEN C API (DEV)
-
-Package: capi-network-wifi-dbg
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, capi-network-wifi (= ${Source-Version})
-Description: Network Wi-Fi library in TIZEN C API (DBG)
-
+++ /dev/null
-#!/usr/bin/make -f
-
-CFLAGS = -Wall -g
-FULLVER ?= $(shell dpkg-parsechangelog | grep Version: | cut -d ' ' -f 2 | cut -d '-' -f 1)
-MAJORVER ?= $(shell echo $(FULLVER) | cut -d '.' -f 1)
-
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
- CFLAGS += -O0
-else
- CFLAGS += -O2
-endif
-CMAKE_ROOT_DIR ?= $(CURDIR)
-CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp
-
-configure: configure-stamp
-configure-stamp:
- dh_testdir
- mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && cmake .. -DFULLVER=${FULLVER} -DMAJORVER=${MAJORVER}
- touch configure-stamp
-
-
-build: build-stamp
-build-stamp: configure-stamp
- dh_testdir
- cd $(CMAKE_BUILD_DIR) && $(MAKE)
- touch $@
-
-clean:
- cd $(CMAKE_ROOT_DIR)
- dh_testdir
- dh_testroot
- rm -f build-stamp configure-stamp
- rm -f `find . -name *.pc`
- rm -rf $(CMAKE_BUILD_DIR)
- dh_clean
-
-install: build
- dh_testdir
- dh_testroot
- dh_clean -k
- dh_installdirs
-
- cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
-
-binary-indep: build install
-
-binary-arch: build install
- dh_testdir
- dh_testroot
- dh_installchangelogs
- dh_installdocs
- dh_installexamples
- dh_install --sourcedir=debian/tmp
- dh_installman
- dh_link
- dh_strip --dbg-package=capi-network-wifi-dbg
- dh_fixperms
- dh_makeshlibs
- dh_installdeb
- dh_shlibdeps
- dh_gencontrol
- dh_md5sums
- dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install configure
-
*
* To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
*
- * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ * More details on featuring your application can be found from <a href="../org.tizen.gettingstarted/html/native/details/app_filtering_n.htm"><b>Feature List</b>.</a>
*
*/
*
* To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
*
- * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ * More details on featuring your application can be found from <a href="../org.tizen.gettingstarted/html/native/details/app_filtering_n.htm"><b>Feature List</b>.</a>
*
*/
*
* To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
*
- * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ * More details on featuring your application can be found from <a href="../org.tizen.gettingstarted/html/native/details/app_filtering_n.htm"><b>Feature List</b>.</a>
*
*/
*
* To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
*
- * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ * More details on featuring your application can be found from <a href="../org.tizen.gettingstarted/html/native/details/app_filtering_n.htm"><b>Feature List</b>.</a>
*
*/
*
* To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
*
- * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ * More details on featuring your application can be found from <a href="../org.tizen.gettingstarted/html/native/details/app_filtering_n.htm"><b>Feature List</b>.</a>
*
*/
*
* To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
*
- * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ * More details on featuring your application can be found from <a href="../org.tizen.gettingstarted/html/native/details/app_filtering_n.htm"><b>Feature List</b>.</a>
*
*/
*
* To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
*
- * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ * More details on featuring your application can be found from <a href="../org.tizen.gettingstarted/html/native/details/app_filtering_n.htm"><b>Feature List</b>.</a>
*
*/
#include <dlog.h>
#include <network-cm-intf.h>
#include <network-wifi-intf.h>
+#include <system_info.h>
#include "wifi.h"
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
#undef LOG_TAG
#define LOG_TAG "CAPI_NETWORK_WIFI"
#define WIFI_ERROR 2
#define WIFI_WARN 3
+#define WIFI_FEATURE "http://tizen.org/feature/network.wifi"
+
+#if !defined TIZEN_TV
+#define CHECK_FEATURE_SUPPORTED(feature_name) \
+ do { \
+ bool feature_supported = FALSE; \
+ if (!system_info_get_platform_bool(feature_name, &feature_supported)) { \
+ if (feature_supported == FALSE) { \
+ LOGE("%s feature is disabled", feature_name); \
+ return WIFI_ERROR_NOT_SUPPORTED; \
+ } \
+ } else { \
+ LOGE("Error - Feature getting from System Info"); \
+ return WIFI_ERROR_OPERATION_FAILED; \
+ } \
+ } while(0)
+#else
+#define CHECK_FEATURE_SUPPORTED(feature_name)
+#endif
+
#define WIFI_LOG(log_level, format, args...) \
do { \
switch (log_level) { \
} \
} while(0)
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+#define SECURE_WIFI_LOG(log_level, format, args...) \
+ do { \
+ switch (log_level) { \
+ case WIFI_ERROR: \
+ SECURE_LOGE(format, ## args); \
+ break; \
+ case WIFI_WARN: \
+ SECURE_LOGW(format, ## args); \
+ break; \
+ default: \
+ SECURE_LOGI(format, ## args); \
+ } \
+ } while(0)
bool _wifi_is_init(void);
/**
* @brief Enumeration for the Wi-Fi error type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
/**
* @brief Enumeration for the state of the Wi-Fi device.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
/**
* @brief Enumeration for the state of the Wi-Fi connection.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
/**
* @brief Enumeration for the RSSI level.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
/**
* @brief Enumeration for the Net IP configuration type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
/**
* @brief Enumeration for the address type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
/**
* @brief Enumeration for the proxy method type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
* @details The following security modes are used in infrastructure and ad-hoc mode.
* For now all EAP security mechanisms are provided only in infrastructure mode.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
/**
* @brief Enumeration for Wi-Fi encryption type.
* @details The following encryption modes are used in infrastructure and ad-hoc mode.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
/**
* @brief Enumeration for EAP type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
/**
* @brief Enumeration for EAP phase2 authentication type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
/**
* @brief The Wi-Fi access point handle.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef void* wifi_ap_h;
/**
* @brief Called when you get the found access point repeatedly.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks @a ap is valid only in this function. In order to use @a ap outside this function, you must copy the ap with wifi_ap_clone().
* @param[in] ap The access point
* @param[in] user_data The user data passed from the request function
/**
* @brief Called when the scan is finished.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] error_code The error code
* @param[in] user_data The user data passed from the callback registration function
* @see wifi_scan()
/**
* @brief Called after wifi_activate() or wifi_activate_with_wifi_picker_tested() is completed.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] result The result
* @param[in] user_data The user data passed from wifi_activate() and wifi_activate_with_wifi_picker_tested()
* @pre wifi_activate() or wifi_activate_with_wifi_picker_tested() will invoke this callback function.
/**
* @brief Called after wifi_deactivate() is completed.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] result The result
* @param[in] user_data The user data passed from wifi_deactivate()
* @pre wifi_deactivate() will invoke this callback function.
/**
* @brief Called after either wifi_connect() or wifi_connect_by_wps_pbc() or wifi_connect_by_wps_pin() are completed.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] result The result
* @param[in] user_data The user data passed from either wifi_connect() or wifi_connect_by_wps_pbc() or wifi_connect_by_wps_pin()
* @pre Either wifi_connect() or wifi_connect_by_wps_pbc() or wifi_connect_by_wps_pin() will invoke this callback function.
/**
* @brief Called after wifi_disconnect() is completed.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] result The result
* @param[in] user_data The user data passed from wifi_disconnect()
* @pre wifi_disconnect() will invoke this callback function.
/**
* @brief Called when the device state is changed.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] state The device state
* @param[in] user_data The user data passed from the callback registration function
* @see wifi_set_device_state_changed_cb()
/**
* @brief Called when the connection state is changed.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] state The connection state
* @param[in] ap The access point
* @param[in] user_data The user data passed from the callback registration function
/**
* @brief Called when the RSSI of connected Wi-Fi is changed.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] rssi_level The level of RSSI
* @param[in] user_data The user data passed from the callback registration function
* @see wifi_set_rssi_level_changed_cb()
/**
* @brief Initializes Wi-Fi.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.get
* @return @c 0 on success, otherwise negative error value
/**
* @brief Deinitializes Wi-Fi.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @return 0 on success, otherwise negative error value
* @retval #WIFI_ERROR_NONE Successful
* @retval #WIFI_ERROR_INVALID_OPERATION Invalid operation
/**
* @brief Activates Wi-Fi asynchronously.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.set \n
* %http://tizen.org/privilege/network.get
/**
* @brief Activates Wi-Fi asynchronously and displays Wi-Fi picker (popup) when Wi-Fi is not automatically connected.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.set \n
* %http://tizen.org/privilege/network.get
/**
* @brief Deactivates Wi-Fi asynchronously.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.set \n
* %http://tizen.org/privilege/network.get
/**
* @brief Checks whether Wi-Fi is activated.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.get
* @param[out] activated @c ture if Wi-Fi is activated,
/**
* @brief Gets the local MAC address.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks You must release @a mac_address using free().
* @param[out] mac_address The MAC address
* @return 0 on success, otherwise negative error value
/**
* @brief Gets the name of the network interface.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.get
* @remarks You must release @a name using free().
/**
* @brief Starts scan asynchronously.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.set \n
* %http://tizen.org/privilege/network.get
/**
* @brief Gets the handle of the connected access point.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.get
* @remarks You must release @a handle using wifi_ap_destroy().
/**
* @brief Gets the result of the scan.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.get
* @param[in] callback The callback to be called
/**
* @brief Connects the access point asynchronously.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.set \n
* %http://tizen.org/privilege/network.get
/**
* @brief Disconnects the access point asynchronously.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.set \n
* %http://tizen.org/privilege/network.get
/**
* @brief Connects the access point with WPS PBC asynchronously.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.profile \n
* %http://tizen.org/privilege/network.get
/**
* @brief Connects the access point with WPS PIN asynchronously.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.profile \n
* %http://tizen.org/privilege/network.get
* @brief Deletes the information of stored access point and disconnects it when it connected.
* @details If an AP is connected, then connection information will be stored.
* This information is used when a connection to that AP is established automatically.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.profile \n
* %http://tizen.org/privilege/network.get
/**
* @brief Gets the connection state.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.get
* @param[out] connection_state The connection state
/**
* @brief Registers the callback called when the device state is changed.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] callback The callback function to be called
* @param[in] user_data The user data passed to the callback function
* @return 0 on success, otherwise negative error value
/**
* @brief Unregisters the callback called when the device state is changed.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @return 0 on success, otherwise negative error value
* @retval #WIFI_ERROR_NONE Successful
* @retval #WIFI_ERROR_INVALID_OPERATION Invalid operation
/**
* @brief Registers the callback called when the background scan is finished periodically.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] callback The callback function to be called
* @param[in] user_data The user data passed to the callback function
* @return 0 on success, otherwise negative error value
/**
* @brief Unregisters the callback called when the scan is finished periodically.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @return 0 on success, otherwise negative error value
* @retval #WIFI_ERROR_NONE Successful
* @retval #WIFI_ERROR_INVALID_OPERATION Invalid operation
/**
* @brief Registers the callback called when the connection state is changed.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] callback The callback function to be called
* @param[in] user_data The user data passed to the callback function
* @return 0 on success, otherwise negative error value
/**
* @brief Unregisters the callback called when the connection state is changed.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @return 0 on success, otherwise negative error value
* @retval #WIFI_ERROR_NONE Successful
* @retval #WIFI_ERROR_INVALID_OPERATION Invalid operation
/**
* @brief Registers callback called when the RSSI of connected Wi-Fi is changed.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] callback The callback function to be called
* @param[in] user_data The user data passed to the callback function
* @return 0 on success, otherwise negative error value
/**
* @brief Unregisters callback called when the RSSI of connected Wi-Fi is changed.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @return 0 on success, otherwise negative error value
* @retval #WIFI_ERROR_NONE Successful
* @retval #WIFI_ERROR_INVALID_OPERATION Invalid operation
/**
* @brief Creates the access point handle.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.profile \n
* %http://tizen.org/privilege/network.get
/**
* @brief Creates the hidden access point handle.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks You must release @a ap using wifi_ap_destroy().
* @param[in] essid The ESSID (Extended Service Set Identifier) should be null-terminated and can be UTF-8 encoded
* @param[out] ap The access point handle
/**
* @brief Destroys the access point handle.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] ap The access point handle
* @return 0 on success, otherwise negative error value
* @retval #WIFI_ERROR_NONE Successful
/**
* @brief Clones the access point handle.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks You must release @a cloned_ap using wifi_ap_destroy().
* @param[out] cloned_ap The cloned access point handle
* @param[in] origin The origin access point handle
/**
* @brief Refreshes the access point information.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.get
* @remarks You should call this function in order to get the current access point information, because the information can be changed.
/**
* @brief Gets ESSID (Extended Service Set Identifier).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks You must release @a essid using free().
* @param[in] ap The access point handle
* @param[out] essid The ESSID
/**
* @brief Gets BSSID (Basic Service Set Identifier).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks You must release @a bssid using free().
* @param[in] ap The access point handle
* @param[out] bssid The BSSID
/**
* @brief Gets the RSSI.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] ap The access point handle
* @param[out] rssi The RSSI
* @return 0 on success, otherwise negative error value
/**
* @brief Gets the frequency band (MHz).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] ap The access point handle
* @param[out] frequency The frequency
* @return 0 on success, otherwise negative error value
/**
* @brief Gets the max speed (Mbps).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] ap The access point handle
* @param[out] max_speed The max speed
* @return 0 on success, otherwise negative error value
/**
* @brief Checks whether the access point is favorite or not.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] ap The access point handle
* @param[out] favorite @c true if access point is favorite,
* otherwise @c false if access point is not favorite
/**
* @brief Checks whether the access point is passpoint or not.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] ap The access point handle
* @param[out] passpoint @c ture if access point is passpoint,
* otherwise @c false if access point is not passpoint.
/**
* @brief Gets the connection state.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] ap The access point handle
* @param[out] state The connection state
* @return 0 on success, otherwise negative error value
/**
* @brief Gets the config type of IP.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] ap The access point handle
* @param[in] address_family The address family
* @param[out] type The type of IP config
* @brief Sets the config type of IP.
* @details If you set IP config type to #WIFI_IP_CONFIG_TYPE_STATIC,
* then IP address, Gateway and Subnet mask will be set to the initial value "0.0.0.0".
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.profile \n
* %http://tizen.org/privilege/network.get
/**
* @brief Gets the IP address.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks You must release @a ip_address using free().
* @param[in] ap The access point handle
* @param[in] address_family The address family
/**
* @brief Sets the IP address.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.profile \n
* %http://tizen.org/privilege/network.get
/**
* @brief Gets the subnet mask.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks You must release @a subnet_mask using free().
* @param[in] ap The access point handle
* @param[in] address_family The address family
/**
* @brief Sets the subnet mask.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.profile \n
* %http://tizen.org/privilege/network.get
/**
* @brief Gets the gateway address.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks You must release @a gateway_address using free().
* @param[in] ap The access point handle
* @param[in] address_family The address family
/**
* @brief Sets the gateway address.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.profile \n
* %http://tizen.org/privilege/network.get
/**
* @brief Gets the proxy address.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks You must release @a proxy_address using free().
* @param[in] ap The access point handle
* @param[in] address_family The address family
/**
* @brief Sets the proxy address.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.profile \n
* %http://tizen.org/privilege/network.get
/**
* @brief Gets the Proxy type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] ap The access point handle
* @param[out] type The type of proxy
* @return 0 on success, otherwise negative error value
/**
* @brief Sets the Proxy address.
* @details If you set Proxy type to #WIFI_PROXY_TYPE_AUTO or #WIFI_PROXY_TYPE_MANUAL, then Proxy will be restored.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.profile \n
* %http://tizen.org/privilege/network.get
/**
* @brief Gets the DNS address.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks The allowance of DNS address is @c 2.You must release @a dns_address using free().
* @param[in] ap The access point handle
* @param[in] order The order of DNS address; it starts from 1, which means first DNS address
/**
* @brief Sets the DNS address.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.profile \n
* %http://tizen.org/privilege/network.get
/**
* @brief Gets the Wi-Fi security mode.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] ap The access point handle
* @param[out] type The type of Wi-Fi security
* @return 0 on success, otherwise negative error value
/**
* @brief Sets the Wi-Fi security mode.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] ap The access point handle
* @param[in] type The type of Wi-Fi security
* @return 0 on success, otherwise negative error value
/**
* @brief Gets the Wi-Fi encryption type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] ap The access point handle
* @param[out] type The type of Wi-Fi encryption
* @return 0 on success, otherwise negative error value
/**
* @brief Sets the Wi-Fi encryption type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] ap The access point handle
* @param[in] type The type of Wi-Fi encryption
* @return 0 on success, otherwise negative error value
/**
* @brief Checks whether the passphrase is required or not.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks This function is not valid if security type is #WIFI_SECURITY_TYPE_EAP.
* @param[in] ap The access point handle
* @param[out] required @c true if passphrase is required,
/**
* @brief Sets the passphrase.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] ap The access point handle
* @param[in] passphrase The passphrase of access point
* @return 0 on success, otherwise negative error value
/**
* @brief Checks whether the WPS(Wi-Fi Protected Setup) is supported or not.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] ap The access point handle
* @param[out] supported @c ture if WPS is supported,
* otherwise @c false is WPS is not supported.
* @details You can set one of @a user_name and @a password as @c NULL.
* In this case, the value of a parameter which is set as @c NULL will be the previous value.
* But it is not allowed that both @a user_name and @a password are set as @c NULL.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks This function is valid only if the EAP type is #WIFI_EAP_TYPE_PEAP or #WIFI_EAP_TYPE_TTLS.
* @param[in] ap The access point handle
* @param[in] user_name The user name \n
/**
* @brief Gets the passphrase of EAP.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks This function is valid only if the EAP type is #WIFI_EAP_TYPE_PEAP or #WIFI_EAP_TYPE_TTLS.
* You must release @a user_name using free().
* @param[in] ap The access point handle
/**
* @brief Gets the CA Certificate of EAP.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks This function is valid only if the EAP type is #WIFI_EAP_TYPE_TLS.
* You must release @a file using free().
* @param[in] ap The access point handle
/**
* @brief Sets the CA Certificate of EAP.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks This function is valid only if the EAP type is #WIFI_EAP_TYPE_TLS.
* @param[in] ap The access point handle
* @param[in] file The file path of CA Certificate
/**
* @brief Gets the Client Certificate of EAP.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks This function is valid only if the EAP type is #WIFI_EAP_TYPE_TLS.
* You must release @a file using free().
* @param[in] ap The access point handle
/**
* @brief Sets the CA Certificate of EAP.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks This function is valid only if the EAP type is #WIFI_EAP_TYPE_TLS.
* @param[in] ap The access point handle
* @param[in] file The file path of Client Certificate
/**
* @brief Gets the private key file of EAP.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks This function is valid only if the EAP type is #WIFI_EAP_TYPE_TLS.
* You must release @a file using free().
* @param[in] ap The access point handle
/**
* @brief Sets the private key information of EAP.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks This function is valid only if the EAP type is #WIFI_EAP_TYPE_TLS.
* @param[in] ap The access point handle
* @param[in] file The file path of private key
/**
* @brief Gets the EAP type of Wi-Fi.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] ap The access point handle
* @param[out] type The type of EAP
* @return 0 on success, otherwise negative error value
/**
* @brief Sets the EAP type of Wi-Fi.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] ap The access point handle
* @param[in] type The type of EAP
* @return 0 on success, otherwise negative error value
/**
* @brief Gets the type of EAP phase2 authentication of Wi-Fi.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] ap The access point handle
* @param[out] type The type of EAP phase2 authentication
* @return 0 on success, otherwise negative error value
/**
* @brief Sets the type of EAP phase2 authentication of Wi-Fi.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] ap The access point handle
* @param[in] type The type of EAP phase2 authentication
* @return 0 on success, otherwise negative error value
+++ /dev/null
-<manifest>
- <request>
- <domain name="_"/>
- </request>
-</manifest>
-Name: capi-network-wifi
-Summary: Network Wi-Fi library in TIZEN C API
-Version: 0.1.2_34
-Release: 1
-Group: System/Network
-License: Apache-2.0
-Source0: %{name}-%{version}.tar.gz
-Source1001: capi-network-wifi.manifest
-BuildRequires: cmake
-BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(glib-2.0)
-BuildRequires: pkgconfig(vconf)
-BuildRequires: pkgconfig(capi-base-common)
-BuildRequires: pkgconfig(network)
+Name: capi-network-wifi
+Summary: Network Wi-Fi library in TIZEN C API
+Version: 1.0.55
+Release: 1
+Group: System/Network
+License: Apache-2.0
+Source0: %{name}-%{version}.tar.gz
+BuildRequires: cmake
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(network)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(capi-base-common)
+BuildRequires: pkgconfig(capi-system-info)
+BuildRequires: model-build-features
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+
+%if "%{?tizen_profile_name}" == "wearable"
+BuildRequires: pkgconfig(capi-appfw-application)
+%endif
%description
Network Wi-Fi library in Tizen C API
%package devel
-Summary: Network Wi-Fi library in Tizen C API (Development)
-Group: System/Network
-Requires: %{name} = %{version}-%{release}
+Summary: Network Wi-Fi library in Tizen C API (Development)
+Group: System/Network
+Requires: %{name} = %{version}-%{release}
%description devel
Network Wi-Fi library in Tizen C API (Development)
%prep
%setup -q
-cp %{SOURCE1001} .
%build
+export CFLAGS+=' -Wno-unused-local-typedefs'
MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
+cmake -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \
+ -DLIB_PATH=%{_lib} \
+%if 0%{?model_build_feature_network_dsds} == 1
+ -DTIZEN_DUALSIM_ENABLE=1 \
+%endif
+%if "%{?tizen_profile_name}" == "wearable"
+ -DTIZEN_WEARABLE=1 \
+%else
+%if "%{?tizen_profile_name}" == "mobile"
+ -DTIZEN_MOBILE=1 \
+%else
+%if "%{?tizen_profile_name}" == "tv"
+ -DTIZEN_TV=1 \
+%endif
+%endif
+%endif
+ .
make %{?_smp_mflags}
#License
mkdir -p %{buildroot}%{_datadir}/license
-cp LICENSE.APLv2 %{buildroot}%{_datadir}/license/capi-network-wifi
+cp LICENSE %{buildroot}%{_datadir}/license/capi-network-wifi
%post -p /sbin/ldconfig
%files
-%manifest %{name}.manifest
+%manifest capi-network-wifi.manifest
%attr(644,-,-) %{_libdir}/libcapi-network-wifi.so.*
%{_datadir}/license/capi-network-wifi
%{_bindir}/wifi_test
%files devel
-%manifest %{name}.manifest
%{_includedir}/network/*.h
%{_libdir}/pkgconfig/*.pc
%{_libdir}/libcapi-network-wifi.so
* limitations under the License.
*/
+#include <glib.h>
+#include <ctype.h>
#include <stdio.h>
#include <string.h>
-#include <ctype.h>
-#include <glib.h>
+
#include "net_wifi_private.h"
static __thread bool is_init = false;
return WIFI_ERROR_NONE;
}
+static gboolean __wifi_state_changed_cb(gpointer data)
+{
+ wifi_ap_h ap_info;
+ struct _wifi_state_notify *notify = (struct _wifi_state_notify *)data;
+
+ if (notify == NULL)
+ return FALSE;
+
+ if (notify->ap_info == NULL) {
+ g_free(notify);
+ return FALSE;
+ }
+
+ ap_info = (wifi_ap_h)notify->ap_info;
+
+ _wifi_libnet_add_to_ap_list(ap_info);
+
+ if (wifi_callbacks.connection_state_cb != NULL)
+ wifi_callbacks.connection_state_cb(notify->state, ap_info,
+ wifi_callbacks.connection_state_user_data);
+
+ _wifi_libnet_remove_from_ap_list(ap_info);
+
+ g_free(notify);
+
+ return FALSE;
+}
+
static void __libnet_state_changed_cb(char *profile_name, net_profile_info_t *profile_info,
wifi_connection_state_e state)
{
+ guint id;
+ net_profile_info_t *ap_info = NULL;
+ struct _wifi_state_notify *notify = NULL;
+
+ if (_wifi_is_init() != true) {
+ WIFI_LOG(WIFI_ERROR, "Application is not registered"
+ "If multi-threaded, thread integrity be broken.");
+ return;
+ }
+
+ if (wifi_callbacks.connection_state_cb == NULL)
+ return;
+
if (profile_name == NULL)
return;
if (profile_info == NULL) {
- WIFI_LOG(WIFI_ERROR, "Error!! Profile info not found! : %s\n", profile_name);
+ SECURE_WIFI_LOG(WIFI_ERROR, "Failed to find: %s", profile_name);
return;
}
- ap_handle_list = g_slist_append(ap_handle_list, (wifi_ap_h)profile_info);
+ ap_info = g_try_malloc0(sizeof(net_profile_info_t));
+ if (ap_info == NULL) {
+ WIFI_LOG(WIFI_ERROR, "Memory allocation error");
+ return;
+ }
- if (wifi_callbacks.connection_state_cb)
- wifi_callbacks.connection_state_cb(state, (wifi_ap_h)profile_info,
- wifi_callbacks.connection_state_user_data);
+ memcpy(ap_info, profile_info, sizeof(net_profile_info_t));
- ap_handle_list = g_slist_remove(ap_handle_list, (wifi_ap_h)profile_info);
+ notify = g_try_new0(struct _wifi_state_notify, 1);
+ if (notify == NULL) {
+ g_free(ap_info);
+ return;
+ }
+
+ notify->ap_info = ap_info;
+ notify->state = state;
+
+ id = _wifi_callback_add(__wifi_state_changed_cb, (gpointer)notify);
+ if (!id)
+ g_free(notify);
}
static void __libnet_set_activated_cb(wifi_activated_cb user_cb, void *user_data)
{
- if (user_cb) {
+ if (user_cb != NULL) {
wifi_callbacks.activated_cb = user_cb;
wifi_callbacks.activated_user_data = user_data;
}
}
-static void __libnet_activated_cb(wifi_error_e result)
+static gboolean __activated_cb_idle(gpointer data)
{
- if (wifi_callbacks.activated_cb)
+ wifi_error_e result = (wifi_error_e)data;
+
+ if (wifi_callbacks.activated_cb != NULL)
wifi_callbacks.activated_cb(result, wifi_callbacks.activated_user_data);
wifi_callbacks.activated_cb = NULL;
wifi_callbacks.activated_user_data = NULL;
+
+ return FALSE;
}
-static void __libnet_set_deactivated_cb(wifi_disconnected_cb user_cb, void *user_data)
+static void __libnet_set_deactivated_cb(wifi_deactivated_cb user_cb, void *user_data)
{
if (user_cb != NULL) {
wifi_callbacks.deactivated_cb = user_cb;
}
}
-static void __libnet_deactivated_cb(wifi_error_e result)
+static gboolean __deactivated_cb_idle(gpointer data)
{
- if (wifi_callbacks.deactivated_cb)
+ wifi_error_e result = (wifi_error_e)data;
+
+ if (wifi_callbacks.deactivated_cb != NULL)
wifi_callbacks.deactivated_cb(result, wifi_callbacks.deactivated_user_data);
wifi_callbacks.deactivated_cb = NULL;
wifi_callbacks.deactivated_user_data = NULL;
+
+ return FALSE;
+}
+
+static gboolean __device_state_cb_idle(gpointer data)
+{
+ wifi_device_state_e state = (wifi_device_state_e)data;
+
+ if (wifi_callbacks.device_state_cb != NULL)
+ wifi_callbacks.device_state_cb(state, wifi_callbacks.device_state_user_data);
+
+ return FALSE;
}
static void __libnet_power_on_off_cb(net_event_info_t *event_cb, bool is_requested)
WIFI_LOG(WIFI_INFO, "Wi-Fi power off");
state = WIFI_DEVICE_STATE_DEACTIVATED;
__libnet_clear_profile_list(&profile_iterator);
- __libnet_clear_profile_list(&specific_profile_iterator);
} else {
WIFI_LOG(WIFI_ERROR, "Error Wi-Fi state %d", *wifi_state);
error_code = WIFI_ERROR_OPERATION_FAILED;
state = WIFI_DEVICE_STATE_DEACTIVATED;
}
- __libnet_activated_cb(error_code);
- __libnet_deactivated_cb(error_code);
+ if (wifi_callbacks.activated_cb != NULL)
+ _wifi_callback_add(__activated_cb_idle, (gpointer)error_code);
- if (wifi_callbacks.device_state_cb)
- wifi_callbacks.device_state_cb(state, wifi_callbacks.device_state_user_data);
+ if (wifi_callbacks.deactivated_cb != NULL)
+ _wifi_callback_add(__deactivated_cb_idle, (gpointer)error_code);
+
+ if (wifi_callbacks.device_state_cb != NULL)
+ _wifi_callback_add(__device_state_cb_idle, (gpointer)state);
}
-static void __libnet_scan_cb(net_event_info_t *event_cb)
+static gboolean __scan_request_cb_idle(gpointer data)
+{
+ wifi_error_e error_code = (wifi_error_e)data;
+
+ if (wifi_callbacks.scan_request_cb != NULL)
+ wifi_callbacks.scan_request_cb(error_code, wifi_callbacks.scan_request_user_data);
+
+ wifi_callbacks.scan_request_cb = NULL;
+ wifi_callbacks.scan_request_user_data = NULL;
+
+ return FALSE;
+}
+
+static void __libnet_set_specific_scan_cb(wifi_scan_finished_cb user_cb, void *user_data)
+{
+ if (user_cb != NULL) {
+ wifi_callbacks.specific_scan_cb = user_cb;
+ wifi_callbacks.specific_scan_user_data = user_data;
+ }
+}
+
+static gboolean __specific_scan_cb_idle(gpointer data)
+{
+ wifi_error_e error_code = (wifi_error_e)data;
+
+ if (wifi_callbacks.specific_scan_cb != NULL)
+ wifi_callbacks.specific_scan_cb(error_code, wifi_callbacks.specific_scan_user_data);
+
+ wifi_callbacks.specific_scan_cb = NULL;
+ wifi_callbacks.specific_scan_user_data = NULL;
+
+ return FALSE;
+}
+
+static gboolean __bgscan_cb_idle(gpointer data)
+{
+ wifi_error_e error_code = (wifi_error_e)data;
+
+ if (wifi_callbacks.bg_scan_cb != NULL)
+ wifi_callbacks.bg_scan_cb(error_code, wifi_callbacks.bg_scan_user_data);
+
+ return FALSE;
+}
+
+static void __libnet_scan_cb(net_event_info_t *event_cb, bool is_requested)
{
wifi_error_e error_code = WIFI_ERROR_NONE;
+ if (_wifi_is_init() != true) {
+ WIFI_LOG(WIFI_ERROR, "Application is not registered"
+ "If multi-threaded, thread integrity be broken.");
+ return;
+ }
+
if (event_cb->Error != NET_ERR_NONE) {
- WIFI_LOG(WIFI_ERROR, "Scan failed!, Error [%d]\n", event_cb->Error);
+ WIFI_LOG(WIFI_ERROR, "Scan failed[%d]", event_cb->Error);
error_code = WIFI_ERROR_OPERATION_FAILED;
}
- if (wifi_callbacks.scan_request_cb) {
- wifi_callbacks.scan_request_cb(error_code, wifi_callbacks.scan_request_user_data);
- wifi_callbacks.scan_request_cb = NULL;
- wifi_callbacks.scan_request_user_data = NULL;
+ if (wifi_callbacks.scan_request_cb != NULL) {
+ _wifi_callback_add(__scan_request_cb_idle, (gpointer)error_code);
return;
}
if (wifi_callbacks.bg_scan_cb != NULL)
- wifi_callbacks.bg_scan_cb(error_code, wifi_callbacks.bg_scan_user_data);
+ _wifi_callback_add(__bgscan_cb_idle, (gpointer)error_code);
}
static void __libnet_specific_scan_cb(net_event_info_t *event_cb)
__libnet_update_specific_profile_iterator(ap_list);
}
- if (wifi_callbacks.specific_scan_cb) {
- wifi_callbacks.specific_scan_cb(error_code, wifi_callbacks.specific_scan_user_data);
- wifi_callbacks.specific_scan_cb = NULL;
- wifi_callbacks.specific_scan_user_data = NULL;
- }
+ if (wifi_callbacks.specific_scan_cb != NULL)
+ _wifi_callback_add(__specific_scan_cb_idle, (gpointer)error_code);
}
static void __libnet_set_connected_cb(wifi_connected_cb user_cb, void *user_data)
{
- if (user_cb) {
+ if (user_cb != NULL) {
wifi_callbacks.connected_cb = user_cb;
wifi_callbacks.connected_user_data = user_data;
}
}
-static void __libnet_connected_cb(wifi_error_e result)
+static gboolean __connected_cb_idle(gpointer data)
{
- if (wifi_callbacks.connected_cb)
+ wifi_error_e result = (wifi_error_e)data;
+
+ if (wifi_callbacks.connected_cb != NULL)
wifi_callbacks.connected_cb(result, wifi_callbacks.connected_user_data);
wifi_callbacks.connected_cb = NULL;
wifi_callbacks.connected_user_data = NULL;
+
+ return FALSE;
+}
+
+static void __libnet_connected_cb(wifi_error_e result)
+{
+ if (_wifi_is_init() != true) {
+ WIFI_LOG(WIFI_ERROR, "Application is not registered"
+ "If multi-threaded, thread integrity be broken.");
+ return;
+ }
+
+ if (wifi_callbacks.connected_cb != NULL)
+ _wifi_callback_add(__connected_cb_idle, (gpointer)result);
}
static void __libnet_set_disconnected_cb(wifi_disconnected_cb user_cb, void *user_data)
{
- if (user_cb) {
+ if (user_cb != NULL) {
wifi_callbacks.disconnected_cb = user_cb;
wifi_callbacks.disconnected_user_data = user_data;
}
}
-static void __libnet_disconnected_cb(wifi_error_e result)
+static gboolean __disconnected_cb_idle(gpointer data)
{
- if (wifi_callbacks.disconnected_cb)
+ wifi_error_e result = (wifi_error_e)data;
+
+ if (wifi_callbacks.disconnected_cb != NULL)
wifi_callbacks.disconnected_cb(result, wifi_callbacks.disconnected_user_data);
wifi_callbacks.disconnected_cb = NULL;
wifi_callbacks.disconnected_user_data = NULL;
+
+ return FALSE;
+}
+
+static void __libnet_disconnected_cb(wifi_error_e result)
+{
+ if (_wifi_is_init() != true) {
+ WIFI_LOG(WIFI_ERROR, "Application is not registered"
+ "If multi-threaded, thread integrity be broken.");
+ return;
+ }
+
+ if (wifi_callbacks.disconnected_cb != NULL)
+ _wifi_callback_add(__disconnected_cb_idle, (gpointer)result);
}
static void __libnet_evt_cb(net_event_info_t *event_cb, void *user_data)
net_profile_info_t *prof_info_p = NULL;
net_profile_info_t prof_info;
wifi_error_e result = WIFI_ERROR_NONE;
+ int i = 0;
+ bool is_profile_exists = false;
switch (event_cb->Event) {
case NET_EVENT_OPEN_RSP:
return;
result = __libnet_convert_to_ap_error_type(event_cb->Error);
- WIFI_LOG(WIFI_INFO, "Got Open RSP/IND : %s\n",
- __libnet_convert_ap_error_type_to_string(result));
+ WIFI_LOG(WIFI_INFO, "Connection open error %s",
+ __libnet_convert_ap_error_type_to_string(result));
if (is_requested)
__libnet_connected_cb(result);
return;
result = __libnet_convert_to_ap_error_type(event_cb->Error);
- WIFI_LOG(WIFI_INFO, "Got Close RSP/IND : %s\n",
- __libnet_convert_ap_error_type_to_string(result));
+ WIFI_LOG(WIFI_ERROR, "Connection close error %s",
+ __libnet_convert_ap_error_type_to_string(result));
if (is_requested)
__libnet_disconnected_cb(result);
net_state_type_t *profile_state = (net_state_type_t *)event_cb->Data;
wifi_connection_state_e ap_state = _wifi_convert_to_ap_state(*profile_state);
- WIFI_LOG(WIFI_INFO,
- "Profile State : %s, profile name : %s\n",
- __libnet_convert_ap_state_to_string(ap_state),
- event_cb->ProfileName);
+ WIFI_LOG(WIFI_INFO, "state: %s", __libnet_convert_ap_state_to_string(ap_state));
+ SECURE_WIFI_LOG(WIFI_INFO, "profile name: %s", event_cb->ProfileName);
if (net_get_profile_info(event_cb->ProfileName, &prof_info) == NET_ERR_NONE)
__libnet_state_changed_cb(event_cb->ProfileName, &prof_info, ap_state);
- else
+ else if (ap_state == WIFI_CONNECTION_STATE_DISCONNECTED) {
+ for (i = 0; i < profile_iterator.count; i++) {
+ if (!g_strcmp0(event_cb->ProfileName,
+ profile_iterator.profiles[i].ProfileName)) {
+ is_profile_exists = true;
+ break;
+ }
+ }
+
+ if (is_profile_exists == true) {
+ profile_iterator.profiles[i].ProfileState = *profile_state;
+ __libnet_state_changed_cb(event_cb->ProfileName,
+ &profile_iterator.profiles[i], ap_state);
+ } else
+ __libnet_state_changed_cb(event_cb->ProfileName,
+ NULL, ap_state);
+ } else
__libnet_state_changed_cb(event_cb->ProfileName, NULL, ap_state);
break;
case NET_EVENT_WIFI_SCAN_RSP:
case NET_EVENT_WIFI_SCAN_IND:
- WIFI_LOG(WIFI_INFO, "Got Wi-Fi scan IND\n");
- __libnet_scan_cb(event_cb);
+ __libnet_scan_cb(event_cb, is_requested);
break;
case NET_EVENT_SPECIFIC_SCAN_RSP:
WIFI_LOG(WIFI_INFO, "Got Wi-Fi specific scan RSP\n");
return false;
__libnet_clear_profile_list(&profile_iterator);
- __libnet_clear_profile_list(&specific_profile_iterator);
g_slist_free_full(ap_handle_list, g_free);
ap_handle_list = NULL;
memset(&wifi_callbacks, 0, sizeof(struct _wifi_cb_s));
{
int rv = NET_ERR_NONE;
- rv = net_wifi_power_on();
+ rv = net_wifi_power_on(wifi_picker_test);
if (rv == NET_ERR_NONE) {
__libnet_set_activated_cb(callback, user_data);
return WIFI_ERROR_NONE;
case WIFI_ON:
*connection_state = WIFI_CONNECTION_STATE_DISCONNECTED;
break;
+ case WIFI_ASSOCIATION:
+ *connection_state = WIFI_CONNECTION_STATE_ASSOCIATION;
+ break;
+ case WIFI_CONFIGURATION:
+ *connection_state = WIFI_CONNECTION_STATE_CONFIGURATION;
+ break;
case WIFI_CONNECTED:
*connection_state = WIFI_CONNECTION_STATE_CONNECTED;
break;
wifi_scan_finished_cb callback, void *user_data)
{
int rv;
- rv = net_specific_scan_wifi(essid);
+ rv = net_specific_scan_wifi(essid);
- if (rv == NET_ERR_NONE) {
+ if (rv == NET_ERR_NONE) {
g_strlcpy(specific_profile_essid, essid, NET_WLAN_ESSID_LEN+1);
- wifi_callbacks.specific_scan_cb = callback;
- wifi_callbacks.specific_scan_user_data = user_data;
+ __libnet_set_specific_scan_cb(callback, user_data);
return WIFI_ERROR_NONE;
} else if (rv == NET_ERR_ACCESS_DENIED) {
WIFI_LOG(WIFI_ERROR, "Access denied");
rv = net_open_connection_with_profile(ap_info->ProfileName);
else if (valid_profile == true &&
ap_info->ProfileInfo.Wlan.is_hidden != TRUE &&
- ap_info->ProfileInfo.Wlan.security_info.sec_mode == WLAN_SEC_MODE_NONE)
+ ap_info->ProfileInfo.Wlan.security_info.sec_mode ==
+ WLAN_SEC_MODE_NONE)
rv = net_open_connection_with_profile(ap_info->ProfileName);
else
rv = __libnet_connect_with_wifi_info(ap_info);
return WIFI_ERROR_NONE;
}
+static void __wifi_idle_destroy_cb(gpointer data)
+{
+ if (!data)
+ return;
+
+ managed_idler_list = g_slist_remove(managed_idler_list, data);
+ g_free(data);
+}
+
+static gboolean __wifi_idle_cb(gpointer user_data)
+{
+ struct managed_idle_data *data = (struct managed_idle_data *)user_data;
+
+ if (!data)
+ return FALSE;
+
+ return data->func(data->user_data);
+}
+
+guint _wifi_callback_add(GSourceFunc func, gpointer user_data)
+{
+ guint id;
+ struct managed_idle_data *data;
+
+ if (!func)
+ return 0;
+
+ data = g_try_new0(struct managed_idle_data, 1);
+ if (!data)
+ return 0;
+
+ data->func = func;
+ data->user_data = user_data;
+
+ id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, __wifi_idle_cb, data,
+ __wifi_idle_destroy_cb);
+ if (!id) {
+ g_free(data);
+ return id;
+ }
+
+ data->id = id;
+
+ managed_idler_list = g_slist_append(managed_idler_list, data);
+
+ return id;
+}
+
void _wifi_callback_cleanup(void)
{
GSList *cur = managed_idler_list;
* limitations under the License.
*/
+#include <glib.h>
#include <stdio.h>
#include <string.h>
-#include <glib.h>
#include <vconf/vconf.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <glib.h>
#include "net_wifi_private.h"
-static wifi_rssi_level_changed_cb rssi_level_changed_cb = NULL;
-static void *rssi_level_changed_user_data = NULL;
+#define WIFI_MAC_ADD_LENGTH 17
+#define WIFI_MAC_ADD_PATH "/sys/class/net/wlan0/address"
+
+static __thread wifi_rssi_level_changed_cb rssi_level_changed_cb = NULL;
+static __thread void *rssi_level_changed_user_data = NULL;
+
+static gboolean __rssi_level_changed_cb_idle(gpointer data)
+{
+ int rssi_level = 0;
+
+ if (vconf_get_int(VCONFKEY_WIFI_STRENGTH, &rssi_level) != 0)
+ return FALSE;
+
+ if (rssi_level_changed_cb != NULL)
+ rssi_level_changed_cb(rssi_level, rssi_level_changed_user_data);
+
+ return FALSE;
+}
static void __rssi_level_changed_cb(keynode_t *node, void *user_data)
{
- int rssi_level = vconf_keynode_get_int(node);
- rssi_level_changed_cb(rssi_level, rssi_level_changed_user_data);
+ if (_wifi_is_init() != true) {
+ WIFI_LOG(WIFI_ERROR, "Application is not registered"
+ "If multi-threaded, thread integrity be broken.");
+ return;
+ }
+
+ if (rssi_level_changed_cb != NULL)
+ _wifi_callback_add(__rssi_level_changed_cb_idle, NULL);
}
EXPORT_API int wifi_initialize(void)
{
int rv;
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_is_init() == true) {
WIFI_LOG(WIFI_ERROR, "Already initialized");
return WIFI_ERROR_INVALID_OPERATION;
EXPORT_API int wifi_deinitialize(void)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_is_init() == false) {
WIFI_LOG(WIFI_ERROR, "Not initialized");
return WIFI_ERROR_INVALID_OPERATION;
{
int rv;
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_is_init() == false) {
WIFI_LOG(WIFI_ERROR, "Not initialized");
return WIFI_ERROR_INVALID_OPERATION;
{
int rv;
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_is_init() == false) {
WIFI_LOG(WIFI_ERROR, "Not initialized");
return WIFI_ERROR_INVALID_OPERATION;
{
int rv;
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_is_init() == false) {
WIFI_LOG(WIFI_ERROR, "Not initialized");
return WIFI_ERROR_INVALID_OPERATION;
int rv;
wifi_device_state_e device_state;
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (activated == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_get_mac_address(char** mac_address)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
+ FILE *fp = NULL;
+ char buf[WIFI_MAC_ADD_LENGTH+ 1];
+
if (mac_address == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
}
- *mac_address = vconf_get_str(VCONFKEY_WIFI_BSSID_ADDRESS);
+#if defined TIZEN_TV
+ if (0 == access(WIFI_MAC_ADD_PATH, F_OK))
+ fp = fopen(WIFI_MAC_ADD_PATH, "r");
+
+ if (fp == NULL) {
+ WIFI_LOG(WIFI_ERROR, "Failed to open file"
+ " %s\n", WIFI_MAC_ADD_PATH);
+ return WIFI_ERROR_OPERATION_FAILED;
+ }
+
+ if (fgets(buf, sizeof(buf), fp) == NULL) {
+ WIFI_LOG(WIFI_ERROR, "Failed to get MAC"
+ " info from %s\n", WIFI_MAC_ADD_PATH);
+ fclose(fp);
+ return WIFI_ERROR_OPERATION_FAILED;
+ }
+
+ WIFI_LOG(WIFI_INFO, "%s : %s\n", WIFI_MAC_ADD_PATH, buf);
+ *mac_address = (char *)g_try_malloc0(WIFI_MAC_ADD_LENGTH + 1);
if (*mac_address == NULL) {
- WIFI_LOG(WIFI_ERROR, "vconf_get_str Failed");
+ WIFI_LOG(WIFI_ERROR, "malloc() failed");
+ fclose(fp);
+ return WIFI_ERROR_OUT_OF_MEMORY;
+ }
+ g_strlcpy(*mac_address, buf, WIFI_MAC_ADD_LENGTH + 1);
+ fclose(fp);
+#else
+ *mac_address = vconf_get_str(VCONFKEY_WIFI_BSSID_ADDRESS);
+
+ if(*mac_address == NULL) {
+ WIFI_LOG(WIFI_ERROR, "Failed to get vconf"
+ " from %s", VCONFKEY_WIFI_BSSID_ADDRESS);
return WIFI_ERROR_OPERATION_FAILED;
}
+#endif
return WIFI_ERROR_NONE;
}
EXPORT_API int wifi_get_network_interface_name(char** name)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (name == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
{
int rv;
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (callback == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
{
int rv;
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (essid == NULL || callback == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
return rv;
}
+
+
EXPORT_API int wifi_get_connected_ap(wifi_ap_h* ap)
{
int rv;
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (ap == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_foreach_found_aps(wifi_found_ap_cb callback, void* user_data)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (callback == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_foreach_found_specific_aps(wifi_found_ap_cb callback, void* user_data)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (callback == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_connect(wifi_ap_h ap, wifi_connected_cb callback, void* user_data)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_is_init() == false) {
WIFI_LOG(WIFI_ERROR, "Not initialized");
return WIFI_ERROR_INVALID_OPERATION;
EXPORT_API int wifi_disconnect(wifi_ap_h ap, wifi_disconnected_cb callback, void* user_data)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_is_init() == false) {
WIFI_LOG(WIFI_ERROR, "Not initialized");
return WIFI_ERROR_INVALID_OPERATION;
}
if (_wifi_libnet_check_ap_validity(ap) == false) {
- WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+ WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
}
EXPORT_API int wifi_connect_by_wps_pbc(wifi_ap_h ap, wifi_connected_cb callback, void* user_data)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_is_init() == false) {
WIFI_LOG(WIFI_ERROR, "Not initialized");
return WIFI_ERROR_INVALID_OPERATION;
EXPORT_API int wifi_connect_by_wps_pin(wifi_ap_h ap, const char *pin, wifi_connected_cb callback, void* user_data)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_is_init() == false) {
WIFI_LOG(WIFI_ERROR, "Not initialized");
return WIFI_ERROR_INVALID_OPERATION;
EXPORT_API int wifi_forget_ap(wifi_ap_h ap)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_is_init() == false) {
WIFI_LOG(WIFI_ERROR, "Not initialized");
return WIFI_ERROR_INVALID_OPERATION;
EXPORT_API int wifi_get_connection_state(wifi_connection_state_e* connection_state)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (connection_state == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_set_device_state_changed_cb(wifi_device_state_changed_cb callback, void* user_data)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (callback == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_unset_device_state_changed_cb(void)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
return _wifi_unset_power_on_off_cb();
}
EXPORT_API int wifi_set_background_scan_cb(wifi_scan_finished_cb callback, void* user_data)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (callback == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_unset_background_scan_cb(void)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
return _wifi_unset_background_scan_cb();
}
EXPORT_API int wifi_set_connection_state_changed_cb(wifi_connection_state_changed_cb callback, void* user_data)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (callback == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_unset_connection_state_changed_cb(void)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
return _wifi_unset_connection_state_cb();
}
EXPORT_API int wifi_set_rssi_level_changed_cb(wifi_rssi_level_changed_cb callback, void* user_data)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (callback == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_unset_rssi_level_changed_cb(void)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (rssi_level_changed_cb != NULL)
vconf_ignore_key_changed(VCONFKEY_WIFI_STRENGTH, __rssi_level_changed_cb);
else
* limitations under the License.
*/
+#include <glib.h>
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
#include <arpa/inet.h>
-#include <glib.h>
+#include <netinet/in.h>
+
#include "net_wifi_private.h"
-static char* __ap_convert_ip_to_string(net_addr_t *ip_addr)
+#define MAX_PREFIX_LENGTH 6
+
+static char *__ap_convert_ip_to_string(net_addr_t *ip_addr, wifi_address_family_e address_family)
{
- unsigned char *ipaddr = (unsigned char *)&ip_addr->Data.Ipv4.s_addr;
+ unsigned char *ipaddr = NULL;
+ char *ipstr = NULL;
- char *ipstr = g_try_malloc0(16);
- if (ipstr == NULL)
- return NULL;
+ if (address_family == WIFI_ADDRESS_FAMILY_IPV4) {
+ ipaddr = (unsigned char *)&ip_addr->Data.Ipv4.s_addr;
+ ipstr = g_try_malloc0(INET_ADDRSTRLEN);
+ if (ipstr == NULL)
+ return NULL;
- g_snprintf(ipstr, 16, "%d.%d.%d.%d", ipaddr[0], ipaddr[1], ipaddr[2], ipaddr[3]);
+ inet_ntop(AF_INET, ipaddr, ipstr, INET_ADDRSTRLEN);
+ } else {
+ ipaddr = (unsigned char *)&ip_addr->Data.Ipv6;
+ ipstr = g_try_malloc0(INET6_ADDRSTRLEN);
+ if (ipstr == NULL)
+ return NULL;
+ inet_ntop(AF_INET6, ipaddr, ipstr, INET6_ADDRSTRLEN);
+ }
return ipstr;
}
profile_name = __wifi_create_profile_name(
ap_info->ProfileInfo.Wlan.is_hidden == TRUE ?
- NULL : ap_info->ProfileInfo.Wlan.essid,
+ NULL : ap_info->ProfileInfo.Wlan.essid,
ap_info->ProfileInfo.Wlan.wlan_mode,
ap_info->ProfileInfo.Wlan.security_info.sec_mode);
if (profile_name == NULL) {
/* Wi-Fi AP ******************************************************************/
EXPORT_API int wifi_ap_create(const char* essid, wifi_ap_h* ap)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (essid == NULL || ap == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_ap_hidden_create(const char* essid, wifi_ap_h* ap)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (essid == NULL || ap == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_ap_destroy(wifi_ap_h ap)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_ap_clone(wifi_ap_h* cloned_ap, wifi_ap_h origin)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(origin) == false || cloned_ap == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_ap_refresh(wifi_ap_h ap)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
net_profile_info_t ap_info_local;
net_profile_info_t *ap_info = ap;
/* Wi-Fi network information *************************************************/
EXPORT_API int wifi_ap_get_essid(wifi_ap_h ap, char** essid)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false || essid == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_ap_get_bssid(wifi_ap_h ap, char** bssid)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false || bssid == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_ap_get_rssi(wifi_ap_h ap, int* rssi)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false || rssi == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_ap_get_frequency(wifi_ap_h ap, int* frequency)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false || frequency == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_ap_get_max_speed(wifi_ap_h ap, int* max_speed)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false || max_speed == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_ap_is_favorite(wifi_ap_h ap, bool* favorite)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false || favorite == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_ap_is_passpoint(wifi_ap_h ap, bool* passpoint)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false || passpoint == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_ap_get_connection_state(wifi_ap_h ap, wifi_connection_state_e* state)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false || state == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_ap_get_ip_config_type(wifi_ap_h ap, wifi_address_family_e address_family, wifi_ip_config_type_e* type)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+ net_ip_config_type_t profileType ;
+
if (_wifi_libnet_check_ap_validity(ap) == false ||
(address_family != WIFI_ADDRESS_FAMILY_IPV4 &&
address_family != WIFI_ADDRESS_FAMILY_IPV6) ||
return WIFI_ERROR_INVALID_PARAMETER;
}
- if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
- WIFI_LOG(WIFI_ERROR, "Not supported yet");
- return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED;
+ net_profile_info_t *profile_info = ap;
+
+ if (address_family == WIFI_ADDRESS_FAMILY_IPV4){
+ profileType = profile_info->ProfileInfo.Wlan.net_info.IpConfigType ;
+ } else {
+ profileType = profile_info->ProfileInfo.Wlan.net_info.IpConfigType6 ;
}
- net_profile_info_t *profile_info = ap;
+ if (address_family == WIFI_ADDRESS_FAMILY_IPV4) {
+ switch (profileType) {
+ case NET_IP_CONFIG_TYPE_STATIC:
+ *type = WIFI_IP_CONFIG_TYPE_STATIC;
+ break;
- switch (profile_info->ProfileInfo.Wlan.net_info.IpConfigType) {
- case NET_IP_CONFIG_TYPE_STATIC:
- *type = WIFI_IP_CONFIG_TYPE_STATIC;
- break;
- case NET_IP_CONFIG_TYPE_DYNAMIC:
- *type = WIFI_IP_CONFIG_TYPE_DYNAMIC;
- break;
- case NET_IP_CONFIG_TYPE_AUTO_IP:
- *type = WIFI_IP_CONFIG_TYPE_AUTO;
- break;
- case NET_IP_CONFIG_TYPE_FIXED:
- *type = WIFI_IP_CONFIG_TYPE_FIXED;
- break;
- case NET_IP_CONFIG_TYPE_OFF:
- *type = WIFI_IP_CONFIG_TYPE_NONE;
- break;
- default:
- return WIFI_ERROR_OPERATION_FAILED;
+ case NET_IP_CONFIG_TYPE_DYNAMIC:
+ *type = WIFI_IP_CONFIG_TYPE_DYNAMIC;
+ break;
+
+ case NET_IP_CONFIG_TYPE_AUTO_IP:
+ *type = WIFI_IP_CONFIG_TYPE_AUTO;
+ break;
+
+ case NET_IP_CONFIG_TYPE_FIXED:
+ *type = WIFI_IP_CONFIG_TYPE_FIXED;
+ break;
+
+ case NET_IP_CONFIG_TYPE_OFF:
+ *type = WIFI_IP_CONFIG_TYPE_NONE;
+ break;
+
+ default:
+ return WIFI_ERROR_OPERATION_FAILED;
+ }
+ } else {
+ switch (profileType) {
+ case NET_IP_CONFIG_TYPE_STATIC:
+ *type = WIFI_IP_CONFIG_TYPE_STATIC;
+ break;
+ case NET_IP_CONFIG_TYPE_AUTO_IP:
+ *type = WIFI_IP_CONFIG_TYPE_AUTO;
+ break;
+ case NET_IP_CONFIG_TYPE_OFF:
+ *type = WIFI_IP_CONFIG_TYPE_NONE;
+ break;
+ default:
+ return WIFI_ERROR_OPERATION_FAILED;
+ }
}
return WIFI_ERROR_NONE;
EXPORT_API int wifi_ap_set_ip_config_type(wifi_ap_h ap, wifi_address_family_e address_family, wifi_ip_config_type_e type)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+ net_ip_config_type_t *profileType = NULL;
+
if (_wifi_libnet_check_ap_validity(ap) == false ||
(address_family != WIFI_ADDRESS_FAMILY_IPV4 &&
address_family != WIFI_ADDRESS_FAMILY_IPV6)) {
return WIFI_ERROR_INVALID_PARAMETER;
}
- if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
- WIFI_LOG(WIFI_ERROR, "Not supported yet");
- return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED;
+ net_profile_info_t *profile_info = ap;
+
+ if (address_family == WIFI_ADDRESS_FAMILY_IPV4) {
+ profileType = &profile_info->ProfileInfo.Wlan.net_info.IpConfigType ;
+ } else {
+ profileType = &profile_info->ProfileInfo.Wlan.net_info.IpConfigType6 ;
}
- net_profile_info_t *profile_info = ap;
+ if (address_family == WIFI_ADDRESS_FAMILY_IPV4) {
+ switch (type) {
+ case WIFI_IP_CONFIG_TYPE_STATIC:
+ *profileType = NET_IP_CONFIG_TYPE_STATIC;
+ profile_info->ProfileInfo.Wlan.net_info.IpAddr.Data.Ipv4.s_addr = 0;
+ profile_info->ProfileInfo.Wlan.net_info.SubnetMask.Data.Ipv4.s_addr = 0;
+ profile_info->ProfileInfo.Wlan.net_info.GatewayAddr.Data.Ipv4.s_addr = 0 ;
+ break;
- switch (type) {
- case WIFI_IP_CONFIG_TYPE_STATIC:
- profile_info->ProfileInfo.Wlan.net_info.IpConfigType = NET_IP_CONFIG_TYPE_STATIC;
- break;
- case WIFI_IP_CONFIG_TYPE_DYNAMIC:
- profile_info->ProfileInfo.Wlan.net_info.IpConfigType = NET_IP_CONFIG_TYPE_DYNAMIC;
- break;
- case WIFI_IP_CONFIG_TYPE_AUTO:
- profile_info->ProfileInfo.Wlan.net_info.IpConfigType = NET_IP_CONFIG_TYPE_AUTO_IP;
- break;
- case WIFI_IP_CONFIG_TYPE_FIXED:
- profile_info->ProfileInfo.Wlan.net_info.IpConfigType = NET_IP_CONFIG_TYPE_FIXED;
- break;
- case WIFI_IP_CONFIG_TYPE_NONE:
- profile_info->ProfileInfo.Wlan.net_info.IpConfigType = NET_IP_CONFIG_TYPE_OFF;
- break;
- default:
- return WIFI_ERROR_INVALID_PARAMETER;
+ case WIFI_IP_CONFIG_TYPE_DYNAMIC:
+ *profileType = NET_IP_CONFIG_TYPE_DYNAMIC;
+ break;
+
+ case WIFI_IP_CONFIG_TYPE_AUTO:
+ *profileType = NET_IP_CONFIG_TYPE_AUTO_IP;
+ break;
+
+ case WIFI_IP_CONFIG_TYPE_FIXED:
+ *profileType = NET_IP_CONFIG_TYPE_FIXED;
+ break;
+
+ case WIFI_IP_CONFIG_TYPE_NONE:
+ *profileType = NET_IP_CONFIG_TYPE_OFF;
+ break;
+
+ default:
+ return WIFI_ERROR_INVALID_PARAMETER;
+ }
+ } else {
+ switch (type) {
+ case WIFI_IP_CONFIG_TYPE_STATIC:
+ *profileType = NET_IP_CONFIG_TYPE_STATIC;
+ inet_pton(AF_INET6, "::", &profile_info->ProfileInfo.Wlan.net_info.IpAddr6.Data.Ipv6);
+ profile_info->ProfileInfo.Wlan.net_info.PrefixLen6 = 0 ;
+ inet_pton(AF_INET6, "::", &profile_info->ProfileInfo.Wlan.net_info.GatewayAddr6.Data.Ipv6);
+ break;
+ case WIFI_IP_CONFIG_TYPE_AUTO:
+ *profileType = NET_IP_CONFIG_TYPE_AUTO_IP;
+ break;
+ case WIFI_IP_CONFIG_TYPE_NONE:
+ *profileType = NET_IP_CONFIG_TYPE_OFF;
+ break;
+ default:
+ return WIFI_ERROR_INVALID_PARAMETER;
+ }
}
if (_wifi_libnet_check_profile_name_validity(profile_info->ProfileName) == false)
EXPORT_API int wifi_ap_get_ip_address(wifi_ap_h ap, wifi_address_family_e address_family, char** ip_address)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false ||
(address_family != WIFI_ADDRESS_FAMILY_IPV4 &&
address_family != WIFI_ADDRESS_FAMILY_IPV6) ||
return WIFI_ERROR_INVALID_PARAMETER;
}
- if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
- WIFI_LOG(WIFI_ERROR, "Not supported yet");
- return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED;
- }
-
net_profile_info_t *profile_info = ap;
- *ip_address = __ap_convert_ip_to_string(&profile_info->ProfileInfo.Wlan.net_info.IpAddr);
+ if (address_family == WIFI_ADDRESS_FAMILY_IPV4)
+ *ip_address = __ap_convert_ip_to_string(
+ &profile_info->ProfileInfo.Wlan.net_info.IpAddr,
+ address_family);
+ else
+ *ip_address = __ap_convert_ip_to_string(
+ &profile_info->ProfileInfo.Wlan.net_info.IpAddr6,
+ address_family);
+
if (*ip_address == NULL)
return WIFI_ERROR_OUT_OF_MEMORY;
EXPORT_API int wifi_ap_set_ip_address(wifi_ap_h ap, wifi_address_family_e address_family, const char* ip_address)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false ||
(address_family != WIFI_ADDRESS_FAMILY_IPV4 &&
address_family != WIFI_ADDRESS_FAMILY_IPV6)) {
return WIFI_ERROR_INVALID_PARAMETER;
}
- if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
- WIFI_LOG(WIFI_ERROR, "Not supported yet");
- return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED;
- }
-
net_profile_info_t *profile_info = ap;
- if (ip_address == NULL)
- profile_info->ProfileInfo.Wlan.net_info.IpAddr.Data.Ipv4.s_addr = 0;
- else if (inet_aton(ip_address, &(profile_info->ProfileInfo.Wlan.net_info.IpAddr.Data.Ipv4)) == 0)
- return WIFI_ERROR_INVALID_PARAMETER;
+ if (address_family == WIFI_ADDRESS_FAMILY_IPV4) {
+ if (ip_address == NULL)
+ profile_info->ProfileInfo.Wlan.net_info.IpAddr.Data.Ipv4.s_addr = 0;
+ else if (inet_aton(ip_address,
+ &(profile_info->ProfileInfo.Wlan.net_info.IpAddr.Data.Ipv4)) == 0)
+ return WIFI_ERROR_INVALID_PARAMETER;
+ } else {
+ if (ip_address == NULL)
+ inet_pton(AF_INET6, "::",
+ &profile_info->ProfileInfo.Wlan.net_info.IpAddr6.Data.Ipv6);
+ else if (inet_pton(AF_INET6, ip_address,
+ &profile_info->ProfileInfo.Wlan.net_info.IpAddr6.Data.Ipv6) == 0)
+ return WIFI_ERROR_INVALID_PARAMETER;
+ }
if (_wifi_libnet_check_profile_name_validity(profile_info->ProfileName) == false)
return WIFI_ERROR_NONE;
EXPORT_API int wifi_ap_get_subnet_mask(wifi_ap_h ap, wifi_address_family_e address_family, char** subnet_mask)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+ char* prefixlen;
+
if (_wifi_libnet_check_ap_validity(ap) == false ||
(address_family != WIFI_ADDRESS_FAMILY_IPV4 &&
address_family != WIFI_ADDRESS_FAMILY_IPV6) ||
return WIFI_ERROR_INVALID_PARAMETER;
}
- if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
- WIFI_LOG(WIFI_ERROR, "Not supported yet");
- return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED;
+ net_profile_info_t *profile_info = ap;
+ if (address_family == WIFI_ADDRESS_FAMILY_IPV4)
+ *subnet_mask = __ap_convert_ip_to_string(
+ &profile_info->ProfileInfo.Wlan.net_info.SubnetMask,
+ address_family);
+ else {
+ prefixlen = g_try_malloc0(MAX_PREFIX_LENGTH);
+ if (prefixlen != NULL) {
+ snprintf(prefixlen, MAX_PREFIX_LENGTH, "%d",
+ profile_info->ProfileInfo.Wlan.net_info.PrefixLen6);
+ *subnet_mask = prefixlen;
+ } else
+ *subnet_mask = NULL;
}
- net_profile_info_t *profile_info = ap;
- *subnet_mask = __ap_convert_ip_to_string(&profile_info->ProfileInfo.Wlan.net_info.SubnetMask);
if (*subnet_mask == NULL)
return WIFI_ERROR_OUT_OF_MEMORY;
EXPORT_API int wifi_ap_set_subnet_mask(wifi_ap_h ap, wifi_address_family_e address_family, const char* subnet_mask)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false ||
(address_family != WIFI_ADDRESS_FAMILY_IPV4 &&
address_family != WIFI_ADDRESS_FAMILY_IPV6)) {
return WIFI_ERROR_INVALID_PARAMETER;
}
- if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
- WIFI_LOG(WIFI_ERROR, "Not supported yet");
- return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED;
- }
-
net_profile_info_t *profile_info = ap;
- if (subnet_mask == NULL)
- profile_info->ProfileInfo.Wlan.net_info.SubnetMask.Data.Ipv4.s_addr = 0;
- else if (inet_aton(subnet_mask, &(profile_info->ProfileInfo.Wlan.net_info.SubnetMask.Data.Ipv4)) == 0)
- return WIFI_ERROR_INVALID_PARAMETER;
+ /* Based on the family of address provided subnet mask should be set.
+ * For IPv6 address subnet mask is prefix length, an integer, while for
+ * Ipv6 address subnet mask is a ipv6 address.
+ */
+ if (address_family == WIFI_ADDRESS_FAMILY_IPV6){
+ if (subnet_mask == NULL)
+ profile_info->ProfileInfo.Wlan.net_info.PrefixLen6 = 0;
+ else {
+ /* subnet mask provided as input parameter is a string
+ * while for IPv6 address subnet mask in prefix length
+ * which should be in integer form */
+ profile_info->ProfileInfo.Wlan.net_info.PrefixLen6 =
+ atoi(subnet_mask) ;
+ }
+ } else {
+ if (subnet_mask == NULL)
+ profile_info->ProfileInfo.Wlan.net_info.SubnetMask.Data.Ipv4.s_addr = 0;
+ else if (inet_pton(AF_INET, subnet_mask,
+ &(profile_info->ProfileInfo.Wlan.net_info.SubnetMask.Data.Ipv4)) < 1)
+ return WIFI_ERROR_INVALID_PARAMETER;
+ }
+
if (_wifi_libnet_check_profile_name_validity(profile_info->ProfileName) == false)
return WIFI_ERROR_NONE;
EXPORT_API int wifi_ap_get_gateway_address(wifi_ap_h ap, wifi_address_family_e address_family, char** gateway_address)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false ||
(address_family != WIFI_ADDRESS_FAMILY_IPV4 &&
address_family != WIFI_ADDRESS_FAMILY_IPV6) ||
return WIFI_ERROR_INVALID_PARAMETER;
}
- if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
- WIFI_LOG(WIFI_ERROR, "Not supported yet");
- return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED;
- }
-
net_profile_info_t *profile_info = ap;
- *gateway_address = __ap_convert_ip_to_string(&profile_info->ProfileInfo.Wlan.net_info.GatewayAddr);
+
+ /* Based on the family of address provided, gateway should be set.
+ * For IPv6 address gateway is of form GatewayAddr6 but for IPv4
+ * gateway is of form GatewayAddr.
+ */
+ if (address_family == WIFI_ADDRESS_FAMILY_IPV4)
+ *gateway_address = __ap_convert_ip_to_string(
+ &profile_info->ProfileInfo.Wlan.net_info.GatewayAddr,
+ address_family);
+ else
+ *gateway_address = __ap_convert_ip_to_string(
+ &profile_info->ProfileInfo.Wlan.net_info.GatewayAddr6,
+ address_family);
+
if (*gateway_address == NULL)
return WIFI_ERROR_OUT_OF_MEMORY;
EXPORT_API int wifi_ap_set_gateway_address(wifi_ap_h ap, wifi_address_family_e address_family, const char* gateway_address)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false ||
(address_family != WIFI_ADDRESS_FAMILY_IPV4 &&
address_family != WIFI_ADDRESS_FAMILY_IPV6)) {
return WIFI_ERROR_INVALID_PARAMETER;
}
+ net_profile_info_t *profile_info = ap;
if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
- WIFI_LOG(WIFI_ERROR, "Not supported yet");
- return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED;
+ if (gateway_address == NULL)
+ inet_pton(AF_INET6, "::",
+ &profile_info->ProfileInfo.Wlan.net_info.GatewayAddr6.Data.Ipv6);
+ else if (inet_pton(AF_INET6, gateway_address,
+ &profile_info->ProfileInfo.Wlan.net_info.GatewayAddr6.Data.Ipv6) < 1)
+ return WIFI_ERROR_INVALID_PARAMETER;
+ } else {
+ if (gateway_address == NULL)
+ profile_info->ProfileInfo.Wlan.net_info.GatewayAddr.Data.Ipv4.s_addr = 0;
+ else if (inet_pton(AF_INET, gateway_address,
+ &profile_info->ProfileInfo.Wlan.net_info.GatewayAddr.Data.Ipv4) < 1)
+ return WIFI_ERROR_INVALID_PARAMETER;
}
- net_profile_info_t *profile_info = ap;
-
- if (gateway_address == NULL)
- profile_info->ProfileInfo.Wlan.net_info.GatewayAddr.Data.Ipv4.s_addr = 0;
- else if (inet_aton(gateway_address, &(profile_info->ProfileInfo.Wlan.net_info.GatewayAddr.Data.Ipv4)) == 0)
- return WIFI_ERROR_INVALID_PARAMETER;
-
if (_wifi_libnet_check_profile_name_validity(profile_info->ProfileName) == false)
return WIFI_ERROR_NONE;
EXPORT_API int wifi_ap_get_proxy_address(wifi_ap_h ap, wifi_address_family_e address_family, char** proxy_address)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false ||
(address_family != WIFI_ADDRESS_FAMILY_IPV4 &&
address_family != WIFI_ADDRESS_FAMILY_IPV6) ||
return WIFI_ERROR_INVALID_PARAMETER;
}
- if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
- WIFI_LOG(WIFI_ERROR, "Not supported yet");
- return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED;
- }
-
net_profile_info_t *profile_info = ap;
*proxy_address = g_strdup(profile_info->ProfileInfo.Wlan.net_info.ProxyAddr);
if (*proxy_address == NULL)
EXPORT_API int wifi_ap_set_proxy_address(wifi_ap_h ap, wifi_address_family_e address_family, const char* proxy_address)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false ||
(address_family != WIFI_ADDRESS_FAMILY_IPV4 &&
address_family != WIFI_ADDRESS_FAMILY_IPV6)) {
return WIFI_ERROR_INVALID_PARAMETER;
}
- if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
- WIFI_LOG(WIFI_ERROR, "Not supported yet");
- return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED;
- }
-
net_profile_info_t *profile_info = ap;
if (proxy_address == NULL)
EXPORT_API int wifi_ap_get_proxy_type(wifi_ap_h ap, wifi_proxy_type_e* type)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false || type == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_ap_set_proxy_type(wifi_ap_h ap, wifi_proxy_type_e proxy_type)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_ap_get_dns_address(wifi_ap_h ap, int order, wifi_address_family_e address_family, char** dns_address)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false ||
(address_family != WIFI_ADDRESS_FAMILY_IPV4 &&
address_family != WIFI_ADDRESS_FAMILY_IPV6) ||
return WIFI_ERROR_INVALID_PARAMETER;
}
- if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
- WIFI_LOG(WIFI_ERROR, "Not supported yet");
- return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED;
- }
-
net_profile_info_t *profile_info = ap;
- *dns_address = __ap_convert_ip_to_string(&profile_info->ProfileInfo.Wlan.net_info.DnsAddr[order-1]);
+ if(address_family == WIFI_ADDRESS_FAMILY_IPV4)
+ *dns_address = __ap_convert_ip_to_string(
+ &profile_info->ProfileInfo.Wlan.net_info.DnsAddr[order-1],
+ address_family);
+ else
+ *dns_address = __ap_convert_ip_to_string(
+ &profile_info->ProfileInfo.Wlan.net_info.DnsAddr6[order-1],
+ address_family);
+
if (*dns_address == NULL)
return WIFI_ERROR_OUT_OF_MEMORY;
EXPORT_API int wifi_ap_set_dns_address(wifi_ap_h ap, int order, wifi_address_family_e address_family, const char* dns_address)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false ||
(address_family != WIFI_ADDRESS_FAMILY_IPV4 &&
address_family != WIFI_ADDRESS_FAMILY_IPV6) ||
return WIFI_ERROR_INVALID_PARAMETER;
}
- if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
- WIFI_LOG(WIFI_ERROR, "Not supported yet");
- return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED;
- }
-
net_profile_info_t *profile_info = ap;
- if (dns_address == NULL)
- profile_info->ProfileInfo.Wlan.net_info.DnsAddr[order-1].Data.Ipv4.s_addr = 0;
- else if (inet_aton(dns_address, &(profile_info->ProfileInfo.Wlan.net_info.DnsAddr[order-1].Data.Ipv4)) == 0)
- return WIFI_ERROR_INVALID_PARAMETER;
+ if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
+ profile_info->ProfileInfo.Wlan.net_info.DnsAddr6[order-1].Type =
+ NET_ADDR_IPV6;
+ if (dns_address == NULL)
+ inet_pton(AF_INET6, "::",
+ &profile_info->ProfileInfo.Wlan.net_info.DnsAddr6[order-1].Data.Ipv6);
+ else if (inet_pton(AF_INET6, dns_address,
+ &profile_info->ProfileInfo.Wlan.net_info.DnsAddr6[order-1].Data.Ipv6) < 1)
+ return WIFI_ERROR_INVALID_PARAMETER;
+
+ if (profile_info->ProfileInfo.Wlan.net_info.DnsCount6 < order)
+ profile_info->ProfileInfo.Wlan.net_info.DnsCount6 = order;
+ } else {
+ profile_info->ProfileInfo.Wlan.net_info.DnsAddr[order-1].Type =
+ NET_ADDR_IPV4;
+ if (dns_address == NULL)
+ profile_info->ProfileInfo.Wlan.net_info.DnsAddr[order-1].Data.Ipv4.s_addr = 0;
+ else if (inet_pton(AF_INET, dns_address,
+ &(profile_info->ProfileInfo.Wlan.net_info.DnsAddr[order-1].Data.Ipv4)) < 1)
+ return WIFI_ERROR_INVALID_PARAMETER;
- if (profile_info->ProfileInfo.Wlan.net_info.DnsCount < order)
- profile_info->ProfileInfo.Wlan.net_info.DnsCount = order;
+ if (profile_info->ProfileInfo.Wlan.net_info.DnsCount < order)
+ profile_info->ProfileInfo.Wlan.net_info.DnsCount = order;
+ }
if (_wifi_libnet_check_profile_name_validity(profile_info->ProfileName) == false)
return WIFI_ERROR_NONE;
/* Wi-Fi security information ************************************************/
EXPORT_API int wifi_ap_get_security_type(wifi_ap_h ap, wifi_security_type_e* type)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false || type == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_ap_set_security_type(wifi_ap_h ap, wifi_security_type_e type)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_ap_get_encryption_type(wifi_ap_h ap, wifi_encryption_type_e* type)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false || type == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_ap_set_encryption_type(wifi_ap_h ap, wifi_encryption_type_e type)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_ap_is_passphrase_required(wifi_ap_h ap, bool* required)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false || required == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
switch (profile_info->ProfileInfo.Wlan.security_info.sec_mode) {
case WLAN_SEC_MODE_NONE:
- case WLAN_SEC_MODE_IEEE8021X:
*required = false;
break;
case WLAN_SEC_MODE_WEP:
+ case WLAN_SEC_MODE_IEEE8021X:
case WLAN_SEC_MODE_WPA_PSK:
case WLAN_SEC_MODE_WPA2_PSK:
*required = true;
EXPORT_API int wifi_ap_set_passphrase(wifi_ap_h ap, const char* passphrase)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false || passphrase == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_ap_is_wps_supported(wifi_ap_h ap, bool* supported)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false || supported == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
/* Wi-Fi EAP *****************************************************************/
EXPORT_API int wifi_ap_set_eap_passphrase(wifi_ap_h ap, const char* user_name, const char* password)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false || (user_name == NULL && password == NULL)) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_ap_get_eap_passphrase(wifi_ap_h ap, char** user_name, bool* is_password_set)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false ||user_name == NULL || is_password_set == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
{
net_profile_info_t *profile_info = NULL;
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false || file == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
{
net_profile_info_t *profile_info = NULL;
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false || file == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
{
net_profile_info_t *profile_info = NULL;
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false || file == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
{
net_profile_info_t *profile_info = NULL;
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false || file == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_ap_get_eap_private_key_file(wifi_ap_h ap, char** file)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false || file == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_ap_set_eap_private_key_info(wifi_ap_h ap, const char* file, const char* password)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false || file == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_ap_get_eap_type(wifi_ap_h ap, wifi_eap_type_e* type)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false || type == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_ap_set_eap_type(wifi_ap_h ap, wifi_eap_type_e type)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_ap_get_eap_auth_type(wifi_ap_h ap, wifi_eap_auth_type_e* type)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false || type == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
EXPORT_API int wifi_ap_set_eap_auth_type(wifi_ap_h ap, wifi_eap_auth_type_e type)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (_wifi_libnet_check_ap_validity(ap) == false) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
+PROJECT(wifi_test C)
+
SET(fw_test "${fw_name}-test")
SET(dependents "capi-base-common glib-2.0 network")
+SET(pc_dependents "capi-base-common")
INCLUDE(FindPkgConfig)
pkg_check_modules(${fw_test} REQUIRED ${dependents})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -fPIE")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
aux_source_directory(. sources)
FOREACH(src ${sources})
ADD_EXECUTABLE(${src_name} ${src})
TARGET_LINK_LIBRARIES(${src_name} ${fw_name} ${${fw_test}_LDFLAGS})
ENDFOREACH()
+
INSTALL(TARGETS wifi_test RUNTIME DESTINATION bin/)
static void __test_scan_request_callback(wifi_error_e error_code, void* user_data)
{
+ if(user_data != NULL)
+ printf("user_data : %s\n", (char *)user_data);
+
printf("Scan Completed from scan request, error code : %s\n",
__test_convert_error_to_string(error_code));
}
if (result == WIFI_ERROR_NONE)
printf("Wi-Fi Activation Succeeded\n");
else
- printf("Wi-Fi Activation Failed! error : %s", __test_convert_error_to_string(result));
+ printf("Wi-Fi Activation Failed! error : %s\n", __test_convert_error_to_string(result));
}
static void __test_deactivated_callback(wifi_error_e result, void* user_data)
if (result == WIFI_ERROR_NONE)
printf("Wi-Fi Deactivation Succeeded\n");
else
- printf("Wi-Fi Deactivation Failed! error : %s", __test_convert_error_to_string(result));
+ printf("Wi-Fi Deactivation Failed! error : %s\n", __test_convert_error_to_string(result));
}
static void __test_connected_callback(wifi_error_e result, void* user_data)
if (result == WIFI_ERROR_NONE)
printf("Wi-Fi Connection Succeeded\n");
else
- printf("Wi-Fi Connection Failed! error : %s", __test_convert_error_to_string(result));
+ printf("Wi-Fi Connection Failed! error : %s\n", __test_convert_error_to_string(result));
}
static void __test_disconnected_callback(wifi_error_e result, void* user_data)
if (result == WIFI_ERROR_NONE)
printf("Wi-Fi Disconnection Succeeded\n");
else
- printf("Wi-Fi Disconnection Failed! error : %s", __test_convert_error_to_string(result));
+ printf("Wi-Fi Disconnection Failed! error : %s\n", __test_convert_error_to_string(result));
}
static void __test_rssi_level_callback(wifi_rssi_level_e rssi_level, void* user_data)
if (strstr(ap_name, ap_name_part) != NULL) {
bool required = false;
- wifi_ap_is_passphrase_required(ap, &required);
+
+ if (wifi_ap_is_passphrase_required(ap, &required) == WIFI_ERROR_NONE)
+ printf("Passphrase required : %s\n", required ? "TRUE" : "FALSE");
+ else
+ printf("Fail to get Passphrase required\n");
if (required) {
char passphrase[100];
}
if (strstr(ap_name, ap_name_part) != NULL) {
- wifi_security_type_e type;;
- wifi_ap_get_security_type(ap, &type);
+ wifi_security_type_e type;
+
+ if (wifi_ap_get_security_type(ap, &type) == WIFI_ERROR_NONE)
+ printf("Security type : %d\n", type);
+ else
+ printf("Fail to get Security type\n");
if (type != WIFI_SECURITY_TYPE_EAP) {
g_free(ap_name);
return true;
}
+static bool test_get_user_int(const char *msg, int *num)
+{
+ if (msg == NULL || num == NULL)
+ return false;
+
+ int rv;
+ char buf[32] = {0,};
+ printf("%s\n", msg);
+ rv = read(0, buf, 32);
+
+ if (rv < 0 || *buf == 0 || *buf == '\n' || *buf == '\r')
+ return false;
+
+ *num = atoi(buf);
+ return true;
+}
+
static bool __test_found_change_ip_method_callback(wifi_ap_h ap, void *user_data)
{
int rv;
if (strstr(ap_name, ap_name_part) != NULL) {
wifi_ip_config_type_e type;
int method;
+ int address_type;
printf("Input new method type (1:dhcp, 2:manual, 3:auto) :\n");
rv = scanf("%9d", &method);
return false;
}
+ rv = test_get_user_int("Input Address type to get"
+ "(0:IPV4, 1:IPV6):", &address_type);
+
+ if (rv == false || (address_type != 0 && address_type != 1)) {
+ printf("Invalid input!!\n");
+ return false;
+ }
+
switch (method) {
case 1:
type = WIFI_IP_CONFIG_TYPE_DYNAMIC;
return false;
}
- rv = wifi_ap_set_ip_config_type(ap, WIFI_ADDRESS_FAMILY_IPV4, type);
+ rv = wifi_ap_set_ip_config_type(ap, address_type, type);
if (rv != WIFI_ERROR_NONE)
printf("Fail to set ip method type[%s]\n", __test_convert_error_to_string(rv));
rv = WIFI_ERROR_NONE;
break;
case '0':
- rv = wifi_ap_set_ip_address(ap, WIFI_ADDRESS_FAMILY_IPV4, NULL);
+ rv = wifi_ap_set_ip_address(ap, address_type, NULL);
break;
default:
- rv = wifi_ap_set_ip_address(ap, WIFI_ADDRESS_FAMILY_IPV4, ip_addr);
+ rv = wifi_ap_set_ip_address(ap, address_type, ip_addr);
}
if (rv != WIFI_ERROR_NONE)
rv = WIFI_ERROR_NONE;
break;
case '0':
- rv = wifi_ap_set_subnet_mask(ap, WIFI_ADDRESS_FAMILY_IPV4, NULL);
+ rv = wifi_ap_set_subnet_mask(ap, address_type, NULL);
break;
default:
- rv = wifi_ap_set_subnet_mask(ap, WIFI_ADDRESS_FAMILY_IPV4, ip_addr);
+ rv = wifi_ap_set_subnet_mask(ap, address_type, ip_addr);
}
if (rv != WIFI_ERROR_NONE)
rv = WIFI_ERROR_NONE;
break;
case '0':
- rv = wifi_ap_set_gateway_address(ap, WIFI_ADDRESS_FAMILY_IPV4, NULL);
+ rv = wifi_ap_set_gateway_address(ap, address_type, NULL);
break;
default:
- rv = wifi_ap_set_gateway_address(ap, WIFI_ADDRESS_FAMILY_IPV4, ip_addr);
+ rv = wifi_ap_set_gateway_address(ap, address_type, ip_addr);
}
if (rv != WIFI_ERROR_NONE)
static bool __test_found_change_proxy_method_callback(wifi_ap_h ap, void *user_data)
{
- int rv;
+ int rv, address_type;
char *ap_name;
char *ap_name_part = (char*)user_data;
return false;
}
+ rv = test_get_user_int("Input Address type to get"
+ "(0:IPV4, 1:IPV6):", &address_type);
+
+ if (rv == false || (address_type != 0 && address_type != 1)) {
+ printf("Invalid input!!\n");
+ return false;
+ }
+
switch (method) {
case 1:
type = WIFI_PROXY_TYPE_DIRECT;
rv = WIFI_ERROR_NONE;
break;
case '0':
- rv = wifi_ap_set_proxy_address(ap, WIFI_ADDRESS_FAMILY_IPV4, NULL);
+ rv = wifi_ap_set_proxy_address(ap, address_type, NULL);
break;
default:
- rv = wifi_ap_set_proxy_address(ap, WIFI_ADDRESS_FAMILY_IPV4, proxy_addr);
+ rv = wifi_ap_set_proxy_address(ap, address_type, proxy_addr);
}
if (rv != WIFI_ERROR_NONE)
static bool __test_found_print_ap_info_callback(wifi_ap_h ap, void *user_data)
{
- int rv;
+ int rv, address_type = 0;
char *ap_name;
char *str_value;
int int_value;
else
printf("Fail to get Connection State\n");
- if (wifi_ap_get_ip_config_type(ap, WIFI_ADDRESS_FAMILY_IPV4, &ip_type) == WIFI_ERROR_NONE)
+ rv = test_get_user_int("Input Address type to get"
+ "(0:IPV4, 1:IPV6):", &address_type);
+
+ if (rv == false || (address_type != 0 && address_type != 1)) {
+ printf("Invalid input!!\n");
+ return false;
+ }
+
+ if (wifi_ap_get_ip_config_type(ap, address_type, &ip_type) == WIFI_ERROR_NONE)
printf("IP config type : %d\n", ip_type);
else
printf("Fail to get IP config type\n");
- if (wifi_ap_get_ip_address(ap, WIFI_ADDRESS_FAMILY_IPV4, &str_value) == WIFI_ERROR_NONE) {
+ if (wifi_ap_get_ip_address(ap, address_type, &str_value) == WIFI_ERROR_NONE) {
printf("IP : %s\n", str_value);
g_free(str_value);
} else
printf("Fail to get IP\n");
- if (wifi_ap_get_subnet_mask(ap, WIFI_ADDRESS_FAMILY_IPV4, &str_value) == WIFI_ERROR_NONE) {
+ if (wifi_ap_get_subnet_mask(ap, address_type, &str_value) == WIFI_ERROR_NONE) {
printf("Subnet mask : %s\n", str_value);
g_free(str_value);
} else
printf("Fail to get Subnet mask\n");
- if (wifi_ap_get_gateway_address(ap, WIFI_ADDRESS_FAMILY_IPV4, &str_value) == WIFI_ERROR_NONE) {
+ if (wifi_ap_get_gateway_address(ap, address_type, &str_value) == WIFI_ERROR_NONE) {
printf("Gateway : %s\n", str_value);
g_free(str_value);
} else
else
printf("Fail to get Proxy type\n");
- if (wifi_ap_get_proxy_address(ap, WIFI_ADDRESS_FAMILY_IPV4, &str_value) == WIFI_ERROR_NONE) {
+ if (wifi_ap_get_proxy_address(ap, address_type, &str_value) == WIFI_ERROR_NONE) {
printf("Proxy : %s\n", str_value);
g_free(str_value);
} else
printf("Fail to get Proxy\n");
- if (wifi_ap_get_dns_address(ap, 1, WIFI_ADDRESS_FAMILY_IPV4, &str_value) == WIFI_ERROR_NONE) {
+ if (wifi_ap_get_dns_address(ap, 1, address_type, &str_value) == WIFI_ERROR_NONE) {
printf("DNS1 : %s\n", str_value);
g_free(str_value);
} else
printf("Fail to get DNS1\n");
- if (wifi_ap_get_dns_address(ap, 2, WIFI_ADDRESS_FAMILY_IPV4, &str_value) == WIFI_ERROR_NONE) {
+ if (wifi_ap_get_dns_address(ap, 2, address_type, &str_value) == WIFI_ERROR_NONE) {
printf("DNS2 : %s\n", str_value);
g_free(str_value);
} else
int main(int argc, char **argv)
{
GMainLoop *mainloop;
+ g_type_init();
mainloop = g_main_loop_new (NULL, FALSE);
GIOChannel *channel = g_io_channel_unix_new(0);