summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArron Wang <arron.wang@intel.com>2014-05-13 15:23:23 +0800
committerArron Wang <arron.wang@intel.com>2014-05-14 14:45:05 +0800
commitbde9e9a0d668804b0501647f42f38f8b29ad7542 (patch)
treee80427897bff28eaf730a90b14324e4916839745
parentaaf2df8153843e4f75312f2ea4703be06ecd71fe (diff)
downloadnfc-manager-neard-tizen_3.0.m14.2_ivi.tar.gz
nfc-manager-neard-tizen_3.0.m14.2_ivi.tar.bz2
nfc-manager-neard-tizen_3.0.m14.2_ivi.zip
only the daemon have the privilege to change the vconf status Change-Id: I234b8896536d284201349a5f6a0b073730549d4c
-rw-r--r--client/net_nfc_neard.c2
-rw-r--r--daemon/net_nfc_server.c22
2 files changed, 21 insertions, 3 deletions
diff --git a/client/net_nfc_neard.c b/client/net_nfc_neard.c
index 25df3dc..c2eafe1 100644
--- a/client/net_nfc_neard.c
+++ b/client/net_nfc_neard.c
@@ -275,8 +275,6 @@ static void _power_completed_cb(errorCode_t error_code, void *user_data)
NFC_DBG("power completed %d", neard_adapter->powered);
powered = (neard_adapter->powered) ? true : false;
- if (vconf_set_bool(VCONFKEY_NFC_STATE, powered) != 0)
- NFC_DBG("vconf_set_bool failed ");
if (powered == true) {
if (nfc_adapter_polling == false) {
diff --git a/daemon/net_nfc_server.c b/daemon/net_nfc_server.c
index ef4bfb8..1d16359 100644
--- a/daemon/net_nfc_server.c
+++ b/daemon/net_nfc_server.c
@@ -310,6 +310,23 @@ static void on_name_lost(GDBusConnection *connnection, const gchar *name,
net_nfc_manager_quit();
}
+static void _adapter_property_changed_cb(char *name, char *property,
+ void *value, void *user_data)
+{
+ bool powered;
+
+ if (!g_strcmp0(property, "Powered")) {
+ if ((int *) value == 0)
+ powered = false;
+ else
+ powered = true;
+
+ NFC_DBG("power changed %d", powered);
+ if (vconf_set_bool(VCONFKEY_NFC_STATE, powered) != 0)
+ NFC_DBG("vconf_set_bool failed ");
+ }
+}
+
static bool net_nfc_neard_nfc_support(void)
{
char **adapters = NULL;
@@ -331,6 +348,10 @@ static bool net_nfc_neard_nfc_support(void)
neard_adapter->powered) != 0)
NFC_ERR("VCONFKEY_NFC_STATE set to %d failed",
neard_adapter->powered);
+
+ if (neardal_set_cb_adapter_property_changed(
+ _adapter_property_changed_cb, NULL) != NEARDAL_SUCCESS)
+ NFC_ERR("Failed to register property changed cb");
}
if (adapters)
@@ -341,7 +362,6 @@ static bool net_nfc_neard_nfc_support(void)
adapters = NULL;
neard_adapter = NULL;
- neardal_destroy();
return true;
}