static const char* kReply = "reply";
static const char* kCbResult = "callback_result";
static const char* kRemoteFunc = "remote_function";
+static const char* kJSCurrentListenerId = "curListenerId";
static const std::string kLaunch = "launch";
static const std::string kLaunchAppControl = "launchAppControl";
return LogAndCreateTizenError(AbortError, "Service with specified type does not exist");
}
- if (reply) {
- UpdateListener(cur_listener_id);
- }
+ 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, nullptr, &is_started);
- const int error = conv_service_start(service, nullptr, nullptr);
- if (CONV_ERROR_NONE != error) {
- return LogAndCreateTizenError(AbortError, "conv_service_start error");
+ if (is_started) {
+ //just call success callback
+ picojson::object param;
+ param[kServiceResultType] = picojson::value("onStart");
+ param[kServiceListenerStatus] = picojson::value(kServiceListenerStatusOk);
+ param[kJSCurrentListenerId] = picojson::value(static_cast<double>(cur_listener_id));
+
+ convergence_plugin_->ReplyAsync(kRemoteAppControlListenerCallback,
+ cur_listener_id,
+ true,
+ param);
} else {
- LoggerI("RemoteAppControlService started");
+ if (reply) {
+ UpdateListener(cur_listener_id);
+ }
+
+ const int error = conv_service_start(service, nullptr, nullptr);
+ if (CONV_ERROR_NONE != error) {
+ return LogAndCreateTizenError(AbortError, "conv_service_start error");
+ } else {
+ LoggerI("RemoteAppControlService started");
+ }
}
return TizenSuccess();