From a9df5845efcb48fbc1bf37444041300773a3fe76 Mon Sep 17 00:00:00 2001 From: kmook Date: Mon, 22 Aug 2016 15:27:40 +0900 Subject: [PATCH] Fixed bug on setting app-comm state Change-Id: I7f6a9a735eb9c56be858aafdef820de444074601 Signed-off-by: kmook --- .../service_provider/AppCommServiceApplication.cpp | 33 ++++++++++++++-------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/daemon/service_provider/AppCommServiceApplication.cpp b/daemon/service_provider/AppCommServiceApplication.cpp index 1de55cc..cb4ff26 100755 --- a/daemon/service_provider/AppCommServiceApplication.cpp +++ b/daemon/service_provider/AppCommServiceApplication.cpp @@ -34,6 +34,14 @@ void conv::AppCommServiceApplication::onStart(bool start_result) { _D("onStart Called"); + if (start_result) { + _D("state : APP_COMM_STATE_STARTED"); + state = APP_COMM_STATE_STARTED; + } else { + _D("state : APP_COMM_STATE_FAILED"); + state = APP_COMM_STATE_FAILED; + } + if ((*requestObj) != NULL) { _D(RED("publishing_response")); Json result; @@ -49,17 +57,14 @@ void conv::AppCommServiceApplication::onStart(bool start_result) result.set(NULL, CONV_JSON_DESCRIPTION, description); result.set(NULL, CONV_JSON_PAYLOAD, payload); - if (start_result) { + if (start_result) (*requestObj)->publish(CONV_ERROR_NONE, result); - state = APP_COMM_STATE_STARTED; - } else { + else (*requestObj)->publish(CONV_ERROR_INVALID_OPERATION, result); - state = APP_COMM_STATE_FAILED; - } } } -void conv::AppCommServiceApplication::onStop(bool start_result) +void conv::AppCommServiceApplication::onStop(bool stop_result) { _D("onStop Called"); @@ -67,6 +72,14 @@ void conv::AppCommServiceApplication::onStop(bool start_result) application->disconnect(); } + if (stop_result) { + _D("state : APP_COMM_STATE_NONE"); + state = APP_COMM_STATE_NONE; + } else { + _D("state : APP_COMM_STATE_FAILED"); + state = APP_COMM_STATE_FAILED; + } + if ((*requestObj) != NULL) { _D(RED("publishing_response")); Json result; @@ -82,13 +95,10 @@ void conv::AppCommServiceApplication::onStop(bool start_result) result.set(NULL, CONV_JSON_DESCRIPTION, description); result.set(NULL, CONV_JSON_PAYLOAD, payload); - if (start_result) { + if (stop_result) (*requestObj)->publish(CONV_ERROR_NONE, result); - state = APP_COMM_STATE_NONE; - } else { + else (*requestObj)->publish(CONV_ERROR_INVALID_OPERATION, result); - state = APP_COMM_STATE_FAILED; - } } } @@ -101,6 +111,7 @@ void conv::AppCommServiceApplication::onConnect(Client client) ((Application*)application)->start(); _D("Application start requested"); } else { + _D("state : APP_COMM_STATE_STARTED"); state = APP_COMM_STATE_STARTED; } } -- 2.7.4