[Convergence] - Adding service attribute "type" 09/99309/1
authorAndrzej Popowski <a.popowski@samsung.com>
Tue, 22 Nov 2016 10:20:02 +0000 (19:20 +0900)
committerAndrzej Popowski <a.popowski@samsung.com>
Tue, 22 Nov 2016 10:20:02 +0000 (19:20 +0900)
Change-Id: I8be40a3467d6472880bef7f4028c217515a1561a
Signed-off-by: Andrzej Popowski <a.popowski@samsung.com>
src/convergence/convergence_api.js

index 614e4d1..215c042 100644 (file)
@@ -45,6 +45,12 @@ var DeviceProfile = {
   TV: 'TV'
 };
 
+var ServiceType = {
+  APP_COMM_CLIENT: 'APP_COMM_CLIENT',
+  APP_COMM_SERVER: 'APP_COMM_SERVER',
+  REMOTE_APP_CONTROL: 'REMOTE_APP_CONTROL'
+};
+
 function SetReadOnlyProperty(obj, n, v) {
   if (arguments.length > 2)
     Object.defineProperty(
@@ -276,6 +282,8 @@ function RemoteAppControlService() {
     }
   });
 
+  this.type = ServiceType.REMOTE_APP_CONTROL;
+
   // Registering the service in the table of issued services
   convergenceServices[this._serviceId] = this;
 }
@@ -461,9 +469,6 @@ RemoteAppControlService.prototype.launch = function(appId, successCallback, erro
     }
   ]);
 
-  if (this.connectionState == ConnectionState.CONNECTED)
-    throw new WebAPIException('InvalidStateError', 'Service is connected already.');
-
   var lid = this._serviceId;
   // TODO In fact it must be a list of callbacks
   // But untill D2D FW suppurts transaction management, it is meaningless to
@@ -934,6 +939,7 @@ function AppCommunicationServerService() {
   validator_.isConstructorCall(this, AppCommunicationServerService);
 
   this.connectionState = ConnectionState.NOT_CONNECTED;
+  this.type = ServiceType.APP_COMM_SERVER;
 
   native_.callSync('AppCommunicationServerService_constructLocal', {
       deviceId: this._deviceId
@@ -948,6 +954,7 @@ function AppCommunicationClientService() {
   validator_.isConstructorCall(this, AppCommunicationClientService);
 
   this.connectionState = ConnectionState.NOT_CONNECTED;
+  this.type = ServiceType.APP_COMM_CLIENT;
 }
 
 AppCommunicationClientService.prototype = new AppCommunicationService();
@@ -1045,7 +1052,5 @@ function ClientInfo(isHost, clientId, connectionTime) {
 }
 
 exports = new ConvergenceManager();
-tizen.RemoteAppControlService = RemoteAppControlService;
 tizen.AppCommunicationServerService = AppCommunicationServerService;
-tizen.AppCommunicationClientService = AppCommunicationClientService;
 tizen.ChannelInfo = ChannelInfo;