native_.callIfPossible(s._remoteAppControlCallback[callback], d);
break;
case 'onStart':
+ s._isStarted = true;
native_.callIfPossible(s._startCallback, s);
break;
case 'onStop':
+ s._isStarted = false;
native_.callIfPossible(s._stopCallback, null);
break;
default:
value: null,
writable: true,
enumerable: false
+ },
+ _isStarted : {
+ value: false,
+ writable: true,
+ enumerable: false
}
});
nullable: true
}]);
- if (this.connectionState === ConnectionState.NOT_CONNECTED) {
- throw new WebAPIException(WebAPIException.INVALID_STATE_ERR, 'Service is not connected yet.');
+ if (this._isStarted) {
+ throw new WebAPIException(WebAPIException.INVALID_STATE_ERR, 'Service is already started.');
}
var lid = this._serviceId;
nullable: true
}]);
+ if (!this._isStarted) {
+ throw new WebAPIException(WebAPIException.INVALID_STATE_ERR, 'Service is not started.');
+ }
+
var lid = this._serviceId;
this._stopCallback = args.successCallback;
convergenceServices[lid] = this;
}
]);
+ if (!this._isStarted) {
+ throw new WebAPIException(WebAPIException.INVALID_STATE_ERR, 'Service is not started.');
+ }
+
var lid = this._serviceId;
//Both callbacks have to be saved as launch on remote device
nullable: true
}]);
+ if (!this._isStarted) {
+ throw new WebAPIException(WebAPIException.INVALID_STATE_ERR, 'Service is not started.');
+ }
+
var lid = this._serviceId;
this._remoteAppControlCallback = args.replyCallback;
convergenceServices[lid] = this;
ConvergenceRemoteAppControlService::ConvergenceRemoteAppControlService()
: ConvergenceService()
- , connect_callback_param_(nullptr)
- , started_(false) {
+ , connect_callback_param_(nullptr) {
ScopeLogger();
}
ConvergenceRemoteAppControlService::ConvergenceRemoteAppControlService(conv_device_h device, ConvergenceInstance *convergence_plugin)
: ConvergenceService(device, CONV_SERVICE_REMOTE_APP_CONTROL, convergence_plugin)
- , connect_callback_param_(nullptr)
- , started_(false) {
+ , connect_callback_param_(nullptr) {
ScopeLogger();
}
TizenResult ConvergenceRemoteAppControlService::Start(const bool reply, const int cur_listener_id) {
ScopeLogger();
- if (started_) {
- return LogAndCreateTizenError(InvalidStateError, "RemoteAppControlService already started");
- }
-
conv_service_h service = FindServiceHandle();
if (!service) {
return LogAndCreateTizenError(AbortError, "Service with specified type does not exist");
return LogAndCreateTizenError(AbortError, "conv_service_start error");
} else {
LoggerI("RemoteAppControlService started");
- started_ = true;
}
return TizenSuccess();
TizenResult ConvergenceRemoteAppControlService::Stop(const bool reply, const int cur_listener_id) {
ScopeLogger();
- if (!started_) {
- return LogAndCreateTizenError(InvalidStateError, "RemoteAppControlService is not started yet");
- }
-
conv_service_h service = FindServiceHandle();
if (!service) {
return LogAndCreateTizenError(AbortError, "Service with specified type does not exist");
return LogAndCreateTizenError(AbortError, "conv_service_stop error");
} else {
LoggerI("RemoteAppControlService stopped");
- started_ = false;
}
return TizenSuccess();
TizenResult ConvergenceRemoteAppControlService::Launch(const char *appId, const int cur_listener_id) {
ScopeLogger();
- if (!started_) {
- return LogAndCreateTizenError(InvalidStateError, "RemoteAppControlService not started");
- }
-
conv_payload_h payload = nullptr;
app_control_h app_control = nullptr;
const int cur_listener_id) {
ScopeLogger();
- if (!started_) {
- return LogAndCreateTizenError(InvalidStateError, "RemoteAppControlService not started");
- }
-
conv_payload_h payload = nullptr;
app_control_h app_control = nullptr;