diff options
author | Arron Wang <arron.wang@intel.com> | 2013-05-09 15:12:08 +0800 |
---|---|---|
committer | Arron Wang <arron.wang@intel.com> | 2013-07-02 14:54:10 +0800 |
commit | 12e442cdec566ca678b0d95685c230fb89deb3d8 (patch) | |
tree | 6e56a24d844c9d55fc8405c86a1bc5573c472e2a | |
parent | 5d8b21dd60f4a9b085e0ad8463157b0c48b01c9a (diff) | |
download | nfc-manager-neard-12e442cdec566ca678b0d95685c230fb89deb3d8.tar.gz nfc-manager-neard-12e442cdec566ca678b0d95685c230fb89deb3d8.tar.bz2 nfc-manager-neard-12e442cdec566ca678b0d95685c230fb89deb3d8.zip |
NFC feature support check through neard
Disable plugin based design
Disable client/server architecture, then server ipc
initialize is also not needed
Change-Id: I28a5cf783a2c50847e70b6f85c6fe2a345ffe5c9
-rw-r--r-- | packaging/nfc-manager.spec | 1 | ||||
-rw-r--r-- | src/manager/CMakeLists.txt | 2 | ||||
-rwxr-xr-x | src/manager/net_nfc_manager.c | 46 |
3 files changed, 27 insertions, 22 deletions
diff --git a/packaging/nfc-manager.spec b/packaging/nfc-manager.spec index 4a3d9da..9edc94b 100644 --- a/packaging/nfc-manager.spec +++ b/packaging/nfc-manager.spec @@ -31,6 +31,7 @@ BuildRequires: pkgconfig(pkgmgr) BuildRequires: pkgconfig(pkgmgr-info) BuildRequires: pkgconfig(ecore-x) BuildRequires: pkgconfig(capi-appfw-app-manager) +BuildRequires: pkgconfig(neardal) BuildRequires: cmake BuildRequires: gettext-tools Requires(post): /sbin/ldconfig diff --git a/src/manager/CMakeLists.txt b/src/manager/CMakeLists.txt index be1d217..e710d10 100644 --- a/src/manager/CMakeLists.txt +++ b/src/manager/CMakeLists.txt @@ -14,7 +14,7 @@ IF("${CMAKE_BUILD_TYPE}" STREQUAL "") ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "") INCLUDE(FindPkgConfig) -pkg_check_modules(manager_pkges REQUIRED aul glib-2.0 gobject-2.0 security-server dbus-glib-1 vconf dlog tapi appsvc libcurl bluetooth-api heynoti smartcard-service smartcard-service-common libssl pmapi svi capi-media-wav-player pkgmgr pkgmgr-info ecore-x) +pkg_check_modules(manager_pkges REQUIRED aul glib-2.0 gobject-2.0 security-server dbus-glib-1 vconf dlog tapi appsvc libcurl bluetooth-api heynoti smartcard-service smartcard-service-common libssl pmapi svi capi-media-wav-player pkgmgr pkgmgr-info ecore-x neardal) FOREACH(flag ${manager_pkges_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") diff --git a/src/manager/net_nfc_manager.c b/src/manager/net_nfc_manager.c index 00efa96..d49b2b7 100755 --- a/src/manager/net_nfc_manager.c +++ b/src/manager/net_nfc_manager.c @@ -38,6 +38,7 @@ #include "net_nfc_server_context_private.h" #include "net_nfc_manager_dbus.h" #include "nfc-service-binding.h" +#include "neardal.h" static GMainLoop *loop = NULL; static GObject *object = NULL; @@ -172,10 +173,30 @@ static void _net_nfc_deintialize_dbus_connection() } } +static bool net_nfc_neard_support_nfc(void) +{ + char **adapters = NULL; + int len; + errorCode_t err; + + DEBUG_SERVER_MSG("checking nfc support"); + err = neardal_get_adapters(&adapters, &len); + if (err != NEARDAL_SUCCESS) + return false; + + if (!(len > 0 && adapters != NULL)) + return false; + + neardal_free_array(&adapters); + adapters = NULL; + neardal_destroy(); + + return true; +} + int main(int check, char* argv[]) { int result = 0; - void *handle = NULL; int state = 0; if (!g_thread_supported()) @@ -193,14 +214,7 @@ int main(int check, char* argv[]) net_nfc_app_util_clean_storage(MESSAGE_STORAGE); - handle = net_nfc_controller_onload(); - if (handle == NULL) - { - DEBUG_ERR_MSG("load plugin library is failed"); - return 0; - } - - if (net_nfc_controller_support_nfc(&result) == true) + if (net_nfc_neard_support_nfc() == true) { DEBUG_SERVER_MSG("NFC Support"); if (vconf_set_bool(VCONFKEY_NFC_FEATURE, VCONFKEY_NFC_FEATURE_ON) != 0) @@ -221,8 +235,6 @@ int main(int check, char* argv[]) { DEBUG_SERVER_MSG("VCONFKEY_NFC_STATE failed"); } - - net_nfc_controller_unload(handle); } result = vconf_get_bool(VCONFKEY_NFC_STATE, &state); @@ -245,14 +257,8 @@ int main(int check, char* argv[]) } } - if (net_nfc_server_ipc_initialize() != true) - { - DEBUG_ERR_MSG("nfc server ipc initialization is failed"); - - goto EXIT; - } - - DEBUG_SERVER_MSG("nfc server ipc init is ok"); + if (vconf_set_bool(NET_NFC_DISABLE_LAUNCH_POPUP_KEY, FALSE) != 0) + DEBUG_ERR_MSG("SERVER : launch state set vconf fail"); _net_nfc_intialize_dbus_connection(); @@ -287,8 +293,6 @@ int main(int check, char* argv[]) EXIT : _net_nfc_deintialize_dbus_connection(); net_nfc_service_vconf_unregister_notify_listener(); - net_nfc_server_ipc_finalize(); - net_nfc_controller_unload(handle); net_nfc_manager_fini_log(); |