[Convergence] Fix SVACE issue 95/128295/1
authorPawel Wasowski <p.wasowski2@partner.samsung.com>
Mon, 8 May 2017 11:14:33 +0000 (13:14 +0200)
committerPawel Wasowski <p.wasowski2@partner.samsung.com>
Mon, 8 May 2017 11:20:23 +0000 (13:20 +0200)
BUG WGID: 174706, WID: 22870047

[Verification] Code compiles

Change-Id: I03b1535f85a22d84aef244b4dc5a872e4d9a9ab7

src/convergence/convergence_instance.cc
src/convergence/convergence_service.cc
src/convergence/convergence_service.h

index c00109b2a395899239b04cf5a4bde45b16273cc8..86343755b159c94b182ed19a55fc87238bf85b6f 100644 (file)
@@ -453,7 +453,7 @@ common::TizenResult ConvergenceInstance::AppCommunicationServiceStart(const pico
       auto channel_arg = ConvergenceUtils::GetArg(args, kJSArgumentChannel);
       std::vector<ConvergenceChannel*>::iterator channel_it = service->GetChannel(channel_arg);
 
-      if (service->IsChannelStarted(channel_it)) {
+      if (service->opened_channels.end() != channel_it) {
         result = LogAndCreateTizenError(InvalidStateError, "Service is already started for the channel.",
           ("Service is already started for the channel."));
       } else {
@@ -505,7 +505,7 @@ common::TizenResult ConvergenceInstance::AppCommunicationServiceSend(const picoj
       auto channel_arg = ConvergenceUtils::GetArg(args, kJSArgumentChannel);
       std::vector<ConvergenceChannel*>::iterator channel_it = service->GetChannel(channel_arg);
 
-      if (!service->IsChannelStarted(channel_it)) {
+      if (service->opened_channels.end() == channel_it) {
         result = LogAndCreateTizenError(InvalidStateError, "Service is not started for the channel.",
           ("Service is not started for the channel."));
       } else {
@@ -556,7 +556,7 @@ common::TizenResult ConvergenceInstance::AppCommunicationServiceStop(const picoj
       auto channel_arg = ConvergenceUtils::GetArg(args, kJSArgumentChannel);
       std::vector<ConvergenceChannel*>::iterator channel_it = service->GetChannel(channel_arg);
 
-      if (!service->IsChannelStarted(channel_it)) {
+      if (service->opened_channels.end() == channel_it) {
         result = LogAndCreateTizenError(InvalidStateError, "Service is not started for the channel.",
           ("Service is not started for the channel."));
       } else {
@@ -609,7 +609,7 @@ common::TizenResult ConvergenceInstance::AppCommunicationServiceGetClientList(co
       auto channel_arg = ConvergenceUtils::GetArg(args, kJSArgumentChannel);
       std::vector<ConvergenceChannel*>::iterator channel_it = service->GetChannel(channel_arg);
 
-      if (!service->IsChannelStarted(channel_it)) {
+      if (service->opened_channels.end() == channel_it) {
         result = LogAndCreateTizenError(InvalidStateError, "Service is not started for the channel.",
           ("Service is not started for the channel."));
       } else {
index 29992d7bba655de07980f5e163400f65c2ef396e..f2b2bbe2cbd6fa38379c23626dd55fb0c9632fa1 100644 (file)
@@ -203,11 +203,6 @@ std::vector<ConvergenceChannel*>::iterator ConvergenceService::GetChannel(const
   return opened_channels.end();
 }
 
-bool ConvergenceService::IsChannelStarted(std::vector<ConvergenceChannel*>::iterator it) {
-  ScopeLogger();
-  return it != opened_channels.end();
-}
-
 void ConvergenceService::RemoveChannel(std::vector<ConvergenceChannel*>::iterator it) {
   ScopeLogger();
   opened_channels.erase(it);
index 42ff0a6544d51f05fa05ed68c418417b07d4b21f..9f4b4e452bb2e77b0155a3bbe10e03e720a1bd44 100644 (file)
@@ -46,13 +46,13 @@ class ConvergenceService {
  public:
   void Refresh();
   std::vector<ConvergenceChannel*>::iterator GetChannel(const picojson::value &channel_json);
-  bool IsChannelStarted(std::vector<ConvergenceChannel*>::iterator);
   void RemoveChannel(std::vector<ConvergenceChannel*>::iterator);
 
  public:
   //conv_service_e get_type() const { return type_; }
   //conv_device_h get_device() const {return device_; }
   picojson::value ToJson() const;
+  std::vector<ConvergenceChannel*> opened_channels;
 
  protected:
   conv_service_h FindServiceHandle() const;
@@ -68,7 +68,6 @@ class ConvergenceService {
   conv_device_h device_; // TODO rename to device_handle_
   conv_service_e type_;
   mutable conv_service_h service_handle_;
-  std::vector<ConvergenceChannel*> opened_channels;
   friend class ConvergenceAppCommunicationServerService; // It is needed to register the local service
  private:
   conv_service_connection_state_e connection_state_;