2 * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @file client_ide_support.cpp
18 * @author Jihoon Chung (jihoon.chung@samsung.com)
21 #include "client_ide_support.h"
24 #include <dpl/log/wrt_log.h>
25 #include <dpl/exception.h>
30 #include <widget_data_types.h>
32 namespace ClientModule {
34 const char* const KEY_DEBUG = "debug";
35 const char* const KEY_PORT = "port";
36 const char* const VALUE_TRUE = "true";
38 const char* const CONSOLE_MESSAGE_LOG_TAG = "ConsoleMessage";
41 bool IDESupport::getDebugMode(bundle* b)
44 WrtLogW("bundle is empty");
48 const char* value = bundle_get_val(b, KEY_DEBUG);
49 if (value != NULL && !strcmp(value, VALUE_TRUE)) {
56 bool IDESupport::sendReply(bundle* b, unsigned int portNum)
58 bundle* request = NULL;
59 if (appsvc_create_result_bundle(b, &request) != APPSVC_RET_OK) {
60 WrtLogW("Fail to create result bundle");
65 sprintf(port, "%u", portNum);
66 if (appsvc_add_data(request, KEY_PORT, port) != APPSVC_RET_OK) {
67 WrtLogW("Fail to add data");
72 if (appsvc_send_result(request, APPSVC_RES_OK) != APPSVC_RET_OK) {
73 WrtLogW("Fail to send result");
82 void IDESupport::consoleMessage(int level, const char* format, ...)
85 va_start(args, format);
87 case ConsoleLogLevel::Debug:
88 ALOG_VA(LOG_DEBUG, CONSOLE_MESSAGE_LOG_TAG, format, args);
90 case ConsoleLogLevel::Warning:
91 ALOG_VA(LOG_WARN, CONSOLE_MESSAGE_LOG_TAG, format, args);
93 case ConsoleLogLevel::Error:
94 ALOG_VA(LOG_ERROR, CONSOLE_MESSAGE_LOG_TAG, format, args);
97 ALOG_VA(LOG_DEBUG, CONSOLE_MESSAGE_LOG_TAG, format, args);