mmserv/tms/tmsimpl/src/tmsglobalroutingbodyimpl.cpp
branchRCL_3
changeset 10 3d8c721bf319
parent 0 71ca22bcf22a
child 18 2eb3b066cc7d
--- a/mmserv/tms/tmsimpl/src/tmsglobalroutingbodyimpl.cpp	Mon Mar 15 12:42:35 2010 +0200
+++ b/mmserv/tms/tmsimpl/src/tmsglobalroutingbodyimpl.cpp	Wed Mar 31 22:29:45 2010 +0300
@@ -25,7 +25,8 @@
 
 TMSGlobalRoutingBodyImpl::TMSGlobalRoutingBodyImpl() :
     iObserver(NULL),
-    iProxy(NULL)
+    iProxy(NULL),
+    iParent(NULL)
     {
     }
 
@@ -38,6 +39,7 @@
         iProxy = NULL;
         }
     iObserver = NULL;
+    iParent = NULL;
     iUserData = NULL;
     }
 
@@ -63,38 +65,38 @@
     gint ret(TMS_RESULT_SUCCESS);
     iClientId = 1;
     iProxy = new TMSProxy;
-    if (iProxy)
+    if (!iProxy)
         {
-        if (iProxy->Connect() != TMS_RESULT_SUCCESS)
-            {
-            delete iProxy;
-            iProxy = NULL;
-            ret = TMS_RESULT_FATAL_ERROR;
-            }
-        else
-            {
-            ret = iProxy->StartRoutingNotifier(); //starts TAR
-            }
+        ret = TMS_RESULT_INSUFFICIENT_MEMORY;
+        }
+    RET_REASON_IF_ERR(ret);
+
+    if (iProxy->Connect() != TMS_RESULT_SUCCESS)
+        {
+        delete iProxy;
+        iProxy = NULL;
+        ret = TMS_RESULT_FATAL_ERROR;
         }
     else
         {
-        ret = TMS_RESULT_UNINITIALIZED_OBJECT;
+        ret = iProxy->StartRoutingNotifier(); //starts TAR
         }
+    RET_REASON_IF_ERR(ret);
     return ret;
     }
 
 gint TMSGlobalRoutingBodyImpl::AddObserver(TMSGlobalRoutingObserver& obsrvr,
-        gpointer /*user_data*/)
+        gpointer user_data)
     {
     gint ret(TMS_RESULT_SUCCESS);
     if (!iObserver)
         {
         iObserver = &obsrvr;
-        //iUserData = user_data;
+        iUserData = user_data;
         if (iProxy)
             {
             ret = iProxy->SetMsgQueueNotifier(EMsgQueueGlobalRoutingType,
-                    iObserver, NULL, iClientId);
+                    iObserver, iParent, iClientId);
             }
         else
             {
@@ -113,9 +115,10 @@
     gint ret(TMS_RESULT_SUCCESS);
     if (iProxy && (&obsrvr == iObserver))
         {
-        iProxy->RemoveMsgQueueNotifier(EMsgQueueGlobalRoutingType, iObserver);
+        ret = iProxy->RemoveMsgQueueNotifier(EMsgQueueGlobalRoutingType,
+                iObserver);
+        iObserver = NULL;
         ret = iProxy->CancelRoutingNotifier();
-        iObserver = NULL;
         }
     else
         {
@@ -180,4 +183,8 @@
     return ret;
     }
 
-// End of file
+void TMSGlobalRoutingBodyImpl::SetParent(TMSGlobalRouting*& parent)
+    {
+    iParent = parent;
+    }
+