return LogAndCreateTizenError(AbortError, "Service with specified type does not exist");
}
- UpdateListener(cur_listener_id, REMOTE_SERVICE_START);
+ bool is_started = false;
+ //regarding to native team returned value should not be checked
+ //as CONV_ERROR_NONE means service is started, otherwise not started
+ //check only passed bool variable
+ conv_service_is_started(service_handle, channel->GetHandle(), &is_started);
- const int error = conv_service_start(service_handle, channel->GetHandle(), nullptr);
- if (CONV_ERROR_NONE != error) {
- return LogAndCreateTizenError(AbortError, "conv_service_start [fail]");
- }
+ if (is_started) {
+ picojson::object param;
+ param[kServiceListenerStatus] = picojson::value(kServiceListenerStatusOk);
+ param[kChannel] = ConvergenceChannel::ToJson(channel->GetHandle());
+ param[kServiceResultType] = picojson::value("onStart");
- opened_channels.push_back(ch_ptr.release());
+ // totu
+ convergence_plugin_->ReplyAsync(kAppCommunicationListenerCallback,
+ cur_listener_id, true, param);
+ } else {
+ UpdateListener(cur_listener_id, REMOTE_SERVICE_START);
+
+ const int error = conv_service_start(service_handle, channel->GetHandle(), nullptr);
+ if (CONV_ERROR_NONE != error) {
+ LoggerD("conv_service_start [fail] %d %s", error, get_error_message(error));
+ return LogAndCreateTizenError(AbortError, "conv_service_start [fail]");
+ }
+
+ opened_channels.push_back(ch_ptr.release());
+ }
return TizenSuccess();
}
return LogAndCreateTizenError(AbortError, "Service with specified type does not exist");
}
- UpdateListener(cur_listener_id, LOCAL_SERVICE_START);
- const int error = conv_service_start(service_handle, channel->GetHandle(), nullptr);
- if (CONV_ERROR_NONE != error) {
- return LogAndCreateTizenError(AbortError, "conv_service_start [fail]");
- }
+ bool is_started = false;
+ //regarding to native team returned value should not be checked
+ //as CONV_ERROR_NONE means service is started, otherwise not started
+ //check only passed bool variable
+ conv_service_is_started(service_handle, channel->GetHandle(), &is_started);
+
+ if (is_started) {
+ picojson::object param;
+ param[kServiceListenerStatus] = picojson::value(kServiceListenerStatusOk);
+ param[kChannel] = ConvergenceChannel::ToJson(channel->GetHandle());
+ param[kServiceResultType] = picojson::value("onStart");
- opened_channels.push_back(ch_ptr.release());
+ // totu
+ convergence_plugin_->ReplyAsync(kAppCommunicationListenerCallback,
+ cur_listener_id, true, param);
+ } else {
+ UpdateListener(cur_listener_id, LOCAL_SERVICE_START);
+
+ const int error = conv_service_start(service_handle, channel->GetHandle(), nullptr);
+ if (CONV_ERROR_NONE != error) {
+ LoggerD("conv_service_start [fail] %d %s", error, get_error_message(error));
+ return LogAndCreateTizenError(AbortError, "conv_service_start [fail]");
+ }
+
+ opened_channels.push_back(ch_ptr.release());
+ }
return TizenSuccess();
}