PTREL 471:Merge from tizen2.2 branch from git repository framework/appfw/vconf 08/13608/1
authorBaptiste DURAND <baptiste.durand@open.eurogiciel.org>
Tue, 10 Dec 2013 14:03:01 +0000 (15:03 +0100)
committerBaptiste DURAND <baptiste.durand@open.eurogiciel.org>
Tue, 10 Dec 2013 14:03:01 +0000 (15:03 +0100)
- Vconf Keys for HID and PAN Devices
- Rework Event management (don't copy list for all events)
- /tmp/vconf-init mechanism is conditional to VCONF_CHECK_IS_INITIALIZED

Change-Id: I288a9d47d84fdbec9b6dabef30334103fe5eb660
Signed-off-by: Baptiste DURAND <baptiste.durand@open.eurogiciel.org>
include/vconf-keys.h
packaging/vconf.spec
vconf-kdb.c
vconf.c

index 8df0778e0846d838a5503da5e08342267e5300e8..ce54463f25ba230560083a07d630cbe103d710ed 100755 (executable)
@@ -167,25 +167,32 @@ enum {
  * @brief Bluetooth Connected status
  *
  * 0x0000 : Not connected \n
- * 0x0004 : Headset connected \n
- * 0x0010 : A2DP headset connected \n
- * 0x0020 : SAP connected \n
- * 0x0040 : PBAP connected \n
+ * 0x0001 : Headset connected \n
+ * 0x0002 : A2DP headset connected \n
+ * 0x0004 : HID connected \n
+ * 0x0008 : PAN connected \n
+ * 0x0010 : SAP connected \n
+ * 0x0020 : PBAP connected \n
 */
 #define VCONFKEY_BT_DEVICE                          "memory/bluetooth/device"
 enum {
        /** Not connected */
        VCONFKEY_BT_DEVICE_NONE = 0x0000,
        /** Headset connected */
-       VCONFKEY_BT_DEVICE_HEADSET_CONNECTED = 0x0004,
+       VCONFKEY_BT_DEVICE_HEADSET_CONNECTED = 0x0001,
        /** A2DP headset connected */
-       VCONFKEY_BT_DEVICE_A2DP_HEADSET_CONNECTED = 0x0010,
+       VCONFKEY_BT_DEVICE_A2DP_HEADSET_CONNECTED = 0x0002,
+       /** HID connected */
+       VCONFKEY_BT_DEVICE_HID_CONNECTED = 0x0004,
+       /** PAN connected */
+       VCONFKEY_BT_DEVICE_PAN_CONNECTED = 0x0008,
        /** SAP connected */
-       VCONFKEY_BT_DEVICE_SAP_CONNECTED = 0x0020,
+       VCONFKEY_BT_DEVICE_SAP_CONNECTED = 0x0010,
        /** PBAP connected */
-       VCONFKEY_BT_DEVICE_PBAP_CONNECTED = 0x0040
+       VCONFKEY_BT_DEVICE_PBAP_CONNECTED = 0x0020
 };
 
+
 /* Media sound path for BT */
 enum {
        /** Media Player Select Speaker */
index 6631f4095115308aa5946ff44bb94d4cc19cf21c..d4e60e6a836d95b2543bb8779a07b488cda75d00 100755 (executable)
@@ -1,7 +1,7 @@
 Name:       vconf
 Summary:    Configuration system library
-Version:    0.2.45
-Release:    3
+Version:    0.2.51
+Release:    1
 Group:      System/Libraries
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
index d0e6c5d0608d8818c46a92671edec3311e472370..1d5ed1fac67d7e9e6ed48517bafee1b9d0b33303 100755 (executable)
@@ -139,50 +139,50 @@ static gboolean _vconf_kdb_gio_cb(GIOChannel *src, GIOCondition cond, gpointer d
        while (r > 0) {
                //INFO("read event from GIOChannel. pid : %d", getpid());
 
-               pthread_mutex_lock(&_kdb_g_ns_mutex);
-               l_notilist = _vconf_copy_noti_list(g_notilist);
-               pthread_mutex_unlock(&_kdb_g_ns_mutex);
+               if (ie.mask & INOTY_EVENT_MASK) {
 
+                       pthread_mutex_lock(&_kdb_g_ns_mutex);
+                       l_notilist = _vconf_copy_noti_list(g_notilist);
+                       pthread_mutex_unlock(&_kdb_g_ns_mutex);
 
-               if (l_notilist) {
+                       if (l_notilist) {
 
-                       struct noti_node *t = NULL;
-                       GList *noti_list = NULL;
+                               struct noti_node *t = NULL;
+                               GList *noti_list = NULL;
 
-                       if (!(ie.mask & INOTY_EVENT_MASK)) {
-                               INFO("Invalid argument: ie.mask(%d), ie.len(%d)", ie.mask, ie.len);
-                               return TRUE;
-                       }
+                               noti_list = g_list_first(l_notilist);
+
+                               while (noti_list) {
+                                       t = noti_list->data;
 
-                       noti_list = g_list_first(l_notilist);
-
-                       while (noti_list) {
-                               t = noti_list->data;
-
-                               keynode_t* keynode = _vconf_keynode_new();
-                               retvm_if(keynode == NULL, TRUE, "key malloc fail");
-
-                               if( (t) && (t->wd == ie.wd) ) {
-                                       if ((ie.mask & IN_DELETE_SELF)) {
-                                               INFO("Notify that key(%s) is deleted", t->keyname);
-                                               _vconf_keynode_set_keyname(keynode, (const char *)t->keyname);
-                                               _vconf_keynode_set_null(keynode);
-                                               t->cb(keynode, t->cb_data);
-                                               _vconf_kdb_del_notify(t->keyname, t->cb);
-                                       } else {
-                                               _vconf_keynode_set_keyname(keynode, t->keyname);
-                                               _vconf_get_key(keynode);
-                                               t->cb(keynode, t->cb_data);
-                                               INFO("key(%s) is changed. cb called", t->keyname);
+                                       keynode_t* keynode = _vconf_keynode_new();
+                                       if (keynode == NULL) {
+                                               ERR("key malloc fail");
+                                               break;
+                                       }
+
+                                       if( (t) && (t->wd == ie.wd) ) {
+                                               if ((ie.mask & IN_DELETE_SELF)) {
+                                                       INFO("Notify that key(%s) is deleted", t->keyname);
+                                                       _vconf_keynode_set_keyname(keynode, (const char *)t->keyname);
+                                                       _vconf_keynode_set_null(keynode);
+                                                       t->cb(keynode, t->cb_data);
+                                                       _vconf_kdb_del_notify(t->keyname, t->cb);
+                                               } else {
+                                                       _vconf_keynode_set_keyname(keynode, t->keyname);
+                                                       _vconf_get_key(keynode);
+                                                       INFO("key(%s) is changed. cb(%p) called", t->keyname, t->cb);
+                                                       t->cb(keynode, t->cb_data);
+                                               }
                                        }
-                               }
 
-                               _vconf_keynode_free(keynode);
+                                       _vconf_keynode_free(keynode);
 
-                               noti_list = g_list_next(noti_list);
-                       }
+                                       noti_list = g_list_next(noti_list);
+                               }
 
-                       _vconf_free_noti_list(l_notilist);
+                               _vconf_free_noti_list(l_notilist);
+                       }
                }
 
                if (ie.len > 0)
diff --git a/vconf.c b/vconf.c
index f7eee54e2b47f67b042cb5242d6882c4fab98f8a..a6af153e7a28431858ea1d50beeb24adae9ef188 100755 (executable)
--- a/vconf.c
+++ b/vconf.c
@@ -1035,6 +1035,14 @@ static int _vconf_set_key_filesys(keynode_t *keynode, int prefix)
        ret = _vconf_get_key_path(keynode->keyname, path);
        retv_if(ret != VCONF_OK, ret);
 
+
+#ifdef VCONF_CHECK_IS_INITIALIZED
+       if(prefix == VCONF_BACKEND_MEMORY && VCONF_NOT_INITIALIZED) {
+               func_ret = VCONF_ERROR_NOT_INITIALIZED;
+               goto out_return;
+       }
+#endif
+
 #ifdef VCONF_USE_BACKUP_TRANSACTION
        if(prefix == VCONF_BACKEND_DB && keynode->type == VCONF_TYPE_STRING) {
                _vconf_get_backup_path(keynode->keyname, backup_path);
@@ -1209,7 +1217,17 @@ static int _vconf_set_key(keynode_t *keynode)
                is_busy_err = 0;
                retry++;
 
+#ifdef VCONF_CHECK_INITIALIZED
+               if(VCONF_NOT_INITIALIZED)
+               {
+                       ERR("%s : vconf is not initialized\n", keynode->keyname);
+                       is_busy_err = 1;
+               }
+               else if(ret == VCONF_ERROR_FILE_OPEN)
+#else
+
                if(ret == VCONF_ERROR_FILE_OPEN)
+#endif
                {
                        switch (errno)
                        {
@@ -1700,6 +1718,14 @@ static int _vconf_get_key_filesys(keynode_t *keynode, int prefix)
        ret = _vconf_get_key_path(keynode->keyname, path);
        retv_if(ret != VCONF_OK, ret);
 
+#ifdef VCONF_CHECK_INITIALIZED
+       if(prefix == VCONF_BACKEND_MEMORY && VCONF_NOT_INITIALIZED)
+       {
+               func_ret = VCONF_ERROR_NOT_INITIALIZED;
+               goto out_return;
+       }
+#endif
+
 #ifdef VCONF_USE_BACKUP_TRANSACTION
        if(prefix == VCONF_BACKEND_DB) {
                _vconf_get_backup_path(keynode->keyname, backup_path);
@@ -1894,7 +1920,16 @@ int _vconf_get_key(keynode_t *keynode)
                is_busy_err = 0;
                retry++;
 
+#ifdef VCONF_CHECK_INITIALIZED
+               if(VCONF_NOT_INITIALIZED)
+               {
+                       ERR("%s : vconf is not initialized\n", keynode->keyname);
+                       is_busy_err = 1;
+               }
+               else if(ret == VCONF_ERROR_FILE_OPEN)
+#else
                if(ret == VCONF_ERROR_FILE_OPEN)
+#endif
                {
                        switch (errno)
                        {