diff options
-rwxr-xr-x | CMakeLists.txt | 1 | ||||
-rw-r--r-- | packaging/org.tizen.watch-setting.spec | 1 | ||||
-rw-r--r-- | src/setting-connection.c | 34 |
3 files changed, 27 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a835a46..dbfb0ea 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,6 +89,7 @@ pkg_check_modules(pkgs REQUIRED elementary ecore-imf appcore-common appcore-efl libtzplatform-config efl-extension capi-network-wifi + capi-network-nfc storage capi-base-utils-i18n tapi diff --git a/packaging/org.tizen.watch-setting.spec b/packaging/org.tizen.watch-setting.spec index b27a855..a7280f7 100644 --- a/packaging/org.tizen.watch-setting.spec +++ b/packaging/org.tizen.watch-setting.spec @@ -57,6 +57,7 @@ BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(efl-extension) BuildRequires: pkgconfig(capi-network-wifi) +BuildRequires: pkgconfig(capi-network-nfc) BuildRequires: pkgconfig(storage) BuildRequires: pkgconfig(capi-base-utils-i18n) BuildRequires: pkgconfig(tapi) diff --git a/src/setting-connection.c b/src/setting-connection.c index ba4e926..ac7a98a 100644 --- a/src/setting-connection.c +++ b/src/setting-connection.c @@ -23,6 +23,7 @@ #include <ITapiNetwork.h> #include <ITapiSim.h> #include <bluetooth.h> +#include <nfc.h> #include "setting-connection.h" #include "util.h" @@ -52,7 +53,7 @@ void _location_cb(void *data, Evas_Object *obj, void *event_info); static void bt_status_changed_cb(int result, bt_adapter_state_e adapter_state, void *user_data); static void wifi_status_vconf_changed_cb(keynode_t *key, void *data); -static void nfc_status_vconf_changed_cb(keynode_t *key, void *data); +static void nfc_status_vconf_changed_cb(bool activated, void *user_data); static void location_status_vconf_changed_cb(keynode_t *key, void *data); static struct _connection_menu_item connection_menu_its[] = { @@ -104,7 +105,6 @@ void _clear_connection_resource() g_app_context = NULL; unregister_vconf_changing(VCONFKEY_WIFI_STATE, wifi_status_vconf_changed_cb); - unregister_vconf_changing(VCONFKEY_NFC_STATE, nfc_status_vconf_changed_cb); unregister_vconf_changing(VCONFKEY_LOCATION_USE_MY_LOCATION, location_status_vconf_changed_cb); if (tel_handle) { @@ -115,7 +115,14 @@ void _clear_connection_resource() bt_adapter_unset_state_changed_cb(); int bt_ret = bt_deinitialize(); if (bt_ret != BT_ERROR_NONE) - DBG("ERROR BT deinit %d", bt_ret); + ERR("ERROR BT deinit %d", bt_ret); + + nfc_manager_unset_activation_changed_cb(); + int nfc_ret = nfc_manager_deinitialize(); + if (nfc_ret != NFC_ERROR_NONE) + ERR("ERROR NFC deinit %d", nfc_ret); + + } @@ -510,6 +517,7 @@ char *_gl_connection_title_get(void *data, Evas_Object *obj, const char *part) int index = id->index; int val = 0; int ret = 0; + bool is_on = 0; bt_adapter_state_e bt_val = 0; if (!strcmp(part, "elm.text")) { @@ -528,8 +536,8 @@ char *_gl_connection_title_get(void *data, Evas_Object *obj, const char *part) snprintf(buf, sizeof(buf) - 1, text_color, val ? _("IDS_COM_BODY_ON_ABB") : _("IDS_COM_BODY_OFF_ABB_M_STATUS")); break; case SETTING_CONNECTION_NFC: - vconf_get_bool(VCONFKEY_NFC_STATE, &val); - snprintf(buf, sizeof(buf) - 1, text_color, val ? _("IDS_COM_BODY_ON_ABB") : _("IDS_COM_BODY_OFF_ABB_M_STATUS")); + is_on = nfc_manager_is_activated(); + snprintf(buf, sizeof(buf) - 1, text_color, is_on ? _("IDS_COM_BODY_ON_ABB") : _("IDS_COM_BODY_OFF_ABB_M_STATUS")); break; case SETTING_CONNECTION_LOCATION: vconf_get_int(VCONFKEY_LOCATION_USE_MY_LOCATION, &val); @@ -707,17 +715,25 @@ Evas_Object *_create_connection_list(void *data) g_connection_genlist = genlist; register_vconf_changing(VCONFKEY_WIFI_STATE, wifi_status_vconf_changed_cb, ad); - register_vconf_changing(VCONFKEY_NFC_STATE, nfc_status_vconf_changed_cb, ad); register_vconf_changing(VCONFKEY_LOCATION_USE_MY_LOCATION, location_status_vconf_changed_cb, ad); + int bt_ret = bt_initialize(); if (bt_ret != BT_ERROR_NONE) - DBG("ERROR BT init %d", bt_ret); + ERR("ERROR BT init %d", bt_ret); bt_ret = bt_adapter_set_state_changed_cb(bt_status_changed_cb, ad); if (bt_ret != BT_ERROR_NONE) - DBG("ERROR BT register changed cb %d", bt_ret); + ERR("ERROR BT register changed cb %d", bt_ret); + + int nfc_ret = nfc_manager_initialize(); + if (nfc_ret != NFC_ERROR_NONE) + ERR("ERROR NFC init %d", nfc_ret); + + nfc_ret = nfc_manager_set_activation_changed_cb(nfc_status_vconf_changed_cb, ad); + if (nfc_ret != NFC_ERROR_NONE) + ERR("ERROR NFC register changed cb %d", nfc_ret); return genlist; } @@ -742,7 +758,7 @@ static void wifi_status_vconf_changed_cb(keynode_t *key, void *data) _update_connection_list(g_WIFI_item); } -static void nfc_status_vconf_changed_cb(keynode_t *key, void *data) +static void nfc_status_vconf_changed_cb(bool activated, void *user_data) { DBG("Setting - nfc_status_vconf_changed_cb() is called!!"); _update_connection_list(g_NFC_item); |