Following changes are included - 1. Updating tcore_server_get_cp_name_list function...
authorSuresh Kumar Narasimhaiah <suresh.n@samsung.com>
Thu, 14 Mar 2013 19:15:26 +0000 (00:45 +0530)
committerwootak.jung <wootak.jung@samsung.com>
Sun, 24 Mar 2013 09:03:13 +0000 (18:03 +0900)
src/at.c
src/core_object.c
src/hal.c
src/mux.c
src/server.c

index e27e774..7df87e6 100755 (executable)
--- a/src/at.c
+++ b/src/at.c
@@ -994,6 +994,7 @@ TReturn tcore_prepare_and_send_at_request(CoreObject *co,
                dbg("HAL is NULL");
                return ret;
        }
+       dbg("hal: [0x%x]", hal);
 
        /* Create Pending Request */
        pending = tcore_pending_new(co, 0);
@@ -1017,5 +1018,6 @@ TReturn tcore_prepare_and_send_at_request(CoreObject *co,
        tcore_pending_link_user_request(pending, ur);
 
        ret = tcore_hal_send_request(hal, pending);
+       dbg("ret: [0x%x]", ret);
        return ret;
 }
index e38920c..15eda49 100644 (file)
@@ -44,7 +44,6 @@
 #include "co_gps.h"
 
 #define INIT_CORE_OBJECT(initializer, plugin, type, hal)       do { \
-       CoreObject *co; \
        if (initializer != NULL) { \
                co = tcore_object_clone_template_object(plugin, type); \
                if (co == NULL) { \
@@ -118,7 +117,7 @@ static void _util_print_mapping_tbl_entry(object_mapping_table_t *tbl_entry)
                if (co_list->data == NULL)
                        continue;
 
-               dbg("Core Object type: [0x%x]", co_list->data);
+               msg("           Core Object type: [0x%x]", co_list->data);
        }
 }
 
@@ -206,12 +205,18 @@ static object_mapping_table_t *_object_search_mapping_tbl_entry_by_type(
 static gboolean _init_core_object_by_type(unsigned int type,
        TcorePlugin *plugin, TcoreHal *hal, struct object_initializer *initializer_list)
 {
+       CoreObject *co;
        gboolean ret = FALSE;
 
        switch (type) {
        case CORE_OBJECT_TYPE_MODEM:
                INIT_CORE_OBJECT(initializer_list->modem_init,
                                                plugin, type, hal);
+
+               /* Send Notification for MODEM ADDED */
+               if (ret == TRUE)
+                       tcore_server_send_notification(tcore_plugin_ref_server(plugin),
+                                                       co, TNOTI_MODEM_ADDED, 0, NULL);
        break;
 
        case CORE_OBJECT_TYPE_CALL:
@@ -517,6 +522,7 @@ TReturn tcore_object_set_hal(CoreObject *co, TcoreHal *hal)
        TcoreAT *at;
        struct callback_type *cb = NULL;
        GSList *l = NULL;
+       dbg("Core Object Type: [0x%x] HAL: [0x%x]", co->type, hal);
 
        if (co == NULL)
                return TCORE_RETURN_EINVAL;
index 550846b..2793bd7 100644 (file)
--- a/src/hal.c
+++ b/src/hal.c
@@ -281,6 +281,7 @@ TReturn tcore_hal_send_request(TcoreHal *hal, TcorePending *pending)
 {
        int qlen = 0;
        enum tcore_pending_priority priority;
+       dbg("HAL: [0x%x]", hal);
 
        if ((hal == NULL) || (pending == NULL))
                return TCORE_RETURN_EINVAL;
index fb59d29..b10dec2 100644 (file)
--- a/src/mux.c
+++ b/src/mux.c
@@ -285,19 +285,19 @@ static tcore_cmux_object *_cmux_get_cmux_object(TcorePlugin *plugin)
 {
        tcore_cmux_object *cmux_obj;
        GSList *tmp_obj;
+       dbg("Entry");
 
        /* Check across CMUX Objects list for specific CMUX Object */
-       tmp_obj = g_cmux_obj;
-       while (tmp_obj) {
+       for (tmp_obj = g_cmux_obj ; tmp_obj ; tmp_obj = tmp_obj->next) {
                cmux_obj = tmp_obj->data;
-               tmp_obj = tmp_obj->next;
-
                if (cmux_obj == NULL)
                        continue;
 
                /* Check for matching 'plugin' */
-               if (plugin == cmux_obj->plugin)
+               if (plugin == cmux_obj->plugin) {
+                       dbg("Found CMUX object");
                        return cmux_obj;
+               }
        }
 
        return NULL;
@@ -804,28 +804,33 @@ static TReturn _cmux_hal_send(TcoreHal *hal, unsigned int data_len, void *data)
                return TCORE_RETURN_FAILURE;
        }
 
-       channel_name = tcore_hal_get_name(hal);
-       dbg("HAL name: %s", channel_name);
-
        /*
         * Get CMUX Object from Modem Interface Plug-in
         */
        cmux_obj = _cmux_get_cmux_object(tcore_hal_ref_plugin(hal));
        if (cmux_obj == NULL) {
-               /* Free memory */
-               g_free(channel_name);
-
+               err("Failed to find CMUX object");
                return TCORE_RETURN_FAILURE;
        }
 
        channel_id = cmux_obj->max_cmux_channels + 1;
 
+       channel_name = tcore_hal_get_name(hal);
+       dbg("HAL name: %s", channel_name);
+
        if (channel_name != NULL) {
-               int i = 0;
+               int i;
 
-               while (cmux_obj->max_cmux_channels > i) {
+               /*
+                * Channel 0 is dedicated to CMUX Control Channel,
+                * hence starting from 1.
+                */
+               for (i = 1 ; cmux_obj->max_cmux_channels > i ; i++) {
                        hal_name =
                                tcore_hal_get_name(cmux_obj->internal_mux.channel_info[i]->hal);
+                       dbg("HAL name: %s", hal_name);
+                       if (hal_name == NULL)
+                               continue;
 
                        /*
                         * Comparing all Logical HAL names with required HAL name.
@@ -842,9 +847,6 @@ static TReturn _cmux_hal_send(TcoreHal *hal, unsigned int data_len, void *data)
 
                        /* Free HAL name */
                        g_free(hal_name);
-
-                       /* Increment to next Logical HAL */
-                       i++;
                }
 
                /* Free memory */
index aefa13b..24a5814 100644 (file)
@@ -790,7 +790,6 @@ GSList *tcore_server_get_cp_name_list(Server *s)
                return NULL;
        }
 
-#if 1
        for (list = s->modems; list; list = list->next) {
                modem = list->data;
                if (modem == NULL) {
@@ -801,27 +800,6 @@ GSList *tcore_server_get_cp_name_list(Server *s)
                dbg("[%d] CP Name: [%s]", i++, modem->cp_name);
                cp_name_list = g_slist_append(cp_name_list, g_strdup(modem->cp_name));
        }
-#else
-       /* (+1) is considered for NULL string to define the last string */
-       cp_name_list = g_try_new0(char *, list_count);
-       if (cp_name_list == NULL) {
-               err("Failed to allocate memory");
-               return NULL;
-       }
-
-       for (list = s->modems; list; list = list->next) {
-               modem = list->data;
-               if (modem == NULL) {
-                       dbg("No modem - continue");
-                       continue;
-               }
-
-               cp_name_list[i] = g_strdup(modem->cp_name);
-               dbg("[%d] CP Name: [%s]", i, cp_name_list[i]);
-
-               i++;
-       }
-#endif
 
        /* 'cp_name_list' would be freed by the calling function */
        return cp_name_list;