[Convergence] Change the channel interface name, Channel->ChannelInfo 42/88842/2
authorsangrae.kim <sangrae.kim@samsung.com>
Wed, 21 Sep 2016 02:07:59 +0000 (11:07 +0900)
committersangrae kim <sangrae.kim@samsung.com>
Wed, 21 Sep 2016 02:50:49 +0000 (19:50 -0700)
SE TC Issue : Channel_notexist...(PASS)

Change-Id: I5e39d2d71c717c8934c8496a49ad52ca2c885435
Signed-off-by: sangrae.kim <sangrae.kim@samsung.com>
src/convergence/convergence.gyp
src/convergence/convergence_api.js
src/convergence/convergence_app_communication_service.cc
src/convergence/convergence_channel.cc [deleted file]
src/convergence/convergence_channel.h [deleted file]
src/convergence/convergence_channel_info.cc [new file with mode: 0644]
src/convergence/convergence_channel_info.h [new file with mode: 0644]
src/convergence/convergence_extension.cc
src/convergence/convergence_instance.cc

index 1ab30fcda853759bb193b74198d4a1505c993ce8..1f6f14b3dad9a2c2c46095a6abc502f0d21aea0c 100644 (file)
@@ -27,8 +27,8 @@
         'convergence_remote_app_control_service.h',
         'convergence_app_communication_service.cc',
         'convergence_app_communication_service.h',
-        'convergence_channel.cc',
-        'convergence_channel.h',
+        'convergence_channel_info.cc',
+        'convergence_channel_info.h',
         'convergence_payload.cc',
         'convergence_payload.h',
         'convergence_client_info.cc',
index 1d048f7b5470aead3c668c78051d291b1c5b92ad..e570e0705bb94f077508eff0c6c08c4d27d11b69 100644 (file)
@@ -540,15 +540,15 @@ native_.addListener('APP_COMMUNICATION_SERVICE_LISTENER', function(result) {
       break;
     case 'onStart':
       native_.callIfPossible(s._startCallback,
-        new Channel(result.channel.uri, result.channel.id), null);
+        new ChannelInfo(result.channel.uri, result.channel.id), null);
       break;
     case 'onPublish':
       native_.callIfPossible(s._sendCallback,
-        new Channel(result.channel.uri, result.channel.id), null);
+        new ChannelInfo(result.channel.uri, result.channel.id), null);
       break;
     case 'onStop':
       native_.callIfPossible(s._stopCallback,
-        new Channel(result.channel.uri, result.channel.id), null);
+        new ChannelInfo(result.channel.uri, result.channel.id), null);
       break;
     case 'onMessage': {
         var payload = [];
@@ -568,7 +568,7 @@ native_.addListener('APP_COMMUNICATION_SERVICE_LISTENER', function(result) {
         }
 
         native_.callIfPossible(s._listenerCallback,
-          new Channel(result.channel.uri, result.channel.id),
+          new ChannelInfo(result.channel.uri, result.channel.id),
           payload, result.senderId);
       }
       break;
@@ -595,7 +595,7 @@ AppCommunicationService.prototype.start = function(channel, successCallback, err
     {
       name: 'channel',
       type: types_.PLATFORM_OBJECT,
-      values: tizen.Channel,
+      values: tizen.ChannelInfo,
       optional: false,
       nullable: false
     },
@@ -641,7 +641,7 @@ AppCommunicationService.prototype.stop = function(channel, successCallback, erro
     {
       name: 'channel',
       type: types_.PLATFORM_OBJECT,
-      values: tizen.Channel,
+      values: tizen.ChannelInfo,
       optional: false,
       nullable: false
     },
@@ -690,7 +690,7 @@ AppCommunicationService.prototype.send = function(channel, payload, successCallb
     {
       name: 'channel',
       type: types_.PLATFORM_OBJECT,
-      values: tizen.Channel,
+      values: tizen.ChannelInfo,
       optional: false,
       nullable: false
     },
@@ -880,8 +880,8 @@ AppCommunicationClientService.prototype.disconnect = function(successCallback, e
   native_.callIfPossible(successCallback, this);
 };
 
-function Channel(uri, id) {
-  validator_.isConstructorCall(this, Channel);
+function ChannelInfo(uri, id) {
+  validator_.isConstructorCall(this, ChannelInfo);
   this.uri = uri;
   this.id = id;
 }
@@ -911,6 +911,6 @@ exports = new ConvergenceManager();
 tizen.RemoteAppControlService = RemoteAppControlService;
 tizen.AppCommunicationServerService = AppCommunicationServerService;
 tizen.AppCommunicationClientService = AppCommunicationClientService;
-tizen.Channel = Channel;
+tizen.ChannelInfo = ChannelInfo;
 tizen.PayloadString = PayloadString;
 tizen.PayloadRawBytes = PayloadRawBytes;
index 0cc7bd60e095c94fc4427445e5a0ee5377ff060e..0be7f1d538f25061a742c3f3c154ea784b2828f0 100644 (file)
@@ -22,7 +22,7 @@
 #include <stdlib.h>
 
 #include "convergence/convergence_instance.h"
-#include "convergence/convergence_channel.h"
+#include "convergence/convergence_channel_info.h"
 #include "convergence/convergence_payload.h"
 #include "convergence/convergence_client_info.h"
 #include "common/logger.h"
diff --git a/src/convergence/convergence_channel.cc b/src/convergence/convergence_channel.cc
deleted file mode 100644 (file)
index 45e77c8..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-
-// TODO check includes
-#include "convergence/convergence_channel.h"
-
-#include <glib.h>
-#include <d2d_conv_internal.h>
-
-#include "convergence/convergence_instance.h"
-#include "convergence/convergence_utils.h"
-#include "common/logger.h"
-
-namespace extension {
-namespace convergence {
-
-namespace {
-// Channel keys
-static const std::string kId = "id"; // This id is used in arguments (comes from JS layer)
-static const std::string kChannelId = "channel_id"; // This id is used in the App Comm Service engine
-static const std::string kUri = "uri";
-} // namespace
-
-ConvergenceChannel::ConvergenceChannel()
-  : channel_handle_(nullptr) {
-  ScopeLogger();
-}
-
-ConvergenceChannel::ConvergenceChannel(const picojson::value &channel_json)
-  : channel_handle_(nullptr) {
-  ScopeLogger();
-  FromJson(channel_json);
-}
-
-ConvergenceChannel::~ConvergenceChannel() {
-  ScopeLogger();
-
-  if (channel_handle_) {
-    conv_channel_destroy(channel_handle_);
-    channel_handle_ = NULL;
-  }
-}
-
-conv_channel_h ConvergenceChannel::GetHandle() const {
-  ScopeLogger();
-  return channel_handle_;
-}
-
-
-void ConvergenceChannel::FromJson(const picojson::value &channel_json) {
-  ScopeLogger();
-  if (channel_json.is<picojson::null>()) {
-    LoggerE("ERROR: Channel json value is NULL");
-    return;
-  }
-
-  if (channel_handle_) {
-    conv_channel_destroy(channel_handle_);
-    channel_handle_ = NULL;
-  }
-
-  int error = conv_channel_create(&channel_handle_);
-  if ((CONV_ERROR_NONE != error) || !channel_handle_) {
-    trace_conv_error(error, __LINE__, "creating channel handle");
-    return;
-  }
-
-  const std::string id = channel_json.get(kId).to_str();
-  error = conv_channel_set_string(channel_handle_, kChannelId.c_str(), id.c_str());
-  if (CONV_ERROR_NONE != error) {
-    trace_conv_error(error, __LINE__, "setting channel string Id");
-  }
-
-  const std::string uri = channel_json.get(kUri).to_str();
-  error = conv_channel_set_string(channel_handle_, kUri.c_str(), uri.c_str());
-  if (CONV_ERROR_NONE != error) {
-    trace_conv_error(error, __LINE__, "setting channel string URI");
-  }
-}
-
-picojson::value ConvergenceChannel::ToJson(conv_channel_h channel_handle) {
-  ScopeLogger();
-
-  picojson::object channel_object;
-  if (!channel_handle) {
-    LoggerE("Error: trying to convert NULL channel handle to json");
-    return picojson::value(channel_object);
-  }
-
-  { // Extracting channel ID
-    char *id = nullptr;
-    const int error = conv_channel_get_string(channel_handle, kChannelId.c_str(), &id);
-    if (CONV_ERROR_NONE != error) {
-      trace_conv_error(error, __LINE__, "getting channel string Id");
-    } else {
-      channel_object[kId] = picojson::value(id);
-      free(id);
-    }
-  }
-
-  { // Extracting channel URI
-    char *uri = nullptr;
-    const int error = conv_channel_get_string(channel_handle, kUri.c_str(), &uri);
-    if (CONV_ERROR_NONE != error) {
-      trace_conv_error(error, __LINE__, "getting channel string URI");
-    } else {
-      channel_object[kUri] = picojson::value(uri);
-      free(uri);
-    }
-  };
-
-  return picojson::value(channel_object);
-}
-
-
-} // namespace convergence
-}  // namespace extension
diff --git a/src/convergence/convergence_channel.h b/src/convergence/convergence_channel.h
deleted file mode 100644 (file)
index 952838c..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-
-#ifndef CONVERGENCE_CONVERGENCE_CHANNEL_H__
-#define CONVERGENCE_CONVERGENCE_CHANNEL_H__
-
-// TODO check includes
-#include <d2d_conv_manager.h>
-
-#include <string>
-#include <unordered_map>
-
-#include "common/tizen_result.h"
-
-namespace extension {
-namespace convergence {
-
-class ConvergenceChannel {
-
- public:
-  ConvergenceChannel();
-  ConvergenceChannel(const picojson::value &channel_json);
-  virtual ~ConvergenceChannel();
-  ConvergenceChannel(const ConvergenceChannel&) = delete;
-  ConvergenceChannel(ConvergenceChannel&&) = delete;
-  ConvergenceChannel& operator=(const ConvergenceChannel&) = delete;
-  ConvergenceChannel& operator=(ConvergenceChannel&&) = delete;
-
- public:
-  conv_channel_h GetHandle() const;
-  void FromJson(const picojson::value &channel_json);
-
- public:
-  static picojson::value ToJson(conv_channel_h channel_handle);
-
- private:
-  conv_channel_h channel_handle_;
-};
-
-} // namespace convergence
-} // namespace extension
-
-#endif // CONVERGENCE_CONVERGENCE_CHANNEL_H__
diff --git a/src/convergence/convergence_channel_info.cc b/src/convergence/convergence_channel_info.cc
new file mode 100644 (file)
index 0000000..ef4d579
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+// TODO check includes
+#include "convergence/convergence_channel_info.h"
+
+#include <glib.h>
+#include <d2d_conv_internal.h>
+
+#include "convergence/convergence_instance.h"
+#include "convergence/convergence_utils.h"
+#include "common/logger.h"
+
+namespace extension {
+namespace convergence {
+
+namespace {
+// Channel keys
+static const std::string kId = "id"; // This id is used in arguments (comes from JS layer)
+static const std::string kChannelId = "channel_id"; // This id is used in the App Comm Service engine
+static const std::string kUri = "uri";
+} // namespace
+
+ConvergenceChannel::ConvergenceChannel()
+  : channel_handle_(nullptr) {
+  ScopeLogger();
+}
+
+ConvergenceChannel::ConvergenceChannel(const picojson::value &channel_json)
+  : channel_handle_(nullptr) {
+  ScopeLogger();
+  FromJson(channel_json);
+}
+
+ConvergenceChannel::~ConvergenceChannel() {
+  ScopeLogger();
+
+  if (channel_handle_) {
+    conv_channel_destroy(channel_handle_);
+    channel_handle_ = NULL;
+  }
+}
+
+conv_channel_h ConvergenceChannel::GetHandle() const {
+  ScopeLogger();
+  return channel_handle_;
+}
+
+
+void ConvergenceChannel::FromJson(const picojson::value &channel_json) {
+  ScopeLogger();
+  if (channel_json.is<picojson::null>()) {
+    LoggerE("ERROR: Channel json value is NULL");
+    return;
+  }
+
+  if (channel_handle_) {
+    conv_channel_destroy(channel_handle_);
+    channel_handle_ = NULL;
+  }
+
+  int error = conv_channel_create(&channel_handle_);
+  if ((CONV_ERROR_NONE != error) || !channel_handle_) {
+    trace_conv_error(error, __LINE__, "creating channel handle");
+    return;
+  }
+
+  const std::string id = channel_json.get(kId).to_str();
+  error = conv_channel_set_string(channel_handle_, kChannelId.c_str(), id.c_str());
+  if (CONV_ERROR_NONE != error) {
+    trace_conv_error(error, __LINE__, "setting channel string Id");
+  }
+
+  const std::string uri = channel_json.get(kUri).to_str();
+  error = conv_channel_set_string(channel_handle_, kUri.c_str(), uri.c_str());
+  if (CONV_ERROR_NONE != error) {
+    trace_conv_error(error, __LINE__, "setting channel string URI");
+  }
+}
+
+picojson::value ConvergenceChannel::ToJson(conv_channel_h channel_handle) {
+  ScopeLogger();
+
+  picojson::object channel_object;
+  if (!channel_handle) {
+    LoggerE("Error: trying to convert NULL channel handle to json");
+    return picojson::value(channel_object);
+  }
+
+  { // Extracting channel ID
+    char *id = nullptr;
+    const int error = conv_channel_get_string(channel_handle, kChannelId.c_str(), &id);
+    if (CONV_ERROR_NONE != error) {
+      trace_conv_error(error, __LINE__, "getting channel string Id");
+    } else {
+      channel_object[kId] = picojson::value(id);
+      free(id);
+    }
+  }
+
+  { // Extracting channel URI
+    char *uri = nullptr;
+    const int error = conv_channel_get_string(channel_handle, kUri.c_str(), &uri);
+    if (CONV_ERROR_NONE != error) {
+      trace_conv_error(error, __LINE__, "getting channel string URI");
+    } else {
+      channel_object[kUri] = picojson::value(uri);
+      free(uri);
+    }
+  };
+
+  return picojson::value(channel_object);
+}
+
+
+} // namespace convergence
+}  // namespace extension
diff --git a/src/convergence/convergence_channel_info.h b/src/convergence/convergence_channel_info.h
new file mode 100644 (file)
index 0000000..952838c
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+#ifndef CONVERGENCE_CONVERGENCE_CHANNEL_H__
+#define CONVERGENCE_CONVERGENCE_CHANNEL_H__
+
+// TODO check includes
+#include <d2d_conv_manager.h>
+
+#include <string>
+#include <unordered_map>
+
+#include "common/tizen_result.h"
+
+namespace extension {
+namespace convergence {
+
+class ConvergenceChannel {
+
+ public:
+  ConvergenceChannel();
+  ConvergenceChannel(const picojson::value &channel_json);
+  virtual ~ConvergenceChannel();
+  ConvergenceChannel(const ConvergenceChannel&) = delete;
+  ConvergenceChannel(ConvergenceChannel&&) = delete;
+  ConvergenceChannel& operator=(const ConvergenceChannel&) = delete;
+  ConvergenceChannel& operator=(ConvergenceChannel&&) = delete;
+
+ public:
+  conv_channel_h GetHandle() const;
+  void FromJson(const picojson::value &channel_json);
+
+ public:
+  static picojson::value ToJson(conv_channel_h channel_handle);
+
+ private:
+  conv_channel_h channel_handle_;
+};
+
+} // namespace convergence
+} // namespace extension
+
+#endif // CONVERGENCE_CONVERGENCE_CHANNEL_H__
index 6ddea5729ec8be2adbec989ecccfa86c0da13c79..089993358508e5553a9eb88cb49d4a6d5009b4a3 100644 (file)
@@ -33,7 +33,7 @@ ConvergenceExtension::ConvergenceExtension() {
       "tizen.RemoteAppControlService",
       "tizen.AppCommunicationServerService",
       "tizen.AppCommunicationClientService",
-      "tizen.Channel",
+      "tizen.ChannelInfo",
       "tizen.PayloadString",
       "tizen.PayloadRawBytes",
       nullptr
index 22bd337a808ab1b920da351cda6ea285a2b29580..48b589b6db54614ddd4083b10f5a6f896b4afca9 100644 (file)
@@ -22,7 +22,7 @@
 #include "convergence/convergence_manager.h"
 #include "convergence/convergence_remote_app_control_service.h"
 #include "convergence/convergence_app_communication_service.h"
-#include "convergence/convergence_channel.h"
+#include "convergence/convergence_channel_info.h"
 #include "convergence/convergence_payload.h"
 #include "common/logger.h"
 #include "common/picojson.h"