mmserv/tms/tmsimpl/src/tmsglobalroutingbodyimpl.cpp
branchRCL_3
changeset 10 3d8c721bf319
parent 0 71ca22bcf22a
child 18 2eb3b066cc7d
equal deleted inserted replaced
8:e35735ece90c 10:3d8c721bf319
    23 
    23 
    24 using namespace TMS;
    24 using namespace TMS;
    25 
    25 
    26 TMSGlobalRoutingBodyImpl::TMSGlobalRoutingBodyImpl() :
    26 TMSGlobalRoutingBodyImpl::TMSGlobalRoutingBodyImpl() :
    27     iObserver(NULL),
    27     iObserver(NULL),
    28     iProxy(NULL)
    28     iProxy(NULL),
       
    29     iParent(NULL)
    29     {
    30     {
    30     }
    31     }
    31 
    32 
    32 TMSGlobalRoutingBodyImpl::~TMSGlobalRoutingBodyImpl()
    33 TMSGlobalRoutingBodyImpl::~TMSGlobalRoutingBodyImpl()
    33     {
    34     {
    36         iProxy->Close();
    37         iProxy->Close();
    37         delete iProxy;
    38         delete iProxy;
    38         iProxy = NULL;
    39         iProxy = NULL;
    39         }
    40         }
    40     iObserver = NULL;
    41     iObserver = NULL;
       
    42     iParent = NULL;
    41     iUserData = NULL;
    43     iUserData = NULL;
    42     }
    44     }
    43 
    45 
    44 gint TMSGlobalRoutingBodyImpl::Create(TMSGlobalRoutingBody*& bodyimpl)
    46 gint TMSGlobalRoutingBodyImpl::Create(TMSGlobalRoutingBody*& bodyimpl)
    45     {
    47     {
    61 gint TMSGlobalRoutingBodyImpl::PostConstruct()
    63 gint TMSGlobalRoutingBodyImpl::PostConstruct()
    62     {
    64     {
    63     gint ret(TMS_RESULT_SUCCESS);
    65     gint ret(TMS_RESULT_SUCCESS);
    64     iClientId = 1;
    66     iClientId = 1;
    65     iProxy = new TMSProxy;
    67     iProxy = new TMSProxy;
    66     if (iProxy)
    68     if (!iProxy)
    67         {
    69         {
    68         if (iProxy->Connect() != TMS_RESULT_SUCCESS)
    70         ret = TMS_RESULT_INSUFFICIENT_MEMORY;
    69             {
    71         }
    70             delete iProxy;
    72     RET_REASON_IF_ERR(ret);
    71             iProxy = NULL;
    73 
    72             ret = TMS_RESULT_FATAL_ERROR;
    74     if (iProxy->Connect() != TMS_RESULT_SUCCESS)
    73             }
    75         {
    74         else
    76         delete iProxy;
    75             {
    77         iProxy = NULL;
    76             ret = iProxy->StartRoutingNotifier(); //starts TAR
    78         ret = TMS_RESULT_FATAL_ERROR;
    77             }
       
    78         }
    79         }
    79     else
    80     else
    80         {
    81         {
    81         ret = TMS_RESULT_UNINITIALIZED_OBJECT;
    82         ret = iProxy->StartRoutingNotifier(); //starts TAR
    82         }
    83         }
       
    84     RET_REASON_IF_ERR(ret);
    83     return ret;
    85     return ret;
    84     }
    86     }
    85 
    87 
    86 gint TMSGlobalRoutingBodyImpl::AddObserver(TMSGlobalRoutingObserver& obsrvr,
    88 gint TMSGlobalRoutingBodyImpl::AddObserver(TMSGlobalRoutingObserver& obsrvr,
    87         gpointer /*user_data*/)
    89         gpointer user_data)
    88     {
    90     {
    89     gint ret(TMS_RESULT_SUCCESS);
    91     gint ret(TMS_RESULT_SUCCESS);
    90     if (!iObserver)
    92     if (!iObserver)
    91         {
    93         {
    92         iObserver = &obsrvr;
    94         iObserver = &obsrvr;
    93         //iUserData = user_data;
    95         iUserData = user_data;
    94         if (iProxy)
    96         if (iProxy)
    95             {
    97             {
    96             ret = iProxy->SetMsgQueueNotifier(EMsgQueueGlobalRoutingType,
    98             ret = iProxy->SetMsgQueueNotifier(EMsgQueueGlobalRoutingType,
    97                     iObserver, NULL, iClientId);
    99                     iObserver, iParent, iClientId);
    98             }
   100             }
    99         else
   101         else
   100             {
   102             {
   101             ret = TMS_RESULT_DOES_NOT_EXIST;
   103             ret = TMS_RESULT_DOES_NOT_EXIST;
   102             }
   104             }
   111 gint TMSGlobalRoutingBodyImpl::RemoveObserver(TMSGlobalRoutingObserver& obsrvr)
   113 gint TMSGlobalRoutingBodyImpl::RemoveObserver(TMSGlobalRoutingObserver& obsrvr)
   112     {
   114     {
   113     gint ret(TMS_RESULT_SUCCESS);
   115     gint ret(TMS_RESULT_SUCCESS);
   114     if (iProxy && (&obsrvr == iObserver))
   116     if (iProxy && (&obsrvr == iObserver))
   115         {
   117         {
   116         iProxy->RemoveMsgQueueNotifier(EMsgQueueGlobalRoutingType, iObserver);
   118         ret = iProxy->RemoveMsgQueueNotifier(EMsgQueueGlobalRoutingType,
       
   119                 iObserver);
       
   120         iObserver = NULL;
   117         ret = iProxy->CancelRoutingNotifier();
   121         ret = iProxy->CancelRoutingNotifier();
   118         iObserver = NULL;
       
   119         }
   122         }
   120     else
   123     else
   121         {
   124         {
   122         ret = TMS_RESULT_DOES_NOT_EXIST;
   125         ret = TMS_RESULT_DOES_NOT_EXIST;
   123         }
   126         }
   178         ret = TMS_RESULT_DOES_NOT_EXIST;
   181         ret = TMS_RESULT_DOES_NOT_EXIST;
   179         }
   182         }
   180     return ret;
   183     return ret;
   181     }
   184     }
   182 
   185 
   183 // End of file
   186 void TMSGlobalRoutingBodyImpl::SetParent(TMSGlobalRouting*& parent)
       
   187     {
       
   188     iParent = parent;
       
   189     }
       
   190