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 } |