diff options
413 files changed, 30659 insertions, 26706 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a813b98a1c..b8fd497a09 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,11 +52,11 @@ option(ENABLE_GCOV "gcov code coverage feature" OFF) option(ENABLE_SANITIZE "Sanitize tool" OFF) option(ENABLE_SECURITY "Security Ford protocol protection" ON) option(ENABLE_HMI_PTU_DECRYPTION "Policy table update parsed by hmi" ON) -option(ENABLE_EXTENDED_POLICY "Turns extended flow which requires embedded system interaction" ON) +option(REMOTE_CONTROL "Enable Reverse functionality" ON) option(USE_COTIRE "Use Cotire to speed up build (currently only for commands tests)" ON) option(USE_GOLD_LD "Use gold linker intead of GNU linker" ON) option(USE_CCACHE "Turn on ccache usage" ON) -option(USE_DISTCC "Turn on distributed build_usage" ON) +option(USE_DISTCC "Turn on distributed build_usage" OFF) set (EXTENDED_POLICY "PROPRIETARY" CACHE STRING "Policy mode (PROPRIETARY, HTTP or EXTERNAL_PROPRIETARY)") set_property(CACHE EXTENDED_POLICY PROPERTY STRINGS PROPRIETARY HTTP EXTERNAL_PROPRIETARY) @@ -160,6 +160,11 @@ if (OS_TYPE_OPTION) endif() endif() +if (REMOTE_CONTROL) + add_definitions(-DSDL_REMOTE_CONTROL) + message(STATUS "Remote control support is enabled (aka Reverse SDL or SDL-RC)") +endif() + #Jenkins integration section end add_custom_target(pasa-tarball @@ -282,6 +287,8 @@ if(ENABLE_LOG) message(STATUS "Logger enabled") endif() +set(install-bson_c_lib "install-bson_c_lib") + if (TELEMETRY_MONITOR) add_definitions(-DTELEMETRY_MONITOR) message(STATUS "Telemetry monitor enabled") @@ -407,6 +414,18 @@ if(CMAKE_SYSTEM_NAME STREQUAL "QNX") set(RTLIB ) endif() +SET(RPATH_DIRECTORIES + ${CMAKE_INSTALL_PREFIX}/bin/plugins + /usr/local/lib + /usr/local + ${CMAKE_INSTALL_PREFIX}/bin +) +SET(CMAKE_SKIP_BUILD_RPATH FALSE) +SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) +SET(CMAKE_INSTALL_RPATH "${RPATH_DIRECTORIES}") +SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + + # Building tests if(BUILD_TESTS) enable_testing() diff --git a/src/3rd_party-static/message_broker/src/client/mb_controller.cpp b/src/3rd_party-static/message_broker/src/client/mb_controller.cpp index 8a4a77cf30..dde2290bb6 100644 --- a/src/3rd_party-static/message_broker/src/client/mb_controller.cpp +++ b/src/3rd_party-static/message_broker/src/client/mb_controller.cpp @@ -6,7 +6,7 @@ #include "mb_controller.hpp" -#include "MBDebugHelper.h" +#include "MBDebugHelper.h" #include "CMessageBroker.hpp" namespace NsMessageBroker @@ -45,7 +45,7 @@ namespace NsMessageBroker return recv; } std::string wmes = m_receiverWriter.write(root); - DBG_MSG(("Parsed JSON string:%s; length: %d\n", wmes.c_str(), wmes.length())); + DBG_MSG(("Parsed JSON string:%s; length: %zu\n", wmes.c_str(), wmes.length())); DBG_MSG(("Buffer is:%s\n", m_receivingBuffer.c_str())); ssize_t beginpos = m_receivingBuffer.find(wmes); if (-1 != beginpos) @@ -125,7 +125,7 @@ namespace NsMessageBroker } int bytesSent = Send(mes); bytesSent = bytesSent; // to prevent compiler warnings in case DBG_MSG off - DBG_MSG(("Length:%d, Sent: %d bytes\n", mes.length(), bytesSent)); + DBG_MSG(("Length: %zu, Sent: %d bytes\n", mes.length(), bytesSent)); } std::string CMessageBrokerController::findMethodById(std::string id) @@ -153,7 +153,7 @@ namespace NsMessageBroker return mControllersIdCurrent = mControllersIdStart; } } - + void CMessageBrokerController::prepareMessage(Json::Value& root) { root["jsonrpc"] = "2.0"; @@ -286,11 +286,11 @@ namespace NsMessageBroker { DBG_MSG(("CMessageBrokerController::checkMessage()\n")); Json::Value err; - + try { /* check the JSON-RPC version => 2.0 */ - if (!root.isObject() || !root.isMember("jsonrpc") || root["jsonrpc"] != "2.0") + if (!root.isObject() || !root.isMember("jsonrpc") || root["jsonrpc"] != "2.0") { error["id"] = Json::Value::null; error["jsonrpc"] = "2.0"; diff --git a/src/3rd_party-static/message_broker/src/lib_messagebroker/CMessageBroker.cpp b/src/3rd_party-static/message_broker/src/lib_messagebroker/CMessageBroker.cpp index 3b14489a8c..b1c29cb0ef 100644 --- a/src/3rd_party-static/message_broker/src/lib_messagebroker/CMessageBroker.cpp +++ b/src/3rd_party-static/message_broker/src/lib_messagebroker/CMessageBroker.cpp @@ -444,13 +444,13 @@ void CMessageBroker::onMessageReceived(int fd, std::string& aJSONData, bool tryH while (! aJSONData.empty()) { Json::Value root; if ((! p->m_reader.parse(aJSONData, root)) || root.isNull()) { - DBG_MSG_ERROR(("Unable to parse JSON!")); + DBG_MSG_ERROR(("Unable to parse JSON!\n")); if (! tryHard) { return; } uint8_t first_byte = static_cast<uint8_t>(aJSONData[0]); if ((first_byte <= 0x08) || ((first_byte >= 0x80) && (first_byte <= 0x88))) { - DBG_MSG((" There is an unparsed websocket header probably.\n")); + DBG_MSG(("There is an unparsed websocket header probably.\n")); /* Websocket headers can have FIN flag set in the first byte (0x80). * Then there are 3 zero bits and 4 bits for opcode (from 0x00 to 0x0A). * But actually we don't use opcodes above 0x08. @@ -458,12 +458,22 @@ void CMessageBroker::onMessageReceived(int fd, std::string& aJSONData, bool tryH * It can be a coincidence of course, but we have to give it a try. */ return; } else if ('{' == aJSONData[0]) { - DBG_MSG_ERROR((" Incomplete JSON object probably.\n")); + const bool is_object = true; + const size_t next_object_pos = + p->jumpOverJSONObjectOrArray(is_object, aJSONData); + + if (next_object_pos != std::string::npos) { + DBG_MSG_ERROR(("Invalid JSON object probably. Skipping.\n")); + aJSONData.erase(0, next_object_pos); + DBG_MSG(("Buffer after cut is: '%s'\n", aJSONData.c_str())); + continue; + } + DBG_MSG_ERROR(("Incomplete JSON object probably.\n")); return; } else { - DBG_MSG_ERROR((" Step in the buffer and try again...\n")); + DBG_MSG_ERROR(("Step in the buffer and try again...\n")); aJSONData.erase(0, 1); - DBG_MSG_ERROR(("Buffer after cut is: '%s'\n", aJSONData.c_str())); + DBG_MSG(("Buffer after cut is: '%s'\n", aJSONData.c_str())); continue; } @@ -505,7 +515,7 @@ void CMessageBroker::Test() { return; } std::string wmes = p->m_recieverWriter.write(root); - DBG_MSG(("Parsed JSON string:%s; length: %d\n", wmes.c_str(), wmes.length())); + DBG_MSG(("Parsed JSON string:%s; length: %zu\n", wmes.c_str(), wmes.length())); DBG_MSG(("Buffer is:%s\n", ReceivingBuffer.c_str())); ssize_t beginpos = ReceivingBuffer.find(wmes); ReceivingBuffer.erase(0, beginpos + wmes.length()); @@ -853,7 +863,7 @@ void CMessageBroker_Private::sendJsonMessage(int fd, Json::Value message) { DBG_MSG_ERROR(("Message hasn't been sent!\n")); return; } - DBG_MSG(("Length:%d, Sent: %d bytes\n", mes.length(), retVal)); + DBG_MSG(("Length: %zu, Sent: %d bytes\n", mes.length(), retVal)); } else { DBG_MSG_ERROR(("mpSender NULL pointer\n")); } diff --git a/src/3rd_party-static/message_broker/src/lib_messagebroker/CMessageBrokerRegistry.cpp b/src/3rd_party-static/message_broker/src/lib_messagebroker/CMessageBrokerRegistry.cpp index fb24d08f1c..e32145058f 100644 --- a/src/3rd_party-static/message_broker/src/lib_messagebroker/CMessageBrokerRegistry.cpp +++ b/src/3rd_party-static/message_broker/src/lib_messagebroker/CMessageBrokerRegistry.cpp @@ -10,7 +10,7 @@ #include <vector> #include <string> -namespace NsMessageBroker +namespace NsMessageBroker { CMessageBrokerRegistry::CMessageBrokerRegistry() { @@ -43,7 +43,7 @@ namespace NsMessageBroker DBG_MSG(("Controller already exists!\n")); } - DBG_MSG(("Count of controllers: %d\n", mControllersList.size())); + DBG_MSG(("Count of controllers: %zu\n", mControllersList.size())); return result; } @@ -64,7 +64,7 @@ namespace NsMessageBroker DBG_MSG(("No such controller in the list!\n")); return; } - DBG_MSG(("Count of controllers: %d\n", mControllersList.size())); + DBG_MSG(("Count of controllers: %zu\n", mControllersList.size())); } removeSubscribersByDescriptor(fd); } @@ -124,7 +124,7 @@ namespace NsMessageBroker mSubscribersList.insert(std::map <std::string, int>::value_type(name, fd)); } - DBG_MSG(("Count of subscribers: %d\n", mSubscribersList.size())); + DBG_MSG(("Count of subscribers: %zu\n", mSubscribersList.size())); return result; } @@ -146,7 +146,7 @@ namespace NsMessageBroker } } - DBG_MSG(("Count of subscribers: %d\n", mSubscribersList.size())); + DBG_MSG(("Count of subscribers: %zu\n", mSubscribersList.size())); } int CMessageBrokerRegistry::getDestinationFd(std::string name) diff --git a/src/3rd_party-static/message_broker/src/lib_messagebroker/websocket_handler.cpp b/src/3rd_party-static/message_broker/src/lib_messagebroker/websocket_handler.cpp index 7d3890b7a8..17c2dd92ae 100644 --- a/src/3rd_party-static/message_broker/src/lib_messagebroker/websocket_handler.cpp +++ b/src/3rd_party-static/message_broker/src/lib_messagebroker/websocket_handler.cpp @@ -19,7 +19,7 @@ #include "libMBDebugHelper.h" #include "md5.h" -namespace NsMessageBroker +namespace NsMessageBroker { unsigned int CWebSocketHandler::parseWebSocketDataLength( @@ -576,43 +576,43 @@ namespace NsMessageBroker return 0; } - + rawBytes CWebSocketHandler::handshake_hybi00(const std::string &key1, const std::string &key2, const rawBytes &key3) { if (key3.size() < 8) { - DBG_MSG_ERROR(("key3's size is %d, less than 8 bytes\n", key3.size())); + DBG_MSG_ERROR(("key3's size is %zu, less than 8 bytes\n", key3.size())); return rawBytes(); } - + unsigned long number1 = extractNumber(key1); unsigned long number2 = extractNumber(key2); DBG_MSG(("number1 is %ld, number2 is %ld\n", number1, number2)); - + if ((number1 == 0) || (number2 == 0)) { return rawBytes(); } - + // represent the numbers in big-endian format (network-byte order) unsigned long bigEndianNumber1 = htonl(number1); unsigned long bigEndianNumber2 = htonl(number2); - + // the temporary key consists of bytes of the first and second numbers // and the key3 rawBytes key(8); memcpy(&key[0], &bigEndianNumber1, 4); memcpy(&key[4], &bigEndianNumber2, 4); key.insert(key.end(), key3.begin(), key3.begin() + 8); - + MD5 md5(std::string(key.begin(), key.end())); char digest[16]; md5.getdigest(digest); rawBytes resultBytes(&digest[0], &digest[16]); - + return resultBytes; } - + unsigned long CWebSocketHandler::extractNumber(const std::string &key) const { // leave digits only @@ -631,9 +631,9 @@ namespace NsMessageBroker keyDigits += keyChar; } } - + unsigned long result = 0; - + // convert string to number long long numberKey; if (std::stringstream(keyDigits) >> numberKey) @@ -659,9 +659,9 @@ namespace NsMessageBroker { // couldn't convert } - + return result; } - + } /* namespace NsMessageBroker */ diff --git a/src/3rd_party-static/message_broker/src/server/mb_tcpserver.cpp b/src/3rd_party-static/message_broker/src/server/mb_tcpserver.cpp index bdd7b2bfdf..bd8fa341b0 100644 --- a/src/3rd_party-static/message_broker/src/server/mb_tcpserver.cpp +++ b/src/3rd_party-static/message_broker/src/server/mb_tcpserver.cpp @@ -64,7 +64,7 @@ bool TcpServer::Recv(int fd) { std::vector<char> buf; buf.reserve(RECV_BUFFER_LENGTH + pReceivingBuffer->size()); - DBG_MSG(("Left in pReceivingBuffer: %d \n", + DBG_MSG(("Left in pReceivingBuffer: %zu\n", pReceivingBuffer->size())); buf.assign(pReceivingBuffer->c_str(), pReceivingBuffer->c_str() + pReceivingBuffer->size()); @@ -102,7 +102,7 @@ bool TcpServer::Recv(int fd) { } *pReceivingBuffer = std::string(&buf[0], nb); - DBG_MSG(("pReceivingBuffer before onMessageReceived:%d : %s\n", + DBG_MSG(("pReceivingBuffer before onMessageReceived: %zu: %s\n", pReceivingBuffer->size(), pReceivingBuffer->c_str())); // we need to check for websocket handshake diff --git a/src/3rd_party/CMakeLists.txt b/src/3rd_party/CMakeLists.txt index cddc2d16b6..adafe686ab 100644 --- a/src/3rd_party/CMakeLists.txt +++ b/src/3rd_party/CMakeLists.txt @@ -283,9 +283,46 @@ if(HMI_DBUS_API) add_subdirectory(dbus-cmake) endif() +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}") +set(CMAKE_SOURCE_PREFIX ${CMAKE_SOURCE_PREFIX} "${3RD_PARTY_INSTALL_PREFIX}") +find_package (BSON) +message (STATUS "bson installed in " ${BSON_LIBS_DIRECTORY} " , " ${BSON_INCLUDE_DIRECTORY}) +message (STATUS "emhashmap installed in " ${EMHASHMAP_LIBS_DIRECTORY} " , " ${EMHASHMAP_INCLUDE_DIRECTORY}) + +if (${BSON_LIB} MATCHES "BSON_LIB-NOTFOUND") + message (STATUS "Building bson required") + set(BSON_LIB_SOURCE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bson_c_lib CACHE INTERNAL "Sources of bson library" FORCE) + set(BSON_LIBS_DIRECTORY ${3RD_PARTY_INSTALL_PREFIX}/lib CACHE INTERNAL "Installation path of bson libraries" FORCE) + set(BSON_INCLUDE_DIRECTORY ${3RD_PARTY_INSTALL_PREFIX}/include CACHE INTERNAL "Installation path of bson headers" FORCE) + set(EMHASHMAP_LIBS_DIRECTORY ${3RD_PARTY_INSTALL_PREFIX}/lib CACHE INTERNAL "Installation path of emashmap libraries" FORCE) + set(EMHASHMAP_INCLUDE_DIRECTORY ${3RD_PARTY_INSTALL_PREFIX}/include CACHE INTERNAL "Installation path of emashmap headers" FORCE) + + set(BSON_INSTALL_COMMAND make install) + if (${3RD_PARTY_INSTALL_PREFIX} MATCHES "/usr/local") + set(BSON_INSTALL_COMMAND sudo make install) + endif() + include(ExternalProject) + ExternalProject_Add(libbson + GIT_REPOSITORY "http://github.com/smartdevicelink/bson_c_lib.git" + GIT_TAG "master" + BINARY_DIR ${BSON_LIB_SOURCE_DIRECTORY} + INSTALL_DIR ${3RD_PARTY_INSTALL_PREFIX} + DOWNLOAD_DIR ${BSON_LIB_SOURCE_DIRECTORY} + SOURCE_DIR ${BSON_LIB_SOURCE_DIRECTORY} + CONFIGURE_COMMAND touch aclocal.m4 configure.ac Makefile.am Makefile.in configure config.h.in && ./configure --prefix=${3RD_PARTY_INSTALL_PREFIX} + BUILD_COMMAND make + INSTALL_COMMAND ${BSON_INSTALL_COMMAND}) +else() + get_filename_component(BSON_LIBS_DIRECTORY ${BSON_LIB} DIRECTORY) + get_filename_component(EMHASHMAP_LIBS_DIRECTORY ${EMHASHMAP_LIB} DIRECTORY) + set(BSON_LIBS_DIRECTORY ${BSON_LIBS_DIRECTORY} CACHE INTERNAL "Installation path of bson libraries" FORCE) + set(EMHASHMAP_LIBS_DIRECTORY ${BSON_LIBS_DIRECTORY} CACHE INTERNAL "Installation path of emashmap libraries" FORCE) +endif() + add_custom_target(install-3rd_party DEPENDS ${install-3rd_party_logger_var} DEPENDS ${install-3rd_party_dbus_var} + DEPENDS libbson WORKING_DIRECTORY ${3RD_PARTY_BINARY_DIRECTORY} ) diff --git a/src/3rd_party/FindBSON.cmake b/src/3rd_party/FindBSON.cmake new file mode 100644 index 0000000000..91d53624f1 --- /dev/null +++ b/src/3rd_party/FindBSON.cmake @@ -0,0 +1,26 @@ +set(INCLUDE_PATH "${CMAKE_SOURCE_PREFIX}/include") +set(LIB_PATH "${CMAKE_SOURCE_PREFIX}/lib") + +find_path(BSON_INCLUDE_DIRECTORY bson_object.h bson_array.h bson_util.h + PATHS "${INCLUDE_PATH}") + +find_library(BSON_LIB + NAMES bson + PATHS ${LIB_PATH}) + +find_path(EMHASHMAP_INCLUDE_DIRECTORY emhashmap.h + PATHS ${INCLUDE_PATH} + PATH_SUFFIXES emhashmap) + +find_library(EMHASHMAP_LIB + NAMES emhashmap + PATHS ${LIB_PATH}) + + +include(FindPackageHandleStandardArgs) + +find_package_handle_standard_args(BSON DEFAULT_MSG BSON_INCLUDE_DIRECTORY BSON_LIB + EMHASHMAP_INCLUDE_DIRECTORY EMHASHMAP_LIB) + +mark_as_advanced(BSON_INCLUDE_DIRECTORY BSON_LIB) +mark_as_advanced(EMHASHMAP_INCLUDE_DIRECTORY EMHASHMAP_LIB) diff --git a/src/3rd_party/apache-log4cxx-0.10.0/autom4te.cache/output.0 b/src/3rd_party/apache-log4cxx-0.10.0/autom4te.cache/output.0 deleted file mode 100644 index 5feeff5217..0000000000 --- a/src/3rd_party/apache-log4cxx-0.10.0/autom4te.cache/output.0 +++ /dev/null @@ -1,21759 +0,0 @@ -@%:@! /bin/sh -@%:@ Guess values for system-dependent variables and create Makefiles. -@%:@ Generated by GNU Autoconf 2.69. -@%:@ -@%:@ -@%:@ Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. -@%:@ -@%:@ -@%:@ This configure script is free software; the Free Software Foundation -@%:@ gives unlimited permission to copy, distribute and modify it. -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in @%:@( - *posix*) : - set -o posix ;; @%:@( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in @%:@( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in @%:@(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -# Use a proper internal environment variable to ensure we don't fall - # into an infinite loop, continuously re-executing ourselves. - if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then - _as_can_reexec=no; export _as_can_reexec; - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in @%:@ (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 - fi - # We don't want this to propagate to other subprocesses. - { _as_can_reexec=; unset _as_can_reexec;} -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in @%:@( - *posix*) : - set -o posix ;; @%:@( - *) : - ;; -esac -fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1 -test -x / || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes -else - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : - -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in @%:@( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : - break 2 -fi -fi - done;; - esac - as_found=false -done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } -IFS=$as_save_IFS - - - if test "x$CONFIG_SHELL" != x; then : - export CONFIG_SHELL - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in @%:@ (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, -$0: including any error possibly output before this -$0: message. Then install a modern shell, or manually run -$0: the script under such a shell if you do have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -@%:@ as_fn_unset VAR -@%:@ --------------- -@%:@ Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -@%:@ as_fn_set_status STATUS -@%:@ ----------------------- -@%:@ Set @S|@? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} @%:@ as_fn_set_status - -@%:@ as_fn_exit STATUS -@%:@ ----------------- -@%:@ Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} @%:@ as_fn_exit - -@%:@ as_fn_mkdir_p -@%:@ ------------- -@%:@ Create "@S|@as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} @%:@ as_fn_mkdir_p - -@%:@ as_fn_executable_p FILE -@%:@ ----------------------- -@%:@ Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} @%:@ as_fn_executable_p -@%:@ as_fn_append VAR VALUE -@%:@ ---------------------- -@%:@ Append the text in VALUE to the end of the definition contained in VAR. Take -@%:@ advantage of any shell optimizations that allow amortized linear growth over -@%:@ repeated appends, instead of the typical quadratic growth present in naive -@%:@ implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -@%:@ as_fn_arith ARG... -@%:@ ------------------ -@%:@ Perform arithmetic evaluation on the ARGs, and store the result in the -@%:@ global @S|@as_val. Take advantage of shells that can avoid forks. The arguments -@%:@ must be portable across @S|@(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -@%:@ as_fn_error STATUS ERROR [LINENO LOG_FD] -@%:@ ---------------------------------------- -@%:@ Output "`basename @S|@0`: error: ERROR" to stderr. If LINENO and LOG_FD are -@%:@ provided, also output the error to LOG_FD, referencing LINENO. Then exit the -@%:@ script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} @%:@ as_fn_error - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # If we had to re-execute with $CONFIG_SHELL, we're ensured to have - # already done that, so ensure we don't try to do so again and fall - # in an infinite loop. This has already happened in practice. - _as_can_reexec=no; export _as_can_reexec - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in @%:@((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - - -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} - -case X$ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` - ;; -esac - -echo=${ECHO-echo} -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then - # Yippee, $echo works! - : -else - # Restart under the correct shell. - exec $SHELL "$0" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat <<EOF -$* -EOF - exit 0 -fi - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test -z "$ECHO"; then -if test "X${echo_test_string+set}" != Xset; then -# find a string as large as possible, as long as the shell can cope with it - for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do - # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... - if (echo_test_string=`eval $cmd`) 2>/dev/null && - echo_test_string=`eval $cmd` && - (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null - then - break - fi - done -fi - -if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : -else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$echo" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - echo='print -r' - elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} - else - # Try using printf. - echo='printf %s\n' - if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - echo="$CONFIG_SHELL $0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$CONFIG_SHELL $0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do - if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null - then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "$0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} - else - # Oops. We lost completely, so just stick with echo. - echo=echo - fi - fi - fi - fi -fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -ECHO=$echo -if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then - ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" -fi - - - - -tagnames=${tagnames+${tagnames},}CXX - -tagnames=${tagnames+${tagnames},}F77 - -test -n "$DJDIR" || exec 7<&0 </dev/null -exec 6>&1 - -# Name of the host. -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIB@&t@OBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= - -# Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= -PACKAGE_URL= - -ac_unique_file="src/main/cpp/logger.cpp" -# Factoring default headers for most tests. -ac_includes_default="\ -#include <stdio.h> -#ifdef HAVE_SYS_TYPES_H -# include <sys/types.h> -#endif -#ifdef HAVE_SYS_STAT_H -# include <sys/stat.h> -#endif -#ifdef STDC_HEADERS -# include <stdlib.h> -# include <stddef.h> -#else -# ifdef HAVE_STDLIB_H -# include <stdlib.h> -# endif -#endif -#ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include <memory.h> -# endif -# include <string.h> -#endif -#ifdef HAVE_STRINGS_H -# include <strings.h> -#endif -#ifdef HAVE_INTTYPES_H -# include <inttypes.h> -#endif -#ifdef HAVE_STDINT_H -# include <stdint.h> -#endif -#ifdef HAVE_UNISTD_H -# include <unistd.h> -#endif" - -ac_subst_vars='LTLIBOBJS -LIB@&t@OBJS -LOGCHAR_IS_UNICHAR -LOGCHAR_IS_WCHAR -LOGCHAR_IS_UTF8 -CHARSET_EBCDIC -CHARSET_USASCII -CHARSET_ISO88591 -CHARSET_UTF8 -CFSTRING_API -UNICHAR_API -WCHAR_T_API -CHAR_API -HAS_LIBESMTP -CPPFLAGS_ODBC -LIBS_ODBC -IODBC_CONFIG -HAS_ODBC -HAS_FWIDE -HAS_WCHAR_T -HAS_STD_LOCALE -HAS_SYSLOG -HAS_WCSTOMBS -HAS_MBSRTOWCS -APU_LIBS -APR_LIBS -base_dir -manual_dest -enable_latex_docs -enable_html_docs -enable_dot -LATEX_DOC_FALSE -LATEX_DOC_TRUE -DOC_FALSE -DOC_TRUE -DOT -DOXYGEN -LIBTOOL -ac_ct_F77 -FFLAGS -F77 -CXXCPP -am__fastdepCXX_FALSE -am__fastdepCXX_TRUE -CXXDEPMODE -ac_ct_CXX -CXXFLAGS -CXX -CPP -RANLIB -AR -ECHO -LN_S -EGREP -GREP -am__fastdepCC_FALSE -am__fastdepCC_TRUE -CCDEPMODE -AMDEPBACKSLASH -AMDEP_FALSE -AMDEP_TRUE -am__quote -am__include -DEPDIR -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -am__untar -am__tar -AMTAR -am__leading_dot -SET_MAKE -AWK -mkdir_p -INSTALL_STRIP_PROGRAM -STRIP -install_sh -MAKEINFO -AUTOHEADER -AUTOMAKE -AUTOCONF -ACLOCAL -VERSION -PACKAGE -CYGPATH_W -INSTALL_DATA -INSTALL_SCRIPT -INSTALL_PROGRAM -LT_VERSION -target_os -target_vendor -target_cpu -target -host_os -host_vendor -host_cpu -host -build_os -build_vendor -build_cpu -build -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_URL -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -PATH_SEPARATOR -SHELL' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -enable_shared -enable_static -enable_fast_install -enable_dependency_tracking -with_gnu_ld -enable_libtool_lock -with_pic -with_tags -enable_doxygen -enable_dot -enable_html_docs -enable_latex_docs -with_apr -with_apr_util -with_ODBC -with_SMTP -enable_char -enable_wchar_t -enable_unichar -enable_cfstring -with_charset -with_logchar -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CPP -CXX -CXXFLAGS -CCC -CXXCPP -F77 -FFLAGS' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *=) ac_optarg= ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; - - -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) as_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; - esac - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error $? "missing argument to $ac_option" -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error $? "working directory cannot be determined" -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error $? "pwd does not report name of working directory" - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures this package to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking ...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - @<:@@S|@ac_default_prefix@:>@ - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - @<:@PREFIX@:>@ - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root @<:@DATAROOTDIR/doc/PACKAGE@:>@ - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -Program names: - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM run sed PROGRAM on installed program names - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] - --target=TARGET configure for building compilers for TARGET [HOST] -_ACEOF -fi - -if test -n "$ac_init_help"; then - - cat <<\_ACEOF - -Optional Features: - --disable-option-checking ignore unrecognized --enable/--with options - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-shared@<:@=PKGS@:>@ build shared libraries @<:@default=yes@:>@ - --enable-static@<:@=PKGS@:>@ build static libraries @<:@default=yes@:>@ - --enable-fast-install@<:@=PKGS@:>@ - optimize for fast installation @<:@default=yes@:>@ - --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors - --disable-libtool-lock avoid locking (might break parallel builds) - --enable-doxygen enable documentation generation with doxygen (auto) - --enable-dot use 'dot' to generate graphs in doxygen (auto) - --enable-html-docs enable HTML generation with doxygen (yes) - --enable-latex-docs enable LaTeX documentation generation with doxygen - (no) - --enable-char enable char API (yes) - --enable-wchar_t enable wchar_t API (yes if wchar_t available) - --enable-unichar enable unichar API (no) - --enable-cfstring enable cfstring API (no) - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-gnu-ld assume the C compiler uses GNU ld @<:@default=no@:>@ - --with-pic try to use only PIC/non-PIC objects @<:@default=use - both@:>@ - --with-tags@<:@=TAGS@:>@ include additional configurations @<:@automatic@:>@ - --with-apr=PATH prefix for installed APR or the full path to - apr-config - --with-apr-util=PATH prefix for installed APU or the full path to - apu-config - --with-ODBC ODBC support. Accepted arguments : unixODBC, iODBC, - Microsoft, no (default=no) - --with-SMTP SMTP support. Accepted arguments : libesmtp, no - (default=no) - --with-charset=TYPE locale charset. Accepted TYPE variants: auto, utf-8, - iso-8859-1, usascii, ebcdic (default=auto) - --with-logchar=TYPE type for logchar. Accepted TYPE variants: utf-8, - wchar_t, unichar (default=utf-8) - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a - nonstandard directory <lib dir> - LIBS libraries to pass to the linker, e.g. -l<library> - CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if - you have headers in a nonstandard directory <include dir> - CPP C preprocessor - CXX C++ compiler command - CXXFLAGS C++ compiler flags - CXXCPP C++ preprocessor - F77 Fortran 77 compiler command - FFLAGS Fortran 77 compiler flags - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to the package provider. -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -configure -generated by GNU Autoconf 2.69 - -Copyright (C) 2012 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -@%:@ ac_fn_c_try_compile LINENO -@%:@ -------------------------- -@%:@ Try to compile conftest.@S|@ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} @%:@ ac_fn_c_try_compile - -@%:@ ac_fn_c_try_link LINENO -@%:@ ----------------------- -@%:@ Try to link conftest.@S|@ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} @%:@ ac_fn_c_try_link - -@%:@ ac_fn_c_try_cpp LINENO -@%:@ ---------------------- -@%:@ Try to preprocess conftest.@S|@ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} @%:@ ac_fn_c_try_cpp - -@%:@ ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -@%:@ ------------------------------------------------------- -@%:@ Tests whether HEADER exists, giving a warning if it cannot be compiled using -@%:@ the include files in INCLUDES and setting the cache variable VAR -@%:@ accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -@%:@include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -@%:@include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} @%:@ ac_fn_c_check_header_mongrel - -@%:@ ac_fn_c_try_run LINENO -@%:@ ---------------------- -@%:@ Try to link conftest.@S|@ac_ext, and return whether this succeeded. Assumes -@%:@ that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} @%:@ ac_fn_c_try_run - -@%:@ ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -@%:@ ------------------------------------------------------- -@%:@ Tests whether HEADER exists and can be compiled using the include files in -@%:@ INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -@%:@include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} @%:@ ac_fn_c_check_header_compile - -@%:@ ac_fn_c_check_func LINENO FUNC VAR -@%:@ ---------------------------------- -@%:@ Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case <limits.h> declares $2. - For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$2 || defined __stub___$2 -choke me -#endif - -int -main () -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} @%:@ ac_fn_c_check_func - -@%:@ ac_fn_cxx_try_compile LINENO -@%:@ ---------------------------- -@%:@ Try to compile conftest.@S|@ac_ext, and return whether this succeeded. -ac_fn_cxx_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} @%:@ ac_fn_cxx_try_compile - -@%:@ ac_fn_cxx_try_cpp LINENO -@%:@ ------------------------ -@%:@ Try to preprocess conftest.@S|@ac_ext, and return whether this succeeded. -ac_fn_cxx_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} @%:@ ac_fn_cxx_try_cpp - -@%:@ ac_fn_cxx_try_link LINENO -@%:@ ------------------------- -@%:@ Try to link conftest.@S|@ac_ext, and return whether this succeeded. -ac_fn_cxx_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} @%:@ ac_fn_cxx_try_link - -@%:@ ac_fn_f77_try_compile LINENO -@%:@ ---------------------------- -@%:@ Try to compile conftest.@S|@ac_ext, and return whether this succeeded. -ac_fn_f77_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_f77_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} @%:@ ac_fn_f77_try_compile - -@%:@ ac_fn_f77_try_link LINENO -@%:@ ------------------------- -@%:@ Try to link conftest.@S|@ac_ext, and return whether this succeeded. -ac_fn_f77_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_f77_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} @%:@ ac_fn_f77_try_link - -@%:@ ac_fn_cxx_check_func LINENO FUNC VAR -@%:@ ------------------------------------ -@%:@ Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_cxx_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case <limits.h> declares $2. - For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$2 || defined __stub___$2 -choke me -#endif - -int -main () -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} @%:@ ac_fn_cxx_check_func - -@%:@ ac_fn_cxx_check_header_mongrel LINENO HEADER VAR INCLUDES -@%:@ --------------------------------------------------------- -@%:@ Tests whether HEADER exists, giving a warning if it cannot be compiled using -@%:@ the include files in INCLUDES and setting the cache variable VAR -@%:@ accordingly. -ac_fn_cxx_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -@%:@include <$2> -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -@%:@include <$2> -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} @%:@ ac_fn_cxx_check_header_mongrel -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by $as_me, which was -generated by GNU Autoconf 2.69. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" - done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; - 2) - as_fn_append ac_configure_args1 " '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - as_fn_append ac_configure_args " '$ac_arg'" - ;; - esac - done -done -{ ac_configure_args0=; unset ac_configure_args0;} -{ ac_configure_args1=; unset ac_configure_args1;} - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - $as_echo "## ---------------- ## -## Cache variables. ## -## ---------------- ##" - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - $as_echo "## ----------------- ## -## Output variables. ## -## ----------------- ##" - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## -## File substitutions. ## -## ------------------- ##" - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - $as_echo "## ----------- ## -## confdefs.h. ## -## ----------- ##" - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -$as_echo "/* confdefs.h */" > confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -@%:@define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -@%:@define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -@%:@define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - -cat >>confdefs.h <<_ACEOF -@%:@define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - -cat >>confdefs.h <<_ACEOF -@%:@define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - -cat >>confdefs.h <<_ACEOF -@%:@define PACKAGE_URL "$PACKAGE_URL" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE -if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in @%:@(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac -elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site -else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site -fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" -do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You 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. -# -# autoconf 2.50 or higher to rebuild aclocal.m4, because the -# AC_CREATE_PREFIX_CONFIG_H macro needs the AS_DIRNAME macro. - - -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -$as_echo_n "checking build system type... " >&6; } -if ${ac_cv_build+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -$as_echo "$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -$as_echo_n "checking host system type... " >&6; } -if ${ac_cv_host+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build -else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -$as_echo "$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 -$as_echo_n "checking target system type... " >&6; } -if ${ac_cv_target+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$target_alias" = x; then - ac_cv_target=$ac_cv_host -else - ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 -$as_echo "$ac_cv_target" >&6; } -case $ac_cv_target in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; -esac -target=$ac_cv_target -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_target -shift -target_cpu=$1 -target_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -target_os=$* -IFS=$ac_save_IFS -case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac - - -# The aliases save the names the user supplied, while $host etc. -# will get canonicalized. -test -n "$target_alias" && - test "$program_prefix$program_suffix$program_transform_name" = \ - NONENONEs,x,x, && - program_prefix=${target_alias}- - -# -# +1 : ? : +1 == new interface that does not break old one -# +1 : ? : 0 == new interface that breaks old one -# ? : ? : 0 == no new interfaces, but breaks apps -# ? :+1 : ? == just some internal changes, nothing breaks but might work -# better -# CURRENT : REVISION : AGE -LT_VERSION=10:0:0 - - - - - -am__api_version="1.9" -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in @%:@(( - ./ | .// | /[cC]/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - rm -rf conftest.one conftest.two conftest.dir - echo one > conftest.one - echo two > conftest.two - mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && - test -s conftest.one && test -s conftest.two && - test -s conftest.dir/conftest.one && - test -s conftest.dir/conftest.two - then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - fi - done - done - ;; -esac - - done -IFS=$as_save_IFS - -rm -rf conftest.one conftest.two conftest.dir - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 -$as_echo_n "checking whether build environment is sane... " >&6; } -# Just in case -sleep 1 -echo timestamp > conftest.file -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftest.file` - fi - rm -f conftest.file - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - as_fn_error $? "ls -t appears to fail. Make sure there is not a broken -alias in your environment" "$LINENO" 5 - fi - - test "$2" = conftest.file - ) -then - # Ok. - : -else - as_fn_error $? "newly created file is older than distributed files! -Check your system clock" "$LINENO" 5 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -test "$program_prefix" != NONE && - program_transform_name="s&^&$program_prefix&;$program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s&\$&$program_suffix&;$program_transform_name" -# Double any \ or $. -# By default was `s,x,x', remove it if useless. -ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` - -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` - -test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} -fi - -if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # We used to keeping the `.' as first argument, in order to - # allow $(mkdir_p) to be used without argument. As in - # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. However this is wrong - # for two reasons: - # 1. if the package is installed by a user who cannot write `.' - # make install will fail, - # 2. the above comment should most certainly read - # $(mkdir_p) $(DESTDIR)$(somedir) - # so it does not work when $(somedir) is undefined and - # $(DESTDIR) is not. - # To support the latter case, we have to write - # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), - # so the `.' trick is pointless. - mkdir_p='mkdir -p --' -else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - for d in ./-p ./--version; - do - test -d $d && rmdir $d - done - # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. - if test -f "$ac_aux_dir/mkinstalldirs"; then - mkdir_p='$(mkinstalldirs)' - else - mkdir_p='$(install_sh) -d' - fi -fi - -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$AWK" && break -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } -set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' -_ACEOF -# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. -case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; - *) - eval ac_cv_prog_make_${ac_make}_set=no;; -esac -rm -f conftest.make -fi -if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - SET_MAKE= -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - SET_MAKE="MAKE=${MAKE-make}" -fi - -rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null - -# test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi - - -# Define the identity of the package. - PACKAGE=log4cxx - VERSION=0.10.0 - - -cat >>confdefs.h <<_ACEOF -@%:@define PACKAGE "$PACKAGE" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -@%:@define VERSION "$VERSION" -_ACEOF - -# Some tools Automake needs. - -ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} - - -AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} - - -AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} - - -AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} - - -MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} - -install_sh=${install_sh-"$am_aux_dir/install-sh"} - -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -if test "$cross_compiling" != no; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -fi -INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" - -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -# Always define AMTAR for backward compatibility. - -AMTAR=${AMTAR-"${am_missing_run}tar"} - -am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' - - - - - - -# Checks for programs -# ---------------------------------------------------------------------------- - -@%:@ Check whether --enable-shared was given. -if test "${enable_shared+set}" = set; then : - enableval=$enable_shared; p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_shared=yes -fi - - -@%:@ Check whether --enable-static was given. -if test "${enable_static+set}" = set; then : - enableval=$enable_static; p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_static=yes -fi - - -@%:@ Check whether --enable-fast-install was given. -if test "${enable_fast_install+set}" = set; then : - enableval=$enable_fast_install; p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_fast_install=yes -fi - - -DEPDIR="${am__leading_dot}deps" - -ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo done -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 -$as_echo_n "checking for style of include used by $am_make... " >&6; } -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# We grep out `Entering directory' and `Leaving directory' -# messages which can occur if `w' ends up in MAKEFLAGS. -# In particular we don't look at `^make:' because GNU make might -# be invoked under some other name (usually "gmake"), in which -# case it prints its new name instead of `make'. -if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then - am__include=include - am__quote= - _am_result=GNU -fi -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then - am__include=.include - am__quote="\"" - _am_result=BSD - fi -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 -$as_echo "$_am_result" >&6; } -rm -f confinc confmf - -@%:@ Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : - enableval=$enable_dependency_tracking; -fi - -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' -fi - - -if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $@%:@ != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -ac_exeext=$ac_cv_exeext - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -@%:@include <stdio.h> -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <stdarg.h> -#include <stdio.h> -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -depcc="$CC" am_compiler_list= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - - -if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 -$as_echo_n "checking for a sed that does not truncate output... " >&6; } -if ${lt_cv_path_SED+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && continue - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done - -fi - -SED=$lt_cv_path_SED -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SED" >&5 -$as_echo "$SED" >&6; } - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - - -@%:@ Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then : - withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -$as_echo_n "checking for ld used by $CC... " >&6; } - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } -fi -if ${lt_cv_path_LD+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in - *GNU* | *'with BFD'*) - test "$with_gnu_ld" != no && break - ;; - *) - test "$with_gnu_ld" != yes && break - ;; - esac - fi - done - IFS="$lt_save_ifs" -else - lt_cv_path_LD="$LD" # Let the user override the test with a path. -fi -fi - -LD="$lt_cv_path_LD" -if test -n "$LD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 -$as_echo "$LD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if ${lt_cv_prog_gnu_ld+:} false; then : - $as_echo_n "(cached) " >&6 -else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 </dev/null` in -*GNU* | *'with BFD'*) - lt_cv_prog_gnu_ld=yes - ;; -*) - lt_cv_prog_gnu_ld=no - ;; -esac -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5 -$as_echo "$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 -$as_echo_n "checking for $LD option to reload object files... " >&6; } -if ${lt_cv_ld_reload_flag+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_reload_flag='-r' -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 -$as_echo "$lt_cv_ld_reload_flag" >&6; } -reload_flag=$lt_cv_ld_reload_flag -case $reload_flag in -"" | " "*) ;; -*) reload_flag=" $reload_flag" ;; -esac -reload_cmds='$LD$reload_flag -o $output$reload_objs' -case $host_os in - darwin*) - if test "$GCC" = yes; then - reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' - else - reload_cmds='$LD$reload_flag -o $output$reload_objs' - fi - ;; -esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD-compatible nm" >&5 -$as_echo_n "checking for BSD-compatible nm... " >&6; } -if ${lt_cv_path_NM+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS="$lt_save_ifs" - done - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 -$as_echo "$lt_cv_path_NM" >&6; } -NM="$lt_cv_path_NM" - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 -$as_echo_n "checking whether ln -s works... " >&6; } -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 -$as_echo "no, using $LN_S" >&6; } -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognise dependent libraries" >&5 -$as_echo_n "checking how to recognise dependent libraries... " >&6; } -if ${lt_cv_deplibs_check_method+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [[regex]]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given extended regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. - -case $host_os in -aix4* | aix5*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi[45]*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin*) - # func_win32_libid is a shell function defined in ltmain.sh - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - ;; - -mingw* | pw32*) - # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump'. - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | kfreebsd*-gnu | dragonfly*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -interix3*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux*) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd* | netbsdelf*-gnu | knetbsd*-gnu) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -nto-qnx*) - lt_cv_deplibs_check_method=unknown - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; -esac - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 -$as_echo "$lt_cv_deplibs_check_method" >&6; } -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -@%:@ Check whether --enable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then : - enableval=$enable_libtool_lock; -fi - -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '#line __oline__ "configure"' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 -$as_echo_n "checking whether the C compiler needs -belf... " >&6; } -if ${lt_cv_cc_needs_belf+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_cc_needs_belf=yes -else - lt_cv_cc_needs_belf=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 -$as_echo "$lt_cv_cc_needs_belf" >&6; } - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -sparc*-*solaris*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.o` in - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) LD="${LD-ld} -m elf64_sparc" ;; - *) LD="${LD-ld} -64" ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - - -esac - -need_locks="$enable_libtool_lock" - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - # <limits.h> exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -@%:@ifdef __STDC__ -@%:@ include <limits.h> -@%:@else -@%:@ include <assert.h> -@%:@endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -@%:@include <ac_nonexistent.h> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - # <limits.h> exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -@%:@ifdef __STDC__ -@%:@ include <limits.h> -@%:@else -@%:@ include <assert.h> -@%:@endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -@%:@include <ac_nonexistent.h> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <stdlib.h> -#include <stdarg.h> -#include <string.h> -#include <float.h> - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <string.h> - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <stdlib.h> - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <ctype.h> -#include <stdlib.h> -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "@%:@define STDC_HEADERS 1" >>confdefs.h - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -@%:@define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -for ac_header in dlfcn.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default" -if test "x$ac_cv_header_dlfcn_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -@%:@define HAVE_DLFCN_H 1 -_ACEOF - -fi - -done - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX"; then - if test -n "$CCC"; then - CXX=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -$as_echo "$CXX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CXX="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -$as_echo "$ac_ct_CXX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CXX" && break -done - - if test "x$ac_ct_CXX" = x; then - CXX="g++" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CXX=$ac_ct_CXX - fi -fi - - fi -fi -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 -$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } -if ${ac_cv_cxx_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 -$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GXX=yes -else - GXX= -fi -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 -$as_echo_n "checking whether $CXX accepts -g... " >&6; } -if ${ac_cv_prog_cxx_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_cxx_werror_flag=$ac_cxx_werror_flag - ac_cxx_werror_flag=yes - ac_cv_prog_cxx_g=no - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_prog_cxx_g=yes -else - CXXFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - -else - ac_cxx_werror_flag=$ac_save_cxx_werror_flag - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_prog_cxx_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_cxx_werror_flag=$ac_save_cxx_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 -$as_echo "$ac_cv_prog_cxx_g" >&6; } -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -depcc="$CXX" am_compiler_list= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CXX_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CXX_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CXX_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CXX_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } -CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type - - - -if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then - am__fastdepCXX_TRUE= - am__fastdepCXX_FALSE='#' -else - am__fastdepCXX_TRUE='#' - am__fastdepCXX_FALSE= -fi - - - - -if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 -$as_echo_n "checking how to run the C++ preprocessor... " >&6; } -if test -z "$CXXCPP"; then - if ${ac_cv_prog_CXXCPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CXXCPP needs to be expanded - for CXXCPP in "$CXX -E" "/lib/cpp" - do - ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - # <limits.h> exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -@%:@ifdef __STDC__ -@%:@ include <limits.h> -@%:@else -@%:@ include <assert.h> -@%:@endif - Syntax error -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -@%:@include <ac_nonexistent.h> -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CXXCPP=$CXXCPP - -fi - CXXCPP=$ac_cv_prog_CXXCPP -else - ac_cv_prog_CXXCPP=$CXXCPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 -$as_echo "$CXXCPP" >&6; } -ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - # <limits.h> exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -@%:@ifdef __STDC__ -@%:@ include <limits.h> -@%:@else -@%:@ include <assert.h> -@%:@endif - Syntax error -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -@%:@include <ac_nonexistent.h> -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -fi - - -ac_ext=f -ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_f77_compiler_gnu -if test -n "$ac_tool_prefix"; then - for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn nagfor - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_F77+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$F77"; then - ac_cv_prog_F77="$F77" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_F77="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -F77=$ac_cv_prog_F77 -if test -n "$F77"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $F77" >&5 -$as_echo "$F77" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$F77" && break - done -fi -if test -z "$F77"; then - ac_ct_F77=$F77 - for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn nagfor -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_F77+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_F77"; then - ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_F77="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_F77=$ac_cv_prog_ac_ct_F77 -if test -n "$ac_ct_F77"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_F77" >&5 -$as_echo "$ac_ct_F77" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_F77" && break -done - - if test "x$ac_ct_F77" = x; then - F77="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - F77=$ac_ct_F77 - fi -fi - - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for Fortran 77 compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done -rm -f a.out - -# If we don't use `.F' as extension, the preprocessor is not run on the -# input file. (Note that this only needs to work for GNU compilers.) -ac_save_ext=$ac_ext -ac_ext=F -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU Fortran 77 compiler" >&5 -$as_echo_n "checking whether we are using the GNU Fortran 77 compiler... " >&6; } -if ${ac_cv_f77_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat > conftest.$ac_ext <<_ACEOF - program main -#ifndef __GNUC__ - choke me -#endif - - end -_ACEOF -if ac_fn_f77_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_f77_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_f77_compiler_gnu" >&5 -$as_echo "$ac_cv_f77_compiler_gnu" >&6; } -ac_ext=$ac_save_ext -ac_test_FFLAGS=${FFLAGS+set} -ac_save_FFLAGS=$FFLAGS -FFLAGS= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $F77 accepts -g" >&5 -$as_echo_n "checking whether $F77 accepts -g... " >&6; } -if ${ac_cv_prog_f77_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - FFLAGS=-g -cat > conftest.$ac_ext <<_ACEOF - program main - - end -_ACEOF -if ac_fn_f77_try_compile "$LINENO"; then : - ac_cv_prog_f77_g=yes -else - ac_cv_prog_f77_g=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_f77_g" >&5 -$as_echo "$ac_cv_prog_f77_g" >&6; } -if test "$ac_test_FFLAGS" = set; then - FFLAGS=$ac_save_FFLAGS -elif test $ac_cv_prog_f77_g = yes; then - if test "x$ac_cv_f77_compiler_gnu" = xyes; then - FFLAGS="-g -O2" - else - FFLAGS="-g" - fi -else - if test "x$ac_cv_f77_compiler_gnu" = xyes; then - FFLAGS="-O2" - else - FFLAGS= - fi -fi - -if test $ac_compiler_gnu = yes; then - G77=yes -else - G77= -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! - -# find the maximum length of command line arguments -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 -$as_echo_n "checking the maximum length of command line arguments... " >&6; } -if ${lt_cv_sys_max_cmd_len+:} false; then : - $as_echo_n "(cached) " >&6 -else - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ - = "XX$teststring") >/dev/null 2>&1 && - new_result=`expr "X$teststring" : ".*" 2>&1` && - lt_cv_sys_max_cmd_len=$new_result && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - teststring= - # Add a significant safety factor because C++ compilers can tack on massive - # amounts of additional arguments before passing them to the linker. - # It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - ;; - esac - -fi - -if test -n $lt_cv_sys_max_cmd_len ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 -$as_echo "$lt_cv_sys_max_cmd_len" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 -$as_echo "none" >&6; } -fi - - - - -# Check for command to grab the raw symbol name followed by C symbol from nm. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 -$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } -if ${lt_cv_sys_global_symbol_pipe+:} false; then : - $as_echo_n "(cached) " >&6 -else - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw* | pw32*) - symcode='[ABCDGISTW]' - ;; -hpux*) # Its linker distinguishes data from code symbols - if test "$host_cpu" = ia64; then - symcode='[ABCDEGRST]' - fi - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -linux*) - if test "$host_cpu" = ia64; then - symcode='[ABCDGIRSTW]' - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - fi - ;; -irix* | nonstopux*) - symcode='[BCDEGRST]' - ;; -osf*) - symcode='[BCDEGQRST]' - ;; -solaris*) - symcode='[BDRT]' - ;; -sco3.2v5*) - symcode='[DT]' - ;; -sysv4.2uw2*) - symcode='[DT]' - ;; -sysv5* | sco5v6* | unixware* | OpenUNIX*) - symcode='[ABDT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[ABCDGIRSTW]' ;; -esac - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <<EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -EOF - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - # Now try to grab the symbols. - nlist=conftest.nm - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\""; } >&5 - (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if grep ' nm_test_var$' "$nlist" >/dev/null; then - if grep ' nm_test_func$' "$nlist" >/dev/null; then - cat <<EOF > conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' - - cat <<EOF >> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr_t address; -} -lt_preloaded_symbols[] = -{ -EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done - -fi - -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 -$as_echo "ok" >&6; } -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 -$as_echo_n "checking for objdir... " >&6; } -if ${lt_cv_objdir+:} false; then : - $as_echo_n "(cached) " >&6 -else - rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 -$as_echo "$lt_cv_objdir" >&6; } -objdir=$lt_cv_objdir - - - - - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e 1s/^X//' -sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AR="${ac_tool_prefix}ar" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -$as_echo "$AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_AR"; then - ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_AR="ar" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -$as_echo "$ac_ct_AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_AR" = x; then - AR="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - AR=$ac_ct_AR - fi -else - AR="$ac_cv_prog_AR" -fi - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -test -z "$AS" && AS=as -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$LD" && LD=ld -test -z "$LN_S" && LN_S="ln -s" -test -z "$MAGIC_CMD" && MAGIC_CMD=file -test -z "$NM" && NM=nm -test -z "$SED" && SED=sed -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$RANLIB" && RANLIB=: -test -z "$STRIP" && STRIP=: -test -z "$ac_objext" && ac_objext=o - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - - -# Only perform the check for file, if the check method requires it -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 -$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/${ac_tool_prefix}file; then - lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 -$as_echo_n "checking for file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/file; then - lt_cv_path_MAGIC_CMD="$ac_dir/file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - else - MAGIC_CMD=: - fi -fi - - fi - ;; -esac - -enable_dlopen=no -enable_win32_dll=no - -@%:@ Check whether --enable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then : - enableval=$enable_libtool_lock; -fi - -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - - -@%:@ Check whether --with-pic was given. -if test "${with_pic+set}" = set; then : - withval=$with_pic; pic_mode="$withval" -else - pic_mode=default -fi - -test -z "$pic_mode" && pic_mode=default - -# Use C for the default configuration in the libtool script -tagname= -lt_save_CC="$CC" -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -objext=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}\n' - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - - -lt_prog_compiler_no_builtin_flag= - -if test "$GCC" = yes; then - lt_prog_compiler_no_builtin_flag=' -fno-builtin' - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } -if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:__oline__: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $rm conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } - -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then - lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" -else - : -fi - -fi - -lt_prog_compiler_wl= -lt_prog_compiler_pic= -lt_prog_compiler_static= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } - - if test "$GCC" = yes; then - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_static='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic='-fno-common' - ;; - - interix3*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - ;; - - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - else - lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' - fi - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case $cc_basename in - xlc*) - lt_prog_compiler_pic='-qnocommon' - lt_prog_compiler_wl='-Wl,' - ;; - esac - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static='-non_shared' - ;; - - newsos6) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - linux*) - case $cc_basename in - icc* | ecc*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-static' - ;; - pgcc* | pgf77* | pgf90* | pgf95*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fpic' - lt_prog_compiler_static='-Bstatic' - ;; - ccc*) - lt_prog_compiler_wl='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - - solaris*) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl='-Qoption ld ';; - *) - lt_prog_compiler_wl='-Wl,';; - esac - ;; - - sunos4*) - lt_prog_compiler_wl='-Qoption ld ' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic='-Kconform_pic' - lt_prog_compiler_static='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - unicos*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_can_build_shared=no - ;; - - uts4*) - lt_prog_compiler_pic='-pic' - lt_prog_compiler_static='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared=no - ;; - esac - fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5 -$as_echo "$lt_prog_compiler_pic" >&6; } - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic"; then - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 -$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } -if ${lt_prog_compiler_pic_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_prog_compiler_pic_works=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:__oline__: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_prog_compiler_pic_works=yes - fi - fi - $rm conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic_works" >&5 -$as_echo "$lt_prog_compiler_pic_works" >&6; } - -if test x"$lt_prog_compiler_pic_works" = xyes; then - case $lt_prog_compiler_pic in - "" | " "*) ;; - *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; - esac -else - lt_prog_compiler_pic= - lt_prog_compiler_can_build_shared=no -fi - -fi -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic= - ;; - *) - lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" - ;; -esac - -# -# Check to make sure the static flag actually works. -# -wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if ${lt_prog_compiler_static_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_prog_compiler_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - printf "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_prog_compiler_static_works=yes - fi - else - lt_prog_compiler_static_works=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_static_works" >&5 -$as_echo "$lt_prog_compiler_static_works" >&6; } - -if test x"$lt_prog_compiler_static_works" = xyes; then - : -else - lt_prog_compiler_static= -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:__oline__: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -$as_echo_n "checking if we can lock with hard links... " >&6; } - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -$as_echo "$hard_links" >&6; } - if test "$hard_links" = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } - - runpath_var= - allow_undefined_flag= - enable_shared_with_static_runtimes=no - archive_cmds= - archive_expsym_cmds= - old_archive_From_new_cmds= - old_archive_from_expsyms_cmds= - export_dynamic_flag_spec= - whole_archive_flag_spec= - thread_safe_flag_spec= - hardcode_libdir_flag_spec= - hardcode_libdir_flag_spec_ld= - hardcode_libdir_separator= - hardcode_direct=no - hardcode_minus_L=no - hardcode_shlibpath_var=unsupported - link_all_deplibs=unknown - hardcode_automatic=no - module_cmds= - module_expsym_cmds= - always_export_symbols=no - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - ld_shlibs=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs=no - cat <<EOF 1>&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - - # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - ld_shlibs=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach <jrb3@best.com> says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - allow_undefined_flag=unsupported - always_export_symbols=no - enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - ld_shlibs=no - fi - ;; - - interix3*) - hardcode_direct=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - link_all_deplibs=no - else - ld_shlibs=no - fi - ;; - - netbsd* | netbsdelf*-gnu | knetbsd*-gnu) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <<EOF 1>&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = no; then - runpath_var= - hardcode_libdir_flag_spec= - export_dynamic_flag_spec= - whole_archive_flag_spec= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds='' - hardcode_direct=yes - hardcode_libdir_separator=':' - link_all_deplibs=yes - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct=yes - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag=' ${wl}-bernotok' - allow_undefined_flag=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec='$convenience' - archive_cmds_need_lc=yes - # This is similar to how AIX traditionally builds its shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no - ;; - - bsdi[45]*) - export_dynamic_flag_spec=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_From_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes=yes - ;; - - darwin* | rhapsody*) - case $host_os in - rhapsody* | darwin1.[012]) - allow_undefined_flag='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - archive_cmds_need_lc=no - hardcode_direct=no - hardcode_automatic=yes - hardcode_shlibpath_var=unsupported - whole_archive_flag_spec='' - link_all_deplibs=yes - if test "$GCC" = yes ; then - output_verbose_link_cmd='echo' - archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case $cc_basename in - xlc*) - output_verbose_link_cmd='echo' - archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - ld_shlibs=no - ;; - esac - fi - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - freebsd1*) - ld_shlibs=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # GNU/kFreeBSD uses gcc -shared to do shared libraries. - kfreebsd*-gnu) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - link_all_deplibs=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - export_dynamic_flag_spec='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - - hardcode_direct=yes - export_dynamic_flag_spec='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - - case $host_cpu in - hppa*64*|ia64*) - hardcode_libdir_flag_spec_ld='+b $libdir' - hardcode_direct=no - hardcode_shlibpath_var=no - ;; - *) - hardcode_direct=yes - export_dynamic_flag_spec='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_ld='-rpath $libdir' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - link_all_deplibs=yes - ;; - - netbsd* | netbsdelf*-gnu | knetbsd*-gnu) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - openbsd*) - hardcode_direct=yes - hardcode_shlibpath_var=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - ;; - - solaris*) - no_undefined_flag=' -z text' - if test "$GCC" = yes; then - wlarc='${wl}' - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - wlarc='' - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) - no_undefined_flag='${wl}-z,text' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - no_undefined_flag='${wl}-z,text' - allow_undefined_flag='${wl}-z,nodefs' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' - hardcode_libdir_separator=':' - link_all_deplibs=yes - export_dynamic_flag_spec='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - *) - ld_shlibs=no - ;; - esac - fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 -$as_echo "$ld_shlibs" >&6; } -test "$ld_shlibs" = no && can_build_shared=no - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } - $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl - pic_flag=$lt_prog_compiler_pic - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\""; } >&5 - (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - then - archive_cmds_need_lc=no - else - archive_cmds_need_lc=yes - fi - allow_undefined_flag=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5 -$as_echo "$archive_cmds_need_lc" >&6; } - ;; - esac - fi - ;; -esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -$as_echo_n "checking dynamic linker characteristics... " >&6; } -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib<name>.so - # instead of lib<name>.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[123]*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ - freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - freebsd*) # from 4.6 on - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -interix3*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsdelf*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='NetBSD ld.elf_so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - shlibpath_overrides_runpath=no - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - shlibpath_overrides_runpath=yes - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -$as_echo "$dynamic_linker" >&6; } -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -$as_echo_n "checking how to hardcode library paths into programs... " >&6; } -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var" || \ - test "X$hardcode_automatic" = "Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 -$as_echo "$hardcode_action" >&6; } - -if test "$hardcode_action" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -striplib= -old_striplib= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 -$as_echo_n "checking whether stripping libraries is possible... " >&6; } -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - esac -fi - -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes -else - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - *) - ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" -if test "x$ac_cv_func_shl_load" = xyes; then : - lt_cv_dlopen="shl_load" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 -$as_echo_n "checking for shl_load in -ldld... " >&6; } -if ${ac_cv_lib_dld_shl_load+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char shl_load (); -int -main () -{ -return shl_load (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dld_shl_load=yes -else - ac_cv_lib_dld_shl_load=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 -$as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = xyes; then : - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" -else - ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes -else - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 -$as_echo_n "checking for dlopen in -lsvld... " >&6; } -if ${ac_cv_lib_svld_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_svld_dlopen=yes -else - ac_cv_lib_svld_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 -$as_echo "$ac_cv_lib_svld_dlopen" >&6; } -if test "x$ac_cv_lib_svld_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 -$as_echo_n "checking for dld_link in -ldld... " >&6; } -if ${ac_cv_lib_dld_dld_link+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dld_link (); -int -main () -{ -return dld_link (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dld_dld_link=yes -else - ac_cv_lib_dld_dld_link=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 -$as_echo "$ac_cv_lib_dld_dld_link" >&6; } -if test "x$ac_cv_lib_dld_dld_link" = xyes; then : - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" -fi - - -fi - - -fi - - -fi - - -fi - - -fi - - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 -$as_echo_n "checking whether a program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<EOF -#line __oline__ "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include <dlfcn.h> -#endif - -#include <stdio.h> - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - else - puts (dlerror ()); - - exit (status); -} -EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 -$as_echo "$lt_cv_dlopen_self" >&6; } - - if test "x$lt_cv_dlopen_self" = xyes; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 -$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self_static+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<EOF -#line __oline__ "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include <dlfcn.h> -#endif - -#include <stdio.h> - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - else - puts (dlerror ()); - - exit (status); -} -EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 -$as_echo "$lt_cv_dlopen_self_static" >&6; } - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - - -# Report which library types will actually be built -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 -$as_echo_n "checking if libtool supports shared libraries... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 -$as_echo "$can_build_shared" >&6; } - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 -$as_echo_n "checking whether to build shared libraries... " >&6; } -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case $host_os in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - -aix4* | aix5*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 -$as_echo "$enable_shared" >&6; } - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 -$as_echo_n "checking whether to build static libraries... " >&6; } -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 -$as_echo "$enable_static" >&6; } - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler \ - CC \ - LD \ - lt_prog_compiler_wl \ - lt_prog_compiler_pic \ - lt_prog_compiler_static \ - lt_prog_compiler_no_builtin_flag \ - export_dynamic_flag_spec \ - thread_safe_flag_spec \ - whole_archive_flag_spec \ - enable_shared_with_static_runtimes \ - old_archive_cmds \ - old_archive_from_new_cmds \ - predep_objects \ - postdep_objects \ - predeps \ - postdeps \ - compiler_lib_search_path \ - archive_cmds \ - archive_expsym_cmds \ - postinstall_cmds \ - postuninstall_cmds \ - old_archive_from_expsyms_cmds \ - allow_undefined_flag \ - no_undefined_flag \ - export_symbols_cmds \ - hardcode_libdir_flag_spec \ - hardcode_libdir_flag_spec_ld \ - hardcode_libdir_separator \ - hardcode_automatic \ - module_cmds \ - module_expsym_cmds \ - lt_cv_prog_compiler_c_o \ - exclude_expsyms \ - include_expsyms; do - - case $var in - old_archive_cmds | \ - old_archive_from_new_cmds | \ - archive_cmds | \ - archive_expsym_cmds | \ - module_cmds | \ - module_expsym_cmds | \ - old_archive_from_expsyms_cmds | \ - export_symbols_cmds | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="${ofile}T" - trap "$rm \"$cfgfile\"; exit 1" 1 2 15 - $rm -f "$cfgfile" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ofile" >&5 -$as_echo "$as_me: creating $ofile" >&6;} - - cat <<__EOF__ >> "$cfgfile" -#! $SHELL - -# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# -# This file is part of GNU Libtool: -# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# A sed program that does not truncate output. -SED=$lt_SED - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e 1s/^X//" - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -# The names of the tagged configurations supported by this script. -available_tags= - -# ### BEGIN LIBTOOL CONFIG - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# LTCC compiler flags. -LTCFLAGS=$lt_LTCFLAGS - -# A language-specific compiler. -CC=$lt_compiler - -# Is the compiler the GNU C compiler? -with_gcc=$GCC - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o - -# Must we lock files when doing compilation? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds -archive_expsym_cmds=$lt_archive_expsym_cmds -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds -module_expsym_cmds=$lt_module_expsym_cmds - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms - -# ### END LIBTOOL CONFIG - -__EOF__ - - - case $host_os in - aix3*) - cat <<\EOF >> "$cfgfile" - -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -EOF - ;; - esac - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || \ - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -CC="$lt_save_CC" - - -@%:@ Check whether --with-tags was given. -if test "${with_tags+set}" = set; then : - withval=$with_tags; tagnames="$withval" -fi - - -if test -f "$ltmain" && test -n "$tagnames"; then - if test ! -f "${ofile}"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: output file \`$ofile' does not exist" >&5 -$as_echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} - fi - - if test -z "$LTCC"; then - eval "`$SHELL ${ofile} --config | grep '^LTCC='`" - if test -z "$LTCC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: output file \`$ofile' does not look like a libtool script" >&5 -$as_echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} - else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 -$as_echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} - fi - fi - if test -z "$LTCFLAGS"; then - eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`" - fi - - # Extract list of available tagged configurations in $ofile. - # Note that this assumes the entire list is on one line. - available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` - - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for tagname in $tagnames; do - IFS="$lt_save_ifs" - # Check whether tagname contains only valid characters - case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in - "") ;; - *) as_fn_error $? "invalid tag name: $tagname" "$LINENO" 5 - ;; - esac - - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null - then - as_fn_error $? "tag name \"$tagname\" already exists" "$LINENO" 5 - fi - - # Update the list of available tags. - if test -n "$tagname"; then - echo appending configuration tag \"$tagname\" to $ofile - - case $tagname in - CXX) - if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - - - -archive_cmds_need_lc_CXX=no -allow_undefined_flag_CXX= -always_export_symbols_CXX=no -archive_expsym_cmds_CXX= -export_dynamic_flag_spec_CXX= -hardcode_direct_CXX=no -hardcode_libdir_flag_spec_CXX= -hardcode_libdir_flag_spec_ld_CXX= -hardcode_libdir_separator_CXX= -hardcode_minus_L_CXX=no -hardcode_shlibpath_var_CXX=unsupported -hardcode_automatic_CXX=no -module_cmds_CXX= -module_expsym_cmds_CXX= -link_all_deplibs_CXX=unknown -old_archive_cmds_CXX=$old_archive_cmds -no_undefined_flag_CXX= -whole_archive_flag_spec_CXX= -enable_shared_with_static_runtimes_CXX=no - -# Dependencies to place before and after the object being linked: -predep_objects_CXX= -postdep_objects_CXX= -predeps_CXX= -postdeps_CXX= -compiler_lib_search_path_CXX= - -# Source file extension for C++ test sources. -ac_ext=cpp - -# Object file extension for compiled C++ test sources. -objext=o -objext_CXX=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_LD=$LD -lt_save_GCC=$GCC -GCC=$GXX -lt_save_with_gnu_ld=$with_gnu_ld -lt_save_path_LD=$lt_cv_path_LD -if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx -else - $as_unset lt_cv_prog_gnu_ld -fi -if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX -else - $as_unset lt_cv_path_LD -fi -test -z "${LDCXX+set}" || LD=$LDCXX -CC=${CXX-"c++"} -compiler=$CC -compiler_CXX=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - - -# We don't want -fno-exception wen compiling C++ code, so set the -# no_builtin_flag separately -if test "$GXX" = yes; then - lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' -else - lt_prog_compiler_no_builtin_flag_CXX= -fi - -if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - -@%:@ Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then : - withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -$as_echo_n "checking for ld used by $CC... " >&6; } - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } -fi -if ${lt_cv_path_LD+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in - *GNU* | *'with BFD'*) - test "$with_gnu_ld" != no && break - ;; - *) - test "$with_gnu_ld" != yes && break - ;; - esac - fi - done - IFS="$lt_save_ifs" -else - lt_cv_path_LD="$LD" # Let the user override the test with a path. -fi -fi - -LD="$lt_cv_path_LD" -if test -n "$LD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 -$as_echo "$LD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if ${lt_cv_prog_gnu_ld+:} false; then : - $as_echo_n "(cached) " >&6 -else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 </dev/null` in -*GNU* | *'with BFD'*) - lt_cv_prog_gnu_ld=yes - ;; -*) - lt_cv_prog_gnu_ld=no - ;; -esac -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5 -$as_echo "$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ - grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_CXX= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - -else - GXX=no - with_gnu_ld=no - wlarc= -fi - -# PORTME: fill in a description of your system's C++ link characteristics -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } -ld_shlibs_CXX=yes -case $host_os in - aix3*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_CXX='' - hardcode_direct_CXX=yes - hardcode_libdir_separator_CXX=':' - link_all_deplibs_CXX=yes - - if test "$GXX" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct_CXX=yes - else - # We have old collect2 - hardcode_direct_CXX=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_CXX=yes - hardcode_libdir_flag_spec_CXX='-L$libdir' - hardcode_libdir_separator_CXX= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols_CXX=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_CXX='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" - - archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_CXX="-z nodefs" - archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_CXX=' ${wl}-bernotok' - allow_undefined_flag_CXX=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_CXX='$convenience' - archive_cmds_need_lc_CXX=yes - # This is similar to how AIX traditionally builds its shared libraries. - archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag_CXX=unsupported - # Joseph Beckenbach <jrb3@best.com> says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs_CXX=no - fi - ;; - - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_CXX='-L$libdir' - allow_undefined_flag_CXX=unsupported - always_export_symbols_CXX=no - enable_shared_with_static_runtimes_CXX=yes - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - ld_shlibs_CXX=no - fi - ;; - darwin* | rhapsody*) - case $host_os in - rhapsody* | darwin1.[012]) - allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - archive_cmds_need_lc_CXX=no - hardcode_direct_CXX=no - hardcode_automatic_CXX=yes - hardcode_shlibpath_var_CXX=unsupported - whole_archive_flag_spec_CXX='' - link_all_deplibs_CXX=yes - - if test "$GXX" = yes ; then - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case $cc_basename in - xlc*) - output_verbose_link_cmd='echo' - archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - ld_shlibs_CXX=no - ;; - esac - fi - ;; - - dgux*) - case $cc_basename in - ec++*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - ghcx*) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - freebsd[12]*) - # C++ shared libraries reported to be fairly broken before switch to ELF - ld_shlibs_CXX=no - ;; - freebsd-elf*) - archive_cmds_need_lc_CXX=no - ;; - freebsd* | kfreebsd*-gnu | dragonfly*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - ld_shlibs_CXX=yes - ;; - gnu*) - ;; - hpux9*) - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_CXX=: - export_dynamic_flag_spec_CXX='${wl}-E' - hardcode_direct_CXX=yes - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aCC*) - archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - case $host_cpu in - hppa*64*|ia64*) - hardcode_libdir_flag_spec_ld_CXX='+b $libdir' - ;; - *) - export_dynamic_flag_spec_CXX='${wl}-E' - ;; - esac - fi - case $host_cpu in - hppa*64*|ia64*) - hardcode_direct_CXX=no - hardcode_shlibpath_var_CXX=no - ;; - *) - hardcode_direct_CXX=yes - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aCC*) - case $host_cpu in - hppa*64*) - archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case $host_cpu in - hppa*64*) - archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - interix3*) - hardcode_direct_CXX=no - hardcode_shlibpath_var_CXX=no - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - irix5* | irix6*) - case $cc_basename in - CC*) - # SGI C++ - archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' - fi - fi - link_all_deplibs_CXX=yes - ;; - esac - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - ;; - linux*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc*) - # Intel C++ - with_gnu_ld=yes - # version 8.0 and above of icpc choke on multiply defined symbols - # if we add $predep_objects and $postdep_objects, however 7.1 and - # earlier do not add the objects themselves. - case `$CC -V 2>&1` in - *"Version 7."*) - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 8.0 or newer - tmp_idyn= - case $host_cpu in - ia64*) tmp_idyn=' -i_dynamic';; - esac - archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - archive_cmds_need_lc_CXX=no - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - pgCC*) - # Portland Group C++ compiler - archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - ;; - cxx*) - # Compaq C++ - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_CXX='-rpath $libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - esac - ;; - lynxos*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - m88k*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - mvs*) - case $cc_basename in - cxx*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - netbsd* | netbsdelf*-gnu | knetbsd*-gnu) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - hardcode_libdir_flag_spec_CXX='-R$libdir' - hardcode_direct_CXX=yes - hardcode_shlibpath_var_CXX=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - openbsd2*) - # C++ shared libraries are fairly broken - ld_shlibs_CXX=no - ;; - openbsd*) - hardcode_direct_CXX=yes - hardcode_shlibpath_var_CXX=no - archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - export_dynamic_flag_spec_CXX='${wl}-E' - whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - fi - output_verbose_link_cmd='echo' - ;; - osf3*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - hardcode_libdir_separator_CXX=: - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' - - ;; - RCC*) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - cxx*) - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - osf4* | osf5*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - hardcode_libdir_separator_CXX=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' - ;; - RCC*) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - cxx*) - allow_undefined_flag_CXX=' -expect_unresolved \*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ - $rm $lib.exp' - - hardcode_libdir_flag_spec_CXX='-rpath $libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - psos*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - lcc*) - # Lucid - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - solaris*) - case $cc_basename in - CC*) - # Sun C++ 4.2, 5.x and Centerline C++ - archive_cmds_need_lc_CXX=yes - no_undefined_flag_CXX=' -zdefs' - archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - hardcode_libdir_flag_spec_CXX='-R$libdir' - hardcode_shlibpath_var_CXX=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The C++ compiler is used as linker so we must use $wl - # flag to pass the commands to the underlying system - # linker. We must also pass each convience library through - # to the system linker between allextract/defaultextract. - # The C++ compiler will combine linker options so we - # cannot just pass the convience library names through - # without $wl. - # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' - ;; - esac - link_all_deplibs_CXX=yes - - output_verbose_link_cmd='echo' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' - ;; - gcx*) - # Green Hills C++ Compiler - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - no_undefined_flag_CXX=' ${wl}-z ${wl}defs' - if $CC --version | grep -v '^2\.7' > /dev/null; then - archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - fi - - hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' - fi - ;; - esac - ;; - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - no_undefined_flag_CXX='${wl}-z,text' - archive_cmds_need_lc_CXX=no - hardcode_shlibpath_var_CXX=no - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - # For security reasons, it is highly recommended that you always - # use absolute paths for naming shared libraries, and exclude the - # DT_RUNPATH tag from executables and libraries. But doing so - # requires that you compile everything twice, which is a pain. - # So that behaviour is only enabled if SCOABSPATH is set to a - # non-empty value in the environment. Most likely only useful for - # creating official distributions of packages. - # This is a hack until libtool officially supports absolute path - # names for shared libraries. - no_undefined_flag_CXX='${wl}-z,text' - allow_undefined_flag_CXX='${wl}-z,nodefs' - archive_cmds_need_lc_CXX=no - hardcode_shlibpath_var_CXX=no - hardcode_libdir_flag_spec_CXX='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' - hardcode_libdir_separator_CXX=':' - link_all_deplibs_CXX=yes - export_dynamic_flag_spec_CXX='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - archive_cmds_CXX='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_CXX='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - vxworks*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 -$as_echo "$ld_shlibs_CXX" >&6; } -test "$ld_shlibs_CXX" = no && can_build_shared=no - -GCC_CXX="$GXX" -LD_CXX="$LD" - - -cat > conftest.$ac_ext <<EOF -class Foo -{ -public: - Foo (void) { a = 0; } -private: - int a; -}; -EOF - -if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - # Parse the compiler output and extract the necessary - # objects, libraries and library flags. - - # Sentinel used to keep track of whether or not we are before - # the conftest object file. - pre_test_object_deps_done=no - - # The `*' in the case matches for architectures that use `case' in - # $output_verbose_cmd can trigger glob expansion during the loop - # eval without this substitution. - output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"` - - for p in `eval $output_verbose_link_cmd`; do - case $p in - - -L* | -R* | -l*) - # Some compilers place space between "-{L,R}" and the path. - # Remove the space. - if test $p = "-L" \ - || test $p = "-R"; then - prev=$p - continue - else - prev= - fi - - if test "$pre_test_object_deps_done" = no; then - case $p in - -L* | -R*) - # Internal compiler library paths should come after those - # provided the user. The postdeps already come after the - # user supplied libs so there is no need to process them. - if test -z "$compiler_lib_search_path_CXX"; then - compiler_lib_search_path_CXX="${prev}${p}" - else - compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" - fi - ;; - # The "-l" case would never come before the object being - # linked, so don't bother handling this case. - esac - else - if test -z "$postdeps_CXX"; then - postdeps_CXX="${prev}${p}" - else - postdeps_CXX="${postdeps_CXX} ${prev}${p}" - fi - fi - ;; - - *.$objext) - # This assumes that the test object file only shows up - # once in the compiler output. - if test "$p" = "conftest.$objext"; then - pre_test_object_deps_done=yes - continue - fi - - if test "$pre_test_object_deps_done" = no; then - if test -z "$predep_objects_CXX"; then - predep_objects_CXX="$p" - else - predep_objects_CXX="$predep_objects_CXX $p" - fi - else - if test -z "$postdep_objects_CXX"; then - postdep_objects_CXX="$p" - else - postdep_objects_CXX="$postdep_objects_CXX $p" - fi - fi - ;; - - *) ;; # Ignore the rest. - - esac - done - - # Clean up. - rm -f a.out a.exe -else - echo "libtool.m4: error: problem compiling CXX test program" -fi - -$rm -f confest.$objext - -# PORTME: override above test on systems where it is broken -case $host_os in -interix3*) - # Interix 3.5 installs completely hosed .la files for C++, so rather than - # hack all around it, let's just trust "g++" to DTRT. - predep_objects_CXX= - postdep_objects_CXX= - postdeps_CXX= - ;; - -solaris*) - case $cc_basename in - CC*) - # Adding this requires a known-good setup of shared libraries for - # Sun compiler versions before 5.6, else PIC objects from an old - # archive will be linked into the output, leading to subtle bugs. - postdeps_CXX='-lCstd -lCrun' - ;; - esac - ;; -esac - - -case " $postdeps_CXX " in -*" -lc "*) archive_cmds_need_lc_CXX=no ;; -esac - -lt_prog_compiler_wl_CXX= -lt_prog_compiler_pic_CXX= -lt_prog_compiler_static_CXX= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } - - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_CXX='-Bstatic' - fi - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | os2* | pw32*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_CXX='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_CXX='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - lt_prog_compiler_pic_CXX= - ;; - interix3*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_CXX=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - ;; - *) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - esac - ;; - *) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - esac - else - case $host_os in - aix4* | aix5*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_CXX='-Bstatic' - else - lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68*) - # Green Hills C++ Compiler - # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case $cc_basename in - xlc*) - lt_prog_compiler_pic_CXX='-qnocommon' - lt_prog_compiler_wl_CXX='-Wl,' - ;; - esac - ;; - dgux*) - case $cc_basename in - ec++*) - lt_prog_compiler_pic_CXX='-KPIC' - ;; - ghcx*) - # Green Hills C++ Compiler - lt_prog_compiler_pic_CXX='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | kfreebsd*-gnu | dragonfly*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC*) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' - if test "$host_cpu" != ia64; then - lt_prog_compiler_pic_CXX='+Z' - fi - ;; - aCC*) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_CXX='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - interix*) - # This is c89, which is MS Visual C++ (no shared libs) - # Anyone wants to do a port? - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC*) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux*) - case $cc_basename in - KCC*) - # KAI C++ Compiler - lt_prog_compiler_wl_CXX='--backend -Wl,' - lt_prog_compiler_pic_CXX='-fPIC' - ;; - icpc* | ecpc*) - # Intel C++ - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-static' - ;; - pgCC*) - # Portland Group C++ compiler. - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-fpic' - lt_prog_compiler_static_CXX='-Bstatic' - ;; - cxx*) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - lt_prog_compiler_pic_CXX= - lt_prog_compiler_static_CXX='-non_shared' - ;; - *) - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx*) - lt_prog_compiler_pic_CXX='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd* | netbsdelf*-gnu | knetbsd*-gnu) - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - lt_prog_compiler_wl_CXX='--backend -Wl,' - ;; - RCC*) - # Rational C++ 2.4.1 - lt_prog_compiler_pic_CXX='-pic' - ;; - cxx*) - # Digital/Compaq C++ - lt_prog_compiler_wl_CXX='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - lt_prog_compiler_pic_CXX= - lt_prog_compiler_static_CXX='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - solaris*) - case $cc_basename in - CC*) - # Sun C++ 4.2, 5.x and Centerline C++ - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-Bstatic' - lt_prog_compiler_wl_CXX='-Qoption ld ' - ;; - gcx*) - # Green Hills C++ Compiler - lt_prog_compiler_pic_CXX='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - lt_prog_compiler_pic_CXX='-pic' - lt_prog_compiler_static_CXX='-Bstatic' - ;; - lcc*) - # Lucid - lt_prog_compiler_pic_CXX='-pic' - ;; - *) - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - lt_prog_compiler_pic_CXX='-KPIC' - ;; - *) - ;; - esac - ;; - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - case $cc_basename in - CC*) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-Bstatic' - ;; - esac - ;; - vxworks*) - ;; - *) - lt_prog_compiler_can_build_shared_CXX=no - ;; - esac - fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic_CXX" >&5 -$as_echo "$lt_prog_compiler_pic_CXX" >&6; } - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_CXX"; then - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 -$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } -if ${lt_prog_compiler_pic_works_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_prog_compiler_pic_works_CXX=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:__oline__: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_prog_compiler_pic_works_CXX=yes - fi - fi - $rm conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic_works_CXX" >&5 -$as_echo "$lt_prog_compiler_pic_works_CXX" >&6; } - -if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then - case $lt_prog_compiler_pic_CXX in - "" | " "*) ;; - *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; - esac -else - lt_prog_compiler_pic_CXX= - lt_prog_compiler_can_build_shared_CXX=no -fi - -fi -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_CXX= - ;; - *) - lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" - ;; -esac - -# -# Check to make sure the static flag actually works. -# -wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if ${lt_prog_compiler_static_works_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_prog_compiler_static_works_CXX=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - printf "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_prog_compiler_static_works_CXX=yes - fi - else - lt_prog_compiler_static_works_CXX=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_static_works_CXX" >&5 -$as_echo "$lt_prog_compiler_static_works_CXX" >&6; } - -if test x"$lt_prog_compiler_static_works_CXX" = xyes; then - : -else - lt_prog_compiler_static_CXX= -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o_CXX=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:__oline__: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o_CXX=yes - fi - fi - chmod u+w . 2>&5 - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 -$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -$as_echo_n "checking if we can lock with hard links... " >&6; } - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -$as_echo "$hard_links" >&6; } - if test "$hard_links" = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } - - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - case $host_os in - aix4* | aix5*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - export_symbols_cmds_CXX="$ltdll_cmds" - ;; - cygwin* | mingw*) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([^ ]*\) [^ ]*/\1 DATA/;/^I /d;/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' - ;; - kfreebsd*-gnu) - link_all_deplibs_CXX=no - ;; - linux*) - link_all_deplibs_CXX=no - ;; - *) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 -$as_echo "$ld_shlibs_CXX" >&6; } -test "$ld_shlibs_CXX" = no && can_build_shared=no - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_CXX" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_CXX=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_CXX in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } - $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_CXX - pic_flag=$lt_prog_compiler_pic_CXX - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_CXX - allow_undefined_flag_CXX= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\""; } >&5 - (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - then - archive_cmds_need_lc_CXX=no - else - archive_cmds_need_lc_CXX=yes - fi - allow_undefined_flag_CXX=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc_CXX" >&5 -$as_echo "$archive_cmds_need_lc_CXX" >&6; } - ;; - esac - fi - ;; -esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -$as_echo_n "checking dynamic linker characteristics... " >&6; } -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib<name>.so - # instead of lib<name>.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[123]*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ - freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - freebsd*) # from 4.6 on - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -interix3*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsdelf*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='NetBSD ld.elf_so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - shlibpath_overrides_runpath=no - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - shlibpath_overrides_runpath=yes - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -$as_echo "$dynamic_linker" >&6; } -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -$as_echo_n "checking how to hardcode library paths into programs... " >&6; } -hardcode_action_CXX= -if test -n "$hardcode_libdir_flag_spec_CXX" || \ - test -n "$runpath_var_CXX" || \ - test "X$hardcode_automatic_CXX" = "Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct_CXX" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && - test "$hardcode_minus_L_CXX" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_CXX=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_CXX=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_CXX=unsupported -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 -$as_echo "$hardcode_action_CXX" >&6; } - -if test "$hardcode_action_CXX" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_CXX \ - CC_CXX \ - LD_CXX \ - lt_prog_compiler_wl_CXX \ - lt_prog_compiler_pic_CXX \ - lt_prog_compiler_static_CXX \ - lt_prog_compiler_no_builtin_flag_CXX \ - export_dynamic_flag_spec_CXX \ - thread_safe_flag_spec_CXX \ - whole_archive_flag_spec_CXX \ - enable_shared_with_static_runtimes_CXX \ - old_archive_cmds_CXX \ - old_archive_from_new_cmds_CXX \ - predep_objects_CXX \ - postdep_objects_CXX \ - predeps_CXX \ - postdeps_CXX \ - compiler_lib_search_path_CXX \ - archive_cmds_CXX \ - archive_expsym_cmds_CXX \ - postinstall_cmds_CXX \ - postuninstall_cmds_CXX \ - old_archive_from_expsyms_cmds_CXX \ - allow_undefined_flag_CXX \ - no_undefined_flag_CXX \ - export_symbols_cmds_CXX \ - hardcode_libdir_flag_spec_CXX \ - hardcode_libdir_flag_spec_ld_CXX \ - hardcode_libdir_separator_CXX \ - hardcode_automatic_CXX \ - module_cmds_CXX \ - module_expsym_cmds_CXX \ - lt_cv_prog_compiler_c_o_CXX \ - exclude_expsyms_CXX \ - include_expsyms_CXX; do - - case $var in - old_archive_cmds_CXX | \ - old_archive_from_new_cmds_CXX | \ - archive_cmds_CXX | \ - archive_expsym_cmds_CXX | \ - module_cmds_CXX | \ - module_expsym_cmds_CXX | \ - old_archive_from_expsyms_cmds_CXX | \ - export_symbols_cmds_CXX | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_CXX - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# LTCC compiler flags. -LTCFLAGS=$lt_LTCFLAGS - -# A language-specific compiler. -CC=$lt_compiler_CXX - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_CXX - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_CXX - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_CXX - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_CXX -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX - -# Must we lock files when doing compilation? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_CXX - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_CXX -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_CXX -archive_expsym_cmds=$lt_archive_expsym_cmds_CXX -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_CXX -module_expsym_cmds=$lt_module_expsym_cmds_CXX - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_CXX - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_CXX - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_CXX - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_CXX - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_CXX - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_CXX - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_CXX - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_CXX - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_CXX - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_CXX - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_CXX - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_CXX - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_CXX" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_CXX - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_CXX - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_CXX - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_CXX - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -CC=$lt_save_CC -LDCXX=$LD -LD=$lt_save_LD -GCC=$lt_save_GCC -with_gnu_ldcxx=$with_gnu_ld -with_gnu_ld=$lt_save_with_gnu_ld -lt_cv_path_LDCXX=$lt_cv_path_LD -lt_cv_path_LD=$lt_save_path_LD -lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld -lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld - - else - tagname="" - fi - ;; - - F77) - if test -n "$F77" && test "X$F77" != "Xno"; then - -ac_ext=f -ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_f77_compiler_gnu - - -archive_cmds_need_lc_F77=no -allow_undefined_flag_F77= -always_export_symbols_F77=no -archive_expsym_cmds_F77= -export_dynamic_flag_spec_F77= -hardcode_direct_F77=no -hardcode_libdir_flag_spec_F77= -hardcode_libdir_flag_spec_ld_F77= -hardcode_libdir_separator_F77= -hardcode_minus_L_F77=no -hardcode_automatic_F77=no -module_cmds_F77= -module_expsym_cmds_F77= -link_all_deplibs_F77=unknown -old_archive_cmds_F77=$old_archive_cmds -no_undefined_flag_F77= -whole_archive_flag_spec_F77= -enable_shared_with_static_runtimes_F77=no - -# Source file extension for f77 test sources. -ac_ext=f - -# Object file extension for compiled f77 test sources. -objext=o -objext_F77=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code=" subroutine t\n return\n end\n" - -# Code to be used in simple link tests -lt_simple_link_test_code=" program t\n end\n" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${F77-"f77"} -compiler=$CC -compiler_F77=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 -$as_echo_n "checking if libtool supports shared libraries... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 -$as_echo "$can_build_shared" >&6; } - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 -$as_echo_n "checking whether to build shared libraries... " >&6; } -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case $host_os in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; -aix4* | aix5*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 -$as_echo "$enable_shared" >&6; } - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 -$as_echo_n "checking whether to build static libraries... " >&6; } -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 -$as_echo "$enable_static" >&6; } - -GCC_F77="$G77" -LD_F77="$LD" - -lt_prog_compiler_wl_F77= -lt_prog_compiler_pic_F77= -lt_prog_compiler_static_F77= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } - - if test "$GCC" = yes; then - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_static_F77='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_F77='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_F77='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_F77='-fno-common' - ;; - - interix3*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared_F77=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_F77=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_F77='-fPIC' - ;; - esac - ;; - - *) - lt_prog_compiler_pic_F77='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl_F77='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_F77='-Bstatic' - else - lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' - fi - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case $cc_basename in - xlc*) - lt_prog_compiler_pic_F77='-qnocommon' - lt_prog_compiler_wl_F77='-Wl,' - ;; - esac - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_F77='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl_F77='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_F77='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static_F77='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl_F77='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static_F77='-non_shared' - ;; - - newsos6) - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - linux*) - case $cc_basename in - icc* | ecc*) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-static' - ;; - pgcc* | pgf77* | pgf90* | pgf95*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_pic_F77='-fpic' - lt_prog_compiler_static_F77='-Bstatic' - ;; - ccc*) - lt_prog_compiler_wl_F77='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static_F77='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl_F77='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static_F77='-non_shared' - ;; - - solaris*) - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl_F77='-Qoption ld ';; - *) - lt_prog_compiler_wl_F77='-Wl,';; - esac - ;; - - sunos4*) - lt_prog_compiler_wl_F77='-Qoption ld ' - lt_prog_compiler_pic_F77='-PIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic_F77='-Kconform_pic' - lt_prog_compiler_static_F77='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - unicos*) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_can_build_shared_F77=no - ;; - - uts4*) - lt_prog_compiler_pic_F77='-pic' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared_F77=no - ;; - esac - fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic_F77" >&5 -$as_echo "$lt_prog_compiler_pic_F77" >&6; } - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_F77"; then - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 -$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... " >&6; } -if ${lt_prog_compiler_pic_works_F77+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_prog_compiler_pic_works_F77=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_F77" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:__oline__: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_prog_compiler_pic_works_F77=yes - fi - fi - $rm conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic_works_F77" >&5 -$as_echo "$lt_prog_compiler_pic_works_F77" >&6; } - -if test x"$lt_prog_compiler_pic_works_F77" = xyes; then - case $lt_prog_compiler_pic_F77 in - "" | " "*) ;; - *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; - esac -else - lt_prog_compiler_pic_F77= - lt_prog_compiler_can_build_shared_F77=no -fi - -fi -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_F77= - ;; - *) - lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" - ;; -esac - -# -# Check to make sure the static flag actually works. -# -wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if ${lt_prog_compiler_static_works_F77+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_prog_compiler_static_works_F77=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - printf "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_prog_compiler_static_works_F77=yes - fi - else - lt_prog_compiler_static_works_F77=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_static_works_F77" >&5 -$as_echo "$lt_prog_compiler_static_works_F77" >&6; } - -if test x"$lt_prog_compiler_static_works_F77" = xyes; then - : -else - lt_prog_compiler_static_F77= -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o_F77+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o_F77=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:__oline__: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o_F77=yes - fi - fi - chmod u+w . 2>&5 - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_F77" >&5 -$as_echo "$lt_cv_prog_compiler_c_o_F77" >&6; } - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -$as_echo_n "checking if we can lock with hard links... " >&6; } - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -$as_echo "$hard_links" >&6; } - if test "$hard_links" = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } - - runpath_var= - allow_undefined_flag_F77= - enable_shared_with_static_runtimes_F77=no - archive_cmds_F77= - archive_expsym_cmds_F77= - old_archive_From_new_cmds_F77= - old_archive_from_expsyms_cmds_F77= - export_dynamic_flag_spec_F77= - whole_archive_flag_spec_F77= - thread_safe_flag_spec_F77= - hardcode_libdir_flag_spec_F77= - hardcode_libdir_flag_spec_ld_F77= - hardcode_libdir_separator_F77= - hardcode_direct_F77=no - hardcode_minus_L_F77=no - hardcode_shlibpath_var_F77=unsupported - link_all_deplibs_F77=unknown - hardcode_automatic_F77=no - module_cmds_F77= - module_expsym_cmds_F77= - always_export_symbols_F77=no - export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms_F77= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - ld_shlibs_F77=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_F77='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_F77= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs_F77=no - cat <<EOF 1>&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_minus_L_F77=yes - - # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - ld_shlibs_F77=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag_F77=unsupported - # Joseph Beckenbach <jrb3@best.com> says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs_F77=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_F77='-L$libdir' - allow_undefined_flag_F77=unsupported - always_export_symbols_F77=no - enable_shared_with_static_runtimes_F77=yes - export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - ld_shlibs_F77=no - fi - ;; - - interix3*) - hardcode_direct_F77=no - hardcode_shlibpath_var_F77=no - hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' - export_dynamic_flag_spec_F77='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers - whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - link_all_deplibs_F77=no - else - ld_shlibs_F77=no - fi - ;; - - netbsd* | netbsdelf*-gnu | knetbsd*-gnu) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - ld_shlibs_F77=no - cat <<EOF 1>&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_F77=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) - ld_shlibs_F77=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' - archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' - else - ld_shlibs_F77=no - fi - ;; - esac - ;; - - sunos4*) - archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_F77=no - fi - ;; - esac - - if test "$ld_shlibs_F77" = no; then - runpath_var= - hardcode_libdir_flag_spec_F77= - export_dynamic_flag_spec_F77= - whole_archive_flag_spec_F77= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag_F77=unsupported - always_export_symbols_F77=yes - archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L_F77=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct_F77=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_F77='' - hardcode_direct_F77=yes - hardcode_libdir_separator_F77=':' - link_all_deplibs_F77=yes - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct_F77=yes - else - # We have old collect2 - hardcode_direct_F77=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_F77=yes - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_libdir_separator_F77= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols_F77=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_F77='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat > conftest.$ac_ext <<_ACEOF - program main - - end -_ACEOF -if ac_fn_f77_try_link "$LINENO"; then : - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_F77="-z nodefs" - archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat > conftest.$ac_ext <<_ACEOF - program main - - end -_ACEOF -if ac_fn_f77_try_link "$LINENO"; then : - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_F77=' ${wl}-bernotok' - allow_undefined_flag_F77=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_F77='$convenience' - archive_cmds_need_lc_F77=yes - # This is similar to how AIX traditionally builds its shared libraries. - archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_minus_L_F77=yes - # see comment about different semantics on the GNU ld section - ld_shlibs_F77=no - ;; - - bsdi[45]*) - export_dynamic_flag_spec_F77=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec_F77=' ' - allow_undefined_flag_F77=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_From_new_cmds_F77='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path_F77='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes_F77=yes - ;; - - darwin* | rhapsody*) - case $host_os in - rhapsody* | darwin1.[012]) - allow_undefined_flag_F77='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - archive_cmds_need_lc_F77=no - hardcode_direct_F77=no - hardcode_automatic_F77=yes - hardcode_shlibpath_var_F77=unsupported - whole_archive_flag_spec_F77='' - link_all_deplibs_F77=yes - if test "$GCC" = yes ; then - output_verbose_link_cmd='echo' - archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case $cc_basename in - xlc*) - output_verbose_link_cmd='echo' - archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - ld_shlibs_F77=no - ;; - esac - fi - ;; - - dgux*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_shlibpath_var_F77=no - ;; - - freebsd1*) - ld_shlibs_F77=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes - hardcode_minus_L_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - # GNU/kFreeBSD uses gcc -shared to do shared libraries. - kfreebsd*-gnu) - archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - link_all_deplibs_F77=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_F77=: - hardcode_direct_F77=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_F77=yes - export_dynamic_flag_spec_F77='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_F77=: - - hardcode_direct_F77=yes - export_dynamic_flag_spec_F77='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_F77=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_F77=: - - case $host_cpu in - hppa*64*|ia64*) - hardcode_libdir_flag_spec_ld_F77='+b $libdir' - hardcode_direct_F77=no - hardcode_shlibpath_var_F77=no - ;; - *) - hardcode_direct_F77=yes - export_dynamic_flag_spec_F77='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_F77=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' - fi - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_F77=: - link_all_deplibs_F77=yes - ;; - - netbsd* | netbsdelf*-gnu | knetbsd*-gnu) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - newsos6) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_F77=: - hardcode_shlibpath_var_F77=no - ;; - - openbsd*) - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' - export_dynamic_flag_spec_F77='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_F77='-R$libdir' - ;; - *) - archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_minus_L_F77=yes - allow_undefined_flag_F77=unsupported - archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag_F77=' -expect_unresolved \*' - archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_F77=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag_F77=' -expect_unresolved \*' - archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec_F77='-rpath $libdir' - fi - hardcode_libdir_separator_F77=: - ;; - - solaris*) - no_undefined_flag_F77=' -z text' - if test "$GCC" = yes; then - wlarc='${wl}' - archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - wlarc='' - archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_shlibpath_var_F77=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; - esac - link_all_deplibs_F77=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_direct_F77=yes - hardcode_minus_L_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds_F77='$CC -r -o $output$reload_objs' - hardcode_direct_F77=no - ;; - motorola) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_F77=no - ;; - - sysv4.3*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_F77=no - export_dynamic_flag_spec_F77='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_F77=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs_F77=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) - no_undefined_flag_F77='${wl}-z,text' - archive_cmds_need_lc_F77=no - hardcode_shlibpath_var_F77=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - no_undefined_flag_F77='${wl}-z,text' - allow_undefined_flag_F77='${wl}-z,nodefs' - archive_cmds_need_lc_F77=no - hardcode_shlibpath_var_F77=no - hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' - hardcode_libdir_separator_F77=':' - link_all_deplibs_F77=yes - export_dynamic_flag_spec_F77='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds_F77='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_F77='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_shlibpath_var_F77=no - ;; - - *) - ld_shlibs_F77=no - ;; - esac - fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_F77" >&5 -$as_echo "$ld_shlibs_F77" >&6; } -test "$ld_shlibs_F77" = no && can_build_shared=no - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_F77" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_F77=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_F77 in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } - $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_F77 - pic_flag=$lt_prog_compiler_pic_F77 - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_F77 - allow_undefined_flag_F77= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\""; } >&5 - (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - then - archive_cmds_need_lc_F77=no - else - archive_cmds_need_lc_F77=yes - fi - allow_undefined_flag_F77=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc_F77" >&5 -$as_echo "$archive_cmds_need_lc_F77" >&6; } - ;; - esac - fi - ;; -esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -$as_echo_n "checking dynamic linker characteristics... " >&6; } -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib<name>.so - # instead of lib<name>.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[123]*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ - freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - freebsd*) # from 4.6 on - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -interix3*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsdelf*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='NetBSD ld.elf_so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - shlibpath_overrides_runpath=no - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - shlibpath_overrides_runpath=yes - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -$as_echo "$dynamic_linker" >&6; } -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -$as_echo_n "checking how to hardcode library paths into programs... " >&6; } -hardcode_action_F77= -if test -n "$hardcode_libdir_flag_spec_F77" || \ - test -n "$runpath_var_F77" || \ - test "X$hardcode_automatic_F77" = "Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct_F77" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && - test "$hardcode_minus_L_F77" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_F77=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_F77=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_F77=unsupported -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_F77" >&5 -$as_echo "$hardcode_action_F77" >&6; } - -if test "$hardcode_action_F77" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_F77 \ - CC_F77 \ - LD_F77 \ - lt_prog_compiler_wl_F77 \ - lt_prog_compiler_pic_F77 \ - lt_prog_compiler_static_F77 \ - lt_prog_compiler_no_builtin_flag_F77 \ - export_dynamic_flag_spec_F77 \ - thread_safe_flag_spec_F77 \ - whole_archive_flag_spec_F77 \ - enable_shared_with_static_runtimes_F77 \ - old_archive_cmds_F77 \ - old_archive_from_new_cmds_F77 \ - predep_objects_F77 \ - postdep_objects_F77 \ - predeps_F77 \ - postdeps_F77 \ - compiler_lib_search_path_F77 \ - archive_cmds_F77 \ - archive_expsym_cmds_F77 \ - postinstall_cmds_F77 \ - postuninstall_cmds_F77 \ - old_archive_from_expsyms_cmds_F77 \ - allow_undefined_flag_F77 \ - no_undefined_flag_F77 \ - export_symbols_cmds_F77 \ - hardcode_libdir_flag_spec_F77 \ - hardcode_libdir_flag_spec_ld_F77 \ - hardcode_libdir_separator_F77 \ - hardcode_automatic_F77 \ - module_cmds_F77 \ - module_expsym_cmds_F77 \ - lt_cv_prog_compiler_c_o_F77 \ - exclude_expsyms_F77 \ - include_expsyms_F77; do - - case $var in - old_archive_cmds_F77 | \ - old_archive_from_new_cmds_F77 | \ - archive_cmds_F77 | \ - archive_expsym_cmds_F77 | \ - module_cmds_F77 | \ - module_expsym_cmds_F77 | \ - old_archive_from_expsyms_cmds_F77 | \ - export_symbols_cmds_F77 | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_F77 - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# LTCC compiler flags. -LTCFLAGS=$lt_LTCFLAGS - -# A language-specific compiler. -CC=$lt_compiler_F77 - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_F77 - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_F77 - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_F77 - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_F77 -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 - -# Must we lock files when doing compilation? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_F77 - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_F77 -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_F77 -archive_expsym_cmds=$lt_archive_expsym_cmds_F77 -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_F77 -module_expsym_cmds=$lt_module_expsym_cmds_F77 - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_F77 - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_F77 - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_F77 - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_F77 - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_F77 - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_F77 - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_F77 - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_F77 - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_F77 - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_F77 - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_F77 - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_F77 - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_F77" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_F77 - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_F77 - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_F77 - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_F77 - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -CC="$lt_save_CC" - - else - tagname="" - fi - ;; - - GCJ) - if test -n "$GCJ" && test "X$GCJ" != "Xno"; then - - -# Source file extension for Java test sources. -ac_ext=java - -# Object file extension for compiled Java test sources. -objext=o -objext_GCJ=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${GCJ-"gcj"} -compiler=$CC -compiler_GCJ=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - - -# GCJ did not exist at the time GCC didn't implicitly link libc in. -archive_cmds_need_lc_GCJ=no - -old_archive_cmds_GCJ=$old_archive_cmds - - -lt_prog_compiler_no_builtin_flag_GCJ= - -if test "$GCC" = yes; then - lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } -if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:__oline__: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $rm conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } - -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then - lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" -else - : -fi - -fi - -lt_prog_compiler_wl_GCJ= -lt_prog_compiler_pic_GCJ= -lt_prog_compiler_static_GCJ= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } - - if test "$GCC" = yes; then - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_static_GCJ='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_GCJ='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_GCJ='-fno-common' - ;; - - interix3*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared_GCJ=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_GCJ=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_GCJ='-fPIC' - ;; - esac - ;; - - *) - lt_prog_compiler_pic_GCJ='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl_GCJ='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_GCJ='-Bstatic' - else - lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' - fi - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case $cc_basename in - xlc*) - lt_prog_compiler_pic_GCJ='-qnocommon' - lt_prog_compiler_wl_GCJ='-Wl,' - ;; - esac - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl_GCJ='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_GCJ='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl_GCJ='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static_GCJ='-non_shared' - ;; - - newsos6) - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - linux*) - case $cc_basename in - icc* | ecc*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-static' - ;; - pgcc* | pgf77* | pgf90* | pgf95*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-fpic' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - ccc*) - lt_prog_compiler_wl_GCJ='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static_GCJ='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl_GCJ='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static_GCJ='-non_shared' - ;; - - solaris*) - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl_GCJ='-Qoption ld ';; - *) - lt_prog_compiler_wl_GCJ='-Wl,';; - esac - ;; - - sunos4*) - lt_prog_compiler_wl_GCJ='-Qoption ld ' - lt_prog_compiler_pic_GCJ='-PIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic_GCJ='-Kconform_pic' - lt_prog_compiler_static_GCJ='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - unicos*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_can_build_shared_GCJ=no - ;; - - uts4*) - lt_prog_compiler_pic_GCJ='-pic' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared_GCJ=no - ;; - esac - fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic_GCJ" >&5 -$as_echo "$lt_prog_compiler_pic_GCJ" >&6; } - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_GCJ"; then - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 -$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... " >&6; } -if ${lt_prog_compiler_pic_works_GCJ+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_prog_compiler_pic_works_GCJ=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_GCJ" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:__oline__: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_prog_compiler_pic_works_GCJ=yes - fi - fi - $rm conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic_works_GCJ" >&5 -$as_echo "$lt_prog_compiler_pic_works_GCJ" >&6; } - -if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then - case $lt_prog_compiler_pic_GCJ in - "" | " "*) ;; - *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; - esac -else - lt_prog_compiler_pic_GCJ= - lt_prog_compiler_can_build_shared_GCJ=no -fi - -fi -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_GCJ= - ;; - *) - lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" - ;; -esac - -# -# Check to make sure the static flag actually works. -# -wl=$lt_prog_compiler_wl_GCJ eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GCJ\" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if ${lt_prog_compiler_static_works_GCJ+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_prog_compiler_static_works_GCJ=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - printf "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_prog_compiler_static_works_GCJ=yes - fi - else - lt_prog_compiler_static_works_GCJ=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_static_works_GCJ" >&5 -$as_echo "$lt_prog_compiler_static_works_GCJ" >&6; } - -if test x"$lt_prog_compiler_static_works_GCJ" = xyes; then - : -else - lt_prog_compiler_static_GCJ= -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o_GCJ+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o_GCJ=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:__oline__: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o_GCJ=yes - fi - fi - chmod u+w . 2>&5 - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 -$as_echo "$lt_cv_prog_compiler_c_o_GCJ" >&6; } - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -$as_echo_n "checking if we can lock with hard links... " >&6; } - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -$as_echo "$hard_links" >&6; } - if test "$hard_links" = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } - - runpath_var= - allow_undefined_flag_GCJ= - enable_shared_with_static_runtimes_GCJ=no - archive_cmds_GCJ= - archive_expsym_cmds_GCJ= - old_archive_From_new_cmds_GCJ= - old_archive_from_expsyms_cmds_GCJ= - export_dynamic_flag_spec_GCJ= - whole_archive_flag_spec_GCJ= - thread_safe_flag_spec_GCJ= - hardcode_libdir_flag_spec_GCJ= - hardcode_libdir_flag_spec_ld_GCJ= - hardcode_libdir_separator_GCJ= - hardcode_direct_GCJ=no - hardcode_minus_L_GCJ=no - hardcode_shlibpath_var_GCJ=unsupported - link_all_deplibs_GCJ=unknown - hardcode_automatic_GCJ=no - module_cmds_GCJ= - module_expsym_cmds_GCJ= - always_export_symbols_GCJ=no - export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms_GCJ= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - ld_shlibs_GCJ=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_GCJ= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs_GCJ=no - cat <<EOF 1>&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_minus_L_GCJ=yes - - # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - ld_shlibs_GCJ=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag_GCJ=unsupported - # Joseph Beckenbach <jrb3@best.com> says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_GCJ='-L$libdir' - allow_undefined_flag_GCJ=unsupported - always_export_symbols_GCJ=no - enable_shared_with_static_runtimes_GCJ=yes - export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - ld_shlibs_GCJ=no - fi - ;; - - interix3*) - hardcode_direct_GCJ=no - hardcode_shlibpath_var_GCJ=no - hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' - export_dynamic_flag_spec_GCJ='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds_GCJ='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds_GCJ='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers - whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - link_all_deplibs_GCJ=no - else - ld_shlibs_GCJ=no - fi - ;; - - netbsd* | netbsdelf*-gnu | knetbsd*-gnu) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - ld_shlibs_GCJ=no - cat <<EOF 1>&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) - ld_shlibs_GCJ=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - esac - ;; - - sunos4*) - archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - esac - - if test "$ld_shlibs_GCJ" = no; then - runpath_var= - hardcode_libdir_flag_spec_GCJ= - export_dynamic_flag_spec_GCJ= - whole_archive_flag_spec_GCJ= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag_GCJ=unsupported - always_export_symbols_GCJ=yes - archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L_GCJ=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct_GCJ=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_GCJ='' - hardcode_direct_GCJ=yes - hardcode_libdir_separator_GCJ=':' - link_all_deplibs_GCJ=yes - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct_GCJ=yes - else - # We have old collect2 - hardcode_direct_GCJ=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_GCJ=yes - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_libdir_separator_GCJ= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols_GCJ=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_GCJ='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_GCJ="-z nodefs" - archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_GCJ=' ${wl}-bernotok' - allow_undefined_flag_GCJ=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_GCJ='$convenience' - archive_cmds_need_lc_GCJ=yes - # This is similar to how AIX traditionally builds its shared libraries. - archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_minus_L_GCJ=yes - # see comment about different semantics on the GNU ld section - ld_shlibs_GCJ=no - ;; - - bsdi[45]*) - export_dynamic_flag_spec_GCJ=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec_GCJ=' ' - allow_undefined_flag_GCJ=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_From_new_cmds_GCJ='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes_GCJ=yes - ;; - - darwin* | rhapsody*) - case $host_os in - rhapsody* | darwin1.[012]) - allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - archive_cmds_need_lc_GCJ=no - hardcode_direct_GCJ=no - hardcode_automatic_GCJ=yes - hardcode_shlibpath_var_GCJ=unsupported - whole_archive_flag_spec_GCJ='' - link_all_deplibs_GCJ=yes - if test "$GCC" = yes ; then - output_verbose_link_cmd='echo' - archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case $cc_basename in - xlc*) - output_verbose_link_cmd='echo' - archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - ld_shlibs_GCJ=no - ;; - esac - fi - ;; - - dgux*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_shlibpath_var_GCJ=no - ;; - - freebsd1*) - ld_shlibs_GCJ=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes - hardcode_minus_L_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - # GNU/kFreeBSD uses gcc -shared to do shared libraries. - kfreebsd*-gnu) - archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - link_all_deplibs_GCJ=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - hardcode_direct_GCJ=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GCJ=yes - export_dynamic_flag_spec_GCJ='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - - hardcode_direct_GCJ=yes - export_dynamic_flag_spec_GCJ='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GCJ=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - - case $host_cpu in - hppa*64*|ia64*) - hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' - hardcode_direct_GCJ=no - hardcode_shlibpath_var_GCJ=no - ;; - *) - hardcode_direct_GCJ=yes - export_dynamic_flag_spec_GCJ='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GCJ=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' - fi - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - link_all_deplibs_GCJ=yes - ;; - - netbsd* | netbsdelf*-gnu | knetbsd*-gnu) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - newsos6) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - hardcode_shlibpath_var_GCJ=no - ;; - - openbsd*) - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' - export_dynamic_flag_spec_GCJ='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - ;; - *) - archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_minus_L_GCJ=yes - allow_undefined_flag_GCJ=unsupported - archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag_GCJ=' -expect_unresolved \*' - archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag_GCJ=' -expect_unresolved \*' - archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec_GCJ='-rpath $libdir' - fi - hardcode_libdir_separator_GCJ=: - ;; - - solaris*) - no_undefined_flag_GCJ=' -z text' - if test "$GCC" = yes; then - wlarc='${wl}' - archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - wlarc='' - archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_shlibpath_var_GCJ=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; - esac - link_all_deplibs_GCJ=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_direct_GCJ=yes - hardcode_minus_L_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds_GCJ='$CC -r -o $output$reload_objs' - hardcode_direct_GCJ=no - ;; - motorola) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_GCJ=no - ;; - - sysv4.3*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_GCJ=no - export_dynamic_flag_spec_GCJ='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_GCJ=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs_GCJ=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) - no_undefined_flag_GCJ='${wl}-z,text' - archive_cmds_need_lc_GCJ=no - hardcode_shlibpath_var_GCJ=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds_GCJ='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_GCJ='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - no_undefined_flag_GCJ='${wl}-z,text' - allow_undefined_flag_GCJ='${wl}-z,nodefs' - archive_cmds_need_lc_GCJ=no - hardcode_shlibpath_var_GCJ=no - hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' - hardcode_libdir_separator_GCJ=':' - link_all_deplibs_GCJ=yes - export_dynamic_flag_spec_GCJ='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds_GCJ='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_GCJ='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_shlibpath_var_GCJ=no - ;; - - *) - ld_shlibs_GCJ=no - ;; - esac - fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_GCJ" >&5 -$as_echo "$ld_shlibs_GCJ" >&6; } -test "$ld_shlibs_GCJ" = no && can_build_shared=no - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_GCJ" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_GCJ=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_GCJ in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } - $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_GCJ - pic_flag=$lt_prog_compiler_pic_GCJ - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ - allow_undefined_flag_GCJ= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\""; } >&5 - (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - then - archive_cmds_need_lc_GCJ=no - else - archive_cmds_need_lc_GCJ=yes - fi - allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc_GCJ" >&5 -$as_echo "$archive_cmds_need_lc_GCJ" >&6; } - ;; - esac - fi - ;; -esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -$as_echo_n "checking dynamic linker characteristics... " >&6; } -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib<name>.so - # instead of lib<name>.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[123]*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ - freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - freebsd*) # from 4.6 on - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -interix3*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsdelf*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='NetBSD ld.elf_so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - shlibpath_overrides_runpath=no - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - shlibpath_overrides_runpath=yes - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -$as_echo "$dynamic_linker" >&6; } -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -$as_echo_n "checking how to hardcode library paths into programs... " >&6; } -hardcode_action_GCJ= -if test -n "$hardcode_libdir_flag_spec_GCJ" || \ - test -n "$runpath_var_GCJ" || \ - test "X$hardcode_automatic_GCJ" = "Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct_GCJ" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && - test "$hardcode_minus_L_GCJ" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_GCJ=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_GCJ=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_GCJ=unsupported -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_GCJ" >&5 -$as_echo "$hardcode_action_GCJ" >&6; } - -if test "$hardcode_action_GCJ" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_GCJ \ - CC_GCJ \ - LD_GCJ \ - lt_prog_compiler_wl_GCJ \ - lt_prog_compiler_pic_GCJ \ - lt_prog_compiler_static_GCJ \ - lt_prog_compiler_no_builtin_flag_GCJ \ - export_dynamic_flag_spec_GCJ \ - thread_safe_flag_spec_GCJ \ - whole_archive_flag_spec_GCJ \ - enable_shared_with_static_runtimes_GCJ \ - old_archive_cmds_GCJ \ - old_archive_from_new_cmds_GCJ \ - predep_objects_GCJ \ - postdep_objects_GCJ \ - predeps_GCJ \ - postdeps_GCJ \ - compiler_lib_search_path_GCJ \ - archive_cmds_GCJ \ - archive_expsym_cmds_GCJ \ - postinstall_cmds_GCJ \ - postuninstall_cmds_GCJ \ - old_archive_from_expsyms_cmds_GCJ \ - allow_undefined_flag_GCJ \ - no_undefined_flag_GCJ \ - export_symbols_cmds_GCJ \ - hardcode_libdir_flag_spec_GCJ \ - hardcode_libdir_flag_spec_ld_GCJ \ - hardcode_libdir_separator_GCJ \ - hardcode_automatic_GCJ \ - module_cmds_GCJ \ - module_expsym_cmds_GCJ \ - lt_cv_prog_compiler_c_o_GCJ \ - exclude_expsyms_GCJ \ - include_expsyms_GCJ; do - - case $var in - old_archive_cmds_GCJ | \ - old_archive_from_new_cmds_GCJ | \ - archive_cmds_GCJ | \ - archive_expsym_cmds_GCJ | \ - module_cmds_GCJ | \ - module_expsym_cmds_GCJ | \ - old_archive_from_expsyms_cmds_GCJ | \ - export_symbols_cmds_GCJ | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_GCJ - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# LTCC compiler flags. -LTCFLAGS=$lt_LTCFLAGS - -# A language-specific compiler. -CC=$lt_compiler_GCJ - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_GCJ - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_GCJ - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_GCJ - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_GCJ -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ - -# Must we lock files when doing compilation? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_GCJ - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_GCJ -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_GCJ -archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_GCJ -module_expsym_cmds=$lt_module_expsym_cmds_GCJ - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_GCJ - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_GCJ - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_GCJ - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_GCJ - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_GCJ - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_GCJ - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_GCJ - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_GCJ - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_GCJ - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_GCJ - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_GCJ - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_GCJ" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_GCJ - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_GCJ - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_GCJ - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_GCJ - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -CC="$lt_save_CC" - - else - tagname="" - fi - ;; - - RC) - - -# Source file extension for RC test sources. -ac_ext=rc - -# Object file extension for compiled RC test sources. -objext=o -objext_RC=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' - -# Code to be used in simple link tests -lt_simple_link_test_code="$lt_simple_compile_test_code" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${RC-"windres"} -compiler=$CC -compiler_RC=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - -lt_cv_prog_compiler_c_o_RC=yes - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_RC \ - CC_RC \ - LD_RC \ - lt_prog_compiler_wl_RC \ - lt_prog_compiler_pic_RC \ - lt_prog_compiler_static_RC \ - lt_prog_compiler_no_builtin_flag_RC \ - export_dynamic_flag_spec_RC \ - thread_safe_flag_spec_RC \ - whole_archive_flag_spec_RC \ - enable_shared_with_static_runtimes_RC \ - old_archive_cmds_RC \ - old_archive_from_new_cmds_RC \ - predep_objects_RC \ - postdep_objects_RC \ - predeps_RC \ - postdeps_RC \ - compiler_lib_search_path_RC \ - archive_cmds_RC \ - archive_expsym_cmds_RC \ - postinstall_cmds_RC \ - postuninstall_cmds_RC \ - old_archive_from_expsyms_cmds_RC \ - allow_undefined_flag_RC \ - no_undefined_flag_RC \ - export_symbols_cmds_RC \ - hardcode_libdir_flag_spec_RC \ - hardcode_libdir_flag_spec_ld_RC \ - hardcode_libdir_separator_RC \ - hardcode_automatic_RC \ - module_cmds_RC \ - module_expsym_cmds_RC \ - lt_cv_prog_compiler_c_o_RC \ - exclude_expsyms_RC \ - include_expsyms_RC; do - - case $var in - old_archive_cmds_RC | \ - old_archive_from_new_cmds_RC | \ - archive_cmds_RC | \ - archive_expsym_cmds_RC | \ - module_cmds_RC | \ - module_expsym_cmds_RC | \ - old_archive_from_expsyms_cmds_RC | \ - export_symbols_cmds_RC | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_RC - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# LTCC compiler flags. -LTCFLAGS=$lt_LTCFLAGS - -# A language-specific compiler. -CC=$lt_compiler_RC - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_RC - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_RC - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_RC - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_RC -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC - -# Must we lock files when doing compilation? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_RC - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_RC -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_RC -archive_expsym_cmds=$lt_archive_expsym_cmds_RC -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_RC -module_expsym_cmds=$lt_module_expsym_cmds_RC - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_RC - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_RC - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_RC - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_RC - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_RC - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_RC - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_RC - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_RC - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_RC - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_RC - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_RC - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_RC - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_RC - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_RC" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_RC - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_RC - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_RC - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_RC - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -CC="$lt_save_CC" - - ;; - - *) - as_fn_error $? "Unsupported tag name: $tagname" "$LINENO" 5 - ;; - esac - - # Append the new tag name to the list of available tags. - if test -n "$tagname" ; then - available_tags="$available_tags $tagname" - fi - fi - done - IFS="$lt_save_ifs" - - # Now substitute the updated list of available tags. - if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then - mv "${ofile}T" "$ofile" - chmod +x "$ofile" - else - rm -f "${ofile}T" - as_fn_error $? "unable to update list of available tagged configurations." "$LINENO" 5 - fi -fi - - - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' - -# Prevent multiple expansion - - - - - - - - - - - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } -set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' -_ACEOF -# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. -case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; - *) - eval ac_cv_prog_make_${ac_make}_set=no;; -esac -rm -f conftest.make -fi -if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - SET_MAKE= -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - SET_MAKE="MAKE=${MAKE-make}" -fi - - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX"; then - if test -n "$CCC"; then - CXX=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC QCC - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -$as_echo "$CXX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC QCC -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CXX="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -$as_echo "$ac_ct_CXX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CXX" && break -done - - if test "x$ac_ct_CXX" = x; then - CXX="g++" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CXX=$ac_ct_CXX - fi -fi - - fi -fi -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 -$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } -if ${ac_cv_cxx_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 -$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GXX=yes -else - GXX= -fi -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 -$as_echo_n "checking whether $CXX accepts -g... " >&6; } -if ${ac_cv_prog_cxx_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_cxx_werror_flag=$ac_cxx_werror_flag - ac_cxx_werror_flag=yes - ac_cv_prog_cxx_g=no - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_prog_cxx_g=yes -else - CXXFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - -else - ac_cxx_werror_flag=$ac_save_cxx_werror_flag - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_prog_cxx_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_cxx_werror_flag=$ac_save_cxx_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 -$as_echo "$ac_cv_prog_cxx_g" >&6; } -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -depcc="$CXX" am_compiler_list= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CXX_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CXX_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CXX_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CXX_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } -CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type - - - -if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then - am__fastdepCXX_TRUE= - am__fastdepCXX_FALSE='#' -else - am__fastdepCXX_TRUE='#' - am__fastdepCXX_FALSE= -fi - - - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 -$as_echo_n "checking how to run the C++ preprocessor... " >&6; } -if test -z "$CXXCPP"; then - if ${ac_cv_prog_CXXCPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CXXCPP needs to be expanded - for CXXCPP in "$CXX -E" "/lib/cpp" - do - ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - # <limits.h> exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -@%:@ifdef __STDC__ -@%:@ include <limits.h> -@%:@else -@%:@ include <assert.h> -@%:@endif - Syntax error -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -@%:@include <ac_nonexistent.h> -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CXXCPP=$CXXCPP - -fi - CXXCPP=$ac_cv_prog_CXXCPP -else - ac_cv_prog_CXXCPP=$CXXCPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 -$as_echo "$CXXCPP" >&6; } -ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - # <limits.h> exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -@%:@ifdef __STDC__ -@%:@ include <limits.h> -@%:@else -@%:@ include <assert.h> -@%:@endif - Syntax error -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -@%:@include <ac_nonexistent.h> -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - -# CXX fine tuning -case "$host" in - *-dec-osf*) - CXXFLAGS="$CXXFLAGS -std strict_ansi_errors" - ;; - *) - ;; -esac - -# Doxygen - -@%:@ Check whether --enable-doxygen was given. -if test "${enable_doxygen+set}" = set; then : - enableval=$enable_doxygen; -fi - - -@%:@ Check whether --enable-dot was given. -if test "${enable_dot+set}" = set; then : - enableval=$enable_dot; -fi - - -@%:@ Check whether --enable-html-docs was given. -if test "${enable_html_docs+set}" = set; then : - enableval=$enable_html_docs; -else - enable_html_docs=yes -fi - - -@%:@ Check whether --enable-latex-docs was given. -if test "${enable_latex_docs+set}" = set; then : - enableval=$enable_latex_docs; -else - enable_latex_docs=no -fi - - -if test "x$enable_doxygen" = xno; then - enable_doc=no -else - # Extract the first word of "doxygen", so it can be a program name with args. -set dummy doxygen; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_DOXYGEN+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $DOXYGEN in - [\\/]* | ?:[\\/]*) - ac_cv_path_DOXYGEN="$DOXYGEN" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_DOXYGEN="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -DOXYGEN=$ac_cv_path_DOXYGEN -if test -n "$DOXYGEN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOXYGEN" >&5 -$as_echo "$DOXYGEN" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - if test "x$DOXYGEN" = x; then - if test "x$enable_doxygen" = xyes; then - as_fn_error $? "could not find doxygen" "$LINENO" 5 - fi - enable_doc=no - else - enable_doc=yes - # Extract the first word of "dot", so it can be a program name with args. -set dummy dot; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_DOT+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $DOT in - [\\/]* | ?:[\\/]*) - ac_cv_path_DOT="$DOT" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_DOT="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -DOT=$ac_cv_path_DOT -if test -n "$DOT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOT" >&5 -$as_echo "$DOT" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi - - -if test x$enable_doc = xyes; then - DOC_TRUE= - DOC_FALSE='#' -else - DOC_TRUE='#' - DOC_FALSE= -fi - - - -if test x$enable_latex_docs = xyes; then - LATEX_DOC_TRUE= - LATEX_DOC_FALSE='#' -else - LATEX_DOC_TRUE='#' - LATEX_DOC_FALSE= -fi - - -if test x$DOT = x; then - if test "x$enable_dot" = xyes; then - as_fn_error $? "could not find dot" "$LINENO" 5 - fi - enable_dot=no -else - enable_dot=yes -fi - -manual_dest="manual" -base_dir=`(cd $srcdir && pwd)` - - - - - - - - - - -# Checks header files -# ---------------------------------------------------------------------------- - - apr_found="no" - - if test "$target_os" = "os2-emx"; then - # Scripts don't pass test -x on OS/2 - TEST_X="test -f" - else - TEST_X="test -x" - fi - - acceptable_majors="1" - - apr_temp_acceptable_apr_config="" - for apr_temp_major in $acceptable_majors - do - case $apr_temp_major in - 0) - apr_temp_acceptable_apr_config="$apr_temp_acceptable_apr_config apr-config" - ;; - *) - apr_temp_acceptable_apr_config="$apr_temp_acceptable_apr_config apr-$apr_temp_major-config" - ;; - esac - done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for APR" >&5 -$as_echo_n "checking for APR... " >&6; } - -@%:@ Check whether --with-apr was given. -if test "${with_apr+set}" = set; then : - withval=$with_apr; - if test "$withval" = "no" || test "$withval" = "yes"; then - as_fn_error $? "--with-apr requires a directory or file to be provided" "$LINENO" 5 - fi - - for apr_temp_apr_config_file in $apr_temp_acceptable_apr_config - do - for lookdir in "$withval/bin" "$withval" - do - if $TEST_X "$lookdir/$apr_temp_apr_config_file"; then - apr_config="$lookdir/$apr_temp_apr_config_file" - - apr_found="yes" - break 2 - fi - done - done - - if test "$apr_found" != "yes" && $TEST_X "$withval" && $withval --help > /dev/null 2>&1 ; then - apr_config="$withval" - apr_found="yes" - fi - - if test "$apr_found" != "yes"; then - as_fn_error $? "the --with-apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file." "$LINENO" 5 - fi - -else - - if test -n "1" && test "1" = "1"; then - for apr_temp_apr_config_file in $apr_temp_acceptable_apr_config - do - if $apr_temp_apr_config_file --help > /dev/null 2>&1 ; then - apr_config="$apr_temp_apr_config_file" - - apr_found="yes" - break - else - for lookdir in /usr /usr/local /usr/local/apr /opt/apr; do - if $TEST_X "$lookdir/bin/$apr_temp_apr_config_file"; then - apr_config="$lookdir/bin/$apr_temp_apr_config_file" - - apr_found="yes" - break 2 - fi - done - fi - done - fi - if test "$apr_found" = "no" && test -d ""; then - apr_temp_abs_srcdir="`cd && pwd`" - apr_found="reconfig" - apr_bundled_major="`sed -n '/#define.*APR_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p' \"/include/apr_version.h\"`" - case $apr_bundled_major in - "") - as_fn_error $? "failed to find major version of bundled APR" "$LINENO" 5 - ;; - 0) - apr_temp_apr_config_file="apr-config" - ;; - *) - apr_temp_apr_config_file="apr-$apr_bundled_major-config" - ;; - esac - if test -n ""; then - apr_config="/$apr_temp_apr_config_file" - else - apr_config="/$apr_temp_apr_config_file" - fi - fi - -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_found" >&5 -$as_echo "$apr_found" >&6; } - -if test "$apr_found" = "no"; then - as_fn_error $? "APR could not be located. Please use the --with-apr option." "$LINENO" 5 -fi - -CPPFLAGS="$CPPFLAGS `$apr_config --cppflags` `$apr_config --includes`" -APR_LIBS="`$apr_config --link-ld --libs`" - -LDFLAGS="$LDFLAGS $APR_LIBS" - - - apu_found="no" - - if test "$target_os" = "os2-emx"; then - # Scripts don't pass test -x on OS/2 - TEST_X="test -f" - else - TEST_X="test -x" - fi - - acceptable_majors="1" - - apu_temp_acceptable_apu_config="" - for apu_temp_major in $acceptable_majors - do - case $apu_temp_major in - 0) - apu_temp_acceptable_apu_config="$apu_temp_acceptable_apu_config apu-config" - ;; - *) - apu_temp_acceptable_apu_config="$apu_temp_acceptable_apu_config apu-$apu_temp_major-config" - ;; - esac - done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for APR-util" >&5 -$as_echo_n "checking for APR-util... " >&6; } - -@%:@ Check whether --with-apr-util was given. -if test "${with_apr_util+set}" = set; then : - withval=$with_apr_util; - if test "$withval" = "no" || test "$withval" = "yes"; then - as_fn_error $? "--with-apr-util requires a directory or file to be provided" "$LINENO" 5 - fi - - for apu_temp_apu_config_file in $apu_temp_acceptable_apu_config - do - for lookdir in "$withval/bin" "$withval" - do - if $TEST_X "$lookdir/$apu_temp_apu_config_file"; then - apu_config="$lookdir/$apu_temp_apu_config_file" - - apu_found="yes" - break 2 - fi - done - done - - if test "$apu_found" != "yes" && $TEST_X "$withval" && $withval --help > /dev/null 2>&1 ; then - apu_config="$withval" - apu_found="yes" - fi - - if test "$apu_found" != "yes"; then - as_fn_error $? "the --with-apr-util parameter is incorrect. It must specify an install prefix, a build directory, or an apu-config file." "$LINENO" 5 - fi - -else - - if test -n "1" && test "1" = "1"; then - for apu_temp_apu_config_file in $apu_temp_acceptable_apu_config - do - if $apu_temp_apu_config_file --help > /dev/null 2>&1 ; then - apu_config="$apu_temp_apu_config_file" - - apu_found="yes" - break - else - for lookdir in /usr /usr/local /usr/local/apr /opt/apr; do - if $TEST_X "$lookdir/bin/$apu_temp_apu_config_file"; then - apu_config="$lookdir/bin/$apu_temp_apu_config_file" - - apu_found="yes" - break 2 - fi - done - fi - done - fi - if test "$apu_found" = "no" && test -d ""; then - apu_temp_abs_srcdir="`cd && pwd`" - apu_found="reconfig" - apu_bundled_major="`sed -n '/#define.*APU_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p' \"/include/apu_version.h\"`" - case $apu_bundled_major in - "") - as_fn_error $? "failed to find major version of bundled APU" "$LINENO" 5 - ;; - 0) - apu_temp_apu_config_file="apu-config" - ;; - *) - apu_temp_apu_config_file="apu-$apu_bundled_major-config" - ;; - esac - if test -n ""; then - apu_config="/$apu_temp_apu_config_file" - else - apu_config="/$apu_temp_apu_config_file" - fi - fi - -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $apu_found" >&5 -$as_echo "$apu_found" >&6; } - -if test "$apu_found" = "no"; then - as_fn_error $? "APR-util could not be located. Please use the --with-apr-util option." "$LINENO" 5 -fi - -CPPFLAGS="$CPPFLAGS `$apu_config --includes`" -APU_LIBS="`$apu_config --link-ld --libs`" - -LDFLAGS="$LDFLAGS $APU_LIBS" - -# Checks local idioms -# ---------------------------------------------------------------------------- - -# for local syslog() function for SyslogAppender -for ac_func in mbsrtowcs -do : - ac_fn_cxx_check_func "$LINENO" "mbsrtowcs" "ac_cv_func_mbsrtowcs" -if test "x$ac_cv_func_mbsrtowcs" = xyes; then : - cat >>confdefs.h <<_ACEOF -@%:@define HAVE_MBSRTOWCS 1 -_ACEOF - have_mbsrtowcs=yes -else - have_mbsrtowcs=no -fi -done - -if test "$have_mbsrtowcs" = "yes" -then - HAS_MBSRTOWCS=1 - -else - HAS_MBSRTOWCS=0 - -fi - -for ac_func in wcstombs -do : - ac_fn_cxx_check_func "$LINENO" "wcstombs" "ac_cv_func_wcstombs" -if test "x$ac_cv_func_wcstombs" = xyes; then : - cat >>confdefs.h <<_ACEOF -@%:@define HAVE_WCSTOMBS 1 -_ACEOF - have_wcstombs=yes -else - have_wcstombs=no -fi -done - -if test "$have_wcstombs" = "yes" -then - HAS_WCSTOMBS=1 - -else - HAS_WCSTOMBS=0 - -fi - -# for local syslog() function for SyslogAppender -for ac_func in syslog -do : - ac_fn_cxx_check_func "$LINENO" "syslog" "ac_cv_func_syslog" -if test "x$ac_cv_func_syslog" = xyes; then : - cat >>confdefs.h <<_ACEOF -@%:@define HAVE_SYSLOG 1 -_ACEOF - have_syslog=yes -else - have_syslog=no -fi -done - -if test "$have_syslog" = "yes" -then - HAS_SYSLOG=1 - -else - HAS_SYSLOG=0 - -fi - - -ac_fn_cxx_check_header_mongrel "$LINENO" "locale" "ac_cv_header_locale" "$ac_includes_default" -if test "x$ac_cv_header_locale" = xyes; then : - have_locale=yes -else - have_locale=no -fi - - -if test "$have_locale" = "yes" -then - HAS_STD_LOCALE=1 - -else - HAS_STD_LOCALE=0 - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for wchar_t" >&5 -$as_echo_n "checking for wchar_t... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include <string> - std::wstring w; -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - have_wchar_t=yes -else - have_wchar_t=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_wchar_t" >&5 -$as_echo "$have_wchar_t" >&6; } -if test "$have_wchar_t" = "yes" -then - HAS_WCHAR_T=1 - -else - HAS_WCHAR_T=0 - -fi - -for ac_func in fwide -do : - ac_fn_cxx_check_func "$LINENO" "fwide" "ac_cv_func_fwide" -if test "x$ac_cv_func_fwide" = xyes; then : - cat >>confdefs.h <<_ACEOF -@%:@define HAVE_FWIDE 1 -_ACEOF - have_fwide=yes -else - have_fwide=no -fi -done - -if test "$have_fwide" = "yes" -then - HAS_FWIDE=1 - -else - HAS_FWIDE=0 - -fi - - -# Checks for libraries -# ---------------------------------------------------------------------------- - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi - - - -#for ODBCAppender -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ODBC support" >&5 -$as_echo_n "checking for ODBC support... " >&6; } - -@%:@ Check whether --with-ODBC was given. -if test "${with_ODBC+set}" = set; then : - withval=$with_ODBC; ac_with_odbc=$withval -else - ac_with_odbc=no -fi - -case "$ac_with_odbc" in - Microsoft) - HAS_ODBC=1 - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Microsoft" >&5 -$as_echo "Microsoft" >&6; } - LIBS_ODBC="-lodbc32" - ;; - unixODBC) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unixODBC" >&5 -$as_echo "unixODBC" >&6; } - ac_fn_cxx_check_header_mongrel "$LINENO" "sqlext.h" "ac_cv_header_sqlext_h" "$ac_includes_default" -if test "x$ac_cv_header_sqlext_h" = xyes; then : - -else - as_fn_error $? "unixODBC not found !" "$LINENO" 5 -fi - - - HAS_ODBC=1 - - LIBS_ODBC="-lodbc" - ;; - iODBC) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: iODBC" >&5 -$as_echo "iODBC" >&6; } - # Extract the first word of "iodbc-config", so it can be a program name with args. -set dummy iodbc-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_IODBC_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$IODBC_CONFIG"; then - ac_cv_prog_IODBC_CONFIG="$IODBC_CONFIG" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_IODBC_CONFIG="yes" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_prog_IODBC_CONFIG" && ac_cv_prog_IODBC_CONFIG="no" -fi -fi -IODBC_CONFIG=$ac_cv_prog_IODBC_CONFIG -if test -n "$IODBC_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $IODBC_CONFIG" >&5 -$as_echo "$IODBC_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - if test "x$IODBC_CONFIG" = "xyes" - then - HAS_ODBC=1 - - LIBS_ODBC="`iodbc-config --libs`" - CPPFLAGS_ODBC="`iodbc-config --cflags`" - else - as_fn_error $? "iODBC not found !" "$LINENO" 5 - fi - ;; - no) - HAS_ODBC=0 - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ???" >&5 -$as_echo "???" >&6; } - as_fn_error $? "Unknown option : $ac_with_odbc" "$LINENO" 5 - ;; -esac - - - - -#for SMTPAppender -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SMTP support" >&5 -$as_echo_n "checking for SMTP support... " >&6; } - -@%:@ Check whether --with-SMTP was given. -if test "${with_SMTP+set}" = set; then : - withval=$with_SMTP; ac_with_smtp=$withval -else - ac_with_smtp=no -fi - -case "$ac_with_smtp" in - libesmtp) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: libesmtp" >&5 -$as_echo "libesmtp" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for smtp_create_session in -lesmtp" >&5 -$as_echo_n "checking for smtp_create_session in -lesmtp... " >&6; } -if ${ac_cv_lib_esmtp_smtp_create_session+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lesmtp -lesmtp $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char smtp_create_session (); -int -main () -{ -return smtp_create_session (); - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - ac_cv_lib_esmtp_smtp_create_session=yes -else - ac_cv_lib_esmtp_smtp_create_session=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_esmtp_smtp_create_session" >&5 -$as_echo "$ac_cv_lib_esmtp_smtp_create_session" >&6; } -if test "x$ac_cv_lib_esmtp_smtp_create_session" = xyes; then : - cat >>confdefs.h <<_ACEOF -@%:@define HAVE_LIBESMTP 1 -_ACEOF - - LIBS="-lesmtp $LIBS" - -else - as_fn_error $? "libesmtp library not found !" "$LINENO" 5 -fi - - HAS_LIBESMTP=1 - - LIBS="-lesmtp $LIBS" - ;; - no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - HAS_LIBESMTP=0 - - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ???" >&5 -$as_echo "???" >&6; } - as_fn_error $? "Unknown option : $ac_with_smtp" "$LINENO" 5 - ;; -esac - -#for char api -@%:@ Check whether --enable-char was given. -if test "${enable_char+set}" = set; then : - enableval=$enable_char; -fi - -if test "x$enable_char" = xno; then - have_char_api=no -else - have_char_api=yes -fi - -if test "$have_char_api" = "yes" -then - CHAR_API=1 - -else - CHAR_API=0 - -fi - -#for wchar_t api -@%:@ Check whether --enable-wchar_t was given. -if test "${enable_wchar_t+set}" = set; then : - enableval=$enable_wchar_t; -fi - -if test "x$enable_wchar_t" = xno; then - have_wchar_t_api=no -else - if test "$have_wchar_t" = "yes" - then - have_wchar_t_api=yes - else - have_wchar_t_api=no - fi -fi - -if test "$have_wchar_t_api" = "yes" -then - WCHAR_T_API=1 - -else - WCHAR_T_API=0 - -fi - -#for unichar api -@%:@ Check whether --enable-unichar was given. -if test "${enable_unichar+set}" = set; then : - enableval=$enable_unichar; -fi - -if test "x$enable_unichar" = "yes" -then - UNICHAR_API=1 - -else - UNICHAR_API=0 - -fi - -#for cfstring api -@%:@ Check whether --enable-cfstring was given. -if test "${enable_cfstring+set}" = set; then : - enableval=$enable_cfstring; -fi - -if test "x$enable_cfstring" = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cfstring" >&5 -$as_echo_n "checking for cfstring... " >&6; } - CPPFLAGS="$CPPFLAGS -framework CoreFoundation" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include <CoreFoundation/CFString.h> - CFStringRef x = CFSTR("Hello"); -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - have_cfstring_api=yes -else - have_cfstring_api=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_cfstring_api" >&5 -$as_echo "$have_cfstring_api" >&6; } -else - have_cfstring_api=no -fi - -if test "$have_cfstring_api" = "yes" -then - CFSTRING_API=1 - -else - CFSTRING_API=0 - -fi - -#determine charset type -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking charset type" >&5 -$as_echo_n "checking charset type... " >&6; } - -@%:@ Check whether --with-charset was given. -if test "${with_charset+set}" = set; then : - withval=$with_charset; ac_with_charset=$withval -else - ac_with_charset=auto -fi - - -case "$ac_with_charset" in - utf-8) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: utf-8" >&5 -$as_echo "utf-8" >&6; } - CHARSET_UTF8=1 - - CHARSET_ISO88591=0 - - CHARSET_USASCII=0 - - CHARSET_EBCDIC=0 - - ;; - - iso-8859-1) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: iso-8859-1" >&5 -$as_echo "iso-8859-1" >&6; } - CHARSET_UTF8=0 - - CHARSET_ISO88591=1 - - CHARSET_USASCII=0 - - CHARSET_EBCDIC=0 - - ;; - - usascii) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: usascii" >&5 -$as_echo "usascii" >&6; } - CHARSET_UTF8=0 - - CHARSET_ISO88591=0 - - CHARSET_USASCII=1 - - CHARSET_EBCDIC=0 - - ;; - - ebcdic) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: usascii" >&5 -$as_echo "usascii" >&6; } - CHARSET_UTF8=0 - - CHARSET_ISO88591=0 - - CHARSET_USASCII=0 - - CHARSET_EBCDIC=1 - - ;; - - auto) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: auto" >&5 -$as_echo "auto" >&6; } - CHARSET_UTF8=0 - - CHARSET_ISO88591=0 - - CHARSET_USASCII=0 - - CHARSET_EBCDIC=0 - - ;; - - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ???" >&5 -$as_echo "???" >&6; } - as_fn_error $? "Invalid charset type: $ac_with_charset" "$LINENO" 5 - ;; -esac - - - -#determine logchar type -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking logchar type" >&5 -$as_echo_n "checking logchar type... " >&6; } - -@%:@ Check whether --with-logchar was given. -if test "${with_logchar+set}" = set; then : - withval=$with_logchar; ac_with_logchar=$withval -else - ac_with_logchar=utf-8 -fi - - -case "$ac_with_logchar" in - utf-8) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: utf-8" >&5 -$as_echo "utf-8" >&6; } - LOGCHAR_IS_UTF8=1 - - LOGCHAR_IS_WCHAR=0 - - LOGCHAR_IS_UNICHAR=0 - - ;; - - wchar_t) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: wchar_t" >&5 -$as_echo "wchar_t" >&6; } - LOGCHAR_IS_UTF8=0 - - LOGCHAR_IS_WCHAR=1 - - LOGCHAR_IS_UNICHAR=0 - - ;; - - unichar) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unichar" >&5 -$as_echo "unichar" >&6; } - LOGCHAR_IS_UTF8=0 - - LOGCHAR_IS_WCHAR=0 - - LOGCHAR_IS_UNICHAR=1 - - ;; - - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ???" >&5 -$as_echo "???" >&6; } - as_fn_error $? "Invalid logchar type: $ac_with_logchar" "$LINENO" 5 - ;; -esac - - - -# Create files -# ---------------------------------------------------------------------------- - -ac_config_files="$ac_config_files Makefile liblog4cxx.pc src/Makefile src/main/Makefile src/main/cpp/Makefile src/main/include/Makefile src/main/include/log4cxx/log4cxx.h src/main/include/log4cxx/private/log4cxx_private.h src/main/include/log4cxx/private/Makefile src/main/include/log4cxx/Makefile src/main/include/log4cxx/helpers/Makefile src/main/include/log4cxx/net/Makefile src/main/include/log4cxx/nt/Makefile src/main/include/log4cxx/spi/Makefile src/main/include/log4cxx/spi/location/Makefile src/main/include/log4cxx/varia/Makefile src/main/include/log4cxx/xml/Makefile src/main/include/log4cxx/config/Makefile src/main/include/log4cxx/db/Makefile src/main/include/log4cxx/rolling/Makefile src/main/include/log4cxx/pattern/Makefile src/main/include/log4cxx/filter/Makefile src/site/Makefile src/site/doxy/Makefile src/site/doxy/Doxyfile src/test/Makefile src/test/resources/Makefile src/test/resources/input/Makefile src/test/resources/input/ndc/Makefile src/test/resources/input/rolling/Makefile src/test/resources/input/xml/Makefile src/test/cpp/Makefile src/test/resources/witness/Makefile src/test/resources/witness/encoding/Makefile src/test/resources/witness/ndc/Makefile src/test/resources/witness/rolling/Makefile src/examples/Makefile src/examples/cpp/Makefile" - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes: double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \. - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -ac_script=' -:mline -/\\$/{ - N - s,\\\n,, - b mline -} -t clear -:clear -s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g -t quote -s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g -t quote -b any -:quote -s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g -s/\[/\\&/g -s/\]/\\&/g -s/\$/$$/g -H -:any -${ - g - s/^\n// - s/\n/ /g - p -} -' -DEFS=`sed -n "$ac_script" confdefs.h` - - -ac_libobjs= -ac_ltlibobjs= -U= -for ac_i in : $LIB@&t@OBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIB@&t@OBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - -if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - as_fn_error $? "conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${DOC_TRUE}" && test -z "${DOC_FALSE}"; then - as_fn_error $? "conditional \"DOC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${LATEX_DOC_TRUE}" && test -z "${LATEX_DOC_FALSE}"; then - as_fn_error $? "conditional \"LATEX_DOC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi - -: "${CONFIG_STATUS=./config.status}" -ac_write_fail=0 -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false - -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in @%:@( - *posix*) : - set -o posix ;; @%:@( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in @%:@( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in @%:@(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -@%:@ as_fn_error STATUS ERROR [LINENO LOG_FD] -@%:@ ---------------------------------------- -@%:@ Output "`basename @S|@0`: error: ERROR" to stderr. If LINENO and LOG_FD are -@%:@ provided, also output the error to LOG_FD, referencing LINENO. Then exit the -@%:@ script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} @%:@ as_fn_error - - -@%:@ as_fn_set_status STATUS -@%:@ ----------------------- -@%:@ Set @S|@? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} @%:@ as_fn_set_status - -@%:@ as_fn_exit STATUS -@%:@ ----------------- -@%:@ Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} @%:@ as_fn_exit - -@%:@ as_fn_unset VAR -@%:@ --------------- -@%:@ Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -@%:@ as_fn_append VAR VALUE -@%:@ ---------------------- -@%:@ Append the text in VALUE to the end of the definition contained in VAR. Take -@%:@ advantage of any shell optimizations that allow amortized linear growth over -@%:@ repeated appends, instead of the typical quadratic growth present in naive -@%:@ implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -@%:@ as_fn_arith ARG... -@%:@ ------------------ -@%:@ Perform arithmetic evaluation on the ARGs, and store the result in the -@%:@ global @S|@as_val. Take advantage of shells that can avoid forks. The arguments -@%:@ must be portable across @S|@(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in @%:@((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - - -@%:@ as_fn_mkdir_p -@%:@ ------------- -@%:@ Create "@S|@as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} @%:@ as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - - -@%:@ as_fn_executable_p FILE -@%:@ ----------------------- -@%:@ Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} @%:@ as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by $as_me, which was -generated by GNU Autoconf 2.69. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -case $ac_config_files in *" -"*) set x $ac_config_files; shift; ac_config_files=$*;; -esac - - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" -config_commands="$ac_config_commands" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - -Configuration files: -$config_files - -Configuration commands: -$config_commands - -Report bugs to the package provider." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" -ac_cs_version="\\ -config.status -configured by $0, generated by GNU Autoconf 2.69, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2012 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -INSTALL='$INSTALL' -AWK='$AWK' -test -n "\$AWK" || AWK=awk -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=?*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - --*=) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h | --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; - - *) as_fn_append ac_config_targets " $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -if \$ac_cs_recheck; then - set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' - export CONFIG_SHELL - exec "\$@" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../@%:@@%:@ /;s/...$/ @%:@@%:@/;p;x;p;x' <<_ASBOX -@%:@@%:@ Running $as_me. @%:@@%:@ -_ASBOX - $as_echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# -# INIT-COMMANDS -# -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "liblog4cxx.pc") CONFIG_FILES="$CONFIG_FILES liblog4cxx.pc" ;; - "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; - "src/main/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/Makefile" ;; - "src/main/cpp/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/cpp/Makefile" ;; - "src/main/include/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/Makefile" ;; - "src/main/include/log4cxx/log4cxx.h") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/log4cxx.h" ;; - "src/main/include/log4cxx/private/log4cxx_private.h") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/private/log4cxx_private.h" ;; - "src/main/include/log4cxx/private/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/private/Makefile" ;; - "src/main/include/log4cxx/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/Makefile" ;; - "src/main/include/log4cxx/helpers/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/helpers/Makefile" ;; - "src/main/include/log4cxx/net/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/net/Makefile" ;; - "src/main/include/log4cxx/nt/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/nt/Makefile" ;; - "src/main/include/log4cxx/spi/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/spi/Makefile" ;; - "src/main/include/log4cxx/spi/location/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/spi/location/Makefile" ;; - "src/main/include/log4cxx/varia/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/varia/Makefile" ;; - "src/main/include/log4cxx/xml/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/xml/Makefile" ;; - "src/main/include/log4cxx/config/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/config/Makefile" ;; - "src/main/include/log4cxx/db/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/db/Makefile" ;; - "src/main/include/log4cxx/rolling/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/rolling/Makefile" ;; - "src/main/include/log4cxx/pattern/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/pattern/Makefile" ;; - "src/main/include/log4cxx/filter/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/filter/Makefile" ;; - "src/site/Makefile") CONFIG_FILES="$CONFIG_FILES src/site/Makefile" ;; - "src/site/doxy/Makefile") CONFIG_FILES="$CONFIG_FILES src/site/doxy/Makefile" ;; - "src/site/doxy/Doxyfile") CONFIG_FILES="$CONFIG_FILES src/site/doxy/Doxyfile" ;; - "src/test/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/Makefile" ;; - "src/test/resources/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/resources/Makefile" ;; - "src/test/resources/input/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/resources/input/Makefile" ;; - "src/test/resources/input/ndc/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/resources/input/ndc/Makefile" ;; - "src/test/resources/input/rolling/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/resources/input/rolling/Makefile" ;; - "src/test/resources/input/xml/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/resources/input/xml/Makefile" ;; - "src/test/cpp/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/cpp/Makefile" ;; - "src/test/resources/witness/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/resources/witness/Makefile" ;; - "src/test/resources/witness/encoding/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/resources/witness/encoding/Makefile" ;; - "src/test/resources/witness/ndc/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/resources/witness/ndc/Makefile" ;; - "src/test/resources/witness/rolling/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/resources/witness/rolling/Makefile" ;; - "src/examples/Makefile") CONFIG_FILES="$CONFIG_FILES src/examples/Makefile" ;; - "src/examples/cpp/Makefile") CONFIG_FILES="$CONFIG_FILES src/examples/cpp/Makefile" ;; - - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= ac_tmp= - trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\)..*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\)..*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' <conf$$subs.awk | sed ' -/^[^""]/{ - N - s/\n// -} -' >>$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove sole $(srcdir), -# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// -s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" - - -eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS" -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$ac_tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; - esac -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_sed_extra="$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -s&@INSTALL@&$ac_INSTALL&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&2;} - - rm -f "$ac_tmp/stdin" - case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; - esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - ;; - - - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} - ;; - esac - - - case $ac_file$ac_mode in - "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$mf" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir=$dirpart/$fdir; as_fn_mkdir_p - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done -done - ;; - - esac -done # for ac_tag - - -as_fn_exit 0 -_ACEOF -ac_clean_files=$ac_clean_files_save - -test $ac_write_fail = 0 || - as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit 1 -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi - diff --git a/src/3rd_party/apache-log4cxx-0.10.0/autom4te.cache/requests b/src/3rd_party/apache-log4cxx-0.10.0/autom4te.cache/requests deleted file mode 100644 index 4230a26bbf..0000000000 --- a/src/3rd_party/apache-log4cxx-0.10.0/autom4te.cache/requests +++ /dev/null @@ -1,78 +0,0 @@ -# This file was generated by Autom4te Thu Apr 10 10:06:43 UTC 2014. -# It contains the lists of macros which have been traced. -# It can be safely removed. - -@request = ( - bless( [ - '0', - 1, - [ - '/usr/share/autoconf' - ], - [ - '/usr/share/autoconf/autoconf/autoconf.m4f', - 'aclocal.m4', - 'configure.in' - ], - { - 'AM_MAKEFILE_INCLUDE' => 1, - 'AC_CONFIG_HEADERS' => 1, - 'sinclude' => 1, - '_AM_SUBST_NOTMAKE' => 1, - 'AM_GNU_GETTEXT' => 1, - '_AM_COND_ELSE' => 1, - 'AC_REQUIRE_AUX_FILE' => 1, - 'AC_CONFIG_LINKS' => 1, - 'm4_sinclude' => 1, - 'AM_AUTOMAKE_VERSION' => 1, - 'AM_PROG_CC_C_O' => 1, - 'LT_SUPPORTED_TAG' => 1, - 'AC_CANONICAL_TARGET' => 1, - 'AM_SILENT_RULES' => 1, - 'AM_PROG_F77_C_O' => 1, - 'AC_SUBST' => 1, - 'm4_pattern_forbid' => 1, - 'AM_MAINTAINER_MODE' => 1, - 'AC_CONFIG_LIBOBJ_DIR' => 1, - 'AM_INIT_AUTOMAKE' => 1, - 'AC_FC_FREEFORM' => 1, - 'AM_POT_TOOLS' => 1, - 'AC_CANONICAL_HOST' => 1, - 'LT_INIT' => 1, - 'AC_CONFIG_AUX_DIR' => 1, - 'LT_CONFIG_LTDL_DIR' => 1, - '_AM_MAKEFILE_INCLUDE' => 1, - 'AC_FC_PP_SRCEXT' => 1, - 'AC_CANONICAL_SYSTEM' => 1, - '_LT_AC_TAGCONFIG' => 1, - 'AM_PATH_GUILE' => 1, - 'AC_CONFIG_FILES' => 1, - 'AC_LIBSOURCE' => 1, - 'AC_CANONICAL_BUILD' => 1, - 'AC_INIT' => 1, - 'AC_SUBST_TRACE' => 1, - 'AM_PROG_AR' => 1, - 'm4_include' => 1, - 'AM_GNU_GETTEXT_INTL_SUBDIR' => 1, - 'AH_OUTPUT' => 1, - 'AC_FC_PP_DEFINE' => 1, - 'AC_DEFINE_TRACE_LITERAL' => 1, - 'm4_pattern_allow' => 1, - 'AM_CONDITIONAL' => 1, - '_AM_COND_ENDIF' => 1, - '_AM_COND_IF' => 1, - 'AM_PROG_MOC' => 1, - 'AM_PROG_CXX_C_O' => 1, - 'AC_CONFIG_SUBDIRS' => 1, - 'include' => 1, - 'AM_PROG_FC_C_O' => 1, - 'AM_XGETTEXT_OPTION' => 1, - 'AM_NLS' => 1, - 'AM_ENABLE_MULTILIB' => 1, - 'AC_PROG_LIBTOOL' => 1, - '_m4_warn' => 1, - 'AC_FC_SRCEXT' => 1 - } - ], 'Autom4te::Request' ) - ); - diff --git a/src/3rd_party/apache-log4cxx-0.10.0/autom4te.cache/traces.0 b/src/3rd_party/apache-log4cxx-0.10.0/autom4te.cache/traces.0 deleted file mode 100644 index e3e68a1a13..0000000000 --- a/src/3rd_party/apache-log4cxx-0.10.0/autom4te.cache/traces.0 +++ /dev/null @@ -1,1131 +0,0 @@ -m4trace:aclocal.m4:7256: -1- m4_include([find_apr.m4]) -m4trace:aclocal.m4:7257: -1- m4_include([find_apu.m4]) -m4trace:configure.in:1: -1- AC_INIT([src/main/cpp/logger.cpp]) -m4trace:configure.in:1: -1- m4_pattern_forbid([^_?A[CHUM]_]) -m4trace:configure.in:1: -1- m4_pattern_forbid([_AC_]) -m4trace:configure.in:1: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS']) -m4trace:configure.in:1: -1- m4_pattern_allow([^AS_FLAGS$]) -m4trace:configure.in:1: -1- m4_pattern_forbid([^_?m4_]) -m4trace:configure.in:1: -1- m4_pattern_forbid([^dnl$]) -m4trace:configure.in:1: -1- m4_pattern_forbid([^_?AS_]) -m4trace:configure.in:1: -1- AC_SUBST([SHELL]) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([SHELL]) -m4trace:configure.in:1: -1- m4_pattern_allow([^SHELL$]) -m4trace:configure.in:1: -1- AC_SUBST([PATH_SEPARATOR]) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([PATH_SEPARATOR]) -m4trace:configure.in:1: -1- m4_pattern_allow([^PATH_SEPARATOR$]) -m4trace:configure.in:1: -1- AC_SUBST([PACKAGE_NAME], [m4_ifdef([AC_PACKAGE_NAME], ['AC_PACKAGE_NAME'])]) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([PACKAGE_NAME]) -m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_NAME$]) -m4trace:configure.in:1: -1- AC_SUBST([PACKAGE_TARNAME], [m4_ifdef([AC_PACKAGE_TARNAME], ['AC_PACKAGE_TARNAME'])]) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([PACKAGE_TARNAME]) -m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_TARNAME$]) -m4trace:configure.in:1: -1- AC_SUBST([PACKAGE_VERSION], [m4_ifdef([AC_PACKAGE_VERSION], ['AC_PACKAGE_VERSION'])]) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([PACKAGE_VERSION]) -m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_VERSION$]) -m4trace:configure.in:1: -1- AC_SUBST([PACKAGE_STRING], [m4_ifdef([AC_PACKAGE_STRING], ['AC_PACKAGE_STRING'])]) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([PACKAGE_STRING]) -m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_STRING$]) -m4trace:configure.in:1: -1- AC_SUBST([PACKAGE_BUGREPORT], [m4_ifdef([AC_PACKAGE_BUGREPORT], ['AC_PACKAGE_BUGREPORT'])]) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([PACKAGE_BUGREPORT]) -m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$]) -m4trace:configure.in:1: -1- AC_SUBST([PACKAGE_URL], [m4_ifdef([AC_PACKAGE_URL], ['AC_PACKAGE_URL'])]) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([PACKAGE_URL]) -m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_URL$]) -m4trace:configure.in:1: -1- AC_SUBST([exec_prefix], [NONE]) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([exec_prefix]) -m4trace:configure.in:1: -1- m4_pattern_allow([^exec_prefix$]) -m4trace:configure.in:1: -1- AC_SUBST([prefix], [NONE]) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([prefix]) -m4trace:configure.in:1: -1- m4_pattern_allow([^prefix$]) -m4trace:configure.in:1: -1- AC_SUBST([program_transform_name], [s,x,x,]) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([program_transform_name]) -m4trace:configure.in:1: -1- m4_pattern_allow([^program_transform_name$]) -m4trace:configure.in:1: -1- AC_SUBST([bindir], ['${exec_prefix}/bin']) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([bindir]) -m4trace:configure.in:1: -1- m4_pattern_allow([^bindir$]) -m4trace:configure.in:1: -1- AC_SUBST([sbindir], ['${exec_prefix}/sbin']) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([sbindir]) -m4trace:configure.in:1: -1- m4_pattern_allow([^sbindir$]) -m4trace:configure.in:1: -1- AC_SUBST([libexecdir], ['${exec_prefix}/libexec']) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([libexecdir]) -m4trace:configure.in:1: -1- m4_pattern_allow([^libexecdir$]) -m4trace:configure.in:1: -1- AC_SUBST([datarootdir], ['${prefix}/share']) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([datarootdir]) -m4trace:configure.in:1: -1- m4_pattern_allow([^datarootdir$]) -m4trace:configure.in:1: -1- AC_SUBST([datadir], ['${datarootdir}']) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([datadir]) -m4trace:configure.in:1: -1- m4_pattern_allow([^datadir$]) -m4trace:configure.in:1: -1- AC_SUBST([sysconfdir], ['${prefix}/etc']) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([sysconfdir]) -m4trace:configure.in:1: -1- m4_pattern_allow([^sysconfdir$]) -m4trace:configure.in:1: -1- AC_SUBST([sharedstatedir], ['${prefix}/com']) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([sharedstatedir]) -m4trace:configure.in:1: -1- m4_pattern_allow([^sharedstatedir$]) -m4trace:configure.in:1: -1- AC_SUBST([localstatedir], ['${prefix}/var']) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([localstatedir]) -m4trace:configure.in:1: -1- m4_pattern_allow([^localstatedir$]) -m4trace:configure.in:1: -1- AC_SUBST([includedir], ['${prefix}/include']) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([includedir]) -m4trace:configure.in:1: -1- m4_pattern_allow([^includedir$]) -m4trace:configure.in:1: -1- AC_SUBST([oldincludedir], ['/usr/include']) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([oldincludedir]) -m4trace:configure.in:1: -1- m4_pattern_allow([^oldincludedir$]) -m4trace:configure.in:1: -1- AC_SUBST([docdir], [m4_ifset([AC_PACKAGE_TARNAME], - ['${datarootdir}/doc/${PACKAGE_TARNAME}'], - ['${datarootdir}/doc/${PACKAGE}'])]) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([docdir]) -m4trace:configure.in:1: -1- m4_pattern_allow([^docdir$]) -m4trace:configure.in:1: -1- AC_SUBST([infodir], ['${datarootdir}/info']) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([infodir]) -m4trace:configure.in:1: -1- m4_pattern_allow([^infodir$]) -m4trace:configure.in:1: -1- AC_SUBST([htmldir], ['${docdir}']) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([htmldir]) -m4trace:configure.in:1: -1- m4_pattern_allow([^htmldir$]) -m4trace:configure.in:1: -1- AC_SUBST([dvidir], ['${docdir}']) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([dvidir]) -m4trace:configure.in:1: -1- m4_pattern_allow([^dvidir$]) -m4trace:configure.in:1: -1- AC_SUBST([pdfdir], ['${docdir}']) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([pdfdir]) -m4trace:configure.in:1: -1- m4_pattern_allow([^pdfdir$]) -m4trace:configure.in:1: -1- AC_SUBST([psdir], ['${docdir}']) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([psdir]) -m4trace:configure.in:1: -1- m4_pattern_allow([^psdir$]) -m4trace:configure.in:1: -1- AC_SUBST([libdir], ['${exec_prefix}/lib']) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([libdir]) -m4trace:configure.in:1: -1- m4_pattern_allow([^libdir$]) -m4trace:configure.in:1: -1- AC_SUBST([localedir], ['${datarootdir}/locale']) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([localedir]) -m4trace:configure.in:1: -1- m4_pattern_allow([^localedir$]) -m4trace:configure.in:1: -1- AC_SUBST([mandir], ['${datarootdir}/man']) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([mandir]) -m4trace:configure.in:1: -1- m4_pattern_allow([^mandir$]) -m4trace:configure.in:1: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_NAME]) -m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_NAME$]) -m4trace:configure.in:1: -1- AH_OUTPUT([PACKAGE_NAME], [/* Define to the full name of this package. */ -@%:@undef PACKAGE_NAME]) -m4trace:configure.in:1: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_TARNAME]) -m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_TARNAME$]) -m4trace:configure.in:1: -1- AH_OUTPUT([PACKAGE_TARNAME], [/* Define to the one symbol short name of this package. */ -@%:@undef PACKAGE_TARNAME]) -m4trace:configure.in:1: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_VERSION]) -m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_VERSION$]) -m4trace:configure.in:1: -1- AH_OUTPUT([PACKAGE_VERSION], [/* Define to the version of this package. */ -@%:@undef PACKAGE_VERSION]) -m4trace:configure.in:1: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_STRING]) -m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_STRING$]) -m4trace:configure.in:1: -1- AH_OUTPUT([PACKAGE_STRING], [/* Define to the full name and version of this package. */ -@%:@undef PACKAGE_STRING]) -m4trace:configure.in:1: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_BUGREPORT]) -m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$]) -m4trace:configure.in:1: -1- AH_OUTPUT([PACKAGE_BUGREPORT], [/* Define to the address where bug reports for this package should be sent. */ -@%:@undef PACKAGE_BUGREPORT]) -m4trace:configure.in:1: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_URL]) -m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_URL$]) -m4trace:configure.in:1: -1- AH_OUTPUT([PACKAGE_URL], [/* Define to the home page for this package. */ -@%:@undef PACKAGE_URL]) -m4trace:configure.in:1: -1- AC_SUBST([DEFS]) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([DEFS]) -m4trace:configure.in:1: -1- m4_pattern_allow([^DEFS$]) -m4trace:configure.in:1: -1- AC_SUBST([ECHO_C]) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([ECHO_C]) -m4trace:configure.in:1: -1- m4_pattern_allow([^ECHO_C$]) -m4trace:configure.in:1: -1- AC_SUBST([ECHO_N]) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([ECHO_N]) -m4trace:configure.in:1: -1- m4_pattern_allow([^ECHO_N$]) -m4trace:configure.in:1: -1- AC_SUBST([ECHO_T]) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([ECHO_T]) -m4trace:configure.in:1: -1- m4_pattern_allow([^ECHO_T$]) -m4trace:configure.in:1: -1- AC_SUBST([LIBS]) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([LIBS]) -m4trace:configure.in:1: -1- m4_pattern_allow([^LIBS$]) -m4trace:configure.in:1: -1- AC_SUBST([build_alias]) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([build_alias]) -m4trace:configure.in:1: -1- m4_pattern_allow([^build_alias$]) -m4trace:configure.in:1: -1- AC_SUBST([host_alias]) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([host_alias]) -m4trace:configure.in:1: -1- m4_pattern_allow([^host_alias$]) -m4trace:configure.in:1: -1- AC_SUBST([target_alias]) -m4trace:configure.in:1: -1- AC_SUBST_TRACE([target_alias]) -m4trace:configure.in:1: -1- m4_pattern_allow([^target_alias$]) -m4trace:configure.in:22: -1- AC_CANONICAL_HOST -m4trace:configure.in:22: -1- AC_CANONICAL_BUILD -m4trace:configure.in:22: -1- AC_REQUIRE_AUX_FILE([config.sub]) -m4trace:configure.in:22: -1- AC_REQUIRE_AUX_FILE([config.guess]) -m4trace:configure.in:22: -1- AC_SUBST([build], [$ac_cv_build]) -m4trace:configure.in:22: -1- AC_SUBST_TRACE([build]) -m4trace:configure.in:22: -1- m4_pattern_allow([^build$]) -m4trace:configure.in:22: -1- AC_SUBST([build_cpu], [$[1]]) -m4trace:configure.in:22: -1- AC_SUBST_TRACE([build_cpu]) -m4trace:configure.in:22: -1- m4_pattern_allow([^build_cpu$]) -m4trace:configure.in:22: -1- AC_SUBST([build_vendor], [$[2]]) -m4trace:configure.in:22: -1- AC_SUBST_TRACE([build_vendor]) -m4trace:configure.in:22: -1- m4_pattern_allow([^build_vendor$]) -m4trace:configure.in:22: -1- AC_SUBST([build_os]) -m4trace:configure.in:22: -1- AC_SUBST_TRACE([build_os]) -m4trace:configure.in:22: -1- m4_pattern_allow([^build_os$]) -m4trace:configure.in:22: -1- AC_SUBST([host], [$ac_cv_host]) -m4trace:configure.in:22: -1- AC_SUBST_TRACE([host]) -m4trace:configure.in:22: -1- m4_pattern_allow([^host$]) -m4trace:configure.in:22: -1- AC_SUBST([host_cpu], [$[1]]) -m4trace:configure.in:22: -1- AC_SUBST_TRACE([host_cpu]) -m4trace:configure.in:22: -1- m4_pattern_allow([^host_cpu$]) -m4trace:configure.in:22: -1- AC_SUBST([host_vendor], [$[2]]) -m4trace:configure.in:22: -1- AC_SUBST_TRACE([host_vendor]) -m4trace:configure.in:22: -1- m4_pattern_allow([^host_vendor$]) -m4trace:configure.in:22: -1- AC_SUBST([host_os]) -m4trace:configure.in:22: -1- AC_SUBST_TRACE([host_os]) -m4trace:configure.in:22: -1- m4_pattern_allow([^host_os$]) -m4trace:configure.in:23: -1- AC_CANONICAL_TARGET -m4trace:configure.in:23: -1- AC_SUBST([target], [$ac_cv_target]) -m4trace:configure.in:23: -1- AC_SUBST_TRACE([target]) -m4trace:configure.in:23: -1- m4_pattern_allow([^target$]) -m4trace:configure.in:23: -1- AC_SUBST([target_cpu], [$[1]]) -m4trace:configure.in:23: -1- AC_SUBST_TRACE([target_cpu]) -m4trace:configure.in:23: -1- m4_pattern_allow([^target_cpu$]) -m4trace:configure.in:23: -1- AC_SUBST([target_vendor], [$[2]]) -m4trace:configure.in:23: -1- AC_SUBST_TRACE([target_vendor]) -m4trace:configure.in:23: -1- m4_pattern_allow([^target_vendor$]) -m4trace:configure.in:23: -1- AC_SUBST([target_os]) -m4trace:configure.in:23: -1- AC_SUBST_TRACE([target_os]) -m4trace:configure.in:23: -1- m4_pattern_allow([^target_os$]) -m4trace:configure.in:34: -1- AC_SUBST([LT_VERSION]) -m4trace:configure.in:34: -1- AC_SUBST_TRACE([LT_VERSION]) -m4trace:configure.in:34: -1- m4_pattern_allow([^LT_VERSION$]) -m4trace:configure.in:36: -1- AH_OUTPUT([HAVE_NO_EXPLICIT_EXPORTS], [/* no explicit exports */ -#define LOG4CXX_EXPORT]) -m4trace:configure.in:40: -1- AM_INIT_AUTOMAKE([log4cxx], [0.10.0]) -m4trace:configure.in:40: -1- m4_pattern_allow([^AM_[A-Z]+FLAGS$]) -m4trace:configure.in:40: -1- AM_AUTOMAKE_VERSION([1.9.6]) -m4trace:configure.in:40: -1- AC_REQUIRE_AUX_FILE([install-sh]) -m4trace:configure.in:40: -1- AC_SUBST([INSTALL_PROGRAM]) -m4trace:configure.in:40: -1- AC_SUBST_TRACE([INSTALL_PROGRAM]) -m4trace:configure.in:40: -1- m4_pattern_allow([^INSTALL_PROGRAM$]) -m4trace:configure.in:40: -1- AC_SUBST([INSTALL_SCRIPT]) -m4trace:configure.in:40: -1- AC_SUBST_TRACE([INSTALL_SCRIPT]) -m4trace:configure.in:40: -1- m4_pattern_allow([^INSTALL_SCRIPT$]) -m4trace:configure.in:40: -1- AC_SUBST([INSTALL_DATA]) -m4trace:configure.in:40: -1- AC_SUBST_TRACE([INSTALL_DATA]) -m4trace:configure.in:40: -1- m4_pattern_allow([^INSTALL_DATA$]) -m4trace:configure.in:40: -1- AC_SUBST([CYGPATH_W]) -m4trace:configure.in:40: -1- AC_SUBST_TRACE([CYGPATH_W]) -m4trace:configure.in:40: -1- m4_pattern_allow([^CYGPATH_W$]) -m4trace:configure.in:40: -1- AC_SUBST([PACKAGE], [log4cxx]) -m4trace:configure.in:40: -1- AC_SUBST_TRACE([PACKAGE]) -m4trace:configure.in:40: -1- m4_pattern_allow([^PACKAGE$]) -m4trace:configure.in:40: -1- AC_SUBST([VERSION], [0.10.0]) -m4trace:configure.in:40: -1- AC_SUBST_TRACE([VERSION]) -m4trace:configure.in:40: -1- m4_pattern_allow([^VERSION$]) -m4trace:configure.in:40: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE]) -m4trace:configure.in:40: -1- m4_pattern_allow([^PACKAGE$]) -m4trace:configure.in:40: -1- AH_OUTPUT([PACKAGE], [/* Name of package */ -@%:@undef PACKAGE]) -m4trace:configure.in:40: -1- AC_DEFINE_TRACE_LITERAL([VERSION]) -m4trace:configure.in:40: -1- m4_pattern_allow([^VERSION$]) -m4trace:configure.in:40: -1- AH_OUTPUT([VERSION], [/* Version number of package */ -@%:@undef VERSION]) -m4trace:configure.in:40: -1- AC_SUBST([ACLOCAL]) -m4trace:configure.in:40: -1- AC_SUBST_TRACE([ACLOCAL]) -m4trace:configure.in:40: -1- m4_pattern_allow([^ACLOCAL$]) -m4trace:configure.in:40: -1- AC_SUBST([AUTOCONF]) -m4trace:configure.in:40: -1- AC_SUBST_TRACE([AUTOCONF]) -m4trace:configure.in:40: -1- m4_pattern_allow([^AUTOCONF$]) -m4trace:configure.in:40: -1- AC_SUBST([AUTOMAKE]) -m4trace:configure.in:40: -1- AC_SUBST_TRACE([AUTOMAKE]) -m4trace:configure.in:40: -1- m4_pattern_allow([^AUTOMAKE$]) -m4trace:configure.in:40: -1- AC_SUBST([AUTOHEADER]) -m4trace:configure.in:40: -1- AC_SUBST_TRACE([AUTOHEADER]) -m4trace:configure.in:40: -1- m4_pattern_allow([^AUTOHEADER$]) -m4trace:configure.in:40: -1- AC_SUBST([MAKEINFO]) -m4trace:configure.in:40: -1- AC_SUBST_TRACE([MAKEINFO]) -m4trace:configure.in:40: -1- m4_pattern_allow([^MAKEINFO$]) -m4trace:configure.in:40: -1- AC_SUBST([install_sh]) -m4trace:configure.in:40: -1- AC_SUBST_TRACE([install_sh]) -m4trace:configure.in:40: -1- m4_pattern_allow([^install_sh$]) -m4trace:configure.in:40: -1- AC_SUBST([STRIP]) -m4trace:configure.in:40: -1- AC_SUBST_TRACE([STRIP]) -m4trace:configure.in:40: -1- m4_pattern_allow([^STRIP$]) -m4trace:configure.in:40: -1- AC_SUBST([INSTALL_STRIP_PROGRAM]) -m4trace:configure.in:40: -1- AC_SUBST_TRACE([INSTALL_STRIP_PROGRAM]) -m4trace:configure.in:40: -1- m4_pattern_allow([^INSTALL_STRIP_PROGRAM$]) -m4trace:configure.in:40: -1- AC_SUBST([mkdir_p]) -m4trace:configure.in:40: -1- AC_SUBST_TRACE([mkdir_p]) -m4trace:configure.in:40: -1- m4_pattern_allow([^mkdir_p$]) -m4trace:configure.in:40: -1- AC_SUBST([AWK]) -m4trace:configure.in:40: -1- AC_SUBST_TRACE([AWK]) -m4trace:configure.in:40: -1- m4_pattern_allow([^AWK$]) -m4trace:configure.in:40: -1- AC_SUBST([SET_MAKE]) -m4trace:configure.in:40: -1- AC_SUBST_TRACE([SET_MAKE]) -m4trace:configure.in:40: -1- m4_pattern_allow([^SET_MAKE$]) -m4trace:configure.in:40: -1- AC_SUBST([am__leading_dot]) -m4trace:configure.in:40: -1- AC_SUBST_TRACE([am__leading_dot]) -m4trace:configure.in:40: -1- m4_pattern_allow([^am__leading_dot$]) -m4trace:configure.in:40: -1- AC_SUBST([AMTAR]) -m4trace:configure.in:40: -1- AC_SUBST_TRACE([AMTAR]) -m4trace:configure.in:40: -1- m4_pattern_allow([^AMTAR$]) -m4trace:configure.in:40: -1- AC_SUBST([am__tar]) -m4trace:configure.in:40: -1- AC_SUBST_TRACE([am__tar]) -m4trace:configure.in:40: -1- m4_pattern_allow([^am__tar$]) -m4trace:configure.in:40: -1- AC_SUBST([am__untar]) -m4trace:configure.in:40: -1- AC_SUBST_TRACE([am__untar]) -m4trace:configure.in:40: -1- m4_pattern_allow([^am__untar$]) -m4trace:configure.in:45: -1- AC_PROG_LIBTOOL -m4trace:configure.in:45: -1- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. -You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... -../../lib/autoconf/general.m4:1462: AC_ARG_ENABLE is expanded from... -aclocal.m4:1927: AC_ENABLE_SHARED is expanded from... -aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... -aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... -aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... -aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... -configure.in:45: the top level]) -m4trace:configure.in:45: -1- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. -You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... -../../lib/autoconf/general.m4:1462: AC_ARG_ENABLE is expanded from... -aclocal.m4:1966: AC_ENABLE_STATIC is expanded from... -aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... -aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... -aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... -aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... -configure.in:45: the top level]) -m4trace:configure.in:45: -1- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. -You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... -../../lib/autoconf/general.m4:1462: AC_ARG_ENABLE is expanded from... -aclocal.m4:2005: AC_ENABLE_FAST_INSTALL is expanded from... -aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... -aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... -aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... -aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... -configure.in:45: the top level]) -m4trace:configure.in:45: -1- AC_SUBST([CC]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([CC]) -m4trace:configure.in:45: -1- m4_pattern_allow([^CC$]) -m4trace:configure.in:45: -1- AC_SUBST([CFLAGS]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([CFLAGS]) -m4trace:configure.in:45: -1- m4_pattern_allow([^CFLAGS$]) -m4trace:configure.in:45: -1- AC_SUBST([LDFLAGS]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([LDFLAGS]) -m4trace:configure.in:45: -1- m4_pattern_allow([^LDFLAGS$]) -m4trace:configure.in:45: -1- AC_SUBST([LIBS]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([LIBS]) -m4trace:configure.in:45: -1- m4_pattern_allow([^LIBS$]) -m4trace:configure.in:45: -1- AC_SUBST([CPPFLAGS]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([CPPFLAGS]) -m4trace:configure.in:45: -1- m4_pattern_allow([^CPPFLAGS$]) -m4trace:configure.in:45: -1- AC_SUBST([CC]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([CC]) -m4trace:configure.in:45: -1- m4_pattern_allow([^CC$]) -m4trace:configure.in:45: -1- AC_SUBST([CC]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([CC]) -m4trace:configure.in:45: -1- m4_pattern_allow([^CC$]) -m4trace:configure.in:45: -1- AC_SUBST([CC]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([CC]) -m4trace:configure.in:45: -1- m4_pattern_allow([^CC$]) -m4trace:configure.in:45: -1- AC_SUBST([CC]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([CC]) -m4trace:configure.in:45: -1- m4_pattern_allow([^CC$]) -m4trace:configure.in:45: -1- AC_SUBST([ac_ct_CC]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([ac_ct_CC]) -m4trace:configure.in:45: -1- m4_pattern_allow([^ac_ct_CC$]) -m4trace:configure.in:45: -1- AC_SUBST([EXEEXT], [$ac_cv_exeext]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([EXEEXT]) -m4trace:configure.in:45: -1- m4_pattern_allow([^EXEEXT$]) -m4trace:configure.in:45: -1- AC_SUBST([OBJEXT], [$ac_cv_objext]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([OBJEXT]) -m4trace:configure.in:45: -1- m4_pattern_allow([^OBJEXT$]) -m4trace:configure.in:45: -1- AC_SUBST([DEPDIR], ["${am__leading_dot}deps"]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([DEPDIR]) -m4trace:configure.in:45: -1- m4_pattern_allow([^DEPDIR$]) -m4trace:configure.in:45: -1- AC_SUBST([am__include]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([am__include]) -m4trace:configure.in:45: -1- m4_pattern_allow([^am__include$]) -m4trace:configure.in:45: -1- AC_SUBST([am__quote]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([am__quote]) -m4trace:configure.in:45: -1- m4_pattern_allow([^am__quote$]) -m4trace:configure.in:45: -1- AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -m4trace:configure.in:45: -1- AC_SUBST([AMDEP_TRUE]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([AMDEP_TRUE]) -m4trace:configure.in:45: -1- m4_pattern_allow([^AMDEP_TRUE$]) -m4trace:configure.in:45: -1- AC_SUBST([AMDEP_FALSE]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([AMDEP_FALSE]) -m4trace:configure.in:45: -1- m4_pattern_allow([^AMDEP_FALSE$]) -m4trace:configure.in:45: -1- AC_SUBST([AMDEPBACKSLASH]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([AMDEPBACKSLASH]) -m4trace:configure.in:45: -1- m4_pattern_allow([^AMDEPBACKSLASH$]) -m4trace:configure.in:45: -1- AC_SUBST([CCDEPMODE], [depmode=$am_cv_CC_dependencies_compiler_type]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([CCDEPMODE]) -m4trace:configure.in:45: -1- m4_pattern_allow([^CCDEPMODE$]) -m4trace:configure.in:45: -1- AM_CONDITIONAL([am__fastdepCC], [ - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3]) -m4trace:configure.in:45: -1- AC_SUBST([am__fastdepCC_TRUE]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([am__fastdepCC_TRUE]) -m4trace:configure.in:45: -1- m4_pattern_allow([^am__fastdepCC_TRUE$]) -m4trace:configure.in:45: -1- AC_SUBST([am__fastdepCC_FALSE]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([am__fastdepCC_FALSE]) -m4trace:configure.in:45: -1- m4_pattern_allow([^am__fastdepCC_FALSE$]) -m4trace:configure.in:45: -1- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. -You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... -../../lib/autoconf/general.m4:1481: AC_ARG_WITH is expanded from... -aclocal.m4:2146: AC_PROG_LD is expanded from... -aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... -aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... -aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... -aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... -configure.in:45: the top level]) -m4trace:configure.in:45: -1- AC_SUBST([GREP]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([GREP]) -m4trace:configure.in:45: -1- m4_pattern_allow([^GREP$]) -m4trace:configure.in:45: -1- AC_SUBST([EGREP]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([EGREP]) -m4trace:configure.in:45: -1- m4_pattern_allow([^EGREP$]) -m4trace:configure.in:45: -1- AC_SUBST([LN_S], [$as_ln_s]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([LN_S]) -m4trace:configure.in:45: -1- m4_pattern_allow([^LN_S$]) -m4trace:configure.in:45: -1- AC_SUBST([ECHO]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([ECHO]) -m4trace:configure.in:45: -1- m4_pattern_allow([^ECHO$]) -m4trace:configure.in:45: -1- AC_SUBST([AR]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([AR]) -m4trace:configure.in:45: -1- m4_pattern_allow([^AR$]) -m4trace:configure.in:45: -1- AC_SUBST([RANLIB]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([RANLIB]) -m4trace:configure.in:45: -1- m4_pattern_allow([^RANLIB$]) -m4trace:configure.in:45: -1- AC_SUBST([STRIP]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([STRIP]) -m4trace:configure.in:45: -1- m4_pattern_allow([^STRIP$]) -m4trace:configure.in:45: -1- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. -You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... -../../lib/autoconf/general.m4:1462: AC_ARG_ENABLE is expanded from... -aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... -aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... -aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... -aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... -configure.in:45: the top level]) -m4trace:configure.in:45: -1- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. -You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... -../../lib/autoconf/general.m4:1481: AC_ARG_WITH is expanded from... -aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... -aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... -aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... -aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... -configure.in:45: the top level]) -m4trace:configure.in:45: -1- _m4_warn([syntax], [AC_CACHE_VAL(lt_prog_compiler_pic_works, ...): suspicious cache-id, must contain _cv_ to be cached], [../../lib/autoconf/general.m4:2031: AC_CACHE_VAL is expanded from... -../../lib/autoconf/general.m4:2052: AC_CACHE_CHECK is expanded from... -aclocal.m4:621: AC_LIBTOOL_COMPILER_OPTION is expanded from... -aclocal.m4:4821: AC_LIBTOOL_PROG_COMPILER_PIC is expanded from... -aclocal.m4:2669: _LT_AC_LANG_C_CONFIG is expanded from... -aclocal.m4:2668: AC_LIBTOOL_LANG_C_CONFIG is expanded from... -aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... -aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... -aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... -aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... -configure.in:45: the top level]) -m4trace:configure.in:45: -1- _m4_warn([syntax], [AC_CACHE_VAL(lt_prog_compiler_static_works, ...): suspicious cache-id, must contain _cv_ to be cached], [../../lib/autoconf/general.m4:2031: AC_CACHE_VAL is expanded from... -../../lib/autoconf/general.m4:2052: AC_CACHE_CHECK is expanded from... -aclocal.m4:666: AC_LIBTOOL_LINKER_OPTION is expanded from... -aclocal.m4:4821: AC_LIBTOOL_PROG_COMPILER_PIC is expanded from... -aclocal.m4:2669: _LT_AC_LANG_C_CONFIG is expanded from... -aclocal.m4:2668: AC_LIBTOOL_LANG_C_CONFIG is expanded from... -aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... -aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... -aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... -aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... -configure.in:45: the top level]) -m4trace:configure.in:45: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. -You should run autoupdate.], [../../lib/autoconf/general.m4:2687: AC_TRY_LINK is expanded from... -../../lib/m4sugar/m4sh.m4:639: AS_IF is expanded from... -../../lib/autoconf/general.m4:2031: AC_CACHE_VAL is expanded from... -../../lib/autoconf/general.m4:2052: AC_CACHE_CHECK is expanded from... -aclocal.m4:475: _LT_AC_LOCK is expanded from... -aclocal.m4:1079: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from... -aclocal.m4:2669: _LT_AC_LANG_C_CONFIG is expanded from... -aclocal.m4:2668: AC_LIBTOOL_LANG_C_CONFIG is expanded from... -aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... -aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... -aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... -aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... -configure.in:45: the top level]) -m4trace:configure.in:45: -1- _m4_warn([syntax], [AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body], [../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from... -../../lib/autoconf/general.m4:2661: _AC_LINK_IFELSE is expanded from... -../../lib/autoconf/general.m4:2678: AC_LINK_IFELSE is expanded from... -aclocal.m4:295: _LT_AC_SYS_LIBPATH_AIX is expanded from... -aclocal.m4:5348: AC_LIBTOOL_PROG_LD_SHLIBS is expanded from... -aclocal.m4:2669: _LT_AC_LANG_C_CONFIG is expanded from... -aclocal.m4:2668: AC_LIBTOOL_LANG_C_CONFIG is expanded from... -aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... -aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... -aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... -aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... -configure.in:45: the top level]) -m4trace:configure.in:45: -1- _m4_warn([syntax], [AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body], [../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from... -../../lib/autoconf/general.m4:2661: _AC_LINK_IFELSE is expanded from... -../../lib/autoconf/general.m4:2678: AC_LINK_IFELSE is expanded from... -aclocal.m4:295: _LT_AC_SYS_LIBPATH_AIX is expanded from... -aclocal.m4:5348: AC_LIBTOOL_PROG_LD_SHLIBS is expanded from... -aclocal.m4:2669: _LT_AC_LANG_C_CONFIG is expanded from... -aclocal.m4:2668: AC_LIBTOOL_LANG_C_CONFIG is expanded from... -aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... -aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... -aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... -aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... -configure.in:45: the top level]) -m4trace:configure.in:45: -1- AH_OUTPUT([HAVE_DLFCN_H], [/* Define to 1 if you have the <dlfcn.h> header file. */ -@%:@undef HAVE_DLFCN_H]) -m4trace:configure.in:45: -1- AC_SUBST([CPP]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([CPP]) -m4trace:configure.in:45: -1- m4_pattern_allow([^CPP$]) -m4trace:configure.in:45: -1- AC_SUBST([CPPFLAGS]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([CPPFLAGS]) -m4trace:configure.in:45: -1- m4_pattern_allow([^CPPFLAGS$]) -m4trace:configure.in:45: -1- AC_SUBST([CPP]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([CPP]) -m4trace:configure.in:45: -1- m4_pattern_allow([^CPP$]) -m4trace:configure.in:45: -1- AC_DEFINE_TRACE_LITERAL([STDC_HEADERS]) -m4trace:configure.in:45: -1- m4_pattern_allow([^STDC_HEADERS$]) -m4trace:configure.in:45: -1- AH_OUTPUT([STDC_HEADERS], [/* Define to 1 if you have the ANSI C header files. */ -@%:@undef STDC_HEADERS]) -m4trace:configure.in:45: -1- AH_OUTPUT([HAVE_SYS_TYPES_H], [/* Define to 1 if you have the <sys/types.h> header file. */ -@%:@undef HAVE_SYS_TYPES_H]) -m4trace:configure.in:45: -1- AH_OUTPUT([HAVE_SYS_STAT_H], [/* Define to 1 if you have the <sys/stat.h> header file. */ -@%:@undef HAVE_SYS_STAT_H]) -m4trace:configure.in:45: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the <stdlib.h> header file. */ -@%:@undef HAVE_STDLIB_H]) -m4trace:configure.in:45: -1- AH_OUTPUT([HAVE_STRING_H], [/* Define to 1 if you have the <string.h> header file. */ -@%:@undef HAVE_STRING_H]) -m4trace:configure.in:45: -1- AH_OUTPUT([HAVE_MEMORY_H], [/* Define to 1 if you have the <memory.h> header file. */ -@%:@undef HAVE_MEMORY_H]) -m4trace:configure.in:45: -1- AH_OUTPUT([HAVE_STRINGS_H], [/* Define to 1 if you have the <strings.h> header file. */ -@%:@undef HAVE_STRINGS_H]) -m4trace:configure.in:45: -1- AH_OUTPUT([HAVE_INTTYPES_H], [/* Define to 1 if you have the <inttypes.h> header file. */ -@%:@undef HAVE_INTTYPES_H]) -m4trace:configure.in:45: -1- AH_OUTPUT([HAVE_STDINT_H], [/* Define to 1 if you have the <stdint.h> header file. */ -@%:@undef HAVE_STDINT_H]) -m4trace:configure.in:45: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the <unistd.h> header file. */ -@%:@undef HAVE_UNISTD_H]) -m4trace:configure.in:45: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DLFCN_H]) -m4trace:configure.in:45: -1- m4_pattern_allow([^HAVE_DLFCN_H$]) -m4trace:configure.in:45: -1- _LT_AC_TAGCONFIG -m4trace:configure.in:45: -1- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. -You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... -../../lib/autoconf/general.m4:1481: AC_ARG_WITH is expanded from... -aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... -aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... -aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... -aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... -aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... -configure.in:45: the top level]) -m4trace:configure.in:45: -1- _m4_warn([obsolete], [back quotes and double quotes must not be escaped in: tag name \"$tagname\" already exists], [aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... -aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... -aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... -aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... -aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... -configure.in:45: the top level]) -m4trace:configure.in:45: -1- AC_SUBST([CXX]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([CXX]) -m4trace:configure.in:45: -1- m4_pattern_allow([^CXX$]) -m4trace:configure.in:45: -1- AC_SUBST([CXXFLAGS]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([CXXFLAGS]) -m4trace:configure.in:45: -1- m4_pattern_allow([^CXXFLAGS$]) -m4trace:configure.in:45: -1- AC_SUBST([LDFLAGS]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([LDFLAGS]) -m4trace:configure.in:45: -1- m4_pattern_allow([^LDFLAGS$]) -m4trace:configure.in:45: -1- AC_SUBST([LIBS]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([LIBS]) -m4trace:configure.in:45: -1- m4_pattern_allow([^LIBS$]) -m4trace:configure.in:45: -1- AC_SUBST([CPPFLAGS]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([CPPFLAGS]) -m4trace:configure.in:45: -1- m4_pattern_allow([^CPPFLAGS$]) -m4trace:configure.in:45: -1- AC_SUBST([CXX]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([CXX]) -m4trace:configure.in:45: -1- m4_pattern_allow([^CXX$]) -m4trace:configure.in:45: -1- AC_SUBST([ac_ct_CXX]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([ac_ct_CXX]) -m4trace:configure.in:45: -1- m4_pattern_allow([^ac_ct_CXX$]) -m4trace:configure.in:45: -1- AC_SUBST([CXXDEPMODE], [depmode=$am_cv_CXX_dependencies_compiler_type]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([CXXDEPMODE]) -m4trace:configure.in:45: -1- m4_pattern_allow([^CXXDEPMODE$]) -m4trace:configure.in:45: -1- AM_CONDITIONAL([am__fastdepCXX], [ - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CXX_dependencies_compiler_type" = gcc3]) -m4trace:configure.in:45: -1- AC_SUBST([am__fastdepCXX_TRUE]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([am__fastdepCXX_TRUE]) -m4trace:configure.in:45: -1- m4_pattern_allow([^am__fastdepCXX_TRUE$]) -m4trace:configure.in:45: -1- AC_SUBST([am__fastdepCXX_FALSE]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([am__fastdepCXX_FALSE]) -m4trace:configure.in:45: -1- m4_pattern_allow([^am__fastdepCXX_FALSE$]) -m4trace:configure.in:45: -1- AC_SUBST([CXXCPP]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([CXXCPP]) -m4trace:configure.in:45: -1- m4_pattern_allow([^CXXCPP$]) -m4trace:configure.in:45: -1- AC_SUBST([CPPFLAGS]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([CPPFLAGS]) -m4trace:configure.in:45: -1- m4_pattern_allow([^CPPFLAGS$]) -m4trace:configure.in:45: -1- AC_SUBST([CXXCPP]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([CXXCPP]) -m4trace:configure.in:45: -1- m4_pattern_allow([^CXXCPP$]) -m4trace:configure.in:45: -1- _m4_warn([syntax], [AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body], [../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from... -../../lib/autoconf/general.m4:2661: _AC_LINK_IFELSE is expanded from... -../../lib/autoconf/general.m4:2678: AC_LINK_IFELSE is expanded from... -aclocal.m4:295: _LT_AC_SYS_LIBPATH_AIX is expanded from... -aclocal.m4:2746: _LT_AC_LANG_CXX_CONFIG is expanded from... -aclocal.m4:2745: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from... -aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... -aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... -aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... -aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... -aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... -configure.in:45: the top level]) -m4trace:configure.in:45: -1- _m4_warn([syntax], [AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body], [../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from... -../../lib/autoconf/general.m4:2661: _AC_LINK_IFELSE is expanded from... -../../lib/autoconf/general.m4:2678: AC_LINK_IFELSE is expanded from... -aclocal.m4:295: _LT_AC_SYS_LIBPATH_AIX is expanded from... -aclocal.m4:2746: _LT_AC_LANG_CXX_CONFIG is expanded from... -aclocal.m4:2745: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from... -aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... -aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... -aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... -aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... -aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... -configure.in:45: the top level]) -m4trace:configure.in:45: -1- _m4_warn([syntax], [AC_CACHE_VAL(lt_prog_compiler_pic_works_CXX, ...): suspicious cache-id, must contain _cv_ to be cached], [../../lib/autoconf/general.m4:2031: AC_CACHE_VAL is expanded from... -../../lib/autoconf/general.m4:2052: AC_CACHE_CHECK is expanded from... -aclocal.m4:621: AC_LIBTOOL_COMPILER_OPTION is expanded from... -aclocal.m4:4821: AC_LIBTOOL_PROG_COMPILER_PIC is expanded from... -aclocal.m4:2746: _LT_AC_LANG_CXX_CONFIG is expanded from... -aclocal.m4:2745: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from... -aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... -aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... -aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... -aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... -aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... -configure.in:45: the top level]) -m4trace:configure.in:45: -1- _m4_warn([syntax], [AC_CACHE_VAL(lt_prog_compiler_static_works_CXX, ...): suspicious cache-id, must contain _cv_ to be cached], [../../lib/autoconf/general.m4:2031: AC_CACHE_VAL is expanded from... -../../lib/autoconf/general.m4:2052: AC_CACHE_CHECK is expanded from... -aclocal.m4:666: AC_LIBTOOL_LINKER_OPTION is expanded from... -aclocal.m4:4821: AC_LIBTOOL_PROG_COMPILER_PIC is expanded from... -aclocal.m4:2746: _LT_AC_LANG_CXX_CONFIG is expanded from... -aclocal.m4:2745: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from... -aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... -aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... -aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... -aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... -aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... -configure.in:45: the top level]) -m4trace:configure.in:45: -1- AC_SUBST([F77]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([F77]) -m4trace:configure.in:45: -1- m4_pattern_allow([^F77$]) -m4trace:configure.in:45: -1- AC_SUBST([FFLAGS]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([FFLAGS]) -m4trace:configure.in:45: -1- m4_pattern_allow([^FFLAGS$]) -m4trace:configure.in:45: -1- AC_SUBST([LDFLAGS]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([LDFLAGS]) -m4trace:configure.in:45: -1- m4_pattern_allow([^LDFLAGS$]) -m4trace:configure.in:45: -1- AC_SUBST([LIBS]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([LIBS]) -m4trace:configure.in:45: -1- m4_pattern_allow([^LIBS$]) -m4trace:configure.in:45: -1- AC_SUBST([F77]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([F77]) -m4trace:configure.in:45: -1- m4_pattern_allow([^F77$]) -m4trace:configure.in:45: -1- AC_SUBST([ac_ct_F77]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([ac_ct_F77]) -m4trace:configure.in:45: -1- m4_pattern_allow([^ac_ct_F77$]) -m4trace:configure.in:45: -1- _m4_warn([syntax], [AC_CACHE_VAL(lt_prog_compiler_pic_works_F77, ...): suspicious cache-id, must contain _cv_ to be cached], [../../lib/autoconf/general.m4:2031: AC_CACHE_VAL is expanded from... -../../lib/autoconf/general.m4:2052: AC_CACHE_CHECK is expanded from... -aclocal.m4:621: AC_LIBTOOL_COMPILER_OPTION is expanded from... -aclocal.m4:4821: AC_LIBTOOL_PROG_COMPILER_PIC is expanded from... -aclocal.m4:3909: _LT_AC_LANG_F77_CONFIG is expanded from... -aclocal.m4:3908: AC_LIBTOOL_LANG_F77_CONFIG is expanded from... -aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... -aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... -aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... -aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... -aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... -configure.in:45: the top level]) -m4trace:configure.in:45: -1- _m4_warn([syntax], [AC_CACHE_VAL(lt_prog_compiler_static_works_F77, ...): suspicious cache-id, must contain _cv_ to be cached], [../../lib/autoconf/general.m4:2031: AC_CACHE_VAL is expanded from... -../../lib/autoconf/general.m4:2052: AC_CACHE_CHECK is expanded from... -aclocal.m4:666: AC_LIBTOOL_LINKER_OPTION is expanded from... -aclocal.m4:4821: AC_LIBTOOL_PROG_COMPILER_PIC is expanded from... -aclocal.m4:3909: _LT_AC_LANG_F77_CONFIG is expanded from... -aclocal.m4:3908: AC_LIBTOOL_LANG_F77_CONFIG is expanded from... -aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... -aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... -aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... -aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... -aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... -configure.in:45: the top level]) -m4trace:configure.in:45: -1- _m4_warn([obsolete], [The macro `AC_LANG_SAVE' is obsolete. -You should run autoupdate.], [../../lib/autoconf/lang.m4:125: AC_LANG_SAVE is expanded from... -aclocal.m4:4011: _LT_AC_LANG_GCJ_CONFIG is expanded from... -aclocal.m4:4010: AC_LIBTOOL_LANG_GCJ_CONFIG is expanded from... -aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... -aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... -aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... -aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... -aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... -configure.in:45: the top level]) -m4trace:configure.in:45: -1- _m4_warn([syntax], [AC_CACHE_VAL(lt_prog_compiler_pic_works_GCJ, ...): suspicious cache-id, must contain _cv_ to be cached], [../../lib/autoconf/general.m4:2031: AC_CACHE_VAL is expanded from... -../../lib/autoconf/general.m4:2052: AC_CACHE_CHECK is expanded from... -aclocal.m4:621: AC_LIBTOOL_COMPILER_OPTION is expanded from... -aclocal.m4:4821: AC_LIBTOOL_PROG_COMPILER_PIC is expanded from... -aclocal.m4:4011: _LT_AC_LANG_GCJ_CONFIG is expanded from... -aclocal.m4:4010: AC_LIBTOOL_LANG_GCJ_CONFIG is expanded from... -aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... -aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... -aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... -aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... -aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... -configure.in:45: the top level]) -m4trace:configure.in:45: -1- _m4_warn([syntax], [AC_CACHE_VAL(lt_prog_compiler_static_works_GCJ, ...): suspicious cache-id, must contain _cv_ to be cached], [../../lib/autoconf/general.m4:2031: AC_CACHE_VAL is expanded from... -../../lib/autoconf/general.m4:2052: AC_CACHE_CHECK is expanded from... -aclocal.m4:666: AC_LIBTOOL_LINKER_OPTION is expanded from... -aclocal.m4:4821: AC_LIBTOOL_PROG_COMPILER_PIC is expanded from... -aclocal.m4:4011: _LT_AC_LANG_GCJ_CONFIG is expanded from... -aclocal.m4:4010: AC_LIBTOOL_LANG_GCJ_CONFIG is expanded from... -aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... -aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... -aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... -aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... -aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... -configure.in:45: the top level]) -m4trace:configure.in:45: -1- _m4_warn([syntax], [AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body], [../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from... -../../lib/autoconf/general.m4:2661: _AC_LINK_IFELSE is expanded from... -../../lib/autoconf/general.m4:2678: AC_LINK_IFELSE is expanded from... -aclocal.m4:295: _LT_AC_SYS_LIBPATH_AIX is expanded from... -aclocal.m4:5348: AC_LIBTOOL_PROG_LD_SHLIBS is expanded from... -aclocal.m4:4011: _LT_AC_LANG_GCJ_CONFIG is expanded from... -aclocal.m4:4010: AC_LIBTOOL_LANG_GCJ_CONFIG is expanded from... -aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... -aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... -aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... -aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... -aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... -configure.in:45: the top level]) -m4trace:configure.in:45: -1- _m4_warn([syntax], [AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body], [../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from... -../../lib/autoconf/general.m4:2661: _AC_LINK_IFELSE is expanded from... -../../lib/autoconf/general.m4:2678: AC_LINK_IFELSE is expanded from... -aclocal.m4:295: _LT_AC_SYS_LIBPATH_AIX is expanded from... -aclocal.m4:5348: AC_LIBTOOL_PROG_LD_SHLIBS is expanded from... -aclocal.m4:4011: _LT_AC_LANG_GCJ_CONFIG is expanded from... -aclocal.m4:4010: AC_LIBTOOL_LANG_GCJ_CONFIG is expanded from... -aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... -aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... -aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... -aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... -aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... -configure.in:45: the top level]) -m4trace:configure.in:45: -1- _m4_warn([obsolete], [The macro `AC_LANG_RESTORE' is obsolete. -You should run autoupdate.], [../../lib/autoconf/lang.m4:134: AC_LANG_RESTORE is expanded from... -aclocal.m4:4011: _LT_AC_LANG_GCJ_CONFIG is expanded from... -aclocal.m4:4010: AC_LIBTOOL_LANG_GCJ_CONFIG is expanded from... -aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... -aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... -aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... -aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... -aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... -configure.in:45: the top level]) -m4trace:configure.in:45: -1- _m4_warn([obsolete], [The macro `AC_LANG_SAVE' is obsolete. -You should run autoupdate.], [../../lib/autoconf/lang.m4:125: AC_LANG_SAVE is expanded from... -aclocal.m4:4067: _LT_AC_LANG_RC_CONFIG is expanded from... -aclocal.m4:4066: AC_LIBTOOL_LANG_RC_CONFIG is expanded from... -aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... -aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... -aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... -aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... -aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... -configure.in:45: the top level]) -m4trace:configure.in:45: -1- _m4_warn([obsolete], [The macro `AC_LANG_RESTORE' is obsolete. -You should run autoupdate.], [../../lib/autoconf/lang.m4:134: AC_LANG_RESTORE is expanded from... -aclocal.m4:4067: _LT_AC_LANG_RC_CONFIG is expanded from... -aclocal.m4:4066: AC_LIBTOOL_LANG_RC_CONFIG is expanded from... -aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... -aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... -aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... -aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... -aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... -configure.in:45: the top level]) -m4trace:configure.in:45: -1- AC_SUBST([LIBTOOL]) -m4trace:configure.in:45: -1- AC_SUBST_TRACE([LIBTOOL]) -m4trace:configure.in:45: -1- m4_pattern_allow([^LIBTOOL$]) -m4trace:configure.in:47: -1- AC_SUBST([SET_MAKE]) -m4trace:configure.in:47: -1- AC_SUBST_TRACE([SET_MAKE]) -m4trace:configure.in:47: -1- m4_pattern_allow([^SET_MAKE$]) -m4trace:configure.in:49: -1- AC_SUBST([CXX]) -m4trace:configure.in:49: -1- AC_SUBST_TRACE([CXX]) -m4trace:configure.in:49: -1- m4_pattern_allow([^CXX$]) -m4trace:configure.in:49: -1- AC_SUBST([CXXFLAGS]) -m4trace:configure.in:49: -1- AC_SUBST_TRACE([CXXFLAGS]) -m4trace:configure.in:49: -1- m4_pattern_allow([^CXXFLAGS$]) -m4trace:configure.in:49: -1- AC_SUBST([LDFLAGS]) -m4trace:configure.in:49: -1- AC_SUBST_TRACE([LDFLAGS]) -m4trace:configure.in:49: -1- m4_pattern_allow([^LDFLAGS$]) -m4trace:configure.in:49: -1- AC_SUBST([LIBS]) -m4trace:configure.in:49: -1- AC_SUBST_TRACE([LIBS]) -m4trace:configure.in:49: -1- m4_pattern_allow([^LIBS$]) -m4trace:configure.in:49: -1- AC_SUBST([CPPFLAGS]) -m4trace:configure.in:49: -1- AC_SUBST_TRACE([CPPFLAGS]) -m4trace:configure.in:49: -1- m4_pattern_allow([^CPPFLAGS$]) -m4trace:configure.in:49: -1- AC_SUBST([CXX]) -m4trace:configure.in:49: -1- AC_SUBST_TRACE([CXX]) -m4trace:configure.in:49: -1- m4_pattern_allow([^CXX$]) -m4trace:configure.in:49: -1- AC_SUBST([ac_ct_CXX]) -m4trace:configure.in:49: -1- AC_SUBST_TRACE([ac_ct_CXX]) -m4trace:configure.in:49: -1- m4_pattern_allow([^ac_ct_CXX$]) -m4trace:configure.in:49: -1- AC_SUBST([CXXDEPMODE], [depmode=$am_cv_CXX_dependencies_compiler_type]) -m4trace:configure.in:49: -1- AC_SUBST_TRACE([CXXDEPMODE]) -m4trace:configure.in:49: -1- m4_pattern_allow([^CXXDEPMODE$]) -m4trace:configure.in:49: -1- AM_CONDITIONAL([am__fastdepCXX], [ - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CXX_dependencies_compiler_type" = gcc3]) -m4trace:configure.in:49: -1- AC_SUBST([am__fastdepCXX_TRUE]) -m4trace:configure.in:49: -1- AC_SUBST_TRACE([am__fastdepCXX_TRUE]) -m4trace:configure.in:49: -1- m4_pattern_allow([^am__fastdepCXX_TRUE$]) -m4trace:configure.in:49: -1- AC_SUBST([am__fastdepCXX_FALSE]) -m4trace:configure.in:49: -1- AC_SUBST_TRACE([am__fastdepCXX_FALSE]) -m4trace:configure.in:49: -1- m4_pattern_allow([^am__fastdepCXX_FALSE$]) -m4trace:configure.in:51: -1- AC_SUBST([CXXCPP]) -m4trace:configure.in:51: -1- AC_SUBST_TRACE([CXXCPP]) -m4trace:configure.in:51: -1- m4_pattern_allow([^CXXCPP$]) -m4trace:configure.in:51: -1- AC_SUBST([CPPFLAGS]) -m4trace:configure.in:51: -1- AC_SUBST_TRACE([CPPFLAGS]) -m4trace:configure.in:51: -1- m4_pattern_allow([^CPPFLAGS$]) -m4trace:configure.in:51: -1- AC_SUBST([CXXCPP]) -m4trace:configure.in:51: -1- AC_SUBST_TRACE([CXXCPP]) -m4trace:configure.in:51: -1- m4_pattern_allow([^CXXCPP$]) -m4trace:configure.in:66: -2- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. -You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... -configure.in:66: the top level]) -m4trace:configure.in:70: -2- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. -You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... -configure.in:70: the top level]) -m4trace:configure.in:74: -2- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. -You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... -configure.in:74: the top level]) -m4trace:configure.in:80: -2- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. -You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... -configure.in:80: the top level]) -m4trace:configure.in:88: -1- AC_SUBST([DOXYGEN]) -m4trace:configure.in:88: -1- AC_SUBST_TRACE([DOXYGEN]) -m4trace:configure.in:88: -1- m4_pattern_allow([^DOXYGEN$]) -m4trace:configure.in:96: -1- AC_SUBST([DOT]) -m4trace:configure.in:96: -1- AC_SUBST_TRACE([DOT]) -m4trace:configure.in:96: -1- m4_pattern_allow([^DOT$]) -m4trace:configure.in:99: -1- AM_CONDITIONAL([DOC], [test x$enable_doc = xyes]) -m4trace:configure.in:99: -1- AC_SUBST([DOC_TRUE]) -m4trace:configure.in:99: -1- AC_SUBST_TRACE([DOC_TRUE]) -m4trace:configure.in:99: -1- m4_pattern_allow([^DOC_TRUE$]) -m4trace:configure.in:99: -1- AC_SUBST([DOC_FALSE]) -m4trace:configure.in:99: -1- AC_SUBST_TRACE([DOC_FALSE]) -m4trace:configure.in:99: -1- m4_pattern_allow([^DOC_FALSE$]) -m4trace:configure.in:100: -1- AM_CONDITIONAL([LATEX_DOC], [test x$enable_latex_docs = xyes]) -m4trace:configure.in:100: -1- AC_SUBST([LATEX_DOC_TRUE]) -m4trace:configure.in:100: -1- AC_SUBST_TRACE([LATEX_DOC_TRUE]) -m4trace:configure.in:100: -1- m4_pattern_allow([^LATEX_DOC_TRUE$]) -m4trace:configure.in:100: -1- AC_SUBST([LATEX_DOC_FALSE]) -m4trace:configure.in:100: -1- AC_SUBST_TRACE([LATEX_DOC_FALSE]) -m4trace:configure.in:100: -1- m4_pattern_allow([^LATEX_DOC_FALSE$]) -m4trace:configure.in:114: -1- AC_SUBST([enable_dot]) -m4trace:configure.in:114: -1- AC_SUBST_TRACE([enable_dot]) -m4trace:configure.in:114: -1- m4_pattern_allow([^enable_dot$]) -m4trace:configure.in:115: -1- AC_SUBST([enable_html_docs]) -m4trace:configure.in:115: -1- AC_SUBST_TRACE([enable_html_docs]) -m4trace:configure.in:115: -1- m4_pattern_allow([^enable_html_docs$]) -m4trace:configure.in:116: -1- AC_SUBST([enable_latex_docs]) -m4trace:configure.in:116: -1- AC_SUBST_TRACE([enable_latex_docs]) -m4trace:configure.in:116: -1- m4_pattern_allow([^enable_latex_docs$]) -m4trace:configure.in:117: -1- AC_SUBST([manual_dest]) -m4trace:configure.in:117: -1- AC_SUBST_TRACE([manual_dest]) -m4trace:configure.in:117: -1- m4_pattern_allow([^manual_dest$]) -m4trace:configure.in:118: -1- AC_SUBST([base_dir]) -m4trace:configure.in:118: -1- AC_SUBST_TRACE([base_dir]) -m4trace:configure.in:118: -1- m4_pattern_allow([^base_dir$]) -m4trace:configure.in:132: -1- AC_SUBST([APR_LIBS]) -m4trace:configure.in:132: -1- AC_SUBST_TRACE([APR_LIBS]) -m4trace:configure.in:132: -1- m4_pattern_allow([^APR_LIBS$]) -m4trace:configure.in:142: -1- AC_SUBST([APU_LIBS]) -m4trace:configure.in:142: -1- AC_SUBST_TRACE([APU_LIBS]) -m4trace:configure.in:142: -1- m4_pattern_allow([^APU_LIBS$]) -m4trace:configure.in:149: -1- AH_OUTPUT([HAVE_MBSRTOWCS], [/* Define to 1 if you have the `mbsrtowcs\' function. */ -@%:@undef HAVE_MBSRTOWCS]) -m4trace:configure.in:149: -1- AC_DEFINE_TRACE_LITERAL([HAVE_MBSRTOWCS]) -m4trace:configure.in:149: -1- m4_pattern_allow([^HAVE_MBSRTOWCS$]) -m4trace:configure.in:152: -1- AC_SUBST([HAS_MBSRTOWCS], [1]) -m4trace:configure.in:152: -1- AC_SUBST_TRACE([HAS_MBSRTOWCS]) -m4trace:configure.in:152: -1- m4_pattern_allow([^HAS_MBSRTOWCS$]) -m4trace:configure.in:154: -1- AC_SUBST([HAS_MBSRTOWCS], [0]) -m4trace:configure.in:154: -1- AC_SUBST_TRACE([HAS_MBSRTOWCS]) -m4trace:configure.in:154: -1- m4_pattern_allow([^HAS_MBSRTOWCS$]) -m4trace:configure.in:157: -1- AH_OUTPUT([HAVE_WCSTOMBS], [/* Define to 1 if you have the `wcstombs\' function. */ -@%:@undef HAVE_WCSTOMBS]) -m4trace:configure.in:157: -1- AC_DEFINE_TRACE_LITERAL([HAVE_WCSTOMBS]) -m4trace:configure.in:157: -1- m4_pattern_allow([^HAVE_WCSTOMBS$]) -m4trace:configure.in:160: -1- AC_SUBST([HAS_WCSTOMBS], [1]) -m4trace:configure.in:160: -1- AC_SUBST_TRACE([HAS_WCSTOMBS]) -m4trace:configure.in:160: -1- m4_pattern_allow([^HAS_WCSTOMBS$]) -m4trace:configure.in:162: -1- AC_SUBST([HAS_WCSTOMBS], [0]) -m4trace:configure.in:162: -1- AC_SUBST_TRACE([HAS_WCSTOMBS]) -m4trace:configure.in:162: -1- m4_pattern_allow([^HAS_WCSTOMBS$]) -m4trace:configure.in:166: -1- AH_OUTPUT([HAVE_SYSLOG], [/* Define to 1 if you have the `syslog\' function. */ -@%:@undef HAVE_SYSLOG]) -m4trace:configure.in:166: -1- AC_DEFINE_TRACE_LITERAL([HAVE_SYSLOG]) -m4trace:configure.in:166: -1- m4_pattern_allow([^HAVE_SYSLOG$]) -m4trace:configure.in:169: -1- AC_SUBST([HAS_SYSLOG], [1]) -m4trace:configure.in:169: -1- AC_SUBST_TRACE([HAS_SYSLOG]) -m4trace:configure.in:169: -1- m4_pattern_allow([^HAS_SYSLOG$]) -m4trace:configure.in:171: -1- AC_SUBST([HAS_SYSLOG], [0]) -m4trace:configure.in:171: -1- AC_SUBST_TRACE([HAS_SYSLOG]) -m4trace:configure.in:171: -1- m4_pattern_allow([^HAS_SYSLOG$]) -m4trace:configure.in:177: -1- AC_SUBST([HAS_STD_LOCALE], [1]) -m4trace:configure.in:177: -1- AC_SUBST_TRACE([HAS_STD_LOCALE]) -m4trace:configure.in:177: -1- m4_pattern_allow([^HAS_STD_LOCALE$]) -m4trace:configure.in:179: -1- AC_SUBST([HAS_STD_LOCALE], [0]) -m4trace:configure.in:179: -1- AC_SUBST_TRACE([HAS_STD_LOCALE]) -m4trace:configure.in:179: -1- m4_pattern_allow([^HAS_STD_LOCALE$]) -m4trace:configure.in:183: -1- _m4_warn([syntax], [AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body], [../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from... -../../lib/autoconf/general.m4:2590: _AC_COMPILE_IFELSE is expanded from... -../../lib/autoconf/general.m4:2606: AC_COMPILE_IFELSE is expanded from... -configure.in:183: the top level]) -m4trace:configure.in:189: -1- AC_SUBST([HAS_WCHAR_T], [1]) -m4trace:configure.in:189: -1- AC_SUBST_TRACE([HAS_WCHAR_T]) -m4trace:configure.in:189: -1- m4_pattern_allow([^HAS_WCHAR_T$]) -m4trace:configure.in:191: -1- AC_SUBST([HAS_WCHAR_T], [0]) -m4trace:configure.in:191: -1- AC_SUBST_TRACE([HAS_WCHAR_T]) -m4trace:configure.in:191: -1- m4_pattern_allow([^HAS_WCHAR_T$]) -m4trace:configure.in:194: -1- AH_OUTPUT([HAVE_FWIDE], [/* Define to 1 if you have the `fwide\' function. */ -@%:@undef HAVE_FWIDE]) -m4trace:configure.in:194: -1- AC_DEFINE_TRACE_LITERAL([HAVE_FWIDE]) -m4trace:configure.in:194: -1- m4_pattern_allow([^HAVE_FWIDE$]) -m4trace:configure.in:197: -1- AC_SUBST([HAS_FWIDE], [1]) -m4trace:configure.in:197: -1- AC_SUBST_TRACE([HAS_FWIDE]) -m4trace:configure.in:197: -1- m4_pattern_allow([^HAS_FWIDE$]) -m4trace:configure.in:199: -1- AC_SUBST([HAS_FWIDE], [0]) -m4trace:configure.in:199: -1- AC_SUBST_TRACE([HAS_FWIDE]) -m4trace:configure.in:199: -1- m4_pattern_allow([^HAS_FWIDE$]) -m4trace:configure.in:206: -1- AC_SUBST([RANLIB]) -m4trace:configure.in:206: -1- AC_SUBST_TRACE([RANLIB]) -m4trace:configure.in:206: -1- m4_pattern_allow([^RANLIB$]) -m4trace:configure.in:212: -2- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. -You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... -configure.in:212: the top level]) -m4trace:configure.in:218: -1- AC_SUBST([HAS_ODBC], [1], [ODBC support]) -m4trace:configure.in:218: -1- AC_SUBST_TRACE([HAS_ODBC]) -m4trace:configure.in:218: -1- m4_pattern_allow([^HAS_ODBC$]) -m4trace:configure.in:225: -1- AC_SUBST([HAS_ODBC], [1], [ODBC support]) -m4trace:configure.in:225: -1- AC_SUBST_TRACE([HAS_ODBC]) -m4trace:configure.in:225: -1- m4_pattern_allow([^HAS_ODBC$]) -m4trace:configure.in:230: -1- AC_SUBST([IODBC_CONFIG]) -m4trace:configure.in:230: -1- AC_SUBST_TRACE([IODBC_CONFIG]) -m4trace:configure.in:230: -1- m4_pattern_allow([^IODBC_CONFIG$]) -m4trace:configure.in:233: -1- AC_SUBST([HAS_ODBC], [1], [ODBC support]) -m4trace:configure.in:233: -1- AC_SUBST_TRACE([HAS_ODBC]) -m4trace:configure.in:233: -1- m4_pattern_allow([^HAS_ODBC$]) -m4trace:configure.in:241: -1- AC_SUBST([HAS_ODBC], [0], [No ODBC support]) -m4trace:configure.in:241: -1- AC_SUBST_TRACE([HAS_ODBC]) -m4trace:configure.in:241: -1- m4_pattern_allow([^HAS_ODBC$]) -m4trace:configure.in:249: -1- AC_SUBST([LIBS_ODBC]) -m4trace:configure.in:249: -1- AC_SUBST_TRACE([LIBS_ODBC]) -m4trace:configure.in:249: -1- m4_pattern_allow([^LIBS_ODBC$]) -m4trace:configure.in:250: -1- AC_SUBST([CPPFLAGS_ODBC]) -m4trace:configure.in:250: -1- AC_SUBST_TRACE([CPPFLAGS_ODBC]) -m4trace:configure.in:250: -1- m4_pattern_allow([^CPPFLAGS_ODBC$]) -m4trace:configure.in:256: -2- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. -You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... -configure.in:256: the top level]) -m4trace:configure.in:263: -1- AH_OUTPUT([HAVE_LIBESMTP], [/* Define to 1 if you have the `esmtp\' library (-lesmtp). */ -@%:@undef HAVE_LIBESMTP]) -m4trace:configure.in:263: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBESMTP]) -m4trace:configure.in:263: -1- m4_pattern_allow([^HAVE_LIBESMTP$]) -m4trace:configure.in:266: -1- AC_SUBST([HAS_LIBESMTP], [1], [SMTP support through libesmtp library.]) -m4trace:configure.in:266: -1- AC_SUBST_TRACE([HAS_LIBESMTP]) -m4trace:configure.in:266: -1- m4_pattern_allow([^HAS_LIBESMTP$]) -m4trace:configure.in:271: -1- AC_SUBST([HAS_LIBESMTP], [0], [SMTP support through libesmtp library.]) -m4trace:configure.in:271: -1- AC_SUBST_TRACE([HAS_LIBESMTP]) -m4trace:configure.in:271: -1- m4_pattern_allow([^HAS_LIBESMTP$]) -m4trace:configure.in:281: -2- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. -You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... -configure.in:281: the top level]) -m4trace:configure.in:291: -1- AC_SUBST([CHAR_API], [1]) -m4trace:configure.in:291: -1- AC_SUBST_TRACE([CHAR_API]) -m4trace:configure.in:291: -1- m4_pattern_allow([^CHAR_API$]) -m4trace:configure.in:293: -1- AC_SUBST([CHAR_API], [0]) -m4trace:configure.in:293: -1- AC_SUBST_TRACE([CHAR_API]) -m4trace:configure.in:293: -1- m4_pattern_allow([^CHAR_API$]) -m4trace:configure.in:298: -2- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. -You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... -configure.in:298: the top level]) -m4trace:configure.in:313: -1- AC_SUBST([WCHAR_T_API], [1]) -m4trace:configure.in:313: -1- AC_SUBST_TRACE([WCHAR_T_API]) -m4trace:configure.in:313: -1- m4_pattern_allow([^WCHAR_T_API$]) -m4trace:configure.in:315: -1- AC_SUBST([WCHAR_T_API], [0]) -m4trace:configure.in:315: -1- AC_SUBST_TRACE([WCHAR_T_API]) -m4trace:configure.in:315: -1- m4_pattern_allow([^WCHAR_T_API$]) -m4trace:configure.in:320: -2- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. -You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... -configure.in:320: the top level]) -m4trace:configure.in:324: -1- AC_SUBST([UNICHAR_API], [1]) -m4trace:configure.in:324: -1- AC_SUBST_TRACE([UNICHAR_API]) -m4trace:configure.in:324: -1- m4_pattern_allow([^UNICHAR_API$]) -m4trace:configure.in:326: -1- AC_SUBST([UNICHAR_API], [0]) -m4trace:configure.in:326: -1- AC_SUBST_TRACE([UNICHAR_API]) -m4trace:configure.in:326: -1- m4_pattern_allow([^UNICHAR_API$]) -m4trace:configure.in:331: -2- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. -You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... -configure.in:331: the top level]) -m4trace:configure.in:336: -1- _m4_warn([syntax], [AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body], [../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from... -../../lib/autoconf/general.m4:2590: _AC_COMPILE_IFELSE is expanded from... -../../lib/autoconf/general.m4:2606: AC_COMPILE_IFELSE is expanded from... -configure.in:336: the top level]) -m4trace:configure.in:346: -1- AC_SUBST([CFSTRING_API], [1]) -m4trace:configure.in:346: -1- AC_SUBST_TRACE([CFSTRING_API]) -m4trace:configure.in:346: -1- m4_pattern_allow([^CFSTRING_API$]) -m4trace:configure.in:348: -1- AC_SUBST([CFSTRING_API], [0]) -m4trace:configure.in:348: -1- AC_SUBST_TRACE([CFSTRING_API]) -m4trace:configure.in:348: -1- m4_pattern_allow([^CFSTRING_API$]) -m4trace:configure.in:354: -2- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. -You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... -configure.in:354: the top level]) -m4trace:configure.in:362: -1- AC_SUBST([CHARSET_UTF8], [1]) -m4trace:configure.in:362: -1- AC_SUBST_TRACE([CHARSET_UTF8]) -m4trace:configure.in:362: -1- m4_pattern_allow([^CHARSET_UTF8$]) -m4trace:configure.in:363: -1- AC_SUBST([CHARSET_ISO88591], [0]) -m4trace:configure.in:363: -1- AC_SUBST_TRACE([CHARSET_ISO88591]) -m4trace:configure.in:363: -1- m4_pattern_allow([^CHARSET_ISO88591$]) -m4trace:configure.in:364: -1- AC_SUBST([CHARSET_USASCII], [0]) -m4trace:configure.in:364: -1- AC_SUBST_TRACE([CHARSET_USASCII]) -m4trace:configure.in:364: -1- m4_pattern_allow([^CHARSET_USASCII$]) -m4trace:configure.in:365: -1- AC_SUBST([CHARSET_EBCDIC], [0]) -m4trace:configure.in:365: -1- AC_SUBST_TRACE([CHARSET_EBCDIC]) -m4trace:configure.in:365: -1- m4_pattern_allow([^CHARSET_EBCDIC$]) -m4trace:configure.in:370: -1- AC_SUBST([CHARSET_UTF8], [0]) -m4trace:configure.in:370: -1- AC_SUBST_TRACE([CHARSET_UTF8]) -m4trace:configure.in:370: -1- m4_pattern_allow([^CHARSET_UTF8$]) -m4trace:configure.in:371: -1- AC_SUBST([CHARSET_ISO88591], [1]) -m4trace:configure.in:371: -1- AC_SUBST_TRACE([CHARSET_ISO88591]) -m4trace:configure.in:371: -1- m4_pattern_allow([^CHARSET_ISO88591$]) -m4trace:configure.in:372: -1- AC_SUBST([CHARSET_USASCII], [0]) -m4trace:configure.in:372: -1- AC_SUBST_TRACE([CHARSET_USASCII]) -m4trace:configure.in:372: -1- m4_pattern_allow([^CHARSET_USASCII$]) -m4trace:configure.in:373: -1- AC_SUBST([CHARSET_EBCDIC], [0]) -m4trace:configure.in:373: -1- AC_SUBST_TRACE([CHARSET_EBCDIC]) -m4trace:configure.in:373: -1- m4_pattern_allow([^CHARSET_EBCDIC$]) -m4trace:configure.in:378: -1- AC_SUBST([CHARSET_UTF8], [0]) -m4trace:configure.in:378: -1- AC_SUBST_TRACE([CHARSET_UTF8]) -m4trace:configure.in:378: -1- m4_pattern_allow([^CHARSET_UTF8$]) -m4trace:configure.in:379: -1- AC_SUBST([CHARSET_ISO88591], [0]) -m4trace:configure.in:379: -1- AC_SUBST_TRACE([CHARSET_ISO88591]) -m4trace:configure.in:379: -1- m4_pattern_allow([^CHARSET_ISO88591$]) -m4trace:configure.in:380: -1- AC_SUBST([CHARSET_USASCII], [1]) -m4trace:configure.in:380: -1- AC_SUBST_TRACE([CHARSET_USASCII]) -m4trace:configure.in:380: -1- m4_pattern_allow([^CHARSET_USASCII$]) -m4trace:configure.in:381: -1- AC_SUBST([CHARSET_EBCDIC], [0]) -m4trace:configure.in:381: -1- AC_SUBST_TRACE([CHARSET_EBCDIC]) -m4trace:configure.in:381: -1- m4_pattern_allow([^CHARSET_EBCDIC$]) -m4trace:configure.in:386: -1- AC_SUBST([CHARSET_UTF8], [0]) -m4trace:configure.in:386: -1- AC_SUBST_TRACE([CHARSET_UTF8]) -m4trace:configure.in:386: -1- m4_pattern_allow([^CHARSET_UTF8$]) -m4trace:configure.in:387: -1- AC_SUBST([CHARSET_ISO88591], [0]) -m4trace:configure.in:387: -1- AC_SUBST_TRACE([CHARSET_ISO88591]) -m4trace:configure.in:387: -1- m4_pattern_allow([^CHARSET_ISO88591$]) -m4trace:configure.in:388: -1- AC_SUBST([CHARSET_USASCII], [0]) -m4trace:configure.in:388: -1- AC_SUBST_TRACE([CHARSET_USASCII]) -m4trace:configure.in:388: -1- m4_pattern_allow([^CHARSET_USASCII$]) -m4trace:configure.in:389: -1- AC_SUBST([CHARSET_EBCDIC], [1]) -m4trace:configure.in:389: -1- AC_SUBST_TRACE([CHARSET_EBCDIC]) -m4trace:configure.in:389: -1- m4_pattern_allow([^CHARSET_EBCDIC$]) -m4trace:configure.in:394: -1- AC_SUBST([CHARSET_UTF8], [0]) -m4trace:configure.in:394: -1- AC_SUBST_TRACE([CHARSET_UTF8]) -m4trace:configure.in:394: -1- m4_pattern_allow([^CHARSET_UTF8$]) -m4trace:configure.in:395: -1- AC_SUBST([CHARSET_ISO88591], [0]) -m4trace:configure.in:395: -1- AC_SUBST_TRACE([CHARSET_ISO88591]) -m4trace:configure.in:395: -1- m4_pattern_allow([^CHARSET_ISO88591$]) -m4trace:configure.in:396: -1- AC_SUBST([CHARSET_USASCII], [0]) -m4trace:configure.in:396: -1- AC_SUBST_TRACE([CHARSET_USASCII]) -m4trace:configure.in:396: -1- m4_pattern_allow([^CHARSET_USASCII$]) -m4trace:configure.in:397: -1- AC_SUBST([CHARSET_EBCDIC], [0]) -m4trace:configure.in:397: -1- AC_SUBST_TRACE([CHARSET_EBCDIC]) -m4trace:configure.in:397: -1- m4_pattern_allow([^CHARSET_EBCDIC$]) -m4trace:configure.in:411: -2- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. -You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... -configure.in:411: the top level]) -m4trace:configure.in:419: -1- AC_SUBST([LOGCHAR_IS_UTF8], [1]) -m4trace:configure.in:419: -1- AC_SUBST_TRACE([LOGCHAR_IS_UTF8]) -m4trace:configure.in:419: -1- m4_pattern_allow([^LOGCHAR_IS_UTF8$]) -m4trace:configure.in:420: -1- AC_SUBST([LOGCHAR_IS_WCHAR], [0]) -m4trace:configure.in:420: -1- AC_SUBST_TRACE([LOGCHAR_IS_WCHAR]) -m4trace:configure.in:420: -1- m4_pattern_allow([^LOGCHAR_IS_WCHAR$]) -m4trace:configure.in:421: -1- AC_SUBST([LOGCHAR_IS_UNICHAR], [0]) -m4trace:configure.in:421: -1- AC_SUBST_TRACE([LOGCHAR_IS_UNICHAR]) -m4trace:configure.in:421: -1- m4_pattern_allow([^LOGCHAR_IS_UNICHAR$]) -m4trace:configure.in:426: -1- AC_SUBST([LOGCHAR_IS_UTF8], [0]) -m4trace:configure.in:426: -1- AC_SUBST_TRACE([LOGCHAR_IS_UTF8]) -m4trace:configure.in:426: -1- m4_pattern_allow([^LOGCHAR_IS_UTF8$]) -m4trace:configure.in:427: -1- AC_SUBST([LOGCHAR_IS_WCHAR], [1]) -m4trace:configure.in:427: -1- AC_SUBST_TRACE([LOGCHAR_IS_WCHAR]) -m4trace:configure.in:427: -1- m4_pattern_allow([^LOGCHAR_IS_WCHAR$]) -m4trace:configure.in:428: -1- AC_SUBST([LOGCHAR_IS_UNICHAR], [0]) -m4trace:configure.in:428: -1- AC_SUBST_TRACE([LOGCHAR_IS_UNICHAR]) -m4trace:configure.in:428: -1- m4_pattern_allow([^LOGCHAR_IS_UNICHAR$]) -m4trace:configure.in:433: -1- AC_SUBST([LOGCHAR_IS_UTF8], [0]) -m4trace:configure.in:433: -1- AC_SUBST_TRACE([LOGCHAR_IS_UTF8]) -m4trace:configure.in:433: -1- m4_pattern_allow([^LOGCHAR_IS_UTF8$]) -m4trace:configure.in:434: -1- AC_SUBST([LOGCHAR_IS_WCHAR], [0]) -m4trace:configure.in:434: -1- AC_SUBST_TRACE([LOGCHAR_IS_WCHAR]) -m4trace:configure.in:434: -1- m4_pattern_allow([^LOGCHAR_IS_WCHAR$]) -m4trace:configure.in:435: -1- AC_SUBST([LOGCHAR_IS_UNICHAR], [1]) -m4trace:configure.in:435: -1- AC_SUBST_TRACE([LOGCHAR_IS_UNICHAR]) -m4trace:configure.in:435: -1- m4_pattern_allow([^LOGCHAR_IS_UNICHAR$]) -m4trace:configure.in:449: -1- AC_CONFIG_FILES([ -Makefile -liblog4cxx.pc -src/Makefile -src/main/Makefile -src/main/cpp/Makefile -src/main/include/Makefile -src/main/include/log4cxx/log4cxx.h -src/main/include/log4cxx/private/log4cxx_private.h -src/main/include/log4cxx/private/Makefile -src/main/include/log4cxx/Makefile -src/main/include/log4cxx/helpers/Makefile -src/main/include/log4cxx/net/Makefile -src/main/include/log4cxx/nt/Makefile -src/main/include/log4cxx/spi/Makefile -src/main/include/log4cxx/spi/location/Makefile -src/main/include/log4cxx/varia/Makefile -src/main/include/log4cxx/xml/Makefile -src/main/include/log4cxx/config/Makefile -src/main/include/log4cxx/db/Makefile -src/main/include/log4cxx/rolling/Makefile -src/main/include/log4cxx/pattern/Makefile -src/main/include/log4cxx/filter/Makefile -src/site/Makefile -src/site/doxy/Makefile -src/site/doxy/Doxyfile -src/test/Makefile -src/test/resources/Makefile -src/test/resources/input/Makefile -src/test/resources/input/ndc/Makefile -src/test/resources/input/rolling/Makefile -src/test/resources/input/xml/Makefile -src/test/cpp/Makefile -src/test/resources/witness/Makefile -src/test/resources/witness/encoding/Makefile -src/test/resources/witness/ndc/Makefile -src/test/resources/witness/rolling/Makefile -src/examples/Makefile -src/examples/cpp/Makefile -]) -m4trace:configure.in:489: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs]) -m4trace:configure.in:489: -1- AC_SUBST_TRACE([LIB@&t@OBJS]) -m4trace:configure.in:489: -1- m4_pattern_allow([^LIB@&t@OBJS$]) -m4trace:configure.in:489: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs]) -m4trace:configure.in:489: -1- AC_SUBST_TRACE([LTLIBOBJS]) -m4trace:configure.in:489: -1- m4_pattern_allow([^LTLIBOBJS$]) -m4trace:configure.in:489: -1- AC_SUBST_TRACE([top_builddir]) -m4trace:configure.in:489: -1- AC_SUBST_TRACE([top_build_prefix]) -m4trace:configure.in:489: -1- AC_SUBST_TRACE([srcdir]) -m4trace:configure.in:489: -1- AC_SUBST_TRACE([abs_srcdir]) -m4trace:configure.in:489: -1- AC_SUBST_TRACE([top_srcdir]) -m4trace:configure.in:489: -1- AC_SUBST_TRACE([abs_top_srcdir]) -m4trace:configure.in:489: -1- AC_SUBST_TRACE([builddir]) -m4trace:configure.in:489: -1- AC_SUBST_TRACE([abs_builddir]) -m4trace:configure.in:489: -1- AC_SUBST_TRACE([abs_top_builddir]) -m4trace:configure.in:489: -1- AC_SUBST_TRACE([INSTALL]) diff --git a/src/appMain/CMakeLists.txt b/src/appMain/CMakeLists.txt index e5f85f7a46..88c2d75dad 100644 --- a/src/appMain/CMakeLists.txt +++ b/src/appMain/CMakeLists.txt @@ -44,6 +44,7 @@ endif() include_directories( ${COMPONENTS_DIR}/protocol_handler/include ${COMPONENTS_DIR}/application_manager/include + ${COMPONENTS_DIR}/remote_control/include ${COMPONENTS_DIR}/formatters/include ${COMPONENTS_DIR}/transport_manager/include ${COMPONENTS_DIR}/security_manager/include @@ -56,14 +57,16 @@ include_directories( ${COMPONENTS_DIR}/smart_objects/include ${COMPONENTS_DIR}/media_manager/include ${COMPONENTS_DIR}/telemetry_monitor/include - ${POLICY_PATH}/include/ + ${COMPONENTS_DIR}/functional_module/include + ${POLICY_PATH}/include ${POLICY_GLOBAL_INCLUDE_PATH}/ - ${COMPONENTS_DIR}/rpc_base/include/ + ${COMPONENTS_DIR}/rpc_base/include ${COMPONENTS_DIR}/resumption/include ${COMPONENTS_DIR}/dbus/include ${CMAKE_BINARY_DIR}/src/components ${JSONCPP_INCLUDE_DIRECTORY} ${LOG4CXX_INCLUDE_DIRECTORY} + ${BSON_INCLUDE_DIRECTORY} ${OPENSSL_INCLUDE_DIRECTORY} ${default_media_inc} ${MESSAGE_BROKER_INCLUDE_DIRECTORY} @@ -114,6 +117,12 @@ set(LIBRARIES ConfigProfile Resumption ) +if(REMOTE_CONTROL) + SET (LIBRARIES + ${LIBRARIES} + FunctionalModule + ) +endif(REMOTE_CONTROL) if (CMAKE_SYSTEM_NAME STREQUAL "Linux") list(APPEND LIBRARIES pthread) @@ -139,6 +148,9 @@ if(ENABLE_LOG) list(APPEND LIBRARIES expat -L${EXPAT_LIBS_DIRECTORY}) endif() +list(APPEND LIBRARIES bson -L${BSON_LIBS_DIRECTORY}) +list(APPEND LIBRARIES emhashmap -L${EMHASHMAP_LIBS_DIRECTORY}) + add_executable(${PROJECT} ${SOURCES}) target_link_libraries(${PROJECT} ${LIBRARIES}) @@ -207,6 +219,11 @@ install( DESTINATION bin ) +install( + FILES sdl_preloaded_pt.json + DESTINATION bin +) + if (${QT_HMI}) if (CMAKE_SYSTEM_NAME STREQUAL "QNX") install(FILES start-qml.sh DESTINATION bin diff --git a/src/appMain/hmi_capabilities.json b/src/appMain/hmi_capabilities.json index 2369543e32..bef4d1e896 100755 --- a/src/appMain/hmi_capabilities.json +++ b/src/appMain/hmi_capabilities.json @@ -1,466 +1,593 @@ { - "UI": - { - "language":"EN-US", - "languages":[ - "EN-US","ES-MX","FR-CA","DE-DE","ES-ES","EN-GB","RU-RU","TR-TR","PL-PL","FR-FR","IT-IT","SV-SE","PT-PT","NL-NL","ZH-TW", -"JA-JP","AR-SA","KO-KR","PT-BR","CS-CZ","DA-DK","NO-NO" - ], - "displayCapabilities": - { - "displayType":"GEN2_8_DMA", - "textFields": [{ - "name": "mainField1", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "mainField2", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "mainField3", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "mainField4", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "statusBar", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "mediaClock", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "mediaTrack", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "alertText1", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "alertText2", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "alertText3", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "scrollableMessageBody", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "initialInteractionText", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "navigationText1", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "navigationText2", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "ETA", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "totalDistance", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "navigationText", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "audioPassThruDisplayText1", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "audioPassThruDisplayText2", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "sliderHeader", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "sliderFooter", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "notificationText", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "menuName", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "secondaryText", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "tertiaryText", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "timeToDestination", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "turnText", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "menuTitle", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - } - ], - "imageFields": - [ - { - "name":"softButtonImage", - "imageTypeSupported": - [ - ], - "imageResolution": - { - "resolutionWidth":35, - "resolutionHeight":35 - } - }, - { - "name":"choiceImage", - "imageTypeSupported": - [ - ], - "imageResolution": - { - "resolutionWidth":35, - "resolutionHeight":35 - } - }, - { - "name":"choiceSecondaryImage", - "imageTypeSupported": - [ - ], - "imageResolution": - { - "resolutionWidth":35, - "resolutionHeight":35 - } - }, - { - "name":"menuIcon", - "imageTypeSupported": - [ - ], - "imageResolution": - { - "resolutionWidth":35, - "resolutionHeight":35 - } - }, - { - "name":"cmdIcon", - "imageTypeSupported": - [ - ], - "imageResolution": - { - "resolutionWidth":35, - "resolutionHeight":35 - } - }, - { - "name":"appIcon", - "imageTypeSupported": - [ - ], - "imageResolution": - { - "resolutionWidth":35, - "resolutionHeight":35 - } - }, - { - "name":"graphic", - "imageTypeSupported": - [ - - ], - "imageResolution": - { - "resolutionWidth":35, - "resolutionHeight":35 - } - }, - { - "name":"locationImage", - "imageTypeSupported": - [ - "GRAPHIC_PNG" - ], - "imageResolution": - { - "resolutionWidth":35, - "resolutionHeight":35 - } - } - + "UI": { + "language": "EN-US", + "languages": [ + "EN-US", "ES-MX", "FR-CA", "DE-DE", "ES-ES", "EN-GB", "RU-RU", "TR-TR", "PL-PL", "FR-FR", "IT-IT", "SV-SE", "PT-PT", "NL-NL", "ZH-TW", + "JA-JP", "AR-SA", "KO-KR", "PT-BR", "CS-CZ", "DA-DK", "NO-NO" + ], + "displayCapabilities": { + "displayType": "GEN2_8_DMA", + "textFields": [{ + "name": "mainField1", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "mainField2", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "mainField3", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "mainField4", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "statusBar", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "mediaClock", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "mediaTrack", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "alertText1", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "alertText2", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "alertText3", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "scrollableMessageBody", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "initialInteractionText", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "navigationText1", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "navigationText2", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "ETA", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "totalDistance", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "navigationText", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "audioPassThruDisplayText1", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "audioPassThruDisplayText2", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "sliderHeader", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "sliderFooter", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "notificationText", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "menuName", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "secondaryText", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "tertiaryText", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "timeToDestination", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "turnText", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "menuTitle", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + } + ], + "imageFields": [{ + "name": "softButtonImage", + "imageTypeSupported": [], + "imageResolution": { + "resolutionWidth": 35, + "resolutionHeight": 35 + } + }, + { + "name": "choiceImage", + "imageTypeSupported": [], + "imageResolution": { + "resolutionWidth": 35, + "resolutionHeight": 35 + } + }, + { + "name": "choiceSecondaryImage", + "imageTypeSupported": [], + "imageResolution": { + "resolutionWidth": 35, + "resolutionHeight": 35 + } + }, + { + "name": "menuIcon", + "imageTypeSupported": [], + "imageResolution": { + "resolutionWidth": 35, + "resolutionHeight": 35 + } + }, + { + "name": "cmdIcon", + "imageTypeSupported": [], + "imageResolution": { + "resolutionWidth": 35, + "resolutionHeight": 35 + } + }, + { + "name": "appIcon", + "imageTypeSupported": [], + "imageResolution": { + "resolutionWidth": 35, + "resolutionHeight": 35 + } + }, + { + "name": "graphic", + "imageTypeSupported": [ + + ], + "imageResolution": { + "resolutionWidth": 35, + "resolutionHeight": 35 + } + }, + { + "name": "locationImage", + "imageTypeSupported": [ + "GRAPHIC_PNG" + ], + "imageResolution": { + "resolutionWidth": 35, + "resolutionHeight": 35 + } + } + + ], + "mediaClockFormats": [ + "CLOCK1", "CLOCK2", "CLOCK3", "CLOCKTEXT1", "CLOCKTEXT2", "CLOCKTEXT3", "CLOCKTEXT4" + ], + "graphicSupported": true, + "templatesAvailable": [ + + "DEFAULT", "MEDIA", "NON-MEDIA", "ONSCREEN_PRESETS", "NAV_FULLSCREEN_MAP", "NAV_KEYBOARD", + "GRAPHIC_WITH_TEXT", "TEXT_WITH_GRAPHIC", "TILES_ONLY", "TEXTBUTTONS_ONLY", + "GRAPHIC_WITH_TILES", "TILES_WITH_GRAPHIC", "GRAPHIC_WITH_TEXT_AND_SOFTBUTTONS", + "TEXT_AND_SOFTBUTTONS_WITH_GRAPHIC", "GRAPHIC_WITH_TEXTBUTTONS", + "TEXTBUTTONS_WITH_GRAPHIC", "LARGE_GRAPHIC_WITH_SOFTBUTTONS", + "DOUBLE_GRAPHIC_WITH_SOFTBUTTONS", "LARGE_GRAPHIC_ONLY" + ], + "screenParams": { + "resolution": { + "resolutionWidth": 800, + "resolutionHeight": 350 + }, + "touchEventAvailable": { + "pressAvailable": true, + "multiTouchAvailable": false, + "doublePressAvailable": false + } + }, + "numCustomPresetsAvailable": 8, + "imageCapabilities": [ + "DYNAMIC", + "STATIC" + ] + }, + "audioPassThruCapabilities": { + "samplingRate": "44KHZ", + "bitsPerSample": "RATE_8_BIT", + "audioType": "PCM" + }, + "pcmStreamCapabilities": { + "samplingRate": "16KHZ", + "bitsPerSample": "RATE_16_BIT", + "audioType": "PCM" + }, + "hmiZoneCapabilities": "FRONT", + "softButtonCapabilities": [{ + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true, + "imageSupported": true + }], + "systemCapabilities": { + "navigationCapability": { + "sendLocationEnabled": true, + "getWayPointsEnabled": true + }, + "phoneCapability": { + "dialNumberEnabled": true + }, + "videoStreamingCapability": { + "preferredResolution": { + "resolutionWidth": 800, + "resolutionHeight": 350 + }, + "maxBitrate": 10000, + "supportedFormats": [{ + "protocol": "RAW", + "codec": "H264" + }], + "hapticSpatialDataSupported": false + }, + "remoteControlCapability": { + "buttonCapabilities": [ + { + "longPressAvailable": true, + "name": "AC_MAX", + "shortPressAvailable": true, + "upDownAvailable": false + }, + { + "longPressAvailable": true, + "name": "AC", + "shortPressAvailable": true, + "upDownAvailable": false + }, + { + "longPressAvailable": true, + "name": "RECIRCULATE", + "shortPressAvailable": true, + "upDownAvailable": false + }, + { + "longPressAvailable": true, + "name": "FAN_UP", + "shortPressAvailable": true, + "upDownAvailable": false + }, + { + "longPressAvailable": true, + "name": "FAN_DOWN", + "shortPressAvailable": true, + "upDownAvailable": false + }, + { + "longPressAvailable": true, + "name": "TEMP_UP", + "shortPressAvailable": true, + "upDownAvailable": false + }, + { + "longPressAvailable": true, + "name": "TEMP_DOWN", + "shortPressAvailable": true, + "upDownAvailable": false + }, + { + "longPressAvailable": true, + "name": "DEFROST_MAX", + "shortPressAvailable": true, + "upDownAvailable": false + }, + { + "longPressAvailable": true, + "name": "DEFROST", + "shortPressAvailable": true, + "upDownAvailable": false + }, + { + "longPressAvailable": true, + "name": "DEFROST_REAR", + "shortPressAvailable": true, + "upDownAvailable": false + }, + { + "longPressAvailable": true, + "name": "UPPER_VENT", + "shortPressAvailable": true, + "upDownAvailable": false + }, + { + "longPressAvailable": true, + "name": "LOWER_VENT", + "shortPressAvailable": true, + "upDownAvailable": false + }, + { + "longPressAvailable": true, + "name": "VOLUME_UP", + "shortPressAvailable": true, + "upDownAvailable": false + }, + { + "longPressAvailable": true, + "name": "VOLUME_DOWN", + "shortPressAvailable": true, + "upDownAvailable": false + }, + { + "longPressAvailable": true, + "name": "EJECT", + "shortPressAvailable": true, + "upDownAvailable": false + }, + { + "longPressAvailable": true, + "name": "SOURCE", + "shortPressAvailable": true, + "upDownAvailable": false + }, + { + "longPressAvailable": true, + "name": "SHUFFLE", + "shortPressAvailable": true, + "upDownAvailable": false + }, + { + "longPressAvailable": true, + "name": "REPEAT", + "shortPressAvailable": true, + "upDownAvailable": false + } + ], + "climateControlCapabilities": [ + { + "acEnableAvailable": true, + "acMaxEnableAvailable": true, + "autoModeEnableAvailable": true, + "circulateAirEnableAvailable": true, + "currentTemperatureAvailable": true, + "defrostZone": [ + "FRONT", + "REAR", + "ALL", + "NONE" ], - "mediaClockFormats": - [ - "CLOCK1","CLOCK2","CLOCK3","CLOCKTEXT1","CLOCKTEXT2","CLOCKTEXT3","CLOCKTEXT4" - ], - "graphicSupported":true, - "templatesAvailable": - [ - - "DEFAULT","MEDIA","NON-MEDIA","ONSCREEN_PRESETS","NAV_FULLSCREEN_MAP","NAV_KEYBOARD", - "GRAPHIC_WITH_TEXT","TEXT_WITH_GRAPHIC","TILES_ONLY","TEXTBUTTONS_ONLY", - "GRAPHIC_WITH_TILES","TILES_WITH_GRAPHIC","GRAPHIC_WITH_TEXT_AND_SOFTBUTTONS", - "TEXT_AND_SOFTBUTTONS_WITH_GRAPHIC","GRAPHIC_WITH_TEXTBUTTONS", - "TEXTBUTTONS_WITH_GRAPHIC","LARGE_GRAPHIC_WITH_SOFTBUTTONS", - "DOUBLE_GRAPHIC_WITH_SOFTBUTTONS","LARGE_GRAPHIC_ONLY" + "defrostZoneAvailable": true, + "desiredTemperatureAvailable": true, + "dualModeEnableAvailable": true, + "fanSpeedAvailable": true, + "moduleName": "primary_climate", + "ventilationMode": [ + "UPPER", + "LOWER", + "BOTH", + "NONE" ], - "screenParams": - { - "resolution": - { - "resolutionWidth":800, - "resolutionHeight":350 - }, - "touchEventAvailable": - { - "pressAvailable":true, - "multiTouchAvailable":false, - "doublePressAvailable":false - } - }, - "numCustomPresetsAvailable":8, - "imageCapabilities": - [ - "DYNAMIC", - "STATIC" - ] - }, - "audioPassThruCapabilities": - { - "samplingRate" : "44KHZ", - "bitsPerSample" : "RATE_8_BIT", - "audioType" : "PCM" - }, - "pcmStreamCapabilities": - { - "samplingRate" : "16KHZ", - "bitsPerSample" : "RATE_16_BIT", - "audioType" : "PCM" - }, - "hmiZoneCapabilities":"FRONT", - "softButtonCapabilities": - [ - { - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true, - "imageSupported" :true - } + "ventilationModeAvailable": true + } + ], + "radioControlCapabilities": [ + { + "availableHDsAvailable": true, + "hdChannelAvailable": true, + "moduleName": "radio", + "radioBandAvailable": true, + "radioEnableAvailable": true, + "radioFrequencyAvailable": true, + "rdsDataAvailable": true, + "signalChangeThresholdAvailable": true, + "signalStrengthAvailable": true, + "stateAvailable": true + } + ] + } + } + }, + "VR": { + "capabilities": ["TEXT"], + "language": "EN-US", + "languages": [ + "EN-US", "ES-MX", "FR-CA", "DE-DE", "ES-ES", "EN-GB", "RU-RU", "TR-TR", "PL-PL", "FR-FR", "IT-IT", "SV-SE", "PT-PT", "NL-NL", "ZH-TW", + "JA-JP", "AR-SA", "KO-KR", "PT-BR", "CS-CZ", "DA-DK", "NO-NO" + ] + }, + "TTS": { + "capabilities": ["TEXT"], + "language": "EN-US", + "languages": [ + "EN-US", "ES-MX", "FR-CA", "DE-DE", "ES-ES", "EN-GB", "RU-RU", "TR-TR", "PL-PL", "FR-FR", "IT-IT", "SV-SE", "PT-PT", "NL-NL", "ZH-TW", + "JA-JP", "AR-SA", "KO-KR", "PT-BR", "CS-CZ", "DA-DK", "NO-NO" ] }, - "VR": - { - "capabilities":["TEXT"], - "language":"EN-US", - "languages": - [ - "EN-US","ES-MX","FR-CA","DE-DE","ES-ES","EN-GB","RU-RU","TR-TR","PL-PL","FR-FR","IT-IT","SV-SE","PT-PT","NL-NL","ZH-TW", -"JA-JP","AR-SA","KO-KR","PT-BR","CS-CZ","DA-DK","NO-NO" - ] -}, - "TTS": - { - "capabilities":["TEXT"], - "language":"EN-US", - "languages": - [ - "EN-US","ES-MX","FR-CA","DE-DE","ES-ES","EN-GB","RU-RU","TR-TR","PL-PL","FR-FR","IT-IT","SV-SE","PT-PT","NL-NL","ZH-TW", -"JA-JP","AR-SA","KO-KR","PT-BR","CS-CZ","DA-DK","NO-NO" - ] + "Buttons": { + "capabilities": [{ + "name": "PRESET_0", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true + }, + { + "name": "PRESET_1", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true + }, + { + "name": "PRESET_2", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true + }, + { + "name": "PRESET_3", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true + }, + { + "name": "PRESET_4", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true + }, + { + "name": "PRESET_5", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true + }, + { + "name": "PRESET_6", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true + }, + { + "name": "PRESET_7", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true + }, + { + "name": "PRESET_8", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true + }, + { + "name": "PRESET_9", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true + }, + { + "name": "OK", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true + }, + { + "name": "SEEKLEFT", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true + }, + { + "name": "SEEKRIGHT", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true + }, + { + "name": "TUNEUP", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true + }, + { + "name": "TUNEDOWN", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true + } + ], + "presetBankCapabilities": { + "onScreenPresetsAvailable": true + } }, - "Buttons": - { - "capabilities": - [ - { - "name":"PRESET_0", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true - }, - { - "name":"PRESET_1", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true - }, - { - "name":"PRESET_2", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true - }, - { - "name":"PRESET_3", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true - }, - { - "name":"PRESET_4", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true - }, - { - "name":"PRESET_5", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true - }, - { - "name":"PRESET_6", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true - }, - { - "name":"PRESET_7", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true - }, - { - "name":"PRESET_8", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true - }, - { - "name":"PRESET_9", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true - }, - { - "name":"OK", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true - }, - { - "name":"SEEKLEFT", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true - }, - { - "name":"SEEKRIGHT", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true - }, - { - "name":"TUNEUP", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true - }, - { - "name":"TUNEDOWN", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true - } - ], - "presetBankCapabilities": - { - "onScreenPresetsAvailable":true - } + "VehicleInfo": { + "make": "Ford", + "model": "Fiesta", + "modelYear": "2013", + "trim": "SE" }, - "VehicleInfo": - { - "make" :"Ford", - "model" :"Fiesta", - "modelYear" :"2013", - "trim" :"SE" - }, - "SyncMessageVersion": - { - "majorVersion": 3, - "minorVersion": 0 - } + "SyncMessageVersion": { + "majorVersion": 3, + "minorVersion": 0 + } } diff --git a/src/appMain/life_cycle.cc b/src/appMain/life_cycle.cc index 9b4910585f..3bf0e62f87 100644 --- a/src/appMain/life_cycle.cc +++ b/src/appMain/life_cycle.cc @@ -127,6 +127,9 @@ bool LifeCycle::StartComponents() { DCHECK(!hmi_handler_); hmi_handler_ = new hmi_message_handler::HMIMessageHandlerImpl(profile_); + hmi_handler_->set_message_observer(app_manager_); + app_manager_->set_hmi_message_handler(hmi_handler_); + media_manager_ = new media_manager::MediaManagerImpl(*app_manager_, profile_); app_manager_->set_connection_handler(connection_handler_); if (!app_manager_->Init(*last_state_, media_manager_)) { @@ -157,8 +160,6 @@ bool LifeCycle::StartComponents() { transport_manager_->AddEventListener(protocol_handler_); transport_manager_->AddEventListener(connection_handler_); - hmi_handler_->set_message_observer(app_manager_); - protocol_handler_->AddProtocolObserver(media_manager_); protocol_handler_->AddProtocolObserver(app_manager_); @@ -178,7 +179,6 @@ bool LifeCycle::StartComponents() { // It's important to initialise TM after setting up listener chain // [TM -> CH -> AM], otherwise some events from TM could arrive at nowhere app_manager_->set_protocol_handler(protocol_handler_); - app_manager_->set_hmi_message_handler(hmi_handler_); transport_manager_->Init(*last_state_); // start transport manager diff --git a/src/appMain/life_cycle.h b/src/appMain/life_cycle.h index f1b3800254..586711d53e 100644 --- a/src/appMain/life_cycle.h +++ b/src/appMain/life_cycle.h @@ -44,6 +44,10 @@ #include "hmi_message_handler/messagebroker_adapter.h" #endif // #if ( defined (MESSAGEBROKER_HMIADAPTER) || defined(PASA_HMI) ) #include "application_manager/application_manager_impl.h" +#ifdef SDL_REMOTE_CONTROL +#include "application_manager/core_service.h" +#include "functional_module/plugin_manager.h" +#endif // SDL_REMOTE_CONTROL #include "connection_handler/connection_handler_impl.h" #include "protocol_handler/protocol_handler_impl.h" #include "transport_manager/transport_manager.h" diff --git a/src/appMain/sdl_preloaded_pt.json b/src/appMain/sdl_preloaded_pt.json index 10f1303ec7..c4f58c04c2 100644 --- a/src/appMain/sdl_preloaded_pt.json +++ b/src/appMain/sdl_preloaded_pt.json @@ -99,6 +99,12 @@ "FULL",
"LIMITED"]
},
+ "GetSystemCapability": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
"ListFiles": {
"hmi_levels": ["BACKGROUND",
"FULL",
@@ -301,6 +307,34 @@ }
}
},
+ "Notifications-RC": {
+ "rpcs": {
+ "OnHMIStatus": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnPermissionsChange": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnSystemRequest": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ }
+ }
+ },
"DrivingCharacteristics-3": {
"user_consent_prompt": "DrivingCharacteristics",
"rpcs": {
@@ -477,6 +511,36 @@ }
}
},
+ "RemoteControl": {
+ "rpcs": {
+ "ButtonPress": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "GetInteriorVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "SetInteriorVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "OnInteriorVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "SystemRequest": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ }
+ }
+ },
"Emergency-1": {
"rpcs": {
"GetVehicleData": {
@@ -938,6 +1002,16 @@ "hmi_levels": ["BACKGROUND"]
}
}
+ },
+ "HapticGroup": {
+ "rpcs": {
+ "OnTouchEvent": {
+ "hmi_levels": ["FULL"]
+ },
+ "SendHapticData": {
+ "hmi_levels": ["FULL"]
+ }
+ }
}
},
"consumer_friendly_messages": {
@@ -2270,7 +2344,11 @@ "steal_focus": false,
"priority": "NONE",
"default_hmi": "NONE",
- "groups": ["Base-4"]
+ "groups": ["Base-4", "RemoteControl"],
+ "moduleType": [
+ "RADIO",
+ "CLIMATE"
+ ]
},
"device": {
"keep_context": false,
diff --git a/src/appMain/smartDeviceLink.ini b/src/appMain/smartDeviceLink.ini index c5cd4dab8e..4557944048 100644 --- a/src/appMain/smartDeviceLink.ini +++ b/src/appMain/smartDeviceLink.ini @@ -30,6 +30,8 @@ AudioStreamingPort = 5080 ; SDL source version ; represents as a git commit hash value SDLVersion = {GIT_COMMIT} +; SDL supported protocol version +MaxSupportedProtocolVersion = 5 ; All logging event could be dropped by setting $LogsEnabled to false LogsEnabled = true ; Contains .json/.ini files @@ -87,6 +89,7 @@ TimeTestingPort = 8090 ReadDIDRequest = 5, 1 ; Limitation for a number of GetVehicleData requests (the 1st value) per (the 2nd value) seconds GetVehicleDataRequest = 5, 1 +PluginFolder = plugins [MEDIA MANAGER] ; where 3 is a number of retries and 1000 is a timeout in milliseconds for request frequency @@ -213,8 +216,7 @@ ThreadPoolSize = 1 HashStringSize = 32 [SDL4] -; Enables SDL 4.0 support -EnableProtocol4 = true +; Section for features added in protocol version 4 ; Path where apps icons must be stored AppIconsFolder = storage ; Max size of the folder in bytes @@ -222,6 +224,21 @@ AppIconsFolderMaxSize = 104857600 ; Amount of oldest icons to remove in case of max folder size was reached AppIconsAmountToRemove = 1 +[SDL5] +; Section for features added in protocol version 5 +; Control service packet with payload bigger than this value will be marked as a malformed, +; if not specified, this value will default to MaxPayloadSize +;MaximumControlPayloadSize = 131072 +; RPC service packet with payload bigger than this value will be marked as a malformed, +; if not specified, this value will default to MaxPayloadSize +;MaximumRpcPayloadSize = 131072 +; Audio service packet with payload bigger than this value will be marked as a malformed, +; if not specified, this value will default to MaxPayloadSize +;MaximumAudioPayloadSize = 131072 +; Video service packet with payloadbigger than this value will be marked as a malformed, +; if not specified, this value will default to MaxPayloadSize +;MaximumVideoPayloadSize = 131072 + [Resumption] ; Timeout in milliseconds for resumption Application HMILevel ; and resolving conflicts in case if multiple applications initiate resumption @@ -254,4 +271,3 @@ MaxNumberOfiOSDevice = 10 WaitTimeBetweenApps = 4000 ; App Launch on iOS devices SDL feature enabler/disabler EnableAppLaunchIOS = true - diff --git a/src/components/CMakeLists.txt b/src/components/CMakeLists.txt index 0304ce986f..e1071e826f 100644 --- a/src/components/CMakeLists.txt +++ b/src/components/CMakeLists.txt @@ -86,6 +86,12 @@ add_subdirectory(./config_profile) # --- Media Manager add_subdirectory(./media_manager) +if(REMOTE_CONTROL) + # --- CAN Module + add_subdirectory(./remote_control) + # --- Functional module + add_subdirectory(./functional_module) +endif() # --- Telemetry Monitor if(TELEMETRY_MONITOR) add_subdirectory(./telemetry_monitor) diff --git a/src/components/application_manager/CMakeLists.txt b/src/components/application_manager/CMakeLists.txt index 0cfb80ed64..7a49ce6b81 100644 --- a/src/components/application_manager/CMakeLists.txt +++ b/src/components/application_manager/CMakeLists.txt @@ -1,6 +1,9 @@ # Copyright (c) 2016, Ford Motor Company # All rights reserved. # +# Copyright (c) 2017 Xevo Inc. +# All rights reserved. +# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # @@ -12,7 +15,7 @@ # disclaimer in the documentation and/or other materials provided with the # distribution. # -# Neither the name of the Ford Motor Company nor the names of its contributors +# Neither the name of the copyright holders nor the names of their contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # @@ -38,6 +41,7 @@ set (AM_MOCK_DIR ${AM_TEST_DIR}/mock) include_directories ( include/ ${COMPONENTS_DIR} + ${COMPONENTS_DIR}/functional_module/include/ ${COMPONENTS_DIR}/utils/include/ ${COMPONENTS_DIR}/formatters/include/ ${COMPONENTS_DIR}/protocol_handler/include/ @@ -57,6 +61,7 @@ include_directories ( ${ENCRYPTION_INCLUDE_DIRECTORY} ${MESSAGE_BROKER_INCLUDE_DIRECTORY} ${LOG4CXX_INCLUDE_DIRECTORY} + ${BSON_INCLUDE_DIRECTORY} ) if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") @@ -306,6 +311,8 @@ set (HMI_COMMANDS_SOURCES ${COMMANDS_SOURCE_DIR}/hmi/navi_audio_stop_stream_response.cc ${COMMANDS_SOURCE_DIR}/hmi/navi_get_way_points_request.cc ${COMMANDS_SOURCE_DIR}/hmi/navi_get_way_points_response.cc + ${COMMANDS_SOURCE_DIR}/hmi/navi_set_video_config_request.cc + ${COMMANDS_SOURCE_DIR}/hmi/navi_set_video_config_response.cc ${COMMANDS_SOURCE_DIR}/hmi/on_system_request_notification.cc ${COMMANDS_SOURCE_DIR}/hmi/on_put_file_notification.cc ${COMMANDS_SOURCE_DIR}/hmi/on_resume_audio_source_notification.cc @@ -331,6 +338,12 @@ set (HMI_COMMANDS_SOURCES ${COMMANDS_SOURCE_DIR}/hmi/decrypt_certificate_request.cc ${COMMANDS_SOURCE_DIR}/hmi/decrypt_certificate_response.cc ${COMMANDS_SOURCE_DIR}/hmi/ui_set_icon_request.cc + ${COMMANDS_SOURCE_DIR}/hmi/rc_is_ready_request.cc + ${COMMANDS_SOURCE_DIR}/hmi/rc_is_ready_response.cc + ${COMMANDS_SOURCE_DIR}/hmi/rc_get_capabilities_request.cc + ${COMMANDS_SOURCE_DIR}/hmi/rc_get_capabilities_response.cc + ${COMMANDS_SOURCE_DIR}/hmi/ui_send_haptic_data_request.cc + ${COMMANDS_SOURCE_DIR}/hmi/ui_send_haptic_data_response.cc ) set (HMI_COMMANDS_SOURCES_JSON @@ -386,6 +399,11 @@ set(PATHS ) collect_sources(SOURCES "${PATHS}" "${EXCLUDE_PATHS}") +if (NOT REMOTE_CONTROL) + list(REMOVE_ITEM SOURCES + ${COMPONENTS_DIR}/application_manager/src/core_service.cc) +endif() + set(LIBRARIES HMI_API MOBILE_API @@ -397,8 +415,17 @@ set(LIBRARIES formatters dbms Utils + bson -L${BSON_LIBS_DIRECTORY} + emhashmap -L${EMHASHMAP_LIBS_DIRECTORY} ) +if(REMOTE_CONTROL) + SET (LIBRARIES + ${LIBRARIES} + FunctionalModule + ) +endif(REMOTE_CONTROL) + if (CMAKE_SYSTEM_NAME STREQUAL "Linux") list(APPEND LIBRARIES sqlite3) endif () @@ -435,6 +462,7 @@ if(ENABLE_LOG) list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) endif() +add_dependencies("ApplicationManager" libbson) target_link_libraries("ApplicationManager" ${LIBRARIES}) if(BUILD_TESTS) diff --git a/src/components/application_manager/include/application_manager/app_extension.h b/src/components/application_manager/include/application_manager/app_extension.h new file mode 100644 index 0000000000..221601a307 --- /dev/null +++ b/src/components/application_manager/include/application_manager/app_extension.h @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_EXTENSION_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_EXTENSION_H_ + +#include "utils/shared_ptr.h" + +namespace application_manager { + +typedef int AppExtensionUID; + +class AppExtension { + public: + explicit AppExtension(AppExtensionUID uid) : kUid_(uid) {} + virtual ~AppExtension() {} + AppExtensionUID uid() const { + return kUid_; + } + + private: + const AppExtensionUID kUid_; +}; + +typedef utils::SharedPtr<AppExtension> AppExtensionPtr; + +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_EXTENSION_H_ diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h index c523f61329..3a03cb5343 100644 --- a/src/components/application_manager/include/application_manager/application.h +++ b/src/components/application_manager/include/application_manager/application.h @@ -37,10 +37,12 @@ #include <map> #include <set> #include <list> +#include <vector> #include "utils/shared_ptr.h" #include "utils/data_accessor.h" #include "interfaces/MOBILE_API.h" #include "connection_handler/device.h" +#include "application_manager/app_extension.h" #include "application_manager/message.h" #include "application_manager/hmi_state.h" #include "application_manager/application_state.h" @@ -383,7 +385,6 @@ class Application : public virtual InitialApplicationData, public: enum ApplicationRegisterState { kRegistered = 0, kWaitingForRegistration }; - public: Application() : is_greyed_out_(false) {} virtual ~Application() {} @@ -427,6 +428,9 @@ class Application : public virtual InitialApplicationData, virtual bool is_navi() const = 0; virtual void set_is_navi(bool allow) = 0; + virtual void set_mobile_projection_enabled(bool option) = 0; + virtual bool mobile_projection_enabled() const = 0; + virtual bool video_streaming_approved() const = 0; virtual void set_video_streaming_approved(bool state) = 0; virtual bool audio_streaming_approved() const = 0; @@ -438,6 +442,15 @@ class Application : public virtual InitialApplicationData, virtual void set_audio_streaming_allowed(bool state) = 0; /** + * @brief Sends SetVideoConfig request to HMI to configure streaming + * @param service_type Type of streaming service, should be kMobileNav + * @param params parameters of video streaming in key-value format + * @return true if SetVideoConfig is sent, false otherwise + */ + virtual bool SetVideoConfig(protocol_handler::ServiceType service_type, + const smart_objects::SmartObject& params) = 0; + + /** * @brief Starts streaming service for application * @param service_type Type of streaming service */ @@ -539,8 +552,8 @@ class Application : public virtual InitialApplicationData, virtual void set_grammar_id(uint32_t value) = 0; virtual void set_protocol_version( - const ProtocolVersion& protocol_version) = 0; - virtual ProtocolVersion protocol_version() const = 0; + const protocol_handler::MajorProtocolVersion& protocol_version) = 0; + virtual protocol_handler::MajorProtocolVersion protocol_version() const = 0; virtual void set_is_resuming(bool is_resuming) = 0; virtual bool is_resuming() const = 0; @@ -773,6 +786,60 @@ class Application : public virtual InitialApplicationData, */ virtual uint32_t GetAvailableDiskSpace() = 0; +#ifdef SDL_REMOTE_CONTROL + /** + * @brief set_system_context Set system context for application + * @param system_context Current context + */ + virtual void set_system_context( + const mobile_api::SystemContext::eType& system_context) = 0; + + /** + * @brief set_audio_streaming_state Set audio streaming state for application + * @param state Current audio streaming state + */ + virtual void set_audio_streaming_state( + const mobile_api::AudioStreamingState::eType& state) = 0; + + /** + * @brief set_hmi_level Set HMI level for application + * @param hmi_level Current HMI level + */ + virtual void set_hmi_level(const mobile_api::HMILevel::eType& hmi_level) = 0; + + /** + * @brief Return pointer to extension by uid + * @param uid uid of extension + * @return Pointer to extension, if extension was initialized, otherwise NULL + */ + virtual AppExtensionPtr QueryInterface(AppExtensionUID uid) = 0; + + /** + * @brief Add extension to application + * @param extension pointer to extension + * @return true if success, false if extension already initialized + */ + virtual bool AddExtension(AppExtensionPtr extention) = 0; + + /** + * @brief Remove extension from application + * @param uid uid of extension + * @return true if success, false if extension is not present + */ + virtual bool RemoveExtension(AppExtensionUID uid) = 0; + + /** + * @brief Removes all extensions + */ + virtual void RemoveExtensions() = 0; + + /** + * @brief Get list of subscriptions to vehicle info notifications + * @return list of subscriptions to vehicle info notifications + */ + virtual const std::set<uint32_t>& SubscribesIVI() const = 0; +#endif // SDL_REMOTE_CONTROL + protected: mutable sync_primitives::Lock hmi_states_lock_; @@ -787,6 +854,7 @@ class Application : public virtual InitialApplicationData, typedef utils::SharedPtr<Application> ApplicationSharedPtr; typedef utils::SharedPtr<const Application> ApplicationConstSharedPtr; +typedef uint32_t ApplicationId; } // namespace application_manager diff --git a/src/components/application_manager/include/application_manager/application_impl.h b/src/components/application_manager/include/application_manager/application_impl.h index ae63a2f8ae..dc2d8ce528 100644 --- a/src/components/application_manager/include/application_manager/application_impl.h +++ b/src/components/application_manager/include/application_manager/application_impl.h @@ -38,6 +38,7 @@ #include <vector> #include <utility> #include <list> +#include <forward_list> #include <stdint.h> #include "utils/date_time.h" @@ -64,7 +65,8 @@ using namespace timer; namespace mobile_api = mobile_apis; namespace custom_str = custom_string; -class ApplicationImpl : public virtual InitialApplicationDataImpl, +class ApplicationImpl : public virtual Application, + public virtual InitialApplicationDataImpl, public virtual DynamicApplicationDataImpl { public: ApplicationImpl( @@ -96,6 +98,10 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl, } void set_is_navi(bool allow); + void set_mobile_projection_enabled(bool option); + + bool mobile_projection_enabled() const; + bool video_streaming_approved() const; void set_video_streaming_approved(bool state); bool audio_streaming_approved() const; @@ -106,6 +112,8 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl, bool audio_streaming_allowed() const; void set_audio_streaming_allowed(bool state); + bool SetVideoConfig(protocol_handler::ServiceType service_type, + const smart_objects::SmartObject& params); void StartStreaming(protocol_handler::ServiceType service_type); void StopStreamingForce(protocol_handler::ServiceType service_type); void StopStreaming(protocol_handler::ServiceType service_type); @@ -158,8 +166,9 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl, virtual void set_grammar_id(uint32_t value); bool is_audio() const OVERRIDE; - virtual void set_protocol_version(const ProtocolVersion& protocol_version); - virtual ProtocolVersion protocol_version() const; + virtual void set_protocol_version( + const protocol_handler::MajorProtocolVersion& protocol_version); + virtual protocol_handler::MajorProtocolVersion protocol_version() const; virtual void set_is_resuming(bool is_resuming); virtual bool is_resuming() const; @@ -184,7 +193,7 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl, /** * @brief ResetDataInNone reset data counters in NONE */ - virtual void ResetDataInNone(); + virtual void ResetDataInNone() OVERRIDE; virtual DataAccessor<ButtonSubscriptions> SubscribedButtons() const OVERRIDE; @@ -299,6 +308,39 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl, */ uint32_t GetAvailableDiskSpace() OVERRIDE; +#ifdef SDL_REMOTE_CONTROL + /** + * @brief Sets current system context + * @param system_context new system context + */ + void set_system_context( + const mobile_api::SystemContext::eType& system_context) OVERRIDE; + /** + * @brief Sets current audio streaming state + * @param state new audio streaming state + */ + void set_audio_streaming_state( + const mobile_api::AudioStreamingState::eType& state) OVERRIDE; + /** + * @brief Sets current HMI level + * @param hmi_level new HMI level + */ + void set_hmi_level(const mobile_api::HMILevel::eType& hmi_level) OVERRIDE; + + /** + * @brief Get list of subscriptions to vehicle info notifications + * @return list of subscriptions to vehicle info notifications + */ + const std::set<uint32_t>& SubscribesIVI() const OVERRIDE; + + /** + * @brief Return pointer to extension by uid + * @param uid uid of extension + * @return Pointer to extension, if extension was initialized, otherwise NULL + */ + AppExtensionPtr QueryInterface(AppExtensionUID uid) OVERRIDE; +#endif + protected: /** * @brief Clean up application folder. Persistent files will stay @@ -328,6 +370,27 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl, */ void OnAudioStreamSuspend(); +#ifdef SDL_REMOTE_CONTROL + /** + * @brief Add extension to application + * @param extension pointer to extension + * @return true if success, false if extension already initialized + */ + bool AddExtension(AppExtensionPtr extention) OVERRIDE; + + /** + * @brief Remove extension from application + * @param uid uid of extension + * @return true if success, false if extension is not present + */ + bool RemoveExtension(AppExtensionUID uid) OVERRIDE; + + /** + * @brief Removes all extensions + */ + void RemoveExtensions() OVERRIDE; +#endif // SDL_REMOTE_CONTROL + std::string hash_val_; uint32_t grammar_id_; @@ -338,6 +401,7 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl, smart_objects::SmartObject* active_message_; bool is_media_; bool is_navi_; + bool mobile_projection_enabled_; bool video_streaming_approved_; bool audio_streaming_approved_; @@ -365,7 +429,7 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl, std::set<mobile_apis::ButtonName::eType> subscribed_buttons_; VehicleInfoSubscriptions subscribed_vehicle_info_; UsageStatistics usage_report_; - ProtocolVersion protocol_version_; + protocol_handler::MajorProtocolVersion protocol_version_; bool is_voice_communication_application_; sync_primitives::atomic_bool is_resuming_; @@ -376,6 +440,10 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl, Timer video_stream_suspend_timer_; Timer audio_stream_suspend_timer_; +#ifdef SDL_REMOTE_CONTROL + std::list<AppExtensionPtr> extensions_; +#endif // SDL_REMOTE_CONTROL + /** * @brief Defines number per time in seconds limits */ diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h index 0e6f598a9c..7a26501afc 100644 --- a/src/components/application_manager/include/application_manager/application_manager_impl.h +++ b/src/components/application_manager/include/application_manager/application_manager_impl.h @@ -59,6 +59,7 @@ #include "protocol_handler/protocol_handler.h" #include "hmi_message_handler/hmi_message_observer.h" #include "hmi_message_handler/hmi_message_sender.h" +#include "application_manager/policies/policy_handler_interface.h" #include "application_manager/policies/policy_handler_observer.h" #include "connection_handler/connection_handler.h" #include "connection_handler/connection_handler_observer.h" @@ -93,6 +94,8 @@ #include "utils/timer.h" #include "smart_objects/smart_object.h" +struct BsonObject; + namespace threads { class Thread; } @@ -243,10 +246,14 @@ class ApplicationManagerImpl std::vector<ApplicationSharedPtr> applications_by_button( uint32_t button) OVERRIDE; std::vector<ApplicationSharedPtr> applications_with_navi() OVERRIDE; + std::vector<ApplicationSharedPtr> applications_with_mobile_projection() + OVERRIDE; ApplicationSharedPtr get_limited_media_application() const OVERRIDE; ApplicationSharedPtr get_limited_navi_application() const OVERRIDE; ApplicationSharedPtr get_limited_voice_application() const OVERRIDE; + ApplicationSharedPtr get_limited_mobile_projection_application() + const OVERRIDE; uint32_t application_id(const int32_t correlation_id) OVERRIDE; void set_application_id(const int32_t correlation_id, @@ -258,6 +265,40 @@ class ApplicationManagerImpl void SendHMIStatusNotification( const utils::SharedPtr<Application> app) OVERRIDE; + +#ifdef SDL_REMOTE_CONTROL + ApplicationSharedPtr application( + const std::string& device_id, + const std::string& policy_app_id) const OVERRIDE; + + /** + * @brief ChangeAppsHMILevel the function that will change application's + * hmi level. + * + * @param app_id id of the application whose hmi level should be changed. + * + * @param level new hmi level for certain application. + */ + void ChangeAppsHMILevel(uint32_t app_id, mobile_apis::HMILevel::eType level); + + void Erase(ApplicationSharedPtr app_to_remove) { + DCHECK(app_to_remove); + app_to_remove->RemoveExtensions(); + applications_.erase(app_to_remove); + } + + virtual functional_modules::PluginManager& GetPluginManager() OVERRIDE { + return plugin_manager_; + } + + std::vector<std::string> devices( + const std::string& policy_app_id) const OVERRIDE; + + virtual void SendPostMessageToMobile(const MessagePtr& message) OVERRIDE; + + virtual void SendPostMessageToHMI(const MessagePtr& message) OVERRIDE; +#endif // SDL_REMOTE_CONTROL + /** * @brief Checks if application with the same HMI type * (media, voice communication or navi) exists @@ -694,6 +735,12 @@ class ApplicationManagerImpl void OnUpdateHMIAppType( std::map<std::string, std::vector<std::string> > app_hmi_types) OVERRIDE; + /** + * @brief OnPTUFinished is called on policy table update coming + * @param ptu_result True if PTU is succeeded, otherwise - false + */ + void OnPTUFinished(const bool ptu_result) FINAL; + /* * @brief Starts audio pass thru thread * @@ -757,6 +804,9 @@ class ApplicationManagerImpl void SendMessageToHMI(const commands::MessageSharedPtr message) OVERRIDE; + void RemoveHMIFakeParameters( + application_manager::MessagePtr& message) OVERRIDE; + bool ManageMobileCommand(const commands::MessageSharedPtr message, commands::Command::CommandOrigin origin) OVERRIDE; bool ManageHMICommand(const commands::MessageSharedPtr message) OVERRIDE; @@ -788,10 +838,16 @@ class ApplicationManagerImpl void OnFindNewApplicationsRequest() OVERRIDE; void RemoveDevice( const connection_handler::DeviceHandle& device_handle) OVERRIDE; + // DEPRECATED bool OnServiceStartedCallback( const connection_handler::DeviceHandle& device_handle, const int32_t& session_key, const protocol_handler::ServiceType& type) OVERRIDE; + void OnServiceStartedCallback( + const connection_handler::DeviceHandle& device_handle, + const int32_t& session_key, + const protocol_handler::ServiceType& type, + const BsonObject* params) OVERRIDE; void OnServiceEndedCallback( const int32_t& session_key, const protocol_handler::ServiceType& type, @@ -882,6 +938,20 @@ class ApplicationManagerImpl void ForbidStreaming(uint32_t app_id) OVERRIDE; /** + * @brief Called when application completes streaming configuration + * @param app_id Streaming application id + * @param service_type Streaming service type + * @param result true if configuration is successful, false otherwise + * @param rejected_params list of rejected parameters' name. Valid + * only when result is false. + */ + void OnStreamingConfigured( + uint32_t app_id, + protocol_handler::ServiceType service_type, + bool result, + std::vector<std::string>& rejected_params) OVERRIDE; + + /** * @brief Callback calls when application starts/stops data streaming * @param app_id Streaming application id * @param service_type Streaming service type @@ -1082,7 +1152,10 @@ class ApplicationManagerImpl bool operator()(const ApplicationSharedPtr app) const { return app ? handle_ == app->device() && - ProtocolVersion::kV4 == app->protocol_version() + Message::is_sufficient_version( + protocol_handler::MajorProtocolVersion:: + PROTOCOL_VERSION_4, + app->protocol_version()) : false; } }; @@ -1145,6 +1218,11 @@ class ApplicationManagerImpl return is_stopping_; } + /** + * @brief Clears all applications' persistent data + */ + void ClearAppsPersistentData(); + StateController& state_controller() OVERRIDE; const ApplicationManagerSettings& get_settings() const OVERRIDE; virtual event_engine::EventDispatcher& event_dispatcher() OVERRIDE; @@ -1187,6 +1265,10 @@ class ApplicationManagerImpl smart_objects::SmartObject& output); bool ConvertSOtoMessage(const smart_objects::SmartObject& message, Message& output); + + MessageValidationResult ValidateMessageBySchema( + const Message& message) OVERRIDE; + utils::SharedPtr<Message> ConvertRawMsgToMessage( const ::protocol_handler::RawMessagePtr message); @@ -1320,10 +1402,23 @@ class ApplicationManagerImpl * @param service_type Type of service to start * @return True on success, false on fail */ + // DEPRECATED bool StartNaviService(uint32_t app_id, protocol_handler::ServiceType service_type); /** + * @brief Starts specified navi service for application + * @param app_id Application to proceed + * @param service_type Type of service to start + * @param params configuration parameters specified by mobile + * @return True if service is immediately started or configuration + * parameters are sent to HMI, false on other cases + */ + bool StartNaviService(uint32_t app_id, + protocol_handler::ServiceType service_type, + const BsonObject* params); + + /** * @brief Stops specified navi service for application * @param app_id Application to proceed * @param service_type Type of service to stop @@ -1349,7 +1444,7 @@ class ApplicationManagerImpl * @brief Function returns supported SDL Protocol Version * @return protocol version depends on parameters from smartDeviceLink.ini. */ - ProtocolVersion SupportedSDLVersion() const; + protocol_handler::MajorProtocolVersion SupportedSDLVersion() const; /** * @brief Types of directories used by Application Manager @@ -1392,6 +1487,24 @@ class ApplicationManagerImpl void ClearTTSGlobalPropertiesList(); + /** + * @brief Converts BSON object containing video parameters to + * smart object's map object + * @param output the smart object to add video parameters + * @param input BSON object to read parameters from + */ + static void ConvertVideoParamsToSO(smart_objects::SmartObject& output, + const BsonObject* input); + + /** + * @brief Converts rejected parameters' names acquired from HMI to + * SDL protocol's parameter names + * @param list of rejected parameters' names + * @return converted parameters' names + */ + static std::vector<std::string> ConvertRejectedParamList( + const std::vector<std::string>& input); + private: const ApplicationManagerSettings& settings_; /** @@ -1439,6 +1552,28 @@ class ApplicationManagerImpl protocol_handler::ProtocolHandler* protocol_handler_; request_controller::RequestController request_ctrl_; +#ifdef SDL_REMOTE_CONTROL + functional_modules::PluginManager plugin_manager_; + + /** + * @brief Map contains apps with HMI state before incoming call + * After incoming call ends previous HMI state must restore + * + */ + struct AppState { + AppState(const mobile_apis::HMILevel::eType& level, + const mobile_apis::AudioStreamingState::eType& streaming_state, + const mobile_apis::SystemContext::eType& context) + : hmi_level(level) + , audio_streaming_state(streaming_state) + , system_context(context) {} + + mobile_apis::HMILevel::eType hmi_level; + mobile_apis::AudioStreamingState::eType audio_streaming_state; + mobile_apis::SystemContext::eType system_context; + }; +#endif // SDL_REMOTE_CONTROL + hmi_apis::HMI_API* hmi_so_factory_; mobile_apis::MOBILE_API* mobile_so_factory_; @@ -1472,6 +1607,7 @@ class ApplicationManagerImpl HmiInterfacesImpl hmi_interfaces_; NaviServiceStatusMap navi_service_status_; + sync_primitives::Lock navi_service_status_lock_; std::deque<uint32_t> navi_app_to_stop_; std::deque<uint32_t> navi_app_to_end_stream_; uint32_t navi_close_app_timeout_; @@ -1498,6 +1634,18 @@ class ApplicationManagerImpl volatile bool is_stopping_; +#ifdef BUILD_TESTS + public: + /** + * @brief register a mock application without going through the formal + * registration process. Only for unit testing. + * @param mock_app the mock app to be registered + */ + void AddMockApplication(ApplicationSharedPtr mock_app); + + private: +#endif + DISALLOW_COPY_AND_ASSIGN(ApplicationManagerImpl); }; diff --git a/src/components/application_manager/include/application_manager/commands/command_request_impl.h b/src/components/application_manager/include/application_manager/commands/command_request_impl.h index f585410e97..aa3c216d4d 100644 --- a/src/components/application_manager/include/application_manager/commands/command_request_impl.h +++ b/src/components/application_manager/include/application_manager/commands/command_request_impl.h @@ -112,13 +112,36 @@ class CommandRequestImpl : public CommandImpl, public: enum RequestState { kAwaitingHMIResponse = 0, kTimedOut, kCompleted }; + /** + * @brief The HashUpdateMode enum defines whether request has to update + * hash after its execution is finished + */ + enum HashUpdateMode { kSkipHashUpdate, kDoHashUpdate }; + CommandRequestImpl(const MessageSharedPtr& message, ApplicationManager& application_manager); - virtual ~CommandRequestImpl(); - virtual bool CheckPermissions(); - virtual bool Init(); - virtual bool CleanUp(); - virtual void Run(); + + ~CommandRequestImpl(); + + /** + * @brief Checks command permissions according to policy table + */ + bool CheckPermissions() OVERRIDE; + + /** + * @brief Init sets hash update mode for request + */ + bool Init() OVERRIDE; + + /** + * @brief Cleanup all resources used by command + **/ + bool CleanUp() OVERRIDE; + + /** + * @brief Execute corresponding command by calling the action on reciever + **/ + void Run() OVERRIDE; /* * @brief Function is called by RequestController when request execution time @@ -193,6 +216,14 @@ class CommandRequestImpl : public CommandImpl, bool CheckAllowedParameters(); /** + * @brief Checks HMI capabilities for specified button support + * @param button Button to check + * @return true if button is present in HMI capabilities + * otherwise returns false + */ + bool CheckHMICapabilities(const mobile_apis::ButtonName::eType button) const; + + /** * @brief Remove from current message parameters disallowed by policy table */ void RemoveDisallowedParameters(); @@ -271,6 +302,12 @@ class CommandRequestImpl : public CommandImpl, CommandParametersPermissions parameters_permissions_; CommandParametersPermissions removed_parameters_permissions_; + /** + * @brief hash_update_mode_ Defines whether request must update hash value of + * application or not + */ + HashUpdateMode hash_update_mode_; + private: DISALLOW_COPY_AND_ASSIGN(CommandRequestImpl); @@ -292,6 +329,19 @@ class CommandRequestImpl : public CommandImpl, bool ProcessHMIInterfacesAvailability( const uint32_t hmi_correlation_id, const hmi_apis::FunctionID::eType& function_id); + + /** + * @brief UpdateHash updates hash field for application and sends + * OnHashChanged notification to mobile side in case of approriate hash mode + * is set + */ + void UpdateHash(); + + /** + * @brief is_success_result_ Defines whether request succeded, at the moment + * it is value of 'success' field of appropriate response sent to mobile + */ + bool is_success_result_; }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_set_video_config_request.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_set_video_config_request.h new file mode 100644 index 0000000000..0788a5595e --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_set_video_config_request.h @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the names of the copyright holders nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_SET_VIDEO_CONFIG_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_SET_VIDEO_CONFIG_REQUEST_H_ + +#include "application_manager/commands/hmi/request_to_hmi.h" + +namespace application_manager { + +namespace commands { + +/** + * @brief NaviSetVideoConfigRequest command class + **/ +class NaviSetVideoConfigRequest : public RequestToHMI, + public event_engine::EventObserver { + public: + /** + * @brief NaviSetVideoConfigRequest class constructor + * + * @param message Incoming SmartObject message + * @param application_manager Reference of application manager + **/ + NaviSetVideoConfigRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); + + /** + * @brief NaviSetVideoConfigRequest class destructor + **/ + virtual ~NaviSetVideoConfigRequest(); + + /** + * @brief Execute command + **/ + void Run() OVERRIDE; + + /** + * @brief On event callback + **/ + void on_event(const event_engine::Event& event) OVERRIDE; + + /** + * @brief onTimeOut callback + */ + void onTimeOut() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(NaviSetVideoConfigRequest); +}; + +} // namespace commands + +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_SET_VIDEO_CONFIG_REQUEST_H_ diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_set_video_config_response.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_set_video_config_response.h new file mode 100644 index 0000000000..3c53687a93 --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_set_video_config_response.h @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the names of the copyright holders nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_SET_VIDEO_CONFIG_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_SET_VIDEO_CONFIG_RESPONSE_H_ + +#include "application_manager/commands/hmi/response_from_hmi.h" + +namespace application_manager { + +namespace commands { + +/** + * @brief NaviSetVideoConfigResponse command class + **/ +class NaviSetVideoConfigResponse : public ResponseFromHMI { + public: + /** + * @brief NaviSetVideoConfigResponse class constructor + * + * @param message Incoming SmartObject message + * @param application_manager Reference of application manager + **/ + NaviSetVideoConfigResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); + + /** + * @brief NaviSetVideoConfigResponse class destructor + **/ + virtual ~NaviSetVideoConfigResponse(); + + /** + * @brief Execute command + **/ + void Run() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(NaviSetVideoConfigResponse); +}; + +} // namespace commands + +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_SET_VIDEO_CONFIG_RESPONSE_H_ diff --git a/src/components/application_manager/include/application_manager/commands/hmi/rc_get_capabilities_request.h b/src/components/application_manager/include/application_manager/commands/hmi/rc_get_capabilities_request.h new file mode 100644 index 0000000000..58654d81d9 --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/hmi/rc_get_capabilities_request.h @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_RC_GET_CAPABILITIES_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_RC_GET_CAPABILITIES_REQUEST_H_ + +#include "application_manager/commands/hmi/request_to_hmi.h" + +namespace application_manager { + +namespace commands { + +/** + * @brief RCGetCapabilitiesRequest command class + **/ +class RCGetCapabilitiesRequest : public RequestToHMI { + public: + /** + * @brief RCGetCapabilitiesRequest class constructor + * + * @param message Incoming SmartObject message + **/ + RCGetCapabilitiesRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); + + /** + * @brief RCGetCapabilitiesRequest class destructor + **/ + virtual ~RCGetCapabilitiesRequest(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(RCGetCapabilitiesRequest); +}; + +} // namespace commands + +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_RC_GET_CAPABILITIES_REQUEST_H_ diff --git a/src/components/application_manager/include/application_manager/commands/hmi/rc_get_capabilities_response.h b/src/components/application_manager/include/application_manager/commands/hmi/rc_get_capabilities_response.h new file mode 100644 index 0000000000..006f38cbb5 --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/hmi/rc_get_capabilities_response.h @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_RC_GET_CAPABILITIES_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_RC_GET_CAPABILITIES_RESPONSE_H_ + +#include "application_manager/commands/hmi/response_from_hmi.h" + +namespace application_manager { + +namespace commands { + +/** + * @brief RCGetCapabilitiesResponse command class + **/ +class RCGetCapabilitiesResponse : public ResponseFromHMI { + public: + /** + * @brief RCGetCapabilitiesResponse class constructor + * + * @param message Incoming SmartObject message + **/ + RCGetCapabilitiesResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); + + /** + * @brief RCGetCapabilitiesResponse class destructor + **/ + virtual ~RCGetCapabilitiesResponse(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(RCGetCapabilitiesResponse); +}; + +} // namespace commands + +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_RC_GET_CAPABILITIES_RESPONSE_H_ diff --git a/src/components/application_manager/include/application_manager/commands/hmi/rc_is_ready_request.h b/src/components/application_manager/include/application_manager/commands/hmi/rc_is_ready_request.h new file mode 100644 index 0000000000..40e05c2b1f --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/hmi/rc_is_ready_request.h @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_RC_IS_READY_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_RC_IS_READY_REQUEST_H_ + +#include "application_manager/commands/hmi/request_to_hmi.h" +#include "application_manager/message_helper.h" + +namespace application_manager { + +namespace commands { + +/** + * @brief RCIsReadyRequest command class + **/ +class RCIsReadyRequest : public RequestToHMI, + public event_engine::EventObserver { + public: + /** + * @brief RCIsReadyRequest class constructor + * + * @param message Incoming SmartObject message + **/ + RCIsReadyRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); + + /** + * @brief RCIsReadyRequest class destructor + **/ + virtual ~RCIsReadyRequest(); + + /** + * @brief Execute command + **/ + void Run() OVERRIDE; + + /** + * @brief On event callback + **/ + void on_event(const event_engine::Event& event) OVERRIDE; + + /** + * @brief onTimeOut from requrst Controller + */ + void onTimeOut() OVERRIDE; + + /** + * @brief Send request to HMI for fetching of cappabilities + */ + void SendMessageToHMI(); + + private: + DISALLOW_COPY_AND_ASSIGN(RCIsReadyRequest); +}; + +} // namespace commands + +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_RC_IS_READY_REQUEST_H_ diff --git a/src/components/application_manager/include/application_manager/commands/hmi/rc_is_ready_response.h b/src/components/application_manager/include/application_manager/commands/hmi/rc_is_ready_response.h new file mode 100644 index 0000000000..547b89a30d --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/hmi/rc_is_ready_response.h @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_RC_IS_READY_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_RC_IS_READY_RESPONSE_H_ + +#include "application_manager/commands/hmi/response_from_hmi.h" + +namespace application_manager { + +namespace commands { + +/** + * @brief RCIsReadyResponse command class + **/ +class RCIsReadyResponse : public ResponseFromHMI { + public: + /** + * @brief RCIsReadyResponse class constructor + * + * @param message Incoming SmartObject message + **/ + RCIsReadyResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); + + /** + * @brief RCIsReadyResponse class destructor + **/ + virtual ~RCIsReadyResponse(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(RCIsReadyResponse); +}; + +} // namespace commands + +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_RC_IS_READY_RESPONSE_H_ diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_send_haptic_data_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_send_haptic_data_request.h new file mode 100644 index 0000000000..b697176a36 --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_send_haptic_data_request.h @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Xevo Inc. nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_UI_SEND_HAPTIC_DATA_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_UI_SEND_HAPTIC_DATA_REQUEST_H_ + +#include "application_manager/commands/hmi/request_to_hmi.h" + +namespace application_manager { + +namespace commands { + +/** + * @brief UISendHapticDataRequest command class + **/ +class UISendHapticDataRequest : public RequestToHMI { + public: + /** + * @brief UISendHapticDataRequest class constructor + * + * @param message Incoming SmartObject message + * @param application_manager Reference of application manager + **/ + UISendHapticDataRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); + + /** + * @brief UISendHapticDataRequest class destructor + **/ + ~UISendHapticDataRequest() OVERRIDE; + + /** + * @brief Execute command + **/ + void Run() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(UISendHapticDataRequest); +}; + +} // namespace commands + +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_UI_SEND_HAPTIC_DATA_REQUEST_H_ diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_send_haptic_data_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_send_haptic_data_response.h new file mode 100644 index 0000000000..96abe4665d --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_send_haptic_data_response.h @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Xevo Inc. nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_UI_SEND_HAPTIC_DATA_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_UI_SEND_HAPTIC_DATA_RESPONSE_H_ + +#include "application_manager/commands/hmi/response_from_hmi.h" + +namespace application_manager { + +namespace commands { + +/** + * @brief UISendHapticDataResponse command class + **/ +class UISendHapticDataResponse : public ResponseFromHMI { + public: + /** + * @brief UISendHapticDataResponse class constructor + * + * @param message Incoming SmartObject message + * @param application_manager Reference of application manager + **/ + UISendHapticDataResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); + + /** + * @brief UISendHapticDataResponse class destructor + **/ + ~UISendHapticDataResponse() OVERRIDE; + + /** + * @brief Execute command + **/ + void Run() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(UISendHapticDataResponse); +}; + +} // namespace commands + +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_UI_SEND_HAPTIC_DATA_RESPONSE_H_ diff --git a/src/components/application_manager/include/application_manager/commands/mobile/add_command_request.h b/src/components/application_manager/include/application_manager/commands/mobile/add_command_request.h index 854ea7f21f..2aed94c448 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/add_command_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/add_command_request.h @@ -60,25 +60,30 @@ class AddCommandRequest : public CommandRequestImpl { /** * @brief AddCommandRequest class destructor **/ - virtual ~AddCommandRequest(); + ~AddCommandRequest(); /** * @brief Execute command **/ - virtual void Run(); + void Run() FINAL; /** * @brief Interface method that is called whenever new event received * * @param event The received event */ - void on_event(const event_engine::Event& event); + void on_event(const event_engine::Event& event) FINAL; /** * @brief Function is called by RequestController when request execution time * has exceed it's limit */ - virtual void onTimeOut(); + void onTimeOut() FINAL; + + /** + * @brief Init sets hash update mode for request + */ + bool Init() FINAL; private: /* diff --git a/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_request.h b/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_request.h index 10e2628035..36b0b38464 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_request.h @@ -57,19 +57,24 @@ class AddSubMenuRequest : public CommandRequestImpl { /** * @brief AddSubMenuRequest class destructor **/ - virtual ~AddSubMenuRequest(); + ~AddSubMenuRequest(); /** * @brief Execute command **/ - virtual void Run(); + void Run() FINAL; /** * @brief Interface method that is called whenever new event received * * @param event The received event */ - void on_event(const event_engine::Event& event); + void on_event(const event_engine::Event& event) FINAL; + + /** + * @brief Init sets hash update mode for request + */ + bool Init() FINAL; private: /* diff --git a/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h b/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h index 987f773d44..c00d310e7d 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h @@ -64,31 +64,36 @@ class CreateInteractionChoiceSetRequest : public CommandRequestImpl { /** * @brief CreateInteractionChoiceSetRequest class destructor **/ - virtual ~CreateInteractionChoiceSetRequest(); + ~CreateInteractionChoiceSetRequest(); /** * @brief Execute command **/ - virtual void Run(); + void Run() FINAL; /** * @brief Interface method that is called whenever new event received * * @param event The received event */ - virtual void on_event(const event_engine::Event& event); + void on_event(const event_engine::Event& event) FINAL; /** * @brief Function is called by RequestController when request execution time * has exceed it's limit */ - virtual void onTimeOut(); + void onTimeOut() FINAL; + /** - * @brief DeleteChoices allows to walk through the sent commands collection - * in order to sent appropriate DeleteCommand request. + * @brief Init sets hash update mode for request */ + bool Init() FINAL; private: + /** + * @brief DeleteChoices allows to walk through the sent commands collection + * in order to sent appropriate DeleteCommand request. + */ void DeleteChoices(); /** diff --git a/src/components/application_manager/include/application_manager/commands/mobile/delete_command_request.h b/src/components/application_manager/include/application_manager/commands/mobile/delete_command_request.h index 3483aea1d6..afb2e226f6 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/delete_command_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/delete_command_request.h @@ -59,19 +59,24 @@ class DeleteCommandRequest : public CommandRequestImpl { /** * @brief DeleteCommandRequest class destructor **/ - virtual ~DeleteCommandRequest(); + ~DeleteCommandRequest(); /** * @brief Execute command **/ - virtual void Run(); + void Run() FINAL; /** * @brief Interface method that is called whenever new event received * * @param event The received event */ - void on_event(const event_engine::Event& event); + void on_event(const event_engine::Event& event) FINAL; + + /** + * @brief Init sets hash update mode for request + */ + bool Init() FINAL; private: DISALLOW_COPY_AND_ASSIGN(DeleteCommandRequest); diff --git a/src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_request.h b/src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_request.h index 12c80138b4..ead60be1af 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_request.h @@ -58,12 +58,17 @@ class DeleteInteractionChoiceSetRequest : public CommandRequestImpl { /** * @brief DeleteInteractionChoiceSetRequest class destructor **/ - virtual ~DeleteInteractionChoiceSetRequest(); + ~DeleteInteractionChoiceSetRequest(); /** * @brief Execute command **/ - virtual void Run(); + void Run() FINAL; + + /** + * @brief Init sets hash update mode for request + */ + bool Init() FINAL; private: /* diff --git a/src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_request.h b/src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_request.h index b9c27ba294..37863598ac 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_request.h @@ -58,19 +58,24 @@ class DeleteSubMenuRequest : public CommandRequestImpl { /** * @brief DeleteSubMenuRequest class destructor **/ - virtual ~DeleteSubMenuRequest(); + ~DeleteSubMenuRequest(); /** * @brief Execute command **/ - virtual void Run(); + void Run() FINAL; /** * @brief Interface method that is called whenever new event received * * @param event The received event */ - void on_event(const event_engine::Event& event); + void on_event(const event_engine::Event& event) FINAL; + + /** + * @brief Init sets hash update mode for request + */ + bool Init() FINAL; private: /* diff --git a/src/components/application_manager/include/application_manager/commands/mobile/get_system_capability_request.h b/src/components/application_manager/include/application_manager/commands/mobile/get_system_capability_request.h new file mode 100644 index 0000000000..ba55a6b4cd --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/mobile/get_system_capability_request.h @@ -0,0 +1,61 @@ +/* + + Copyright (c) 2013, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_GET_SYSTEM_CAPABILITY_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_GET_SYSTEM_CAPABILITY_REQUEST_H_ + +#include "application_manager/commands/command_request_impl.h" + +namespace application_manager { + +namespace commands { + +class GetSystemCapabilityRequest : public CommandRequestImpl { + public: + GetSystemCapabilityRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); + + virtual ~GetSystemCapabilityRequest(); + + virtual void Run() OVERRIDE; + + virtual void on_event(const event_engine::Event& event); + + private: + DISALLOW_COPY_AND_ASSIGN(GetSystemCapabilityRequest); + +}; // GetSystemCapabilityRequest +} // commands +} // application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_GET_SYSTEM_CAPABILITY_REQUEST_H_
\ No newline at end of file diff --git a/src/components/application_manager/include/application_manager/commands/mobile/get_system_capability_response.h b/src/components/application_manager/include/application_manager/commands/mobile/get_system_capability_response.h new file mode 100644 index 0000000000..9fa6f9b5bb --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/mobile/get_system_capability_response.h @@ -0,0 +1,60 @@ +/* + + Copyright (c) 2013, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_GET_SYSTEM_CAPABILITY_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_GET_SYSTEM_CAPABILITY_RESPONSE_H_ + +#include "application_manager/commands/command_response_impl.h" +#include "utils/macro.h" + +namespace application_manager { + +namespace commands { + +class GetSystemCapabilityResponse : public CommandResponseImpl { + public: + GetSystemCapabilityResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); + + virtual ~GetSystemCapabilityResponse(); + + virtual void Run() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(GetSystemCapabilityResponse); + +}; // GetSystemCapabilityResponse +} // commands +} // application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_GET_SYSTEM_CAPABILITY_RESPONSE_H_
\ No newline at end of file diff --git a/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_request.h b/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_request.h index 49e5fe34ff..eb955df197 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_request.h @@ -58,19 +58,24 @@ class ResetGlobalPropertiesRequest : public CommandRequestImpl { /** * @brief ResetGlobalPropertiesRequest class destructor **/ - virtual ~ResetGlobalPropertiesRequest(); + ~ResetGlobalPropertiesRequest(); /** * @brief Execute command **/ - virtual void Run(); + void Run() FINAL; /** * @brief Interface method that is called whenever new event received * * @param event The received event */ - void on_event(const event_engine::Event& event); + void on_event(const event_engine::Event& event) FINAL; + + /** + * @brief Init sets hash update mode for request + */ + bool Init() FINAL; private: /* diff --git a/src/components/application_manager/include/application_manager/commands/mobile/send_haptic_data_request.h b/src/components/application_manager/include/application_manager/commands/mobile/send_haptic_data_request.h new file mode 100644 index 0000000000..13ed06cce6 --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/mobile/send_haptic_data_request.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Xevo Inc. nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SEND_HAPTIC_DATA_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SEND_HAPTIC_DATA_REQUEST_H_ + +#include <string> +#include "application_manager/commands/command_request_impl.h" +#include "application_manager/application_manager.h" +#include "application_manager/event_engine/event.h" +#include "smart_objects/smart_object.h" + +namespace application_manager { + +namespace commands { + +/** + * @brief SendHapticDataRequest command class + **/ +class SendHapticDataRequest : public CommandRequestImpl { + public: + /** + * @brief SendHapticDataRequest class constructor + * + * @param message Incoming SmartObject message + * @param application_manager Reference of application manager + **/ + SendHapticDataRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); + + /** + * @brief SendHapticDataRequest class destructor + **/ + ~SendHapticDataRequest() OVERRIDE; + + /** + * @brief Execute command + **/ + void Run() OVERRIDE; + + /** + * @brief Interface method that is called whenever new event received + * + * @param event The received event + */ + void on_event(const event_engine::Event& event) OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(SendHapticDataRequest); +}; + +} // namespace commands +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SEND_HAPTIC_DATA_REQUEST_H_ diff --git a/src/components/application_manager/include/application_manager/commands/mobile/send_haptic_data_response.h b/src/components/application_manager/include/application_manager/commands/mobile/send_haptic_data_response.h new file mode 100644 index 0000000000..2a60746c61 --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/mobile/send_haptic_data_response.h @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Xevo Inc. nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SEND_HAPTIC_DATA_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SEND_HAPTIC_DATA_RESPONSE_H_ + +#include "application_manager/commands/command_response_impl.h" + +namespace application_manager { + +namespace commands { + +/** + * @brief SendHapticDataResponse command class + **/ +class SendHapticDataResponse : public CommandResponseImpl { + public: + /** + * @brief SendHapticDataResponse class constructor + * + * @param message Incoming SmartObject message + * @param application_manager Reference of application manager + **/ + SendHapticDataResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); + + /** + * @brief SendHapticDataResponse class destructor + **/ + ~SendHapticDataResponse() OVERRIDE; + + /** + * @brief Execute command + **/ + void Run() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(SendHapticDataResponse); +}; + +} // namespace commands +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SEND_HAPTIC_DATA_RESPONSE_H_ diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_request.h b/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_request.h index 0300245af8..da28d33de8 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_request.h @@ -57,19 +57,24 @@ class SetGlobalPropertiesRequest : public CommandRequestImpl { /** * @brief SetGlobalPropertiesRequest class destructor **/ - virtual ~SetGlobalPropertiesRequest(); + ~SetGlobalPropertiesRequest(); /** * @brief Execute command **/ - virtual void Run(); + void Run() FINAL; /** * @brief Interface method that is called whenever new event received * * @param event The received event */ - void on_event(const event_engine::Event& event); + void on_event(const event_engine::Event& event) FINAL; + + /** + * @brief Init sets hash update mode for request + */ + bool Init() FINAL; private: // Verify correctness VrHelptitle value diff --git a/src/components/application_manager/include/application_manager/commands/mobile/show_request.h b/src/components/application_manager/include/application_manager/commands/mobile/show_request.h index cbe2ca396a..a10997bacd 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/show_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/show_request.h @@ -78,6 +78,17 @@ class ShowRequest : public CommandRequestImpl { */ bool CheckStringsOfShowRequest(); + /** + * @brief Handle the conversion of metadata information from the incoming + * mobile json message format to the outgoing hmi json message format + */ + void HandleMetadata(const char* field_id, + int32_t field_index, + smart_objects::SmartObject& msg_params); + + mobile_apis::Result::eType core_result_code_; + std::string core_response_info_; + DISALLOW_COPY_AND_ASSIGN(ShowRequest); }; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_request.h b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_request.h index b5a22d40a9..cf65e2a6a4 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_request.h @@ -58,12 +58,17 @@ class SubscribeButtonRequest : public CommandRequestImpl { /** * @brief SubscribeButtonRequest class destructor **/ - virtual ~SubscribeButtonRequest(); + ~SubscribeButtonRequest(); /** * @brief Execute command **/ - virtual void Run(); + void Run() FINAL; + + /** + * @brief Init sets hash update mode for request + */ + bool Init() FINAL; private: /** @@ -85,12 +90,6 @@ class SubscribeButtonRequest : public CommandRequestImpl { */ void SendSubscribeButtonNotification(); - /** - * @brief Checks HMI capabilities for specified button support - * @param button Button to check - */ - bool CheckHMICapabilities(mobile_apis::ButtonName::eType button); - DISALLOW_COPY_AND_ASSIGN(SubscribeButtonRequest); }; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h index fb21823b3a..eb360b50d8 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h @@ -58,19 +58,24 @@ class SubscribeVehicleDataRequest : public CommandRequestImpl { /** * @brief SubscribeButtonCommandRequest class destructor **/ - virtual ~SubscribeVehicleDataRequest(); + ~SubscribeVehicleDataRequest(); /** * @brief Execute command **/ - virtual void Run(); + void Run() FINAL; /** * @brief Interface method that is called whenever new event received * * @param event The received event */ - virtual void on_event(const event_engine::Event& event); + void on_event(const event_engine::Event& event) FINAL; + + /** + * @brief Init sets hash update mode for request + */ + bool Init() FINAL; #ifdef HMI_DBUS_API private: diff --git a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_way_points_request.h b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_way_points_request.h index 50b3a6f2cb..f392dd6dd1 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_way_points_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_way_points_request.h @@ -53,18 +53,23 @@ class SubscribeWayPointsRequest : public CommandRequestImpl { /** * \brief SubscribeWayPointsRequest class destructor **/ - virtual ~SubscribeWayPointsRequest(); + ~SubscribeWayPointsRequest(); /** * @brief Execute command **/ - virtual void Run() OVERRIDE; + void Run() FINAL; /** * @brief Interface method that is called whenever new event received * * @param event The received event */ - virtual void on_event(const event_engine::Event& event); + void on_event(const event_engine::Event& event) FINAL; + + /** + * @brief Init sets hash update mode for request + */ + bool Init() FINAL; private: DISALLOW_COPY_AND_ASSIGN(SubscribeWayPointsRequest); diff --git a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_request.h b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_request.h index 62600d51d7..b0206c4407 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_request.h @@ -57,12 +57,17 @@ class UnsubscribeButtonRequest : public CommandRequestImpl { /** * @brief UnsubscribeButtonRequest class destructor **/ - virtual ~UnsubscribeButtonRequest(); + ~UnsubscribeButtonRequest() FINAL; /** * @brief Execute command **/ - virtual void Run(); + void Run() FINAL; + + /** + * @brief Init sets hash update mode for request + */ + bool Init() FINAL; private: /** diff --git a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_request.h b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_request.h index a6bade2fd6..1c7d80797d 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_request.h @@ -58,19 +58,24 @@ class UnsubscribeVehicleDataRequest : public CommandRequestImpl { /** * @brief UnsubscribeVehicleDataRequest class destructor **/ - virtual ~UnsubscribeVehicleDataRequest(); + ~UnsubscribeVehicleDataRequest(); /** * @brief Execute command **/ - virtual void Run(); + void Run() FINAL; /** * @brief Interface method that is called whenever new event received * * @param event The received event */ - virtual void on_event(const event_engine::Event& event); + void on_event(const event_engine::Event& event) FINAL; + + /** + * @brief Init sets hash update mode for request + */ + bool Init() FINAL; #ifdef HMI_DBUS_API private: @@ -103,11 +108,6 @@ class UnsubscribeVehicleDataRequest : public CommandRequestImpl { void AddAlreadyUnsubscribedVI(smart_objects::SmartObject& response) const; /** - * @brief Allows to update hash after sending response to mobile. - */ - void UpdateHash() const; - - /** * @brief VI parameters which still being subscribed by another apps after * particular app had been unsubscribed from these parameters */ diff --git a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_way_points_request.h b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_way_points_request.h index 2831551667..0b5462b7b5 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_way_points_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_way_points_request.h @@ -50,18 +50,24 @@ class UnSubscribeWayPointsRequest : public CommandRequestImpl { /** * \brief UnSubscribeWayPointsRequest class destructor **/ - virtual ~UnSubscribeWayPointsRequest(); + ~UnSubscribeWayPointsRequest(); /** * @brief Execute command **/ - virtual void Run() OVERRIDE; + void Run() FINAL; + /** * @brief Interface method that is called whenever new event received * * @param event The received event */ - virtual void on_event(const event_engine::Event& event); + void on_event(const event_engine::Event& event) FINAL; + + /** + * @brief Init sets hash update mode for request + */ + bool Init() FINAL; private: DISALLOW_COPY_AND_ASSIGN(UnSubscribeWayPointsRequest); diff --git a/src/components/application_manager/include/application_manager/core_service.h b/src/components/application_manager/include/application_manager/core_service.h new file mode 100644 index 0000000000..5e95ecd245 --- /dev/null +++ b/src/components/application_manager/include/application_manager/core_service.h @@ -0,0 +1,214 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_CORE_SERVICE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_CORE_SERVICE_H_ + +#include <string> +#include <vector> +#include "application_manager/service.h" +#include "application_manager/application.h" +#include "policy/policy_types.h" + +namespace Json { +class Value; +} + +namespace application_manager { + +struct CommandParametersPermissions; + +/** + * @brief Class through which the plug-in can interact with the core + */ +class CoreService : public Service { + public: + /** + * @brief CoreService class destructor + */ + explicit CoreService(ApplicationManager& application_manager); + + /** + * @brief CoreService class destructor + */ + virtual ~CoreService(); + + /** + * @brief Checks message permissions and cuts parameters according + * to policy table permissions + * @param msg message to cut disallowed parameters + * @return result according by mobile API + */ + mobile_apis::Result::eType CheckPolicyPermissions(MessagePtr msg) FINAL; + + /** + * Checks if module for application is present in policy table + * @param app_id id of application + * @param module type + * @return true if module is present, otherwise - false + */ + bool CheckModule(const ApplicationId& app_id, + const std::string& module) FINAL; + + /** + * Checks if application has remote control functions + * @param app application + * @return true if application has remote control functions + */ + bool IsRemoteControlApplication(ApplicationSharedPtr app) const FINAL; + + /** + * @brief Gets current state of the specified interface + * @param interface which state to get + * @return true if specified interface available otherwise false + */ + bool IsInterfaceAvailable( + const HmiInterfaces::InterfaceID interface) const FINAL; + + /** + * Removes fake parameters from request to HMI + * @param message message to handle + */ + void RemoveHMIFakeParameters(application_manager::MessagePtr& message) FINAL; + + /** + * @brief Get pointer to application by application id + * @param app_id application id + * return pointer to application + */ + ApplicationSharedPtr GetApplication(ApplicationId app_id) FINAL; + + /** + * @brief Send message to HMI + * @param message Message to HMI + */ + void SendMessageToHMI(const MessagePtr& message) FINAL; + + /** + * @brief Send message to mobile device + * @param message Message to mobile + */ + void SendMessageToMobile(const MessagePtr& message) FINAL; + + /** + * @brief Returns unique correlation ID for next HMI request + * + * @return Unique correlation ID + */ + uint32_t GetNextCorrelationID() FINAL; + + /** + * @brief Returns all applications + * + * @return List with shared pointers to applications + */ + std::vector<ApplicationSharedPtr> GetApplications(AppExtensionUID uid) FINAL; + + /** + * @brief Change hmi level of app and notify it + * @param app Application to be changed and notified + * @param level New HMI level of app + */ + void ChangeNotifyHMILevel(ApplicationSharedPtr app, + mobile_apis::HMILevel::eType level) FINAL; + + const smart_objects::SmartObject* GetRCCapabilities() const FINAL; + /** + * @brief Notify HMI about app changing HMI Level + * only NONE, BACKGROUND and LIMITED levels are sent + * @param app Application to be changed and notified + * @param level New HMI level of app + */ + void NotifyHMIAboutHMILevel(ApplicationSharedPtr app, + mobile_apis::HMILevel::eType level) FINAL; + + /** + * Gets all allowed module types + * @param app_id unique identifier of application + * @param list of allowed module types + * @return true if application has allowed modules + */ + bool GetModuleTypes(const std::string& policy_app_id, + std::vector<std::string>* modules) const FINAL; + + /** + * @brief ValidateMessageBySchema Checks whether message is valid according + * to API + * @param message Message to check + * @return Check result + */ + MessageValidationResult ValidateMessageBySchema(const Message& message) FINAL; + + /** + * @brief Gets application manager settings structure + * @return reference to application manager settings structure + */ + const ApplicationManagerSettings& GetSettings() const FINAL; + + private: + /** + * @brief AreParametersAllowed Checks message parameters across current policy + * permissions + * @param msg Message having parameters + * @param params Parameters sorted by permissions + * @return True if allowed, otherwise - false + */ + bool AreParametersAllowed(MessagePtr msg, + const CommandParametersPermissions& params); + + /** + * @brief CheckParams Checks object params with allowed parameters received + * from policy + * @param object Message object + * @param allowed_params Parameters allowed by policy + * @return True if all parameters allowed, otherwise - false + */ + bool CheckParams(const Json::Value& object, + const policy::RPCParams& allowed_params); + + /** + * @brief IsAllowed Checks particular parameter among allowed list + * @param name Parameter name + * @param allowed_params List of allowed parameters + * @return True if found, otherwise - false + */ + bool IsAllowed(const std::string& name, + const policy::RPCParams& allowed_params); + + ApplicationManager& application_manager_; + + DISALLOW_COPY_AND_ASSIGN(CoreService); +}; + +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_CORE_SERVICE_H_ diff --git a/src/components/application_manager/include/application_manager/hmi_capabilities_impl.h b/src/components/application_manager/include/application_manager/hmi_capabilities_impl.h index 7a85c49027..cbab1fcc80 100644 --- a/src/components/application_manager/include/application_manager/hmi_capabilities_impl.h +++ b/src/components/application_manager/include/application_manager/hmi_capabilities_impl.h @@ -91,6 +91,9 @@ class HMICapabilitiesImpl : public HMICapabilities { bool is_ivi_cooperating() const OVERRIDE; void set_is_ivi_cooperating(const bool value) OVERRIDE; + bool is_rc_cooperating() const OVERRIDE; + void set_is_rc_cooperating(const bool value) OVERRIDE; + /* * @brief Interface used to store information about software version of the *target @@ -407,6 +410,75 @@ class HMICapabilitiesImpl : public HMICapabilities { */ bool phone_call_supported() const OVERRIDE; + /* + * @brief Interface to store whether HMI supports video streaming + * + * @param supported Indicates whether video streaming is supported by HMI + */ + void set_video_streaming_supported(const bool supported) OVERRIDE; + + /* + * @brief Retrieves whether HMI supports video streaming + * + * @return TRUE if it supported, otherwise FALSE + */ + bool video_streaming_supported() const OVERRIDE; + + /* + * @brief Interface used to store information regarding + * the navigation "System Capability" + * + * @param navigation_capability contains information related + * to the navigation system capability. + */ + void set_navigation_capability( + const smart_objects::SmartObject& navigation_capability) OVERRIDE; + + /* + * @brief Retrieves information regarding the navigation system capability + * + * @return NAVIGATION system capability + */ + const smart_objects::SmartObject* navigation_capability() const OVERRIDE; + + /* + * @brief Interface used to store information regarding + * the phone "System Capability" + * + * @param phone_capability contains information related + * to the phone system capability. + */ + void set_phone_capability( + const smart_objects::SmartObject& phone_capability) OVERRIDE; + + /* + * @brief Retrieves information regarding the phone call system capability + * + * @return PHONE_CALL system capability + */ + + const smart_objects::SmartObject* phone_capability() const OVERRIDE; + + /* + * @brief Sets HMI's video streaming related capability information + * + * @param video_streaming_capability the video streaming related capabilities + */ + void set_video_streaming_capability( + const smart_objects::SmartObject& video_streaming_capability) OVERRIDE; + + /* + * @brief Retrieves HMI's video streaming related capabilities + * + * @return HMI's video streaming related capability information + */ + const smart_objects::SmartObject* video_streaming_capability() const OVERRIDE; + + void set_rc_capability( + const smart_objects::SmartObject& rc_capability) OVERRIDE; + + const smart_objects::SmartObject* rc_capability() const OVERRIDE; + void Init(resumption::LastState* last_state) OVERRIDE; /* @@ -462,6 +534,7 @@ class HMICapabilitiesImpl : public HMICapabilities { bool is_ui_cooperating_; bool is_navi_cooperating_; bool is_ivi_cooperating_; + bool is_rc_cooperating_; bool attenuated_supported_; hmi_apis::Common_Language::eType ui_language_; @@ -483,7 +556,12 @@ class HMICapabilitiesImpl : public HMICapabilities { smart_objects::SmartObject* prerecorded_speech_; bool is_navigation_supported_; bool is_phone_call_supported_; + bool is_video_streaming_supported_; std::string ccpu_version_; + smart_objects::SmartObject* navigation_capability_; + smart_objects::SmartObject* phone_capability_; + smart_objects::SmartObject* video_streaming_capability_; + smart_objects::SmartObject* rc_capability_; ApplicationManager& app_mngr_; HMILanguageHandler hmi_language_handler_; diff --git a/src/components/application_manager/include/application_manager/hmi_interfaces.h b/src/components/application_manager/include/application_manager/hmi_interfaces.h index df1e2a9067..59ec32694a 100644 --- a/src/components/application_manager/include/application_manager/hmi_interfaces.h +++ b/src/components/application_manager/include/application_manager/hmi_interfaces.h @@ -59,7 +59,8 @@ class HmiInterfaces { HMI_INTERFACE_UI, HMI_INTERFACE_Navigation, HMI_INTERFACE_VehicleInfo, - HMI_INTERFACE_SDL + HMI_INTERFACE_SDL, + HMI_INTERFACE_RC }; /** diff --git a/src/components/application_manager/include/application_manager/hmi_state.h b/src/components/application_manager/include/application_manager/hmi_state.h index 799fdff67d..939b8b86d0 100644 --- a/src/components/application_manager/include/application_manager/hmi_state.h +++ b/src/components/application_manager/include/application_manager/hmi_state.h @@ -196,6 +196,8 @@ class HmiState { */ bool is_voice_communication_app(const uint32_t app_id) const; + bool is_mobile_projection_app(const uint32_t app_id) const; + private: void operator=(const HmiState&); }; diff --git a/src/components/application_manager/include/application_manager/message.h b/src/components/application_manager/include/application_manager/message.h index fe903393fb..77ef5479ee 100644 --- a/src/components/application_manager/include/application_manager/message.h +++ b/src/components/application_manager/include/application_manager/message.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Ford Motor Company + * Copyright (c) 2017, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,6 +39,7 @@ #include "utils/shared_ptr.h" #include "protocol/message_priority.h" #include "protocol/rpc_type.h" +#include "protocol/common.h" #include "smart_objects/smart_object.h" namespace application_manager { @@ -57,30 +58,24 @@ enum MessageType { // Map PrcType to corresponding MessageType MessageType MessageTypeFromRpcType(protocol_handler::RpcType rpc_type); -enum ProtocolVersion { - kUnknownProtocol = -1, - kHMI = 0, - kV1 = 1, - kV2 = 2, - kV3 = 3, - kV4 = 4 -}; - class Message { public: - Message(protocol_handler::MessagePriority priority); + explicit Message(protocol_handler::MessagePriority priority); Message(const Message& message); Message& operator=(const Message& message); - bool operator==(const Message& message); + bool operator==(const Message& message) const; ~Message(); //! -------------------------------------------------------------------------- int32_t function_id() const; +#ifdef SDL_REMOTE_CONTROL + std::string function_name() const; +#endif // SDL_REMOTE_CONTROL int32_t correlation_id() const; int32_t connection_key() const; MessageType type() const; - ProtocolVersion protocol_version() const; + protocol_handler::MajorProtocolVersion protocol_version() const; const std::string& json_message() const; const BinaryData* binary_data() const; @@ -89,18 +84,26 @@ class Message { size_t payload_size() const; const smart_objects::SmartObject& smart_object() const; - //! -------------------------------------------------------------------------- + //! + //--------------------------------------------------------------------------. void set_function_id(int32_t id); +#ifdef SDL_REMOTE_CONTROL + void set_function_name(const std::string& name); +#endif // SDL_REMOTE_CONTROL void set_correlation_id(int32_t id); void set_connection_key(int32_t key); void set_message_type(MessageType type); void set_binary_data(BinaryData* data); void set_json_message(const std::string& json_message); - void set_protocol_version(ProtocolVersion version); + void set_protocol_version(protocol_handler::MajorProtocolVersion version); void set_smart_object(const smart_objects::SmartObject& object); void set_data_size(size_t data_size); void set_payload_size(size_t payload_size); + static bool is_sufficient_version( + protocol_handler::MajorProtocolVersion minVersion, + protocol_handler::MajorProtocolVersion version); + protocol_handler::MessagePriority Priority() const { return priority_; } @@ -109,6 +112,9 @@ class Message { int32_t function_id_; // @remark protocol V2. int32_t correlation_id_; // @remark protocol V2. MessageType type_; // @remark protocol V2. +#ifdef SDL_REMOTE_CONTROL + std::string function_name_; +#endif // SDL_REMOTE_CONTROL // Pre-calculated message priority, higher priority messages are // Processed first @@ -122,8 +128,11 @@ class Message { BinaryData* binary_data_; size_t data_size_; size_t payload_size_; - ProtocolVersion version_; + protocol_handler::MajorProtocolVersion version_; }; + +typedef utils::SharedPtr<application_manager::Message> MobileMessage; +typedef utils::SharedPtr<application_manager::Message> MessagePtr; } // namespace application_manager #endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_MESSAGE_H_ diff --git a/src/components/application_manager/include/application_manager/message_helper.h b/src/components/application_manager/include/application_manager/message_helper.h index 8d10511d66..c0a3f37c34 100644 --- a/src/components/application_manager/include/application_manager/message_helper.h +++ b/src/components/application_manager/include/application_manager/message_helper.h @@ -381,6 +381,18 @@ class MessageHelper { #endif // EXTERNAL_PROPRIETARY_MODE /* + * @brief Sends SetVideoConfig request to HMI to negotiate video parameters + * + * @param app_id the application which will start video streaming + * @param app_mngr reference of application manager + * @param video_params parameters of video streaming, notified by mobile + */ + static void SendNaviSetVideoConfig( + int32_t app_id, + ApplicationManager& app_mngr, + const smart_objects::SmartObject& video_params); + + /* * @brief Sends notification to HMI to start video streaming * * @param connection_key Application connection key @@ -690,6 +702,31 @@ class MessageHelper { int32_t connection_key, mobile_api::AppInterfaceUnregisteredReason::eType reason); +#ifdef SDL_REMOTE_CONTROL + /** + * @brief Sends HMI status notification to mobile + * @param application_impl application with changed HMI status + **/ + static void SendHMIStatusNotification( + const Application& application_impl, + ApplicationManager& application_manager); + + /** + * @brief SendActivateAppToHMI Sends BasicCommunication.ActivateApp request to + * HMI + * @param app_id Application id + * @param application_manager Application manager + * @param level Application HMI level + * @param send_policy_priority Defines whether to send "priority" field with + * request + */ + static void SendActivateAppToHMI( + uint32_t const app_id, + ApplicationManager& application_manager, + hmi_apis::Common_HMILevel::eType level = hmi_apis::Common_HMILevel::FULL, + bool send_policy_priority = true); +#endif // SDL_REMOTE_CONTROL + private: /** * @brief Creates new request object and fill its header diff --git a/src/components/application_manager/include/application_manager/policies/policy_handler.h b/src/components/application_manager/include/application_manager/policies/policy_handler.h index 0b808b13f5..9de2d6af68 100644 --- a/src/components/application_manager/include/application_manager/policies/policy_handler.h +++ b/src/components/application_manager/include/application_manager/policies/policy_handler.h @@ -112,6 +112,73 @@ class PolicyHandler : public PolicyHandlerInterface, uint32_t GetNotificationsNumber(const std::string& priority) const OVERRIDE; virtual DeviceConsent GetUserConsentForDevice( const std::string& device_id) const OVERRIDE; + +#ifdef SDL_REMOTE_CONTROL + /** + * @brief Sets HMI default type for specified application + * @param application_id ID application + * @param app_types list of HMI types + */ + void SetDefaultHmiTypes(const std::string& application_id, + const smart_objects::SmartObject* app_types) OVERRIDE; + + /** + * Checks if application has HMI type + * @param application_id ID application + * @param hmi HMI type to check + * @param app_types additional list of HMI type to search in it + * @return true if hmi is contained in policy or app_types + */ + bool CheckHMIType(const std::string& application_id, + mobile_apis::AppHMIType::eType hmi, + const smart_objects::SmartObject* app_types) OVERRIDE; + + /** + * Notifies about changing HMI level + * @param device_id unique identifier of device + * @param policy_app_id unique identifier of application in policy + * @param hmi_level default HMI level for this application + */ + void OnUpdateHMILevel(const std::string& device_id, + const std::string& policy_app_id, + const std::string& hmi_level) OVERRIDE; + + /** + * Checks if module for application is present in policy table + * @param app_id id of application + * @param module type + * @return true if module is present, otherwise - false + */ + bool CheckModule(const PTString& app_id, const PTString& module) OVERRIDE; + + /** + * @brief Notifies Remote apps about change in permissions + * @param device_id Device on which app is running + * @param application_id ID of app whose permissions are changed + */ + void OnRemoteAppPermissionsChanged( + const std::string& device_id, const std::string& application_id) OVERRIDE; + + /** + * @brief Notifies Remote apps about change in HMI status + * @param device_id Device on which app is running + * @param policy_app_id ID of application + * @param hmi_level new HMI level for this application + */ + void OnUpdateHMIStatus(const std::string& device_id, + const std::string& policy_app_id, + const std::string& hmi_level) OVERRIDE; + + /** + * Gets all allowed module types + * @param app_id unique identifier of application + * @param list of allowed module types + * @return true if application has allowed modules + */ + bool GetModuleTypes(const std::string& policy_app_id, + std::vector<std::string>* modules) const OVERRIDE; +#endif // SDL_REMOTE_CONTROL + bool GetDefaultHmi(const std::string& policy_app_id, std::string* default_hmi) const OVERRIDE; bool GetInitialAppData(const std::string& application_id, @@ -123,7 +190,17 @@ class PolicyHandler : public PolicyHandlerInterface, EndpointUrls& out_end_points) OVERRIDE; virtual std::string GetLockScreenIconUrl() const OVERRIDE; uint32_t NextRetryTimeout() OVERRIDE; + + /** + * Gets timeout to wait until receive response + * @return timeout in seconds + */ uint32_t TimeoutExchangeSec() const OVERRIDE; + + /** + * Gets timeout to wait until receive response + * @return timeout in miliseconds + */ uint32_t TimeoutExchangeMSec() const OVERRIDE; void OnExceededTimeout() OVERRIDE; void OnSystemReady() OVERRIDE; @@ -348,7 +425,8 @@ class PolicyHandler : public PolicyHandlerInterface, * @brief Allows to add new or update existed application during * registration process * @param application_id The policy aplication id. - ** @return function that will notify update manager about new application + * @param hmi_types list of hmi types + * @return function that will notify update manager about new application */ StatusNotifier AddApplication( const std::string& application_id, @@ -506,6 +584,18 @@ class PolicyHandler : public PolicyHandlerInterface, PermissionConsent& out_permissions) OVERRIDE; #endif +#ifdef SDL_REMOTE_CONTROL + /** + * @brief Updates HMI level for specified application and send notification + * @param app application where HMI level was changed + * @param level new HMI level + */ + void UpdateHMILevel(application_manager::ApplicationSharedPtr app, + mobile_apis::HMILevel::eType level); + std::vector<std::string> GetDevicesIds( + const std::string& policy_app_id) OVERRIDE; +#endif // SDL_REMOTE_CONTROL + /** * @brief Sets days after epoch on successful policy update */ @@ -644,7 +734,6 @@ class PolicyHandler : public PolicyHandlerInterface, * otherwise FALSE */ bool IsUrlAppIdValid(const uint32_t app_idx, const EndpointUrls& urls) const; - DISALLOW_COPY_AND_ASSIGN(PolicyHandler); }; diff --git a/src/components/application_manager/include/application_manager/service.h b/src/components/application_manager/include/application_manager/service.h new file mode 100644 index 0000000000..da08957afa --- /dev/null +++ b/src/components/application_manager/include/application_manager/service.h @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2017, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_SERVICE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_SERVICE_H_ + +#include <string> +#include <sstream> +#include <vector> +#include "application_manager/application.h" +#include "application_manager/application_manager_settings.h" +#include "application_manager/message.h" +#include "application_manager/hmi_interfaces.h" + +namespace application_manager { + +enum TypeAccess { kDisallowed, kAllowed }; + +enum MessageValidationResult { + SUCCESS = 0, + INVALID_JSON, + INVALID_METADATA, + SCHEMA_MISMATCH, + UNSUPPORTED_PROTOCOL +}; + +typedef std::string PluginFunctionID; + +/** + * @brief Interface to core service + */ +class Service { + public: + virtual ~Service() {} + + /** + * @brief Checks message permissions and cuts parameters according + * to policy table permissions + * @param msg message to cut disallowed parameters + * @return result according by mobile API + */ + virtual mobile_apis::Result::eType CheckPolicyPermissions(MessagePtr msg) = 0; + + /** + * Checks if module for application is present in policy table + * @param app_id id of application + * @param module type + * @return true if module is present, otherwise - false + */ + virtual bool CheckModule(const ApplicationId& app_id, + const std::string& module) = 0; + + /** + * @brief Get pointer to application by application id + * @param app_id application id + * return pointer to application + */ + virtual ApplicationSharedPtr GetApplication(ApplicationId app_id) = 0; + + /** + * Removes parameters not listed in HMI API from HMI request + * @param message message to handle + */ + virtual void RemoveHMIFakeParameters( + application_manager::MessagePtr& message) = 0; + /** + * @brief Send message to HMI + * @param message Message to HMI + */ + virtual void SendMessageToHMI(const MessagePtr& message) = 0; + + /** + * @brief Send message to mobile device + * @param message Message to mobile + */ + virtual void SendMessageToMobile(const MessagePtr& message) = 0; + + /** + * @brief Returns unique correlation ID for next HMI request + * + * @return Unique correlation ID + */ + virtual uint32_t GetNextCorrelationID() = 0; + + /** + * @brief Returns all applications related to plugin + * @param uid ID provided by plugin to its extension to app. + * @return List with shared pointers to applications + */ + virtual std::vector<ApplicationSharedPtr> GetApplications( + AppExtensionUID uid) = 0; + + /** + * @brief Change hmi level of app and notify it + * @param app Application to be changed and notified + * @param level New HMI level of app + */ + virtual void ChangeNotifyHMILevel(ApplicationSharedPtr app, + mobile_apis::HMILevel::eType level) = 0; + + /** + * @brief Notify HMI about app changing HMI Level + * only NONE, BACKGROUND and LIMITED levels are sent + * @param app Application to be changed and notified + * @param level New HMI level of app + */ + virtual void NotifyHMIAboutHMILevel(ApplicationSharedPtr app, + mobile_apis::HMILevel::eType level) = 0; + + virtual const smart_objects::SmartObject* GetRCCapabilities() const = 0; + /** + * Checks if application has remote control functions + * @param app application + * @return true if application has remote control functions + */ + virtual bool IsRemoteControlApplication(ApplicationSharedPtr app) const = 0; + + /** + * @brief Gets current state of the specified interface + * @param interface which state to get + * @return true if specified interface available otherwise false + */ + virtual bool IsInterfaceAvailable( + const HmiInterfaces::InterfaceID interface) const = 0; + + /** + * Gets all allowed module types + * @param app_id unique identifier of application + * @param list of allowed module types + * @return true if application has allowed modules + */ + virtual bool GetModuleTypes(const std::string& policy_app_id, + std::vector<std::string>* modules) const = 0; + + /** + * @brief ValidateMessageBySchema validates message by xml schema + * @param message message for validation + * @return true if message is valid according to schema, otherwise false + */ + virtual MessageValidationResult ValidateMessageBySchema( + const Message& message) = 0; + + /** + * @brief Gets application manager settings structure + * @return reference to application manager settings structure + */ + virtual const ApplicationManagerSettings& GetSettings() const = 0; +}; + +typedef utils::SharedPtr<Service> ServicePtr; + +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_SERVICE_H_ diff --git a/src/components/application_manager/include/application_manager/smart_object_keys.h b/src/components/application_manager/include/application_manager/smart_object_keys.h index 38c1b1d9cc..25fa435364 100644 --- a/src/components/application_manager/include/application_manager/smart_object_keys.h +++ b/src/components/application_manager/include/application_manager/smart_object_keys.h @@ -2,6 +2,9 @@ Copyright (c) 2013, Ford Motor Company All rights reserved. + Copyright (c) 2017 Xevo Inc. + All rights reserved. + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -13,7 +16,7 @@ disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of the Ford Motor Company nor the names of its contributors + Neither the name of the copyright holders nor the names of their contributors may be used to endorse or promote products derived from this software without specific prior written permission. @@ -90,6 +93,7 @@ extern const char* main_field_1; extern const char* main_field_2; extern const char* main_field_3; extern const char* main_field_4; +extern const char* metadata_tags; extern const char* eta; extern const char* time_to_destination; extern const char* total_distance; @@ -167,6 +171,13 @@ extern const char* audio_pass_thru_capabilities; extern const char* pcm_stream_capabilities; extern const char* audio_pass_thru_icon; extern const char* way_points; +extern const char* system_capability; +extern const char* system_capability_type; +extern const char* system_capabilities; +extern const char* navigation_capability; +extern const char* phone_capability; +extern const char* video_streaming_capability; +extern const char* rc_capability; // PutFile extern const char* sync_file_name; @@ -258,6 +269,7 @@ extern const char* supported_diag_modes; extern const char* hmi_capabilities; extern const char* navigation; extern const char* phone_call; +extern const char* video_streaming; extern const char* sdl_version; extern const char* system_software_version; extern const char* priority; @@ -332,6 +344,22 @@ extern const char* const status; extern const char* const external_consent_status; extern const char* const consented_functions; extern const char* const source; +extern const char* const config; +extern const char* const protocol; +extern const char* const codec; +extern const char* const width; +extern const char* const height; +extern const char* const rejected_params; +extern const char* const preferred_resolution; +extern const char* const resolution_width; +extern const char* const resolution_height; +extern const char* const max_bitrate; +extern const char* const supported_formats; +extern const char* const haptic_spatial_data_supported; +extern const char* const haptic_rect_data; +extern const char* const rect; +extern const char* const x; +extern const char* const y; } // namespace strings namespace json { @@ -383,6 +411,7 @@ namespace hmi_request { extern const char* parent_id; extern const char* field_name; extern const char* field_text; +extern const char* field_types; extern const char* alert_strings; extern const char* duration; extern const char* soft_buttons; diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc index 5f9c4386f5..4a752febf8 100644 --- a/src/components/application_manager/src/application_impl.cc +++ b/src/components/application_manager/src/application_impl.cc @@ -88,6 +88,7 @@ ApplicationImpl::ApplicationImpl( , active_message_(NULL) , is_media_(false) , is_navi_(false) + , mobile_projection_enabled_(false) , video_streaming_approved_(false) , audio_streaming_approved_(false) , video_streaming_allowed_(false) @@ -106,7 +107,8 @@ ApplicationImpl::ApplicationImpl( , device_(0) , mac_address_(mac_address) , usage_report_(mobile_app_id, statistics_manager) - , protocol_version_(ProtocolVersion::kV3) + , protocol_version_( + protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3) , is_voice_communication_application_(false) , is_resuming_(false) , video_stream_retry_number_(0) @@ -179,6 +181,7 @@ bool ApplicationImpl::is_audio() const { void ApplicationImpl::ChangeSupportingAppHMIType() { is_navi_ = false; is_voice_communication_application_ = false; + mobile_projection_enabled_ = false; const smart_objects::SmartObject& array_app_types = *app_types_; uint32_t lenght_app_types = array_app_types.length(); @@ -193,6 +196,11 @@ void ApplicationImpl::ChangeSupportingAppHMIType() { array_app_types[i].asUInt())) { is_voice_communication_application_ = true; } + if (mobile_apis::AppHMIType::PROJECTION == + static_cast<mobile_apis::AppHMIType::eType>( + array_app_types[i].asUInt())) { + mobile_projection_enabled_ = true; + } } } @@ -228,6 +236,15 @@ void ApplicationImpl::SetPostponedState(HmiStatePtr state) { state_.AddState(state); } +void ApplicationImpl::set_mobile_projection_enabled(bool option) { + LOG4CXX_AUTO_TRACE(logger_); + mobile_projection_enabled_ = option; +} + +bool ApplicationImpl::mobile_projection_enabled() const { + return mobile_projection_enabled_; +} + struct StateIDComparator { HmiState::StateID state_id_; StateIDComparator(HmiState::StateID state_id) : state_id_(state_id) {} @@ -399,6 +416,24 @@ bool ApplicationImpl::audio_streaming_allowed() const { return audio_streaming_allowed_; } +bool ApplicationImpl::SetVideoConfig(protocol_handler::ServiceType service_type, + const smart_objects::SmartObject& params) { + using namespace protocol_handler; + LOG4CXX_AUTO_TRACE(logger_); + + if (ServiceType::kMobileNav == service_type) { + // See StartStreaming(). We issue SetVideoConfig and StartStream + // only when streaming is not approved yet + if (!video_streaming_approved()) { + LOG4CXX_TRACE(logger_, "Video streaming not approved"); + MessageHelper::SendNaviSetVideoConfig( + app_id(), application_manager_, params); + return true; + } + } + return false; +} + void ApplicationImpl::StartStreaming( protocol_handler::ServiceType service_type) { using namespace protocol_handler; @@ -601,11 +636,12 @@ bool ApplicationImpl::set_activated(bool is_active) { } void ApplicationImpl::set_protocol_version( - const ProtocolVersion& protocol_version) { + const protocol_handler::MajorProtocolVersion& protocol_version) { protocol_version_ = protocol_version; } -ProtocolVersion ApplicationImpl::protocol_version() const { +protocol_handler::MajorProtocolVersion ApplicationImpl::protocol_version() + const { return protocol_version_; } @@ -972,4 +1008,81 @@ void ApplicationImpl::UnsubscribeFromSoftButtons(int32_t cmd_id) { } } +#ifdef SDL_REMOTE_CONTROL + +void ApplicationImpl::set_system_context( + const mobile_api::SystemContext::eType& system_context) { + const HmiStatePtr hmi_state = CurrentHmiState(); + hmi_state->set_system_context(system_context); +} + +void ApplicationImpl::set_audio_streaming_state( + const mobile_api::AudioStreamingState::eType& state) { + if (!(is_media_application() || is_navi()) && + state != mobile_api::AudioStreamingState::NOT_AUDIBLE) { + LOG4CXX_WARN(logger_, + "Trying to set audio streaming state" + " for non-media application to different from NOT_AUDIBLE"); + return; + } + CurrentHmiState()->set_audio_streaming_state(state); +} + +void ApplicationImpl::set_hmi_level( + const mobile_api::HMILevel::eType& new_hmi_level) { + using namespace mobile_apis; + const HMILevel::eType current_hmi_level = hmi_level(); + if (HMILevel::HMI_NONE != current_hmi_level && + HMILevel::HMI_NONE == new_hmi_level) { + put_file_in_none_count_ = 0; + delete_file_in_none_count_ = 0; + list_files_in_none_count_ = 0; + } + ApplicationSharedPtr app = application_manager_.application(app_id()); + DCHECK_OR_RETURN_VOID(app) + application_manager_.state_controller().SetRegularState(app, new_hmi_level); + LOG4CXX_INFO(logger_, "hmi_level = " << new_hmi_level); + usage_report_.RecordHmiStateChanged(new_hmi_level); +} + +const std::set<uint32_t>& ApplicationImpl::SubscribesIVI() const { + return subscribed_vehicle_info_; +} + +AppExtensionPtr ApplicationImpl::QueryInterface(AppExtensionUID uid) { + std::list<AppExtensionPtr>::const_iterator it = extensions_.begin(); + for (; it != extensions_.end(); ++it) { + if ((*it)->uid() == uid) { + return (*it); + } + } + + return AppExtensionPtr(); +} + +bool ApplicationImpl::AddExtension(AppExtensionPtr extension) { + if (!QueryInterface(extension->uid())) { + extensions_.push_back(extension); + return true; + } + return false; +} + +bool ApplicationImpl::RemoveExtension(AppExtensionUID uid) { + for (std::list<AppExtensionPtr>::iterator it = extensions_.begin(); + extensions_.end() != it; + ++it) { + if ((*it)->uid() == uid) { + extensions_.erase(it); + return true; + } + } + return false; +} + +void ApplicationImpl::RemoveExtensions() { + application_manager_.GetPluginManager().RemoveAppExtension(app_id_); +} +#endif // SDL_REMOTE_CONTROL + } // namespace application_manager diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 097abc4645..ab20222fcf 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -36,6 +36,7 @@ #include <string> #include <fstream> #include <utility> +#include <bson_object.h> #include "application_manager/application_manager_impl.h" #include "application_manager/mobile_command_factory.h" @@ -55,6 +56,7 @@ #include "formatters/formatter_json_rpc.h" #include "formatters/CFormatterJsonSDLRPCv2.h" #include "formatters/CFormatterJsonSDLRPCv1.h" +#include "protocol/bson_object_keys.h" #include "utils/threads/thread.h" #include "utils/file_system.h" @@ -69,6 +71,12 @@ #include "utils/custom_string.h" #include <time.h> +#ifdef SDL_REMOTE_CONTROL +#include "policy/usage_statistics/counter.h" +#include "functional_module/plugin_manager.h" +#include "application_manager/core_service.h" +#endif // SDL_REMOTE_CONTROL + namespace { int get_rand_from_range(uint32_t from = 0, int to = RAND_MAX) { return std::rand() % to + from; @@ -291,6 +299,29 @@ ApplicationManagerImpl::applications_with_navi() { DataAccessor<ApplicationSet> accessor = applications(); return FindAllApps(accessor, NaviAppPredicate); } + +bool LimitedMobileProjectionPredicate(const ApplicationSharedPtr app) { + return app ? (app->mobile_projection_enabled() && + app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED) + : false; +} + +ApplicationSharedPtr +ApplicationManagerImpl::get_limited_mobile_projection_application() const { + DataAccessor<ApplicationSet> accessor = applications(); + return FindApp(accessor, LimitedMobileProjectionPredicate); +} + +bool MobileProjectionPredicate(const ApplicationSharedPtr app) { + return app ? app->mobile_projection_enabled() : false; +} + +std::vector<ApplicationSharedPtr> +ApplicationManagerImpl::applications_with_mobile_projection() { + DataAccessor<ApplicationSet> accessor = applications(); + return FindAllApps(accessor, MobileProjectionPredicate); +} + std::vector<ApplicationSharedPtr> ApplicationManagerImpl::applications_by_button(uint32_t button) { SubscribedToButtonPredicate finder( @@ -308,6 +339,20 @@ struct SubscribedToIVIPredicate { } }; +struct IsApplication { + IsApplication(connection_handler::DeviceHandle device_handle, + const std::string& policy_app_id) + : device_handle_(device_handle), policy_app_id_(policy_app_id) {} + bool operator()(const ApplicationSharedPtr app) const { + return app && app->device() == device_handle_ && + app->policy_app_id() == policy_app_id_; + } + + private: + connection_handler::DeviceHandle device_handle_; + const std::string& policy_app_id_; +}; + std::vector<ApplicationSharedPtr> ApplicationManagerImpl::IviInfoUpdated( VehicleDataType vehicle_info, int value) { // Notify Policy Manager if available about info it's interested in, @@ -353,6 +398,7 @@ bool ApplicationManagerImpl::IsAppTypeExistsInFullOrLimited( bool voice_state = app->is_voice_communication_supported(); bool media_state = app->is_media_application(); bool navi_state = app->is_navi(); + bool mobile_projection_state = app->mobile_projection_enabled(); ApplicationSharedPtr active_app = active_application(); // Check app in FULL level if (active_app.valid()) { @@ -374,6 +420,10 @@ bool ApplicationManagerImpl::IsAppTypeExistsInFullOrLimited( if (navi_state && active_app->is_navi()) { return true; } + + if (mobile_projection_state && active_app->mobile_projection_enabled()) { + return true; + } } // Check LIMITED apps @@ -398,6 +448,14 @@ bool ApplicationManagerImpl::IsAppTypeExistsInFullOrLimited( } } + if (mobile_projection_state) { + if (get_limited_mobile_projection_application().valid() && + (get_limited_mobile_projection_application()->app_id() != + app->app_id())) { + return true; + } + } + return false; } @@ -510,15 +568,18 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( version.max_supported_api_version = static_cast<APIVersion>(max_version); application->set_version(version); - ProtocolVersion protocol_version = static_cast<ProtocolVersion>( - message[strings::params][strings::protocol_version].asInt()); + protocol_handler::MajorProtocolVersion protocol_version = + static_cast<protocol_handler::MajorProtocolVersion>( + message[strings::params][strings::protocol_version].asInt()); application->set_protocol_version(protocol_version); - if (ProtocolVersion::kUnknownProtocol != protocol_version) { + if (protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_UNKNOWN != + protocol_version) { connection_handler().BindProtocolVersionWithSession( connection_key, static_cast<uint8_t>(protocol_version)); } - if ((protocol_version == ProtocolVersion::kV3) && + if ((protocol_version == + protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3) && (get_settings().heart_beat_timeout() != 0)) { connection_handler().StartSessionHeartBeat(connection_key); } @@ -664,6 +725,13 @@ void ApplicationManagerImpl::OnHMIStartedCooperation() { hmi_apis::FunctionID::VehicleInfo_IsReady, *this)); ManageHMICommand(is_ivi_ready); +#ifdef SDL_REMOTE_CONTROL + utils::SharedPtr<smart_objects::SmartObject> is_rc_ready( + MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::RC_IsReady, + *this)); + ManageHMICommand(is_rc_ready); +#endif + utils::SharedPtr<smart_objects::SmartObject> button_capabilities( MessageHelper::CreateModuleInfoSO( hmi_apis::FunctionID::Buttons_GetCapabilities, *this)); @@ -1098,6 +1166,7 @@ void ApplicationManagerImpl::ReplaceHMIByMobileAppId( } } +// DEPRECATED bool ApplicationManagerImpl::StartNaviService( uint32_t app_id, protocol_handler::ServiceType service_type) { using namespace protocol_handler; @@ -1130,20 +1199,118 @@ bool ApplicationManagerImpl::StartNaviService( return false; } +bool ApplicationManagerImpl::StartNaviService( + uint32_t app_id, + protocol_handler::ServiceType service_type, + const BsonObject* params) { + using namespace protocol_handler; + LOG4CXX_AUTO_TRACE(logger_); + + if (HMILevelAllowsStreaming(app_id, service_type)) { + { + sync_primitives::AutoLock lock(navi_service_status_lock_); + + NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); + if (navi_service_status_.end() == it) { + std::pair<NaviServiceStatusMap::iterator, bool> res = + navi_service_status_.insert( + std::pair<uint32_t, std::pair<bool, bool> >( + app_id, std::make_pair(false, false))); + if (!res.second) { + LOG4CXX_WARN(logger_, "Navi service refused"); + return false; + } + it = res.first; + } + } + + if (service_type == ServiceType::kMobileNav) { + smart_objects::SmartObject converted_params(smart_objects::SmartType_Map); + ConvertVideoParamsToSO(converted_params, params); + + if (!converted_params.empty()) { + LOG4CXX_INFO(logger_, "Sending video configuration params"); +#ifdef DEBUG + MessageHelper::PrintSmartObject(converted_params); +#endif + bool request_sent = + application(app_id)->SetVideoConfig(service_type, converted_params); + if (request_sent) { + return true; + } + } + } + // no configuration is needed, or SetVideoConfig is not sent + std::vector<std::string> empty; + OnStreamingConfigured(app_id, service_type, true, empty); + return true; + + } else { + LOG4CXX_WARN(logger_, "Refused navi service by HMI level"); + } + return false; +} + +void ApplicationManagerImpl::OnStreamingConfigured( + uint32_t app_id, + protocol_handler::ServiceType service_type, + bool result, + std::vector<std::string>& rejected_params) { + using namespace protocol_handler; + LOG4CXX_AUTO_TRACE(logger_); + + LOG4CXX_INFO(logger_, + "OnStreamingConfigured called for service " + << service_type << ", result=" << result); + + if (result) { + std::vector<std::string> empty; + { + sync_primitives::AutoLock lock(navi_service_status_lock_); + + NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); + if (navi_service_status_.end() == it) { + LOG4CXX_WARN(logger_, "Application not found in navi status map"); + connection_handler().NotifyServiceStartedResult(app_id, false, empty); + return; + } + + // Fill NaviServices map. Set true to first value of pair if + // we've started video service or to second value if we've + // started audio service + service_type == ServiceType::kMobileNav ? it->second.first = true + : it->second.second = true; + } + + application(app_id)->StartStreaming(service_type); + connection_handler().NotifyServiceStartedResult(app_id, true, empty); + } else { + std::vector<std::string> converted_params = + ConvertRejectedParamList(rejected_params); + connection_handler().NotifyServiceStartedResult( + app_id, false, converted_params); + } +} + void ApplicationManagerImpl::StopNaviService( uint32_t app_id, protocol_handler::ServiceType service_type) { using namespace protocol_handler; LOG4CXX_AUTO_TRACE(logger_); - NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); - if (navi_service_status_.end() == it) { - LOG4CXX_WARN(logger_, "No Information about navi service " << service_type); - } else { - // Fill NaviServices map. Set false to first value of pair if - // we've stopped video service or to second value if we've - // stopped audio service - service_type == ServiceType::kMobileNav ? it->second.first = false - : it->second.second = false; + { + sync_primitives::AutoLock lock(navi_service_status_lock_); + + NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); + if (navi_service_status_.end() == it) { + LOG4CXX_WARN(logger_, + "No Information about navi service " << service_type); + } else { + // Fill NaviServices map. Set false to first value of pair if + // we've stopped video service or to second value if we've + // stopped audio service + service_type == ServiceType::kMobileNav ? it->second.first = false + : it->second.second = false; + } } ApplicationSharedPtr app = application(app_id); @@ -1155,6 +1322,7 @@ void ApplicationManagerImpl::StopNaviService( app->StopStreaming(service_type); } +// DEPRECATED bool ApplicationManagerImpl::OnServiceStartedCallback( const connection_handler::DeviceHandle& device_handle, const int32_t& session_key, @@ -1191,6 +1359,50 @@ bool ApplicationManagerImpl::OnServiceStartedCallback( return false; } +void ApplicationManagerImpl::OnServiceStartedCallback( + const connection_handler::DeviceHandle& device_handle, + const int32_t& session_key, + const protocol_handler::ServiceType& type, + const BsonObject* params) { + using namespace helpers; + using namespace protocol_handler; + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, + "ServiceType = " << type << ". Session = " << std::hex + << session_key); + std::vector<std::string> empty; + + if (type == kRpc) { + LOG4CXX_DEBUG(logger_, "RPC service is about to be started."); + connection_handler().NotifyServiceStartedResult(session_key, true, empty); + return; + } + ApplicationSharedPtr app = application(session_key); + if (!app) { + LOG4CXX_WARN(logger_, + "The application with id:" << session_key + << " doesn't exists."); + connection_handler().NotifyServiceStartedResult(session_key, false, empty); + return; + } + + if (Compare<ServiceType, EQ, ONE>( + type, ServiceType::kMobileNav, ServiceType::kAudio)) { + if (app->is_navi() || app->mobile_projection_enabled()) { + if (!StartNaviService(session_key, type, params)) { + connection_handler().NotifyServiceStartedResult( + session_key, false, empty); + } + return; + } else { + LOG4CXX_WARN(logger_, "Refuse not navi/projection application"); + } + } else { + LOG4CXX_WARN(logger_, "Refuse unknown service"); + } + connection_handler().NotifyServiceStartedResult(session_key, false, empty); +} + void ApplicationManagerImpl::OnServiceEndedCallback( const int32_t& session_key, const protocol_handler::ServiceType& type, @@ -1356,7 +1568,7 @@ void ApplicationManagerImpl::SendMessageToMobile( ((*message)[strings::msg_params][strings::result_code] == NsSmartDeviceLinkRPC::V1::Result::UNSUPPORTED_VERSION)) { (*message)[strings::params][strings::protocol_version] = - ProtocolVersion::kV1; + protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1; } else { (*message)[strings::params][strings::protocol_version] = SupportedSDLVersion(); @@ -1393,6 +1605,19 @@ void ApplicationManagerImpl::SendMessageToMobile( msg_to_mobile[strings::params][strings::correlation_id].asUInt(), msg_to_mobile[strings::params][strings::connection_key].asUInt(), msg_to_mobile[strings::params][strings::function_id].asInt()); +#ifdef SDL_REMOTE_CONTROL + const mobile_apis::FunctionID::eType function_id = + static_cast<mobile_apis::FunctionID::eType>( + (*message)[strings::params][strings::function_id].asUInt()); + if (function_id == mobile_apis::FunctionID::RegisterAppInterfaceID && + (*message)[strings::msg_params][strings::success].asBool()) { + const bool is_for_plugin = plugin_manager_.IsAppForPlugins(app); + LOG4CXX_INFO(logger_, + "Registered app " << app->app_id() << " is " + << (is_for_plugin ? "" : "not ") + << "for plugins."); + } +#endif // SDL_REMOTE_CONTROL } else if (app) { mobile_apis::FunctionID::eType function_id = static_cast<mobile_apis::FunctionID::eType>( @@ -1625,6 +1850,25 @@ bool ApplicationManagerImpl::ManageMobileCommand( return false; } +void ApplicationManagerImpl::RemoveHMIFakeParameters( + application_manager::MessagePtr& message) { + LOG4CXX_AUTO_TRACE(logger_); + using namespace NsSmartDeviceLink::NsSmartObjects; + using namespace NsSmartDeviceLink::NsJSONHandler; + SmartObject so; + + Formatters::FormatterJsonRpc::FromString<hmi_apis::FunctionID::eType, + hmi_apis::messageType::eType>( + message->json_message(), so); + + std::string formatted_message; + namespace Formatters = NsSmartDeviceLink::NsJSONHandler::Formatters; + hmi_apis::HMI_API factory; + factory.attachSchema(so, true); + Formatters::FormatterJsonRpc::ToString(so, formatted_message); + message->set_json_message(formatted_message); +} + void ApplicationManagerImpl::SendMessageToHMI( const commands::MessageSharedPtr message) { LOG4CXX_AUTO_TRACE(logger_); @@ -1769,6 +2013,17 @@ bool ApplicationManagerImpl::Init(resumption::LastState& last_state, app_launch_ctrl_.reset(new app_launch::AppLaunchCtrlImpl( *app_launch_dto_.get(), *this, settings_)); +#ifdef SDL_REMOTE_CONTROL + if (!hmi_handler_) { + LOG4CXX_ERROR(logger_, "HMI message handler was not initialized"); + return false; + } + plugin_manager_.SetServiceHandler(utils::MakeShared<CoreService>(*this)); + plugin_manager_.LoadPlugins(settings_.plugins_folder()); + plugin_manager_.OnServiceStateChanged( + functional_modules::ServiceState::HMI_ADAPTER_INITIALIZED); +#endif // SDL_REMOTE_CONTROL + return true; } @@ -1802,9 +2057,10 @@ bool ApplicationManagerImpl::ConvertMessageToSO( << message.json_message()); switch (message.protocol_version()) { - case ProtocolVersion::kV4: - case ProtocolVersion::kV3: - case ProtocolVersion::kV2: { + case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5: + case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4: + case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3: + case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_2: { const bool conversion_result = formatters::CFormatterJsonSDLRPCv2::fromString( message.json_message(), @@ -1856,7 +2112,7 @@ bool ApplicationManagerImpl::ConvertMessageToSO( } break; } - case ProtocolVersion::kHMI: { + case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_HMI: { #ifdef ENABLE_LOG int32_t result = #endif @@ -1873,28 +2129,11 @@ bool ApplicationManagerImpl::ConvertMessageToSO( } if (output.validate() != smart_objects::Errors::OK) { LOG4CXX_ERROR(logger_, "Incorrect parameter from HMI"); - - if (application_manager::MessageType::kNotification == - output[strings::params][strings::message_type].asInt()) { - LOG4CXX_ERROR(logger_, "Ignore wrong HMI notification"); - return false; - } - - if (application_manager::MessageType::kRequest == - output[strings::params][strings::message_type].asInt()) { - LOG4CXX_ERROR(logger_, "Ignore wrong HMI request"); - return false; - } - - output.erase(strings::msg_params); - output[strings::params][hmi_response::code] = - hmi_apis::Common_Result::INVALID_DATA; - output[strings::msg_params][strings::info] = - std::string("Received invalid data on HMI response"); + return false; } break; } - case ProtocolVersion::kV1: { + case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1: { static NsSmartDeviceLinkRPC::V1::v4_protocol_v1_2_no_extra v1_shema; if (message.function_id() == 0 || message.type() == kUnknownType) { @@ -1932,8 +2171,6 @@ bool ApplicationManagerImpl::ConvertMessageToSO( break; } default: - // TODO(PV): - // removed NOTREACHED() because some app can still have vesion 1. LOG4CXX_WARN(logger_, "Application used unsupported protocol :" << message.protocol_version() << "."); @@ -1975,7 +2212,8 @@ bool ApplicationManagerImpl::ConvertSOtoMessage( LOG4CXX_WARN(logger_, "Failed to serialize smart object"); return false; } - output.set_protocol_version(application_manager::kV1); + output.set_protocol_version( + protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1); } else { if (!formatters::CFormatterJsonSDLRPCv2::toString(message, output_string)) { @@ -1983,7 +2221,8 @@ bool ApplicationManagerImpl::ConvertSOtoMessage( return false; } output.set_protocol_version( - static_cast<ProtocolVersion>(protocol_version)); + static_cast<protocol_handler::MajorProtocolVersion>( + protocol_version)); } break; @@ -1993,7 +2232,8 @@ bool ApplicationManagerImpl::ConvertSOtoMessage( LOG4CXX_WARN(logger_, "Failed to serialize smart object"); return false; } - output.set_protocol_version(application_manager::kHMI); + output.set_protocol_version( + protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_HMI); break; } default: @@ -2045,6 +2285,60 @@ bool ApplicationManagerImpl::ConvertSOtoMessage( return true; } +MessageValidationResult ApplicationManagerImpl::ValidateMessageBySchema( + const Message& message) { + LOG4CXX_AUTO_TRACE(logger_); + smart_objects::SmartObject so; + using namespace protocol_handler; + switch (message.protocol_version()) { + case MajorProtocolVersion::PROTOCOL_VERSION_5: + case MajorProtocolVersion::PROTOCOL_VERSION_4: + case MajorProtocolVersion::PROTOCOL_VERSION_3: + case MajorProtocolVersion::PROTOCOL_VERSION_2: { + const bool conversion_result = + formatters::CFormatterJsonSDLRPCv2::fromString( + message.json_message(), + so, + message.function_id(), + message.type(), + message.correlation_id()); + if (!conversion_result) { + return INVALID_JSON; + } + + if (!mobile_so_factory().attachSchema(so, true)) { + return INVALID_METADATA; + } + + if (so.validate() != smart_objects::Errors::OK) { + return SCHEMA_MISMATCH; + } + break; + } + case MajorProtocolVersion::PROTOCOL_VERSION_HMI: { + const int32_t conversion_result = formatters::FormatterJsonRpc:: + FromString<hmi_apis::FunctionID::eType, hmi_apis::messageType::eType>( + message.json_message(), so); + if (0 != conversion_result) { + LOG4CXX_WARN(logger_, + "Failed to parse json from HMI: " << conversion_result); + return INVALID_JSON; + } + + if (!hmi_so_factory().attachSchema(so, true)) { + return INVALID_METADATA; + } + + if (so.validate() != smart_objects::Errors::OK) { + return SCHEMA_MISMATCH; + } + break; + } + default: { return UNSUPPORTED_PROTOCOL; } + } + return SUCCESS; +} + utils::SharedPtr<Message> ApplicationManagerImpl::ConvertRawMsgToMessage( const ::protocol_handler::RawMessagePtr message) { LOG4CXX_AUTO_TRACE(logger_); @@ -2120,8 +2414,17 @@ void ApplicationManagerImpl::ProcessMessageFromHMI( *smart_object = message->smart_object(); #else if (!ConvertMessageToSO(*message, *smart_object)) { - LOG4CXX_ERROR(logger_, "Cannot create smart object from message"); - return; + if (application_manager::MessageType::kResponse == + (*smart_object)[strings::params][strings::message_type].asInt()) { + (*smart_object).erase(strings::msg_params); + (*smart_object)[strings::params][hmi_response::code] = + hmi_apis::Common_Result::INVALID_DATA; + (*smart_object)[strings::msg_params][strings::info] = + std::string("Received invalid data on HMI response"); + } else { + LOG4CXX_ERROR(logger_, "Cannot create smart object from message"); + return; + } } #endif // HMI_DBUS_API @@ -2409,32 +2712,38 @@ void ApplicationManagerImpl::RemovePolicyObserver( void ApplicationManagerImpl::SetUnregisterAllApplicationsReason( mobile_api::AppInterfaceUnregisteredReason::eType reason) { + LOG4CXX_AUTO_TRACE(logger_); LOG4CXX_TRACE(logger_, "reason = " << reason); unregister_reason_ = reason; } void ApplicationManagerImpl::HeadUnitReset( mobile_api::AppInterfaceUnregisteredReason::eType reason) { + LOG4CXX_AUTO_TRACE(logger_); stopping_application_mng_lock_.Acquire(); is_stopping_ = true; stopping_application_mng_lock_.Release(); switch (reason) { case mobile_api::AppInterfaceUnregisteredReason::MASTER_RESET: { + LOG4CXX_TRACE(logger_, "Performing MASTER_RESET"); UnregisterAllApplications(); GetPolicyHandler().ResetPolicyTable(); GetPolicyHandler().UnloadPolicyLibrary(); resume_controller().StopSavePersistentDataTimer(); - file_system::remove_directory_content( - get_settings().app_storage_folder()); + + const std::string storage_folder = get_settings().app_storage_folder(); + file_system::RemoveDirectory(storage_folder, true); + ClearAppsPersistentData(); break; } case mobile_api::AppInterfaceUnregisteredReason::FACTORY_DEFAULTS: { + LOG4CXX_TRACE(logger_, "Performing FACTORY_DEFAULTS"); GetPolicyHandler().ClearUserConsent(); resume_controller().StopSavePersistentDataTimer(); - file_system::remove_directory_content( - get_settings().app_storage_folder()); + + ClearAppsPersistentData(); break; } default: { @@ -2444,6 +2753,43 @@ void ApplicationManagerImpl::HeadUnitReset( } } +void ApplicationManagerImpl::ClearAppsPersistentData() { + LOG4CXX_AUTO_TRACE(logger_); + typedef std::vector<std::string> FilesList; + const std::string apps_info_storage_file = get_settings().app_info_storage(); + file_system::DeleteFile(apps_info_storage_file); + + const std::string storage_folder = get_settings().app_storage_folder(); + + FilesList files = file_system::ListFiles(storage_folder); + FilesList::iterator element_to_skip = + std::find(files.begin(), files.end(), "policy.sqlite"); + if (element_to_skip != files.end()) { + files.erase(element_to_skip); + } + + FilesList::iterator it = files.begin(); + for (; it != files.end(); ++it) { + const std::string path_to_item = storage_folder + "/"; + const std::string item_to_remove = path_to_item + (*it); + LOG4CXX_TRACE(logger_, "Removing : " << item_to_remove); + if (file_system::IsDirectory(item_to_remove)) { + LOG4CXX_TRACE(logger_, + "Removal result : " << file_system::RemoveDirectory( + item_to_remove, true)); + } else { + LOG4CXX_TRACE( + logger_, + "Removal result : " << file_system::DeleteFile(item_to_remove)); + } + } + + const std::string apps_icons_folder = get_settings().app_icons_folder(); + if (storage_folder != apps_icons_folder) { + file_system::RemoveDirectory(apps_icons_folder, true); + } +} + void ApplicationManagerImpl::SendOnSDLClose() { LOG4CXX_AUTO_TRACE(logger_); @@ -2574,9 +2920,13 @@ void ApplicationManagerImpl::UnregisterApplication( MessageHelper::SendUnsubscribedWayPoints(*this); } - NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); - if (navi_service_status_.end() != it) { - navi_service_status_.erase(it); + { + sync_primitives::AutoLock lock(navi_service_status_lock_); + + NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); + if (navi_service_status_.end() != it) { + navi_service_status_.erase(it); + } } // remove appID from tts_global_properties_app_list_ @@ -2659,6 +3009,11 @@ void ApplicationManagerImpl::UnregisterApplication( MessageHelper::SendStopAudioPathThru(*this); } +#ifdef SDL_REMOTE_CONTROL + plugin_manager_.OnApplicationEvent( + functional_modules::ApplicationEvent::kApplicationUnregistered, app_id); +#endif + MessageHelper::SendOnAppUnregNotificationToHMI( app_to_remove, is_unexpected_disconnect, *this); request_ctrl_.terminateAppRequests(app_id); @@ -2682,6 +3037,15 @@ void ApplicationManagerImpl::Handle(const impl::MessageFromMobile message) { LOG4CXX_INFO(logger_, "Application manager is stopping"); return; } +#ifdef SDL_REMOTE_CONTROL + if (plugin_manager_.IsMessageForPlugin(message)) { + if (functional_modules::ProcessResult::PROCESSED == + plugin_manager_.ProcessMessage(message)) { + LOG4CXX_INFO(logger_, "Message is processed by plugin."); + return; + } + } +#endif ProcessMessageFromMobile(message); } @@ -2727,6 +3091,18 @@ void ApplicationManagerImpl::Handle(const impl::MessageFromHmi message) { return; } +#ifdef SDL_REMOTE_CONTROL + if (plugin_manager_.IsHMIMessageForPlugin(message)) { + functional_modules::ProcessResult result = + plugin_manager_.ProcessHMIMessage(message); + if (functional_modules::ProcessResult::PROCESSED == result || + functional_modules::ProcessResult::FAILED == result) { + LOG4CXX_INFO(logger_, "Message is processed by plugin."); + return; + } + } +#endif + ProcessMessageFromHMI(message); } @@ -2900,8 +3276,10 @@ void ApplicationManagerImpl::ForbidStreaming(uint32_t app_id) { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = application(app_id); - if (!app || !app->is_navi()) { - LOG4CXX_DEBUG(logger_, "There is no navi application with id: " << app_id); + if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) { + LOG4CXX_DEBUG( + logger_, + "There is no navi or projection application with id: " << app_id); return; } @@ -2915,9 +3293,17 @@ void ApplicationManagerImpl::ForbidStreaming(uint32_t app_id) { return; } - NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); - if (navi_service_status_.end() == it || - (!it->second.first && !it->second.second)) { + bool unregister = false; + { + sync_primitives::AutoLock lock(navi_service_status_lock_); + + NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); + if (navi_service_status_.end() == it || + (!it->second.first && !it->second.second)) { + unregister = true; + } + } + if (unregister) { ManageMobileCommand( MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( app_id, PROTOCOL_VIOLATION), @@ -2934,8 +3320,10 @@ void ApplicationManagerImpl::OnAppStreaming( LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = application(app_id); - if (!app || !app->is_navi()) { - LOG4CXX_DEBUG(logger_, " There is no navi application with id: " << app_id); + if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) { + LOG4CXX_DEBUG( + logger_, + " There is no navi or projection application with id: " << app_id); return; } DCHECK_OR_RETURN_VOID(media_manager_); @@ -2954,24 +3342,34 @@ void ApplicationManagerImpl::EndNaviServices(uint32_t app_id) { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = application(app_id); - if (!app || !app->is_navi()) { - LOG4CXX_DEBUG(logger_, "There is no navi application with id: " << app_id); + if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) { + LOG4CXX_DEBUG( + logger_, + "There is no navi or projection application with id: " << app_id); return; } - NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); - if (navi_service_status_.end() == it) { - LOG4CXX_ERROR(logger_, "No info about navi servicies for app"); - return; + bool end_video = false; + bool end_audio = false; + { + sync_primitives::AutoLock lock(navi_service_status_lock_); + + NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); + if (navi_service_status_.end() == it) { + LOG4CXX_ERROR(logger_, "No info about navi servicies for app"); + return; + } + end_video = it->second.first; + end_audio = it->second.second; } if (connection_handler_) { - if (it->second.first) { + if (end_video) { LOG4CXX_DEBUG(logger_, "Going to end video service"); connection_handler().SendEndService(app_id, ServiceType::kMobileNav); app->StopStreamingForce(ServiceType::kMobileNav); } - if (it->second.second) { + if (end_audio) { LOG4CXX_DEBUG(logger_, "Going to end audio service"); connection_handler().SendEndService(app_id, ServiceType::kAudio); app->StopStreamingForce(ServiceType::kAudio); @@ -3005,8 +3403,8 @@ void ApplicationManagerImpl::OnHMILevelChanged( } ApplicationSharedPtr app = application(app_id); - if (!app || !app->is_navi()) { - LOG4CXX_ERROR(logger_, "Navi application not found"); + if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) { + LOG4CXX_ERROR(logger_, "Navi/Projection application not found"); return; } @@ -3093,18 +3491,26 @@ void ApplicationManagerImpl::CloseNaviApp() { uint32_t app_id = navi_app_to_stop_.front(); navi_app_to_stop_.pop_front(); - NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); - if (navi_service_status_.end() != it) { - if (it->second.first || it->second.second) { - LOG4CXX_INFO(logger_, - "App haven't answered for EndService. Unregister it."); - ManageMobileCommand( - MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( - app_id, PROTOCOL_VIOLATION), - commands::Command::ORIGIN_SDL); - UnregisterApplication(app_id, ABORTED); + bool unregister = false; + { + sync_primitives::AutoLock lock(navi_service_status_lock_); + + NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); + if (navi_service_status_.end() != it) { + if (it->second.first || it->second.second) { + unregister = true; + } } } + if (unregister) { + LOG4CXX_INFO(logger_, + "App haven't answered for EndService. Unregister it."); + ManageMobileCommand( + MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( + app_id, PROTOCOL_VIOLATION), + commands::Command::ORIGIN_SDL); + UnregisterApplication(app_id, ABORTED); + } } void ApplicationManagerImpl::EndNaviStreaming() { @@ -3128,18 +3534,22 @@ void ApplicationManagerImpl::DisallowStreaming(uint32_t app_id) { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = application(app_id); - if (!app || !app->is_navi()) { - LOG4CXX_ERROR(logger_, "Navi application not found"); + if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) { + LOG4CXX_ERROR(logger_, "Navi/Projection application not found"); return; } - NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); - if (navi_service_status_.end() != it) { - if (it->second.first) { - app->set_video_streaming_allowed(false); - } - if (it->second.second) { - app->set_audio_streaming_allowed(false); + { + sync_primitives::AutoLock lock(navi_service_status_lock_); + + NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); + if (navi_service_status_.end() != it) { + if (it->second.first) { + app->set_video_streaming_allowed(false); + } + if (it->second.second) { + app->set_audio_streaming_allowed(false); + } } } } @@ -3149,18 +3559,22 @@ void ApplicationManagerImpl::AllowStreaming(uint32_t app_id) { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = application(app_id); - if (!app || !app->is_navi()) { - LOG4CXX_ERROR(logger_, "Navi application not found"); + if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) { + LOG4CXX_ERROR(logger_, "Navi/Projection application not found"); return; } - NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); - if (navi_service_status_.end() != it) { - if (it->second.first) { - app->set_video_streaming_allowed(true); - } - if (it->second.second) { - app->set_audio_streaming_allowed(true); + { + sync_primitives::AutoLock lock(navi_service_status_lock_); + + NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); + if (navi_service_status_.end() != it) { + if (it->second.first) { + app->set_video_streaming_allowed(true); + } + if (it->second.second) { + app->set_audio_streaming_allowed(true); + } } } } @@ -3454,24 +3868,21 @@ void ApplicationManagerImpl::OnUpdateHMIAppType( } } -ProtocolVersion ApplicationManagerImpl::SupportedSDLVersion() const { - LOG4CXX_AUTO_TRACE(logger_); - bool heart_beat_support = get_settings().heart_beat_timeout(); - bool sdl4_support = protocol_handler_->get_settings().enable_protocol_4(); - - if (sdl4_support) { - LOG4CXX_DEBUG(logger_, - "SDL Supported protocol version " << ProtocolVersion::kV4); - return ProtocolVersion::kV4; - } - if (heart_beat_support) { - LOG4CXX_DEBUG(logger_, - "SDL Supported protocol version " << ProtocolVersion::kV3); - return ProtocolVersion::kV3; +void ApplicationManagerImpl::OnPTUFinished(const bool ptu_result) { +#ifdef SDL_REMOTE_CONTROL + if (!ptu_result) { + return; } - LOG4CXX_DEBUG(logger_, - "SDL Supported protocol version " << ProtocolVersion::kV2); - return ProtocolVersion::kV2; + plugin_manager_.OnPolicyEvent( + functional_modules::PolicyEvent::kApplicationPolicyUpdated); +#endif // SDL_REMOTE_CONTROL +} + +protocol_handler::MajorProtocolVersion +ApplicationManagerImpl::SupportedSDLVersion() const { + LOG4CXX_AUTO_TRACE(logger_); + return static_cast<protocol_handler::MajorProtocolVersion>( + get_settings().max_supported_protocol_version()); } event_engine::EventDispatcher& ApplicationManagerImpl::event_dispatcher() { @@ -3570,4 +3981,189 @@ const std::set<int32_t> ApplicationManagerImpl::GetAppsSubscribedForWayPoints() return subscribed_way_points_apps_list_; } +static hmi_apis::Common_VideoStreamingProtocol::eType ConvertVideoProtocol( + const char* str) { + if (strcmp(str, "RAW") == 0) { + return hmi_apis::Common_VideoStreamingProtocol::RAW; + } else if (strcmp(str, "RTP") == 0) { + return hmi_apis::Common_VideoStreamingProtocol::RTP; + } else if (strcmp(str, "RTSP") == 0) { + return hmi_apis::Common_VideoStreamingProtocol::RTSP; + } else if (strcmp(str, "RTMP") == 0) { + return hmi_apis::Common_VideoStreamingProtocol::RTMP; + } else if (strcmp(str, "WEBM") == 0) { + return hmi_apis::Common_VideoStreamingProtocol::WEBM; + } + return hmi_apis::Common_VideoStreamingProtocol::INVALID_ENUM; +} + +static hmi_apis::Common_VideoStreamingCodec::eType ConvertVideoCodec( + const char* str) { + if (strcmp(str, "H264") == 0) { + return hmi_apis::Common_VideoStreamingCodec::H264; + } else if (strcmp(str, "H265") == 0) { + return hmi_apis::Common_VideoStreamingCodec::H265; + } else if (strcmp(str, "Theora") == 0) { + return hmi_apis::Common_VideoStreamingCodec::Theora; + } else if (strcmp(str, "VP8") == 0) { + return hmi_apis::Common_VideoStreamingCodec::VP8; + } else if (strcmp(str, "VP9") == 0) { + return hmi_apis::Common_VideoStreamingCodec::VP9; + } + return hmi_apis::Common_VideoStreamingCodec::INVALID_ENUM; +} + +// static +void ApplicationManagerImpl::ConvertVideoParamsToSO( + smart_objects::SmartObject& output, const BsonObject* input) { + if (input == NULL) { + return; + } + BsonObject* obj = const_cast<BsonObject*>(input); + + const char* protocol = + bson_object_get_string(obj, protocol_handler::strings::video_protocol); + if (protocol != NULL) { + hmi_apis::Common_VideoStreamingProtocol::eType protocol_enum = + ConvertVideoProtocol(protocol); + if (protocol_enum != + hmi_apis::Common_VideoStreamingProtocol::INVALID_ENUM) { + output[strings::protocol] = protocol_enum; + } + } + const char* codec = + bson_object_get_string(obj, protocol_handler::strings::video_codec); + if (codec != NULL) { + hmi_apis::Common_VideoStreamingCodec::eType codec_enum = + ConvertVideoCodec(codec); + if (codec_enum != hmi_apis::Common_VideoStreamingCodec::INVALID_ENUM) { + output[strings::codec] = codec_enum; + } + } + BsonElement* element = + bson_object_get(obj, protocol_handler::strings::height); + if (element != NULL && element->type == TYPE_INT32) { + output[strings::height] = + bson_object_get_int32(obj, protocol_handler::strings::height); + } + element = bson_object_get(obj, protocol_handler::strings::width); + if (element != NULL && element->type == TYPE_INT32) { + output[strings::width] = + bson_object_get_int32(obj, protocol_handler::strings::width); + } +} + +// static +std::vector<std::string> ApplicationManagerImpl::ConvertRejectedParamList( + const std::vector<std::string>& input) { + std::vector<std::string> output; + for (std::vector<std::string>::const_iterator it = input.begin(); + it != input.end(); + ++it) { + if (*it == strings::protocol) { + output.push_back(protocol_handler::strings::video_protocol); + } else if (*it == strings::codec) { + output.push_back(protocol_handler::strings::video_codec); + } else if (*it == strings::height) { + output.push_back(protocol_handler::strings::height); + } else if (*it == strings::width) { + output.push_back(protocol_handler::strings::width); + } + // ignore unknown parameters + } + return output; +} + +#ifdef BUILD_TESTS +void ApplicationManagerImpl::AddMockApplication(ApplicationSharedPtr mock_app) { + applications_list_lock_.Acquire(); + applications_.insert(mock_app); + apps_size_ = applications_.size(); + applications_list_lock_.Release(); +} +#endif // BUILD_TESTS +#ifdef SDL_REMOTE_CONTROL +struct MobileAppIdPredicate { + std::string policy_app_id_; + MobileAppIdPredicate(const std::string& policy_app_id) + : policy_app_id_(policy_app_id) {} + bool operator()(const ApplicationSharedPtr app) const { + return app ? policy_app_id_ == app->policy_app_id() : false; + } +}; + +struct TakeDeviceHandle { + public: + TakeDeviceHandle(const ApplicationManager& app_mngr) : app_mngr_(app_mngr) {} + std::string operator()(ApplicationSharedPtr& app) { + DCHECK_OR_RETURN(app, ""); + return MessageHelper::GetDeviceMacAddressForHandle(app->device(), + app_mngr_); + } + + private: + const ApplicationManager& app_mngr_; +}; + +ApplicationSharedPtr ApplicationManagerImpl::application( + const std::string& device_id, const std::string& policy_app_id) const { + connection_handler::DeviceHandle device_handle; + if (!connection_handler().GetDeviceID(device_id, &device_handle)) { + LOG4CXX_DEBUG(logger_, "No such device : " << device_id); + return ApplicationSharedPtr(); + } + + DataAccessor<ApplicationSet> accessor = applications(); + ApplicationSharedPtr app = + FindApp(accessor, IsApplication(device_handle, policy_app_id)); + + LOG4CXX_DEBUG(logger_, + " policy_app_id << " << policy_app_id << "Found = " << app); + return app; +} + +std::vector<std::string> ApplicationManagerImpl::devices( + const std::string& policy_app_id) const { + MobileAppIdPredicate matcher(policy_app_id); + AppSharedPtrs apps = FindAllApps(applications(), matcher); + std::vector<std::string> devices; + std::transform(apps.begin(), + apps.end(), + std::back_inserter(devices), + TakeDeviceHandle(*this)); + return devices; +} + +void ApplicationManagerImpl::ChangeAppsHMILevel( + uint32_t app_id, mobile_apis::HMILevel::eType level) { + using namespace mobile_apis::HMILevel; + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, "AppID to change: " << app_id << " -> " << level); + ApplicationSharedPtr app = application(app_id); + if (!app) { + LOG4CXX_ERROR(logger_, "There is no app with id: " << app_id); + return; + } + eType old_level = app->hmi_level(); + if (old_level != level) { + app->set_hmi_level(level); + OnHMILevelChanged(app_id, old_level, level); + + plugin_manager_.OnAppHMILevelChanged(app, old_level); + } else { + LOG4CXX_WARN(logger_, "Redudant changing HMI level : " << level); + } +} + +void ApplicationManagerImpl::SendPostMessageToMobile( + const MessagePtr& message) { + messages_to_mobile_.PostMessage(impl::MessageToMobile(message, false)); +} + +void ApplicationManagerImpl::SendPostMessageToHMI(const MessagePtr& message) { + messages_to_hmi_.PostMessage(impl::MessageToHmi(message)); +} + +#endif // SDL_REMOTE_CONTROL + } // namespace application_manager diff --git a/src/components/application_manager/src/commands/command_request_impl.cc b/src/components/application_manager/src/commands/command_request_impl.cc index cea5412587..3f9a1d13b3 100644 --- a/src/components/application_manager/src/commands/command_request_impl.cc +++ b/src/components/application_manager/src/commands/command_request_impl.cc @@ -89,6 +89,9 @@ const std::string CreateInfoForUnsupportedResult( case (HmiInterfaces::InterfaceID::HMI_INTERFACE_VehicleInfo): { return "VehicleInfo is not supported by system"; } + case (HmiInterfaces::InterfaceID::HMI_INTERFACE_RC): { + return "Remote control is not supported by system"; + } default: #ifdef ENABLE_LOG CREATE_LOGGERPTR_LOCAL(logger, "Commands"); @@ -147,9 +150,13 @@ CommandRequestImpl::CommandRequestImpl(const MessageSharedPtr& message, ApplicationManager& application_manager) : CommandImpl(message, application_manager) , EventObserver(application_manager.event_dispatcher()) - , current_state_(kAwaitingHMIResponse) {} + , current_state_(kAwaitingHMIResponse) + , hash_update_mode_(kSkipHashUpdate) + , is_success_result_(false) {} -CommandRequestImpl::~CommandRequestImpl() {} +CommandRequestImpl::~CommandRequestImpl() { + UpdateHash(); +} bool CommandRequestImpl::Init() { return true; @@ -249,6 +256,8 @@ void CommandRequestImpl::SendResponse( response[strings::msg_params][strings::success] = success; response[strings::msg_params][strings::result_code] = result_code; + is_success_result_ = success; + application_manager_.ManageMobileCommand(result, ORIGIN_SDL); } @@ -308,6 +317,46 @@ bool CommandRequestImpl::ProcessHMIInterfacesAvailability( return true; } +void CommandRequestImpl::UpdateHash() { + LOG4CXX_AUTO_TRACE(logger_); + if (hash_update_mode_ == kSkipHashUpdate) { + LOG4CXX_DEBUG(logger_, "Hash update is disabled for " << function_id()); + return; + } + + if (HmiInterfaces::InterfaceState::STATE_NOT_RESPONSE == + application_manager_.hmi_interfaces().GetInterfaceState( + HmiInterfaces::InterfaceID::HMI_INTERFACE_UI)) { + LOG4CXX_ERROR(logger_, + "UI interface has not responded. Hash won't be updated."); + return; + } + + if (!is_success_result_) { + LOG4CXX_WARN(logger_, "Command is not succeeded. Hash won't be updated."); + return; + } + + ApplicationSharedPtr application = + application_manager_.application(connection_key()); + if (!application) { + LOG4CXX_ERROR(logger_, + "Application with connection key " + << connection_key() + << " not found. Not able to update hash."); + return; + } + + LOG4CXX_DEBUG( + logger_, + "Updating hash for application with connection key " + << connection_key() << " while processing function id " + << MessageHelper::StringifiedFunctionID( + static_cast<mobile_api::FunctionID::eType>(function_id()))); + + application->UpdateHash(); +} + uint32_t CommandRequestImpl::SendHMIRequest( const hmi_apis::FunctionID::eType& function_id, const smart_objects::SmartObject* msg_params, @@ -550,6 +599,44 @@ bool CommandRequestImpl::CheckAllowedParameters() { return true; } +bool CommandRequestImpl::CheckHMICapabilities( + const mobile_apis::ButtonName::eType button) const { + LOG4CXX_AUTO_TRACE(logger_); + + using namespace smart_objects; + using namespace mobile_apis; + + const HMICapabilities& hmi_capabilities = + application_manager_.hmi_capabilities(); + if (!hmi_capabilities.is_ui_cooperating()) { + LOG4CXX_ERROR(logger_, "UI is not supported by HMI"); + return false; + } + + const SmartObject* button_capabilities_so = + hmi_capabilities.button_capabilities(); + if (!button_capabilities_so) { + LOG4CXX_ERROR(logger_, "Invalid button capabilities object"); + return false; + } + + const SmartObject& button_capabilities = *button_capabilities_so; + for (size_t i = 0; i < button_capabilities.length(); ++i) { + const SmartObject& capabilities = button_capabilities[i]; + const ButtonName::eType current_button = static_cast<ButtonName::eType>( + capabilities.getElement(hmi_response::button_name).asInt()); + if (current_button == button) { + LOG4CXX_DEBUG(logger_, + "Button capabilities for " << button << " was found"); + return true; + } + } + + LOG4CXX_DEBUG(logger_, + "Button capabilities for " << button << " was not found"); + return false; +} + void CommandRequestImpl::RemoveDisallowedParameters() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/hmi/get_urls.cc b/src/components/application_manager/src/commands/hmi/get_urls.cc index a2e1878fac..bfcdf4985e 100644 --- a/src/components/application_manager/src/commands/hmi/get_urls.cc +++ b/src/components/application_manager/src/commands/hmi/get_urls.cc @@ -34,6 +34,7 @@ #include "application_manager/message.h" #include "application_manager/application_manager.h" #include "application_manager/policies/policy_handler.h" +#include "utils/helpers.h" namespace application_manager { namespace commands { @@ -194,32 +195,25 @@ void GetUrls::ProcessPolicyServiceURLs(const policy::EndpointUrls& endpoints) { object[msg_params][hmi_response::urls] = SmartObject(SmartType_Array); SmartObject& urls = object[msg_params][hmi_response::urls]; const std::string mobile_app_id = app->policy_app_id(); - std::string default_url = "URL is not found"; - // Will use only one URL for particular application if it will be found - // Otherwise URL from default section will used - SmartObject service_info = SmartObject(SmartType_Map); - - for (size_t e = 0; e < endpoints.size(); ++e) { - if (mobile_app_id == endpoints[e].app_id) { - if (endpoints[e].url.size()) { - service_info[url] = endpoints[e].url[0]; - SendResponseToHMI(Common_Result::SUCCESS); - return; - } - } - if (policy::kDefaultId == endpoints[e].app_id) { - if (endpoints[e].url.size()) { - default_url = endpoints[e].url[0]; + size_t index = 0; + for (size_t i = 0; i < endpoints.size(); ++i) { + using namespace helpers; + + const bool to_add = Compare<std::string, EQ, ONE>( + endpoints[i].app_id, mobile_app_id, policy::kDefaultId); + const bool is_default = policy::kDefaultId == endpoints[i].app_id; + + if (to_add) { + for (size_t k = 0; k < endpoints[i].url.size(); ++k) { + if (!is_default) { + urls[index][strings::app_id] = app_id_to_send_to; + } + urls[index][strings::url] = endpoints[i].url[k]; + ++index; } } } - - service_info[strings::app_id] = app->app_id(); - service_info[strings::url] = default_url; - urls[0] = service_info; - // TODO(AOleynik): Issue with absent policy_app_id. Need to fix later on. - // Possibly related to smart schema SendResponseToHMI(Common_Result::SUCCESS); return; } diff --git a/src/components/application_manager/src/commands/hmi/navi_set_video_config_request.cc b/src/components/application_manager/src/commands/hmi/navi_set_video_config_request.cc new file mode 100644 index 0000000000..d19db515ab --- /dev/null +++ b/src/components/application_manager/src/commands/hmi/navi_set_video_config_request.cc @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the names of the copyright holders nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "application_manager/commands/hmi/navi_set_video_config_request.h" +#include <string> +#include <vector> + +namespace application_manager { + +namespace commands { + +NaviSetVideoConfigRequest::NaviSetVideoConfigRequest( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : RequestToHMI(message, application_manager) + , EventObserver(application_manager.event_dispatcher()) {} + +NaviSetVideoConfigRequest::~NaviSetVideoConfigRequest() {} + +void NaviSetVideoConfigRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + if (!CheckAvailabilityHMIInterfaces( + application_manager_, HmiInterfaces::HMI_INTERFACE_Navigation)) { + LOG4CXX_WARN(logger_, "HMI interface Navigation is not supported"); + return; + } + + ApplicationSharedPtr app = + application_manager_.application_by_hmi_app(application_id()); + if (!app) { + LOG4CXX_ERROR(logger_, + "Application with hmi_app_id " << application_id() + << "does not exist"); + return; + } + + subscribe_on_event(hmi_apis::FunctionID::Navigation_SetVideoConfig, + correlation_id()); + SendRequest(); +} + +void NaviSetVideoConfigRequest::on_event(const event_engine::Event& event) { + LOG4CXX_AUTO_TRACE(logger_); + + ApplicationSharedPtr app = + application_manager_.application_by_hmi_app(application_id()); + if (!app) { + LOG4CXX_ERROR(logger_, + "Application is not found, abort NaviSetVideoConfigRequest"); + return; + } + + const smart_objects::SmartObject& message = event.smart_object(); + switch (event.id()) { + case hmi_apis::FunctionID::Navigation_SetVideoConfig: { + const hmi_apis::Common_Result::eType code = + static_cast<hmi_apis::Common_Result::eType>( + message[strings::params][hmi_response::code].asInt()); + bool result = false; + std::vector<std::string> rejected_params; + + if (code == hmi_apis::Common_Result::SUCCESS) { + LOG4CXX_DEBUG(logger_, "Received SetVideoConfig success response"); + result = true; + } else { + LOG4CXX_DEBUG(logger_, + "Received SetVideoConfig failure response (" << event.id() + << ")"); + result = false; + if (message[strings::msg_params].keyExists(strings::rejected_params)) { + const smart_objects::SmartArray* list = + message[strings::msg_params][strings::rejected_params].asArray(); + if (list != NULL) { + for (unsigned int i = 0; i < list->size(); i++) { + const std::string& param = (*list)[i].asString(); + // Make sure that we actually sent the parameter in the request + if ((*message_)[strings::msg_params].keyExists(strings::config) && + (*message_)[strings::msg_params][strings::config].keyExists( + param)) { + rejected_params.push_back(param); + } + } + } + } + } + application_manager_.OnStreamingConfigured( + app->app_id(), + protocol_handler::ServiceType::kMobileNav, + result, + rejected_params); + break; + } + default: + LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + break; + } +} + +void NaviSetVideoConfigRequest::onTimeOut() { + LOG4CXX_WARN(logger_, "Timed out while waiting for SetVideoConfig response"); + + ApplicationSharedPtr app = + application_manager_.application_by_hmi_app(application_id()); + if (!app) { + LOG4CXX_ERROR(logger_, "Application is not found"); + return; + } + + std::vector<std::string> empty; + application_manager_.OnStreamingConfigured( + app->app_id(), protocol_handler::ServiceType::kMobileNav, false, empty); + + application_manager_.TerminateRequest( + connection_key(), correlation_id(), function_id()); +} + +} // namespace commands + +} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/navi_set_video_config_response.cc b/src/components/application_manager/src/commands/hmi/navi_set_video_config_response.cc new file mode 100644 index 0000000000..03679eb3b1 --- /dev/null +++ b/src/components/application_manager/src/commands/hmi/navi_set_video_config_response.cc @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the names of the copyright holders nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include "application_manager/commands/hmi/navi_set_video_config_response.h" +#include "application_manager/event_engine/event.h" + +namespace application_manager { + +namespace commands { + +NaviSetVideoConfigResponse::NaviSetVideoConfigResponse( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : ResponseFromHMI(message, application_manager) {} + +NaviSetVideoConfigResponse::~NaviSetVideoConfigResponse() {} + +void NaviSetVideoConfigResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + event_engine::Event event(hmi_apis::FunctionID::Navigation_SetVideoConfig); + event.set_smart_object(*message_); + event.raise(application_manager_.event_dispatcher()); +} + +} // namespace commands + +} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc b/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc index 682093cef9..07a95adcea 100644 --- a/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc @@ -110,5 +110,4 @@ void OnExitAllApplicationsNotification::SendOnSDLPersistenceComplete() { } } // namespace commands - } // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_exit_application_notification.cc b/src/components/application_manager/src/commands/hmi/on_exit_application_notification.cc index 0553fbba94..9f4c6e5b5d 100644 --- a/src/components/application_manager/src/commands/hmi/on_exit_application_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_exit_application_notification.cc @@ -37,6 +37,9 @@ #include "application_manager/message_helper.h" #include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" +#ifdef SDL_REMOTE_CONTROL +#include "functional_module/plugin_manager.h" +#endif // SDL_REMOTE_CONTROL namespace application_manager { @@ -62,6 +65,11 @@ void OnExitApplicationNotification::Run() { return; } +#ifdef SDL_REMOTE_CONTROL + application_manager_.GetPluginManager().OnApplicationEvent( + functional_modules::ApplicationEvent::kApplicationExit, app_id); +#endif // SDL_REMOTE_CONTROL + Common_ApplicationExitReason::eType reason; reason = static_cast<Common_ApplicationExitReason::eType>( (*message_)[strings::msg_params][strings::reason].asInt()); diff --git a/src/components/application_manager/src/commands/hmi/rc_get_capabilities_request.cc b/src/components/application_manager/src/commands/hmi/rc_get_capabilities_request.cc new file mode 100644 index 0000000000..32b296a3b9 --- /dev/null +++ b/src/components/application_manager/src/commands/hmi/rc_get_capabilities_request.cc @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "application_manager/commands/hmi/rc_get_capabilities_request.h" + +namespace application_manager { + +namespace commands { + +RCGetCapabilitiesRequest::RCGetCapabilitiesRequest( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : RequestToHMI(message, application_manager) {} + +RCGetCapabilitiesRequest::~RCGetCapabilitiesRequest() {} + +void RCGetCapabilitiesRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + SendRequest(); +} + +} // namespace commands + +} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/rc_get_capabilities_response.cc b/src/components/application_manager/src/commands/hmi/rc_get_capabilities_response.cc new file mode 100644 index 0000000000..3ff6edd125 --- /dev/null +++ b/src/components/application_manager/src/commands/hmi/rc_get_capabilities_response.cc @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include "application_manager/commands/hmi/rc_get_capabilities_response.h" + +namespace application_manager { + +namespace commands { + +RCGetCapabilitiesResponse::RCGetCapabilitiesResponse( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : ResponseFromHMI(message, application_manager) {} + +RCGetCapabilitiesResponse::~RCGetCapabilitiesResponse() {} + +void RCGetCapabilitiesResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); + + hmi_capabilities.set_rc_capability( + (*message_)[strings::msg_params][strings::rc_capability]); +} + +} // namespace commands + +} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/rc_is_ready_request.cc b/src/components/application_manager/src/commands/hmi/rc_is_ready_request.cc new file mode 100644 index 0000000000..71b803d198 --- /dev/null +++ b/src/components/application_manager/src/commands/hmi/rc_is_ready_request.cc @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "application_manager/commands/hmi/rc_is_ready_request.h" + +namespace application_manager { + +namespace commands { + +RCIsReadyRequest::RCIsReadyRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : RequestToHMI(message, application_manager) + , EventObserver(application_manager.event_dispatcher()) {} + +RCIsReadyRequest::~RCIsReadyRequest() {} + +void RCIsReadyRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + subscribe_on_event(hmi_apis::FunctionID::RC_IsReady, correlation_id()); + SendRequest(); +} + +void RCIsReadyRequest::on_event(const event_engine::Event& event) { + LOG4CXX_AUTO_TRACE(logger_); + const smart_objects::SmartObject& message = event.smart_object(); + switch (event.id()) { + case hmi_apis::FunctionID::RC_IsReady: { + LOG4CXX_DEBUG(logger_, "Received RC_IsReady event"); + unsubscribe_from_event(hmi_apis::FunctionID::RC_IsReady); + const bool is_available = ChangeInterfaceState( + application_manager_, message, HmiInterfaces::HMI_INTERFACE_RC); + + HMICapabilities& hmi_capabilities = + application_manager_.hmi_capabilities(); + hmi_capabilities.set_is_rc_cooperating(is_available); + if (!CheckAvailabilityHMIInterfaces(application_manager_, + HmiInterfaces::HMI_INTERFACE_RC)) { + LOG4CXX_INFO(logger_, + "HmiInterfaces::HMI_INTERFACE_VR isn't available"); + return; + } + SendMessageToHMI(); + break; + } + default: { + LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + return; + } + } +} + +void RCIsReadyRequest::onTimeOut() { + // Note(dtrunov): According to new requirment APPLINK-27956 + SendMessageToHMI(); +} + +void RCIsReadyRequest::SendMessageToHMI() { + utils::SharedPtr<smart_objects::SmartObject> get_capabilities( + MessageHelper::CreateModuleInfoSO( + hmi_apis::FunctionID::RC_GetCapabilities, application_manager_)); + application_manager_.ManageHMICommand(get_capabilities); +} + +} // namespace commands + +} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/rc_is_ready_response.cc b/src/components/application_manager/src/commands/hmi/rc_is_ready_response.cc new file mode 100644 index 0000000000..6756b294f3 --- /dev/null +++ b/src/components/application_manager/src/commands/hmi/rc_is_ready_response.cc @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include "application_manager/commands/hmi/rc_is_ready_response.h" + +namespace application_manager { + +namespace commands { + +RCIsReadyResponse::RCIsReadyResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : ResponseFromHMI(message, application_manager) {} + +RCIsReadyResponse::~RCIsReadyResponse() {} + +void RCIsReadyResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + event_engine::Event event(hmi_apis::FunctionID::RC_IsReady); + event.set_smart_object(*message_); + event.raise(application_manager_.event_dispatcher()); +} + +} // namespace commands + +} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc b/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc index 3a5a8d25f9..6961c15f76 100644 --- a/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc +++ b/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc @@ -46,7 +46,10 @@ struct ProtoV4AppsOnDevice : std::unary_function<ApplicationSharedPtr, bool> { bool operator()(const ApplicationSharedPtr app) const { return app ? handle_ == app->device() && - ProtocolVersion::kV4 == app->protocol_version() + Message::is_sufficient_version( + protocol_handler::MajorProtocolVersion:: + PROTOCOL_VERSION_4, + app->protocol_version()) : false; } }; diff --git a/src/components/application_manager/src/commands/hmi/ui_get_capabilities_response.cc b/src/components/application_manager/src/commands/hmi/ui_get_capabilities_response.cc index de0a2f2157..3b5aeac639 100644 --- a/src/components/application_manager/src/commands/hmi/ui_get_capabilities_response.cc +++ b/src/components/application_manager/src/commands/hmi/ui_get_capabilities_response.cc @@ -78,6 +78,32 @@ void UIGetCapabilitiesResponse::Run() { hmi_capabilities.set_phone_call_supported( msg_params[strings::hmi_capabilities][strings::phone_call].asBool()); } + if (msg_params[strings::hmi_capabilities].keyExists( + strings::video_streaming)) { + hmi_capabilities.set_video_streaming_supported( + msg_params[strings::hmi_capabilities][strings::video_streaming] + .asBool()); + } + } + + if (msg_params.keyExists(strings::system_capabilities)) { + if (msg_params[strings::system_capabilities].keyExists( + strings::navigation_capability)) { + hmi_capabilities.set_navigation_capability( + msg_params[strings::system_capabilities] + [strings::navigation_capability]); + } + if (msg_params[strings::system_capabilities].keyExists( + strings::phone_capability)) { + hmi_capabilities.set_phone_capability( + msg_params[strings::system_capabilities][strings::phone_capability]); + } + if (msg_params[strings::system_capabilities].keyExists( + strings::video_streaming_capability)) { + hmi_capabilities.set_video_streaming_capability( + msg_params[strings::system_capabilities] + [strings::video_streaming_capability]); + } } } diff --git a/src/components/application_manager/src/commands/hmi/ui_send_haptic_data_request.cc b/src/components/application_manager/src/commands/hmi/ui_send_haptic_data_request.cc new file mode 100644 index 0000000000..9484906a17 --- /dev/null +++ b/src/components/application_manager/src/commands/hmi/ui_send_haptic_data_request.cc @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Xevo Inc. nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "application_manager/commands/hmi/ui_send_haptic_data_request.h" + +namespace application_manager { + +namespace commands { + +UISendHapticDataRequest::UISendHapticDataRequest( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : RequestToHMI(message, application_manager) {} + +UISendHapticDataRequest::~UISendHapticDataRequest() {} + +void UISendHapticDataRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + SendRequest(); +} + +} // namespace commands + +} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_send_haptic_data_response.cc b/src/components/application_manager/src/commands/hmi/ui_send_haptic_data_response.cc new file mode 100644 index 0000000000..a8239a40e8 --- /dev/null +++ b/src/components/application_manager/src/commands/hmi/ui_send_haptic_data_response.cc @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Xevo Inc. nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include "application_manager/commands/hmi/ui_send_haptic_data_response.h" +#include "application_manager/event_engine/event.h" + +#include "interfaces/HMI_API.h" + +namespace application_manager { + +namespace commands { + +UISendHapticDataResponse::UISendHapticDataResponse( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : ResponseFromHMI(message, application_manager) {} + +UISendHapticDataResponse::~UISendHapticDataResponse() {} + +void UISendHapticDataResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + event_engine::Event event(hmi_apis::FunctionID::UI_SendHapticData); + event.set_smart_object(*message_); + event.raise(application_manager_.event_dispatcher()); +} + +} // namespace commands + +} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/add_command_request.cc b/src/components/application_manager/src/commands/mobile/add_command_request.cc index a76f537a24..c748ddcbb6 100644 --- a/src/components/application_manager/src/commands/mobile/add_command_request.cc +++ b/src/components/application_manager/src/commands/mobile/add_command_request.cc @@ -64,6 +64,11 @@ void AddCommandRequest::onTimeOut() { CommandRequestImpl::onTimeOut(); } +bool AddCommandRequest::Init() { + hash_update_mode_ = HashUpdateMode::kDoHashUpdate; + return true; +} + void AddCommandRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); @@ -492,10 +497,6 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { result_code, info.empty() ? NULL : info.c_str(), &(message[strings::msg_params])); - - if (result) { - application->UpdateHash(); - } } bool AddCommandRequest::IsPendingResponseExist() { diff --git a/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc b/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc index 6838d1af7d..a5491481dc 100644 --- a/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc +++ b/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc @@ -128,9 +128,6 @@ void AddSubMenuRequest::on_event(const event_engine::Event& event) { MessageHelper::HMIToMobileResult(result_code), response_info.empty() ? NULL : response_info.c_str(), &(message[strings::msg_params])); - if (result) { - application->UpdateHash(); - } break; } default: { @@ -140,6 +137,11 @@ void AddSubMenuRequest::on_event(const event_engine::Event& event) { } } +bool AddSubMenuRequest::Init() { + hash_update_mode_ = HashUpdateMode::kDoHashUpdate; + return true; +} + bool AddSubMenuRequest::CheckSubMenuName() { LOG4CXX_AUTO_TRACE(logger_); const char* str = NULL; diff --git a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc index 46ef39d806..e1148bd126 100644 --- a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc +++ b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc @@ -386,6 +386,11 @@ void CreateInteractionChoiceSetRequest::onTimeOut() { connection_key(), correlation_id(), function_id()); } +bool CreateInteractionChoiceSetRequest::Init() { + hash_update_mode_ = HashUpdateMode::kDoHashUpdate; + return true; +} + void CreateInteractionChoiceSetRequest::DeleteChoices() { LOG4CXX_AUTO_TRACE(logger_); @@ -421,14 +426,6 @@ void CreateInteractionChoiceSetRequest::OnAllHMIResponsesReceived() { if (!error_from_hmi_) { SendResponse(true, mobile_apis::Result::SUCCESS); - - ApplicationSharedPtr application = - application_manager_.application(connection_key()); - if (!application) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - return; - } - application->UpdateHash(); } else { DeleteChoices(); } diff --git a/src/components/application_manager/src/commands/mobile/delete_command_request.cc b/src/components/application_manager/src/commands/mobile/delete_command_request.cc index 103e87fa00..cfc8e12144 100644 --- a/src/components/application_manager/src/commands/mobile/delete_command_request.cc +++ b/src/components/application_manager/src/commands/mobile/delete_command_request.cc @@ -201,9 +201,11 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) { } SendResponse( result, result_code, info.empty() ? NULL : info.c_str(), &msg_params); - if (result) { - application->UpdateHash(); - } +} + +bool DeleteCommandRequest::Init() { + hash_update_mode_ = HashUpdateMode::kDoHashUpdate; + return true; } bool DeleteCommandRequest::IsPendingResponseExist() { diff --git a/src/components/application_manager/src/commands/mobile/delete_file_request.cc b/src/components/application_manager/src/commands/mobile/delete_file_request.cc index 31ca29cb51..984c7a1725 100644 --- a/src/components/application_manager/src/commands/mobile/delete_file_request.cc +++ b/src/components/application_manager/src/commands/mobile/delete_file_request.cc @@ -73,6 +73,13 @@ void DeleteFileRequest::Run() { const std::string& sync_file_name = (*message_)[strings::msg_params][strings::sync_file_name].asString(); + if (!file_system::IsFileNameValid(sync_file_name)) { + const std::string err_msg = "Sync file name contains forbidden symbols."; + LOG4CXX_ERROR(logger_, err_msg); + SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str()); + return; + } + std::string full_file_path = application_manager_.get_settings().app_storage_folder() + "/"; full_file_path += application->folder_name(); diff --git a/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc b/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc index 6ef8e5d9da..bfbb2429ac 100644 --- a/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc +++ b/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc @@ -90,9 +90,11 @@ void DeleteInteractionChoiceSetRequest::Run() { // Checking of HMI responses will be implemented with APPLINK-14600 const bool result = true; SendResponse(result, mobile_apis::Result::SUCCESS); - if (result) { - app->UpdateHash(); - } +} + +bool DeleteInteractionChoiceSetRequest::Init() { + hash_update_mode_ = HashUpdateMode::kDoHashUpdate; + return true; } bool DeleteInteractionChoiceSetRequest::ChoiceSetInUse( diff --git a/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc b/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc index 57748e6feb..21c7ecce90 100644 --- a/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc +++ b/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc @@ -171,9 +171,6 @@ void DeleteSubMenuRequest::on_event(const event_engine::Event& event) { MessageHelper::HMIToMobileResult(result_code), response_info.empty() ? NULL : response_info.c_str(), &(message[strings::msg_params])); - if (result) { - application->UpdateHash(); - } break; } default: { @@ -183,6 +180,11 @@ void DeleteSubMenuRequest::on_event(const event_engine::Event& event) { } } +bool DeleteSubMenuRequest::Init() { + hash_update_mode_ = HashUpdateMode::kDoHashUpdate; + return true; +} + } // namespace commands } // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/get_system_capability_request.cc b/src/components/application_manager/src/commands/mobile/get_system_capability_request.cc new file mode 100644 index 0000000000..d19e2ecbb0 --- /dev/null +++ b/src/components/application_manager/src/commands/mobile/get_system_capability_request.cc @@ -0,0 +1,98 @@ +#include "application_manager/commands/mobile/get_system_capability_request.h" + +namespace application_manager { + +namespace commands { + +GetSystemCapabilityRequest::GetSystemCapabilityRequest( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) {} + +GetSystemCapabilityRequest::~GetSystemCapabilityRequest() {} + +void GetSystemCapabilityRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + ApplicationSharedPtr app = application_manager_.application(connection_key()); + + if (!app) { + LOG4CXX_ERROR(logger_, "Application is not registered"); + SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); + return; + } + + if ((*message_)[strings::msg_params].empty()) { + LOG4CXX_ERROR(logger_, strings::msg_params << " is empty."); + SendResponse(false, mobile_apis::Result::INVALID_DATA); + return; + } + smart_objects::SmartObject response_params(smart_objects::SmartType_Map); + mobile_apis::SystemCapabilityType::eType response_type = + static_cast<mobile_apis::SystemCapabilityType::eType>( + (*message_)[strings::msg_params][strings::system_capability_type] + .asInt()); + response_params[strings::system_capability][strings::system_capability_type] = + response_type; + + const HMICapabilities& hmi_capabilities = + application_manager_.hmi_capabilities(); + + switch (response_type) { + case mobile_apis::SystemCapabilityType::NAVIGATION: { + if (hmi_capabilities.navigation_capability()) { + response_params[strings::system_capability] + [strings::navigation_capability] = + *hmi_capabilities.navigation_capability(); + } else { + SendResponse(false, mobile_apis::Result::DATA_NOT_AVAILABLE); + return; + } + break; + } + case mobile_apis::SystemCapabilityType::PHONE_CALL: { + if (hmi_capabilities.phone_capability()) { + response_params[strings::system_capability][strings::phone_capability] = + *hmi_capabilities.phone_capability(); + } else { + SendResponse(false, mobile_apis::Result::DATA_NOT_AVAILABLE); + return; + } + break; + } + case mobile_apis::SystemCapabilityType::REMOTE_CONTROL: { + if (hmi_capabilities.rc_capability()) { + response_params[strings::system_capability][strings::rc_capability] = + *hmi_capabilities.rc_capability(); + } else { + SendResponse(false, mobile_apis::Result::DATA_NOT_AVAILABLE); + return; + } + break; + } + case mobile_apis::SystemCapabilityType::VIDEO_STREAMING: + if (hmi_capabilities.video_streaming_capability()) { + response_params[strings::system_capability] + [strings::video_streaming_capability] = + *hmi_capabilities.video_streaming_capability(); + } else { + SendResponse(false, mobile_apis::Result::DATA_NOT_AVAILABLE); + return; + } + break; + case mobile_apis::SystemCapabilityType::AUDIO_STREAMING: + SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE); + return; + default: // Return unsupported resource + SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE); + return; + } + SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params); +} + +void GetSystemCapabilityRequest::on_event(const event_engine::Event& event) { + LOG4CXX_INFO(logger_, "GetSystemCapabilityRequest on_event"); +} + +} // namespace commands + +} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/get_system_capability_response.cc b/src/components/application_manager/src/commands/mobile/get_system_capability_response.cc new file mode 100644 index 0000000000..91c2562cd3 --- /dev/null +++ b/src/components/application_manager/src/commands/mobile/get_system_capability_response.cc @@ -0,0 +1,22 @@ +#include "application_manager/application_manager.h" +#include "application_manager/commands/mobile/get_system_capability_response.h" + +namespace application_manager { + +namespace commands { + +GetSystemCapabilityResponse::GetSystemCapabilityResponse( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} + +GetSystemCapabilityResponse::~GetSystemCapabilityResponse() {} + +void GetSystemCapabilityResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + application_manager_.SendMessageToMobile(message_); +} + +} // namespace commands + +} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/get_way_points_request.cc b/src/components/application_manager/src/commands/mobile/get_way_points_request.cc index 198964a333..c313d74d4b 100644 --- a/src/components/application_manager/src/commands/mobile/get_way_points_request.cc +++ b/src/components/application_manager/src/commands/mobile/get_way_points_request.cc @@ -8,7 +8,9 @@ namespace commands { GetWayPointsRequest::GetWayPointsRequest( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} + : CommandRequestImpl(message, application_manager) { + subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout); +} GetWayPointsRequest::~GetWayPointsRequest() {} @@ -38,6 +40,12 @@ void GetWayPointsRequest::on_event(const event_engine::Event& event) { LOG4CXX_AUTO_TRACE(logger_); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { + case hmi_apis::FunctionID::UI_OnResetTimeout: { + LOG4CXX_INFO(logger_, "Received UI_OnResetTimeout event"); + application_manager_.updateRequestTimeout( + connection_key(), correlation_id(), default_timeout()); + break; + } case hmi_apis::FunctionID::Navigation_GetWayPoints: { LOG4CXX_INFO(logger_, "Received Navigation_GetWayPoints event"); const hmi_apis::Common_Result::eType result_code = diff --git a/src/components/application_manager/src/commands/mobile/list_files_request.cc b/src/components/application_manager/src/commands/mobile/list_files_request.cc index 425f1ddb46..794fba631d 100644 --- a/src/components/application_manager/src/commands/mobile/list_files_request.cc +++ b/src/components/application_manager/src/commands/mobile/list_files_request.cc @@ -76,22 +76,21 @@ void ListFilesRequest::Run() { (*message_)[strings::msg_params][strings::space_available] = static_cast<int32_t>(application->GetAvailableDiskSpace()); + // Enumarating through File system uint32_t i = 0; - const AppFilesMap& app_files = application->getAppFiles(); - for (AppFilesMap::const_iterator it = app_files.begin(); - it != app_files.end(); - ++it) { - std::string filename = it->first.substr(it->first.find_last_of('/') + 1); - // In AppFile to application stored full path to file. In message required - // to write only name file. - // Plus one required for move to next letter after '/'. + std::string directory_name = + application_manager_.get_settings().app_storage_folder(); + directory_name += "/" + application->folder_name(); + std::vector<std::string> persistent_files = + file_system::ListFiles(directory_name); + std::vector<std::string>::const_iterator it = persistent_files.begin(); + for (; it != persistent_files.end(); ++it) { if (i < application_manager_.get_settings().list_files_response_size()) { - LOG4CXX_DEBUG(logger_, - "File " + filename + " added to ListFiles response"); - (*message_)[strings::msg_params][strings::filenames][i++] = filename; + LOG4CXX_DEBUG(logger_, "File " + *it + " added to ListFiles response"); + (*message_)[strings::msg_params][strings::filenames][i++] = *it; } else { LOG4CXX_DEBUG(logger_, - "File " + filename + " not added to ListFiles response"); + "File " + *it + " not added to ListFiles response"); } } (*message_)[strings::params][strings::message_type] = diff --git a/src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc b/src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc index 9b16bd3572..4bb6cfe9d5 100644 --- a/src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc +++ b/src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc @@ -75,10 +75,13 @@ void OnHMIStatusNotificationFromMobile::Run() { << connection_key() << " and handle: " << handle); if (!is_apps_requested_before && - ProtocolVersion::kV4 == app->protocol_version() && app->is_foreground()) { + Message::is_sufficient_version( + protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4, + app->protocol_version()) && + app->is_foreground()) { // In case this notification will be received from mobile side with // foreground level for app on mobile, this should trigger remote - // apps list query for SDL 4.0 app + // apps list query for SDL 4.0+ app MessageHelper::SendQueryApps(connection_key(), application_manager_); return; } @@ -89,7 +92,9 @@ void OnHMIStatusNotificationFromMobile::Run() { " for handle: " << handle); - if (ProtocolVersion::kV4 == app->protocol_version()) { + if (Message::is_sufficient_version( + protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4, + app->protocol_version())) { const ApplicationSet& accessor = application_manager_.applications().GetData(); @@ -97,7 +102,9 @@ void OnHMIStatusNotificationFromMobile::Run() { ApplicationSetConstIt it = accessor.begin(); for (; accessor.end() != it; ++it) { if (connection_key() != (*it)->app_id() && - ProtocolVersion::kV4 == (*it)->protocol_version() && + Message::is_sufficient_version( + protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4, + (*it)->protocol_version()) && (*it)->is_foreground()) { is_another_foreground_sdl4_app = true; break; diff --git a/src/components/application_manager/src/commands/mobile/on_touch_event_notification.cc b/src/components/application_manager/src/commands/mobile/on_touch_event_notification.cc index c769194c95..2a9969eac4 100644 --- a/src/components/application_manager/src/commands/mobile/on_touch_event_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_touch_event_notification.cc @@ -50,17 +50,34 @@ OnTouchEventNotification::~OnTouchEventNotification() {} void OnTouchEventNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); - const std::vector<ApplicationSharedPtr>& applications = + const std::vector<ApplicationSharedPtr>& applications_with_navi = application_manager_.applications_with_navi(); - std::vector<ApplicationSharedPtr>::const_iterator it = applications.begin(); - for (; applications.end() != it; ++it) { - ApplicationSharedPtr app = *it; + const std::vector<ApplicationSharedPtr>& projection_applications = + application_manager_.applications_with_mobile_projection(); + + std::vector<ApplicationSharedPtr>::const_iterator nav_it = + applications_with_navi.begin(); + + for (; applications_with_navi.end() != nav_it; ++nav_it) { + ApplicationSharedPtr app = *nav_it; if (app->IsFullscreen()) { (*message_)[strings::params][strings::connection_key] = app->app_id(); SendNotification(); } } + + std::vector<ApplicationSharedPtr>::const_iterator projection_it = + projection_applications.begin(); + + for (; projection_applications.end() != projection_it; ++projection_it) { + ApplicationSharedPtr projection_app = *projection_it; + if (projection_app->IsFullscreen()) { + (*message_)[strings::params][strings::connection_key] = + projection_app->app_id(); + SendNotification(); + } + } } } // namespace mobile diff --git a/src/components/application_manager/src/commands/mobile/put_file_request.cc b/src/components/application_manager/src/commands/mobile/put_file_request.cc index 68e7ad60d1..602b420ba0 100644 --- a/src/components/application_manager/src/commands/mobile/put_file_request.cc +++ b/src/components/application_manager/src/commands/mobile/put_file_request.cc @@ -110,6 +110,17 @@ void PutFileRequest::Run() { } sync_file_name_ = (*message_)[strings::msg_params][strings::sync_file_name].asString(); + + if (!file_system::IsFileNameValid(sync_file_name_)) { + const std::string err_msg = "Sync file name contains forbidden symbols."; + LOG4CXX_ERROR(logger_, err_msg); + SendResponse(false, + mobile_apis::Result::INVALID_DATA, + err_msg.c_str(), + &response_params); + return; + } + file_type_ = static_cast<mobile_apis::FileType::eType>( (*message_)[strings::msg_params][strings::file_type].asInt()); const std::vector<uint8_t> binary_data = diff --git a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc index 413aa1f669..74bc0c032e 100644 --- a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc @@ -74,6 +74,12 @@ mobile_apis::AppHMIType::eType StringToAppHMIType(const std::string& str) { return mobile_apis::AppHMIType::TESTING; } else if ("SYSTEM" == str) { return mobile_apis::AppHMIType::SYSTEM; + } else if ("PROJECTION" == str) { + return mobile_apis::AppHMIType::PROJECTION; +#ifdef SDL_REMOTE_CONTROL + } else if ("REMOTE_CONTROL" == str) { + return mobile_apis::AppHMIType::REMOTE_CONTROL; +#endif } else { return mobile_apis::AppHMIType::INVALID_ENUM; } @@ -82,6 +88,9 @@ mobile_apis::AppHMIType::eType StringToAppHMIType(const std::string& str) { std::string AppHMITypeToString(mobile_apis::AppHMIType::eType type) { const std::map<mobile_apis::AppHMIType::eType, std::string> app_hmi_type_map = {{mobile_apis::AppHMIType::DEFAULT, "DEFAULT"}, +#ifdef SDL_REMOTE_CONTROL + {mobile_apis::AppHMIType::REMOTE_CONTROL, "REMOTE_CONTROL"}, +#endif // SDL_REMOTE_CONTROL {mobile_apis::AppHMIType::COMMUNICATION, "COMMUNICATION"}, {mobile_apis::AppHMIType::MEDIA, "MEDIA"}, {mobile_apis::AppHMIType::MESSAGING, "MESSAGING"}, @@ -90,7 +99,8 @@ std::string AppHMITypeToString(mobile_apis::AppHMIType::eType type) { {mobile_apis::AppHMIType::SOCIAL, "SOCIAL"}, {mobile_apis::AppHMIType::BACKGROUND_PROCESS, "BACKGROUND_PROCESS"}, {mobile_apis::AppHMIType::TESTING, "TESTING"}, - {mobile_apis::AppHMIType::SYSTEM, "SYSTEM"}}; + {mobile_apis::AppHMIType::SYSTEM, "SYSTEM"}, + {mobile_apis::AppHMIType::PROJECTION, "PROJECTION"}}; std::map<mobile_apis::AppHMIType::eType, std::string>::const_iterator iter = app_hmi_type_map.find(type); @@ -319,6 +329,11 @@ void RegisterAppInterfaceRequest::Run() { app_type.getElement(i).asUInt())) { application->set_voice_communication_supported(true); } + if (mobile_apis::AppHMIType::PROJECTION == + static_cast<mobile_apis::AppHMIType::eType>( + app_type.getElement(i).asUInt())) { + application->set_mobile_projection_enabled(true); + } } } @@ -477,6 +492,8 @@ void FillUIRelatedFields(smart_objects::SmartObject& response_params, hmi_capabilities.navigation_supported(); response_params[strings::hmi_capabilities][strings::phone_call] = hmi_capabilities.phone_call_supported(); + response_params[strings::hmi_capabilities][strings::video_streaming] = + hmi_capabilities.video_streaming_supported(); } void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() { @@ -663,6 +680,12 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() { SendResponse(true, result_code, add_info.c_str(), &response_params); SendOnAppRegisteredNotificationToHMI( *(application.get()), resumption, need_restore_vr); +#ifdef SDL_REMOTE_CONTROL + if (msg_params.keyExists(strings::app_hmi_type)) { + GetPolicyHandler().SetDefaultHmiTypes(application->policy_app_id(), + &(msg_params[strings::app_hmi_type])); + } +#endif // SDL_REMOTE_CONTROL // Default HMI level should be set before any permissions validation, since it // relies on HMI level. diff --git a/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc b/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc index b1dce9151f..713d50e190 100644 --- a/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc +++ b/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc @@ -242,9 +242,6 @@ void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { LOG4CXX_AUTO_TRACE(logger_); const smart_objects::SmartObject& message = event.smart_object(); - ApplicationSharedPtr application = - application_manager_.application(connection_key()); - switch (event.id()) { case hmi_apis::FunctionID::UI_SetGlobalProperties: { LOG4CXX_INFO(logger_, "Received UI_SetGlobalProperties event"); @@ -281,15 +278,11 @@ void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { static_cast<mobile_apis::Result::eType>(result_code), response_info.empty() ? NULL : response_info.c_str(), &(message[strings::msg_params])); +} - if (!application) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - return; - } - - if (result) { - application->UpdateHash(); - } +bool ResetGlobalPropertiesRequest::Init() { + hash_update_mode_ = HashUpdateMode::kDoHashUpdate; + return true; } bool ResetGlobalPropertiesRequest::PrepareResponseParameters( diff --git a/src/components/application_manager/src/commands/mobile/send_haptic_data_request.cc b/src/components/application_manager/src/commands/mobile/send_haptic_data_request.cc new file mode 100644 index 0000000000..cabfef15f6 --- /dev/null +++ b/src/components/application_manager/src/commands/mobile/send_haptic_data_request.cc @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Xevo Inc. nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "application_manager/commands/mobile/send_haptic_data_request.h" +#include "interfaces/MOBILE_API.h" + +namespace application_manager { + +namespace commands { + +namespace custom_str = utils::custom_string; + +SendHapticDataRequest::SendHapticDataRequest( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) {} + +SendHapticDataRequest::~SendHapticDataRequest() {} + +void SendHapticDataRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; + SendHMIRequest(hmi_apis::FunctionID::UI_SendHapticData, &msg_params, true); +} + +void SendHapticDataRequest::on_event(const event_engine::Event& event) { + LOG4CXX_AUTO_TRACE(logger_); + using namespace helpers; + + const smart_objects::SmartObject& message = event.smart_object(); + + switch (event.id()) { + case hmi_apis::FunctionID::UI_SendHapticData: { + mobile_apis::Result::eType result_code = + GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>( + message[strings::params][hmi_response::code].asUInt())); + + const bool result = Compare<mobile_api::Result::eType, EQ, ONE>( + result_code, + mobile_api::Result::SUCCESS, + mobile_api::Result::WARNINGS); + + SendResponse(result, result_code, NULL, &(message[strings::msg_params])); + break; + } + default: { + LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + return; + } + } +} + +} // namespace commands + +} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/send_haptic_data_response.cc b/src/components/application_manager/src/commands/mobile/send_haptic_data_response.cc new file mode 100644 index 0000000000..c8649d34af --- /dev/null +++ b/src/components/application_manager/src/commands/mobile/send_haptic_data_response.cc @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Xevo Inc. nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "application_manager/commands/mobile/send_haptic_data_response.h" + +namespace application_manager { + +namespace commands { + +SendHapticDataResponse::SendHapticDataResponse( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} + +SendHapticDataResponse::~SendHapticDataResponse() {} + +void SendHapticDataResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + application_manager_.SendMessageToMobile(message_); +} + +} // namespace commands + +} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc b/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc index 5d70a2fb5b..5afddfb4d0 100644 --- a/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc @@ -71,6 +71,13 @@ void SetAppIconRequest::Run() { const std::string& sync_file_name = (*message_)[strings::msg_params][strings::sync_file_name].asString(); + if (!file_system::IsFileNameValid(sync_file_name)) { + const std::string err_msg = "Sync file name contains forbidden symbols."; + LOG4CXX_ERROR(logger_, err_msg); + SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str()); + return; + } + std::string full_file_path = application_manager_.get_settings().app_storage_folder() + "/"; full_file_path += app->folder_name(); @@ -113,9 +120,10 @@ void SetAppIconRequest::Run() { void SetAppIconRequest::CopyToIconStorage( const std::string& path_to_file) const { - if (!application_manager_.protocol_handler() - .get_settings() - .enable_protocol_4()) { + if (!(application_manager_.protocol_handler() + .get_settings() + .max_supported_protocol_version() >= + protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4)) { LOG4CXX_WARN(logger_, "Icon copying skipped, since protocol ver. 4 is not enabled."); return; diff --git a/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc b/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc index fcfea5e744..096c4ed783 100644 --- a/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc @@ -265,15 +265,11 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { result_code, response_info.empty() ? NULL : response_info.c_str(), &(message[strings::msg_params])); +} - if (!application) { - LOG4CXX_DEBUG(logger_, "NULL pointer."); - return; - } - - if (result) { - application->UpdateHash(); - } +bool SetGlobalPropertiesRequest::Init() { + hash_update_mode_ = HashUpdateMode::kDoHashUpdate; + return true; } bool SetGlobalPropertiesRequest::PrepareResponseParameters( diff --git a/src/components/application_manager/src/commands/mobile/show_request.cc b/src/components/application_manager/src/commands/mobile/show_request.cc index cf2509cdb9..5b8e98d7ea 100644 --- a/src/components/application_manager/src/commands/mobile/show_request.cc +++ b/src/components/application_manager/src/commands/mobile/show_request.cc @@ -45,10 +45,46 @@ namespace commands { ShowRequest::ShowRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} + : CommandRequestImpl(message, application_manager) + , core_result_code_(mobile_apis::Result::INVALID_ENUM) {} ShowRequest::~ShowRequest() {} +void ShowRequest::HandleMetadata(const char* field_id, + int32_t field_index, + smart_objects::SmartObject& msg_params) { + smart_objects::SmartObject& metadata_tags = + (*message_)[strings::msg_params][strings::metadata_tags]; + + if (metadata_tags.keyExists(field_id)) { + if (field_index != -1) { + msg_params[hmi_request::show_strings][field_index] + [hmi_request::field_types] = + smart_objects::SmartObject(smart_objects::SmartType_Array); + + const size_t num_tags = metadata_tags[field_id].length(); + for (size_t i = 0; i < num_tags; ++i) { + const int32_t current_tag = metadata_tags[field_id][i].asInt(); + msg_params[hmi_request::show_strings][field_index] + [hmi_request::field_types][i] = current_tag; + } + } else { + LOG4CXX_INFO(logger_, + "metadata tag provided with no item for " + << field_id << ", ignoring with warning"); + // tag provided with no item, ignore with warning + if (mobile_apis::Result::INVALID_ENUM == core_result_code_) { + core_result_code_ = mobile_apis::Result::WARNINGS; + core_response_info_ = + "Metadata tag was provided for a field with no data."; + } + } + } else { + LOG4CXX_INFO(logger_, + "No metadata tagging provided for field: " << field_id); + } +} + void ShowRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); @@ -125,38 +161,53 @@ void ShowRequest::Run() { smart_objects::SmartObject(smart_objects::SmartType_Array); int32_t index = 0; + int32_t main_field_1_index = -1; if ((*message_)[strings::msg_params].keyExists(strings::main_field_1)) { msg_params[hmi_request::show_strings][index][hmi_request::field_name] = static_cast<int32_t>(hmi_apis::Common_TextFieldName::mainField1); msg_params[hmi_request::show_strings][index][hmi_request::field_text] = (*message_)[strings::msg_params][strings::main_field_1]; + main_field_1_index = index; ++index; } + int32_t main_field_2_index = -1; if ((*message_)[strings::msg_params].keyExists(strings::main_field_2)) { msg_params[hmi_request::show_strings][index][hmi_request::field_name] = static_cast<int32_t>(hmi_apis::Common_TextFieldName::mainField2); msg_params[hmi_request::show_strings][index][hmi_request::field_text] = (*message_)[strings::msg_params][strings::main_field_2]; + main_field_2_index = index; ++index; } + int32_t main_field_3_index = -1; if ((*message_)[strings::msg_params].keyExists(strings::main_field_3)) { msg_params[hmi_request::show_strings][index][hmi_request::field_name] = static_cast<int32_t>(hmi_apis::Common_TextFieldName::mainField3); msg_params[hmi_request::show_strings][index][hmi_request::field_text] = (*message_)[strings::msg_params][strings::main_field_3]; + main_field_3_index = index; ++index; } + int32_t main_field_4_index = -1; if ((*message_)[strings::msg_params].keyExists(strings::main_field_4)) { msg_params[hmi_request::show_strings][index][hmi_request::field_name] = static_cast<int32_t>(hmi_apis::Common_TextFieldName::mainField4); msg_params[hmi_request::show_strings][index][hmi_request::field_text] = (*message_)[strings::msg_params][strings::main_field_4]; + main_field_4_index = index; ++index; } + if ((*message_)[strings::msg_params].keyExists(strings::metadata_tags)) { + HandleMetadata(strings::main_field_1, main_field_1_index, msg_params); + HandleMetadata(strings::main_field_2, main_field_2_index, msg_params); + HandleMetadata(strings::main_field_3, main_field_3_index, msg_params); + HandleMetadata(strings::main_field_4, main_field_4_index, msg_params); + } + if ((*message_)[strings::msg_params].keyExists(strings::media_clock)) { msg_params[hmi_request::show_strings][index][hmi_request::field_name] = static_cast<int32_t>(hmi_apis::Common_TextFieldName::mediaClock); @@ -239,8 +290,15 @@ void ShowRequest::on_event(const event_engine::Event& event) { response_info = message[strings::params][hmi_response::message].asString(); } + mobile_apis::Result::eType converted_result_code = + MessageHelper::HMIToMobileResult(result_code); + if (mobile_apis::Result::SUCCESS == converted_result_code && + mobile_apis::Result::INVALID_ENUM != core_result_code_) { + converted_result_code = core_result_code_; + response_info = core_response_info_; + } SendResponse(result, - MessageHelper::HMIToMobileResult(result_code), + converted_result_code, response_info.empty() ? NULL : response_info.c_str(), &(message[strings::msg_params])); break; diff --git a/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc index eb6bbf545e..4d11467d2d 100644 --- a/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc +++ b/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc @@ -86,10 +86,11 @@ void SubscribeButtonRequest::Run() { const bool is_succedeed = true; SendResponse(is_succedeed, mobile_apis::Result::SUCCESS); +} - if (is_succedeed) { - app->UpdateHash(); - } +bool SubscribeButtonRequest::Init() { + hash_update_mode_ = HashUpdateMode::kDoHashUpdate; + return true; } bool SubscribeButtonRequest::IsSubscriptionAllowed( @@ -104,34 +105,6 @@ bool SubscribeButtonRequest::IsSubscriptionAllowed( return true; } -bool SubscribeButtonRequest::CheckHMICapabilities( - mobile_apis::ButtonName::eType button) { - using namespace smart_objects; - using namespace mobile_apis; - LOG4CXX_AUTO_TRACE(logger_); - - const HMICapabilities& hmi_caps = application_manager_.hmi_capabilities(); - if (!hmi_caps.is_ui_cooperating()) { - LOG4CXX_ERROR(logger_, "UI is not supported by HMI."); - return false; - } - - const SmartObject* button_caps_ptr = hmi_caps.button_capabilities(); - if (button_caps_ptr) { - const SmartObject& button_caps = *button_caps_ptr; - const size_t length = button_caps.length(); - for (size_t i = 0; i < length; ++i) { - const SmartObject& caps = button_caps[i]; - const ButtonName::eType name = static_cast<ButtonName::eType>( - caps.getElement(hmi_response::button_name).asInt()); - if (name == button) { - return true; - } - } - } - return false; -} - void SubscribeButtonRequest::SendSubscribeButtonNotification() { using namespace smart_objects; using namespace hmi_apis; diff --git a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc index 56027bacaf..fc839a43f4 100644 --- a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc +++ b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc @@ -264,13 +264,14 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { result_code, response_info.empty() ? NULL : response_info.c_str(), &(message[strings::msg_params])); - - if (is_succeeded) { - app->UpdateHash(); - } #endif // #ifdef HMI_DBUS_API } +bool SubscribeVehicleDataRequest::Init() { + hash_update_mode_ = HashUpdateMode::kDoHashUpdate; + return true; +} + void SubscribeVehicleDataRequest::AddAlreadySubscribedVI( smart_objects::SmartObject& msg_params) const { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc index 29cc8e6541..0e0d760228 100644 --- a/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc +++ b/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc @@ -33,7 +33,6 @@ void SubscribeWayPointsRequest::Run() { if (application_manager_.IsAnyAppSubscribedForWayPoints()) { application_manager_.SubscribeAppForWayPoints(app->app_id()); SendResponse(true, mobile_apis::Result::SUCCESS); - app->UpdateHash(); return; } @@ -62,9 +61,6 @@ void SubscribeWayPointsRequest::on_event(const event_engine::Event& event) { MessageHelper::HMIToMobileResult(result_code), response_info.empty() ? NULL : response_info.c_str(), &(message[strings::msg_params])); - if (result) { - app->UpdateHash(); - } break; } default: { @@ -74,6 +70,11 @@ void SubscribeWayPointsRequest::on_event(const event_engine::Event& event) { } } +bool SubscribeWayPointsRequest::Init() { + hash_update_mode_ = HashUpdateMode::kDoHashUpdate; + return true; +} + } // namespace commands } // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/system_request.cc b/src/components/application_manager/src/commands/mobile/system_request.cc index 0d3334a1a1..e4706441ef 100644 --- a/src/components/application_manager/src/commands/mobile/system_request.cc +++ b/src/components/application_manager/src/commands/mobile/system_request.cc @@ -467,6 +467,20 @@ void SystemRequest::Run() { file_name = kSYNC; } + if (!CheckSyntax(file_name)) { + LOG4CXX_ERROR(logger_, + "Incoming request contains \t\n \\t \\n or whitespace"); + SendResponse(false, mobile_apis::Result::INVALID_DATA); + return; + } + + if (!file_system::IsFileNameValid(file_name)) { + const std::string err_msg = "Sync file name contains forbidden symbols."; + LOG4CXX_ERROR(logger_, err_msg); + SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str()); + return; + } + bool is_system_file = std::string::npos != file_name.find(kSYNC) || std::string::npos != file_name.find(kIVSU); diff --git a/src/components/application_manager/src/commands/mobile/unregister_app_interface_request.cc b/src/components/application_manager/src/commands/mobile/unregister_app_interface_request.cc index d7056a624e..d40ad9c870 100644 --- a/src/components/application_manager/src/commands/mobile/unregister_app_interface_request.cc +++ b/src/components/application_manager/src/commands/mobile/unregister_app_interface_request.cc @@ -53,6 +53,7 @@ void UnregisterAppInterfaceRequest::Run() { connection_key(), mobile_api::AppInterfaceUnregisteredReason::INVALID_ENUM), commands::Command::ORIGIN_SDL); + application_manager_.EndNaviServices(connection_key()); application_manager_.UnregisterApplication(connection_key(), mobile_apis::Result::SUCCESS); SendResponse(true, mobile_apis::Result::SUCCESS); diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc index e1bdba61a0..7e798bcb4e 100644 --- a/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc +++ b/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc @@ -58,8 +58,16 @@ void UnsubscribeButtonRequest::Run() { return; } - const uint32_t btn_id = - (*message_)[str::msg_params][str::button_name].asUInt(); + const mobile_apis::ButtonName::eType btn_id = + static_cast<mobile_apis::ButtonName::eType>( + (*message_)[str::msg_params][str::button_name].asInt()); + + if (!CheckHMICapabilities(btn_id)) { + LOG4CXX_ERROR(logger_, + "Button " << btn_id << " isn't allowed by HMI capabilities"); + SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE); + return; + } if (!app->UnsubscribeFromButton( static_cast<mobile_apis::ButtonName::eType>(btn_id))) { @@ -70,7 +78,11 @@ void UnsubscribeButtonRequest::Run() { SendUnsubscribeButtonNotification(); SendResponse(true, mobile_apis::Result::SUCCESS); - app->UpdateHash(); +} + +bool UnsubscribeButtonRequest::Init() { + hash_update_mode_ = HashUpdateMode::kDoHashUpdate; + return true; } void UnsubscribeButtonRequest::SendUnsubscribeButtonNotification() { @@ -81,7 +93,7 @@ void UnsubscribeButtonRequest::SendUnsubscribeButtonNotification() { SmartObject msg_params = SmartObject(SmartType_Map); msg_params[strings::app_id] = connection_key(); msg_params[strings::name] = static_cast<Common_ButtonName::eType>( - (*message_)[strings::msg_params][strings::button_name].asUInt()); + (*message_)[strings::msg_params][strings::button_name].asInt()); msg_params[strings::is_suscribed] = false; CreateHMINotification(FunctionID::Buttons_OnButtonSubscription, msg_params); } diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc index 9b0c0a673f..fa3a9ad400 100644 --- a/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc +++ b/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc @@ -342,11 +342,17 @@ void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { response_info.empty() ? NULL : response_info.c_str(), &(message[strings::msg_params])); if (result) { - UpdateHash(); + application_manager_.TerminateRequest( + connection_key(), correlation_id(), function_id()); } #endif // #ifdef HMI_DBUS_API } +bool UnsubscribeVehicleDataRequest::Init() { + hash_update_mode_ = HashUpdateMode::kDoHashUpdate; + return true; +} + struct SubscribedToIVIPredicate { int32_t vehicle_info_; SubscribedToIVIPredicate(int32_t vehicle_info) @@ -387,20 +393,5 @@ void UnsubscribeVehicleDataRequest::AddAlreadyUnsubscribedVI( } } -void UnsubscribeVehicleDataRequest::UpdateHash() const { - LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr application = - application_manager_.application(connection_key()); - if (application) { - application->UpdateHash(); - } else { - LOG4CXX_ERROR(logger_, - "Application with connection_key = " << connection_key() - << " doesn't exist."); - } - application_manager_.TerminateRequest( - connection_key(), correlation_id(), function_id()); -} - } // namespace commands } // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc index 728209fcf2..953bbc7a12 100644 --- a/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc +++ b/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc @@ -55,9 +55,6 @@ void UnSubscribeWayPointsRequest::on_event(const event_engine::Event& event) { MessageHelper::HMIToMobileResult(result_code), response_info.empty() ? NULL : response_info.c_str(), &(message[strings::msg_params])); - if (result) { - app->UpdateHash(); - } break; } default: { @@ -67,6 +64,11 @@ void UnSubscribeWayPointsRequest::on_event(const event_engine::Event& event) { } } +bool UnSubscribeWayPointsRequest::Init() { + hash_update_mode_ = HashUpdateMode::kDoHashUpdate; + return true; +} + } // namespace commands } // namespace application_manager diff --git a/src/components/application_manager/src/core_service.cc b/src/components/application_manager/src/core_service.cc new file mode 100644 index 0000000000..2a96502cde --- /dev/null +++ b/src/components/application_manager/src/core_service.cc @@ -0,0 +1,231 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include <vector> +#include <algorithm> +#include "application_manager/core_service.h" +#include "application_manager/application_manager_impl.h" +#include "application_manager/policies/policy_handler.h" +#include "application_manager/message_helper.h" +#include "json/json.h" +#include "interfaces/HMI_API.h" + +namespace application_manager { + +namespace { +struct AppExtensionPredicate { + AppExtensionUID uid; + bool operator()(const ApplicationSharedPtr app) { + return app ? app->QueryInterface(uid).valid() : false; + } +}; +} + +CoreService::CoreService(ApplicationManager& application_manager) + : application_manager_(application_manager) {} + +CoreService::~CoreService() {} + +mobile_apis::Result::eType CoreService::CheckPolicyPermissions(MessagePtr msg) { + ApplicationSharedPtr app = GetApplication(msg->connection_key()); + if (!app) { + return mobile_apis::Result::eType::APPLICATION_NOT_REGISTERED; + } + +#ifdef SDL_REMOTE_CONTROL + const RPCParams rpc_params; + CommandParametersPermissions params; + const mobile_apis::Result::eType ret = + application_manager_.CheckPolicyPermissions( + app, msg->function_name(), rpc_params, ¶ms); + + if (ret != mobile_apis::Result::eType::SUCCESS) { + return ret; + } + + if (!AreParametersAllowed(msg, params)) { + return mobile_apis::Result::eType::DISALLOWED; + } + + return ret; +#else + return mobile_apis::Result::eType::SUCCESS; +#endif // SDL_REMOTE_CONTROL +} + +bool CoreService::CheckModule(const ApplicationId& app_id, + const std::string& module) { +#ifdef SDL_REMOTE_CONTROL + ApplicationSharedPtr app = GetApplication(app_id); + if (app) { + return application_manager_.GetPolicyHandler().CheckModule( + app->policy_app_id(), module); + } +#endif // SDL_REMOTE_CONTROL + return false; +} + +bool CoreService::IsRemoteControlApplication(ApplicationSharedPtr app) const { +#ifdef SDL_REMOTE_CONTROL + DCHECK_OR_RETURN(app, false); + return application_manager_.GetPolicyHandler().CheckHMIType( + app->policy_app_id(), + mobile_apis::AppHMIType::eType::REMOTE_CONTROL, + app->app_types()); +#endif // SDL_REMOTE_CONTROL + return false; +} + +bool CoreService::IsInterfaceAvailable( + const HmiInterfaces::InterfaceID interface) const { +#ifdef SDL_REMOTE_CONTROL + HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces(); + const HmiInterfaces::InterfaceState state = + hmi_interfaces.GetInterfaceState(interface); + return HmiInterfaces::STATE_NOT_AVAILABLE != state; +#endif // SDL_REMOTE_CONTROL + return false; +} + +void CoreService::RemoveHMIFakeParameters( + application_manager::MessagePtr& message) { + application_manager_.RemoveHMIFakeParameters(message); +} + +ApplicationSharedPtr CoreService::GetApplication(ApplicationId app_id) { + return application_manager_.application(app_id); +} + +void CoreService::SendMessageToHMI(const MessagePtr& message) { + application_manager_.SendPostMessageToHMI(message); +} + +void CoreService::SendMessageToMobile(const MessagePtr& message) { + application_manager_.SendPostMessageToMobile(message); +} + +uint32_t CoreService::GetNextCorrelationID() { + return application_manager_.GetNextHMICorrelationID(); +} + +std::vector<ApplicationSharedPtr> CoreService::GetApplications( + AppExtensionUID uid) { + ApplicationSet accessor = application_manager_.applications().GetData(); + AppExtensionPredicate predicate; + predicate.uid = uid; + + std::vector<ApplicationSharedPtr> result; + ApplicationSetConstIt it = + std::find_if(accessor.begin(), accessor.end(), predicate); + while (it != accessor.end()) { + result.push_back(*it); + it = std::find_if(++it, accessor.end(), predicate); + } + return result; +} + +void CoreService::ChangeNotifyHMILevel(ApplicationSharedPtr app, + mobile_apis::HMILevel::eType level) { + DCHECK_OR_RETURN_VOID(app); + application_manager_.ChangeAppsHMILevel(app->app_id(), level); +} + +const smart_objects::SmartObject* CoreService::GetRCCapabilities() const { + return application_manager_.hmi_capabilities().rc_capability(); +} + +void CoreService::NotifyHMIAboutHMILevel(ApplicationSharedPtr app, + mobile_apis::HMILevel::eType level) { + DCHECK_OR_RETURN_VOID(app); + if (app->hmi_level() != mobile_apis::HMILevel::eType::HMI_FULL) { + MessageHelper::SendActivateAppToHMI( + app->app_id(), + application_manager_, + static_cast<hmi_apis::Common_HMILevel::eType>(level), + true); + } +} + +bool CoreService::AreParametersAllowed( + MessagePtr msg, const CommandParametersPermissions& params) { + Json::Reader reader; + Json::Value json; + bool ret = reader.parse(msg->json_message(), json); + if (ret) { + return CheckParams(json.get(strings::params, Json::Value(Json::nullValue)), + params.allowed_params); + } + return false; +} + +bool CoreService::CheckParams(const Json::Value& object, + const RPCParams& allowed_params) { + if (!object.isObject()) { + return true; + } + for (Json::Value::iterator i = object.begin(); i != object.end(); ++i) { + std::string name = i.memberName(); + if (!IsAllowed(name, allowed_params)) { + return false; + } + } + return true; +} + +bool CoreService::IsAllowed(const std::string& name, + const RPCParams& allowed_params) { + return std::find(allowed_params.begin(), allowed_params.end(), name) != + allowed_params.end(); +} + +bool CoreService::GetModuleTypes(const std::string& policy_app_id, + std::vector<std::string>* modules) const { +#ifdef SDL_REMOTE_CONTROL + return application_manager_.GetPolicyHandler().GetModuleTypes(policy_app_id, + modules); +#endif // SDL_REMOTE_CONTROL + return false; +} + +MessageValidationResult CoreService::ValidateMessageBySchema( + const Message& message) { + const MessageValidationResult result = + application_manager_.ValidateMessageBySchema(message); + LOG4CXX_DEBUG(logger_, "Validation result : " << result); + return result; +} + +const ApplicationManagerSettings& CoreService::GetSettings() const { + return application_manager_.get_settings(); +} + +} // namespace application_manager diff --git a/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc b/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc index f8b8bc791d..d0bc0c41ef 100644 --- a/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc +++ b/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc @@ -63,9 +63,10 @@ void EventDispatcherImpl::raise_event(const Event& event) { // Call observers EventObserver* temp; while (!observers_.empty()) { - AutoLock auto_lock(observer_lock_); + observer_lock_.Acquire(); temp = *observers_.begin(); observers_.erase(observers_.begin()); + observer_lock_.Release(); temp->on_event(event); } } diff --git a/src/components/application_manager/src/hmi_capabilities_impl.cc b/src/components/application_manager/src/hmi_capabilities_impl.cc index 9d52cc98db..1c6e439ee8 100644 --- a/src/components/application_manager/src/hmi_capabilities_impl.cc +++ b/src/components/application_manager/src/hmi_capabilities_impl.cc @@ -68,6 +68,10 @@ std::map<std::string, hmi_apis::Common_ImageFieldName::eType> std::map<std::string, hmi_apis::Common_FileType::eType> file_type_enum; std::map<std::string, hmi_apis::Common_DisplayType::eType> display_type_enum; std::map<std::string, hmi_apis::Common_CharacterSet::eType> character_set_enum; +std::map<std::string, hmi_apis::Common_VideoStreamingProtocol::eType> + video_streaming_protocol_enum; +std::map<std::string, hmi_apis::Common_VideoStreamingCodec::eType> + video_streaming_codec_enum; void InitCapabilities() { vr_enum_capabilities.insert(std::make_pair( @@ -333,6 +337,28 @@ void InitCapabilities() { std::string("CID1SET"), hmi_apis::Common_CharacterSet::CID1SET)); character_set_enum.insert(std::make_pair( std::string("CID2SET"), hmi_apis::Common_CharacterSet::CID2SET)); + + video_streaming_protocol_enum.insert(std::make_pair( + std::string("RAW"), hmi_apis::Common_VideoStreamingProtocol::RAW)); + video_streaming_protocol_enum.insert(std::make_pair( + std::string("RTP"), hmi_apis::Common_VideoStreamingProtocol::RTP)); + video_streaming_protocol_enum.insert(std::make_pair( + std::string("RTSP"), hmi_apis::Common_VideoStreamingProtocol::RTSP)); + video_streaming_protocol_enum.insert(std::make_pair( + std::string("RTMP"), hmi_apis::Common_VideoStreamingProtocol::RTMP)); + video_streaming_protocol_enum.insert(std::make_pair( + std::string("WEBM"), hmi_apis::Common_VideoStreamingProtocol::WEBM)); + + video_streaming_codec_enum.insert(std::make_pair( + std::string("H264"), hmi_apis::Common_VideoStreamingCodec::H264)); + video_streaming_codec_enum.insert(std::make_pair( + std::string("H265"), hmi_apis::Common_VideoStreamingCodec::H265)); + video_streaming_codec_enum.insert(std::make_pair( + std::string("Theora"), hmi_apis::Common_VideoStreamingCodec::Theora)); + video_streaming_codec_enum.insert(std::make_pair( + std::string("VP8"), hmi_apis::Common_VideoStreamingCodec::VP8)); + video_streaming_codec_enum.insert(std::make_pair( + std::string("VP9"), hmi_apis::Common_VideoStreamingCodec::VP9)); } } // namespace @@ -343,6 +369,7 @@ HMICapabilitiesImpl::HMICapabilitiesImpl(ApplicationManager& app_mngr) , is_ui_cooperating_(false) , is_navi_cooperating_(false) , is_ivi_cooperating_(false) + , is_rc_cooperating_(false) , attenuated_supported_(false) , ui_language_(hmi_apis::Common_Language::INVALID_ENUM) , vr_language_(hmi_apis::Common_Language::INVALID_ENUM) @@ -363,6 +390,11 @@ HMICapabilitiesImpl::HMICapabilitiesImpl(ApplicationManager& app_mngr) , prerecorded_speech_(NULL) , is_navigation_supported_(false) , is_phone_call_supported_(false) + , is_video_streaming_supported_(false) + , navigation_capability_(NULL) + , phone_capability_(NULL) + , video_streaming_capability_(NULL) + , rc_capability_(NULL) , app_mngr_(app_mngr) , hmi_language_handler_(app_mngr) { InitCapabilities(); @@ -372,6 +404,7 @@ HMICapabilitiesImpl::HMICapabilitiesImpl(ApplicationManager& app_mngr) is_ui_cooperating_ = true; is_navi_cooperating_ = true; is_ivi_cooperating_ = true; + is_rc_cooperating_ = true; } } @@ -390,6 +423,10 @@ HMICapabilitiesImpl::~HMICapabilitiesImpl() { delete audio_pass_thru_capabilities_; delete pcm_stream_capabilities_; delete prerecorded_speech_; + delete navigation_capability_; + delete phone_capability_; + delete video_streaming_capability_; + delete rc_capability_; } bool HMICapabilitiesImpl::VerifyImageType(const int32_t image_type) const { @@ -430,6 +467,10 @@ void HMICapabilitiesImpl::set_is_ivi_cooperating(const bool value) { is_ivi_cooperating_ = value; } +void HMICapabilitiesImpl::set_is_rc_cooperating(const bool value) { + is_rc_cooperating_ = value; +} + void HMICapabilitiesImpl::set_attenuated_supported(const bool state) { attenuated_supported_ = state; } @@ -605,6 +646,44 @@ void HMICapabilitiesImpl::set_phone_call_supported(const bool supported) { is_phone_call_supported_ = supported; } +void HMICapabilitiesImpl::set_video_streaming_supported(const bool supported) { + is_video_streaming_supported_ = supported; +} + +void HMICapabilitiesImpl::set_navigation_capability( + const smart_objects::SmartObject& navigation_capability) { + if (navigation_capability_) { + delete navigation_capability_; + } + navigation_capability_ = + new smart_objects::SmartObject(navigation_capability); +} + +void HMICapabilitiesImpl::set_phone_capability( + const smart_objects::SmartObject& phone_capability) { + if (phone_capability_) { + delete phone_capability_; + } + phone_capability_ = new smart_objects::SmartObject(phone_capability); +} + +void HMICapabilitiesImpl::set_video_streaming_capability( + const smart_objects::SmartObject& video_streaming_capability) { + if (video_streaming_capability_) { + delete video_streaming_capability_; + } + video_streaming_capability_ = + new smart_objects::SmartObject(video_streaming_capability); +} + +void HMICapabilitiesImpl::set_rc_capability( + const smart_objects::SmartObject& rc_capability) { + if (rc_capability_) { + delete rc_capability_; + } + rc_capability_ = new smart_objects::SmartObject(rc_capability); +} + void HMICapabilitiesImpl::Init(resumption::LastState* last_state) { hmi_language_handler_.Init(last_state); if (false == load_capabilities_from_file()) { @@ -636,6 +715,10 @@ bool HMICapabilitiesImpl::is_ivi_cooperating() const { return is_ivi_cooperating_; } +bool HMICapabilitiesImpl::is_rc_cooperating() const { + return is_rc_cooperating_; +} + const smart_objects::SmartObject* HMICapabilitiesImpl::ui_supported_languages() const { return ui_supported_languages_; @@ -716,6 +799,29 @@ bool HMICapabilitiesImpl::phone_call_supported() const { return is_phone_call_supported_; } +bool HMICapabilitiesImpl::video_streaming_supported() const { + return is_video_streaming_supported_; +} + +const smart_objects::SmartObject* HMICapabilitiesImpl::navigation_capability() + const { + return navigation_capability_; +} + +const smart_objects::SmartObject* HMICapabilitiesImpl::phone_capability() + const { + return phone_capability_; +} + +const smart_objects::SmartObject* +HMICapabilitiesImpl::video_streaming_capability() const { + return video_streaming_capability_; +} + +const smart_objects::SmartObject* HMICapabilitiesImpl::rc_capability() const { + return rc_capability_; +} + bool HMICapabilitiesImpl::load_capabilities_from_file() { std::string json_string; std::string file_name = app_mngr_.get_settings().hmi_capabilities_file_name(); @@ -960,6 +1066,83 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() { soft_button_capabilities, soft_button_capabilities_so); set_soft_button_capabilities(soft_button_capabilities_so); } + if (check_existing_json_member(ui, "systemCapabilities")) { + Json::Value system_capabilities = ui.get("systemCapabilities", ""); + if (check_existing_json_member(system_capabilities, + "navigationCapability")) { + Json::Value navigation_capability = + system_capabilities.get("navigationCapability", ""); + smart_objects::SmartObject navigation_capability_so; + Formatters::CFormatterJsonBase::jsonValueToObj( + navigation_capability, navigation_capability_so); + set_navigation_capability(navigation_capability_so); + } + if (check_existing_json_member(system_capabilities, + "phoneCapability")) { + Json::Value phone_capability = + system_capabilities.get("phoneCapability", ""); + smart_objects::SmartObject phone_capability_so; + Formatters::CFormatterJsonBase::jsonValueToObj(phone_capability, + phone_capability_so); + set_phone_capability(phone_capability_so); + } + if (check_existing_json_member(system_capabilities, + "videoStreamingCapability")) { + Json::Value vs_capability = + system_capabilities.get("videoStreamingCapability", ""); + smart_objects::SmartObject vs_capability_so; + Formatters::CFormatterJsonBase::jsonValueToObj(vs_capability, + vs_capability_so); + + if (vs_capability_so.keyExists("supportedFormats")) { + smart_objects::SmartObject& supported_format_array = + vs_capability_so["supportedFormats"]; + smart_objects::SmartObject converted_array( + smart_objects::SmartType_Array); + for (uint32_t i = 0, j = 0; i < supported_format_array.length(); + i++) { + if (!supported_format_array[i].keyExists("protocol") || + !supported_format_array[i].keyExists("codec")) { + continue; + } + + std::map<std::string, + hmi_apis::Common_VideoStreamingProtocol::eType>:: + const_iterator it_protocol = + video_streaming_protocol_enum.find( + supported_format_array[i]["protocol"].asString()); + + std::map<std::string, + hmi_apis::Common_VideoStreamingCodec::eType>:: + const_iterator it_codec = video_streaming_codec_enum.find( + supported_format_array[i]["codec"].asString()); + + // format is valid only if both protocol and codec are converted + // to enum values successfully + if (it_protocol != video_streaming_protocol_enum.end() && + it_codec != video_streaming_codec_enum.end()) { + smart_objects::SmartObject format_so = + smart_objects::SmartObject(smart_objects::SmartType_Map); + format_so["protocol"] = it_protocol->second; + format_so["codec"] = it_codec->second; + converted_array[j++] = format_so; + } + } + vs_capability_so.erase("supportedFormats"); + vs_capability_so["supportedFormats"] = converted_array; + } + set_video_streaming_capability(vs_capability_so); + } + if (check_existing_json_member(system_capabilities, + "remoteControlCapability")) { + Json::Value rc_capability = + system_capabilities.get("remoteControlCapability", ""); + smart_objects::SmartObject rc_capability_so; + Formatters::CFormatterJsonBase::jsonValueToObj(rc_capability, + rc_capability_so); + set_rc_capability(rc_capability_so); + } + } } // UI end // VR @@ -1065,7 +1248,6 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() { vehicle_type_so); set_vehicle_type(vehicle_type_so); } // VehicleType end - } catch (...) { return false; } diff --git a/src/components/application_manager/src/hmi_command_factory.cc b/src/components/application_manager/src/hmi_command_factory.cc index 3f8a60a4a5..ffaa8d9b5f 100644 --- a/src/components/application_manager/src/hmi_command_factory.cc +++ b/src/components/application_manager/src/hmi_command_factory.cc @@ -2,6 +2,9 @@ Copyright (c) 2013, Ford Motor Company All rights reserved. + Copyright (c) 2017 Xevo Inc. + All rights reserved. + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -13,7 +16,7 @@ disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of the Ford Motor Company nor the names of its contributors + Neither the name of the copyright holders nor the names of their contributors may be used to endorse or promote products derived from this software without specific prior written permission. @@ -246,6 +249,8 @@ #include "application_manager/commands/hmi/on_ui_keyboard_input_notification.h" #include "application_manager/commands/hmi/on_ui_touch_event_notification.h" #include "application_manager/commands/hmi/on_ui_reset_timeout_notification.h" +#include "application_manager/commands/hmi/navi_set_video_config_request.h" +#include "application_manager/commands/hmi/navi_set_video_config_response.h" #include "application_manager/commands/hmi/navi_start_stream_request.h" #include "application_manager/commands/hmi/navi_start_stream_response.h" #include "application_manager/commands/hmi/navi_stop_stream_request.h" @@ -276,6 +281,13 @@ #include "application_manager/commands/hmi/on_tts_reset_timeout_notification.h" #include "application_manager/commands/hmi/dial_number_request.h" #include "application_manager/commands/hmi/dial_number_response.h" +#include "application_manager/commands/hmi/ui_send_haptic_data_request.h" +#include "application_manager/commands/hmi/ui_send_haptic_data_response.h" + +#include "application_manager/commands/hmi/rc_is_ready_request.h" +#include "application_manager/commands/hmi/rc_is_ready_response.h" +#include "application_manager/commands/hmi/rc_get_capabilities_request.h" +#include "application_manager/commands/hmi/rc_get_capabilities_response.h" CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") namespace application_manager { @@ -2078,6 +2090,16 @@ CommandSharedPtr HMICommandFactory::CreateCommand( message, application_manager)); break; } + case hmi_apis::FunctionID::Navigation_SetVideoConfig: { + if (is_response) { + command.reset(new commands::NaviSetVideoConfigResponse( + message, application_manager)); + } else { + command.reset(new commands::NaviSetVideoConfigRequest( + message, application_manager)); + } + break; + } case hmi_apis::FunctionID::Navigation_StartStream: { if (is_response) { command.reset(new commands::NaviStartStreamResponse( @@ -2252,6 +2274,36 @@ CommandSharedPtr HMICommandFactory::CreateCommand( message, application_manager)); break; } + case hmi_apis::FunctionID::RC_IsReady: { + if (is_response) { + command.reset( + new commands::RCIsReadyResponse(message, application_manager)); + } else { + command.reset( + new commands::RCIsReadyRequest(message, application_manager)); + } + break; + } + case hmi_apis::FunctionID::RC_GetCapabilities: { + if (is_response) { + command.reset(new commands::RCGetCapabilitiesResponse( + message, application_manager)); + } else { + command.reset(new commands::RCGetCapabilitiesRequest( + message, application_manager)); + } + break; + } + case hmi_apis::FunctionID::UI_SendHapticData: { + if (is_response) { + command.reset(new commands::UISendHapticDataResponse( + message, application_manager)); + } else { + command.reset(new commands::UISendHapticDataRequest( + message, application_manager)); + } + break; + } } return command; } diff --git a/src/components/application_manager/src/hmi_interfaces_impl.cc b/src/components/application_manager/src/hmi_interfaces_impl.cc index 8a9944bec4..4479665f64 100644 --- a/src/components/application_manager/src/hmi_interfaces_impl.cc +++ b/src/components/application_manager/src/hmi_interfaces_impl.cc @@ -2,6 +2,9 @@ * Copyright (c) 2016, Ford Motor Company * All rights reserved. * + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -13,7 +16,7 @@ * disclaimer in the documentation and/or other materials provided with the * distribution. * - * Neither the name of the Ford Motor Company nor the names of its contributors + * Neither the name of the copyright holders nor the names of their contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -155,6 +158,7 @@ generate_function_to_interface_convert_map() { convert_map[UI_IsReady] = HmiInterfaces::HMI_INTERFACE_UI; convert_map[UI_ClosePopUp] = HmiInterfaces::HMI_INTERFACE_UI; convert_map[UI_OnResetTimeout] = HmiInterfaces::HMI_INTERFACE_UI; + convert_map[UI_SendHapticData] = HmiInterfaces::HMI_INTERFACE_UI; convert_map[Navigation_IsReady] = HmiInterfaces::HMI_INTERFACE_Navigation; convert_map[Navigation_SendLocation] = HmiInterfaces::HMI_INTERFACE_Navigation; @@ -166,6 +170,8 @@ generate_function_to_interface_convert_map() { HmiInterfaces::HMI_INTERFACE_Navigation; convert_map[Navigation_OnTBTClientState] = HmiInterfaces::HMI_INTERFACE_Navigation; + convert_map[Navigation_SetVideoConfig] = + HmiInterfaces::HMI_INTERFACE_Navigation; convert_map[Navigation_StartStream] = HmiInterfaces::HMI_INTERFACE_Navigation; convert_map[Navigation_StopStream] = HmiInterfaces::HMI_INTERFACE_Navigation; convert_map[Navigation_StartAudioStream] = @@ -214,6 +220,8 @@ generate_function_to_interface_convert_map() { convert_map[SDL_OnSystemError] = HmiInterfaces::HMI_INTERFACE_SDL; convert_map[SDL_AddStatisticsInfo] = HmiInterfaces::HMI_INTERFACE_SDL; convert_map[SDL_GetURLS] = HmiInterfaces::HMI_INTERFACE_SDL; + convert_map[RC_IsReady] = HmiInterfaces::HMI_INTERFACE_RC; + convert_map[RC_GetCapabilities] = HmiInterfaces::HMI_INTERFACE_RC; return convert_map; } @@ -235,6 +243,8 @@ HmiInterfacesImpl::HmiInterfacesImpl() { HmiInterfaces::STATE_NOT_RESPONSE; interfaces_states_[HmiInterfaces::HMI_INTERFACE_VR] = HmiInterfaces::STATE_NOT_RESPONSE; + interfaces_states_[HmiInterfaces::HMI_INTERFACE_RC] = + HmiInterfaces::STATE_NOT_RESPONSE; } HmiInterfaces::InterfaceState HmiInterfacesImpl::GetInterfaceState( diff --git a/src/components/application_manager/src/hmi_state.cc b/src/components/application_manager/src/hmi_state.cc index 1f05232476..393a9d7784 100644 --- a/src/components/application_manager/src/hmi_state.cc +++ b/src/components/application_manager/src/hmi_state.cc @@ -1,3 +1,4 @@ + /* * Copyright (c) 2015, Ford Motor Company * All rights reserved. @@ -74,6 +75,11 @@ bool HmiState::is_voice_communication_app(const uint32_t app_id) const { return app ? app->is_voice_communication_supported() : false; } +bool HmiState::is_mobile_projection_app(const uint32_t app_id) const { + const ApplicationSharedPtr app = app_mngr_.application(app_id); + return app ? app->mobile_projection_enabled() : false; +} + mobile_apis::AudioStreamingState::eType VRHmiState::audio_streaming_state() const { using namespace mobile_apis; @@ -133,7 +139,7 @@ mobile_apis::HMILevel::eType PhoneCallHmiState::hmi_level() const { HMILevel::HMI_NONE)) { return parent()->hmi_level(); } - if (is_navi_app(app_id_)) { + if (is_navi_app(app_id_) || is_mobile_projection_app(app_id_)) { return HMILevel::HMI_LIMITED; } if (!is_media_app(app_id_)) { diff --git a/src/components/application_manager/src/message.cc b/src/components/application_manager/src/message.cc index 2206cf479f..b211b270b8 100644 --- a/src/components/application_manager/src/message.cc +++ b/src/components/application_manager/src/message.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Ford Motor Company + * Copyright (c) 2017, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -64,10 +64,20 @@ Message::Message(protocol_handler::MessagePriority priority) , binary_data_(NULL) , data_size_(0) , payload_size_(0) - , version_(kUnknownProtocol) {} + , version_( + protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_UNKNOWN) {} Message::Message(const Message& message) - : priority_(message.priority_), binary_data_(NULL) { + : function_id_(0) + , correlation_id_(0) + , type_(kUnknownType) + , priority_(message.priority_) + , connection_key_(0) + , binary_data_(NULL) + , data_size_(0) + , payload_size_(0) + , version_( + protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_UNKNOWN) { *this = message; } @@ -88,7 +98,7 @@ Message& Message::operator=(const Message& message) { return *this; } -bool Message::operator==(const Message& message) { +bool Message::operator==(const Message& message) const { bool function_id = function_id_ == message.function_id_; bool correlation_id = correlation_id_ == message.correlation_id_; bool connection_key = connection_key_ == message.connection_key_; @@ -97,14 +107,17 @@ bool Message::operator==(const Message& message) { bool version = version_ == message.version_; bool data_size = data_size_ == message.data_size_; bool payload_size = payload_size_ == message.payload_size_; - - bool binary_data = std::equal(binary_data_->begin(), - binary_data_->end(), - message.binary_data_->begin(), - BinaryDataPredicate); + bool binary_data_available = true; + if (binary_data_) { + binary_data_available = std::equal(binary_data_->begin(), + binary_data_->end(), + message.binary_data_->begin(), + BinaryDataPredicate); + } return function_id && correlation_id && connection_key && type && - binary_data && json_message && version && data_size && payload_size; + binary_data_available && json_message && version && data_size && + payload_size; } Message::~Message() { @@ -117,6 +130,12 @@ int32_t Message::function_id() const { return function_id_; } +#ifdef SDL_REMOTE_CONTROL +std::string Message::function_name() const { + return function_name_; +} +#endif // SDL_REMOTE_CONTROL + int32_t Message::correlation_id() const { return correlation_id_; } @@ -129,7 +148,7 @@ MessageType Message::type() const { return type_; } -ProtocolVersion Message::protocol_version() const { +protocol_handler::MajorProtocolVersion Message::protocol_version() const { return version_; } @@ -157,6 +176,12 @@ void Message::set_function_id(int32_t id) { function_id_ = id; } +#ifdef SDL_REMOTE_CONTROL +void Message::set_function_name(const std::string& name) { + function_name_ = name; +} +#endif // SDL_REMOTE_CONTROL + void Message::set_correlation_id(int32_t id) { correlation_id_ = id; } @@ -179,14 +204,15 @@ void Message::set_binary_data(BinaryData* data) { delete binary_data_; } - binary_data_ = data; + binary_data_ = new BinaryData(*data); } void Message::set_json_message(const std::string& json_message) { json_message_ = json_message; } -void Message::set_protocol_version(ProtocolVersion version) { +void Message::set_protocol_version( + protocol_handler::MajorProtocolVersion version) { version_ = version; } @@ -205,4 +231,11 @@ void Message::set_data_size(size_t data_size) { void Message::set_payload_size(size_t payload_size) { payload_size_ = payload_size; } + +bool Message::is_sufficient_version( + protocol_handler::MajorProtocolVersion minVersion, + protocol_handler::MajorProtocolVersion version) { + return version >= minVersion && + version <= protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5; +} } // namespace application_manager diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc index 19bb658bca..65f4c79fa6 100644 --- a/src/components/application_manager/src/message_helper/message_helper.cc +++ b/src/components/application_manager/src/message_helper/message_helper.cc @@ -443,6 +443,95 @@ hmi_apis::Common_Result::eType MessageHelper::MobileToHMIResult( return HMIResultFromString(result); } +#ifdef SDL_REMOTE_CONTROL +void MessageHelper::SendHMIStatusNotification( + const Application& application_impl, + ApplicationManager& application_manager) { + LOG4CXX_AUTO_TRACE(logger_); + smart_objects::SmartObjectSPtr notification = new smart_objects::SmartObject; + if (!notification) { + LOG4CXX_ERROR(logger_, "Failed to create smart object"); + return; + } + smart_objects::SmartObject& message = *notification; + + message[strings::params][strings::function_id] = + static_cast<int32_t>(mobile_api::FunctionID::OnHMIStatusID); + + message[strings::params][strings::message_type] = + static_cast<int32_t>(application_manager::MessageType::kNotification); + + message[strings::params][strings::connection_key] = + static_cast<int32_t>(application_impl.app_id()); + + message[strings::msg_params][strings::hmi_level] = + static_cast<int32_t>(application_impl.hmi_level()); + + message[strings::msg_params][strings::audio_streaming_state] = + static_cast<int32_t>(application_impl.audio_streaming_state()); + + message[strings::msg_params][strings::system_context] = + static_cast<int32_t>(application_impl.system_context()); + + application_manager.ManageMobileCommand(notification, + commands::Command::ORIGIN_SDL); +} + +void MessageHelper::SendActivateAppToHMI( + uint32_t const app_id, + ApplicationManager& application_manager, + hmi_apis::Common_HMILevel::eType level, + bool send_policy_priority) { + application_manager::ApplicationConstSharedPtr app = + application_manager.application(app_id); + if (!app) { + LOG4CXX_WARN(logger_, "Invalid app_id: " << app_id); + return; + } + + utils::SharedPtr<smart_objects::SmartObject> message = + new smart_objects::SmartObject(smart_objects::SmartType_Map); + + (*message)[strings::params][strings::function_id] = + hmi_apis::FunctionID::BasicCommunication_ActivateApp; + (*message)[strings::params][strings::message_type] = MessageType::kRequest; + (*message)[strings::params][strings::correlation_id] = + application_manager.GetNextHMICorrelationID(); + (*message)[strings::msg_params][strings::app_id] = app_id; + + if (send_policy_priority) { + std::string priority; + application_manager.GetPolicyHandler().GetPriority(app->policy_app_id(), + &priority); + // According SDLAQ-CRS-2794 + // SDL have to send ActivateApp without "proirity" parameter to HMI. + // in case of unconsented device + std::string mac_adress; + connection_handler::DeviceHandle device_handle = app->device(); + application_manager.connection_handler() + .get_session_observer() + .GetDataOnDeviceID(device_handle, NULL, NULL, &mac_adress, NULL); + + policy::DeviceConsent consent = + application_manager.GetPolicyHandler().GetUserConsentForDevice( + mac_adress); + if (!priority.empty() && + (policy::DeviceConsent::kDeviceAllowed == consent)) { + (*message)[strings::msg_params][strings::priority] = + GetPriorityCode(priority); + } + } + + // We haven't send HMI level to HMI in case it FULL. + if (hmi_apis::Common_HMILevel::INVALID_ENUM != level && + hmi_apis::Common_HMILevel::FULL != level) { + (*message)[strings::msg_params][strings::activate_app_hmi_level] = level; + } + + application_manager.ManageHMICommand(message); +} +#endif // SDL_REMOTE_CONTROL + mobile_apis::HMILevel::eType MessageHelper::StringToHMILevel( const std::string& hmi_level) { using namespace NsSmartDeviceLink::NsSmartObjects; @@ -619,8 +708,8 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateBlockedByPoliciesResponse( (*response)[strings::params][strings::connection_key] = connection_key; (*response)[strings::params][strings::protocol_type] = commands::CommandImpl::mobile_protocol_type_; - (*response)[strings::params][strings::protocol_version] = - static_cast<int>(kV2); + (*response)[strings::params][strings::protocol_version] = static_cast<int>( + protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_2); return response; } @@ -637,9 +726,12 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateDeviceListSO( smart_objects::SmartObject(smart_objects::SmartType_Array); smart_objects::SmartObject& list_so = (*device_list_so)[strings::device_list]; - int32_t index = 0; + uint32_t index = 0; + // According to requirements, SDL should send info about 100 devices at + // maximum, even if SDL has more devices connected. + const uint32_t max_device_count = 100; for (connection_handler::DeviceMap::const_iterator it = devices.begin(); - devices.end() != it; + devices.end() != it && index < max_device_count; ++it) { const connection_handler::Device& d = static_cast<connection_handler::Device>(it->second); @@ -1445,8 +1537,6 @@ smart_objects::SmartObjectSPtr MessageHelper::GetBCActivateAppRequestToHMI( if (send_policy_priority) { std::string priority; - // TODO(KKolodiy): need remove method policy_manager - policy_handler.GetPriority(app->policy_app_id(), &priority); // According SDLAQ-CRS-2794 // SDL have to send ActivateApp without "proirity" parameter to HMI. @@ -1745,6 +1835,26 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateNegativeResponse( return utils::MakeShared<smart_objects::SmartObject>(response_data); } +void MessageHelper::SendNaviSetVideoConfig( + int32_t app_id, + ApplicationManager& app_mngr, + const smart_objects::SmartObject& video_params) { + LOG4CXX_AUTO_TRACE(logger_); + smart_objects::SmartObjectSPtr request = + CreateRequestObject(app_mngr.GetNextHMICorrelationID()); + if (!request) { + return; + } + + (*request)[strings::params][strings::function_id] = + hmi_apis::FunctionID::Navigation_SetVideoConfig; + + (*request)[strings::msg_params][strings::app_id] = app_id; + (*request)[strings::msg_params][strings::config] = video_params; + + app_mngr.ManageHMICommand(request); +} + void MessageHelper::SendNaviStartStream(const int32_t app_id, ApplicationManager& app_mngr) { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/mobile_command_factory.cc b/src/components/application_manager/src/mobile_command_factory.cc index 688bacf1ac..f6f9cab7f5 100644 --- a/src/components/application_manager/src/mobile_command_factory.cc +++ b/src/components/application_manager/src/mobile_command_factory.cc @@ -2,6 +2,9 @@ Copyright (c) 2013, Ford Motor Company All rights reserved. + Copyright (c) 2017 Xevo Inc. + All rights reserved. + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -13,7 +16,7 @@ disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of the Ford Motor Company nor the names of its contributors + Neither the name of the copyright holders nor the names of their contributors may be used to endorse or promote products derived from this software without specific prior written permission. @@ -56,6 +59,8 @@ #include "application_manager/commands/mobile/generic_response.h" #include "application_manager/commands/mobile/get_dtcs_request.h" #include "application_manager/commands/mobile/get_dtcs_response.h" +#include "application_manager/commands/mobile/get_system_capability_request.h" +#include "application_manager/commands/mobile/get_system_capability_response.h" #include "application_manager/commands/mobile/get_vehicle_data_request.h" #include "application_manager/commands/mobile/get_vehicle_data_response.h" #include "application_manager/commands/mobile/get_way_points_request.h" @@ -133,6 +138,8 @@ #include "application_manager/commands/mobile/send_location_response.h" #include "application_manager/commands/mobile/dial_number_request.h" #include "application_manager/commands/mobile/dial_number_response.h" +#include "application_manager/commands/mobile/send_haptic_data_request.h" +#include "application_manager/commands/mobile/send_haptic_data_response.h" #include "interfaces/MOBILE_API.h" #include "utils/make_shared.h" @@ -450,6 +457,17 @@ CommandSharedPtr MobileCommandFactory::CreateCommand( } break; } + case mobile_apis::FunctionID::GetSystemCapabilityID: { + if ((*message)[strings::params][strings::message_type] == + static_cast<int>(application_manager::MessageType::kResponse)) { + command.reset(new commands::GetSystemCapabilityResponse( + message, application_manager)); + } else { + command.reset(new commands::GetSystemCapabilityRequest( + message, application_manager)); + } + break; + } case mobile_apis::FunctionID::ReadDIDID: { if ((*message)[strings::params][strings::message_type] == static_cast<int>(application_manager::MessageType::kResponse)) { @@ -604,6 +622,17 @@ CommandSharedPtr MobileCommandFactory::CreateCommand( } break; } + case mobile_apis::FunctionID::SendHapticDataID: { + if ((*message)[strings::params][strings::message_type] == + static_cast<int>(application_manager::MessageType::kResponse)) { + command.reset( + new commands::SendHapticDataResponse(message, application_manager)); + } else { + command.reset( + new commands::SendHapticDataRequest(message, application_manager)); + } + break; + } case mobile_apis::FunctionID::OnButtonEventID: { command.reset(new commands::mobile::OnButtonEventNotification( message, application_manager)); diff --git a/src/components/application_manager/src/mobile_message_handler.cc b/src/components/application_manager/src/mobile_message_handler.cc index b635cb1f84..f7beea670e 100644 --- a/src/components/application_manager/src/mobile_message_handler.cc +++ b/src/components/application_manager/src/mobile_message_handler.cc @@ -67,26 +67,31 @@ MobileMessageHandler::HandleIncomingMessageProtocol( DCHECK_OR_RETURN(message, NULL); application_manager::Message* out_message = NULL; switch (message->protocol_version()) { - case ProtocolVersion::kV1: + case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1: LOG4CXX_DEBUG(logger_, "Protocol version - V1"); out_message = MobileMessageHandler::HandleIncomingMessageProtocolV1(message); break; - case ProtocolVersion::kV2: + case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_2: LOG4CXX_DEBUG(logger_, "Protocol version - V2"); out_message = MobileMessageHandler::HandleIncomingMessageProtocolV2(message); break; - case ProtocolVersion::kV3: + case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3: LOG4CXX_DEBUG(logger_, "Protocol version - V3"); out_message = MobileMessageHandler::HandleIncomingMessageProtocolV2(message); break; - case ProtocolVersion::kV4: + case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4: LOG4CXX_DEBUG(logger_, "Protocol version - V4"); out_message = MobileMessageHandler::HandleIncomingMessageProtocolV2(message); break; + case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5: + LOG4CXX_DEBUG(logger_, "Protocol version - V5"); + out_message = + MobileMessageHandler::HandleIncomingMessageProtocolV2(message); + break; default: LOG4CXX_WARN(logger_, "Can't recognise protocol version"); out_message = NULL; @@ -116,12 +121,13 @@ MobileMessageHandler::HandleOutgoingMessageProtocol( << message->correlation_id() << ", " << message->json_message()); - if (message->protocol_version() == application_manager::kV1) { + if (message->protocol_version() == + protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1) { return MobileMessageHandler::HandleOutgoingMessageProtocolV1(message); } - if ((message->protocol_version() == application_manager::kV2) || - (message->protocol_version() == application_manager::kV3) || - (message->protocol_version() == application_manager::kV4)) { + if (Message::is_sufficient_version( + protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_2, + message->protocol_version())) { return MobileMessageHandler::HandleOutgoingMessageProtocolV2(message); } return NULL; @@ -142,7 +148,7 @@ MobileMessageHandler::HandleIncomingMessageProtocolV1( outgoing_message->set_connection_key(message->connection_key()); outgoing_message->set_protocol_version( - static_cast<application_manager::ProtocolVersion>( + static_cast<protocol_handler::MajorProtocolVersion>( message->protocol_version())); outgoing_message->set_json_message(std::string( reinterpret_cast<const char*>(message->data()), message->data_size())); @@ -184,7 +190,7 @@ MobileMessageHandler::HandleIncomingMessageProtocolV2( outgoing_message->set_correlation_id(int32_t(payload.header.correlation_id)); outgoing_message->set_connection_key(message->connection_key()); outgoing_message->set_protocol_version( - static_cast<application_manager::ProtocolVersion>( + static_cast<protocol_handler::MajorProtocolVersion>( message->protocol_version())); outgoing_message->set_data_size(message->data_size()); outgoing_message->set_payload_size(message->payload_size()); diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc index ec8b36477c..ad21f533a1 100644 --- a/src/components/application_manager/src/policies/policy_handler.cc +++ b/src/components/application_manager/src/policies/policy_handler.cc @@ -55,6 +55,9 @@ #include "utils/scope_guard.h" #include "utils/make_shared.h" #include "policy/policy_manager.h" +#ifdef SDL_REMOTE_CONTROL +#include "functional_module/plugin_manager.h" +#endif // SDL_REMOTE_CONTROL namespace policy { @@ -541,6 +544,12 @@ void PolicyHandler::GetAvailableApps(std::queue<std::string>& apps) { } } +struct SmartObjectToInt { + int operator()(const smart_objects::SmartObject& item) const { + return item.asInt(); + } +}; + StatusNotifier PolicyHandler::AddApplication( const std::string& application_id, const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) { @@ -1178,6 +1187,10 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification( accessor.GetData().end(), DeactivateApplication(device_handle, application_manager_.state_controller())); +#ifdef SDL_REMOTE_CONTROL + application_manager_.GetPluginManager().OnPolicyEvent( + functional_modules::PolicyEvent::kApplicationsDisabled); +#endif // SDL_REMOTE_CONTROL } else { std::for_each( accessor.GetData().begin(), @@ -1186,7 +1199,6 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification( policy_manager_.get(), application_manager_.state_controller())); } - #endif // EXTERNAL_PROPRIETARY_MODE } } @@ -1941,4 +1953,141 @@ bool PolicyHandler::IsUrlAppIdValid(const uint32_t app_idx, return ((is_registered && !is_empty_urls) || is_default); } + +#ifdef SDL_REMOTE_CONTROL + +std::vector<std::string> PolicyHandler::GetDevicesIds( + const std::string& policy_app_id) { + return application_manager_.devices(policy_app_id); +} + +void PolicyHandler::UpdateHMILevel(ApplicationSharedPtr app, + mobile_apis::HMILevel::eType level) { + LOG4CXX_AUTO_TRACE(logger_); + DCHECK_OR_RETURN_VOID(app); + if (app->hmi_level() == mobile_apis::HMILevel::HMI_NONE) { + // If default is FULL, send request to HMI. Notification to mobile will be + // sent on response receiving. + if (mobile_apis::HMILevel::HMI_FULL == level) { + MessageHelper::SendActivateAppToHMI(app->app_id(), application_manager_); + } else { + LOG4CXX_INFO(logger_, + "Changing hmi level of application " + << app->app_id() << " to default hmi level " << level); + // Set application hmi level + application_manager_.ChangeAppsHMILevel(app->app_id(), level); + // If hmi Level is full, it will be seted after ActivateApp response + MessageHelper::SendHMIStatusNotification(*app, application_manager_); + } + } +} + +bool PolicyHandler::CheckModule(const PTString& app_id, + const PTString& module) { + POLICY_LIB_CHECK(false); + return policy_manager_->CheckModule(app_id, module); +} + +void PolicyHandler::OnRemoteAppPermissionsChanged( + const std::string& device_id, const std::string& application_id) { + POLICY_LIB_CHECK_VOID(); + policy_manager_->SendAppPermissionsChanged(device_id, application_id); +} + +void PolicyHandler::OnUpdateHMIStatus(const std::string& device_id, + const std::string& policy_app_id, + const std::string& hmi_level) { + LOG4CXX_AUTO_TRACE(logger_); + ApplicationSharedPtr app = + application_manager_.application(device_id, policy_app_id); + if (!app) { + LOG4CXX_WARN(logger_, + "Could not find application: " << device_id << " - " + << policy_app_id); + return; + } + mobile_apis::HMILevel::eType level = + MessageHelper::StringToHMILevel(hmi_level); + if (mobile_apis::HMILevel::INVALID_ENUM == level) { + LOG4CXX_WARN(logger_, + "Couldn't convert default hmi level " << hmi_level + << " to enum."); + return; + } + + LOG4CXX_INFO(logger_, + "Changing hmi level of application " + << app->app_id() << " to default hmi level " << level); + // Set application hmi level + application_manager_.ChangeAppsHMILevel(app->app_id(), level); + MessageHelper::SendHMIStatusNotification(*app, application_manager_); +} + +bool PolicyHandler::GetModuleTypes(const std::string& policy_app_id, + std::vector<std::string>* modules) const { + LOG4CXX_AUTO_TRACE(logger_); + POLICY_LIB_CHECK(false); + return policy_manager_->GetModuleTypes(policy_app_id, modules); +} + +void PolicyHandler::SetDefaultHmiTypes( + const std::string& application_id, + const smart_objects::SmartObject* app_types) { + LOG4CXX_AUTO_TRACE(logger_); + POLICY_LIB_CHECK_VOID(); + std::vector<int> hmi_types; + if (app_types && app_types->asArray()) { + smart_objects::SmartArray* hmi_list = app_types->asArray(); + std::transform(hmi_list->begin(), + hmi_list->end(), + std::back_inserter(hmi_types), + SmartObjectToInt()); + } + policy_manager_->SetDefaultHmiTypes(application_id, hmi_types); +} + +bool PolicyHandler::CheckHMIType(const std::string& application_id, + mobile_apis::AppHMIType::eType hmi, + const smart_objects::SmartObject* app_types) { + LOG4CXX_AUTO_TRACE(logger_); + POLICY_LIB_CHECK(false); + std::vector<int> policy_hmi_types; + bool ret = policy_manager_->GetHMITypes(application_id, &policy_hmi_types); + + std::vector<int> additional_hmi_types; + if (app_types && app_types->asArray()) { + smart_objects::SmartArray* hmi_list = app_types->asArray(); + std::transform(hmi_list->begin(), + hmi_list->end(), + std::back_inserter(additional_hmi_types), + SmartObjectToInt()); + } + const std::vector<int>& hmi_types = + ret ? policy_hmi_types : additional_hmi_types; + return std::find(hmi_types.begin(), hmi_types.end(), hmi) != hmi_types.end(); +} + +void PolicyHandler::OnUpdateHMILevel(const std::string& device_id, + const std::string& policy_app_id, + const std::string& hmi_level) { + LOG4CXX_AUTO_TRACE(logger_); + ApplicationSharedPtr app = + application_manager_.application(device_id, policy_app_id); + if (!app) { + LOG4CXX_WARN(logger_, + "Could not find application: " << device_id << " - " + << policy_app_id); + return; + } + mobile_apis::HMILevel::eType level = + MessageHelper::StringToHMILevel(hmi_level); + if (mobile_apis::HMILevel::INVALID_ENUM == level) { + LOG4CXX_WARN(logger_, + "Couldn't convert default hmi level " << hmi_level + << " to enum."); + return; + } + UpdateHMILevel(app, level); +} +#endif // SDL_REMOTE_CONTROL } // namespace policy diff --git a/src/components/application_manager/src/request_controller.cc b/src/components/application_manager/src/request_controller.cc index 77a1853a39..1b9bd7ffb9 100644 --- a/src/components/application_manager/src/request_controller.cc +++ b/src/components/application_manager/src/request_controller.cc @@ -63,8 +63,11 @@ RequestController::RequestController(const RequestControlerSettings& settings) RequestController::~RequestController() { LOG4CXX_AUTO_TRACE(logger_); - timer_stop_flag_ = true; - timer_condition_.Broadcast(); + { + sync_primitives::AutoLock auto_lock(timer_lock); + timer_stop_flag_ = true; + timer_condition_.Broadcast(); + } timer_.Stop(); if (pool_state_ != TPoolState::STOPPED) { DestroyThreadpool(); @@ -370,11 +373,11 @@ void RequestController::TimeoutThread() { LOG4CXX_DEBUG( logger_, "ENTER Waiting fore response count: " << waiting_for_response_.Size()); + sync_primitives::AutoLock auto_lock(timer_lock); while (!timer_stop_flag_) { RequestInfoPtr probably_expired = waiting_for_response_.FrontWithNotNullTimeout(); if (!probably_expired) { - sync_primitives::AutoLock auto_lock(timer_lock); timer_condition_.Wait(auto_lock); continue; } @@ -388,7 +391,6 @@ void RequestController::TimeoutThread() { << " request id: " << probably_expired->requestId() << " connection_key: " << probably_expired->app_id() << " NOT expired"); - sync_primitives::AutoLock auto_lock(timer_lock); const TimevalStruct current_time = date_time::DateTime::getCurrentTime(); const TimevalStruct end_time = probably_expired->end_time(); if (current_time < end_time) { diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc index 99d9e4122a..45bab026b4 100644 --- a/src/components/application_manager/src/smart_object_keys.cc +++ b/src/components/application_manager/src/smart_object_keys.cc @@ -57,6 +57,7 @@ const char* main_field_1 = "mainField1"; const char* main_field_2 = "mainField2"; const char* main_field_3 = "mainField3"; const char* main_field_4 = "mainField4"; +const char* metadata_tags = "metadataTags"; const char* eta = "eta"; const char* time_to_destination = "timeToDestination"; const char* total_distance = "totalDistance"; @@ -134,6 +135,13 @@ const char* audio_pass_thru_capabilities = "audioPassThruCapabilities"; const char* pcm_stream_capabilities = "pcmStreamCapabilities"; const char* audio_pass_thru_icon = "audioPassThruIcon"; const char* way_points = "wayPoints"; +const char* system_capability = "systemCapability"; +const char* system_capability_type = "systemCapabilityType"; +const char* system_capabilities = "systemCapabilities"; +const char* navigation_capability = "navigationCapability"; +const char* phone_capability = "phoneCapability"; +const char* video_streaming_capability = "videoStreamingCapability"; +const char* rc_capability = "remoteControlCapability"; // PutFile const char* sync_file_name = "syncFileName"; @@ -225,6 +233,7 @@ const char* supported_diag_modes = "supportedDiagModes"; const char* hmi_capabilities = "hmiCapabilities"; const char* navigation = "navigation"; const char* phone_call = "phoneCall"; +const char* video_streaming = "videoStreaming"; const char* sdl_version = "sdlVersion"; const char* system_software_version = "systemSoftwareVersion"; const char* priority = "priority"; @@ -293,6 +302,22 @@ const char* const status = "status"; const char* const external_consent_status = "externalConsentStatus"; const char* const consented_functions = "consentedFunctions"; const char* const source = "source"; +const char* const config = "config"; +const char* const protocol = "protocol"; +const char* const codec = "codec"; +const char* const width = "width"; +const char* const height = "height"; +const char* const rejected_params = "rejectedParams"; +const char* const preferred_resolution = "preferredResolution"; +const char* const resolution_width = "resolutionWidth"; +const char* const resolution_height = "resolutionHeight"; +const char* const max_bitrate = "maxBitrate"; +const char* const supported_formats = "supportedFormats"; +const char* const haptic_spatial_data_supported = "hapticSpatialDataSupported"; +const char* const haptic_rect_data = "hapticRectData"; +const char* const rect = "rect"; +const char* const x = "x"; +const char* const y = "y"; } // namespace strings namespace json { @@ -344,6 +369,7 @@ namespace hmi_request { const char* parent_id = "parentID"; const char* field_name = "fieldName"; const char* field_text = "fieldText"; +const char* field_types = "fieldTypes"; const char* alert_strings = "alertStrings"; const char* duration = "duration"; const char* soft_buttons = "softButtons"; diff --git a/src/components/application_manager/src/state_controller_impl.cc b/src/components/application_manager/src/state_controller_impl.cc index 06a7e508e5..b456ff6abb 100644 --- a/src/components/application_manager/src/state_controller_impl.cc +++ b/src/components/application_manager/src/state_controller_impl.cc @@ -363,9 +363,9 @@ bool StateControllerImpl::IsResumptionAllowed(ApplicationSharedPtr app, } if (IsTempStateActive(HmiState::StateID::STATE_ID_EMBEDDED_NAVI) && - app->is_navi()) { + (app->is_navi() || app->mobile_projection_enabled())) { LOG4CXX_DEBUG(logger_, - "Resumption for navi app is not allowed. " + "Resumption for navi or projection app is not allowed. " << "EMBEDDED_NAVI event is active"); return false; } @@ -556,12 +556,19 @@ bool StateControllerImpl::IsSameAppType(ApplicationConstSharedPtr app1, ApplicationConstSharedPtr app2) { const bool both_media = app1->is_media_application() && app2->is_media_application(); + const bool both_navi = app1->is_navi() && app2->is_navi(); + const bool both_vc = app1->is_voice_communication_supported() && app2->is_voice_communication_supported(); + const bool both_simple = !app1->IsAudioApplication() && !app2->IsAudioApplication(); - return both_simple || both_media || both_navi || both_vc; + + const bool both_projection = + app1->mobile_projection_enabled() && app2->mobile_projection_enabled(); + + return both_simple || both_media || both_navi || both_vc || both_projection; } void StateControllerImpl::on_event(const event_engine::Event& event) { diff --git a/src/components/application_manager/test/CMakeLists.txt b/src/components/application_manager/test/CMakeLists.txt index dba8d99a62..089f8fd25e 100644 --- a/src/components/application_manager/test/CMakeLists.txt +++ b/src/components/application_manager/test/CMakeLists.txt @@ -45,12 +45,13 @@ include_directories( ${COMPONENTS_DIR}/resumption/include/ ${COMPONENTS_DIR}/utils/include/ ${POLICY_PATH}/include/ + ${COMPONENTS_DIR}/policy/policy_regular/test/include ${POLICY_PATH}/policy/test/include/ ${POLICY_MOCK_INCLUDE_PATH}/ ${COMPONENTS_DIR}/media_manager/include/ ${COMPONENTS_DIR}/security_manager/include/ - ${COMPONENTS_DIR}/policy/test/include/ ${COMPONENTS_DIR}/application_manager/test/include/ + ${BSON_INCLUDE_DIRECTORY} ) set(testSources @@ -68,10 +69,14 @@ set(testSources ${AM_TEST_DIR}/usage_statistics_test.cc ${AM_TEST_DIR}/policy_handler_test.cc ${AM_TEST_DIR}/mock_message_helper.cc - #${AM_TEST_DIR}/application_manager_impl_test.cc + ${AM_TEST_DIR}/application_manager_impl_test.cc ) +if(REMOTE_CONTROL) + list(APPEND testSources ${AM_TEST_DIR}/rc_policy_handler_test.cc) +endif(REMOTE_CONTROL) + set (RequestController_SOURCES ${AM_TEST_DIR}/request_controller/request_controller_test.cc ${AM_TEST_DIR}/mock_message_helper.cc @@ -97,6 +102,8 @@ set(LIBRARIES Resumption ProtocolHandler SecurityManager + bson -L${BSON_LIBS_DIRECTORY} + emhashmap -L${EMHASHMAP_LIBS_DIRECTORY} ) if (${CMAKE_SYSTEM_NAME} MATCHES "QNX") @@ -123,6 +130,7 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath=${CMAKE_CURRENT_BINARY_DIR}" ) create_test("application_manager_test" "${testSources}" "${LIBRARIES}") +add_dependencies("application_manager_test" libbson) create_test("request_controller_test" "${RequestController_SOURCES}" "${LIBRARIES}") # TODO [AKozoriz] : Fix not buildable tests diff --git a/src/components/application_manager/test/application_impl_test.cc b/src/components/application_manager/test/application_impl_test.cc index 54414a93de..a1e284b40d 100644 --- a/src/components/application_manager/test/application_impl_test.cc +++ b/src/components/application_manager/test/application_impl_test.cc @@ -569,12 +569,14 @@ TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeNotNaviNotVoice) { EXPECT_FALSE(app_impl->is_navi()); EXPECT_FALSE(app_impl->is_voice_communication_supported()); + EXPECT_FALSE(app_impl->mobile_projection_enabled()); app_impl->set_app_types(type_media); app_impl->ChangeSupportingAppHMIType(); EXPECT_FALSE(app_impl->is_navi()); EXPECT_FALSE(app_impl->is_voice_communication_supported()); + EXPECT_FALSE(app_impl->mobile_projection_enabled()); } TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeIsVoice) { @@ -583,12 +585,14 @@ TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeIsVoice) { EXPECT_FALSE(app_impl->is_navi()); EXPECT_FALSE(app_impl->is_voice_communication_supported()); + EXPECT_FALSE(app_impl->mobile_projection_enabled()); app_impl->set_app_types(type_comm); app_impl->ChangeSupportingAppHMIType(); EXPECT_FALSE(app_impl->is_navi()); EXPECT_TRUE(app_impl->is_voice_communication_supported()); + EXPECT_FALSE(app_impl->mobile_projection_enabled()); } TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeIsNavi) { @@ -597,12 +601,14 @@ TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeIsNavi) { EXPECT_FALSE(app_impl->is_navi()); EXPECT_FALSE(app_impl->is_voice_communication_supported()); + EXPECT_FALSE(app_impl->mobile_projection_enabled()); app_impl->set_app_types(type_navi); app_impl->ChangeSupportingAppHMIType(); EXPECT_TRUE(app_impl->is_navi()); EXPECT_FALSE(app_impl->is_voice_communication_supported()); + EXPECT_FALSE(app_impl->mobile_projection_enabled()); } TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeIsNaviAndVoice) { @@ -613,12 +619,34 @@ TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeIsNaviAndVoice) { EXPECT_FALSE(app_impl->is_navi()); EXPECT_FALSE(app_impl->is_voice_communication_supported()); + EXPECT_FALSE(app_impl->mobile_projection_enabled()); app_impl->set_app_types(app_types); app_impl->ChangeSupportingAppHMIType(); EXPECT_TRUE(app_impl->is_navi()); EXPECT_TRUE(app_impl->is_voice_communication_supported()); + EXPECT_FALSE(app_impl->mobile_projection_enabled()); +} + +TEST_F(ApplicationImplTest, + ChangeSupportingAppHMIType_TypeIsNaviAndVoiceAndProjection) { + smart_objects::SmartObject app_types; + app_types[0] = AppHMIType::NAVIGATION; + app_types[1] = AppHMIType::COMMUNICATION; + app_types[2] = AppHMIType::MEDIA; + app_types[3] = AppHMIType::PROJECTION; + + EXPECT_FALSE(app_impl->is_navi()); + EXPECT_FALSE(app_impl->is_voice_communication_supported()); + EXPECT_FALSE(app_impl->mobile_projection_enabled()); + + app_impl->set_app_types(app_types); + app_impl->ChangeSupportingAppHMIType(); + + EXPECT_TRUE(app_impl->is_navi()); + EXPECT_TRUE(app_impl->is_voice_communication_supported()); + EXPECT_TRUE(app_impl->mobile_projection_enabled()); } TEST_F(ApplicationImplTest, UpdateHash_AppMngrNotSuspended) { @@ -629,6 +657,31 @@ TEST_F(ApplicationImplTest, UpdateHash_AppMngrNotSuspended) { EXPECT_TRUE(app_impl->is_application_data_changed()); } +TEST_F(ApplicationImplTest, SetVideoConfig_MobileNavi_StreamingNotApproved) { + EXPECT_CALL(*MockMessageHelper::message_helper_mock(), + SendNaviSetVideoConfig(app_id, _, _)); + + smart_objects::SmartObject params; + app_impl->SetVideoConfig(protocol_handler::ServiceType::kMobileNav, params); +} + +TEST_F(ApplicationImplTest, SetVideoConfig_MobileNavi_StreamingApproved) { + app_impl->set_video_streaming_approved(true); + EXPECT_CALL(*MockMessageHelper::message_helper_mock(), + SendNaviSetVideoConfig(app_id, _, _)).Times(0); + + smart_objects::SmartObject params; + app_impl->SetVideoConfig(protocol_handler::ServiceType::kMobileNav, params); +} + +TEST_F(ApplicationImplTest, SetVideoConfig_NotMobileNavi) { + EXPECT_CALL(*MockMessageHelper::message_helper_mock(), + SendNaviSetVideoConfig(app_id, _, _)).Times(0); + + smart_objects::SmartObject params; + app_impl->SetVideoConfig(protocol_handler::ServiceType::kAudio, params); +} + TEST_F(ApplicationImplTest, StartStreaming_MobileNavi_StreamingNotApproved) { EXPECT_CALL(*MockMessageHelper::message_helper_mock(), SendNaviStartStream(app_id, _)); diff --git a/src/components/application_manager/test/application_manager_impl_test.cc b/src/components/application_manager/test/application_manager_impl_test.cc index 5b232e1dfc..d19d3cd8ed 100644 --- a/src/components/application_manager/test/application_manager_impl_test.cc +++ b/src/components/application_manager/test/application_manager_impl_test.cc @@ -32,11 +32,13 @@ #include <stdint.h> #include <memory> #include <set> +#include <bson_object.h> #include "gtest/gtest.h" #include "application_manager/application.h" #include "application_manager/application_impl.h" #include "application_manager/application_manager_impl.h" +#include "application_manager/mock_application.h" #include "application_manager/mock_application_manager_settings.h" #include "application_manager/mock_resumption_data.h" #include "application_manager/resumption/resume_ctrl_impl.h" @@ -45,6 +47,7 @@ #include "hmi_message_handler/mock_hmi_message_handler.h" #include "policy/mock_policy_settings.h" #include "policy/usage_statistics/mock_statistics_manager.h" +#include "protocol/bson_object_keys.h" #include "protocol_handler/mock_session_observer.h" #include "utils/custom_string.h" #include "utils/file_system.h" @@ -61,14 +64,22 @@ namespace policy_test = test::components::policy_handler_test; namespace con_test = connection_handler_test; using testing::_; +using ::testing::ByRef; +using ::testing::DoAll; using ::testing::Mock; using ::testing::Return; using ::testing::ReturnRef; using ::testing::NiceMock; +using ::testing::SaveArg; using ::testing::SetArgPointee; using namespace application_manager; +// custom action to call a member function with 4 arguments +ACTION_P6(InvokeMemberFuncWithArg4, ptr, memberFunc, a, b, c, d) { + (ptr->*memberFunc)(a, b, c, d); +} + namespace { const std::string kDirectoryName = "./test_storage"; const uint32_t kTimeout = 10000u; @@ -124,8 +135,14 @@ class ApplicationManagerImplTest : public ::testing::Test { .WillByDefault(ReturnRef(kTimeout)); app_manager_impl_.reset(new am::ApplicationManagerImpl( mock_application_manager_settings_, mock_policy_settings_)); + mock_app_ptr_ = utils::SharedPtr<MockApplication>(new MockApplication()); ASSERT_TRUE(app_manager_impl_.get()); + ASSERT_TRUE(mock_app_ptr_.get()); + } + + void AddMockApplication() { + app_manager_impl_->AddMockApplication(mock_app_ptr_); } NiceMock<policy_test::MockPolicySettings> mock_policy_settings_; @@ -139,6 +156,7 @@ class ApplicationManagerImplTest : public ::testing::Test { application_manager::MockMessageHelper* mock_message_helper_; uint32_t app_id_; application_manager::MessageHelper* message_helper_; + utils::SharedPtr<MockApplication> mock_app_ptr_; }; TEST_F(ApplicationManagerImplTest, ProcessQueryApp_ExpectSuccess) { @@ -195,6 +213,432 @@ TEST_F( EXPECT_TRUE(result.find(app_id_) != result.end()); } +TEST_F(ApplicationManagerImplTest, OnServiceStartedCallback_RpcService) { + AddMockApplication(); + + const connection_handler::DeviceHandle device_handle = 0; + const protocol_handler::ServiceType service_type = + protocol_handler::ServiceType::kRpc; + const int32_t session_key = 123; + EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key)); + + bool result = false; + std::vector<std::string> rejected_params; + EXPECT_CALL(mock_connection_handler_, NotifyServiceStartedResult(_, _, _)) + .WillOnce(DoAll(SaveArg<1>(&result), SaveArg<2>(&rejected_params))); + + app_manager_impl_->OnServiceStartedCallback( + device_handle, session_key, service_type, NULL); + + // check: return value is true and list is empty + EXPECT_TRUE(result); + EXPECT_TRUE(rejected_params.empty()); +} + +TEST_F(ApplicationManagerImplTest, OnServiceStartedCallback_UnknownApp) { + AddMockApplication(); + + const connection_handler::DeviceHandle device_handle = 0; + const protocol_handler::ServiceType service_type = + protocol_handler::ServiceType::kInvalidServiceType; + const int32_t session_key = 123; + EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(456)); + + bool result = false; + std::vector<std::string> rejected_params; + EXPECT_CALL(mock_connection_handler_, NotifyServiceStartedResult(_, _, _)) + .WillOnce(DoAll(SaveArg<1>(&result), SaveArg<2>(&rejected_params))); + + app_manager_impl_->OnServiceStartedCallback( + device_handle, session_key, service_type, NULL); + + // check: return value is false and list is empty + EXPECT_FALSE(result); + EXPECT_TRUE(rejected_params.empty()); +} + +TEST_F(ApplicationManagerImplTest, OnServiceStartedCallback_UnknownService) { + AddMockApplication(); + + const connection_handler::DeviceHandle device_handle = 0; + const protocol_handler::ServiceType service_type = + protocol_handler::ServiceType::kInvalidServiceType; + const int32_t session_key = 123; + EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key)); + + bool result = false; + std::vector<std::string> rejected_params; + EXPECT_CALL(mock_connection_handler_, NotifyServiceStartedResult(_, _, _)) + .WillOnce(DoAll(SaveArg<1>(&result), SaveArg<2>(&rejected_params))); + + app_manager_impl_->OnServiceStartedCallback( + device_handle, session_key, service_type, NULL); + + // check: return value is false and list is empty + EXPECT_FALSE(result); + EXPECT_TRUE(rejected_params.empty()); +} + +TEST_F(ApplicationManagerImplTest, OnServiceStartedCallback_VideoServiceStart) { + AddMockApplication(); + + const connection_handler::DeviceHandle device_handle = 0; + const protocol_handler::ServiceType service_type = + protocol_handler::ServiceType::kMobileNav; + const int32_t session_key = 123; + EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key)); + EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true)); + EXPECT_CALL(*mock_app_ptr_, hmi_level()) + .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL)); + + bool result = false; + std::vector<std::string> rejected_params; + EXPECT_CALL(mock_connection_handler_, NotifyServiceStartedResult(_, _, _)) + .WillOnce(DoAll(SaveArg<1>(&result), SaveArg<2>(&rejected_params))); + + // check: SetVideoConfig() should not be called, StartStreaming() is called + EXPECT_CALL(*mock_app_ptr_, SetVideoConfig(_, _)).Times(0); + EXPECT_CALL(*mock_app_ptr_, StartStreaming(service_type)).WillOnce(Return()); + + app_manager_impl_->OnServiceStartedCallback( + device_handle, session_key, service_type, NULL); + + // check: return value is true and list is empty + EXPECT_TRUE(result); + EXPECT_TRUE(rejected_params.empty()); +} + +TEST_F(ApplicationManagerImplTest, + OnServiceStartedCallback_VideoServiceNotStart1) { + AddMockApplication(); + + const connection_handler::DeviceHandle device_handle = 0; + const protocol_handler::ServiceType service_type = + protocol_handler::ServiceType::kMobileNav; + const int32_t session_key = 123; + EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key)); + // is_navi() is false + EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(false)); + EXPECT_CALL(*mock_app_ptr_, hmi_level()) + .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL)); + + bool result = false; + std::vector<std::string> rejected_params; + EXPECT_CALL(mock_connection_handler_, NotifyServiceStartedResult(_, _, _)) + .WillOnce(DoAll(SaveArg<1>(&result), SaveArg<2>(&rejected_params))); + + // check: SetVideoConfig() and StartStreaming() should not be called + EXPECT_CALL(*mock_app_ptr_, SetVideoConfig(_, _)).Times(0); + EXPECT_CALL(*mock_app_ptr_, StartStreaming(service_type)).Times(0); + + app_manager_impl_->OnServiceStartedCallback( + device_handle, session_key, service_type, NULL); + + // check: return value is false and list is empty + EXPECT_FALSE(result); + EXPECT_TRUE(rejected_params.empty()); +} + +TEST_F(ApplicationManagerImplTest, + OnServiceStartedCallback_VideoServiceNotStart2) { + AddMockApplication(); + + const connection_handler::DeviceHandle device_handle = 0; + const protocol_handler::ServiceType service_type = + protocol_handler::ServiceType::kMobileNav; + const int32_t session_key = 123; + EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key)); + EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true)); + // HMI level is not FULL nor LIMITED + EXPECT_CALL(*mock_app_ptr_, hmi_level()) + .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_BACKGROUND)); + + bool result = false; + std::vector<std::string> rejected_params; + EXPECT_CALL(mock_connection_handler_, NotifyServiceStartedResult(_, _, _)) + .WillOnce(DoAll(SaveArg<1>(&result), SaveArg<2>(&rejected_params))); + + // check: SetVideoConfig() and StartStreaming() should not be called + EXPECT_CALL(*mock_app_ptr_, SetVideoConfig(_, _)).Times(0); + EXPECT_CALL(*mock_app_ptr_, StartStreaming(service_type)).Times(0); + + app_manager_impl_->OnServiceStartedCallback( + device_handle, session_key, service_type, NULL); + + // check: return value is false and list is empty + EXPECT_FALSE(result); + EXPECT_TRUE(rejected_params.empty()); +} + +TEST_F(ApplicationManagerImplTest, + OnServiceStartedCallback_VideoSetConfig_SUCCESS) { + AddMockApplication(); + + const connection_handler::DeviceHandle device_handle = 0; + const protocol_handler::ServiceType service_type = + protocol_handler::ServiceType::kMobileNav; + const int32_t session_key = 123; + EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key)); + EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true)); + EXPECT_CALL(*mock_app_ptr_, hmi_level()) + .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_LIMITED)); + + bool result = false; + std::vector<std::string> rejected_params; + EXPECT_CALL(mock_connection_handler_, NotifyServiceStartedResult(_, _, _)) + .WillOnce(DoAll(SaveArg<1>(&result), SaveArg<2>(&rejected_params))); + + BsonObject input_params; + bson_object_initialize_default(&input_params); + char protocol_version[] = "1.0.0"; + bson_object_put_string(&input_params, + protocol_handler::strings::protocol_version, + protocol_version); + bson_object_put_int64(&input_params, protocol_handler::strings::mtu, 100); + char protocol_name[] = "RTP"; + bson_object_put_string( + &input_params, protocol_handler::strings::video_protocol, protocol_name); + char codec_name[] = "VP9"; + bson_object_put_string( + &input_params, protocol_handler::strings::video_codec, codec_name); + bson_object_put_int32(&input_params, protocol_handler::strings::height, 640); + bson_object_put_int32(&input_params, protocol_handler::strings::width, 480); + + smart_objects::SmartObject converted_params(smart_objects::SmartType_Map); + converted_params[strings::protocol] = + hmi_apis::Common_VideoStreamingProtocol::RTP; + converted_params[strings::codec] = hmi_apis::Common_VideoStreamingCodec::VP9; + converted_params[strings::height] = 640; + converted_params[strings::width] = 480; + + std::vector<std::string> empty; + + // check: SetVideoConfig() and StartStreaming() are called + EXPECT_CALL(*mock_app_ptr_, SetVideoConfig(service_type, converted_params)) + .WillOnce(DoAll(InvokeMemberFuncWithArg4( + app_manager_impl_.get(), + &ApplicationManagerImpl::OnStreamingConfigured, + session_key, + service_type, + true, + ByRef(empty)), + Return(true))); + EXPECT_CALL(*mock_app_ptr_, StartStreaming(service_type)).WillOnce(Return()); + + app_manager_impl_->OnServiceStartedCallback( + device_handle, session_key, service_type, &input_params); + + // check: return value is true and list is empty + EXPECT_TRUE(result); + EXPECT_TRUE(rejected_params.empty()); +} + +static bool ValidateList(std::vector<std::string>& expected, + std::vector<std::string>& actual) { + if (expected.size() != actual.size()) { + return false; + } + for (unsigned int i = 0; i < expected.size(); i++) { + std::string& param = expected[i]; + unsigned int j; + for (j = 0; j < actual.size(); j++) { + if (param == actual[j]) { + break; + } + } + if (j == actual.size()) { + // not found + return false; + } + } + return true; +} + +TEST_F(ApplicationManagerImplTest, + OnServiceStartedCallback_VideoSetConfig_FAILURE) { + AddMockApplication(); + + const connection_handler::DeviceHandle device_handle = 0; + const protocol_handler::ServiceType service_type = + protocol_handler::ServiceType::kMobileNav; + const int32_t session_key = 123; + EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key)); + EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true)); + EXPECT_CALL(*mock_app_ptr_, hmi_level()) + .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL)); + + bool result = false; + std::vector<std::string> rejected_params; + EXPECT_CALL(mock_connection_handler_, NotifyServiceStartedResult(_, _, _)) + .WillOnce(DoAll(SaveArg<1>(&result), SaveArg<2>(&rejected_params))); + + BsonObject input_params; + bson_object_initialize_default(&input_params); + char protocol_version[] = "1.0.0"; + bson_object_put_string(&input_params, + protocol_handler::strings::protocol_version, + protocol_version); + bson_object_put_int64(&input_params, protocol_handler::strings::mtu, 100); + char protocol_name[] = "RTP"; + bson_object_put_string( + &input_params, protocol_handler::strings::video_protocol, protocol_name); + char codec_name[] = "VP9"; + bson_object_put_string( + &input_params, protocol_handler::strings::video_codec, codec_name); + bson_object_put_int32(&input_params, protocol_handler::strings::height, 640); + bson_object_put_int32(&input_params, protocol_handler::strings::width, 480); + + smart_objects::SmartObject converted_params(smart_objects::SmartType_Map); + converted_params[strings::protocol] = + hmi_apis::Common_VideoStreamingProtocol::RTP; + converted_params[strings::codec] = hmi_apis::Common_VideoStreamingCodec::VP9; + converted_params[strings::height] = 640; + converted_params[strings::width] = 480; + + std::vector<std::string> rejected_list; + rejected_list.push_back(std::string("protocol")); + rejected_list.push_back(std::string("codec")); + + // simulate HMI returning negative response + EXPECT_CALL(*mock_app_ptr_, SetVideoConfig(service_type, converted_params)) + .WillOnce(DoAll(InvokeMemberFuncWithArg4( + app_manager_impl_.get(), + &ApplicationManagerImpl::OnStreamingConfigured, + session_key, + service_type, + false, + ByRef(rejected_list)), + Return(true))); + + // check: StartStreaming() should not be called + EXPECT_CALL(*mock_app_ptr_, StartStreaming(service_type)).Times(0); + + app_manager_impl_->OnServiceStartedCallback( + device_handle, session_key, service_type, &input_params); + + // check: return value is false + EXPECT_FALSE(result); + + // check: rejected param list contains "videoProtocol" and "videoCodec" + ASSERT_EQ(2u, rejected_params.size()); + std::vector<std::string> expected_list; + expected_list.push_back( + std::string(protocol_handler::strings::video_protocol)); + expected_list.push_back(std::string(protocol_handler::strings::video_codec)); + ASSERT_TRUE(ValidateList(expected_list, rejected_params)); +} + +TEST_F(ApplicationManagerImplTest, + OnServiceStartedCallback_VideoServiceWithoutVideoParams) { + AddMockApplication(); + + const connection_handler::DeviceHandle device_handle = 0; + const protocol_handler::ServiceType service_type = + protocol_handler::ServiceType::kMobileNav; + const int32_t session_key = 123; + EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key)); + EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true)); + EXPECT_CALL(*mock_app_ptr_, hmi_level()) + .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL)); + + bool result = false; + std::vector<std::string> rejected_params; + EXPECT_CALL(mock_connection_handler_, NotifyServiceStartedResult(_, _, _)) + .WillOnce(DoAll(SaveArg<1>(&result), SaveArg<2>(&rejected_params))); + + BsonObject input_params; + bson_object_initialize_default(&input_params); + char protocol_version[] = "1.0.0"; + bson_object_put_string(&input_params, "protocolVersion", protocol_version); + bson_object_put_int64(&input_params, "mtu", 100); + + // check: SetVideoConfig() should not be called, StartStreaming() is called + EXPECT_CALL(*mock_app_ptr_, SetVideoConfig(_, _)).Times(0); + EXPECT_CALL(*mock_app_ptr_, StartStreaming(service_type)).WillOnce(Return()); + + app_manager_impl_->OnServiceStartedCallback( + device_handle, session_key, service_type, &input_params); + + // check: return value is true and list is empty + EXPECT_TRUE(result); + EXPECT_TRUE(rejected_params.empty()); +} + +TEST_F(ApplicationManagerImplTest, OnServiceStartedCallback_AudioServiceStart) { + AddMockApplication(); + + const connection_handler::DeviceHandle device_handle = 0; + const protocol_handler::ServiceType service_type = + protocol_handler::ServiceType::kAudio; + const int32_t session_key = 123; + EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key)); + EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true)); + EXPECT_CALL(*mock_app_ptr_, hmi_level()) + .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL)); + + bool result = false; + std::vector<std::string> rejected_params; + EXPECT_CALL(mock_connection_handler_, NotifyServiceStartedResult(_, _, _)) + .WillOnce(DoAll(SaveArg<1>(&result), SaveArg<2>(&rejected_params))); + + // check: SetVideoConfig() should not be called, StartStreaming() is called + EXPECT_CALL(*mock_app_ptr_, SetVideoConfig(_, _)).Times(0); + EXPECT_CALL(*mock_app_ptr_, StartStreaming(service_type)).WillOnce(Return()); + + app_manager_impl_->OnServiceStartedCallback( + device_handle, session_key, service_type, NULL); + + // check: return value is true and list is empty + EXPECT_TRUE(result); + EXPECT_TRUE(rejected_params.empty()); +} + +TEST_F(ApplicationManagerImplTest, + OnServiceStartedCallback_AudioServiceWithParams) { + AddMockApplication(); + + const connection_handler::DeviceHandle device_handle = 0; + const protocol_handler::ServiceType service_type = + protocol_handler::ServiceType::kAudio; + const int32_t session_key = 123; + EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key)); + EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true)); + EXPECT_CALL(*mock_app_ptr_, hmi_level()) + .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL)); + + bool result = false; + std::vector<std::string> rejected_params; + EXPECT_CALL(mock_connection_handler_, NotifyServiceStartedResult(_, _, _)) + .WillOnce(DoAll(SaveArg<1>(&result), SaveArg<2>(&rejected_params))); + + BsonObject input_params; + bson_object_initialize_default(&input_params); + char protocol_version[] = "1.0.0"; + bson_object_put_string(&input_params, + protocol_handler::strings::protocol_version, + protocol_version); + bson_object_put_int64(&input_params, protocol_handler::strings::mtu, 100); + char protocol_name[] = "RTP"; + bson_object_put_string( + &input_params, protocol_handler::strings::video_protocol, protocol_name); + char codec_name[] = "VP9"; + bson_object_put_string( + &input_params, protocol_handler::strings::video_codec, codec_name); + bson_object_put_int32(&input_params, protocol_handler::strings::height, 640); + bson_object_put_int32(&input_params, protocol_handler::strings::width, 480); + + // check: SetVideoConfig() should not be called, StartStreaming() is called + EXPECT_CALL(*mock_app_ptr_, SetVideoConfig(_, _)).Times(0); + EXPECT_CALL(*mock_app_ptr_, StartStreaming(service_type)).WillOnce(Return()); + + app_manager_impl_->OnServiceStartedCallback( + device_handle, session_key, service_type, &input_params); + + // check: return value is true and list is empty + EXPECT_TRUE(result); + EXPECT_TRUE(rejected_params.empty()); +} + } // application_manager_test } // namespace components } // namespace test diff --git a/src/components/application_manager/test/commands/CMakeLists.txt b/src/components/application_manager/test/commands/CMakeLists.txt index e22d1434a7..cc16e4d87b 100644 --- a/src/components/application_manager/test/commands/CMakeLists.txt +++ b/src/components/application_manager/test/commands/CMakeLists.txt @@ -44,8 +44,10 @@ include_directories( set(COMMANDS_TEST_DIR ${AM_TEST_DIR}/commands) file(GLOB SOURCES + ${COMMANDS_TEST_DIR}/* ${COMPONENTS_DIR}/application_manager/test/mock_message_helper.cc ${COMPONENTS_DIR}/application_manager/src/smart_object_keys.cc + ${COMPONENTS_DIR}/application_manager/src/message.cc ${COMMANDS_TEST_DIR}/hmi/* ${COMMANDS_TEST_DIR}/hmi/hmi_notifications/* ${COMMANDS_TEST_DIR}/mobile/* diff --git a/src/components/application_manager/test/commands/command_request_impl_test.cc b/src/components/application_manager/test/commands/command_request_impl_test.cc index 2471ec1165..1948608b9f 100644 --- a/src/components/application_manager/test/commands/command_request_impl_test.cc +++ b/src/components/application_manager/test/commands/command_request_impl_test.cc @@ -64,6 +64,7 @@ using ::testing::_; using ::testing::Return; using ::testing::SaveArg; using ::testing::DoAll; +using ::testing::Mock; using ::utils::SharedPtr; using am::commands::MessageSharedPtr; @@ -121,13 +122,18 @@ class CommandRequestImplTest CommandParametersPermissions& removed_parameters_permissions() { return removed_parameters_permissions_; } + + void SetHashUpdateMode(HashUpdateMode mode) { + hash_update_mode_ = mode; + } }; - CommandRequestImplTest() { - mock_message_helper_ = am::MockMessageHelper::message_helper_mock(); + CommandRequestImplTest() + : mock_message_helper_(*am::MockMessageHelper::message_helper_mock()) { + Mock::VerifyAndClearExpectations(&mock_message_helper_); } ~CommandRequestImplTest() { - mock_message_helper_ = NULL; + Mock::VerifyAndClearExpectations(&mock_message_helper_); } MockAppPtr InitAppSetDataAccessor(SharedPtr<ApplicationSet>& app_set) { @@ -141,7 +147,7 @@ class CommandRequestImplTest } sync_primitives::Lock app_set_lock_; - am::MockMessageHelper* mock_message_helper_; + am::MockMessageHelper& mock_message_helper_; }; typedef CommandRequestImplTest::UnwrappedCommandRequestImpl UCommandRequestImpl; @@ -173,7 +179,7 @@ TEST_F(CommandRequestImplTest, OnTimeOut_StateAwaitingHMIResponse_SUCCESS) { CommandPtr command = CreateCommand<UCommandRequestImpl>(msg); MessageSharedPtr dummy_msg(CreateMessage()); - EXPECT_CALL(*mock_message_helper_, CreateNegativeResponse(_, _, _, _)) + EXPECT_CALL(mock_message_helper_, CreateNegativeResponse(_, _, _, _)) .WillOnce(Return(dummy_msg)); EXPECT_CALL( app_mngr_, @@ -269,12 +275,11 @@ TEST_F(CommandRequestImplTest, SendHMIRequest_NoUseEvent_SUCCESS) { EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()) .WillOnce(Return(kCorrelationId)); - MockHmiInterfaces hmi_interfaces; - EXPECT_CALL(app_mngr_, hmi_interfaces()).WillOnce(ReturnRef(hmi_interfaces)); - EXPECT_CALL(hmi_interfaces, GetInterfaceFromFunction(_)) - .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_BasicCommunication)); - EXPECT_CALL(hmi_interfaces, GetInterfaceState(_)) - .WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE)); + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_)) + .WillRepeatedly( + Return(am::HmiInterfaces::HMI_INTERFACE_BasicCommunication)); + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) + .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE)); // Return `true` prevents call of `SendResponse` method; EXPECT_CALL(app_mngr_, ManageHMICommand(_)).WillOnce(Return(true)); @@ -287,12 +292,11 @@ TEST_F(CommandRequestImplTest, SendHMIRequest_UseEvent_SUCCESS) { EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()) .WillOnce(Return(kCorrelationId)); - MockHmiInterfaces hmi_interfaces; - EXPECT_CALL(app_mngr_, hmi_interfaces()).WillOnce(ReturnRef(hmi_interfaces)); - EXPECT_CALL(hmi_interfaces, GetInterfaceFromFunction(_)) - .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_BasicCommunication)); - EXPECT_CALL(hmi_interfaces, GetInterfaceState(_)) - .WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE)); + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_)) + .WillRepeatedly( + Return(am::HmiInterfaces::HMI_INTERFACE_BasicCommunication)); + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) + .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE)); // Return `true` prevents call of `SendResponse` method; EXPECT_CALL(app_mngr_, ManageHMICommand(_)).WillOnce(Return(true)); @@ -307,7 +311,7 @@ TEST_F(CommandRequestImplTest, RemoveDisallowedParameters_SUCCESS) { vehicle_data.insert( am::VehicleData::value_type(kMissedParam, am::VehicleDataType::MYKEY)); - EXPECT_CALL(*mock_message_helper_, vehicle_data()) + EXPECT_CALL(mock_message_helper_, vehicle_data()) .WillOnce(ReturnRef(vehicle_data)); MessageSharedPtr msg = CreateMessage(); @@ -348,33 +352,24 @@ TEST_F(CommandRequestImplTest, } TEST_F(CommandRequestImplTest, - CheckAllowedParameters_NoAppWithSameConnectionKey_SUCCESS) { - MessageSharedPtr msg = CreateMessage(); - (*msg)[strings::params][strings::connection_key] = kConnectionKey; - - CommandPtr command = CreateCommand<UCommandRequestImpl>(msg); - - SharedPtr<ApplicationSet> app_set; - MockAppPtr app(InitAppSetDataAccessor(app_set)); - EXPECT_CALL(*app, app_id()).WillOnce(Return(6u)); - EXPECT_TRUE(command->CheckPermissions()); + CheckAllowedParameters_NoAppWithSameConnectionKey_UNSUCCESS) { + MessageSharedPtr message = CreateMessage(); + CommandPtr command = CreateCommand<UCommandRequestImpl>(message); + EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(MockAppPtr())); + EXPECT_FALSE(command->CheckPermissions()); } TEST_F(CommandRequestImplTest, CheckAllowedParameters_NoMsgParamsMap_SUCCESS) { - MessageSharedPtr msg = CreateMessage(); - (*msg)[strings::params][strings::connection_key] = kConnectionKey; - (*msg)[strings::msg_params] = 0u; + MockAppPtr mock_app = CreateMockApp(); + ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app)); - CommandPtr command = CreateCommand<UCommandRequestImpl>(msg); + MessageSharedPtr message = CreateMessage(); + (*message)[strings::msg_params] = + smart_objects::SmartObject(smart_objects::SmartType_Map); - SharedPtr<ApplicationSet> app_set; - MockAppPtr app(InitAppSetDataAccessor(app_set)); - EXPECT_CALL(*app, app_id()).WillOnce(Return(kConnectionKey)); - EXPECT_CALL(*app, policy_app_id()).WillOnce(Return(kPolicyAppId)); - EXPECT_CALL(*app, hmi_level()) - .WillOnce(Return(mobile_apis::HMILevel::HMI_NONE)); + CommandPtr command = CreateCommand<UCommandRequestImpl>(message); - EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _, _)) + EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _)) .WillOnce(Return(kMobResultSuccess)); EXPECT_TRUE(command->CheckPermissions()); @@ -382,32 +377,31 @@ TEST_F(CommandRequestImplTest, CheckAllowedParameters_NoMsgParamsMap_SUCCESS) { TEST_F(CommandRequestImplTest, CheckAllowedParameters_WrongPolicyPermissions_UNSUCCESS) { - MessageSharedPtr msg = CreateMessage(); - (*msg)[strings::params][strings::connection_key] = kConnectionKey; - (*msg)[strings::msg_params] = 0u; + MockAppPtr mock_app = CreateMockApp(); + ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app)); - CommandPtr command = CreateCommand<UCommandRequestImpl>(msg); + MessageSharedPtr message = CreateMessage(); + (*message)[strings::msg_params] = + smart_objects::SmartObject(smart_objects::SmartType_Map); + + CommandPtr command = CreateCommand<UCommandRequestImpl>(message); - SharedPtr<ApplicationSet> app_set; - MockAppPtr app(InitAppSetDataAccessor(app_set)); - EXPECT_CALL(*app, app_id()).Times(2).WillRepeatedly(Return(kConnectionKey)); - EXPECT_CALL(*app, policy_app_id()).WillOnce(Return(kPolicyAppId)); - EXPECT_CALL(*app, hmi_level()) - .WillOnce(Return(mobile_apis::HMILevel::HMI_NONE)); + EXPECT_CALL(*mock_app, app_id()) + .Times(1) + .WillRepeatedly(Return(kConnectionKey)); - EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _, _)) + EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _)) .WillOnce(Return(mobile_apis::Result::INVALID_ENUM)); - MessageSharedPtr dummy_msg; - EXPECT_CALL(*mock_message_helper_, - CreateBlockedByPoliciesResponse(_, _, _, _)) - .WillOnce(Return(dummy_msg)); + EXPECT_CALL(mock_message_helper_, CreateBlockedByPoliciesResponse(_, _, _, _)) + .WillOnce(Return(smart_objects::SmartObjectSPtr())); + EXPECT_CALL(app_mngr_, SendMessageToMobile(_, _)); EXPECT_FALSE(command->CheckPermissions()); } ACTION_P(GetArg3, output) { - *output = arg3; + *output = arg2; } TEST_F(CommandRequestImplTest, CheckAllowedParameters_MsgParamsMap_SUCCESS) { @@ -417,15 +411,11 @@ TEST_F(CommandRequestImplTest, CheckAllowedParameters_MsgParamsMap_SUCCESS) { CommandPtr command = CreateCommand<UCommandRequestImpl>(msg); - SharedPtr<ApplicationSet> app_set; - MockAppPtr app(InitAppSetDataAccessor(app_set)); - EXPECT_CALL(*app, app_id()).WillOnce(Return(kConnectionKey)); - EXPECT_CALL(*app, policy_app_id()).WillOnce(Return(kPolicyAppId)); - EXPECT_CALL(*app, hmi_level()) - .WillOnce(Return(mobile_apis::HMILevel::HMI_NONE)); + MockAppPtr app = CreateMockApp(); + ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app)); RPCParams params; - EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _, _)) + EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _)) .WillOnce(DoAll(GetArg3(¶ms), Return(kMobResultSuccess))); EXPECT_TRUE(command->CheckPermissions()); @@ -438,7 +428,7 @@ TEST_F(CommandRequestImplTest, AddDisallowedParameters_SUCCESS) { vehicle_data.insert(am::VehicleData::value_type(kDisallowedParam1, am::VehicleDataType::MYKEY)); - EXPECT_CALL(*mock_message_helper_, vehicle_data()) + EXPECT_CALL(mock_message_helper_, vehicle_data()) .WillOnce(ReturnRef(vehicle_data)); MessageSharedPtr msg; @@ -490,7 +480,7 @@ TEST_F(CommandRequestImplTest, vehicle_data.insert(am::VehicleData::value_type(kDisallowedParam1, am::VehicleDataType::MYKEY)); - EXPECT_CALL(*mock_message_helper_, vehicle_data()) + EXPECT_CALL(mock_message_helper_, vehicle_data()) .WillOnce(ReturnRef(vehicle_data)); MessageSharedPtr msg = CreateMessage(); @@ -515,6 +505,81 @@ TEST_F(CommandRequestImplTest, (*result)[strings::msg_params][strings::info].asString().empty()); } +TEST_F(CommandRequestImplTest, HashUpdateAllowed_UpdateExpected) { + MessageSharedPtr msg; + CommandPtr command = CreateCommand<UCommandRequestImpl>(msg); + command->SetHashUpdateMode(CommandRequestImpl::HashUpdateMode::kDoHashUpdate); + + MessageSharedPtr result; + EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)) + .WillOnce(DoAll(SaveArg<0>(&result), Return(true))); + + const bool is_succedeed = true; + command->SendResponse(is_succedeed, kMobResultSuccess, NULL, NULL); + + MockAppPtr mock_app = CreateMockApp(); + EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app)); + EXPECT_CALL(*mock_app, UpdateHash()); + + command.reset(); +} + +TEST_F(CommandRequestImplTest, HashUpdateDisallowed_HashUpdateNotExpected) { + MessageSharedPtr msg; + CommandPtr command = CreateCommand<UCommandRequestImpl>(msg); + command->SetHashUpdateMode( + CommandRequestImpl::HashUpdateMode::kSkipHashUpdate); + + MessageSharedPtr result; + EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)) + .WillOnce(DoAll(SaveArg<0>(&result), Return(true))); + + const bool is_succedeed = true; + command->SendResponse(is_succedeed, kMobResultSuccess, NULL, NULL); + + MockAppPtr mock_app = CreateMockApp(); + EXPECT_CALL(*mock_app, UpdateHash()).Times(0); + + command.reset(); +} + +TEST_F(CommandRequestImplTest, RequestFailed_HashUpdateNotExpected) { + MessageSharedPtr msg; + CommandPtr command = CreateCommand<UCommandRequestImpl>(msg); + command->SetHashUpdateMode(CommandRequestImpl::HashUpdateMode::kDoHashUpdate); + + MessageSharedPtr result; + EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)) + .WillOnce(DoAll(SaveArg<0>(&result), Return(true))); + + const bool is_succedeed = false; + command->SendResponse(is_succedeed, kMobResultSuccess, NULL, NULL); + + MockAppPtr mock_app = CreateMockApp(); + EXPECT_CALL(*mock_app, UpdateHash()).Times(0); + + command.reset(); +} + +TEST_F(CommandRequestImplTest, AppNotFound_HashUpdateNotExpected) { + MessageSharedPtr msg; + CommandPtr command = CreateCommand<UCommandRequestImpl>(msg); + command->SetHashUpdateMode(CommandRequestImpl::HashUpdateMode::kDoHashUpdate); + + MessageSharedPtr result; + EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)) + .WillOnce(DoAll(SaveArg<0>(&result), Return(true))); + + const bool is_succedeed = true; + command->SendResponse(is_succedeed, kMobResultSuccess, NULL, NULL); + + MockAppPtr mock_app = CreateMockApp(); + EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(MockAppPtr())); + EXPECT_CALL(*mock_app, UpdateHash()).Times(0); + + command.reset(); +} + } // namespace command_request_impl } // namespace commands_test } // namespace components diff --git a/src/components/application_manager/test/commands/hmi/hmi_notifications/hmi_notifications_test.cc b/src/components/application_manager/test/commands/hmi/hmi_notifications/hmi_notifications_test.cc index ecdb698c56..9af72a7925 100644 --- a/src/components/application_manager/test/commands/hmi/hmi_notifications/hmi_notifications_test.cc +++ b/src/components/application_manager/test/commands/hmi/hmi_notifications/hmi_notifications_test.cc @@ -130,6 +130,9 @@ #include "application_manager/policies/mock_policy_handler_interface.h" #include "application_manager/mock_message_helper.h" #include "protocol_handler/mock_session_observer.h" +#ifdef SDL_REMOTE_CONTROL +#include "functional_module/plugin_manager.h" +#endif // SDL_REMOTE_CONTROL namespace am = application_manager; @@ -1106,6 +1109,12 @@ TEST_F(HMICommandsNotificationsTest, (*notification)[am::strings::msg_params][am::strings::reason] = static_cast<int32_t>(*it_mobile_reason); +#ifdef SDL_REMOTE_CONTROL + functional_modules::PluginManager plugin_mng; + EXPECT_CALL(app_mngr_, GetPluginManager()) + .WillRepeatedly(ReturnRef(plugin_mng)); +#endif // SDL_REMOTE_CONTROL + EXPECT_CALL(app_mngr_, application(kAppId_)).WillRepeatedly(Return(app_)); EXPECT_CALL(*message_helper_mock_, GetOnAppInterfaceUnregisteredNotificationToMobile( @@ -1130,6 +1139,12 @@ TEST_F(HMICommandsNotificationsTest, utils::SharedPtr<Command> command = CreateCommand<OnExitApplicationNotification>(message); +#ifdef SDL_REMOTE_CONTROL + functional_modules::PluginManager plugin_mng; + EXPECT_CALL(app_mngr_, GetPluginManager()) + .WillRepeatedly(ReturnRef(plugin_mng)); +#endif // SDL_REMOTE_CONTROL + EXPECT_CALL(app_mngr_, application(_)).Times(0); EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0); EXPECT_CALL(app_mngr_, UnregisterApplication(_, _, _, _)).Times(0); @@ -1184,6 +1199,12 @@ TEST_F(HMICommandsNotificationsTest, utils::SharedPtr<Command> command = CreateCommand<OnExitApplicationNotification>(message); +#ifdef SDL_REMOTE_CONTROL + functional_modules::PluginManager plugin_mng; + EXPECT_CALL(app_mngr_, GetPluginManager()) + .WillRepeatedly(ReturnRef(plugin_mng)); +#endif // SDL_REMOTE_CONTROL + EXPECT_CALL(app_mngr_, application(kAppId_)).WillRepeatedly(Return(app_)); EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0); EXPECT_CALL(app_mngr_, UnregisterApplication(_, _, _, _)).Times(0); diff --git a/src/components/application_manager/test/commands/hmi/navi_audio_start_stream_request_test.cc b/src/components/application_manager/test/commands/hmi/navi_audio_start_stream_request_test.cc index e590412204..c187cc75d9 100644 --- a/src/components/application_manager/test/commands/hmi/navi_audio_start_stream_request_test.cc +++ b/src/components/application_manager/test/commands/hmi/navi_audio_start_stream_request_test.cc @@ -67,8 +67,6 @@ class AudioStartStreamRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { public: AudioStartStreamRequestTest() { - ON_CALL(app_mngr_, hmi_interfaces()) - .WillByDefault(ReturnRef(mock_hmi_interfaces_)); ON_CALL(app_mngr_settings_, start_stream_retry_amount()) .WillByDefault(ReturnRef(start_stream_retry_amount_)); msg_ = CreateMessage(); @@ -78,7 +76,6 @@ class AudioStartStreamRequestTest std::pair<uint32_t, int32_t> start_stream_retry_amount_; MessageSharedPtr msg_; SharedPtr<AudioStartStreamRequest> command_; - MOCK(am::MockHmiInterfaces) mock_hmi_interfaces_; }; TEST_F(AudioStartStreamRequestTest, Run_HmiInterfaceNotAvailable_NoRequest) { diff --git a/src/components/application_manager/test/commands/hmi/navi_is_ready_request_test.cc b/src/components/application_manager/test/commands/hmi/navi_is_ready_request_test.cc index b08bf6e515..825cca9185 100644 --- a/src/components/application_manager/test/commands/hmi/navi_is_ready_request_test.cc +++ b/src/components/application_manager/test/commands/hmi/navi_is_ready_request_test.cc @@ -69,12 +69,9 @@ class NaviIsReadyRequestTest NaviIsReadyRequestTest() : command_(CreateCommand<NaviIsReadyRequest>()) { ON_CALL(app_mngr_, hmi_capabilities()) .WillByDefault(ReturnRef(mock_hmi_capabilities_)); - ON_CALL(app_mngr_, hmi_interfaces()) - .WillByDefault(ReturnRef(mock_hmi_interfaces_)); } NaviIsReadyRequestPtr command_; - MOCK(am::MockHmiInterfaces) mock_hmi_interfaces_; MOCK(application_manager_test::MockHMICapabilities) mock_hmi_capabilities_; }; diff --git a/src/components/application_manager/test/commands/hmi/navi_set_video_config_request_test.cc b/src/components/application_manager/test/commands/hmi/navi_set_video_config_request_test.cc new file mode 100644 index 0000000000..7c04aa724c --- /dev/null +++ b/src/components/application_manager/test/commands/hmi/navi_set_video_config_request_test.cc @@ -0,0 +1,216 @@ +/* + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the names of the copyright holders nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include <algorithm> + +#include "application_manager/commands/hmi/navi_set_video_config_request.h" + +#include "gtest/gtest.h" +#include "utils/shared_ptr.h" +#include "smart_objects/smart_object.h" +#include "application_manager/smart_object_keys.h" +#include "application_manager/commands/command_request_test.h" +#include "application_manager/mock_application_manager.h" +#include "application_manager/hmi_interfaces.h" +#include "application_manager/mock_hmi_interface.h" +#include "application_manager/event_engine/event.h" +#include "application_manager/mock_event_dispatcher.h" + +namespace test { +namespace components { +namespace commands_test { +namespace hmi_commands_test { +namespace navi_set_video_config_request { + +using ::testing::_; +using ::testing::ReturnRef; +namespace am = ::application_manager; +using am::commands::MessageSharedPtr; +using am::commands::NaviSetVideoConfigRequest; +using am::event_engine::Event; + +namespace { +const uint32_t kAppId = 1u; +const uint32_t kHmiAppId = 13u; +const hmi_apis::FunctionID::eType kEventID = + hmi_apis::FunctionID::Navigation_SetVideoConfig; +} // namespace + +typedef SharedPtr<NaviSetVideoConfigRequest> NaviSetVideoConfigRequestPtr; + +class NaviSetVideoConfigRequestTest + : public CommandRequestTest<CommandsTestMocks::kIsNice> { + public: + NaviSetVideoConfigRequestTest() { + mock_app_ptr_ = CreateMockApp(); + ON_CALL(app_mngr_, hmi_interfaces()) + .WillByDefault(ReturnRef(mock_hmi_interfaces_)); + ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_ptr_)); + ON_CALL(app_mngr_, application_by_hmi_app(_)) + .WillByDefault(Return(mock_app_ptr_)); + ON_CALL(app_mngr_, event_dispatcher()) + .WillByDefault(ReturnRef(mock_event_dispatcher_)); + ON_CALL(*mock_app_ptr_, app_id()).WillByDefault(Return(kAppId)); + ON_CALL(*mock_app_ptr_, hmi_app_id()).WillByDefault(Return(kHmiAppId)); + } + + MOCK(am::MockHmiInterfaces) mock_hmi_interfaces_; + MockAppPtr mock_app_ptr_; + MockEventDispatcher mock_event_dispatcher_; +}; + +TEST_F(NaviSetVideoConfigRequestTest, OnEventWithSuccessResponse) { + MessageSharedPtr request_msg = CreateMessage(); + (*request_msg)[am::strings::msg_params][am::strings::app_id] = kAppId; + + NaviSetVideoConfigRequestPtr command = + CreateCommand<NaviSetVideoConfigRequest>(request_msg); + + MessageSharedPtr event_msg = CreateMessage(); + (*event_msg)[am::strings::params][am::hmi_response::code] = + hmi_apis::Common_Result::SUCCESS; + Event event(kEventID); + event.set_smart_object(*event_msg); + + std::vector<std::string> empty; + EXPECT_CALL( + app_mngr_, + OnStreamingConfigured( + kAppId, protocol_handler::ServiceType::kMobileNav, true, empty)) + .Times(1); + + command->on_event(event); +} + +static bool ValidateList(std::vector<std::string>& expected, + std::vector<std::string>& actual) { + std::sort(expected.begin(), expected.end()); + std::sort(actual.begin(), actual.end()); + return std::equal(expected.begin(), expected.end(), actual.begin()); +} + +TEST_F(NaviSetVideoConfigRequestTest, OnEventWithRejectedResponse) { + MessageSharedPtr request_msg = CreateMessage(); + (*request_msg)[am::strings::msg_params][am::strings::app_id] = kAppId; + (*request_msg)[am::strings::msg_params][am::strings::config] = + smart_objects::SmartObject(smart_objects::SmartType_Array); + (*request_msg)[am::strings::msg_params][am::strings::config] + [am::strings::protocol] = + hmi_apis::Common_VideoStreamingProtocol::RTP; + (*request_msg)[am::strings::msg_params][am::strings::config] + [am::strings::codec] = + hmi_apis::Common_VideoStreamingCodec::H265; + (*request_msg)[am::strings::msg_params][am::strings::config] + [am::strings::height] = 640; + (*request_msg)[am::strings::msg_params][am::strings::config] + [am::strings::width] = 480; + + NaviSetVideoConfigRequestPtr command = + CreateCommand<NaviSetVideoConfigRequest>(request_msg); + + MessageSharedPtr event_msg = CreateMessage(); + (*event_msg)[am::strings::params][am::hmi_response::code] = + hmi_apis::Common_Result::REJECTED; + + (*event_msg)[am::strings::msg_params][am::strings::rejected_params] = + smart_objects::SmartObject(smart_objects::SmartType_Array); + (*event_msg)[am::strings::msg_params][am::strings::rejected_params][0] = + "codec"; + (*event_msg)[am::strings::msg_params][am::strings::rejected_params][1] = + "protocol"; + Event event(kEventID); + event.set_smart_object(*event_msg); + + std::vector<std::string> rejected_params; + EXPECT_CALL(app_mngr_, + OnStreamingConfigured( + kAppId, protocol_handler::ServiceType::kMobileNav, false, _)) + .WillOnce(SaveArg<3>(&rejected_params)); + + command->on_event(event); + + ASSERT_EQ(2u, rejected_params.size()); + std::vector<std::string> expected_list; + expected_list.push_back(std::string("protocol")); + expected_list.push_back(std::string("codec")); + ASSERT_TRUE(ValidateList(expected_list, rejected_params)); +} + +TEST_F(NaviSetVideoConfigRequestTest, + OnEventWithRejectedResponseWithoutParams) { + MessageSharedPtr request_msg = CreateMessage(); + (*request_msg)[am::strings::msg_params][am::strings::app_id] = kAppId; + + NaviSetVideoConfigRequestPtr command = + CreateCommand<NaviSetVideoConfigRequest>(request_msg); + + MessageSharedPtr event_msg = CreateMessage(); + (*event_msg)[am::strings::params][am::hmi_response::code] = + hmi_apis::Common_Result::REJECTED; + + Event event(kEventID); + event.set_smart_object(*event_msg); + + std::vector<std::string> empty; + EXPECT_CALL( + app_mngr_, + OnStreamingConfigured( + kAppId, protocol_handler::ServiceType::kMobileNav, false, empty)) + .WillOnce(Return()); + + command->on_event(event); +} + +TEST_F(NaviSetVideoConfigRequestTest, OnTimeout) { + MessageSharedPtr request_msg = CreateMessage(); + (*request_msg)[am::strings::msg_params][am::strings::app_id] = kAppId; + + NaviSetVideoConfigRequestPtr command = + CreateCommand<NaviSetVideoConfigRequest>(request_msg); + + std::vector<std::string> empty; + EXPECT_CALL( + app_mngr_, + OnStreamingConfigured( + kAppId, protocol_handler::ServiceType::kMobileNav, false, empty)) + .WillOnce(Return()); + + EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _)).Times(1); + + command->onTimeOut(); +} + +} // namespace navi_set_video_config_request +} // namespace hmi_commands_test +} // namespace commands_test +} // namespace components +} // namespace test diff --git a/src/components/application_manager/test/commands/hmi/navi_set_video_config_response_test.cc b/src/components/application_manager/test/commands/hmi/navi_set_video_config_response_test.cc new file mode 100644 index 0000000000..753c2a9179 --- /dev/null +++ b/src/components/application_manager/test/commands/hmi/navi_set_video_config_response_test.cc @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the names of the copyright holders nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "gtest/gtest.h" +#include "application_manager/commands/commands_test.h" +#include "application_manager/commands/hmi/navi_set_video_config_response.h" +#include "application_manager/mock_application_manager.h" +#include "application_manager/mock_event_dispatcher.h" +#include "application_manager/mock_hmi_capabilities.h" +#include "application_manager/smart_object_keys.h" + +namespace test { +namespace components { +namespace commands_test { +namespace hmi_commands_test { +namespace navi_set_video_config_response { + +using utils::SharedPtr; +using application_manager::commands::NaviSetVideoConfigResponse; +using test::components::event_engine_test::MockEventDispatcher; +using testing::_; +using testing::ReturnRef; +using ::testing::NiceMock; + +typedef NiceMock< + ::test::components::application_manager_test::MockHMICapabilities> + MockHMICapabilities; + +class NaviSetVideoConfigResponseTest + : public CommandsTest<CommandsTestMocks::kIsNice> {}; + +TEST_F(NaviSetVideoConfigResponseTest, RUN_SUCCESS) { + MessageSharedPtr msg = CreateMessage(); + + SharedPtr<NaviSetVideoConfigResponse> command( + CreateCommand<NaviSetVideoConfigResponse>(msg)); + + MockEventDispatcher mock_event_dispatcher; + EXPECT_CALL(app_mngr_, event_dispatcher()) + .WillOnce(ReturnRef(mock_event_dispatcher)); + EXPECT_CALL(mock_event_dispatcher, raise_event(_)); + + command->Run(); +} + +} // namespace navi_set_video_config_response +} // namespace hmi_commands_test +} // namespace commands_test +} // namespace components +} // namespace test diff --git a/src/components/application_manager/test/commands/hmi/navi_start_stream_request_test.cc b/src/components/application_manager/test/commands/hmi/navi_start_stream_request_test.cc index 8a157c9a0f..1327ff6dd6 100644 --- a/src/components/application_manager/test/commands/hmi/navi_start_stream_request_test.cc +++ b/src/components/application_manager/test/commands/hmi/navi_start_stream_request_test.cc @@ -67,8 +67,6 @@ class NaviStartStreamRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { public: NaviStartStreamRequestTest() { - ON_CALL(app_mngr_, hmi_interfaces()) - .WillByDefault(ReturnRef(mock_hmi_interfaces_)); ON_CALL(app_mngr_settings_, start_stream_retry_amount()) .WillByDefault(ReturnRef(start_stream_retry_amount_)); msg_ = CreateMessage(); @@ -78,7 +76,6 @@ class NaviStartStreamRequestTest std::pair<uint32_t, int32_t> start_stream_retry_amount_; MessageSharedPtr msg_; SharedPtr<NaviStartStreamRequest> command_; - MOCK(am::MockHmiInterfaces) mock_hmi_interfaces_; }; TEST_F(NaviStartStreamRequestTest, Run_HmiInterfaceNotAvailable_NoRequest) { diff --git a/src/components/application_manager/test/commands/hmi/navi_stop_stream_requests_test.cc b/src/components/application_manager/test/commands/hmi/navi_stop_stream_requests_test.cc index 91b781c1ff..18f82cd645 100644 --- a/src/components/application_manager/test/commands/hmi/navi_stop_stream_requests_test.cc +++ b/src/components/application_manager/test/commands/hmi/navi_stop_stream_requests_test.cc @@ -73,7 +73,6 @@ class NaviStopStreamRequestsTest MessageSharedPtr msg_; SharedPtr<Command> command_; - MOCK(am::MockHmiInterfaces) mock_hmi_interfaces_; }; typedef testing::Types<commands::AudioStopStreamRequest, diff --git a/src/components/application_manager/test/commands/hmi/rc_get_capabilities_response_test.cc b/src/components/application_manager/test/commands/hmi/rc_get_capabilities_response_test.cc new file mode 100644 index 0000000000..f851bd644a --- /dev/null +++ b/src/components/application_manager/test/commands/hmi/rc_get_capabilities_response_test.cc @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2016, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include <stdint.h> + +#include "gtest/gtest.h" +#include "utils/shared_ptr.h" +#include "smart_objects/smart_object.h" +#include "interfaces/MOBILE_API.h" +#include "application_manager/mock_hmi_capabilities.h" +#include "application_manager/smart_object_keys.h" +#include "application_manager/commands/commands_test.h" +#include "application_manager/commands/command_impl.h" +#include "application_manager/commands/hmi/rc_get_capabilities_response.h" + +namespace test { +namespace components { +namespace commands_test { +namespace hmi_commands_test { +namespace rc_get_capabilities_response { + +using ::utils::SharedPtr; +using ::testing::NiceMock; +namespace am = ::application_manager; +namespace strings = am::strings; +namespace hmi_response = am::hmi_response; +using am::commands::RCGetCapabilitiesResponse; +using am::commands::CommandImpl; + +typedef SharedPtr<RCGetCapabilitiesResponse> RCGetCapabilitiesResponsePtr; +typedef NiceMock< + ::test::components::application_manager_test::MockHMICapabilities> + MockHMICapabilities; + +namespace { +const uint32_t kConnectionKey = 2u; +} // namespace + +class RCGetCapabilitiesResponseTest + : public CommandsTest<CommandsTestMocks::kIsNice> { + public: + MessageSharedPtr CreateCommandMsg() { + MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map)); + (*command_msg)[strings::msg_params][strings::number] = "123"; + (*command_msg)[strings::params][strings::connection_key] = kConnectionKey; + (*command_msg)[strings::params][hmi_response::code] = + hmi_apis::Common_Result::SUCCESS; + (*command_msg)[strings::msg_params][strings::rc_capability] = + (capabilities_); + + return command_msg; + } + + MockHMICapabilities mock_hmi_capabilities_; + SmartObject capabilities_; +}; + +TEST_F(RCGetCapabilitiesResponseTest, RUN_SUCCESSS) { + MessageSharedPtr command_msg = CreateCommandMsg(); + + RCGetCapabilitiesResponsePtr command( + CreateCommand<RCGetCapabilitiesResponse>(command_msg)); + + EXPECT_CALL(app_mngr_, hmi_capabilities()) + .WillOnce(ReturnRef(mock_hmi_capabilities_)); + + smart_objects::SmartObject rc_capability_so = + (*command_msg)[strings::msg_params][strings::rc_capability]; + + EXPECT_CALL(mock_hmi_capabilities_, set_rc_capability(rc_capability_so)); + + command->Run(); +} + +} // namespace rc_get_capabilities_response +} // namespace hmi_commands_test +} // namespace commands_test +} // namespace components +} // namespace test diff --git a/src/components/application_manager/test/commands/hmi/rc_is_ready_request_test.cc b/src/components/application_manager/test/commands/hmi/rc_is_ready_request_test.cc new file mode 100644 index 0000000000..af54321ca7 --- /dev/null +++ b/src/components/application_manager/test/commands/hmi/rc_is_ready_request_test.cc @@ -0,0 +1,172 @@ +/* + * Copyright (c) 2016, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "application_manager/commands/hmi/rc_is_ready_request.h" + +#include "gtest/gtest.h" +#include "utils/shared_ptr.h" +#include "smart_objects/smart_object.h" +#include "application_manager/smart_object_keys.h" +#include "application_manager/commands/command_request_test.h" +#include "application_manager/mock_application_manager.h" +#include "application_manager/hmi_interfaces.h" +#include "application_manager/mock_hmi_interface.h" +#include "application_manager/mock_hmi_capabilities.h" +#include "application_manager/mock_message_helper.h" +#include "application_manager/event_engine/event.h" + +namespace test { +namespace components { +namespace commands_test { +namespace hmi_commands_test { +namespace rc_is_ready_request { + +using ::testing::_; +using ::testing::ReturnRef; +namespace am = ::application_manager; +using am::commands::MessageSharedPtr; +using am::commands::RCIsReadyRequest; +using am::MockMessageHelper; +using am::event_engine::Event; + +typedef SharedPtr<RCIsReadyRequest> RCIsReadyRequestPtr; + +class RCIsReadyRequestTest + : public CommandRequestTest<CommandsTestMocks::kIsNice> { + public: + RCIsReadyRequestTest() : command_(CreateCommand<RCIsReadyRequest>()) {} + + void SetUpExpectations(bool is_rc_cooperating_available, + bool is_send_message_to_hmi, + bool is_message_contain_param, + am::HmiInterfaces::InterfaceState state) { + if (is_send_message_to_hmi) { + EXPECT_CALL(app_mngr_, hmi_capabilities()) + .WillRepeatedly(ReturnRef(mock_hmi_capabilities_)); + ExpectSendMessagesToHMI(); + } else { + EXPECT_CALL(app_mngr_, hmi_capabilities()) + .WillOnce(ReturnRef(mock_hmi_capabilities_)); + } + EXPECT_CALL(mock_hmi_capabilities_, + set_is_rc_cooperating(is_rc_cooperating_available)); + + if (is_message_contain_param) { + EXPECT_CALL(app_mngr_, hmi_interfaces()) + .WillRepeatedly(ReturnRef(mock_hmi_interfaces_)); + EXPECT_CALL( + mock_hmi_interfaces_, + SetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_RC, state)); + } else { + EXPECT_CALL(app_mngr_, hmi_interfaces()) + .WillOnce(ReturnRef(mock_hmi_interfaces_)); + EXPECT_CALL(mock_hmi_interfaces_, SetInterfaceState(_, _)).Times(0); + } + EXPECT_CALL(mock_hmi_interfaces_, + GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_RC)) + .WillOnce(Return(state)); + } + + void ExpectSendMessagesToHMI() { + smart_objects::SmartObjectSPtr capabilities( + new smart_objects::SmartObject(smart_objects::SmartType_Map)); + EXPECT_CALL(*(MockMessageHelper::message_helper_mock()), + CreateModuleInfoSO(hmi_apis::FunctionID::RC_GetCapabilities, _)) + .WillOnce(Return(capabilities)); + EXPECT_CALL(app_mngr_, ManageHMICommand(capabilities)); + } + + void PrepareEvent(bool is_message_contain_param, + Event& event, + bool is_rc_cooperating_available = false) { + MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map); + if (is_message_contain_param) { + (*msg)[am::strings::msg_params][am::strings::available] = + is_rc_cooperating_available; + } + event.set_smart_object(*msg); + } + + RCIsReadyRequestPtr command_; + am::MockHmiInterfaces mock_hmi_interfaces_; + application_manager_test::MockHMICapabilities mock_hmi_capabilities_; +}; + +TEST_F(RCIsReadyRequestTest, Run_NoKeyAvailableInMessage_HmiInterfacesIgnored) { + const bool is_rc_cooperating_available = false; + const bool is_send_message_to_hmi = true; + const bool is_message_contain_param = false; + Event event(hmi_apis::FunctionID::RC_IsReady); + PrepareEvent(is_message_contain_param, event); + SetUpExpectations(is_rc_cooperating_available, + is_send_message_to_hmi, + is_message_contain_param, + am::HmiInterfaces::STATE_NOT_RESPONSE); + command_->on_event(event); +} + +TEST_F(RCIsReadyRequestTest, Run_KeyAvailableEqualToFalse_StateNotAvailable) { + const bool is_rc_cooperating_available = false; + const bool is_send_message_to_hmi = false; + const bool is_message_contain_param = true; + Event event(hmi_apis::FunctionID::RC_IsReady); + PrepareEvent(is_message_contain_param, event); + SetUpExpectations(is_rc_cooperating_available, + is_send_message_to_hmi, + is_message_contain_param, + am::HmiInterfaces::STATE_NOT_AVAILABLE); + command_->on_event(event); +} + +TEST_F(RCIsReadyRequestTest, Run_KeyAvailableEqualToTrue_StateAvailable) { + const bool is_rc_cooperating_available = true; + const bool is_send_message_to_hmi = true; + const bool is_message_contain_param = true; + Event event(hmi_apis::FunctionID::RC_IsReady); + PrepareEvent(is_message_contain_param, event, is_rc_cooperating_available); + SetUpExpectations(is_rc_cooperating_available, + is_send_message_to_hmi, + is_message_contain_param, + am::HmiInterfaces::STATE_AVAILABLE); + command_->on_event(event); +} + +TEST_F(RCIsReadyRequestTest, Run_HMIDoestRespond_SendMessageToHMIByTimeout) { + ExpectSendMessagesToHMI(); + command_->onTimeOut(); +} + +} // namespace rc_is_ready_request +} // namespace hmi_commands_test +} // namespace commands_test +} // namespace components +} // namespace test diff --git a/src/components/application_manager/test/commands/hmi/rc_is_ready_response_test.cc b/src/components/application_manager/test/commands/hmi/rc_is_ready_response_test.cc new file mode 100644 index 0000000000..157dff6216 --- /dev/null +++ b/src/components/application_manager/test/commands/hmi/rc_is_ready_response_test.cc @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2016, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include <stdint.h> +#include <string> + +#include "gtest/gtest.h" +#include "utils/shared_ptr.h" +#include "smart_objects/smart_object.h" +#include "commands/commands_test.h" +#include "application_manager/mock_hmi_capabilities.h" +#include "application_manager/commands/hmi/rc_is_ready_response.h" +#include "application_manager/mock_event_dispatcher.h" + +namespace test { +namespace components { +namespace commands_test { +namespace hmi_commands_test { +namespace rc_is_ready_response { + +using ::testing::Return; +using ::utils::SharedPtr; +using ::testing::NiceMock; +namespace am = ::application_manager; +namespace strings = ::application_manager::strings; +namespace hmi_response = am::hmi_response; +using am::commands::RCIsReadyResponse; +using test::components::event_engine_test::MockEventDispatcher; + +typedef SharedPtr<RCIsReadyResponse> RCIsReadyResponsePtr; + +class RCIsReadyResponseTest : public CommandsTest<CommandsTestMocks::kIsNice> { +}; + +TEST_F(RCIsReadyResponseTest, RUN_SUCCESS) { + RCIsReadyResponsePtr command(CreateCommand<RCIsReadyResponse>()); + + MockEventDispatcher mock_event_dispatcher; + EXPECT_CALL(app_mngr_, event_dispatcher()) + .WillOnce(ReturnRef(mock_event_dispatcher)); + EXPECT_CALL(mock_event_dispatcher, raise_event(_)); + + command->Run(); +} + +} // namespace rc_is_ready_response +} // namespace hmi_commands_test +} // namespace commands_test +} // namespace components +} // namespace test diff --git a/src/components/application_manager/test/commands/hmi/sdl_activate_app_request_test.cc b/src/components/application_manager/test/commands/hmi/sdl_activate_app_request_test.cc index eeae0422d1..3805df5834 100644 --- a/src/components/application_manager/test/commands/hmi/sdl_activate_app_request_test.cc +++ b/src/components/application_manager/test/commands/hmi/sdl_activate_app_request_test.cc @@ -209,9 +209,11 @@ TEST_F(SDLActivateAppRequestTest, FindAppToRegister_SUCCESS) { ON_CALL(*mock_app_first, device()).WillByDefault(Return(kHandle)); EXPECT_CALL(*mock_app_first, is_foreground()).WillOnce(Return(false)); ON_CALL(*mock_app_first, protocol_version()) - .WillByDefault(Return(am::ProtocolVersion::kV4)); + .WillByDefault( + Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5)); ON_CALL(*mock_app, protocol_version()) - .WillByDefault(Return(am::ProtocolVersion::kV4)); + .WillByDefault( + Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5)); const std::string url = "url"; ON_CALL(*mock_app_first, SchemaUrl()).WillByDefault(Return(url)); @@ -291,7 +293,8 @@ TEST_F(SDLActivateAppRequestTest, FirstAppActive_SUCCESS) { app_list_.insert(mock_app_first); ON_CALL(*mock_app_first, protocol_version()) - .WillByDefault(Return(am::ProtocolVersion::kV4)); + .WillByDefault( + Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5)); ON_CALL(*mock_app_first, device()).WillByDefault(Return(kHandle)); EXPECT_CALL(*mock_app_first, is_foreground()).WillRepeatedly(Return(true)); @@ -355,7 +358,8 @@ TEST_F(SDLActivateAppRequestTest, FirstAppIsForeground_SUCCESS) { DataAccessor<ApplicationSet> accessor(app_list_, lock_); EXPECT_CALL(app_mngr_, applications()).WillRepeatedly(Return(accessor)); ON_CALL(*mock_app_first, protocol_version()) - .WillByDefault(Return(am::ProtocolVersion::kV4)); + .WillByDefault( + Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5)); ON_CALL(*mock_app_first, device()).WillByDefault(Return(kHandle)); EXPECT_CALL(*mock_app_first, is_foreground()).WillOnce(Return(true)); @@ -389,7 +393,8 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotRegisteredAndEmpty_SUCCESS) { DataAccessor<ApplicationSet> accessor(app_list_, lock_); EXPECT_CALL(app_mngr_, applications()).WillRepeatedly(Return(accessor)); ON_CALL(*mock_app_first, protocol_version()) - .WillByDefault(Return(am::ProtocolVersion::kV4)); + .WillByDefault( + Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5)); EXPECT_CALL(*mock_app_first, is_foreground()).WillOnce(Return(false)); EXPECT_CALL(*message_helper_mock_, SendLaunchApp(_, _, _, _)); @@ -423,7 +428,8 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotRegistered_SUCCESS) { app_list_.insert(mock_app_first); ON_CALL(*mock_app_first, protocol_version()) - .WillByDefault(Return(am::ProtocolVersion::kV4)); + .WillByDefault( + Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5)); EXPECT_CALL(*mock_app_first, is_foreground()).WillRepeatedly(Return(true)); EXPECT_CALL(*message_helper_mock_, SendLaunchApp(_, _, _, _)); diff --git a/src/components/application_manager/test/commands/hmi/simple_requests_to_hmi_test.cc b/src/components/application_manager/test/commands/hmi/simple_requests_to_hmi_test.cc index f444e45a6c..3fa3aaef3a 100644 --- a/src/components/application_manager/test/commands/hmi/simple_requests_to_hmi_test.cc +++ b/src/components/application_manager/test/commands/hmi/simple_requests_to_hmi_test.cc @@ -2,6 +2,9 @@ * Copyright (c) 2016, Ford Motor Company * All rights reserved. * + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -13,7 +16,7 @@ * disclaimer in the documentation and/or other materials provided with the * distribution. * - * Neither the name of the Ford Motor Company nor the names of its contributors + * Neither the name of the copyright holders nor the names of their contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -114,6 +117,7 @@ #include "application_manager/commands/hmi/sdl_policy_update.h" #include "application_manager/commands/hmi/ui_set_icon_request.h" #include "application_manager/commands/hmi/dial_number_request.h" +#include "application_manager/commands/hmi/ui_send_haptic_data_request.h" #include "application_manager/test/include/application_manager/mock_event_dispatcher.h" @@ -217,7 +221,8 @@ typedef Types<am_commands::VIGetVehicleTypeRequest, am_commands::NaviAlertManeuverRequest, am_commands::AudioStopStreamRequest, am_commands::NaviGetWayPointsRequest, - am_commands::UISetGlobalPropertiesRequest> RequestCommandsList; + am_commands::UISetGlobalPropertiesRequest, + am_commands::UISendHapticDataRequest> RequestCommandsList; typedef Types<am_commands::UIScrollableMessageRequest, am_commands::VRGetCapabilitiesRequest, diff --git a/src/components/application_manager/test/commands/hmi/simple_response_from_hmi_test.cc b/src/components/application_manager/test/commands/hmi/simple_response_from_hmi_test.cc index 7e55b8b834..f55b2e5835 100644 --- a/src/components/application_manager/test/commands/hmi/simple_response_from_hmi_test.cc +++ b/src/components/application_manager/test/commands/hmi/simple_response_from_hmi_test.cc @@ -2,6 +2,9 @@ * Copyright (c) 2016, Ford Motor Company * All rights reserved. * + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -13,7 +16,7 @@ * disclaimer in the documentation and/or other materials provided with the * distribution. * - * Neither the name of the Ford Motor Company nor the names of its contributors + * Neither the name of the copyright holders nor the names of their contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -102,6 +105,7 @@ #include "hmi/update_app_list_response.h" #include "hmi/update_device_list_response.h" #include "hmi/notification_from_hmi.h" +#include "hmi/ui_send_haptic_data_response.h" namespace test { namespace components { @@ -232,8 +236,9 @@ typedef Types< CommandData<commands::VRPerformInteractionResponse, hmi_apis::FunctionID::VR_PerformInteraction>, CommandData<commands::UIScrollableMessageResponse, - hmi_apis::FunctionID::UI_ScrollableMessage> > - ResponseCommandsList; + hmi_apis::FunctionID::UI_ScrollableMessage>, + CommandData<commands::UISendHapticDataResponse, + hmi_apis::FunctionID::UI_SendHapticData> > ResponseCommandsList; typedef Types<commands::AudioStopStreamResponse, commands::NaviStopStreamResponse, diff --git a/src/components/application_manager/test/commands/hmi/ui_get_capabilities_response_test.cc b/src/components/application_manager/test/commands/hmi/ui_get_capabilities_response_test.cc index 11162f9a03..b02c9851ee 100644 --- a/src/components/application_manager/test/commands/hmi/ui_get_capabilities_response_test.cc +++ b/src/components/application_manager/test/commands/hmi/ui_get_capabilities_response_test.cc @@ -2,6 +2,9 @@ * Copyright (c) 2016, Ford Motor Company * All rights reserved. * + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -13,7 +16,7 @@ * disclaimer in the documentation and/or other materials provided with the * distribution. * - * Neither the name of the Ford Motor Company nor the names of its contributors + * Neither the name of the copyright holders nor the names of their contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -216,6 +219,126 @@ TEST_F(UIGetCapabilitiesResponseTest, SetPhoneCall_SUCCESS) { command->Run(); } +TEST_F(UIGetCapabilitiesResponseTest, SetVideoStreaming_SUCCESS) { + MessageSharedPtr command_msg = CreateCommandMsg(); + (*command_msg)[strings::msg_params][strings::hmi_capabilities] = + smart_objects::SmartObject(smart_objects::SmartType_Map); + (*command_msg)[strings::msg_params][strings::hmi_capabilities] + [strings::video_streaming] = true; + + ResponseFromHMIPtr command( + CreateCommand<UIGetCapabilitiesResponse>(command_msg)); + + EXPECT_CALL(app_mngr_, hmi_capabilities()) + .WillOnce(ReturnRef(mock_hmi_capabilities_)); + + smart_objects::SmartObject hmi_capabilities_so = + (*command_msg)[strings::msg_params][strings::hmi_capabilities]; + EXPECT_CALL(mock_hmi_capabilities_, + set_video_streaming_supported( + hmi_capabilities_so[strings::video_streaming].asBool())); + + command->Run(); +} + +TEST_F(UIGetCapabilitiesResponseTest, SetNavigationCapability_SUCCESS) { + MessageSharedPtr command_msg = CreateCommandMsg(); + (*command_msg)[strings::msg_params][strings::system_capabilities] = + smart_objects::SmartObject(smart_objects::SmartType_Map); + + (*command_msg)[strings::msg_params][strings::system_capabilities] + [strings::navigation_capability]["sendLocationEnabled"] = true; + + (*command_msg)[strings::msg_params][strings::system_capabilities] + [strings::navigation_capability]["getWayPointsEnabled"] = true; + + ResponseFromHMIPtr command( + CreateCommand<UIGetCapabilitiesResponse>(command_msg)); + + EXPECT_CALL(app_mngr_, hmi_capabilities()) + .WillOnce(ReturnRef(mock_hmi_capabilities_)); + + smart_objects::SmartObject navigation_capability_so = + (*command_msg)[strings::msg_params][strings::system_capabilities] + [strings::navigation_capability]; + + EXPECT_CALL(mock_hmi_capabilities_, + set_navigation_capability(navigation_capability_so)); + + command->Run(); +} + +TEST_F(UIGetCapabilitiesResponseTest, SetPhonenCapability_SUCCESS) { + MessageSharedPtr command_msg = CreateCommandMsg(); + (*command_msg)[strings::msg_params][strings::system_capabilities] = + smart_objects::SmartObject(smart_objects::SmartType_Map); + + (*command_msg)[strings::msg_params][strings::system_capabilities] + [strings::phone_capability]["dialNumberEnabled"] = true; + + ResponseFromHMIPtr command( + CreateCommand<UIGetCapabilitiesResponse>(command_msg)); + + EXPECT_CALL(app_mngr_, hmi_capabilities()) + .WillOnce(ReturnRef(mock_hmi_capabilities_)); + + smart_objects::SmartObject phone_capability_so = + (*command_msg)[strings::msg_params][strings::system_capabilities] + [strings::phone_capability]; + + EXPECT_CALL(mock_hmi_capabilities_, + set_phone_capability(phone_capability_so)); + + command->Run(); +} + +TEST_F(UIGetCapabilitiesResponseTest, SetVideoStreamingCapability_SUCCESS) { + MessageSharedPtr command_msg = CreateCommandMsg(); + (*command_msg)[strings::msg_params][strings::system_capabilities] = + smart_objects::SmartObject(smart_objects::SmartType_Map); + + (*command_msg)[strings::msg_params][strings::system_capabilities] + [strings::video_streaming_capability] = + smart_objects::SmartObject(smart_objects::SmartType_Map); + smart_objects::SmartObject& video_streaming_capability = + (*command_msg)[strings::msg_params][strings::system_capabilities] + [strings::video_streaming_capability]; + + video_streaming_capability[strings::preferred_resolution] = + smart_objects::SmartObject(smart_objects::SmartType_Map); + video_streaming_capability[strings::preferred_resolution] + [strings::resolution_width] = 800; + video_streaming_capability[strings::preferred_resolution] + [strings::resolution_height] = 350; + + video_streaming_capability[strings::max_bitrate] = 10000; + + video_streaming_capability[strings::supported_formats] = + smart_objects::SmartObject(smart_objects::SmartType_Array); + + video_streaming_capability[strings::supported_formats][0] = + smart_objects::SmartObject(smart_objects::SmartType_Map); + + video_streaming_capability[strings::supported_formats][0][strings::protocol] = + hmi_apis::Common_VideoStreamingProtocol::RAW; + + video_streaming_capability[strings::supported_formats][0][strings::codec] = + hmi_apis::Common_VideoStreamingCodec::H264; + + video_streaming_capability[strings::haptic_spatial_data_supported] = true; + + ResponseFromHMIPtr command( + CreateCommand<UIGetCapabilitiesResponse>(command_msg)); + + EXPECT_CALL(app_mngr_, hmi_capabilities()) + .WillOnce(ReturnRef(mock_hmi_capabilities_)); + + EXPECT_CALL(mock_hmi_capabilities_, + set_video_streaming_capability(video_streaming_capability)); + + command->Run(); +} + } // namespace ui_get_capabilities_response } // namespace hmi_commands_test } // namespace commands_test diff --git a/src/components/application_manager/test/commands/hmi/ui_is_ready_request_test.cc b/src/components/application_manager/test/commands/hmi/ui_is_ready_request_test.cc index 2759a8a19e..23146eec9a 100644 --- a/src/components/application_manager/test/commands/hmi/ui_is_ready_request_test.cc +++ b/src/components/application_manager/test/commands/hmi/ui_is_ready_request_test.cc @@ -151,7 +151,6 @@ class UIIsReadyRequestTest } UIIsReadyRequestPtr command_; - am::MockHmiInterfaces mock_hmi_interfaces_; MockMessageHelper& mock_message_helper_; application_manager_test::MockHMICapabilities mock_hmi_capabilities_; policy_test::MockPolicyHandlerInterface mock_policy_handler_interface_; diff --git a/src/components/application_manager/test/commands/hmi/vi_is_ready_request_test.cc b/src/components/application_manager/test/commands/hmi/vi_is_ready_request_test.cc index 48293f9a12..1e15d4ab60 100644 --- a/src/components/application_manager/test/commands/hmi/vi_is_ready_request_test.cc +++ b/src/components/application_manager/test/commands/hmi/vi_is_ready_request_test.cc @@ -121,7 +121,6 @@ class VIIsReadyRequestTest } VIIsReadyRequestPtr command_; - am::MockHmiInterfaces mock_hmi_interfaces_; application_manager_test::MockHMICapabilities mock_hmi_capabilities_; policy_test::MockPolicyHandlerInterface mock_policy_handler_interface_; }; diff --git a/src/components/application_manager/test/commands/hmi/vr_is_ready_request_test.cc b/src/components/application_manager/test/commands/hmi/vr_is_ready_request_test.cc index 64e5c25546..64735a77e2 100644 --- a/src/components/application_manager/test/commands/hmi/vr_is_ready_request_test.cc +++ b/src/components/application_manager/test/commands/hmi/vr_is_ready_request_test.cc @@ -139,7 +139,6 @@ class VRIsReadyRequestTest } VRIsReadyRequestPtr command_; - am::MockHmiInterfaces mock_hmi_interfaces_; application_manager_test::MockHMICapabilities mock_hmi_capabilities_; }; diff --git a/src/components/application_manager/test/commands/mobile/add_command_request_test.cc b/src/components/application_manager/test/commands/mobile/add_command_request_test.cc index 567c3d32f9..dec0ffe7ad 100644 --- a/src/components/application_manager/test/commands/mobile/add_command_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/add_command_request_test.cc @@ -62,7 +62,6 @@ using am::ApplicationManager; using am::commands::MessageSharedPtr; using am::ApplicationSharedPtr; using am::MockMessageHelper; -using am::MockHmiInterfaces; using ::testing::_; using ::utils::SharedPtr; using ::testing::Return; @@ -520,7 +519,6 @@ TEST_F(AddCommandRequestTest, OnEvent_UI_SUCCESS) { EXPECT_CALL(mock_message_helper_, HMIToMobileResult(hmi_apis::Common_Result::SUCCESS)) .WillOnce(Return(mobile_apis::Result::SUCCESS)); - EXPECT_CALL(*mock_app_, UpdateHash()); request_ptr->on_event(event); } @@ -541,7 +539,6 @@ TEST_F(AddCommandRequestTest, OnEvent_VR_SUCCESS) { EXPECT_CALL(*mock_app_, commands_map()) .WillRepeatedly( Return(DataAccessor<am::CommandsMap>(commands_map, lock_))); - EXPECT_CALL(*mock_app_, UpdateHash()); EXPECT_CALL( app_mngr_, ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) @@ -668,7 +665,6 @@ TEST_F(AddCommandRequestTest, event_ui.set_smart_object(*msg_); Event event_vr(hmi_apis::FunctionID::VR_AddCommand); event_vr.set_smart_object(*msg_); - EXPECT_CALL(*mock_app_, UpdateHash()); request_ptr->on_event(event_ui); request_ptr->on_event(event_vr); } diff --git a/src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc b/src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc index 95bcede5fa..9617f91016 100644 --- a/src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc @@ -54,7 +54,6 @@ namespace am = ::application_manager; using am::commands::AddSubMenuRequest; using am::commands::MessageSharedPtr; using am::event_engine::Event; -using am::MockHmiInterfaces; using am::MockMessageHelper; using ::testing::_; using ::testing::Mock; @@ -98,12 +97,6 @@ TEST_F(AddSubMenuRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) { Event event(hmi_apis::FunctionID::UI_AddSubMenu); event.set_smart_object(*ev_msg); - MockHmiInterfaces hmi_interfaces; - ON_CALL(app_mngr_, hmi_interfaces()).WillByDefault(ReturnRef(hmi_interfaces)); - EXPECT_CALL(hmi_interfaces, - GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) - .WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE)) .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE)); @@ -113,7 +106,7 @@ TEST_F(AddSubMenuRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) { app_mngr_, ManageMobileCommand(_, am::commands::Command::CommandOrigin::ORIGIN_SDL)) .WillOnce(DoAll(SaveArg<0>(&ui_command_result), Return(true))); - + command->Init(); command->on_event(event); EXPECT_EQ((*ui_command_result)[am::strings::msg_params][am::strings::success] diff --git a/src/components/application_manager/test/commands/mobile/alert_maneuver_request_test.cc b/src/components/application_manager/test/commands/mobile/alert_maneuver_request_test.cc index a835239a90..ee0662e5c6 100644 --- a/src/components/application_manager/test/commands/mobile/alert_maneuver_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/alert_maneuver_request_test.cc @@ -63,7 +63,6 @@ namespace am = ::application_manager; using am::commands::AlertManeuverRequest; using am::commands::MessageSharedPtr; using am::event_engine::Event; -using am::MockHmiInterfaces; using am::MockMessageHelper; typedef SharedPtr<AlertManeuverRequest> CommandPtr; @@ -93,10 +92,7 @@ class AlertManeuverRequestTest EXPECT_CALL(*mock_message_helper, HMIToMobileResult(_)) .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE)); - MockHmiInterfaces hmi_interfaces; - EXPECT_CALL(app_mngr_, hmi_interfaces()) - .WillRepeatedly(ReturnRef(hmi_interfaces)); - EXPECT_CALL(hmi_interfaces, GetInterfaceState(_)) + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillRepeatedly(Return(state)); MessageSharedPtr response_to_mobile; @@ -213,13 +209,10 @@ TEST_F(AlertManeuverRequestTest, Run_ProcessingResult_SUCCESS) { ProcessSoftButtons(_, _, _, _)) .WillOnce(Return(mobile_apis::Result::SUCCESS)); - MockHmiInterfaces hmi_interfaces; - EXPECT_CALL(app_mngr_, hmi_interfaces()) - .WillRepeatedly(ReturnRef(hmi_interfaces)); - EXPECT_CALL(hmi_interfaces, GetInterfaceFromFunction(_)) + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_)) .WillRepeatedly( Return(am::HmiInterfaces::InterfaceID::HMI_INTERFACE_TTS)); - EXPECT_CALL(hmi_interfaces, GetInterfaceState(_)) + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE)); EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), diff --git a/src/components/application_manager/test/commands/mobile/alert_request_test.cc b/src/components/application_manager/test/commands/mobile/alert_request_test.cc index 43151c2d98..f83a40843c 100644 --- a/src/components/application_manager/test/commands/mobile/alert_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/alert_request_test.cc @@ -56,7 +56,6 @@ using am::commands::AlertRequest; using am::commands::CommandImpl; using am::commands::MessageSharedPtr; using am::MockMessageHelper; -using am::MockHmiInterfaces; using ::utils::SharedPtr; using am::event_engine::Event; using policy_test::MockPolicyHandlerInterface; @@ -125,15 +124,13 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { ON_CALL(app_mngr_, application(kConnectionKey)) .WillByDefault(Return(mock_app_)); ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey)); - ON_CALL(app_mngr_, hmi_interfaces()) - .WillByDefault(ReturnRef(hmi_interfaces_)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault( Return(am::HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS)) .WillByDefault( Return(am::HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE)); @@ -199,7 +196,6 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { MockAppPtr mock_app_; MessageSharedPtr msg_; MockPolicyHandlerInterface mock_policy_handler_; - NiceMock<MockHmiInterfaces> hmi_interfaces_; }; TEST_F(AlertRequestTest, OnTimeout_GENERIC_ERROR) { @@ -267,6 +263,9 @@ TEST_F(AlertRequestTest, OnEvent_UI_HmiSendSuccess_UNSUPPORTED_RESOURCE) { event.set_smart_object(*msg); MessageSharedPtr ui_command_result; + ON_CALL(mock_message_helper_, + HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE)) + .WillByDefault(Return(am::mobile_api::Result::UNSUPPORTED_RESOURCE)); EXPECT_CALL( app_mngr_, ManageMobileCommand(_, am::commands::Command::CommandOrigin::ORIGIN_SDL)) diff --git a/src/components/application_manager/test/commands/mobile/change_registration_test.cc b/src/components/application_manager/test/commands/mobile/change_registration_test.cc index 0c76a08fe9..2fd43a6353 100644 --- a/src/components/application_manager/test/commands/mobile/change_registration_test.cc +++ b/src/components/application_manager/test/commands/mobile/change_registration_test.cc @@ -65,7 +65,6 @@ using am::ApplicationManager; using am::commands::MessageSharedPtr; using am::ApplicationSharedPtr; using am::MockMessageHelper; -using am::MockHmiInterfaces; using ::testing::_; using ::testing::Mock; using ::utils::SharedPtr; @@ -118,28 +117,28 @@ class ChangeRegistrationRequestTest .WillOnce(Return(supported_languages_.get())); EXPECT_CALL(app_mngr_, hmi_interfaces()) - .WillRepeatedly(ReturnRef(hmi_interfaces_)); + .WillRepeatedly(ReturnRef(mock_hmi_interfaces_)); EXPECT_CALL( - hmi_interfaces_, + mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::UI_ChangeRegistration)) .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); - EXPECT_CALL(hmi_interfaces_, + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE)); EXPECT_CALL( - hmi_interfaces_, + mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::VR_ChangeRegistration)) .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_VR)); - EXPECT_CALL(hmi_interfaces_, + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR)) .WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE)); EXPECT_CALL( - hmi_interfaces_, + mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_ChangeRegistration)) .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_TTS)); - EXPECT_CALL(hmi_interfaces_, + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS)) .WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE)); } @@ -185,10 +184,7 @@ class ChangeRegistrationRequestTest (*tts_response)[strings::params][hmi_response::code] = hmi_response; (*tts_response)[strings::msg_params] = 0; - MockHmiInterfaces hmi_interfaces; - EXPECT_CALL(app_mngr_, hmi_interfaces()) - .WillRepeatedly(ReturnRef(hmi_interfaces)); - EXPECT_CALL(hmi_interfaces, GetInterfaceState(_)) + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillRepeatedly(Return(state)); am::event_engine::Event event_ui( @@ -251,8 +247,6 @@ class ChangeRegistrationRequestTest ON_CALL(app_mngr_, application(kConnectionKey)) .WillByDefault(Return(mock_app_)); ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey)); - ON_CALL(app_mngr_, hmi_interfaces()) - .WillByDefault(ReturnRef(hmi_interfaces_)); ON_CALL(app_mngr_, hmi_capabilities()) .WillByDefault(ReturnRef(hmi_capabilities_)); } @@ -288,7 +282,6 @@ class ChangeRegistrationRequestTest MockHMICapabilities; sync_primitives::Lock app_set_lock_; MockHMICapabilities hmi_capabilities_; - NiceMock<MockHmiInterfaces> hmi_interfaces_; MockMessageHelper& mock_message_helper_; MockAppPtr mock_app_; MessageSharedPtr supported_languages_; @@ -322,25 +315,25 @@ TEST_F(ChangeRegistrationRequestTest, ExpectationsHmiCapabilities(supported_languages); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::UI_ChangeRegistration)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::VR_ChangeRegistration)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_VR)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_RESPONSE)); ON_CALL( - hmi_interfaces_, + mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_ChangeRegistration)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_TTS)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); command->Run(); @@ -367,10 +360,7 @@ TEST_F(ChangeRegistrationRequestTest, hmi_apis::FunctionID::TTS_ChangeRegistration); event_tts.set_smart_object(*tts_response); - MockHmiInterfaces hmi_interfaces; - EXPECT_CALL(app_mngr_, hmi_interfaces()) - .WillRepeatedly(ReturnRef(hmi_interfaces)); - EXPECT_CALL(hmi_interfaces, GetInterfaceState(_)) + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); MessageSharedPtr response_to_mobile; @@ -478,25 +468,25 @@ TEST_F(ChangeRegistrationRequestTest, ExpectationsHmiCapabilities(supported_languages); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::UI_ChangeRegistration)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::VR_ChangeRegistration)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_VR)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); ON_CALL( - hmi_interfaces_, + mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_ChangeRegistration)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_TTS)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); diff --git a/src/components/application_manager/test/commands/mobile/create_interaction_choice_set_test.cc b/src/components/application_manager/test/commands/mobile/create_interaction_choice_set_test.cc index a0b0dc32ff..a627740588 100644 --- a/src/components/application_manager/test/commands/mobile/create_interaction_choice_set_test.cc +++ b/src/components/application_manager/test/commands/mobile/create_interaction_choice_set_test.cc @@ -64,7 +64,6 @@ using am::ApplicationManager; using am::commands::MessageSharedPtr; using am::ApplicationSharedPtr; using am::MockMessageHelper; -using am::MockHmiInterfaces; using ::testing::_; using ::testing::Mock; using ::utils::SharedPtr; @@ -116,7 +115,7 @@ class CreateInteractionChoiceSetRequestTest : message_helper_mock_(*am::MockMessageHelper::message_helper_mock()) , message_(CreateMessage()) , command_(CreateCommand<CreateInteractionChoiceSetRequest>(message_)) - , app_(CreateMockApp()) { + , mock_app_(CreateMockApp()) { Mock::VerifyAndClearExpectations(&message_helper_mock_); } ~CreateInteractionChoiceSetRequestTest() { @@ -166,7 +165,7 @@ class CreateInteractionChoiceSetRequestTest MockMessageHelper& message_helper_mock_; MessageSharedPtr message_; CreateInteractionChoiceSetRequestPtr command_; - MockAppPtr app_; + MockAppPtr mock_app_; sync_primitives::Lock lock_; }; @@ -213,11 +212,10 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_VR_UNSUPPORTED_RESOURCE) { utils::SharedPtr<CreateInteractionChoiceSetRequest> req_vr = CreateCommand<CreateInteractionChoiceSetRequest>(msg_vr); - MockAppPtr mock_app = CreateMockApp(); - ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app)); - ON_CALL(*mock_app, app_id()).WillByDefault(Return(kConnectionKey)); + ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_)); + smart_objects::SmartObject* null_obj = NULL; - ON_CALL(*mock_app, FindChoiceSet(_)).WillByDefault(Return(null_obj)); + ON_CALL(*mock_app_, FindChoiceSet(_)).WillByDefault(Return(null_obj)); MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map); (*msg)[strings::params][hmi_response::code] = @@ -229,25 +227,21 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_VR_UNSUPPORTED_RESOURCE) { event.set_smart_object(*msg); smart_objects::SmartObject* ptr = NULL; - ON_CALL(*mock_app, FindCommand(kCmdId)).WillByDefault(Return(ptr)); + ON_CALL(*mock_app_, FindCommand(kCmdId)).WillByDefault(Return(ptr)); EXPECT_EQ(NULL, ptr); - MockMessageHelper* mock_message_helper = - MockMessageHelper::message_helper_mock(); - ON_CALL(*mock_message_helper, HMIToMobileResult(_)) + ON_CALL(message_helper_mock_, HMIToMobileResult(_)) .WillByDefault(Return(mobile_apis::Result::SUCCESS)); am::CommandsMap commands_map; - ON_CALL(*mock_app, commands_map()) + ON_CALL(*mock_app_, commands_map()) .WillByDefault( Return(DataAccessor<am::CommandsMap>(commands_map, lock_))); - MockHmiInterfaces hmi_interfaces; - ON_CALL(app_mngr_, hmi_interfaces()).WillByDefault(ReturnRef(hmi_interfaces)); - ON_CALL(hmi_interfaces, GetInterfaceFromFunction(_)) + + ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_)) .WillByDefault( Return(am::HmiInterfaces::HMI_INTERFACE_BasicCommunication)); - ON_CALL(hmi_interfaces, GetInterfaceState(_)) - .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); + EXPECT_CALL(app_mngr_, ManageHMICommand(_)).WillOnce(Return(true)); req_vr->Run(); @@ -287,7 +281,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, Run_VerifyImageFail_UNSUCCESS) { (*message_)[am::strings::msg_params][am::strings::choice_set][0] [am::strings::secondary_image] = kSecondImage; - EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_)); + EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_)); EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _)) .WillRepeatedly(Return(mobile_apis::Result::INVALID_DATA)); EXPECT_CALL(app_mngr_, GenerateGrammarID()).Times(0); @@ -303,14 +297,14 @@ TEST_F(CreateInteractionChoiceSetRequestTest, Run_FindChoiceSetFail_UNSUCCESS) { (*message_)[am::strings::msg_params][am::strings::interaction_choice_set_id] = kChoiceSetId; - EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_)); + EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_)); EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _)) .WillRepeatedly(Return(mobile_apis::Result::SUCCESS)); smart_objects::SmartObject* invalid_choice_set_id = &((*message_)[am::strings::msg_params] [am::strings::interaction_choice_set_id]); - EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId)) + EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId)) .WillOnce(Return(invalid_choice_set_id)); EXPECT_CALL(app_mngr_, GenerateGrammarID()).Times(0); command_->Run(); @@ -337,13 +331,13 @@ TEST_F(CreateInteractionChoiceSetRequestTest, (*message_)[am::strings::msg_params][am::strings::choice_set][1] [am::strings::vr_commands][0] = kVrCommands1; - EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_)); + EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_)); EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _)) .WillRepeatedly(Return(mobile_apis::Result::SUCCESS)); smart_objects::SmartObject* choice_set_id = NULL; - EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId)) + EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId)) .WillOnce(Return(choice_set_id)); EXPECT_CALL(app_mngr_, GenerateGrammarID()).Times(0); @@ -372,9 +366,9 @@ TEST_F(CreateInteractionChoiceSetRequestTest, kChoiceSetId; smart_objects::SmartObject* choice_set_id = NULL; - EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId)) + EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId)) .WillRepeatedly(Return(choice_set_id)); - EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_)); + EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app_)); EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _)) .WillRepeatedly(Return(mobile_apis::Result::SUCCESS)); @@ -443,17 +437,17 @@ TEST_F(CreateInteractionChoiceSetRequestTest, Run_ValidAmountVrCommands_SUCCESS) { FillMessageFieldsItem1(message_); FillMessageFieldsItem2(message_); - EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_)); + EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_)); EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _)) .WillRepeatedly(Return(mobile_apis::Result::SUCCESS)); smart_objects::SmartObject* choice_set_id = NULL; - EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId)) + EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId)) .WillOnce(Return(choice_set_id)); EXPECT_CALL(app_mngr_, GenerateGrammarID()).WillOnce(Return(kGrammarId)); - EXPECT_CALL(*app_, AddChoiceSet(kChoiceSetId, _)); + EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _)); EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()) .Times(AtLeast(2)) .WillOnce(Return(kConnectionKey)) @@ -482,16 +476,16 @@ TEST_F(CreateInteractionChoiceSetRequestTest, (*message_)[am::strings::msg_params][am::strings::choice_set][1] [am::strings::vr_commands][0] = kVrCommands2; - EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_)); + EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_)); EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _)) .WillRepeatedly(Return(mobile_apis::Result::SUCCESS)); smart_objects::SmartObject* choice_set_id = NULL; - EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId)) + EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId)) .WillOnce(Return(choice_set_id)); - EXPECT_CALL(*app_, AddChoiceSet(kChoiceSetId, _)); + EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _)); command_->Run(); } @@ -528,17 +522,17 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_ValidVrNoError_SUCCESS) { FillMessageFieldsItem1(message_); FillMessageFieldsItem2(message_); - EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_)); + EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_)); EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _)) .WillRepeatedly(Return(mobile_apis::Result::SUCCESS)); smart_objects::SmartObject* choice_set_id = NULL; - EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId)) + EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId)) .WillOnce(Return(choice_set_id)); EXPECT_CALL(app_mngr_, GenerateGrammarID()).WillOnce(Return(kGrammarId)); - EXPECT_CALL(*app_, AddChoiceSet(kChoiceSetId, _)); + EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _)); ON_CALL(app_mngr_, GetNextHMICorrelationID()) .WillByDefault(Return(kCorrelationId)); command_->Run(); @@ -561,17 +555,17 @@ TEST_F(CreateInteractionChoiceSetRequestTest, FillMessageFieldsItem1(message_); FillMessageFieldsItem2(message_); - EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_)); + EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_)); EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _)) .WillRepeatedly(Return(mobile_apis::Result::SUCCESS)); smart_objects::SmartObject* choice_set_id = NULL; - EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId)) + EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId)) .WillOnce(Return(choice_set_id)); EXPECT_CALL(app_mngr_, GenerateGrammarID()).WillOnce(Return(kGrammarId)); - EXPECT_CALL(*app_, AddChoiceSet(kChoiceSetId, _)); + EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _)); ON_CALL(app_mngr_, GetNextHMICorrelationID()) .WillByDefault(Return(kCorrelationId)); command_->Run(); @@ -595,17 +589,17 @@ TEST_F(CreateInteractionChoiceSetRequestTest, (*message_)[am::strings::msg_params][am::strings::interaction_choice_set_id] = kChoiceSetId; - ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app_)); + ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_)); EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _)) .WillRepeatedly(Return(mobile_apis::Result::SUCCESS)); smart_objects::SmartObject* choice_set_id = NULL; - EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId)) + EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId)) .WillOnce(Return(choice_set_id)); EXPECT_CALL(app_mngr_, GenerateGrammarID()).WillOnce(Return(kGrammarId)); - EXPECT_CALL(*app_, AddChoiceSet(kChoiceSetId, _)); + EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _)); ON_CALL(app_mngr_, GetNextHMICorrelationID()) .WillByDefault(Return(kCorrelationId)); command_->Run(); @@ -620,7 +614,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeOut_InvalidErrorFromHMI_UNSUCCESS) { - EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_)); + EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_)); EXPECT_CALL(app_mngr_, ManageMobileCommand( @@ -642,17 +636,17 @@ TEST_F(CreateInteractionChoiceSetRequestTest, (*message_)[am::strings::msg_params][am::strings::interaction_choice_set_id] = kChoiceSetId; - ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app_)); + ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_)); EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _)) .WillRepeatedly(Return(mobile_apis::Result::SUCCESS)); smart_objects::SmartObject* choice_set_id = NULL; - EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId)) + EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId)) .WillOnce(Return(choice_set_id)); EXPECT_CALL(app_mngr_, GenerateGrammarID()).WillOnce(Return(kGrammarId)); - EXPECT_CALL(*app_, AddChoiceSet(kChoiceSetId, _)); + EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _)); ON_CALL(app_mngr_, GetNextHMICorrelationID()) .WillByDefault(Return(kCorrelationId)); command_->Run(); @@ -664,7 +658,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, event.set_smart_object(*message_); command_->on_event(event); - EXPECT_CALL(*app_, RemoveChoiceSet(kChoiceSetId)); + EXPECT_CALL(*mock_app_, RemoveChoiceSet(kChoiceSetId)); EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0); EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _)); command_->onTimeOut(); @@ -682,17 +676,17 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeOut_InvalidApp_UNSUCCESS) { (*message_)[am::strings::msg_params][am::strings::interaction_choice_set_id] = kChoiceSetId; - EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_)); + EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app_)); EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _)) .WillRepeatedly(Return(mobile_apis::Result::SUCCESS)); smart_objects::SmartObject* choice_set_id = NULL; - EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId)) + EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId)) .WillOnce(Return(choice_set_id)); EXPECT_CALL(app_mngr_, GenerateGrammarID()).WillOnce(Return(kGrammarId)); - EXPECT_CALL(*app_, AddChoiceSet(kChoiceSetId, _)); + EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _)); ON_CALL(app_mngr_, GetNextHMICorrelationID()) .WillByDefault(Return(kCorrelationId)); command_->Run(); @@ -707,7 +701,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeOut_InvalidApp_UNSUCCESS) { MockAppPtr invalid_app; EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(invalid_app)); - EXPECT_CALL(*app_, RemoveChoiceSet(_)).Times(0); + EXPECT_CALL(*mock_app_, RemoveChoiceSet(_)).Times(0); command_->onTimeOut(); } @@ -724,34 +718,38 @@ TEST_F(CreateInteractionChoiceSetRequestTest, (*message_)[am::strings::msg_params][am::strings::interaction_choice_set_id] = kChoiceSetId; - EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app_)); - EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _)) .WillRepeatedly(Return(mobile_apis::Result::SUCCESS)); smart_objects::SmartObject* choice_set_id = NULL; - EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId)) - .WillOnce(Return(choice_set_id)); + EXPECT_CALL(app_mngr_, application(kConnectionKey)) + .WillOnce(Return(mock_app_)); EXPECT_CALL(app_mngr_, GenerateGrammarID()).WillOnce(Return(kGrammarId)); - EXPECT_CALL(*app_, AddChoiceSet(kChoiceSetId, _)); ON_CALL(app_mngr_, GetNextHMICorrelationID()) .WillByDefault(Return(kCorrelationId)); + + EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId)) + .WillOnce(Return(choice_set_id)); + EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _)); + command_->Run(); FillMessageFieldsItem2(message_); + EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)).Times(0); EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _)); + Event event(hmi_apis::FunctionID::VR_AddCommand); event.set_smart_object(*message_); - MockAppPtr invalid_app; - EXPECT_CALL(app_mngr_, application(kConnectionKey)) - .WillOnce(Return(invalid_app)); command_->on_event(event); - EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app_)); - EXPECT_CALL(*app_, RemoveChoiceSet(_)); + EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _)); + EXPECT_CALL(app_mngr_, application(kConnectionKey)) + .WillOnce(Return(mock_app_)); + EXPECT_CALL(*mock_app_, RemoveChoiceSet(_)); + command_->onTimeOut(); } @@ -791,18 +789,18 @@ TEST_F(CreateInteractionChoiceSetRequestTest, Run_ErrorFromHmiFalse_UNSUCCESS) { (*message_)[am::strings::msg_params][am::strings::interaction_choice_set_id] = kChoiceSetId; - ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app_)); + ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_)); EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _)) .WillRepeatedly(Return(mobile_apis::Result::GENERIC_ERROR)); smart_objects::SmartObject* choice_set_id = NULL; - EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId)) + EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId)) .WillRepeatedly(Return(choice_set_id)); EXPECT_CALL(app_mngr_, GenerateGrammarID()) .WillRepeatedly(Return(kGrammarId)); - EXPECT_CALL(*app_, AddChoiceSet(kChoiceSetId, _)).Times(2); + EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _)).Times(2); ON_CALL(app_mngr_, GetNextHMICorrelationID()) .WillByDefault(Return(kCorrelationId)); command_->Run(); diff --git a/src/components/application_manager/test/commands/mobile/delete_command_request_test.cc b/src/components/application_manager/test/commands/mobile/delete_command_request_test.cc index 1e03dcaaf1..efa889a2c1 100644 --- a/src/components/application_manager/test/commands/mobile/delete_command_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/delete_command_request_test.cc @@ -61,7 +61,6 @@ using am::commands::DeleteCommandRequest; using am::commands::MessageSharedPtr; using am::event_engine::Event; using am::MockMessageHelper; -using am::MockHmiInterfaces; typedef SharedPtr<DeleteCommandRequest> DeleteCommandPtr; @@ -130,15 +129,12 @@ class DeleteCommandRequestTest ON_CALL(app_mngr_, application(kConnectionKey)) .WillByDefault(Return(mock_app_)); ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey)); - ON_CALL(app_mngr_, hmi_interfaces()) - .WillByDefault(ReturnRef(hmi_interfaces_)); } void TearDown() OVERRIDE { Mock::VerifyAndClearExpectations(&mock_message_helper_); } - NiceMock<MockHmiInterfaces> hmi_interfaces_; MockMessageHelper& mock_message_helper_; MockAppPtr mock_app_; }; @@ -158,12 +154,12 @@ TEST_F(DeleteCommandRequestTest, (*test_msg)[am::strings::vr_commands] = 0; (*test_msg)[am::strings::menu_params] = 0; - ON_CALL(hmi_interfaces_, GetInterfaceFromFunction(_)) + ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_VR)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); ON_CALL(*mock_app_, FindCommand(kCommandId)) @@ -189,8 +185,6 @@ TEST_F(DeleteCommandRequestTest, EXPECT_CALL(*mock_app_, RemoveCommand(kCommandId)); - EXPECT_CALL(*mock_app_, UpdateHash()); - MessageSharedPtr vr_command_result; EXPECT_CALL( app_mngr_, @@ -218,12 +212,12 @@ TEST_F(DeleteCommandRequestTest, (*test_msg)[am::strings::vr_commands] = 0; (*test_msg)[am::strings::menu_params] = 0; - ON_CALL(hmi_interfaces_, GetInterfaceFromFunction(_)) + ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); ON_CALL(*app, FindCommand(kCommandId)).WillByDefault(Return(test_msg.get())); @@ -248,8 +242,6 @@ TEST_F(DeleteCommandRequestTest, EXPECT_CALL(*app, RemoveCommand(kCommandId)); - EXPECT_CALL(*app, UpdateHash()); - MessageSharedPtr result_msg( CatchMobileCommandResult(CallOnEvent(*command, event_ui))); diff --git a/src/components/application_manager/test/commands/mobile/delete_file_test.cc b/src/components/application_manager/test/commands/mobile/delete_file_test.cc index 6af9a62bf0..3692f7298e 100644 --- a/src/components/application_manager/test/commands/mobile/delete_file_test.cc +++ b/src/components/application_manager/test/commands/mobile/delete_file_test.cc @@ -159,7 +159,7 @@ TEST_F(DeleteFileRequestTest, Run_ValidFileName_SUCCESS) { kConnectionKey; EXPECT_CALL(app_mngr_, application(kConnectionKey)) - .WillOnce(Return(mock_app_)); + .WillRepeatedly(Return(mock_app_)); EXPECT_CALL(*mock_app_, hmi_level()) .WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL)); diff --git a/src/components/application_manager/test/commands/mobile/delete_interaction_choice_set_test.cc b/src/components/application_manager/test/commands/mobile/delete_interaction_choice_set_test.cc index 64c2fae1d3..a6d9d8f50a 100644 --- a/src/components/application_manager/test/commands/mobile/delete_interaction_choice_set_test.cc +++ b/src/components/application_manager/test/commands/mobile/delete_interaction_choice_set_test.cc @@ -191,8 +191,10 @@ TEST_F(DeleteInteractionChoiceSetRequestTest, [am::strings::interaction_choice_set_id]); smart_objects::SmartObject* invalid_choice_set_id = NULL; + EXPECT_CALL(app_mngr_, application(kConnectionKey)) + .WillRepeatedly(Return(app_)); + InSequence seq; - EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app_)); EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId)) .WillOnce(Return(choice_set_id)); @@ -206,8 +208,11 @@ TEST_F(DeleteInteractionChoiceSetRequestTest, EXPECT_CALL(*app_, RemoveChoiceSet(kChoiceSetId)); EXPECT_CALL(*app_, UpdateHash()); - command_->Run(); - EXPECT_TRUE(Mock::VerifyAndClearExpectations(app_.get())); + DeleteInteractionChoiceSetRequestPtr command = + CreateCommand<DeleteInteractionChoiceSetRequest>(message_); + + command->Init(); + command->Run(); } TEST_F(DeleteInteractionChoiceSetRequestTest, Run_SendVrDeleteCommand_SUCCESS) { @@ -221,8 +226,10 @@ TEST_F(DeleteInteractionChoiceSetRequestTest, Run_SendVrDeleteCommand_SUCCESS) { smart_objects::SmartObject* choice_set_id = &((*message_)[am::strings::msg_params]); + EXPECT_CALL(app_mngr_, application(kConnectionKey)) + .WillRepeatedly(Return(app_)); + InSequence seq; - EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app_)); EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId)) .WillOnce(Return(choice_set_id)); @@ -238,8 +245,11 @@ TEST_F(DeleteInteractionChoiceSetRequestTest, Run_SendVrDeleteCommand_SUCCESS) { EXPECT_CALL(*app_, RemoveChoiceSet(kChoiceSetId)); EXPECT_CALL(*app_, UpdateHash()); - command_->Run(); - EXPECT_TRUE(Mock::VerifyAndClearExpectations(app_.get())); + DeleteInteractionChoiceSetRequestPtr command = + CreateCommand<DeleteInteractionChoiceSetRequest>(message_); + + command->Init(); + command->Run(); } TEST_F(DeleteInteractionChoiceSetResponseTest, Run_SuccessFalse_UNSUCCESS) { diff --git a/src/components/application_manager/test/commands/mobile/delete_sub_menu_test.cc b/src/components/application_manager/test/commands/mobile/delete_sub_menu_test.cc index dd57d5f8c6..beff4c3584 100644 --- a/src/components/application_manager/test/commands/mobile/delete_sub_menu_test.cc +++ b/src/components/application_manager/test/commands/mobile/delete_sub_menu_test.cc @@ -241,9 +241,11 @@ TEST_F(DeleteSubMenuRequestTest, OnEvent_UnknownEventId_UNSUCCESS) { TEST_F(DeleteSubMenuRequestTest, OnEvent_InvalidApp_UNSUCCESS) { Event event(hmi_apis::FunctionID::UI_DeleteSubMenu); (*message_)[am::strings::params][am::hmi_response::code] = - am::mobile_api::Result::SUCCESS; + hmi_apis::Common_Result::eType::SUCCESS; event.set_smart_object(*message_); - + ON_CALL(mock_message_helper_, + HMIToMobileResult(hmi_apis::Common_Result::eType::SUCCESS)) + .WillByDefault(Return(am::mobile_api::Result::SUCCESS)); MockAppPtr invalid_app; EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(invalid_app)); EXPECT_CALL(*app_, RemoveSubMenu(_)).Times(0); @@ -270,8 +272,9 @@ TEST_F(DeleteSubMenuRequestTest, OnEvent_DeleteSubmenu_SUCCESS) { commands_map_.insert( std::make_pair(0, &((*message_)[am::strings::msg_params]))); + EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_)); + InSequence seq; - EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_)); EXPECT_CALL(*app_, commands_map()).WillOnce(Return(accessor_)); EXPECT_CALL(*app_, app_id()).WillOnce(Return(kConnectionKey)); EXPECT_CALL(*app_, get_grammar_id()).WillOnce(Return(kGrammarId)); @@ -282,8 +285,12 @@ TEST_F(DeleteSubMenuRequestTest, OnEvent_DeleteSubmenu_SUCCESS) { EXPECT_CALL(*app_, RemoveSubMenu(_)); EXPECT_CALL(*app_, UpdateHash()); - command_->on_event(event); - EXPECT_TRUE(Mock::VerifyAndClearExpectations(app_.get())); + + DeleteSubMenuRequestPtr command = + CreateCommand<DeleteSubMenuRequest>(message_); + + command->Init(); + command->on_event(event); } TEST_F(DeleteSubMenuResponseTest, Run_SUCCESS) { @@ -311,7 +318,11 @@ TEST_F(DeleteSubMenuRequestTest, commands_map_.insert( std::make_pair(0, &((*message_)[am::strings::msg_params]))); - EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_)); + ON_CALL(mock_message_helper_, + HMIToMobileResult(hmi_apis::Common_Result::SUCCESS)) + .WillByDefault(Return(am::mobile_api::Result::SUCCESS)); + + EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_)); EXPECT_CALL(app_mngr_, ManageHMICommand(_)).Times(0); EXPECT_CALL(*app_, commands_map()).Times(2).WillRepeatedly(Return(accessor_)); EXPECT_CALL(*app_, RemoveCommand(_)).Times(0); @@ -334,7 +345,10 @@ TEST_F(DeleteSubMenuRequestTest, commands_map_.insert( std::make_pair(0, &((*message_)[am::strings::msg_params]))); - EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_)); + EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)) + .WillRepeatedly(Return(am::mobile_api::Result::SUCCESS)); + + EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_)); EXPECT_CALL(app_mngr_, ManageHMICommand(_)).Times(0); EXPECT_CALL(*app_, commands_map()).Times(2).WillRepeatedly(Return(accessor_)); EXPECT_CALL(*app_, RemoveCommand(_)).Times(0); diff --git a/src/components/application_manager/test/commands/mobile/dial_number_request_test.cc b/src/components/application_manager/test/commands/mobile/dial_number_request_test.cc index 2f7415c98e..33c84d305a 100644 --- a/src/components/application_manager/test/commands/mobile/dial_number_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/dial_number_request_test.cc @@ -156,15 +156,6 @@ TEST_F(DialNumberRequestTest, OnEvent_UnknownEvent_UNSUCCESS) { } TEST_F(DialNumberRequestTest, OnEvent_SUCCESS) { - MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map)); - (*command_msg)[am::strings::params][am::strings::connection_key] = - kConnectionKey; - - DialNumberRequestPtr command(CreateCommand<DialNumberRequest>(command_msg)); - - MockAppPtr app(CreateMockApp()); - EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app)); - MessageSharedPtr event_msg(CreateMessage(smart_objects::SmartType_Map)); (*event_msg)[am::strings::params][am::hmi_response::code] = mobile_apis::Result::SUCCESS; @@ -173,10 +164,19 @@ TEST_F(DialNumberRequestTest, OnEvent_SUCCESS) { Event event(hmi_apis::FunctionID::BasicCommunication_DialNumber); event.set_smart_object(*event_msg); + MockAppPtr app(CreateMockApp()); + EXPECT_CALL(app_mngr_, application(kConnectionKey)) + .WillRepeatedly(Return(app)); + EXPECT_CALL( app_mngr_, ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), _)); + MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map)); + (*command_msg)[am::strings::params][am::strings::connection_key] = + kConnectionKey; + + DialNumberRequestPtr command(CreateCommand<DialNumberRequest>(command_msg)); command->on_event(event); } diff --git a/src/components/application_manager/test/commands/mobile/end_audio_pass_thru_request_test.cc b/src/components/application_manager/test/commands/mobile/end_audio_pass_thru_request_test.cc index ceb5e3b916..b8c0ed23f3 100644 --- a/src/components/application_manager/test/commands/mobile/end_audio_pass_thru_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/end_audio_pass_thru_request_test.cc @@ -59,7 +59,6 @@ using ::testing::ReturnRef; using am::commands::MessageSharedPtr; using am::commands::EndAudioPassThruRequest; using am::event_engine::Event; -using am::MockHmiInterfaces; using am::MockMessageHelper; typedef SharedPtr<EndAudioPassThruRequest> EndAudioPassThruRequestPtr; @@ -90,12 +89,6 @@ TEST_F(EndAudioPassThruRequestTest, OnEvent_UI_UNSUPPORTED_RESOUCRE) { Event event(hmi_apis::FunctionID::UI_EndAudioPassThru); event.set_smart_object(*event_msg); - MockHmiInterfaces hmi_interfaces; - ON_CALL(app_mngr_, hmi_interfaces()).WillByDefault(ReturnRef(hmi_interfaces)); - ON_CALL(hmi_interfaces, - GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) - .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE)) .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE)); @@ -108,6 +101,9 @@ TEST_F(EndAudioPassThruRequestTest, OnEvent_UI_UNSUPPORTED_RESOUCRE) { ManageMobileCommand(_, am::commands::Command::CommandOrigin::ORIGIN_SDL)) .WillOnce(DoAll(SaveArg<0>(&ui_command_result), Return(true))); + MockAppPtr app(CreateMockApp()); + EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app)); + command->on_event(event); EXPECT_EQ((*ui_command_result)[am::strings::msg_params][am::strings::success] diff --git a/src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc b/src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc index 31d406d959..dfa38a758b 100644 --- a/src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc @@ -61,12 +61,18 @@ using am::commands::MessageSharedPtr; using am::commands::GetDTCsRequest; using am::event_engine::Event; using am::MockMessageHelper; +using testing::Mock; namespace mobile_result = mobile_apis::Result; typedef SharedPtr<GetDTCsRequest> GetDTCsRequestPtr; class GetDTCsRequestTest - : public CommandRequestTest<CommandsTestMocks::kIsNice> {}; + : public CommandRequestTest<CommandsTestMocks::kIsNice> { + public: + GetDTCsRequestTest() : CommandRequestTest<CommandsTestMocks::kIsNice>() { + Mock::VerifyAndClearExpectations(message_helper_mock_); + } +}; TEST_F(GetDTCsRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) { GetDTCsRequestPtr command(CreateCommand<GetDTCsRequest>()); @@ -112,8 +118,6 @@ TEST_F(GetDTCsRequestTest, OnEvent_UnknownEvent_UNSUCCESS) { } TEST_F(GetDTCsRequestTest, OnEvent_SUCCESS) { - GetDTCsRequestPtr command(CreateCommand<GetDTCsRequest>()); - MessageSharedPtr event_msg(CreateMessage(smart_objects::SmartType_Map)); (*event_msg)[am::strings::msg_params] = 0; (*event_msg)[am::strings::params][am::hmi_response::code] = @@ -130,6 +134,10 @@ TEST_F(GetDTCsRequestTest, OnEvent_SUCCESS) { app_mngr_, ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), _)); + MockAppPtr app(CreateMockApp()); + EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app)); + + GetDTCsRequestPtr command(CreateCommand<GetDTCsRequest>()); command->on_event(event); } diff --git a/src/components/application_manager/test/commands/mobile/get_way_points_request_test.cc b/src/components/application_manager/test/commands/mobile/get_way_points_request_test.cc index 4b13576a39..d886a2b1bd 100644 --- a/src/components/application_manager/test/commands/mobile/get_way_points_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/get_way_points_request_test.cc @@ -76,6 +76,7 @@ class GetWayPointsRequestTest : message_helper_mock_(*am::MockMessageHelper::message_helper_mock()) { Mock::VerifyAndClearExpectations(&message_helper_mock_); } + ~GetWayPointsRequestTest() { Mock::VerifyAndClearExpectations(&message_helper_mock_); } @@ -90,6 +91,9 @@ class GetWayPointsRequestTest message_); mock_app_ = CreateMockApp(); ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_)); + + ON_CALL(message_helper_mock_, HMIToMobileResult(_)) + .WillByDefault(Return(mobile_apis::Result::SUCCESS)); } MockMessageHelper& message_helper_mock_; @@ -127,6 +131,12 @@ class GetWayPointsRequestOnEventTest event.set_smart_object(*event_msg); + EXPECT_CALL(message_helper_mock_, HMIToMobileResult(_)) + .WillOnce(Return(ResultCode)); + + MockAppPtr app(CreateMockApp()); + EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app)); + MessageSharedPtr result_msg( CatchMobileCommandResult(CallOnEvent(*command, event))); EXPECT_EQ( @@ -195,7 +205,7 @@ TEST_F(GetWayPointsRequestTest, Run_ApplicationRegistered_Success) { } TEST_F(GetWayPointsRequestTest, - OnEvent_NavigationGetWayPointsEvent_SendResponce) { + OnEvent_NavigationGetWayPointsEvent_SendResponse) { am::event_engine::Event event(hmi_apis::FunctionID::Navigation_GetWayPoints); (*message_)[am::strings::params][am::hmi_response::code] = @@ -248,42 +258,46 @@ TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_SUCCESS_Case3) { } TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case1) { - EXPECT_CALL(app_mngr_, hmi_interfaces()).WillOnce(ReturnRef(hmi_interfaces_)); - EXPECT_CALL(hmi_interfaces_, + EXPECT_CALL(mock_hmi_interfaces_, + GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) + .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE)); + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_Navigation)) - .WillOnce(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - EXPECT_CALL(message_helper_mock_, HMIToMobileResult(_)) - .WillOnce(Return(mobile_apis::Result::GENERIC_ERROR)); + .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); + CheckOnEventResponse(" ", GENERIC_ERROR, false); } TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case2) { - EXPECT_CALL(app_mngr_, hmi_interfaces()).WillOnce(ReturnRef(hmi_interfaces_)); - EXPECT_CALL(hmi_interfaces_, + EXPECT_CALL(mock_hmi_interfaces_, + GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) + .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE)); + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_Navigation)) - .WillOnce(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - EXPECT_CALL(message_helper_mock_, HMIToMobileResult(_)) - .WillOnce(Return(mobile_apis::Result::GENERIC_ERROR)); + .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); + CheckOnEventResponse("test\t", GENERIC_ERROR, false); } TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case3) { - EXPECT_CALL(app_mngr_, hmi_interfaces()).WillOnce(ReturnRef(hmi_interfaces_)); - EXPECT_CALL(hmi_interfaces_, + EXPECT_CALL(mock_hmi_interfaces_, + GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) + .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE)); + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_Navigation)) - .WillOnce(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - EXPECT_CALL(message_helper_mock_, HMIToMobileResult(_)) - .WillOnce(Return(mobile_apis::Result::GENERIC_ERROR)); + .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); + CheckOnEventResponse("test\n", GENERIC_ERROR, false); } TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case4) { - EXPECT_CALL(app_mngr_, hmi_interfaces()).WillOnce(ReturnRef(hmi_interfaces_)); - EXPECT_CALL(hmi_interfaces_, + EXPECT_CALL(mock_hmi_interfaces_, + GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) + .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE)); + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_Navigation)) - .WillOnce(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - EXPECT_CALL(message_helper_mock_, HMIToMobileResult(_)) - .WillOnce(Return(mobile_apis::Result::GENERIC_ERROR)); + .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); + CheckOnEventResponse("test\t\n", GENERIC_ERROR, false); } diff --git a/src/components/application_manager/test/commands/mobile/list_files_request_test.cc b/src/components/application_manager/test/commands/mobile/list_files_request_test.cc index 85377054ef..ae0e523832 100644 --- a/src/components/application_manager/test/commands/mobile/list_files_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/list_files_request_test.cc @@ -61,7 +61,12 @@ using am::commands::ListFilesRequest; using am::commands::MessageSharedPtr; class ListFilesRequestTest - : public CommandRequestTest<CommandsTestMocks::kIsNice> {}; + : public CommandRequestTest<CommandsTestMocks::kIsNice> { + public: + ListFilesRequestTest() : kStoragePath_("storage"), kResponseSize_(1) {} + const std::string kStoragePath_; + const uint32_t kResponseSize_; +}; TEST_F(ListFilesRequestTest, Run_AppNotRegistered_UNSUCCESS) { SharedPtr<ListFilesRequest> command(CreateCommand<ListFilesRequest>()); @@ -105,7 +110,17 @@ TEST_F(ListFilesRequestTest, Run_SUCCESS) { MockAppPtr app(CreateMockApp()); SharedPtr<ListFilesRequest> command(CreateCommand<ListFilesRequest>()); + EXPECT_CALL(app_mngr_, get_settings()) + .WillRepeatedly(ReturnRef(app_mngr_settings_)); + + ON_CALL(app_mngr_settings_, app_storage_folder()) + .WillByDefault(ReturnRef(kStoragePath_)); + + ON_CALL(app_mngr_settings_, list_files_response_size()) + .WillByDefault(ReturnRef(kResponseSize_)); + ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app)); + ON_CALL(*app, hmi_level()) .WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL)); diff --git a/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc index 2cfed4a26a..34f8a010d8 100644 --- a/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc +++ b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc @@ -52,7 +52,7 @@ const connection_handler::DeviceHandle kHandle = 2u; namespace strings = application_manager::strings; using application_manager::commands::OnHMIStatusNotificationFromMobile; -using application_manager::ProtocolVersion; +using protocol_handler::MajorProtocolVersion; using application_manager::ApplicationSet; using testing::Mock; using testing::Return; @@ -91,7 +91,8 @@ TEST_F(OnHMIStatusNotificationFromMobileTest, EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor)); EXPECT_CALL(*mock_app, protocol_version()) - .WillRepeatedly(Return(ProtocolVersion::kV4)); + .WillRepeatedly( + Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5)); EXPECT_CALL(*mock_app, is_foreground()).WillRepeatedly(Return(true)); command->Run(); @@ -144,7 +145,8 @@ TEST_F(OnHMIStatusNotificationFromMobileTest, EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor)); EXPECT_CALL(*mock_app, protocol_version()) - .WillRepeatedly(Return(ProtocolVersion::kV4)); + .WillRepeatedly( + Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5)); EXPECT_CALL(*mock_app, is_foreground()).WillRepeatedly(Return(true)); command->Run(); @@ -172,7 +174,8 @@ TEST_F(OnHMIStatusNotificationFromMobileTest, EXPECT_CALL(app_mngr_, applications()).Times(0); EXPECT_CALL(*mock_app, protocol_version()) - .WillOnce(Return(ProtocolVersion::kV3)); + .WillOnce( + Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3)); EXPECT_CALL(*mock_app, is_foreground()).Times(0); command->Run(); @@ -199,7 +202,8 @@ TEST_F(OnHMIStatusNotificationFromMobileTest, EXPECT_CALL(app_mngr_, applications()).Times(0); EXPECT_CALL(*mock_app, protocol_version()) - .WillOnce(Return(ProtocolVersion::kV3)); + .WillOnce( + Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3)); EXPECT_CALL(*mock_app, is_foreground()).Times(0); command->Run(); @@ -224,7 +228,8 @@ TEST_F(OnHMIStatusNotificationFromMobileTest, EXPECT_CALL(app_mngr_, IsAppsQueriedFrom(kHandle)).WillOnce(Return(false)); EXPECT_CALL(*mock_app, protocol_version()) - .WillOnce(Return(ProtocolVersion::kV4)); + .WillOnce( + Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5)); EXPECT_CALL(app_mngr_, applications()).Times(0); @@ -261,7 +266,8 @@ TEST_F(OnHMIStatusNotificationFromMobileTest, EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor)); EXPECT_CALL(*mock_app, protocol_version()) - .WillRepeatedly(Return(ProtocolVersion::kV4)); + .WillRepeatedly( + Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5)); EXPECT_CALL(*mock_app, is_foreground()).WillRepeatedly(Return(false)); EXPECT_CALL(app_mngr_, MarkAppsGreyOut(kHandle, false)); diff --git a/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc index 8f2ce3d3dc..2da0e60df1 100644 --- a/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc +++ b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc @@ -49,7 +49,7 @@ const uint32_t kConnectionKey = 1u; namespace strings = application_manager::strings; using application_manager::commands::OnHMIStatusNotification; -using application_manager::ProtocolVersion; +using protocol_handler::MajorProtocolVersion; using application_manager::MockMessageHelper; using application_manager::commands::CommandImpl; using testing::Mock; diff --git a/src/components/application_manager/test/commands/mobile/on_touch_event_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_touch_event_notification_test.cc index 466facec1f..c90991fdf7 100644 --- a/src/components/application_manager/test/commands/mobile/on_touch_event_notification_test.cc +++ b/src/components/application_manager/test/commands/mobile/on_touch_event_notification_test.cc @@ -76,10 +76,16 @@ TEST_F(OnTouchEventNotificationTest, Run_AppIsNotFullscreen_UNSUCCESS) { std::vector<ApplicationSharedPtr> applications_with_navi; applications_with_navi.push_back(mock_app); + std::vector<ApplicationSharedPtr> applications_with_mobile_projection; + applications_with_mobile_projection.push_back(mock_app); + EXPECT_CALL(app_mngr_, applications_with_navi()) .WillOnce(Return(applications_with_navi)); - EXPECT_CALL(*mock_app, IsFullscreen()).WillOnce(Return(false)); + EXPECT_CALL(app_mngr_, applications_with_mobile_projection()) + .WillOnce(Return(applications_with_mobile_projection)); + + EXPECT_CALL(*mock_app, IsFullscreen()).WillRepeatedly(Return(false)); EXPECT_CALL(*mock_app, app_id()).Times(0); @@ -118,14 +124,20 @@ TEST_F(OnTouchEventNotificationTest, Run_NotEmptyListOfAppsWithNavi_SUCCESS) { std::vector<ApplicationSharedPtr> applications_with_navi; applications_with_navi.push_back(mock_app); + std::vector<ApplicationSharedPtr> applications_with_mobile_projection; + applications_with_mobile_projection.push_back(mock_app); + EXPECT_CALL(app_mngr_, applications_with_navi()) .WillOnce(Return(applications_with_navi)); - EXPECT_CALL(*mock_app, IsFullscreen()).WillOnce(Return(true)); + EXPECT_CALL(app_mngr_, applications_with_mobile_projection()) + .WillOnce(Return(applications_with_mobile_projection)); + + EXPECT_CALL(*mock_app, IsFullscreen()).WillRepeatedly(Return(true)); - EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppId)); + EXPECT_CALL(*mock_app, app_id()).WillRepeatedly(Return(kAppId)); - EXPECT_CALL(app_mngr_, SendMessageToMobile(CheckMessageData(), _)); + EXPECT_CALL(app_mngr_, SendMessageToMobile(CheckMessageData(), _)).Times(2); command_->Run(); } diff --git a/src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc b/src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc index 9126e43050..e2adc38f50 100644 --- a/src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc +++ b/src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc @@ -55,7 +55,6 @@ using am::commands::PerformAudioPassThruRequest; using am::commands::CommandImpl; using am::commands::MessageSharedPtr; using am::MockMessageHelper; -using am::MockHmiInterfaces; using ::utils::SharedPtr; using ::testing::_; using ::testing::Mock; @@ -131,8 +130,6 @@ class PerformAudioPassThruRequestTest ON_CALL(app_mngr_, application(kConnectionKey)) .WillByDefault(Return(mock_app_)); ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey)); - ON_CALL(app_mngr_, hmi_interfaces()) - .WillByDefault(ReturnRef(hmi_interfaces_)); command_sptr_ = CreateCommand<am::commands::PerformAudioPassThruRequest>(message_); @@ -156,7 +153,6 @@ class PerformAudioPassThruRequestTest } sync_primitives::Lock lock_; - NiceMock<MockHmiInterfaces> hmi_interfaces_; MockMessageHelper& mock_message_helper_; MockAppPtr mock_app_; MessageSharedPtr message_; @@ -217,10 +213,10 @@ TEST_F(PerformAudioPassThruRequestTest, am::event_engine::Event event(hmi_apis::FunctionID::UI_PerformAudioPassThru); event.set_smart_object(*msg); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); @@ -312,10 +308,10 @@ TEST_F(PerformAudioPassThruRequestTest, // Send speak request sending ON_CALL(app_mngr_, GetNextHMICorrelationID()) .WillByDefault(Return(kCorrelationId)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_Speak)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_TTS)); - ON_CALL(hmi_interfaces_, GetInterfaceState(_)) + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); EXPECT_CALL(app_mngr_, ManageHMICommand(_)) .WillOnce(DoAll(SaveArg<0>(&speak_reqeust_result_msg), Return(true))); @@ -324,10 +320,10 @@ TEST_F(PerformAudioPassThruRequestTest, ON_CALL(app_mngr_, GetNextHMICorrelationID()) .WillByDefault(Return(kCorrelationId)); ON_CALL( - hmi_interfaces_, + mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::UI_PerformAudioPassThru)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); - ON_CALL(hmi_interfaces_, GetInterfaceState(_)) + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); EXPECT_CALL(app_mngr_, ManageHMICommand(_)) .WillOnce(DoAll(SaveArg<0>(&perform_result_msg), Return(true))); @@ -359,10 +355,10 @@ TEST_F(PerformAudioPassThruRequestTest, ON_CALL(app_mngr_, GetNextHMICorrelationID()) .WillByDefault(Return(kCorrelationId)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_StopSpeaking)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_TTS)); - ON_CALL(hmi_interfaces_, GetInterfaceState(_)) + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0); @@ -395,10 +391,10 @@ TEST_F(PerformAudioPassThruRequestTest, InSequence dummy; ON_CALL(app_mngr_, GetNextHMICorrelationID()) .WillByDefault(Return(kCorrelationId)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_Speak)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_TTS)); - ON_CALL(hmi_interfaces_, GetInterfaceState(_)) + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); EXPECT_CALL(app_mngr_, ManageHMICommand(_)) .WillOnce(DoAll(SaveArg<0>(&speak_reqeust_result_msg), Return(true))); @@ -407,10 +403,10 @@ TEST_F(PerformAudioPassThruRequestTest, ON_CALL(app_mngr_, GetNextHMICorrelationID()) .WillByDefault(Return(kCorrelationId)); ON_CALL( - hmi_interfaces_, + mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::UI_PerformAudioPassThru)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); - ON_CALL(hmi_interfaces_, GetInterfaceState(_)) + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); EXPECT_CALL(app_mngr_, ManageHMICommand(_)) .WillOnce(DoAll(SaveArg<0>(&perform_result_msg), Return(true))); @@ -463,10 +459,10 @@ TEST_F(PerformAudioPassThruRequestTest, InSequence dummy; ON_CALL(app_mngr_, GetNextHMICorrelationID()) .WillByDefault(Return(kCorrelationId)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_Speak)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_TTS)); - ON_CALL(hmi_interfaces_, GetInterfaceState(_)) + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); EXPECT_CALL(app_mngr_, ManageHMICommand(_)) .WillOnce(DoAll(SaveArg<0>(&speak_reqeust_result_msg), Return(true))); @@ -475,10 +471,10 @@ TEST_F(PerformAudioPassThruRequestTest, ON_CALL(app_mngr_, GetNextHMICorrelationID()) .WillByDefault(Return(kCorrelationId)); ON_CALL( - hmi_interfaces_, + mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::UI_PerformAudioPassThru)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); - ON_CALL(hmi_interfaces_, GetInterfaceState(_)) + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); EXPECT_CALL(app_mngr_, ManageHMICommand(_)) .WillOnce(DoAll(SaveArg<0>(&perform_result_msg), Return(true))); @@ -506,10 +502,10 @@ TEST_F( ON_CALL(app_mngr_, GetNextHMICorrelationID()) .WillByDefault(Return(kCorrelationId)); ON_CALL( - hmi_interfaces_, + mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::UI_PerformAudioPassThru)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_TTS)); - ON_CALL(hmi_interfaces_, GetInterfaceState(_)) + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); // Perform audio path thru request sending EXPECT_CALL(app_mngr_, ManageHMICommand(_)) @@ -518,10 +514,10 @@ TEST_F( // Perform audio path thru request sending ON_CALL(app_mngr_, GetNextHMICorrelationID()) .WillByDefault(Return(kCorrelationId)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::UI_OnRecordStart)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); - ON_CALL(hmi_interfaces_, GetInterfaceState(_)) + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); // Start recording notification sending EXPECT_CALL(app_mngr_, ManageHMICommand(_)) @@ -583,7 +579,7 @@ TEST_F(PerformAudioPassThruRequestTest, EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)); - ON_CALL(hmi_interfaces_, GetInterfaceState(_)) + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)) @@ -609,7 +605,7 @@ TEST_F(PerformAudioPassThruRequestTest, hmi_apis::Common_Result::SUCCESS; event_perform.set_smart_object(*message_); - ON_CALL(hmi_interfaces_, GetInterfaceState(_)) + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); // First call on_event for setting result_tts_speak_ to UNSUPPORTED_RESOURCE EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)); @@ -619,7 +615,7 @@ TEST_F(PerformAudioPassThruRequestTest, // Second call for test correct behavior of UI_PerformAudioPassThru event EXPECT_CALL(app_mngr_, EndAudioPassThrough()).WillOnce(Return(false)); EXPECT_CALL(app_mngr_, StopAudioPassThru(_)).Times(0); - ON_CALL(hmi_interfaces_, GetInterfaceState(_)) + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); CallOnEvent caller_perform(*command_sptr_, event_perform); @@ -648,7 +644,7 @@ TEST_F(PerformAudioPassThruRequestTest, StartAudioPassThruThread(kConnectionKey, kCorrelationId, _, _, _, _)); EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)); - ON_CALL(hmi_interfaces_, GetInterfaceState(_)) + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); ON_CALL(mock_message_helper_, HMIToMobileResult(_)) .WillByDefault(Return(am::mobile_api::Result::SUCCESS)); @@ -673,7 +669,7 @@ TEST_F(PerformAudioPassThruRequestTest, app_mngr_, StartAudioPassThruThread(kConnectionKey, kCorrelationId, _, _, _, _)); EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)); - ON_CALL(hmi_interfaces_, GetInterfaceState(_)) + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); CallOnEvent caller(*command_sptr_, event); caller(); @@ -732,10 +728,10 @@ TEST_F(PerformAudioPassThruRequestTest, MessageSharedPtr perform_result_msg; ON_CALL(app_mngr_, GetNextHMICorrelationID()) .WillByDefault(Return(kCorrelationId)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_Speak)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_TTS)); - ON_CALL(hmi_interfaces_, GetInterfaceState(_)) + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); EXPECT_CALL(app_mngr_, ManageHMICommand(_)) .WillOnce(DoAll(SaveArg<0>(&speak_reqeust_result_msg), Return(true))); @@ -744,10 +740,10 @@ TEST_F(PerformAudioPassThruRequestTest, ON_CALL(app_mngr_, GetNextHMICorrelationID()) .WillByDefault(Return(kCorrelationId)); ON_CALL( - hmi_interfaces_, + mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::UI_PerformAudioPassThru)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); - ON_CALL(hmi_interfaces_, GetInterfaceState(_)) + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); EXPECT_CALL(app_mngr_, ManageHMICommand(_)) .WillOnce(DoAll(SaveArg<0>(&perform_result_msg), Return(true))); diff --git a/src/components/application_manager/test/commands/mobile/perform_interaction_test.cc b/src/components/application_manager/test/commands/mobile/perform_interaction_test.cc index 22ce735c61..84a0e0b354 100644 --- a/src/components/application_manager/test/commands/mobile/perform_interaction_test.cc +++ b/src/components/application_manager/test/commands/mobile/perform_interaction_test.cc @@ -62,7 +62,6 @@ using am::ApplicationManager; using am::commands::MessageSharedPtr; using am::ApplicationSharedPtr; using am::MockMessageHelper; -using am::MockHmiInterfaces; using ::testing::_; using ::testing::Mock; using ::utils::SharedPtr; @@ -91,8 +90,6 @@ class PerformInteractionRequestTest ON_CALL(app_mngr_, application(kConnectionKey)) .WillByDefault(Return(mock_app_)); ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey)); - ON_CALL(app_mngr_, hmi_interfaces()) - .WillByDefault(ReturnRef(hmi_interfaces_)); } void TearDown() OVERRIDE { @@ -111,7 +108,6 @@ class PerformInteractionRequestTest } sync_primitives::Lock lock_; - NiceMock<MockHmiInterfaces> hmi_interfaces_; MockMessageHelper& mock_message_helper_; MockAppPtr mock_app_; }; @@ -174,10 +170,6 @@ TEST_F(PerformInteractionRequestTest, MockAppPtr mock_app; EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app)); - MockHmiInterfaces hmi_interfaces; - EXPECT_CALL(app_mngr_, hmi_interfaces()) - .WillRepeatedly(ReturnRef(hmi_interfaces)); - MessageSharedPtr response_msg_vr = CreateMessage(smart_objects::SmartType_Map); (*response_msg_vr)[strings::params][hmi_response::code] = @@ -197,10 +189,10 @@ TEST_F(PerformInteractionRequestTest, am::event_engine::Event event_ui(hmi_apis::FunctionID::UI_PerformInteraction); event_ui.set_smart_object(*response_msg_ui); - EXPECT_CALL(hmi_interfaces, + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - EXPECT_CALL(hmi_interfaces, + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); @@ -228,10 +220,10 @@ TEST_F(PerformInteractionRequestTest, utils::SharedPtr<PerformInteractionRequest> command = CreateCommand<PerformInteractionRequest>(msg_from_mobile); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); diff --git a/src/components/application_manager/test/commands/mobile/read_did_request_test.cc b/src/components/application_manager/test/commands/mobile/read_did_request_test.cc index 334f559ae6..7e46f6942f 100644 --- a/src/components/application_manager/test/commands/mobile/read_did_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/read_did_request_test.cc @@ -98,6 +98,9 @@ TEST_F(ReadDIDRequestTest, OnEvent_SUCCESS) { EXPECT_CALL(app_mngr_, ManageMobileCommand(MobileResultCodeIs(mobile_response_code), _)); + MockAppPtr app(CreateMockApp()); + EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app)); + command->on_event(event); testing::Mock::VerifyAndClearExpectations(&mock_message_helper); diff --git a/src/components/application_manager/test/commands/mobile/register_app_interface_request_test.cc b/src/components/application_manager/test/commands/mobile/register_app_interface_request_test.cc index 96b3cb067b..844f87d57e 100644 --- a/src/components/application_manager/test/commands/mobile/register_app_interface_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/register_app_interface_request_test.cc @@ -151,8 +151,6 @@ class RegisterAppInterfaceRequestTest .WillByDefault(Return(policy::DeviceConsent::kDeviceAllowed)); ON_CALL(app_mngr_, GetDeviceTransportType(_)) .WillByDefault(Return(hmi_apis::Common_TransportType::WIFI)); - ON_CALL(app_mngr_, hmi_interfaces()) - .WillByDefault(ReturnRef(mock_hmi_interfaces_)); ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); ON_CALL( @@ -191,15 +189,11 @@ class RegisterAppInterfaceRequestTest typedef IsNiceMock<application_manager_test::MockHMICapabilities, kMocksAreNice>::Result MockHMICapabilities; - typedef IsNiceMock<am::MockHmiInterfaces, kMocksAreNice>::Result - MockHmiInterfaces; - MockPolicyHandlerInterface mock_policy_handler_; MockResumeCtrl mock_resume_crt_; MockConnectionHandler mock_connection_handler_; MockSessionObserver mock_session_observer_; MockHMICapabilities mock_hmi_capabilities_; - MockHmiInterfaces mock_hmi_interfaces_; }; TEST_F(RegisterAppInterfaceRequestTest, Init_SUCCESS) { diff --git a/src/components/application_manager/test/commands/mobile/reset_global_properties_test.cc b/src/components/application_manager/test/commands/mobile/reset_global_properties_test.cc index 29c52bb0d5..e133ec9119 100644 --- a/src/components/application_manager/test/commands/mobile/reset_global_properties_test.cc +++ b/src/components/application_manager/test/commands/mobile/reset_global_properties_test.cc @@ -280,7 +280,6 @@ TEST_F(ResetGlobalPropertiesRequestTest, EXPECT_CALL(*mock_app_, reset_vr_help_title()); EXPECT_CALL(*mock_app_, reset_vr_help()); - EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true)); smart_objects::SmartObjectSPtr vr_help = @@ -297,7 +296,6 @@ TEST_F(ResetGlobalPropertiesRequestTest, ManageMobileCommand( MobileResultCodeIs(mobile_apis::Result::eType::SUCCESS), am::commands::Command::ORIGIN_SDL)); - EXPECT_CALL(*mock_app_, UpdateHash()); command_->on_event(event); } @@ -344,7 +342,6 @@ TEST_F(ResetGlobalPropertiesRequestTest, app_mngr_, ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::WARNINGS), am::commands::Command::ORIGIN_SDL)); - EXPECT_CALL(*mock_app_, UpdateHash()); command_->on_event(event); } @@ -368,8 +365,7 @@ TEST_F(ResetGlobalPropertiesResponseTest, Run_Sendmsg_SUCCESS) { command->Run(); } -TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_InvalidApp_UNSUCCESS) { - Event event(hmi_apis::FunctionID::UI_SetGlobalProperties); +TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_InvalidApp_NoHashUpdate) { (*msg_)[am::strings::params][am::hmi_response::code] = hmi_apis::Common_Result::eType::SUCCESS; @@ -387,22 +383,23 @@ TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_InvalidApp_UNSUCCESS) { EXPECT_CALL(*mock_message_helper_, CreateAppVrHelp(_)) .WillOnce(Return(vr_help)); - command_->Run(); + EXPECT_CALL(*mock_app_, UpdateHash()).Times(0); - event.set_smart_object(*msg_); + ResetGlobalPropertiesRequestPtr command = + CreateCommand<ResetGlobalPropertiesRequest>(msg_); + command->Run(); + + EXPECT_CALL(*mock_message_helper_, HMIToMobileResult(_)) + .WillRepeatedly(Return(mobile_apis::Result::SUCCESS)); EXPECT_CALL(app_mngr_, ManageMobileCommand( MobileResultCodeIs(mobile_apis::Result::eType::SUCCESS), am::commands::Command::ORIGIN_SDL)); - MockAppPtr invalid_app; - EXPECT_CALL(app_mngr_, application(kConnectionKey)) - .WillOnce(Return(invalid_app)); - - EXPECT_CALL(*mock_app_, UpdateHash()).Times(0); - - command_->on_event(event); + Event event(hmi_apis::FunctionID::UI_SetGlobalProperties); + event.set_smart_object(*msg_); + command->on_event(event); } } // namespace reset_global_properties diff --git a/src/components/application_manager/test/commands/mobile/scrollable_message_test.cc b/src/components/application_manager/test/commands/mobile/scrollable_message_test.cc index aba549eb34..d9fac769e5 100644 --- a/src/components/application_manager/test/commands/mobile/scrollable_message_test.cc +++ b/src/components/application_manager/test/commands/mobile/scrollable_message_test.cc @@ -61,7 +61,6 @@ using am::commands::ScrollableMessageRequest; using am::commands::CommandImpl; using am::commands::MessageSharedPtr; using am::MockMessageHelper; -using am::MockHmiInterfaces; using ::utils::SharedPtr; using ::testing::_; using ::testing::Eq; @@ -146,11 +145,6 @@ TEST_F(ScrollableMessageRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) { .WillByDefault(Return(mock_app)); ON_CALL(*mock_app, app_id()).WillByDefault(Return(kConnectionKey)); - MockHmiInterfaces hmi_interfaces; - ON_CALL(app_mngr_, hmi_interfaces()).WillByDefault(ReturnRef(hmi_interfaces)); - EXPECT_CALL(hmi_interfaces, - GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) - .WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE)); MockHMICapabilities hmi_capabilities; ON_CALL(app_mngr_, hmi_capabilities()) @@ -298,11 +292,6 @@ TEST_F(ScrollableMessageRequestTest, EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)) .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE)); - MockHmiInterfaces hmi_interfaces; - ON_CALL(app_mngr_, hmi_interfaces()).WillByDefault(ReturnRef(hmi_interfaces)); - EXPECT_CALL(hmi_interfaces, GetInterfaceState(_)) - .WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL( app_mngr_, ManageMobileCommand( diff --git a/src/components/application_manager/test/commands/mobile/send_haptic_data_test.cc b/src/components/application_manager/test/commands/mobile/send_haptic_data_test.cc new file mode 100644 index 0000000000..49483209b6 --- /dev/null +++ b/src/components/application_manager/test/commands/mobile/send_haptic_data_test.cc @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Xevo Inc. nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "gtest/gtest.h" + +#include "commands/commands_test.h" +#include "commands/command_request_test.h" + +#include "mobile/send_haptic_data_request.h" +#include "mobile/send_haptic_data_response.h" + +#include "interfaces/MOBILE_API.h" +#include "application_manager/application.h" +#include "application_manager/mock_application.h" + +namespace test { +namespace components { +namespace commands_test { +namespace mobile_commands_test { +namespace send_haptic_data { + +using ::testing::_; +using ::testing::Return; + +namespace am = ::application_manager; + +using am::commands::SendHapticDataRequest; +using am::commands::SendHapticDataResponse; +using am::commands::MessageSharedPtr; + +typedef SharedPtr<SendHapticDataRequest> SendHapticDataRequestPtr; +typedef SharedPtr<SendHapticDataResponse> SendHapticDataResponsePtr; + +namespace { +const uint32_t kConnectionKey = 1u; +} + +class SendHapticDataRequestTest + : public CommandRequestTest<CommandsTestMocks::kIsNice> { + public: + SendHapticDataRequestTest() + : msg_(CreateMessage(::smart_objects::SmartType_Map)) + , mock_app_(CreateMockApp()) {} + + void SetUp() OVERRIDE { + (*msg_)[am::strings::params][am::strings::connection_key] = kConnectionKey; + ON_CALL(app_mngr_, application(kConnectionKey)) + .WillByDefault(Return(mock_app_)); + } + + MessageSharedPtr msg_; + MockAppPtr mock_app_; +}; + +class SendHapticDataResponseTest + : public CommandsTest<CommandsTestMocks::kIsNice> { + public: + SendHapticDataResponseTest() : message_(CreateMessage()) {} + + void SetUp() OVERRIDE { + command_sptr_ = CreateCommand<SendHapticDataResponse>(message_); + } + + MessageSharedPtr message_; + SharedPtr<SendHapticDataResponse> command_sptr_; +}; + +TEST_F(SendHapticDataRequestTest, Run_SUCCESS) { + EXPECT_CALL(app_mngr_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_SendHapticData))) + .WillOnce(Return(true)); + + SendHapticDataRequestPtr command(CreateCommand<SendHapticDataRequest>(msg_)); + + command->Init(); + command->Run(); +} + +TEST_F(SendHapticDataRequestTest, OnEvent_SUCCESS) { + EXPECT_CALL( + app_mngr_, + ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), + am::commands::Command::ORIGIN_SDL)); + + (*msg_)[am::strings::msg_params] = 0; + (*msg_)[am::strings::params][am::hmi_response::code] = + hmi_apis::Common_Result::eType::SUCCESS; + Event event(hmi_apis::FunctionID::UI_SendHapticData); + event.set_smart_object(*msg_); + SendHapticDataRequestPtr command(CreateCommand<SendHapticDataRequest>(msg_)); + + command->Init(); + command->on_event(event); +} + +TEST_F(SendHapticDataResponseTest, Run_Success) { + ::smart_objects::SmartObject& message_ref = *message_; + message_ref[am::strings::msg_params][am::strings::result_code] = + mobile_apis::Result::SUCCESS; + + EXPECT_CALL( + app_mngr_, + SendMessageToMobile(MobileResultCodeIs(mobile_apis::Result::SUCCESS), _)); + command_sptr_->Init(); + command_sptr_->Run(); +} + +} // namespace send_haptic_data +} // namespace mobile_commands_test +} // namespace commands_test +} // namespace components +} // namespace test diff --git a/src/components/application_manager/test/commands/mobile/send_location_request_test.cc b/src/components/application_manager/test/commands/mobile/send_location_request_test.cc index df412695fd..03cc715188 100644 --- a/src/components/application_manager/test/commands/mobile/send_location_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/send_location_request_test.cc @@ -351,11 +351,19 @@ TEST_F(SendLocationRequestTest, Run_HMIUINotCoop_Cancelled) { TEST_F(SendLocationRequestTest, OnEvent_Success) { mobile_apis::Result::eType response_code = mobile_apis::Result::SUCCESS; (*message_)[strings::params][hmi_response::code] = response_code; + (*message_)[strings::params][strings::connection_key] = kConnectionKey; + Event event(hmi_apis::FunctionID::Navigation_SendLocation); event.set_smart_object(*message_); + EXPECT_CALL(mock_message_helper_, HMIToMobileResult(hmi_apis::Common_Result::SUCCESS)) .WillOnce(Return(mobile_apis::Result::SUCCESS)); + + MockAppPtr app(CreateMockApp()); + EXPECT_CALL(app_mngr_, application(kConnectionKey)) + .WillRepeatedly(Return(app)); + command_->on_event(event); } diff --git a/src/components/application_manager/test/commands/mobile/set_app_icon_test.cc b/src/components/application_manager/test/commands/mobile/set_app_icon_test.cc index b51b7c83ea..60b01f2cfa 100644 --- a/src/components/application_manager/test/commands/mobile/set_app_icon_test.cc +++ b/src/components/application_manager/test/commands/mobile/set_app_icon_test.cc @@ -55,7 +55,6 @@ using am::commands::SetAppIconRequest; using am::commands::CommandImpl; using am::commands::MessageSharedPtr; using am::MockMessageHelper; -using am::MockHmiInterfaces; using ::utils::SharedPtr; using ::testing::_; using ::testing::Mock; @@ -73,6 +72,15 @@ class SetAppIconRequestTest public: SetAppIconRequestTest() : mock_message_helper_(*MockMessageHelper::message_helper_mock()) {} + + void SetUp() OVERRIDE { + Mock::VerifyAndClearExpectations(&mock_message_helper_); + } + + void TearDown() OVERRIDE { + Mock::VerifyAndClearExpectations(&mock_message_helper_); + } + MockMessageHelper& mock_message_helper_; MessageSharedPtr CreateFullParamsUISO() { @@ -118,12 +126,6 @@ TEST_F(SetAppIconRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) { ON_CALL(*mock_app, set_app_icon_path(_)).WillByDefault(Return(true)); ON_CALL(*mock_app, app_icon_path()).WillByDefault(ReturnRef(file_path)); - MockHmiInterfaces hmi_interfaces; - ON_CALL(app_mngr_, hmi_interfaces()).WillByDefault(ReturnRef(hmi_interfaces)); - EXPECT_CALL(hmi_interfaces, - GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) - .WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE)); - MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map); (*msg)[am::strings::params][am::hmi_response::code] = hmi_apis::Common_Result::UNSUPPORTED_RESOURCE; @@ -158,7 +160,6 @@ TEST_F(SetAppIconRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) { .asString() .empty()); } - Mock::VerifyAndClearExpectations(&mock_message_helper_); } } // namespace set_app_icon_request diff --git a/src/components/application_manager/test/commands/mobile/set_display_layout_test.cc b/src/components/application_manager/test/commands/mobile/set_display_layout_test.cc index 0518b325ea..68aa76010f 100644 --- a/src/components/application_manager/test/commands/mobile/set_display_layout_test.cc +++ b/src/components/application_manager/test/commands/mobile/set_display_layout_test.cc @@ -57,7 +57,6 @@ using am::commands::SetDisplayLayoutRequest; using am::commands::CommandImpl; using am::commands::MessageSharedPtr; using am::MockMessageHelper; -using am::MockHmiInterfaces; using ::utils::SharedPtr; using ::testing::_; using ::testing::Mock; @@ -89,8 +88,6 @@ class SetDisplayLayoutRequestTest ON_CALL(app_mngr_, application(kConnectionKey)) .WillByDefault(Return(mock_app_)); ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey)); - ON_CALL(app_mngr_, hmi_interfaces()) - .WillByDefault(ReturnRef(hmi_interfaces_)); } ~SetDisplayLayoutRequestTest() { @@ -133,7 +130,6 @@ class SetDisplayLayoutRequestTest } sync_primitives::Lock lock_; - NiceMock<MockHmiInterfaces> hmi_interfaces_; MockMessageHelper& mock_message_helper_; MockAppPtr mock_app_; }; @@ -164,7 +160,7 @@ TEST_F(SetDisplayLayoutRequestTest, Event event(hmi_apis::FunctionID::UI_SetDisplayLayout); event.set_smart_object(*msg); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); @@ -186,6 +182,7 @@ TEST_F(SetDisplayLayoutRequestTest, Run_InvalidApp_UNSUCCESS) { MessageSharedPtr msg(CreateMessage(smart_objects::SmartType_Map)); (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey; CommandPtr command(CreateCommand<SetDisplayLayoutRequest>(msg)); + MockAppPtr invalid_mock_app; EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(invalid_mock_app)); @@ -209,8 +206,6 @@ TEST_F(SetDisplayLayoutRequestTest, Run_SUCCESS) { EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()) .WillOnce(Return(kCorrelationKey)); - EXPECT_CALL(app_mngr_, hmi_interfaces()) - .WillOnce(ReturnRef(mock_hmi_interfaces_)); EXPECT_CALL( mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetDisplayLayout)) @@ -236,14 +231,13 @@ TEST_F(SetDisplayLayoutRequestTest, OnEvent_InvalidEventId_UNSUCCESS) { } TEST_F(SetDisplayLayoutRequestTest, OnEvent_SUCCESS) { - CommandPtr command(CreateCommand<SetDisplayLayoutRequest>()); - am::event_engine::Event event(hmi_apis::FunctionID::UI_SetDisplayLayout); MessageSharedPtr msg = CreateMessage(); (*msg)[am::strings::params][am::hmi_response::code] = hmi_apis::Common_Result::SUCCESS; (*msg)[am::strings::msg_params][am::hmi_response::display_capabilities] = 0; + (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey; event.set_smart_object(*msg); MockHMICapabilities hmi_capabilities; @@ -251,17 +245,23 @@ TEST_F(SetDisplayLayoutRequestTest, OnEvent_SUCCESS) { (*dispaly_capabilities_msg)[am::hmi_response::templates_available] = "templates_available"; + EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)) + .WillOnce(Return(mobile_apis::Result::SUCCESS)); + EXPECT_CALL(app_mngr_, hmi_capabilities()) .WillOnce(ReturnRef(hmi_capabilities)); EXPECT_CALL(hmi_capabilities, display_capabilities()) .WillOnce(Return(dispaly_capabilities_msg.get())); - + ON_CALL(mock_message_helper_, + HMIToMobileResult(hmi_apis::Common_Result::eType::SUCCESS)) + .WillByDefault(Return(am::mobile_api::Result::SUCCESS)); EXPECT_CALL( app_mngr_, ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), am::commands::Command::CommandOrigin::ORIGIN_SDL)); + CommandPtr command(CreateCommand<SetDisplayLayoutRequest>(msg)); command->on_event(event); } diff --git a/src/components/application_manager/test/commands/mobile/set_global_properties_test.cc b/src/components/application_manager/test/commands/mobile/set_global_properties_test.cc index 0908b54ba7..7143bdf71a 100644 --- a/src/components/application_manager/test/commands/mobile/set_global_properties_test.cc +++ b/src/components/application_manager/test/commands/mobile/set_global_properties_test.cc @@ -55,7 +55,6 @@ using am::commands::SetGlobalPropertiesRequest; using am::commands::CommandImpl; using am::commands::MessageSharedPtr; using am::MockMessageHelper; -using am::MockHmiInterfaces; using am::CommandsMap; using utils::custom_string::CustomString; using ::utils::SharedPtr; @@ -119,8 +118,6 @@ class SetGlobalPropertiesRequestTest vr_help_array[0][am::strings::text] = kText; vr_help_array[0][am::strings::position] = kPosition; (*msg)[am::strings::msg_params][am::strings::vr_help] = vr_help_array; - EXPECT_CALL(app_mngr_, application(kConnectionKey)) - .WillOnce(Return(mock_app_)); } void OnEventUISetupHelper(MessageSharedPtr msg, @@ -155,8 +152,6 @@ class SetGlobalPropertiesRequestTest (*msg)[am::strings::msg_params][am::strings::timeout_prompt] = timeout_prompt; - EXPECT_CALL(app_mngr_, application(kConnectionKey)) - .WillOnce(Return(mock_app_)); EXPECT_CALL(mock_message_helper_, VerifyImageVrHelpItems(_, _, _)).Times(0); EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey)); @@ -216,8 +211,9 @@ class SetGlobalPropertiesRequestTest ON_CALL(app_mngr_, application(kConnectionKey)) .WillByDefault(Return(mock_app_)); ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey)); - ON_CALL(app_mngr_, hmi_interfaces()) - .WillByDefault(ReturnRef(hmi_interfaces_)); + ON_CALL(mock_hmi_interfaces_, + GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) + .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); } void TearDown() OVERRIDE { @@ -237,22 +233,21 @@ class SetGlobalPropertiesRequestTest void ExpectationsHmiInterface_Run() { EXPECT_CALL( - hmi_interfaces_, + mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetGlobalProperties)) .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); EXPECT_CALL( - hmi_interfaces_, + mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_SetGlobalProperties)) .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_TTS)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); } sync_primitives::Lock lock_; - NiceMock<MockHmiInterfaces> hmi_interfaces_; MockMessageHelper& mock_message_helper_; MockAppPtr mock_app_; }; @@ -297,8 +292,6 @@ TEST_F(SetGlobalPropertiesRequestTest, ON_CALL(mock_message_helper_, VerifyImage(_, _, _)) .WillByDefault(Return(mobile_apis::Result::SUCCESS)); - EXPECT_CALL(*mock_app_, UpdateHash()); - (*msg_vr)[am::strings::params][am::hmi_response::code] = hmi_apis::Common_Result::SUCCESS; Event event_vr(hmi_apis::FunctionID::TTS_SetGlobalProperties); @@ -330,9 +323,6 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_SUCCESS_Expect_MessageNotSend) { utils::SharedPtr<SetGlobalPropertiesRequest> command = CreateCommand<SetGlobalPropertiesRequest>(response); - MockAppPtr mock_app(CreateMockApp()); - ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app)); - EXPECT_CALL( app_mngr_, ManageMobileCommand(_, am::commands::Command::CommandOrigin::ORIGIN_SDL)) @@ -345,6 +335,8 @@ TEST_F(SetGlobalPropertiesRequestTest, MessageSharedPtr response = CreateMessage(smart_objects::SmartType_Map); (*response)[am::strings::params][am::hmi_response::code] = hmi_apis::Common_Result::SUCCESS; + (*response)[am::strings::params][am::strings::connection_key] = + kConnectionKey; (*response)[am::strings::msg_params][am::strings::info] = "qwe"; am::event_engine::Event event_tts( @@ -356,16 +348,10 @@ TEST_F(SetGlobalPropertiesRequestTest, utils::SharedPtr<SetGlobalPropertiesRequest> command = CreateCommand<SetGlobalPropertiesRequest>(response); - MockAppPtr mock_app(CreateMockApp()); - ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app)); - ON_CALL(mock_message_helper_, HMIToMobileResult(_)) .WillByDefault(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE)); - MockHmiInterfaces hmi_interfaces; - EXPECT_CALL(app_mngr_, hmi_interfaces()) - .WillRepeatedly(ReturnRef(hmi_interfaces)); - EXPECT_CALL(hmi_interfaces, GetInterfaceState(_)) + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); MessageSharedPtr response_to_mobile; @@ -393,11 +379,11 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_VRNoMenuAndKeyboard_SUCCESS) { SharedPtr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); EXPECT_CALL( - hmi_interfaces_, + mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetGlobalProperties)) .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); @@ -434,11 +420,11 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_VRWithMenuAndKeyboard_SUCCESS) { EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId)); EXPECT_CALL( - hmi_interfaces_, + mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetGlobalProperties)) .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); @@ -595,10 +581,10 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoVR_SUCCESS) { EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId)); EXPECT_CALL( - hmi_interfaces_, + mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetGlobalProperties)) .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); @@ -667,10 +653,10 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoVRNoDataNoDefault_Canceled) { EXPECT_CALL(*mock_app_, app_id()); EXPECT_CALL( - hmi_interfaces_, + mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetGlobalProperties)) .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); @@ -712,10 +698,10 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoVRNoDataDefaultCreated_SUCCESS) { EXPECT_CALL(*mock_app_, set_keyboard_props(keyboard_properties)); EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId)); EXPECT_CALL( - hmi_interfaces_, + mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetGlobalProperties)) .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); @@ -757,10 +743,10 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoVRNoDataFromSynonyms_SUCCESS) { EXPECT_CALL(*mock_app_, set_keyboard_props(keyboard_properties)); EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId)); EXPECT_CALL( - hmi_interfaces_, + mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetGlobalProperties)) .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); SharedPtr<SetGlobalPropertiesRequest> command( @@ -791,10 +777,10 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_TTSHelpAndTimeout_SUCCESS) { EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId)); EXPECT_CALL( - hmi_interfaces_, + mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_SetGlobalProperties)) .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_TTS)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); @@ -822,10 +808,10 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_TTSOnlyHelp_SUCCESS) { EXPECT_CALL(*mock_app_, timeout_prompt()).Times(0); EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId)); EXPECT_CALL( - hmi_interfaces_, + mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_SetGlobalProperties)) .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_TTS)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); SharedPtr<SetGlobalPropertiesRequest> command( @@ -852,10 +838,10 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_TTSOnlyTimeout_SUCCESS) { EXPECT_CALL(*mock_app_, timeout_prompt()).WillOnce(Return(&timeout_prompt)); EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId)); EXPECT_CALL( - hmi_interfaces_, + mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_SetGlobalProperties)) .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_TTS)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); SharedPtr<SetGlobalPropertiesRequest> command( @@ -1060,16 +1046,16 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_UIAndSuccessResultCode_SUCCESS) { hmi_apis::Common_Result::SUCCESS; (*msg)[am::strings::params][am::hmi_response::code] = response_code; - SharedPtr<SetGlobalPropertiesRequest> command( - CreateCommand<SetGlobalPropertiesRequest>(msg)); ON_CALL( - hmi_interfaces_, + mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetGlobalProperties)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); + SharedPtr<SetGlobalPropertiesRequest> command( + CreateCommand<SetGlobalPropertiesRequest>(msg)); OnEventUISetupHelper(msg, command); Event event(hmi_apis::FunctionID::UI_SetGlobalProperties); @@ -1077,11 +1063,8 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_UIAndSuccessResultCode_SUCCESS) { EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)) .WillOnce(Return(mobile_apis::Result::SUCCESS)); - EXPECT_CALL(app_mngr_, application(kConnectionKey)) - .WillOnce(Return(mock_app_)); - EXPECT_CALL(*mock_app_, UpdateHash()); - EXPECT_CALL(hmi_interfaces_, GetInterfaceState(_)) + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); EXPECT_CALL(app_mngr_, @@ -1100,23 +1083,20 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_UIAndWarningResultCode_SUCCESS) { SharedPtr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); ON_CALL( - hmi_interfaces_, + mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetGlobalProperties)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); OnEventUISetupHelper(msg, command); EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)).Times(0); - EXPECT_CALL(app_mngr_, application(kConnectionKey)) - .WillOnce(Return(mock_app_)); - EXPECT_CALL(*mock_app_, UpdateHash()); Event event(hmi_apis::FunctionID::UI_SetGlobalProperties); event.set_smart_object(*msg); - EXPECT_CALL(hmi_interfaces_, GetInterfaceState(_)) + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)) .WillOnce(Return(mobile_apis::Result::SUCCESS)); @@ -1133,23 +1113,25 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_InvalidApp_Canceled) { hmi_apis::Common_Result::WARNINGS; (*msg)[am::strings::params][am::hmi_response::code] = response_code; ON_CALL( - hmi_interfaces_, + mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetGlobalProperties)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); SharedPtr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); OnEventUISetupHelper(msg, command); - EXPECT_CALL(hmi_interfaces_, GetInterfaceState(_)) + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)) .WillOnce(Return(mobile_apis::Result::SUCCESS)); + EXPECT_CALL(app_mngr_, application(kConnectionKey)) - .WillOnce(Return(MockAppPtr())); + .WillRepeatedly(Return(MockAppPtr())); + EXPECT_CALL(*mock_app_, UpdateHash()).Times(0); Event event(hmi_apis::FunctionID::UI_SetGlobalProperties); @@ -1181,17 +1163,17 @@ TEST_F(SetGlobalPropertiesRequestTest, hmi_apis::Common_Result::SUCCESS; (*msg)[am::strings::params][am::hmi_response::code] = response_code; ON_CALL( - hmi_interfaces_, + mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_SetGlobalProperties)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_TTS)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); SharedPtr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); OnEventTTSSetupHelper(msg, command); - EXPECT_CALL(hmi_interfaces_, GetInterfaceState(_)) + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); EXPECT_CALL(app_mngr_, @@ -1200,9 +1182,6 @@ TEST_F(SetGlobalPropertiesRequestTest, EXPECT_CALL(mock_message_helper_, HMIToMobileResult(response_code)) .WillOnce(Return(mobile_apis::Result::SUCCESS)); - EXPECT_CALL(app_mngr_, application(kConnectionKey)) - .WillOnce(Return(mock_app_)); - EXPECT_CALL(*mock_app_, UpdateHash()); Event event(hmi_apis::FunctionID::TTS_SetGlobalProperties); event.set_smart_object(*msg); @@ -1217,10 +1196,10 @@ TEST_F(SetGlobalPropertiesRequestTest, hmi_apis::Common_Result::WARNINGS; (*msg)[am::strings::params][am::hmi_response::code] = response_code; ON_CALL( - hmi_interfaces_, + mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_SetGlobalProperties)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_TTS)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); SharedPtr<SetGlobalPropertiesRequest> command( @@ -1228,7 +1207,7 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEventTTSSetupHelper(msg, command); - EXPECT_CALL(hmi_interfaces_, GetInterfaceState(_)) + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); EXPECT_CALL(app_mngr_, @@ -1237,9 +1216,6 @@ TEST_F(SetGlobalPropertiesRequestTest, EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)) .WillOnce(Return(mobile_apis::Result::SUCCESS)); - EXPECT_CALL(app_mngr_, application(kConnectionKey)) - .WillOnce(Return(mock_app_)); - EXPECT_CALL(*mock_app_, UpdateHash()); Event event(hmi_apis::FunctionID::TTS_SetGlobalProperties); event.set_smart_object(*msg); diff --git a/src/components/application_manager/test/commands/mobile/set_media_clock_timer_test.cc b/src/components/application_manager/test/commands/mobile/set_media_clock_timer_test.cc index da6f29cf5e..3056d0e9fc 100644 --- a/src/components/application_manager/test/commands/mobile/set_media_clock_timer_test.cc +++ b/src/components/application_manager/test/commands/mobile/set_media_clock_timer_test.cc @@ -53,7 +53,6 @@ namespace am = ::application_manager; using am::commands::SetMediaClockRequest; using am::commands::MessageSharedPtr; using am::event_engine::Event; -using am::MockHmiInterfaces; using am::MockMessageHelper; using ::testing::_; using ::testing::Mock; @@ -84,8 +83,6 @@ class SetMediaClockRequestTest ON_CALL(app_mngr_, application(kConnectionKey)) .WillByDefault(Return(mock_app_)); ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey)); - ON_CALL(app_mngr_, hmi_interfaces()) - .WillByDefault(ReturnRef(hmi_interfaces_)); } void TearDown() OVERRIDE { @@ -117,7 +114,6 @@ class SetMediaClockRequestTest EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)); } - NiceMock<MockHmiInterfaces> hmi_interfaces_; MockMessageHelper& mock_message_helper_; MockAppPtr mock_app_; }; @@ -140,7 +136,7 @@ TEST_F(SetMediaClockRequestTest, Event event(hmi_apis::FunctionID::UI_SetMediaClockTimer); event.set_smart_object(*ev_msg); - EXPECT_CALL(hmi_interfaces_, + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_RESPONSE)); @@ -183,10 +179,10 @@ TEST_F(SetMediaClockRequestTest, Run_UpdateCountUp_SUCCESS) { EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppID)); EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()) .WillOnce(Return(kCorrelationId)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetMediaClockTimer)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); EXPECT_CALL(app_mngr_, ManageHMICommand(_)).WillOnce(Return(true)); @@ -218,10 +214,10 @@ TEST_F(SetMediaClockRequestTest, Run_UpdateCountDown_SUCCESS) { EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppID)); EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()) .WillOnce(Return(kCorrelationId)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetMediaClockTimer)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); - ON_CALL(hmi_interfaces_, + ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); EXPECT_CALL(app_mngr_, ManageHMICommand(_)).WillOnce(Return(true)); @@ -340,6 +336,9 @@ TEST_F(SetMediaClockRequestTest, OnEvent_Success) { EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)); + MockAppPtr app(CreateMockApp()); + EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app)); + Event event(hmi_apis::FunctionID::UI_SetMediaClockTimer); event.set_smart_object(*msg); diff --git a/src/components/application_manager/test/commands/mobile/show_test.cc b/src/components/application_manager/test/commands/mobile/show_test.cc index 2d2e19cbf2..29ab902f5c 100644 --- a/src/components/application_manager/test/commands/mobile/show_test.cc +++ b/src/components/application_manager/test/commands/mobile/show_test.cc @@ -56,7 +56,6 @@ using am::commands::ShowRequest; using am::commands::CommandImpl; using am::commands::MessageSharedPtr; using am::MockMessageHelper; -using am::MockHmiInterfaces; using test::components::policy_test::MockPolicyHandlerInterface; using ::utils::SharedPtr; using ::testing::_; @@ -151,6 +150,59 @@ class ShowRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0); } + void TestSetupHelperWithMetadata( + MessageSharedPtr msg, + hmi_apis::Common_TextFieldName::eType field_name, + const char* field, + size_t num_tags, + int32_t* field_tags, + bool set_field_text = true) { + SmartObject msg_params(smart_objects::SmartType_Map); + (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey; + (*msg)[am::strings::params][am::strings::function_id] = kFunctionID; + if (set_field_text) { + msg_params[field] = text_field_; + } + msg_params[am::strings::metadata_tags][field] = + smart_objects::SmartObject(smart_objects::SmartType_Array); + for (size_t i = 0; i < num_tags; ++i) { + const int32_t current_tag = field_tags[i]; + msg_params[am::strings::metadata_tags][field][i] = current_tag; + } + (*msg)[am::strings::msg_params] = msg_params; + + EXPECT_EQ((*msg)[am::strings::msg_params], msg_params); + + EXPECT_CALL(app_mngr_, application(kConnectionKey)) + .WillOnce(Return(mock_app_)); + EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId)); + + msg_params.erase(field); + msg_params.erase(am::strings::metadata_tags); + + msg_params[am::strings::app_id] = kAppId; + msg_params[am::hmi_request::show_strings] = + smart_objects::SmartObject(smart_objects::SmartType_Array); + if (set_field_text) { + msg_params[am::hmi_request::show_strings][0] + [am::hmi_request::field_name] = + static_cast<int32_t>(field_name); + msg_params[am::hmi_request::show_strings][0] + [am::hmi_request::field_text] = text_field_; + msg_params[am::hmi_request::show_strings][0] + [am::hmi_request::field_types] = + smart_objects::SmartObject(smart_objects::SmartType_Array); + for (size_t i = 0; i < num_tags; ++i) { + const int32_t current_tag = field_tags[i]; + msg_params[am::hmi_request::show_strings][0] + [am::hmi_request::field_types][i] = current_tag; + } + } + + EXPECT_CALL(app_mngr_, ManageHMICommand(_)); + EXPECT_CALL(*mock_app_, set_show_command(msg_params)); + } + void SetUp() OVERRIDE { Mock::VerifyAndClearExpectations(&mock_message_helper_); } @@ -177,13 +229,6 @@ TEST_F(ShowRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) { ON_CALL(app_mngr_, application(kConnectionKey)) .WillByDefault(Return(mock_app)); ON_CALL(*mock_app, app_id()).WillByDefault(Return(kConnectionKey)); - MockHmiInterfaces hmi_interfaces; - ON_CALL(app_mngr_, hmi_interfaces()).WillByDefault(ReturnRef(hmi_interfaces)); - ON_CALL(hmi_interfaces, GetInterfaceFromFunction(_)) - .WillByDefault( - Return(am::HmiInterfaces::HMI_INTERFACE_BasicCommunication)); - ON_CALL(hmi_interfaces, GetInterfaceState(_)) - .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map); (*msg)[am::strings::params][am::hmi_response::code] = @@ -590,6 +635,132 @@ TEST_F(ShowRequestTest, Run_MainField4_WrongSyntax) { command->Run(); } +TEST_F(ShowRequestTest, Run_MainField1_MetadataTag) { + MessageSharedPtr msg = CreateMsgParams(); + + SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + + text_field_ = "Main_Field_1"; + const size_t num_tags = 1; + int32_t tags[num_tags] = {hmi_apis::Common_MetadataType::mediaArtist}; + TestSetupHelperWithMetadata(msg, + hmi_apis::Common_TextFieldName::mainField1, + am::strings::main_field_1, + num_tags, + tags); + command->Run(); +} + +TEST_F(ShowRequestTest, Run_MainField1_MultipleMetadataTags) { + MessageSharedPtr msg = CreateMsgParams(); + + SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + + text_field_ = "Main_Field_1"; + const size_t num_tags = 5; + int32_t tags[num_tags] = {hmi_apis::Common_MetadataType::mediaTitle, + hmi_apis::Common_MetadataType::mediaArtist, + hmi_apis::Common_MetadataType::rating, + hmi_apis::Common_MetadataType::humidity, + hmi_apis::Common_MetadataType::currentTemperature}; + TestSetupHelperWithMetadata(msg, + hmi_apis::Common_TextFieldName::mainField1, + am::strings::main_field_1, + num_tags, + tags); + command->Run(); +} + +TEST_F(ShowRequestTest, Run_MainField2_MetadataTag) { + MessageSharedPtr msg = CreateMsgParams(); + + SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + + text_field_ = "Main_Field_2"; + const size_t num_tags = 1; + int32_t tags[num_tags] = {hmi_apis::Common_MetadataType::mediaArtist}; + TestSetupHelperWithMetadata(msg, + hmi_apis::Common_TextFieldName::mainField2, + am::strings::main_field_2, + num_tags, + tags); + command->Run(); +} + +TEST_F(ShowRequestTest, Run_MainField3_MetadataTag) { + MessageSharedPtr msg = CreateMsgParams(); + + SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + + text_field_ = "Main_Field_3"; + const size_t num_tags = 1; + int32_t tags[num_tags] = {hmi_apis::Common_MetadataType::mediaArtist}; + TestSetupHelperWithMetadata(msg, + hmi_apis::Common_TextFieldName::mainField3, + am::strings::main_field_3, + num_tags, + tags); + command->Run(); +} + +TEST_F(ShowRequestTest, Run_MainField4_MetadataTag) { + MessageSharedPtr msg = CreateMsgParams(); + + SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + + text_field_ = "Main_Field_4"; + const size_t num_tags = 1; + int32_t tags[num_tags] = {hmi_apis::Common_MetadataType::mediaArtist}; + TestSetupHelperWithMetadata(msg, + hmi_apis::Common_TextFieldName::mainField4, + am::strings::main_field_4, + num_tags, + tags); + command->Run(); +} + +TEST_F(ShowRequestTest, Run_MainField1_MetadataTagWithNoFieldData) { + MessageSharedPtr msg = CreateMsgParams(); + + SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + + text_field_ = "Main_Field_1"; + const size_t num_tags = 1; + int32_t tags[num_tags] = {hmi_apis::Common_MetadataType::mediaArtist}; + TestSetupHelperWithMetadata(msg, + hmi_apis::Common_TextFieldName::mainField1, + am::strings::main_field_1, + num_tags, + tags, + false); + command->Run(); + + MessageSharedPtr ev_msg = CreateMessage(smart_objects::SmartType_Map); + (*ev_msg)[am::strings::params][am::hmi_response::code] = + hmi_apis::Common_Result::SUCCESS; + (*ev_msg)[am::strings::msg_params][am::strings::app_id] = kConnectionKey; + (*ev_msg)[am::strings::msg_params][am::strings::info] = ""; + + Event event(hmi_apis::FunctionID::UI_Show); + event.set_smart_object(*ev_msg); + + MessageSharedPtr ui_command_result; + EXPECT_CALL( + app_mngr_, + ManageMobileCommand(_, am::commands::Command::CommandOrigin::ORIGIN_SDL)) + .WillOnce(DoAll(SaveArg<0>(&ui_command_result), Return(true))); + + command->on_event(event); + + EXPECT_EQ((*ui_command_result)[am::strings::msg_params][am::strings::success] + .asBool(), + true); + EXPECT_EQ( + (*ui_command_result)[am::strings::msg_params][am::strings::result_code] + .asInt(), + static_cast<int32_t>(mobile_apis::Result::WARNINGS)); +} + TEST_F(ShowRequestTest, Run_MediaClock_SUCCESS) { MessageSharedPtr msg = CreateMsgParams(); @@ -760,16 +931,23 @@ TEST_F(ShowRequestTest, Run_EmptyParams_Canceled) { TEST_F(ShowRequestTest, OnEvent_SuccessResultCode_SUCCESS) { MessageSharedPtr msg = CreateMessage(); (*msg)[am::strings::params][am::hmi_response::code] = - mobile_apis::Result::SUCCESS; + hmi_apis::Common_Result::eType::SUCCESS; (*msg)[am::strings::msg_params] = SmartObject(smart_objects::SmartType_Map); SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); - EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)); + ON_CALL(mock_message_helper_, + HMIToMobileResult(hmi_apis::Common_Result::eType::SUCCESS)) + .WillByDefault(Return(am::mobile_api::Result::SUCCESS)); + EXPECT_CALL(app_mngr_, + ManageMobileCommand( + MobileResultCodeIs(mobile_apis::Result::eType::SUCCESS), _)); Event event(hmi_apis::FunctionID::UI_Show); event.set_smart_object(*msg); + EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app_)); + command->on_event(event); } @@ -782,11 +960,16 @@ TEST_F(ShowRequestTest, OnEvent_WarningsResultCode_SUCCESS) { SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + EXPECT_CALL(mock_message_helper_, + HMIToMobileResult(hmi_apis::Common_Result::WARNINGS)) + .WillOnce(Return(mobile_apis::Result::WARNINGS)); EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)); Event event(hmi_apis::FunctionID::UI_Show); event.set_smart_object(*msg); + EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app_)); + command->on_event(event); } diff --git a/src/components/application_manager/test/commands/mobile/slider_test.cc b/src/components/application_manager/test/commands/mobile/slider_test.cc index 7f260f7ddb..20262ed35a 100644 --- a/src/components/application_manager/test/commands/mobile/slider_test.cc +++ b/src/components/application_manager/test/commands/mobile/slider_test.cc @@ -56,7 +56,6 @@ using am::commands::SliderRequest; using am::commands::CommandImpl; using am::commands::MessageSharedPtr; using am::MockMessageHelper; -using am::MockHmiInterfaces; using policy_test::MockPolicyHandlerInterface; using ::utils::SharedPtr; using ::testing::_; @@ -159,11 +158,6 @@ TEST_F(SliderRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) { .WillByDefault(Return(mock_app)); ON_CALL(*mock_app, app_id()).WillByDefault(Return(kConnectionKey)); - MockHmiInterfaces hmi_interfaces; - ON_CALL(app_mngr_, hmi_interfaces()).WillByDefault(ReturnRef(hmi_interfaces)); - EXPECT_CALL(hmi_interfaces, - GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) - .WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE)); MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map); (*msg)[am::strings::params][am::hmi_response::code] = diff --git a/src/components/application_manager/test/commands/mobile/speak_request_test.cc b/src/components/application_manager/test/commands/mobile/speak_request_test.cc index 58eec42902..f8a7d22b40 100644 --- a/src/components/application_manager/test/commands/mobile/speak_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/speak_request_test.cc @@ -67,7 +67,6 @@ using am::ApplicationManager; using am::commands::MessageSharedPtr; using am::ApplicationSharedPtr; using am::MockMessageHelper; -using am::MockHmiInterfaces; using ::testing::_; using ::utils::SharedPtr; using ::testing::Return; @@ -113,10 +112,8 @@ class SpeakRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app)); MessageSharedPtr response_to_mobile; - MockHmiInterfaces hmi_interfaces; - EXPECT_CALL(app_mngr_, hmi_interfaces()) - .WillOnce(ReturnRef(hmi_interfaces)); - EXPECT_CALL(hmi_interfaces, GetInterfaceState(_)).WillOnce(Return(state)); + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) + .WillRepeatedly(Return(state)); MockMessageHelper* mock_message_helper = MockMessageHelper::message_helper_mock(); EXPECT_CALL(*mock_message_helper, HMIToMobileResult(_)) diff --git a/src/components/application_manager/test/commands/mobile/subscribe_way_points_request_test.cc b/src/components/application_manager/test/commands/mobile/subscribe_way_points_request_test.cc index 66cd740bbe..4546293172 100644 --- a/src/components/application_manager/test/commands/mobile/subscribe_way_points_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/subscribe_way_points_request_test.cc @@ -83,6 +83,7 @@ TEST_F(SubscribeWayPointsRequestTest, Run_SUCCESS) { EXPECT_CALL(*app, UpdateHash()); } + command->Init(); MessageSharedPtr mobile_result_msg( CatchMobileCommandResult(CallRun(*command))); @@ -120,6 +121,7 @@ TEST_F(SubscribeWayPointsRequestTest, OnEvent_SUCCESS) { EXPECT_CALL(*app, UpdateHash()); } + command->Init(); command->on_event(event); Mock::VerifyAndClearExpectations(mock_message_helper); diff --git a/src/components/application_manager/test/commands/mobile/unregister_app_interface_request_test.cc b/src/components/application_manager/test/commands/mobile/unregister_app_interface_request_test.cc index 7cc5e59470..ae4e46d40b 100644 --- a/src/components/application_manager/test/commands/mobile/unregister_app_interface_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/unregister_app_interface_request_test.cc @@ -84,7 +84,7 @@ TEST_F(UnregisterAppInterfaceRequestTest, Run_SUCCESS) { MockAppPtr mock_app(CreateMockApp()); EXPECT_CALL(app_mngr_, application(kConnectionKey)) - .WillOnce(Return(mock_app)); + .WillRepeatedly(Return(mock_app)); const mobile_apis::AppInterfaceUnregisteredReason::eType kUnregisterReason = mobile_apis::AppInterfaceUnregisteredReason::INVALID_ENUM; diff --git a/src/components/application_manager/test/commands/mobile/unsubscribe_button_request_test.cc b/src/components/application_manager/test/commands/mobile/unsubscribe_button_request_test.cc index a71f8a43c8..46a1ce02eb 100644 --- a/src/components/application_manager/test/commands/mobile/unsubscribe_button_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/unsubscribe_button_request_test.cc @@ -6,6 +6,7 @@ #include "application_manager/commands/command_request_test.h" #include "application_manager/mock_application_manager.h" #include "application_manager/mock_message_helper.h" +#include "application_manager/mock_hmi_capabilities.h" #include "application_manager/commands/mobile/unsubscribe_button_request.h" namespace test { @@ -30,7 +31,13 @@ const mobile_apis::ButtonName::eType kButtonId = mobile_apis::ButtonName::OK; } // namespace class UnsubscribeButtonRequestTest - : public CommandRequestTest<CommandsTestMocks::kIsNice> {}; + : public CommandRequestTest<CommandsTestMocks::kIsNice> { + public: + typedef TypeIf<kMocksAreNice, + NiceMock<application_manager_test::MockHMICapabilities>, + application_manager_test::MockHMICapabilities>::Result + MockHMICapabilities; +}; TEST_F(UnsubscribeButtonRequestTest, Run_AppNotRegistered_UNSUCCESS) { CommandPtr command(CreateCommand<UnsubscribeButtonRequest>()); @@ -55,13 +62,21 @@ TEST_F(UnsubscribeButtonRequestTest, CommandPtr command(CreateCommand<UnsubscribeButtonRequest>(command_msg)); + UnsubscribeButtonRequestTest::MockHMICapabilities hmi_capabilities; + EXPECT_CALL(app_mngr_, hmi_capabilities()) + .WillOnce(ReturnRef(hmi_capabilities)); + EXPECT_CALL(hmi_capabilities, is_ui_cooperating()).WillOnce(Return(true)); + + MessageSharedPtr button_caps_ptr(CreateMessage(smart_objects::SmartType_Map)); + (*button_caps_ptr)[0][am::hmi_response::button_name] = kButtonId; + EXPECT_CALL(hmi_capabilities, button_capabilities()) + .WillOnce(Return(button_caps_ptr.get())); + MockAppPtr mock_app(CreateMockApp()); EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(mock_app)); - EXPECT_CALL(*mock_app, UnsubscribeFromButton(kButtonId)) .WillOnce(Return(false)); - EXPECT_CALL( app_mngr_, ManageMobileCommand(MobileResultCodeIs(mobile_result::IGNORED), _)); @@ -69,9 +84,35 @@ TEST_F(UnsubscribeButtonRequestTest, command->Run(); } -TEST_F(UnsubscribeButtonRequestTest, Run_SUCCESS) { - const mobile_apis::ButtonName::eType kButtonId = mobile_apis::ButtonName::OK; +TEST_F(UnsubscribeButtonRequestTest, + Run_UnsubscribeNotAllowedByHmiCapabilities_UNSUCCESS) { + MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map)); + (*command_msg)[am::strings::params][am::strings::connection_key] = + kConnectionKey; + (*command_msg)[am::strings::msg_params][am::strings::button_name] = kButtonId; + CommandPtr command(CreateCommand<UnsubscribeButtonRequest>(command_msg)); + MockAppPtr mock_app(CreateMockApp()); + EXPECT_CALL(app_mngr_, application(kConnectionKey)) + .WillOnce(Return(mock_app)); + + UnsubscribeButtonRequestTest::MockHMICapabilities hmi_capabilities; + EXPECT_CALL(app_mngr_, hmi_capabilities()) + .WillOnce(ReturnRef(hmi_capabilities)); + EXPECT_CALL(hmi_capabilities, is_ui_cooperating()).WillOnce(Return(true)); + + MessageSharedPtr button_caps_ptr(CreateMessage(smart_objects::SmartType_Map)); + EXPECT_CALL(hmi_capabilities, button_capabilities()) + .WillOnce(Return(button_caps_ptr.get())); + + EXPECT_CALL(app_mngr_, + ManageMobileCommand( + MobileResultCodeIs(mobile_result::UNSUPPORTED_RESOURCE), _)); + + command->Run(); +} + +TEST_F(UnsubscribeButtonRequestTest, Run_SUCCESS) { MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map)); (*command_msg)[am::strings::params][am::strings::connection_key] = kConnectionKey; @@ -79,9 +120,19 @@ TEST_F(UnsubscribeButtonRequestTest, Run_SUCCESS) { CommandPtr command(CreateCommand<UnsubscribeButtonRequest>(command_msg)); + UnsubscribeButtonRequestTest::MockHMICapabilities hmi_capabilities; + EXPECT_CALL(app_mngr_, hmi_capabilities()) + .WillOnce(ReturnRef(hmi_capabilities)); + EXPECT_CALL(hmi_capabilities, is_ui_cooperating()).WillOnce(Return(true)); + + MessageSharedPtr button_caps_ptr(CreateMessage(smart_objects::SmartType_Map)); + (*button_caps_ptr)[0][am::hmi_response::button_name] = kButtonId; + EXPECT_CALL(hmi_capabilities, button_capabilities()) + .WillOnce(Return(button_caps_ptr.get())); + MockAppPtr mock_app(CreateMockApp()); EXPECT_CALL(app_mngr_, application(kConnectionKey)) - .WillOnce(Return(mock_app)); + .WillRepeatedly(Return(mock_app)); EXPECT_CALL(*mock_app, UnsubscribeFromButton(kButtonId)) .WillOnce(Return(true)); @@ -94,7 +145,7 @@ TEST_F(UnsubscribeButtonRequestTest, Run_SUCCESS) { ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _)); EXPECT_CALL(*mock_app, UpdateHash()); - + command->Init(); command->Run(); } diff --git a/src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc b/src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc index eae368347e..9652364646 100644 --- a/src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc @@ -181,22 +181,26 @@ void UnsubscribeVehicleRequestTest::UnsubscribeSuccessfully() { (*command_msg)[am::strings::params][am::strings::connection_key] = kConnectionKey; (*command_msg)[am::strings::msg_params][kMsgParamKey] = true; + am::VehicleData vehicle_data; vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType)); + EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data()) .WillOnce(ReturnRef(vehicle_data)); - CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg)); am::ApplicationSet application_set_; MockAppPtr mock_app(CreateMockApp()); application_set_.insert(mock_app); DataAccessor<am::ApplicationSet> accessor(application_set_, app_set_lock_); + EXPECT_CALL(app_mngr_, application(kConnectionKey)) - .WillOnce(Return(mock_app)); - EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor)); + .WillRepeatedly(Return(mock_app)); + + EXPECT_CALL(app_mngr_, applications()).WillRepeatedly(Return(accessor)); EXPECT_CALL(*mock_app, IsSubscribedToIVI(kVehicleType)) .WillRepeatedly(Return(true)); + EXPECT_CALL(*mock_app, UnsubscribeFromIVI(kVehicleType)) .WillRepeatedly(Return(true)); @@ -204,6 +208,7 @@ void UnsubscribeVehicleRequestTest::UnsubscribeSuccessfully() { app_mngr_, ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _)); + CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg)); command->Run(); } @@ -230,6 +235,7 @@ TEST_F(UnsubscribeVehicleRequestTest, OnEvent_DataNotSubscribed_IGNORED) { EXPECT_CALL( app_mngr_, ManageMobileCommand(MobileResultCodeIs(mobile_result::IGNORED), _)); + command->Init(); command->Run(); am::event_engine::Event test_event( @@ -274,15 +280,10 @@ TEST_F(UnsubscribeVehicleRequestTest, OnEvent_DataUnsubscribed_SUCCESS) { EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), HMIToMobileResult(hmi_result)).WillOnce(Return(mob_result)); - EXPECT_CALL(app_mngr_, application(kConnectionKey)) - .WillOnce(Return(mock_app)); - EXPECT_CALL( app_mngr_, ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _)); - EXPECT_CALL(*mock_app, UpdateHash()); - command->on_event(test_event); } diff --git a/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc b/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc index 738cf35553..50567a7c62 100644 --- a/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc @@ -152,7 +152,7 @@ TEST_F(UnSubscribeWayPointsRequestTest, OnEvent_ReceivedNavigationUnSubscribeWayPointsEvent_SUCCESS) { MockAppPtr mock_app(CreateMockApp()); EXPECT_CALL(app_mngr_, application(kConnectionKey)) - .WillOnce(Return(mock_app)); + .WillRepeatedly(Return(mock_app)); MessageSharedPtr event_msg(CreateMessage(smart_objects::SmartType_Map)); (*event_msg)[am::strings::msg_params] = 0; diff --git a/src/components/application_manager/test/hmi_capabilities.json b/src/components/application_manager/test/hmi_capabilities.json index 61cda5ce43..9db6ee78ae 100644 --- a/src/components/application_manager/test/hmi_capabilities.json +++ b/src/components/application_manager/test/hmi_capabilities.json @@ -1,465 +1,699 @@ { - "UI": - { + "UI": { "language":"EN_US", "languages":[ - "EN_US","ES_MX","FR_CA","DE_DE","ES_ES","EN_GB","RU_RU","TR_TR","PL_PL","FR_FR","IT_IT","SV_SE","PT_PT","NL_NL","ZH_TW", -"JA_JP","AR_SA","KO_KR","PT_BR","CS_CZ","DA_DK","NO_NO" + "EN_US", + "ES_MX", + "FR_CA", + "DE_DE", + "ES_ES", + "EN_GB", + "RU_RU", + "TR_TR", + "PL_PL", + "FR_FR", + "IT_IT", + "SV_SE", + "PT_PT", + "NL_NL", + "ZH_TW", + "JA_JP", + "AR_SA", + "KO_KR", + "PT_BR", + "CS_CZ", + "DA_DK", + "NO_NO", + "NL_BE", + "EL_GR", + "HU_HU", + "FI_FI", + "SK_SK", + "EN_IN", + "TH_TH", + "EN_SA", + "HE_IL", + "RO_RO", + "UK_UA", + "ID_ID", + "VI_VN", + "MS_MY", + "HI_IN" ], - "displayCapabilities": + "displayCapabilities": { + "displayType": "GEN2_8_DMA", + "textFields": [ { - "displayType":"GEN2_8_DMA", - "textFields": [{ - "name": "mainField1", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "mainField2", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "mainField3", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "mainField4", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "statusBar", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "mediaClock", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "mediaTrack", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "alertText1", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "alertText2", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "alertText3", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "scrollableMessageBody", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "initialInteractionText", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "navigationText1", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "navigationText2", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "ETA", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "totalDistance", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "navigationText", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "audioPassThruDisplayText1", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "audioPassThruDisplayText2", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "sliderHeader", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "sliderFooter", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "notificationText", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "menuName", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "secondaryText", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "tertiaryText", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "timeToDestination", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "turnText", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - }, - { - "name": "menuTitle", - "characterSet": "TYPE2SET", - "width": 500, - "rows": 1 - } - ], - "imageFields": - [ - { - "name":"softButtonImage", - "imageTypeSupported": - [ - ], - "imageResolution": - { - "resolutionWidth":35, - "resolutionHeight":35 - } - }, - { - "name":"choiceImage", - "imageTypeSupported": - [ - ], - "imageResolution": - { - "resolutionWidth":35, - "resolutionHeight":35 - } - }, - { - "name":"choiceSecondaryImage", - "imageTypeSupported": - [ - ], - "imageResolution": - { - "resolutionWidth":35, - "resolutionHeight":35 - } - }, - { - "name":"menuIcon", - "imageTypeSupported": - [ - ], - "imageResolution": - { - "resolutionWidth":35, - "resolutionHeight":35 - } - }, - { - "name":"cmdIcon", - "imageTypeSupported": - [ - ], - "imageResolution": - { - "resolutionWidth":35, - "resolutionHeight":35 - } - }, - { - "name":"appIcon", - "imageTypeSupported": - [ - ], - "imageResolution": - { - "resolutionWidth":35, - "resolutionHeight":35 - } - }, - { - "name":"graphic", - "imageTypeSupported": - [ - - ], - "imageResolution": - { - "resolutionWidth":35, - "resolutionHeight":35 - } - }, - { - "name":"locationImage", - "imageTypeSupported": - [ - "GRAPHIC_PNG" - ], - "imageResolution": - { - "resolutionWidth":35, - "resolutionHeight":35 - } - } + "name": "mainField1", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "mainField2", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "mainField3", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "mainField4", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "statusBar", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "mediaClock", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "mediaTrack", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "alertText1", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "alertText2", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "alertText3", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "scrollableMessageBody", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "initialInteractionText", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "navigationText1", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "navigationText2", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "ETA", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "totalDistance", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "navigationText", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "audioPassThruDisplayText1", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "audioPassThruDisplayText2", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "sliderHeader", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "sliderFooter", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "notificationText", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "menuName", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "secondaryText", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "tertiaryText", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "timeToDestination", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "turnText", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "menuTitle", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + } + ], + "imageFields": [ + { + "name": "softButtonImage", + "imageTypeSupported": [], + "imageResolution": { + "resolutionWidth": 35, + "resolutionHeight": 35 + } + }, + { + "name": "choiceImage", + "imageTypeSupported": [], + "imageResolution": { + "resolutionWidth": 35, + "resolutionHeight": 35 + } + }, + { + "name": "choiceSecondaryImage", + "imageTypeSupported": [], + "imageResolution": { + "resolutionWidth": 35, + "resolutionHeight": 35 + } + }, + { + "name": "menuIcon", + "imageTypeSupported": [], + "imageResolution": { + "resolutionWidth": 35, + "resolutionHeight": 35 + } + }, + { + "name": "cmdIcon", + "imageTypeSupported": [], + "imageResolution": { + "resolutionWidth": 35, + "resolutionHeight": 35 + } + }, + { + "name": "appIcon", + "imageTypeSupported": [], + "imageResolution": { + "resolutionWidth": 35, + "resolutionHeight": 35 + } + }, + { + "name": "graphic", + "imageTypeSupported": [], + "imageResolution": { + "resolutionWidth": 35, + "resolutionHeight": 35 + } + }, + { + "name": "locationImage", + "imageTypeSupported": [ + "GRAPHIC_PNG" + ], + "imageResolution": { + "resolutionWidth": 35, + "resolutionHeight": 35 + } + } - ], - "mediaClockFormats": - [ - "CLOCK1","CLOCK2","CLOCK3","CLOCKTEXT1","CLOCKTEXT2","CLOCKTEXT3","CLOCKTEXT4" ], - "graphicSupported":true, - "templatesAvailable": - [ + "mediaClockFormats": [ + "CLOCK1", + "CLOCK2", + "CLOCK3", + "CLOCKTEXT1", + "CLOCKTEXT2", + "CLOCKTEXT3", + "CLOCKTEXT4" + ], + "graphicSupported": true, + "templatesAvailable": [ - "DEFAULT","MEDIA","NON-MEDIA","ONSCREEN_PRESETS","NAV_FULLSCREEN_MAP","NAV_KEYBOARD", - "GRAPHIC_WITH_TEXT","TEXT_WITH_GRAPHIC","TILES_ONLY","TEXTBUTTONS_ONLY", - "GRAPHIC_WITH_TILES","TILES_WITH_GRAPHIC","GRAPHIC_WITH_TEXT_AND_SOFTBUTTONS", - "TEXT_AND_SOFTBUTTONS_WITH_GRAPHIC","GRAPHIC_WITH_TEXTBUTTONS", - "TEXTBUTTONS_WITH_GRAPHIC","LARGE_GRAPHIC_WITH_SOFTBUTTONS", - "DOUBLE_GRAPHIC_WITH_SOFTBUTTONS","LARGE_GRAPHIC_ONLY" - ], - "screenParams": - { - "resolution": - { - "resolutionWidth":800, - "resolutionHeight":350 - }, - "touchEventAvailable": - { - "pressAvailable":true, - "multiTouchAvailable":false, - "doublePressAvailable":false - } - }, - "numCustomPresetsAvailable":8, - "imageCapabilities": - [ + "DEFAULT", + "MEDIA", + "NON-MEDIA", + "ONSCREEN_PRESETS", + "NAV_FULLSCREEN_MAP", + "NAV_KEYBOARD", + "GRAPHIC_WITH_TEXT", + "TEXT_WITH_GRAPHIC", + "TILES_ONLY", + "TEXTBUTTONS_ONLY", + "GRAPHIC_WITH_TILES", + "TILES_WITH_GRAPHIC", + "GRAPHIC_WITH_TEXT_AND_SOFTBUTTONS", + "TEXT_AND_SOFTBUTTONS_WITH_GRAPHIC", + "GRAPHIC_WITH_TEXTBUTTONS", + "TEXTBUTTONS_WITH_GRAPHIC", + "LARGE_GRAPHIC_WITH_SOFTBUTTONS", + "DOUBLE_GRAPHIC_WITH_SOFTBUTTONS", + "LARGE_GRAPHIC_ONLY" + ], + "screenParams": { + "resolution": { + "resolutionWidth": 800, + "resolutionHeight": 350 + }, + "touchEventAvailable": { + "pressAvailable": true, + "multiTouchAvailable": false, + "doublePressAvailable": false + } + }, + "numCustomPresetsAvailable": 8, + "imageCapabilities": [ "DYNAMIC", "STATIC" ] }, - "audioPassThruCapabilities": - { - "samplingRate" : "44KHZ", - "bitsPerSample" : "RATE_8_BIT", - "audioType" : "PCM" + "audioPassThruCapabilities": { + "samplingRate": "44KHZ", + "bitsPerSample": "RATE_8_BIT", + "audioType": "PCM" }, - "pcmStreamCapabilities": - { - "samplingRate" : "16KHZ", - "bitsPerSample" : "RATE_16_BIT", - "audioType" : "PCM" + "pcmStreamCapabilities": { + "samplingRate": "16KHZ", + "bitsPerSample": "RATE_16_BIT", + "audioType": "PCM" }, - "hmiZoneCapabilities":"FRONT", - "softButtonCapabilities": - [ - { - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true, - "imageSupported" :true - } + "hmiZoneCapabilities": "FRONT", + "softButtonCapabilities": [ + { + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true, + "imageSupported": true + } + ], + "systemCapabilities": { + "navigationCapability": { + "sendLocationEnabled": true, + "getWayPointsEnabled": true + }, + "phoneCapability": { + "dialNumberEnabled": true + }, + + "remoteControlCapability":{ + "climateControlCapabilities": [ + { + "moduleName": "primary_climate", + "fanSpeedAvailable": true, + "desiredTemperatureAvailable": true, + "acEnableAvailable": true, + "acMaxEnableAvailable": true, + "circulateAirEnableAvailable": true, + "autoModeEnableAvailable": true, + "dualModeEnableAvailable": true, + "defrostZoneAvailable": true, + "ventilationModeAvailable": true, + "defrostZone": [ + "FRONT", + "REAR", + "ALL", + "NONE" + ], + "ventilationMode": [ + "UPPER", + "LOWER", + "BOTH", + "NONE" + ] + } + ], + "radioControlCapabilities": [ + { + "moduleName": "radio", + "radioEnableAvailable": true, + "radioBandAvailable": true, + "radioFrequencyAvailable": true, + "hdChannelAvailable": true, + "rdsDataAvailable": true, + "availableHDsAvailable": true, + "stateAvailable": true, + "signalStrengthAvailable": true, + "signalChangeThresholdAvailable": true + } + ], + "buttonCapabilities": [ + { + "name": "AC_MAX", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": false + }, + { + "name": "AC", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": false + }, + { + "name": "RECIRCULATE", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": false + }, + { + "name": "FAN_UP", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": false + }, + { + "name": "FAN_DOWN", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": false + }, + { + "name": "TEMP_UP", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": false + }, + { + "name": "TEMP_DOWN", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": false + }, + { + "name": "DEFROST_MAX", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": false + }, + { + "name": "DEFROST", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": false + }, + { + "name": "DEFROST_REAR", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": false + }, + { + "name": "UPPER_VENT", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": false + }, + { + "name": "LOWER_VENT", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": false + }, + { + "name": "VOLUME_UP", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": false + }, + { + "name": "VOLUME_DOWN", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": false + }, + { + "name": "EJECT", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": false + }, + { + "name": "SOURCE", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": false + }, + { + "name": "SHUFFLE", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": false + }, + { + "name": "REPEAT", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": false + } + ] + }, + "videoStreamingCapability": { + "preferredResolution": { + "resolutionWidth": 800, + "resolutionHeight": 350 + }, + "maxBitrate": 10000, + "supportedFormats": [ + { + "protocol": "RAW", + "codec": "H264" + }, + { + "protocol": "RTP", + "codec": "Theora" + } + ], + "hapticSpatialDataSupported": true + } + } + }, + "VR": { + "capabilities": [ + "TEXT" + ], + "language": "ES_MX", + "languages": [ + "AR_SA", + "EN_US", + "ES_MX", + "FR_CA", + "DE_DE", + "ES_ES", + "EN_GB", + "RU_RU", + "TR_TR", + "PL_PL", + "FR_FR", + "IT_IT", + "SV_SE", + "PT_PT", + "NL_NL", + "ZH_TW", + "JA_JP", + "KO_KR", + "PT_BR", + "CS_CZ", + "DA_DK", + "NO_NO" ] }, - "VR": - { - "capabilities":["TEXT"], - "language":"ES_MX", - "languages": - [ - "AR_SA", "EN_US","ES_MX","FR_CA","DE_DE","ES_ES","EN_GB","RU_RU","TR_TR","PL_PL","FR_FR","IT_IT","SV_SE","PT_PT","NL_NL","ZH_TW", -"JA_JP","KO_KR","PT_BR","CS_CZ","DA_DK","NO_NO" - ] -}, - "TTS": - { - "capabilities":["TEXT"], - "language":"DE_DE", - "languages": - [ - "DA_DK","CS_CZ","KO_KR","EN_US","ES_MX","FR_CA","DE_DE","ES_ES","EN_GB","RU_RU","TR_TR","PL_PL","FR_FR","IT_IT","SV_SE","PT_PT","NL_NL","ZH_TW", -"JA_JP","AR_SA","PT_BR","NO_NO" + "TTS": { + "capabilities": [ + "TEXT" + ], + "language": "DE_DE", + "languages": [ + "DA_DK", + "CS_CZ", + "KO_KR", + "EN_US", + "ES_MX", + "FR_CA", + "DE_DE", + "ES_ES", + "EN_GB", + "RU_RU", + "TR_TR", + "PL_PL", + "FR_FR", + "IT_IT", + "SV_SE", + "PT_PT", + "NL_NL", + "ZH_TW", + "JA_JP", + "AR_SA", + "PT_BR", + "NO_NO" ] }, - "Buttons": - { - "capabilities": - [ - { - "name":"PRESET_0", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true + "Buttons": { + "capabilities": [ + { + "name": "PRESET_0", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true }, { - "name":"PRESET_1", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true + "name": "PRESET_1", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true }, { - "name":"PRESET_2", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true + "name": "PRESET_2", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true }, { - "name":"PRESET_3", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true + "name": "PRESET_3", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true }, { - "name":"PRESET_4", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true + "name": "PRESET_4", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true }, { - "name":"PRESET_5", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true + "name": "PRESET_5", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true }, { - "name":"PRESET_6", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true + "name": "PRESET_6", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true }, { - "name":"PRESET_7", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true + "name": "PRESET_7", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true }, { - "name":"PRESET_8", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true + "name": "PRESET_8", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true }, { - "name":"PRESET_9", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true + "name": "PRESET_9", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true }, { - "name":"OK", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true + "name": "OK", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true }, { - "name":"SEEKLEFT", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true + "name": "SEEKLEFT", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true }, { - "name":"SEEKRIGHT", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true + "name": "SEEKRIGHT", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true }, { - "name":"TUNEUP", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true + "name": "TUNEUP", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true }, { - "name":"TUNEDOWN", - "shortPressAvailable":true, - "longPressAvailable" :true, - "upDownAvailable" :true + "name": "TUNEDOWN", + "shortPressAvailable": true, + "longPressAvailable": true, + "upDownAvailable": true } ], - "presetBankCapabilities": - { - "onScreenPresetsAvailable":true + "presetBankCapabilities": { + "onScreenPresetsAvailable": true } }, - "VehicleInfo": - { - "make" :"Ford", - "model" :"Fiesta", - "modelYear" :"2013", - "trim" :"SE" + "VehicleInfo": { + "make": "Ford", + "model": "Fiesta", + "modelYear": "2013", + "trim": "SE" }, - "SyncMessageVersion": - { + "SyncMessageVersion": { "majorVersion": 3, "minorVersion": 0 } diff --git a/src/components/application_manager/test/hmi_capabilities_test.cc b/src/components/application_manager/test/hmi_capabilities_test.cc index 4eb9f920d9..5c3830d5a5 100644 --- a/src/components/application_manager/test/hmi_capabilities_test.cc +++ b/src/components/application_manager/test/hmi_capabilities_test.cc @@ -2,6 +2,9 @@ * Copyright (c) 2017, Ford Motor Company * All rights reserved. * + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -13,7 +16,7 @@ * disclaimer in the documentation and/or other materials provided with the * distribution. * - * Neither the name of the Ford Motor Company nor the names of its contributors + * Neither the name of the copyright holders nor the names of their contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -104,7 +107,8 @@ const char* const cstring_values_[] = { "EN_US", "ES_MX", "FR_CA", "DE_DE", "ES_ES", "EN_GB", "RU_RU", "TR_TR", "PL_PL", "FR_FR", "IT_IT", "SV_SE", "PT_PT", "NL_NL", "EN_AU", "ZH_CN", "ZH_TW", "JA_JP", "AR_SA", "KO_KR", "PT_BR", "CS_CZ", "DA_DK", "NO_NO", - "NL_BE", "EL_GR", "HU_HU", "FI_FI", "SK_SK"}; + "NL_BE", "EL_GR", "HU_HU", "FI_FI", "SK_SK", "EN_IN", "TH_TH", "EN_SA", + "HE_IL", "RO_RO", "UK_UA", "ID_ID", "VI_VN", "MS_MY", "HI_IN"}; const hmi_apis::Common_Language::eType enum_values_[] = { hmi_apis::Common_Language::EN_US, hmi_apis::Common_Language::ES_MX, @@ -121,7 +125,12 @@ const hmi_apis::Common_Language::eType enum_values_[] = { hmi_apis::Common_Language::DA_DK, hmi_apis::Common_Language::NO_NO, hmi_apis::Common_Language::NL_BE, hmi_apis::Common_Language::EL_GR, hmi_apis::Common_Language::HU_HU, hmi_apis::Common_Language::FI_FI, - hmi_apis::Common_Language::SK_SK}; + hmi_apis::Common_Language::SK_SK, hmi_apis::Common_Language::EN_IN, + hmi_apis::Common_Language::TH_TH, hmi_apis::Common_Language::EN_SA, + hmi_apis::Common_Language::HE_IL, hmi_apis::Common_Language::RO_RO, + hmi_apis::Common_Language::UK_UA, hmi_apis::Common_Language::ID_ID, + hmi_apis::Common_Language::VI_VN, hmi_apis::Common_Language::MS_MY, + hmi_apis::Common_Language::HI_IN}; struct CStringComparator { bool operator()(const char* a, const char* b) { @@ -351,12 +360,113 @@ TEST_F(HMICapabilitiesTest, LoadCapabilitiesFromFile) { // Check vehicle type const smart_objects::SmartObject vehicle_type_so = *(hmi_capabilities_test->vehicle_type()); - EXPECT_TRUE(preset_bank_so["onScreenPresetsAvailable"].asBool()); EXPECT_EQ("Ford", vehicle_type_so["make"].asString()); EXPECT_EQ("Fiesta", vehicle_type_so["model"].asString()); EXPECT_EQ("2013", vehicle_type_so["modelYear"].asString()); EXPECT_EQ("SE", vehicle_type_so["trim"].asString()); + + // Check system capabilities + smart_objects::SmartObject navigation_capability_so = + *(hmi_capabilities_test->navigation_capability()); + + EXPECT_TRUE(navigation_capability_so.keyExists("sendLocationEnabled")); + EXPECT_TRUE(navigation_capability_so.keyExists("getWayPointsEnabled")); + EXPECT_TRUE(navigation_capability_so["sendLocationEnabled"].asBool()); + EXPECT_TRUE(navigation_capability_so["getWayPointsEnabled"].asBool()); + + const smart_objects::SmartObject phone_capability_so = + *(hmi_capabilities_test->phone_capability()); + + EXPECT_TRUE(phone_capability_so.keyExists("dialNumberEnabled")); + EXPECT_TRUE(phone_capability_so["dialNumberEnabled"].asBool()); + + const smart_objects::SmartObject vs_capability_so = + *(hmi_capabilities_test->video_streaming_capability()); + + EXPECT_TRUE(vs_capability_so.keyExists(strings::preferred_resolution)); + EXPECT_TRUE(vs_capability_so[strings::preferred_resolution].keyExists( + strings::resolution_width)); + EXPECT_TRUE(vs_capability_so[strings::preferred_resolution].keyExists( + strings::resolution_height)); + EXPECT_EQ( + 800, + vs_capability_so[strings::preferred_resolution][strings::resolution_width] + .asInt()); + EXPECT_EQ(350, + vs_capability_so[strings::preferred_resolution] + [strings::resolution_height].asInt()); + EXPECT_TRUE(vs_capability_so.keyExists(strings::max_bitrate)); + EXPECT_EQ(10000, vs_capability_so[strings::max_bitrate].asInt()); + EXPECT_TRUE(vs_capability_so.keyExists(strings::supported_formats)); + const uint32_t supported_formats_len = + vs_capability_so[strings::supported_formats].length(); + EXPECT_EQ(2u, supported_formats_len); + EXPECT_TRUE(vs_capability_so[strings::supported_formats][0].keyExists( + strings::protocol)); + EXPECT_TRUE(vs_capability_so[strings::supported_formats][0].keyExists( + strings::codec)); + EXPECT_EQ(0, + vs_capability_so[strings::supported_formats][0][strings::protocol] + .asInt()); + EXPECT_EQ( + 0, + vs_capability_so[strings::supported_formats][0][strings::codec].asInt()); + EXPECT_TRUE(vs_capability_so[strings::supported_formats][1].keyExists( + strings::protocol)); + EXPECT_TRUE(vs_capability_so[strings::supported_formats][1].keyExists( + strings::codec)); + EXPECT_EQ(1, + vs_capability_so[strings::supported_formats][1][strings::protocol] + .asInt()); + EXPECT_EQ( + 2, + vs_capability_so[strings::supported_formats][1][strings::codec].asInt()); + + EXPECT_TRUE( + vs_capability_so.keyExists(strings::haptic_spatial_data_supported)); + EXPECT_TRUE( + vs_capability_so[strings::haptic_spatial_data_supported].asBool()); + + // Check remote control capabilites + const smart_objects::SmartObject rc_capability_so = + *(hmi_capabilities_test->rc_capability()); + + EXPECT_TRUE(rc_capability_so.keyExists("climateControlCapabilities")); + EXPECT_TRUE(rc_capability_so.keyExists("radioControlCapabilities")); + EXPECT_TRUE(rc_capability_so.keyExists("buttonCapabilities")); + + EXPECT_TRUE( + rc_capability_so["climateControlCapabilities"][0]["fanSpeedAvailable"] + .asBool()); + EXPECT_TRUE(rc_capability_so["climateControlCapabilities"][0] + ["desiredTemperatureAvailable"].asBool()); + EXPECT_TRUE( + rc_capability_so["climateControlCapabilities"][0]["acEnableAvailable"] + .asBool()); + EXPECT_TRUE( + rc_capability_so["climateControlCapabilities"][0]["acMaxEnableAvailable"] + .asBool()); + + EXPECT_TRUE( + rc_capability_so["radioControlCapabilities"][0]["radioBandAvailable"] + .asBool()); + EXPECT_TRUE( + rc_capability_so["radioControlCapabilities"][0]["radioFrequencyAvailable"] + .asBool()); + EXPECT_TRUE( + rc_capability_so["radioControlCapabilities"][0]["hdChannelAvailable"] + .asBool()); + EXPECT_TRUE( + rc_capability_so["radioControlCapabilities"][0]["rdsDataAvailable"] + .asBool()); + + EXPECT_TRUE(rc_capability_so["buttonCapabilities"][0]["shortPressAvailable"] + .asBool()); + EXPECT_TRUE( + rc_capability_so["buttonCapabilities"][0]["longPressAvailable"].asBool()); + EXPECT_FALSE( + rc_capability_so["buttonCapabilities"][0]["upDownAvailable"].asBool()); } TEST_F(HMICapabilitiesTest, VerifyImageType) { diff --git a/src/components/application_manager/test/include/application_manager/mock_application.h b/src/components/application_manager/test/include/application_manager/mock_application.h index 2617f777bb..c24e4590f5 100644 --- a/src/components/application_manager/test/include/application_manager/mock_application.h +++ b/src/components/application_manager/test/include/application_manager/mock_application.h @@ -34,6 +34,7 @@ #include <string> #include "gmock/gmock.h" #include "application_manager/application.h" +#include "application_manager/app_extension.h" #include "smart_objects/smart_object.h" #include "utils/custom_string.h" #include "application_manager/usage_statistics.h" @@ -59,6 +60,8 @@ class MockApplication : public ::application_manager::Application { MOCK_METHOD0(ChangeSupportingAppHMIType, void()); MOCK_CONST_METHOD0(is_navi, bool()); MOCK_METHOD1(set_is_navi, void(bool allow)); + MOCK_CONST_METHOD0(mobile_projection_enabled, bool()); + MOCK_METHOD1(set_mobile_projection_enabled, void(bool allow)); MOCK_CONST_METHOD0(video_streaming_approved, bool()); MOCK_METHOD1(set_video_streaming_approved, void(bool state)); MOCK_CONST_METHOD0(audio_streaming_approved, bool()); @@ -68,6 +71,9 @@ class MockApplication : public ::application_manager::Application { MOCK_CONST_METHOD0(audio_streaming_allowed, bool()); MOCK_METHOD1(set_audio_streaming_allowed, void(bool state)); MOCK_CONST_METHOD0(is_audio, bool()); + MOCK_METHOD2(SetVideoConfig, + bool(protocol_handler::ServiceType service_type, + const smart_objects::SmartObject& params)); MOCK_METHOD1(StartStreaming, void(protocol_handler::ServiceType service_type)); MOCK_METHOD1(StopStreaming, void(protocol_handler::ServiceType service_type)); @@ -121,9 +127,9 @@ class MockApplication : public ::application_manager::Application { MOCK_METHOD1(set_grammar_id, void(uint32_t value)); MOCK_METHOD1( set_protocol_version, - void(const ::application_manager::ProtocolVersion& protocol_version)); + void(const ::protocol_handler::MajorProtocolVersion& protocol_version)); MOCK_CONST_METHOD0(protocol_version, - ::application_manager::ProtocolVersion()); + ::protocol_handler::MajorProtocolVersion()); MOCK_METHOD1(set_is_resuming, void(bool)); MOCK_CONST_METHOD0(is_resuming, bool()); MOCK_METHOD1(AddFile, bool(const ::application_manager::AppFile& file)); @@ -275,12 +281,41 @@ class MockApplication : public ::application_manager::Application { MOCK_CONST_METHOD0(bundle_id, const std::string&()); MOCK_METHOD1(set_bundle_id, void(const std::string& bundle_id)); MOCK_METHOD0(GetAvailableDiskSpace, uint32_t()); + MOCK_METHOD1(set_mobile_app_id, void(const std::string& policy_app_id)); MOCK_CONST_METHOD0(is_foreground, bool()); MOCK_METHOD1(set_foreground, void(bool is_foreground)); MOCK_CONST_METHOD0(IsRegistered, bool()); MOCK_CONST_METHOD0(SchemaUrl, std::string()); MOCK_CONST_METHOD0(PackageName, std::string()); + +#ifdef SDL_REMOTE_CONTROL + MOCK_METHOD1( + set_system_context, + void(const application_manager::mobile_api::SystemContext::eType&)); + MOCK_METHOD1( + set_audio_streaming_state, + void(const application_manager::mobile_api::AudioStreamingState::eType& + state)); + MOCK_METHOD1(IsSubscribedToInteriorVehicleData, + bool(smart_objects::SmartObject module)); + MOCK_METHOD1(SubscribeToInteriorVehicleData, + bool(smart_objects::SmartObject module)); + MOCK_METHOD1(UnsubscribeFromInteriorVehicleData, + bool(smart_objects::SmartObject module)); + MOCK_METHOD1( + set_hmi_level, + void(const application_manager::mobile_api::HMILevel::eType& hmi_level)); + MOCK_METHOD1(QueryInterface, + application_manager::AppExtensionPtr( + application_manager::AppExtensionUID uid)); + MOCK_METHOD1(AddExtension, + bool(application_manager::AppExtensionPtr extention)); + MOCK_METHOD1(RemoveExtension, bool(application_manager::AppExtensionUID uid)); + MOCK_METHOD0(RemoveExtensions, void()); + MOCK_CONST_METHOD0(SubscribesIVI, const std::set<uint32_t>&()); + +#endif // SDL_REMOTE_CONTROL }; } // namespace application_manager_test diff --git a/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h b/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h index a8664f5e2c..dd7ec5f0d5 100644 --- a/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h +++ b/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h @@ -61,6 +61,9 @@ class MockHMICapabilities : public ::application_manager::HMICapabilities { MOCK_CONST_METHOD0(is_ivi_cooperating, bool()); MOCK_METHOD1(set_is_ivi_cooperating, void(const bool value)); + MOCK_CONST_METHOD0(is_rc_cooperating, bool()); + MOCK_METHOD1(set_is_rc_cooperating, void(const bool value)); + MOCK_CONST_METHOD0(attenuated_supported, bool()); MOCK_METHOD1(set_attenuated_supported, void(const bool state)); @@ -154,6 +157,27 @@ class MockHMICapabilities : public ::application_manager::HMICapabilities { MOCK_CONST_METHOD0(phone_call_supported, bool()); MOCK_METHOD1(set_phone_call_supported, void(const bool supported)); + MOCK_CONST_METHOD0(video_streaming_supported, bool()); + MOCK_METHOD1(set_video_streaming_supported, void(const bool supported)); + + MOCK_CONST_METHOD0(navigation_capability, + const smart_objects::SmartObject*()); + MOCK_METHOD1(set_navigation_capability, + void(const smart_objects::SmartObject& navigation_capability)); + + MOCK_CONST_METHOD0(phone_capability, const smart_objects::SmartObject*()); + MOCK_METHOD1(set_phone_capability, + void(const smart_objects::SmartObject& phone_capability)); + + MOCK_CONST_METHOD0(video_streaming_capability, + const smart_objects::SmartObject*()); + MOCK_METHOD1( + set_video_streaming_capability, + void(const smart_objects::SmartObject& video_streaming_capability)); + MOCK_CONST_METHOD0(rc_capability, const smart_objects::SmartObject*()); + MOCK_METHOD1(set_rc_capability, + void(const smart_objects::SmartObject& rc_capability)); + MOCK_METHOD1(Init, void(resumption::LastState* last_state)); MOCK_CONST_METHOD0(ccpu_version, const std::string&()); diff --git a/src/components/application_manager/test/include/application_manager/mock_message_helper.h b/src/components/application_manager/test/include/application_manager/mock_message_helper.h index 0d28f9e522..f927f6bb72 100644 --- a/src/components/application_manager/test/include/application_manager/mock_message_helper.h +++ b/src/components/application_manager/test/include/application_manager/mock_message_helper.h @@ -70,6 +70,10 @@ class MockMessageHelper { const connection_handler::DeviceMap& devices, const policy::PolicyHandlerInterface& policy_handler, ApplicationManager& app_mngr)); + MOCK_METHOD3(SendNaviSetVideoConfig, + void(int32_t app_id, + ApplicationManager& app_mngr, + const smart_objects::SmartObject& video_params)); MOCK_METHOD2(SendNaviStartStream, void(int32_t connection_key, ApplicationManager& app_mngr)); MOCK_METHOD2(SendNaviStopStream, @@ -109,7 +113,14 @@ class MockMessageHelper { uint32_t correlation_id, ApplicationManager& app_mngr)); MOCK_METHOD1(SendGetSystemInfoRequest, void(ApplicationManager& app_mngr)); - + MOCK_METHOD4(SendActivateAppToHMI, + void(uint32_t const app_id, + ApplicationManager& application_manager, + hmi_apis::Common_HMILevel::eType level, + bool send_policy_priority)); + MOCK_METHOD2(SendHMIStatusNotification, + void(const Application& application_impl, + ApplicationManager& application_manager)); MOCK_METHOD4(SendPolicyUpdate, void(const std::string& file_path, const uint32_t timeout, diff --git a/src/components/application_manager/test/message_helper/CMakeLists.txt b/src/components/application_manager/test/message_helper/CMakeLists.txt index d115ad8b40..e4a77aa00a 100755 --- a/src/components/application_manager/test/message_helper/CMakeLists.txt +++ b/src/components/application_manager/test/message_helper/CMakeLists.txt @@ -47,6 +47,13 @@ set(LIBRARIES Utils ) +if(REMOTE_CONTROL) + SET (LIBRARIES + ${LIBRARIES} + FunctionalModule + ) +endif(REMOTE_CONTROL) + set(SOURCES ${COMPONENTS_DIR}/application_manager/test/message_helper/message_helper_test.cc ) diff --git a/src/components/application_manager/test/message_helper/message_helper_test.cc b/src/components/application_manager/test/message_helper/message_helper_test.cc index 94ab511dc4..289e4f5d05 100644 --- a/src/components/application_manager/test/message_helper/message_helper_test.cc +++ b/src/components/application_manager/test/message_helper/message_helper_test.cc @@ -96,7 +96,8 @@ TEST(MessageHelperTestCreate, obj[strings::params][strings::correlation_id].asUInt()); EXPECT_EQ(connection_key, obj[strings::params][strings::connection_key].asUInt()); - EXPECT_EQ(kV2, obj[strings::params][strings::protocol_version].asInt()); + EXPECT_EQ(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_2, + obj[strings::params][strings::protocol_version].asInt()); } TEST(MessageHelperTestCreate, CreateSetAppIcon_SendNullPathImagetype_Equal) { @@ -448,7 +449,9 @@ class MessageHelperTest : public ::testing::Test { "RU-RU", "TR-TR", "PL-PL", "FR-FR", "IT-IT", "SV-SE", "PT-PT", "NL-NL", "EN-AU", "ZH-CN", "ZH-TW", "JA-JP", "AR-SA", "KO-KR", "PT-BR", "CS-CZ", "DA-DK", "NO-NO", - "NL-BE", "EL-GR", "HU-HU", "FI-FI", "SK-SK"} + "NL-BE", "EL-GR", "HU-HU", "FI-FI", "SK-SK", "EN-IN", + "TH-TH", "EN-SA", "HE-IL", "RO-RO", "UK-UA", "ID-ID", + "VI-VN", "MS-MY", "HI-IN"} , hmi_result_strings{"SUCCESS", "UNSUPPORTED_REQUEST", "UNSUPPORTED_RESOURCE", @@ -1025,6 +1028,39 @@ TEST_F(MessageHelperTest, std::find(status_array->begin(), status_array->end(), item_2_so)); } #endif + +TEST_F(MessageHelperTest, SendNaviSetVideoConfigRequest) { + smart_objects::SmartObjectSPtr result; + EXPECT_CALL(mock_application_manager, ManageHMICommand(_)) + .WillOnce(DoAll(SaveArg<0>(&result), Return(true))); + + int32_t app_id = 123; + smart_objects::SmartObject video_params(smart_objects::SmartType_Map); + video_params[strings::protocol] = + hmi_apis::Common_VideoStreamingProtocol::RTP; + video_params[strings::codec] = hmi_apis::Common_VideoStreamingCodec::H264; + video_params[strings::width] = 640; + video_params[strings::height] = 480; + + MessageHelper::SendNaviSetVideoConfig( + app_id, mock_application_manager, video_params); + + EXPECT_EQ(hmi_apis::FunctionID::Navigation_SetVideoConfig, + (*result)[strings::params][strings::function_id].asInt()); + + smart_objects::SmartObject& msg_params = (*result)[strings::msg_params]; + EXPECT_TRUE(msg_params.keyExists(strings::config)); + + EXPECT_TRUE(msg_params[strings::config].keyExists(strings::protocol)); + EXPECT_EQ(1, msg_params[strings::config][strings::protocol].asInt()); + EXPECT_TRUE(msg_params[strings::config].keyExists(strings::codec)); + EXPECT_EQ(0, msg_params[strings::config][strings::codec].asInt()); + EXPECT_TRUE(msg_params[strings::config].keyExists(strings::width)); + EXPECT_EQ(640, msg_params[strings::config][strings::width].asInt()); + EXPECT_TRUE(msg_params[strings::config].keyExists(strings::height)); + EXPECT_EQ(480, msg_params[strings::config][strings::height].asInt()); +} + } // namespace application_manager_test } // namespace components } // namespace test diff --git a/src/components/application_manager/test/mobile_message_handler_test.cc b/src/components/application_manager/test/mobile_message_handler_test.cc index 07b523c56e..3f2ba0a3c5 100644 --- a/src/components/application_manager/test/mobile_message_handler_test.cc +++ b/src/components/application_manager/test/mobile_message_handler_test.cc @@ -53,7 +53,7 @@ using protocol_handler::ServiceType; using protocol_handler::MessagePriority; using protocol_handler::PROTOCOL_HEADER_V2_SIZE; using application_manager::MobileMessageHandler; -using application_manager::ProtocolVersion; +using protocol_handler::MajorProtocolVersion; using ::testing::_; using ::application_manager::Message; using ::application_manager::MobileMessage; @@ -176,7 +176,7 @@ class MobileMessageHandlerTest : public testing::Test { message->set_correlation_id(correlation_id); message->set_connection_key(connection_key); message->set_protocol_version( - static_cast<ProtocolVersion>(protocol_version)); + static_cast<protocol_handler::MajorProtocolVersion>(protocol_version)); message->set_message_type(application_manager::MessageType::kNotification); if (data) { message->set_binary_data(data); @@ -270,7 +270,7 @@ TEST_F( size_t payload_size = data.size(); std::srand(time(0)); // Generate unknown random protocol version except 1-3 - uint32_t protocol_version = 4 + rand() % UINT32_MAX; + uint32_t protocol_version = 5 + rand() % UINT32_MAX; Message* message = HandleIncomingMessage(protocol_version, data, payload_size); @@ -288,7 +288,7 @@ TEST_F( const uint32_t correlation_id = 92u; const uint32_t connection_key = 1u; // Generate unknown random protocol version except 1-3 - uint32_t protocol_version = 4 + rand() % UINT32_MAX; + uint32_t protocol_version = 5 + rand() % UINT32_MAX; MobileMessage message_to_send = CreateMessageForSending( protocol_version, function_id, correlation_id, connection_key, data); diff --git a/src/components/application_manager/test/mobile_message_handler_v1_test.cc b/src/components/application_manager/test/mobile_message_handler_v1_test.cc index f5a6e7833d..a19ea991b9 100644 --- a/src/components/application_manager/test/mobile_message_handler_v1_test.cc +++ b/src/components/application_manager/test/mobile_message_handler_v1_test.cc @@ -111,7 +111,8 @@ TEST(MobileMessageHandlerTestV1Test, utils::MakeShared<application_manager::Message>( protocol_handler::MessagePriority::kDefault); - message->set_protocol_version(application_manager::ProtocolVersion::kV1); + message->set_protocol_version( + protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1); message->set_json_message(data_json); message->set_connection_key(connection_key_p1); @@ -121,7 +122,8 @@ TEST(MobileMessageHandlerTestV1Test, ASSERT_TRUE(ptr); EXPECT_EQ(connection_key, ptr->connection_key()); - EXPECT_EQ(static_cast<uint32_t>(application_manager::ProtocolVersion::kV1), + EXPECT_EQ(static_cast<uint32_t>( + protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1), ptr->protocol_version()); } diff --git a/src/components/application_manager/test/mock_message_helper.cc b/src/components/application_manager/test/mock_message_helper.cc index 01ce9cb066..5f221a105b 100644 --- a/src/components/application_manager/test/mock_message_helper.cc +++ b/src/components/application_manager/test/mock_message_helper.cc @@ -33,6 +33,8 @@ #include "application_manager/message_helper.h" #include "application_manager/mock_message_helper.h" #include "application_manager/policies/policy_handler_interface.h" +#include "gtest/gtest.h" +#include "gmock/gmock.h" namespace application_manager { @@ -41,6 +43,13 @@ void MessageHelper::SendHashUpdateNotification(uint32_t const app_id, MockMessageHelper::message_helper_mock()->SendHashUpdateNotification( app_id, app_mngr); } +void MessageHelper::SendNaviSetVideoConfig( + int32_t app_id, + ApplicationManager& app_mngr, + const smart_objects::SmartObject& video_params) { + MockMessageHelper::message_helper_mock()->SendNaviSetVideoConfig( + app_id, app_mngr, video_params); +} void MessageHelper::SendNaviStartStream(int32_t connection_key, ApplicationManager& app_mngr) { MockMessageHelper::message_helper_mock()->SendNaviStartStream(connection_key, @@ -220,6 +229,25 @@ void MessageHelper::SendPolicyUpdate(const std::string& file_path, file_path, timeout, retries, app_mngr); } +#ifdef SDL_REMOTE_CONTROL +void MessageHelper::SendActivateAppToHMI( + uint32_t const app_id, + ApplicationManager& application_manager, + hmi_apis::Common_HMILevel::eType level, + bool send_policy_priority) { + MockMessageHelper::message_helper_mock()->SendActivateAppToHMI( + app_id, application_manager, level, send_policy_priority); +} + +void MessageHelper::SendHMIStatusNotification( + const Application& application_impl, + ApplicationManager& application_manager) { + MockMessageHelper::message_helper_mock()->SendHMIStatusNotification( + application_impl, application_manager); +} + +#endif // SDL_REMOTE_CONTROL + void MessageHelper::SendUpdateSDLResponse(const std::string& result, uint32_t correlation_id, ApplicationManager& app_mngr) { @@ -240,7 +268,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateModuleInfoSO( } MockMessageHelper* MockMessageHelper::message_helper_mock() { - static MockMessageHelper message_helper_mock; + static ::testing::NiceMock<MockMessageHelper> message_helper_mock; return &message_helper_mock; } void MessageHelper::SendAllOnButtonSubscriptionNotificationsForApp( diff --git a/src/components/application_manager/test/rc_policy_handler_test.cc b/src/components/application_manager/test/rc_policy_handler_test.cc new file mode 100644 index 0000000000..7faf3e36cb --- /dev/null +++ b/src/components/application_manager/test/rc_policy_handler_test.cc @@ -0,0 +1,400 @@ +/* + * Copyright (c) 2017, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include <string> +#include <vector> +#include <fstream> +#include "gmock/gmock.h" + +#include "application_manager/policies/policy_handler.h" +#include "application_manager/policies/delegates/app_permission_delegate.h" +#include "policy/mock_cache_manager.h" +#include "application_manager/mock_message_helper.h" +#include "connection_handler/mock_connection_handler_settings.h" +#include "policy/policy_types.h" +#include "policy/access_remote.h" +#include "json/reader.h" +#include "json/writer.h" +#include "json/value.h" +#include "smart_objects/smart_object.h" +#include "utils/make_shared.h" +#include "utils/custom_string.h" +#include "interfaces/MOBILE_API.h" +#include "policy/mock_policy_settings.h" +#include "application_manager/mock_application.h" +#include "policy/usage_statistics/mock_statistics_manager.h" +#include "protocol_handler/mock_session_observer.h" +#include "connection_handler/mock_connection_handler.h" +#include "application_manager/mock_application_manager.h" +#include "application_manager/policies/mock_policy_handler_observer.h" +#include "application_manager/mock_event_dispatcher.h" +#include "policy/mock_policy_manager.h" + +namespace test { +namespace components { +namespace rc_policy_handler_test { + +using namespace application_manager; +using namespace policy; +using namespace utils::custom_string; +using testing::_; +using ::testing::Mock; +using ::testing::Return; +using ::testing::ReturnRef; +using ::testing::NiceMock; +using ::testing::DoAll; +using ::testing::SetArgPointee; + +class RCPolicyHandlerTest : public ::testing::Test { + public: + RCPolicyHandlerTest() + : policy_handler_(policy_settings_, app_manager_) + , kPolicyAppId_("fake_app_id") + , kMacAddr_("kMacAddr_ess") + , kDeviceId_("fake_device_id") + , kHmiLevel_("NONE") + , default_hmi_("fake_hmi") + , app_set(test_app, app_lock) + , kAppId1_(10u) + , kAppId2_(11u) + , kConnectionKey_(1u) + , kCorrelationKey_(2u) + , kUrl_("test_url") + , mock_message_helper_(*MockMessageHelper::message_helper_mock()) {} + + protected: + NiceMock<policy_handler_test::MockPolicySettings> policy_settings_; + utils::SharedPtr<application_manager_test::MockApplication> mock_app_; + connection_handler_test::MockConnectionHandler conn_handler; + protocol_handler_test::MockSessionObserver mock_session_observer; + components::usage_statistics_test::MockStatisticsManager + mock_statistics_manager_; + PolicyHandler policy_handler_; + utils::SharedPtr<policy_manager_test::MockPolicyManager> mock_policy_manager_; + application_manager_test::MockApplicationManager app_manager_; + const std::string kPolicyAppId_; + const std::string kMacAddr_; + const std::string kDeviceId_; + const std::string kHmiLevel_; + std::string default_hmi_; + ApplicationSet test_app; + sync_primitives::Lock app_lock; + DataAccessor<ApplicationSet> app_set; + const uint32_t kAppId1_; + const uint32_t kAppId2_; + const uint32_t kConnectionKey_; + const uint32_t kCorrelationKey_; + const std::string kUrl_; + application_manager::MockMessageHelper& mock_message_helper_; + + virtual void SetUp() OVERRIDE { + Mock::VerifyAndClearExpectations(&mock_message_helper_); + ON_CALL(app_manager_, applications()).WillByDefault(Return(app_set)); + ON_CALL(policy_settings_, enable_policy()).WillByDefault(Return(true)); + mock_policy_manager_ = + utils::MakeShared<policy_manager_test::MockPolicyManager>(); + ASSERT_TRUE(mock_policy_manager_.valid()); + + ON_CALL(app_manager_, connection_handler()) + .WillByDefault(ReturnRef(conn_handler)); + ON_CALL(conn_handler, get_session_observer()) + .WillByDefault(ReturnRef(mock_session_observer)); + + mock_app_ = utils::MakeShared<application_manager_test::MockApplication>(); + } + + virtual void TearDown() OVERRIDE { + Mock::VerifyAndClearExpectations(&mock_message_helper_); + } + + void ChangePolicyManagerToMock() { + policy_handler_.SetPolicyManager(mock_policy_manager_); + } + + void EnablePolicy() { + ON_CALL(policy_settings_, enable_policy()).WillByDefault(Return(true)); + } + + void EnablePolicyAndPolicyManagerMock() { + EnablePolicy(); + ChangePolicyManagerToMock(); + } +}; + +TEST_F(RCPolicyHandlerTest, + SendMessageToSDK_RemoteControlInvalidMobileAppId_UNSUCCESS) { + // Precondition + BinaryMessage msg; + EnablePolicyAndPolicyManagerMock(); + + EXPECT_CALL(app_manager_, applications()).WillOnce(Return(app_set)); + test_app.insert(mock_app_); + + ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId1_)); + ON_CALL(*mock_app_, hmi_level()) + .WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL)); + EXPECT_CALL(*mock_app_, IsRegistered()).WillOnce(Return(true)); + + EXPECT_CALL(app_manager_, application(kAppId1_)) + .WillRepeatedly(Return(mock_app_)); + const std::string empty_mobile_app_id(""); + EXPECT_CALL(*mock_app_, policy_app_id()) + .WillOnce(Return(empty_mobile_app_id)); + + EXPECT_CALL(*mock_policy_manager_, GetUserConsentForDevice(_)) + .WillOnce(Return(kDeviceAllowed)); + + EXPECT_CALL(mock_message_helper_, SendPolicySnapshotNotification(_, _, _, _)) + .Times(0); + EXPECT_FALSE(policy_handler_.SendMessageToSDK(msg, kUrl_)); +} + +TEST_F(RCPolicyHandlerTest, SendMessageToSDK_RemoteControl_SUCCESS) { + BinaryMessage msg; + EnablePolicyAndPolicyManagerMock(); + EXPECT_CALL(app_manager_, applications()).WillOnce(Return(app_set)); + test_app.insert(mock_app_); + + ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId1_)); + ON_CALL(*mock_app_, hmi_level()) + .WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL)); + EXPECT_CALL(*mock_app_, IsRegistered()).WillOnce(Return(true)); + + EXPECT_CALL(app_manager_, application(kAppId1_)) + .WillRepeatedly(Return(mock_app_)); + + EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId_)); + + EXPECT_CALL(*mock_policy_manager_, GetUserConsentForDevice(_)) + .WillOnce(Return(kDeviceAllowed)); + + EXPECT_CALL(mock_message_helper_, + SendPolicySnapshotNotification(kAppId1_, _, kUrl_, _)); + EXPECT_TRUE(policy_handler_.SendMessageToSDK(msg, kUrl_)); +} + +TEST_F(RCPolicyHandlerTest, OnUpdateHMILevel_InvalidApp_UNSUCCESS) { + EnablePolicyAndPolicyManagerMock(); + + utils::SharedPtr<application_manager_test::MockApplication> invalid_app; + EXPECT_CALL(app_manager_, application(kDeviceId_, kPolicyAppId_)) + .WillOnce(Return(invalid_app)); + EXPECT_CALL(mock_message_helper_, StringToHMILevel(_)).Times(0); + + const std::string hmi_level("HMI_FULL"); + policy_handler_.OnUpdateHMILevel(kDeviceId_, kPolicyAppId_, hmi_level); +} + +TEST_F(RCPolicyHandlerTest, OnUpdateHMILevel_InvalidHmiLevel_UNSUCCESS) { + EnablePolicyAndPolicyManagerMock(); + + EXPECT_CALL(app_manager_, application(kDeviceId_, kPolicyAppId_)) + .WillOnce(Return(mock_app_)); + + const std::string hmi_level("INVALID_ENUM"); + EXPECT_CALL(mock_message_helper_, StringToHMILevel(hmi_level)) + .WillOnce(Return(mobile_apis::HMILevel::INVALID_ENUM)); + + policy_handler_.OnUpdateHMILevel(kDeviceId_, kPolicyAppId_, hmi_level); +} + +TEST_F(RCPolicyHandlerTest, OnUpdateHMILevel_HmiLevelFull_SUCCESS) { + EnablePolicyAndPolicyManagerMock(); + + EXPECT_CALL(app_manager_, application(kDeviceId_, kPolicyAppId_)) + .WillOnce(Return(mock_app_)); + + const std::string hmi_level("HMI_FULL"); + EXPECT_CALL(mock_message_helper_, StringToHMILevel(hmi_level)) + .WillOnce(Return(mobile_apis::HMILevel::HMI_FULL)); + + EXPECT_CALL(*mock_app_, hmi_level()) + .WillOnce(Return(mobile_apis::HMILevel::HMI_NONE)); + EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId1_)); + EXPECT_CALL(mock_message_helper_, SendActivateAppToHMI(kAppId1_, _, _, _)); + + policy_handler_.OnUpdateHMILevel(kDeviceId_, kPolicyAppId_, hmi_level); +} + +TEST_F(RCPolicyHandlerTest, OnUpdateHMILevel_HmiLevelChanged_SUCCESS) { + EnablePolicyAndPolicyManagerMock(); + + EXPECT_CALL(app_manager_, application(kDeviceId_, kPolicyAppId_)) + .WillOnce(Return(mock_app_)); + + const std::string hmi_level("HMI_LIMITED"); + EXPECT_CALL(mock_message_helper_, StringToHMILevel(hmi_level)) + .WillOnce(Return(mobile_apis::HMILevel::HMI_LIMITED)); + + EXPECT_CALL(*mock_app_, hmi_level()) + .WillOnce(Return(mobile_apis::HMILevel::HMI_NONE)); + EXPECT_CALL(*mock_app_, app_id()).WillRepeatedly(Return(kAppId1_)); + + EXPECT_CALL(app_manager_, + ChangeAppsHMILevel(kAppId1_, mobile_apis::HMILevel::HMI_LIMITED)); + + EXPECT_CALL(mock_message_helper_, SendHMIStatusNotification(_, _)); + + policy_handler_.OnUpdateHMILevel(kDeviceId_, kPolicyAppId_, hmi_level); +} + +TEST_F(RCPolicyHandlerTest, CheckModule_SUCCESS) { + EnablePolicyAndPolicyManagerMock(); + + const PTString module("module"); + EXPECT_CALL(*mock_policy_manager_, CheckModule(kPolicyAppId_, module)) + .WillOnce(Return(true)); + + EXPECT_TRUE(policy_handler_.CheckModule(kPolicyAppId_, module)); +} + +ACTION_P(SetDeviceHandle, handle) { + *arg1 = handle; +} + +TEST_F(RCPolicyHandlerTest, + OnRemoteAppPermissionsChanged_DifferentDeviceHandle_SUCCESS) { + EnablePolicyAndPolicyManagerMock(); + EXPECT_CALL(*mock_policy_manager_, + SendAppPermissionsChanged(kDeviceId_, kPolicyAppId_)); + + policy_handler_.OnRemoteAppPermissionsChanged(kDeviceId_, kPolicyAppId_); +} + +TEST_F(RCPolicyHandlerTest, OnUpdateHMIStatus_InvalidApp_UNSUCCESS) { + EnablePolicyAndPolicyManagerMock(); + utils::SharedPtr<application_manager_test::MockApplication> invalid_app; + EXPECT_CALL(app_manager_, application(_, _)).WillOnce(Return(invalid_app)); + EXPECT_CALL(app_manager_, ChangeAppsHMILevel(_, _)).Times(0); + + const std::string hmi_level("HMI_NONE"); + policy_handler_.OnUpdateHMIStatus(kDeviceId_, kPolicyAppId_, hmi_level); +} + +TEST_F(RCPolicyHandlerTest, OnUpdateHMIStatus_HmiLevelInvalidEnum_UNSUCCESS) { + EnablePolicyAndPolicyManagerMock(); + EXPECT_CALL(app_manager_, application(kDeviceId_, kPolicyAppId_)) + .WillOnce(Return(mock_app_)); + + const std::string hmi_level("INVALID_ENUM"); + EXPECT_CALL(mock_message_helper_, StringToHMILevel(hmi_level)) + .WillOnce(Return(mobile_apis::HMILevel::INVALID_ENUM)); + + EXPECT_CALL(app_manager_, ChangeAppsHMILevel(_, _)).Times(0); + + policy_handler_.OnUpdateHMIStatus(kDeviceId_, kPolicyAppId_, hmi_level); +} + +TEST_F(RCPolicyHandlerTest, OnUpdateHMIStatus_ValidAppAndHmiLevel_SUCCESS) { + EnablePolicyAndPolicyManagerMock(); + EXPECT_CALL(app_manager_, application(kDeviceId_, kPolicyAppId_)) + .WillOnce(Return(mock_app_)); + + const std::string hmi_level("HMI_NONE"); + EXPECT_CALL(mock_message_helper_, StringToHMILevel(hmi_level)) + .WillOnce(Return(mobile_apis::HMILevel::HMI_NONE)); + + EXPECT_CALL(*mock_app_, app_id()).WillRepeatedly(Return(kAppId1_)); + + EXPECT_CALL(app_manager_, + ChangeAppsHMILevel(kAppId1_, mobile_apis::HMILevel::HMI_NONE)); + EXPECT_CALL(mock_message_helper_, SendHMIStatusNotification(_, _)); + + policy_handler_.OnUpdateHMIStatus(kDeviceId_, kPolicyAppId_, hmi_level); +} + +TEST_F(RCPolicyHandlerTest, + OnUpdateHMIStatusFourParams_HmiLevelInvalidEnum_UNSUCCESS) { + EnablePolicyAndPolicyManagerMock(); + EXPECT_CALL(app_manager_, application(kDeviceId_, kPolicyAppId_)) + .WillOnce(Return(mock_app_)); + + const std::string hmi_level("INVALID_ENUM"); + EXPECT_CALL(mock_message_helper_, StringToHMILevel(hmi_level)) + .WillOnce(Return(mobile_apis::HMILevel::INVALID_ENUM)); + + EXPECT_CALL(app_manager_, ChangeAppsHMILevel(_, _)).Times(0); + policy_handler_.OnUpdateHMIStatus(kDeviceId_, kPolicyAppId_, hmi_level); +} + +TEST_F(RCPolicyHandlerTest, OnUpdateHMIStatus_ValidParams_SUCCESS) { + EnablePolicyAndPolicyManagerMock(); + EXPECT_CALL(app_manager_, application(kDeviceId_, kPolicyAppId_)) + .WillOnce(Return(mock_app_)); + + const std::string hmi_level("HMI_NONE"); + EXPECT_CALL(mock_message_helper_, StringToHMILevel(hmi_level)) + .WillOnce(Return(mobile_apis::HMILevel::HMI_NONE)); + + EXPECT_CALL(*mock_app_, app_id()).WillRepeatedly(Return(kAppId1_)); + EXPECT_CALL(app_manager_, + ChangeAppsHMILevel(kAppId1_, mobile_apis::HMILevel::HMI_NONE)); + EXPECT_CALL(mock_message_helper_, SendHMIStatusNotification(_, _)); + + policy_handler_.OnUpdateHMIStatus(kDeviceId_, kPolicyAppId_, hmi_level); +} + +TEST_F(RCPolicyHandlerTest, GetModuleTypes_GetModuleTypes_SUCCESS) { + EnablePolicyAndPolicyManagerMock(); + std::vector<std::string> modules; + + EXPECT_CALL(*mock_policy_manager_, GetModuleTypes(kPolicyAppId_, &modules)) + .WillOnce(Return(true)); + + EXPECT_TRUE(policy_handler_.GetModuleTypes(kPolicyAppId_, &modules)); +} + +TEST_F(RCPolicyHandlerTest, CheckHMIType_ValidTypes_SUCCESS) { + EnablePolicyAndPolicyManagerMock(); + mobile_apis::AppHMIType::eType hmi = mobile_apis::AppHMIType::MEDIA; + + const smart_objects::SmartObjectSPtr app_types = + utils::MakeShared<smart_objects::SmartObject>( + smart_objects::SmartType_Array); + (*app_types)[strings::app_hmi_type][0] = mobile_apis::AppHMIType::MEDIA; + (*app_types)[strings::app_hmi_type][1] = + mobile_apis::AppHMIType::BACKGROUND_PROCESS; + + std::vector<int> policy_hmi_types; + policy_hmi_types.push_back(mobile_apis::AppHMIType::MEDIA); + policy_hmi_types.push_back(mobile_apis::AppHMIType::BACKGROUND_PROCESS); + + EXPECT_CALL(*mock_policy_manager_, GetHMITypes(kPolicyAppId_, _)) + .WillOnce(DoAll(SetArgPointee<1>(policy_hmi_types), Return(true))); + + EXPECT_TRUE(policy_handler_.CheckHMIType( + kPolicyAppId_, hmi, &(*app_types.get())[strings::app_hmi_type])); +} + +} // namespace rc_policy_handler_test +} // namespace components +} // namespace test diff --git a/src/components/config_profile/include/config_profile/profile.h b/src/components/config_profile/include/config_profile/profile.h index 42b0d10ceb..ac4950220e 100644 --- a/src/components/config_profile/include/config_profile/profile.h +++ b/src/components/config_profile/include/config_profile/profile.h @@ -111,6 +111,7 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, /** * @brief Returns true, if SDL 4.0 is enabled */ + // DEPRECATED, use max_supported_protocol_version instead bool enable_protocol_4() const OVERRIDE; /** @@ -130,6 +131,26 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, const uint32_t& app_icons_amount_to_remove() const OVERRIDE; /** + * @brief Returns the maximum payload size for control services + */ + size_t maximum_control_payload_size() const OVERRIDE; + + /** + * @brief Returns the maximum payload size for RPC services + */ + size_t maximum_rpc_payload_size() const OVERRIDE; + + /** + * @brief Returns the maximum payload size for audio services + */ + size_t maximum_audio_payload_size() const OVERRIDE; + + /** + * @brief Returns the maximum payload size for video services + */ + size_t maximum_video_payload_size() const OVERRIDE; + + /** * @brief Returns the path to the config file */ const std::string& config_file_name() const; @@ -155,9 +176,9 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, const uint16_t video_streaming_port() const OVERRIDE; /** - * @brief Returns port for audio streaming - */ - const uint16_t audio_streaming_port() const; + * @brief Returns port for audio streaming + */ + const uint16_t audio_streaming_port() const OVERRIDE; /** * @brief Returns streaming timeout @@ -191,6 +212,11 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, const std::vector<std::string>& vr_commands() const; /** + * @brief Returns folder containing all plugins + */ + const std::string& plugins_folder() const OVERRIDE; + + /** * @brief Maximum command id available for mobile app */ const uint32_t& max_cmd_id() const; @@ -209,7 +235,7 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, /** * @brief Returns desirable thread stack size */ - const uint64_t& thread_min_stack_size() const; + const uint64_t thread_min_stack_size() const; /** * @brief Returns true if audio mixing is supported @@ -323,7 +349,7 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, /* * @brief Returns file name for storing applications data */ - const std::string& app_info_storage() const; + const std::string& app_info_storage() const OVERRIDE; /* * @brief Path to preloaded policy file @@ -344,10 +370,19 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, // TransportManageSettings interface + /* + * @brief Returns true if last state singleton is used + */ bool use_last_state() const OVERRIDE; + /** + * @brief Timeout in transport manager before disconnect + */ uint32_t transport_manager_disconnect_timeout() const OVERRIDE; + /** + * @brief Returns port for TCP transport adapter + */ uint16_t transport_manager_tcp_adapter_port() const OVERRIDE; // TransportManageMMESettings interface @@ -759,10 +794,13 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, std::string app_config_folder_; std::string app_storage_folder_; std::string app_resource_folder_; - bool enable_protocol_4_; std::string app_icons_folder_; uint32_t app_icons_folder_max_size_; uint32_t app_icons_amount_to_remove_; + size_t maximum_control_payload_size_; + size_t maximum_rpc_payload_size_; + size_t maximum_audio_payload_size_; + size_t maximum_video_payload_size_; std::string config_file_name_; std::string server_address_; uint16_t server_port_; @@ -856,6 +894,7 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, std::string iap_pool_protocol_mask_; std::string iap_system_config_; std::string iap2_system_config_; + std::string plugins_folder_; int iap2_hub_connect_attempts_; int iap_hub_connection_wait_timeout_; uint16_t tts_global_properties_timeout_; diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc index beabc6afa8..6389375bb8 100644 --- a/src/components/config_profile/src/profile.cc +++ b/src/components/config_profile/src/profile.cc @@ -85,6 +85,7 @@ const char* kFilesystemRestrictionsSection = "FILESYSTEM RESTRICTIONS"; const char* kIAPSection = "IAP"; const char* kProtocolHandlerSection = "ProtocolHandler"; const char* kSDL4Section = "SDL4"; +const char* kSDL5Section = "SDL5"; const char* kResumptionSection = "Resumption"; const char* kAppLaunchSection = "AppLaunch"; @@ -100,10 +101,13 @@ const char* kAppStorageFolderKey = "AppStorageFolder"; const char* kAppResourseFolderKey = "AppResourceFolder"; const char* kLogsEnabledKey = "LogsEnabled"; const char* kAppConfigFolderKey = "AppConfigFolder"; -const char* kEnableProtocol4Key = "EnableProtocol4"; const char* kAppIconsFolderKey = "AppIconsFolder"; const char* kAppIconsFolderMaxSizeKey = "AppIconsFolderMaxSize"; const char* kAppIconsAmountToRemoveKey = "AppIconsAmountToRemove"; +const char* kMaximumControlPayloadSizeKey = "MaximumControlPayloadSize"; +const char* kMaximumRpcPayloadSizeKey = "MaximumRpcPayloadSize"; +const char* kMaximumAudioPayloadSizeKey = "MaximumAudioPayloadSize"; +const char* kMaximumVideoPayloadSizeKey = "MaximumVideoPayloadSize"; const char* kLaunchHMIKey = "LaunchHMI"; const char* kDefaultSDLVersion = ""; #ifdef WEB_HMI @@ -137,6 +141,7 @@ const char* kTimeoutPromptKey = "TimeOutPromt"; const char* kHelpTitleKey = "HelpTitle"; const char* kHelpCommandKey = "HelpCommand"; const char* kSystemFilesPathKey = "SystemFilesPath"; +const char* kPluginsFolderKey = "PluginFolder"; const char* kHeartBeatTimeoutKey = "HeartBeatTimeout"; const char* kMaxSupportedProtocolVersionKey = "MaxSupportedProtocolVersion"; const char* kUseLastStateKey = "UseLastState"; @@ -215,6 +220,7 @@ const char* kDefaultPreloadedPTFileName = "sdl_preloaded_pt.json"; const char* kDefaultServerAddress = "127.0.0.1"; const char* kDefaultAppInfoFileName = "app_info.dat"; const char* kDefaultSystemFilesPath = "/tmp/fs/mp/images/ivsu_cache"; +const char* kDefaultPluginsPath = "plugins"; const char* kDefaultTtsDelimiter = ","; const uint32_t kDefaultAudioDataStoppedTimeout = 1000; const uint32_t kDefaultVideoDataStoppedTimeout = 1000; @@ -238,7 +244,7 @@ const uint32_t kDefaultBeforeUpdateHours = 24; const uint32_t kDefaultHubProtocolIndex = 0; const uint32_t kDefaultHeartBeatTimeout = 0; -const uint16_t kDefaultMaxSupportedProtocolVersion = 3; +const uint16_t kDefaultMaxSupportedProtocolVersion = 5; const uint16_t kDefautTransportManagerTCPPort = 12345; const uint16_t kDefaultServerPort = 8087; const uint16_t kDefaultVideoStreamingPort = 5050; @@ -286,6 +292,10 @@ const uint16_t kDefaultOpenAttemptTimeoutMs = 500; const uint32_t kDefaultAppIconsFolderMaxSize = 104857600; const uint32_t kDefaultAppIconsAmountToRemove = 1; const uint16_t kDefaultAttemptsToOpenResumptionDB = 5; +const size_t kDefaultMaximumControlPayloadSize = 0; +const size_t kDefaultMaximumRpcPayloadSize = 0; +const size_t kDefaultMaximumAudioPayloadSize = 0; +const size_t kDefaultMaximumVideoPayloadSize = 0; const uint16_t kDefaultOpenAttemptTimeoutMsResumptionDB = 500; const uint16_t kDefaultAppLaunchWaitTime = 5000; const uint16_t kDefaultAppLaunchMaxRetryAttempt = 3; @@ -313,10 +323,13 @@ Profile::Profile() app_config_folder_() , app_storage_folder_() , app_resource_folder_() - , enable_protocol_4_(false) , app_icons_folder_() , app_icons_folder_max_size_(kDefaultAppIconsFolderMaxSize) , app_icons_amount_to_remove_(kDefaultAppIconsAmountToRemove) + , maximum_control_payload_size_(kDefaultMaximumControlPayloadSize) + , maximum_rpc_payload_size_(kDefaultMaximumRpcPayloadSize) + , maximum_audio_payload_size_(kDefaultMaximumAudioPayloadSize) + , maximum_video_payload_size_(kDefaultMaximumVideoPayloadSize) , config_file_name_(kDefaultConfigFileName) , server_address_(kDefaultServerAddress) , server_port_(kDefaultServerPort) @@ -439,7 +452,7 @@ const std::string& Profile::app_resource_folder() const { } bool Profile::enable_protocol_4() const { - return enable_protocol_4_; + return max_supported_protocol_version_ >= 4; } const std::string& Profile::app_icons_folder() const { @@ -454,6 +467,22 @@ const uint32_t& Profile::app_icons_amount_to_remove() const { return app_icons_amount_to_remove_; } +size_t Profile::maximum_control_payload_size() const { + return maximum_control_payload_size_; +} + +size_t Profile::maximum_rpc_payload_size() const { + return maximum_rpc_payload_size_; +} + +size_t Profile::maximum_audio_payload_size() const { + return maximum_audio_payload_size_; +} + +size_t Profile::maximum_video_payload_size() const { + return maximum_video_payload_size_; +} + const std::string& Profile::hmi_capabilities_file_name() const { return hmi_capabilities_file_name_; } @@ -514,7 +543,7 @@ const uint16_t& Profile::time_testing_port() const { return time_testing_port_; } -const uint64_t& Profile::thread_min_stack_size() const { +const uint64_t Profile::thread_min_stack_size() const { return min_tread_stack_size_; } @@ -634,6 +663,9 @@ const std::string& Profile::system_files_path() const { return system_files_path_; } +const std::string& Profile::plugins_folder() const { + return plugins_folder_; +} const std::vector<uint32_t>& Profile::supported_diag_modes() const { return supported_diag_modes_; } @@ -1008,17 +1040,6 @@ void Profile::UpdateValues() { LOG_UPDATED_VALUE(app_resource_folder_, kAppResourseFolderKey, kMainSection); - // Enable protocol ver.4 parameter - std::string enable_protocol_4_value; - if (ReadValue(&enable_protocol_4_value, kSDL4Section, kEnableProtocol4Key) && - 0 == strcmp("true", enable_protocol_4_value.c_str())) { - enable_protocol_4_ = true; - } else { - enable_protocol_4_ = false; - } - - LOG_UPDATED_BOOL_VALUE(enable_protocol_4_, kEnableProtocol4Key, kSDL4Section); - // Application icon folder ReadStringValue(&app_icons_folder_, file_system::CurrentWorkingDirectory().c_str(), @@ -1053,6 +1074,39 @@ void Profile::UpdateValues() { LOG_UPDATED_VALUE( app_icons_amount_to_remove_, kAppIconsAmountToRemoveKey, kSDL4Section); + ReadUIntValue(&maximum_control_payload_size_, + kDefaultMaximumControlPayloadSize, + kSDL5Section, + kMaximumControlPayloadSizeKey); + + LOG_UPDATED_VALUE(maximum_control_payload_size_, + kMaximumControlPayloadSizeKey, + kSDL5Section); + + ReadUIntValue(&maximum_rpc_payload_size_, + kDefaultMaximumRpcPayloadSize, + kSDL5Section, + kMaximumRpcPayloadSizeKey); + + LOG_UPDATED_VALUE( + maximum_rpc_payload_size_, kMaximumRpcPayloadSizeKey, kSDL5Section); + + ReadUIntValue(&maximum_audio_payload_size_, + kDefaultMaximumAudioPayloadSize, + kSDL5Section, + kMaximumAudioPayloadSizeKey); + + LOG_UPDATED_VALUE( + maximum_audio_payload_size_, kMaximumAudioPayloadSizeKey, kSDL5Section); + + ReadUIntValue(&maximum_video_payload_size_, + kDefaultMaximumVideoPayloadSize, + kSDL5Section, + kMaximumVideoPayloadSizeKey); + + LOG_UPDATED_VALUE( + maximum_video_payload_size_, kMaximumVideoPayloadSizeKey, kSDL5Section); + // Application info file name ReadStringValue(&app_info_storage_, kDefaultAppInfoFileName, @@ -1507,6 +1561,10 @@ void Profile::UpdateValues() { LOG_UPDATED_VALUE(system_files_path_, kSystemFilesPathKey, kMainSection); + // Plugins folder + ReadStringValue( + &plugins_folder_, kDefaultPluginsPath, kMainSection, kPluginsFolderKey); + LOG_UPDATED_VALUE(plugins_folder_, kPluginsFolderKey, kMainSection); // Heartbeat timeout ReadUIntValue(&heart_beat_timeout_, kDefaultHeartBeatTimeout, @@ -1633,10 +1691,11 @@ void Profile::UpdateValues() { kProtocolHandlerSection, kMaxSupportedProtocolVersionKey); - // if .ini file contains protocol version less than 2 or more than 3 - // max_supported_protocol_version_ = 3 - if (max_supported_protocol_version_ < 2) { - max_supported_protocol_version_ = 3; + if (max_supported_protocol_version_ < 1) { + max_supported_protocol_version_ = 1; + } else if (max_supported_protocol_version_ > + kDefaultMaxSupportedProtocolVersion) { + max_supported_protocol_version_ = kDefaultMaxSupportedProtocolVersion; } LOG_UPDATED_BOOL_VALUE(enable_policy_, kEnablePolicy, kPolicySection); diff --git a/src/components/connection_handler/include/connection_handler/connection_handler_impl.h b/src/components/connection_handler/include/connection_handler/connection_handler_impl.h index cd8aec0ff3..aebc612a22 100644 --- a/src/components/connection_handler/include/connection_handler/connection_handler_impl.h +++ b/src/components/connection_handler/include/connection_handler/connection_handler_impl.h @@ -49,6 +49,7 @@ #include "utils/logger.h" #include "utils/macro.h" +#include "utils/message_queue.h" #include "utils/lock.h" #include "utils/stl_utils.h" #include "utils/rwlock.h" @@ -182,6 +183,7 @@ class ConnectionHandlerImpl * \param hash_id pointer for session hash identifier * \return uint32_t Id (number) of new session if successful, otherwise 0. */ + // DEPRECATED virtual uint32_t OnSessionStartedCallback( const transport_manager::ConnectionUID connection_handle, const uint8_t session_id, @@ -191,18 +193,43 @@ class ConnectionHandlerImpl /** * \brief Callback function used by ProtocolHandler + * when Mobile Application initiates start of new session. + * Result must be notified through NotifySessionStartedResult(). + * \param connection_handle Connection identifier within which session + * has to be started. + * \param sessionId Identifier of the session to be start + * \param service_type Type of service + * \param protocol_version Version of protocol + * \param is_protected would be service protected + * \param params configuration parameters specified by mobile + */ + virtual void OnSessionStartedCallback( + const transport_manager::ConnectionUID connection_handle, + const uint8_t session_id, + const protocol_handler::ServiceType& service_type, + const bool is_protected, + const BsonObject* params); + + // DEPRECATED + uint32_t OnSessionEndedCallback( + const transport_manager::ConnectionUID connection_handle, + const uint8_t session_id, + const uint32_t& hashCode, + const protocol_handler::ServiceType& service_type) OVERRIDE; + /** + * \brief Callback function used by ProtocolHandler * when Mobile Application initiates session ending. * \param connection_handle Connection identifier within which session exists * \param sessionId Identifier of the session to be ended * \param hashCode Hash used only in second version of SmartDeviceLink - * protocol. + * protocol. (Set to HASH_ID_WRONG if the hash is incorrect) * If not equal to hash assigned to session on start then operation fails. * \return uint32_t 0 if operation fails, session key otherwise */ uint32_t OnSessionEndedCallback( const transport_manager::ConnectionUID connection_handle, const uint8_t session_id, - const uint32_t& hashCode, + uint32_t* hashCode, const protocol_handler::ServiceType& service_type) OVERRIDE; /** @@ -435,8 +462,72 @@ class ConnectionHandlerImpl const protocol_handler::SessionObserver& get_session_observer(); DevicesDiscoveryStarter& get_device_discovery_starter(); + /** + * \brief Invoked when observer's OnServiceStartedCallback is completed + * \param session_key the key of started session passed to + * OnServiceStartedCallback(). + * \param result true if observer accepts starting service, false otherwise + * \param rejected_params list of rejected parameters' name. Only valid when + * result is false. Note that even if result is false, this may be empty. + * + * \note This is invoked only once but can be invoked by multiple threads. + * Also it can be invoked before OnServiceStartedCallback() returns. + **/ + virtual void NotifyServiceStartedResult( + uint32_t session_key, + bool result, + std::vector<std::string>& rejected_params); + private: /** + * \brief Struct to keep variables between OnSessionStartedCallback() and + * NotifyServiceStartedResult() + **/ + struct ServiceStartedContext { + transport_manager::ConnectionUID connection_handle_; + uint8_t session_id_; + uint32_t new_session_id_; + protocol_handler::ServiceType service_type_; + uint32_t hash_id_; + bool is_protected_; + + /** + * \brief Constructor + */ + ServiceStartedContext() + : connection_handle_(0) + , session_id_(0) + , new_session_id_(0) + , service_type_(protocol_handler::kInvalidServiceType) + , hash_id_(0) + , is_protected_(0) {} + + /** + * \brief Constructor + * \param connection_handle Connection identifier within which session is + * started. + * \param session_id Session ID specified to OnSessionStartedCallback() + * \param new_session_id Session ID generated + * \param service_type Type of service + * \param hash_id Hash ID generated from connection_handle and + * new_session_id + * \param is_protected Whether service will be protected + **/ + ServiceStartedContext(transport_manager::ConnectionUID connection_handle, + uint8_t session_id, + uint32_t new_session_id, + protocol_handler::ServiceType service_type, + uint32_t hash_id, + bool is_protected) + : connection_handle_(connection_handle) + , session_id_(session_id) + , new_session_id_(new_session_id) + , service_type_(service_type) + , hash_id_(hash_id) + , is_protected_(is_protected) {} + }; + + /** * \brief Disconnect application. * * \param device_handle DeviceHandle of disconnected device. @@ -446,6 +537,19 @@ class ConnectionHandlerImpl void OnConnectionEnded(const transport_manager::ConnectionUID connection_id); + /** + * \brief Convenient method to call NotifySessionStartedResult() with + * negative result. + * \param connection_handle Identifier of connection within which session + * exists + * \param session_id session ID passed to OnSessionStartedCallback() + * \param is_protected whether the service would be protected + **/ + void NotifySessionStartedFailure( + const transport_manager::ConnectionUID connection_handle, + const uint8_t session_id, + bool is_protected); + const ConnectionHandlerSettings& settings_; /** * \brief Pointer to observer @@ -480,6 +584,9 @@ class ConnectionHandlerImpl */ utils::StlMapDeleter<ConnectionList> connection_list_deleter_; + sync_primitives::Lock start_service_context_map_lock_; + std::map<uint32_t, ServiceStartedContext> start_service_context_map_; + #ifdef BUILD_TESTS // Methods for test usage public: diff --git a/src/components/connection_handler/src/connection.cc b/src/components/connection_handler/src/connection.cc index 7bb54d4493..202736e612 100644 --- a/src/components/connection_handler/src/connection.cc +++ b/src/components/connection_handler/src/connection.cc @@ -352,8 +352,7 @@ bool Connection::SupportHeartBeat(uint8_t session_id) { } Session& session = session_it->second; return ( - (::protocol_handler::PROTOCOL_VERSION_3 == session.protocol_version || - ::protocol_handler::PROTOCOL_VERSION_4 == session.protocol_version) && + (session.protocol_version >= ::protocol_handler::PROTOCOL_VERSION_3) && (0 != heartbeat_timeout_)); } diff --git a/src/components/connection_handler/src/connection_handler_impl.cc b/src/components/connection_handler/src/connection_handler_impl.cc index 0f6720f6a1..6dd4fe06d7 100644 --- a/src/components/connection_handler/src/connection_handler_impl.cc +++ b/src/components/connection_handler/src/connection_handler_impl.cc @@ -69,7 +69,9 @@ ConnectionHandlerImpl::ConnectionHandlerImpl( , protocol_handler_(NULL) , connection_list_lock_() , connection_handler_observer_lock_() - , connection_list_deleter_(&connection_list_) {} + , connection_list_deleter_(&connection_list_) + , start_service_context_map_lock_() + , start_service_context_map_() {} ConnectionHandlerImpl::~ConnectionHandlerImpl() { LOG4CXX_AUTO_TRACE(logger_); @@ -82,6 +84,9 @@ void ConnectionHandlerImpl::Stop() { RemoveConnection(itr->second->connection_handle()); itr = connection_list_.begin(); } + + sync_primitives::AutoLock auto_lock(start_service_context_map_lock_); + start_service_context_map_.clear(); } void ConnectionHandlerImpl::set_connection_handler_observer( @@ -169,12 +174,12 @@ void ConnectionHandlerImpl::OnDeviceRemoved( RemoveConnection(*it); } - device_list_.erase(device_info.device_handle()); sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_); if (connection_handler_observer_) { connection_handler_observer_->RemoveDevice(device_info.device_handle()); connection_handler_observer_->OnDeviceListUpdated(device_list_); } + device_list_.erase(device_info.device_handle()); } void ConnectionHandlerImpl::OnScanDevicesFinished() { @@ -279,6 +284,7 @@ bool AllowProtection(const ConnectionHandlerSettings& settings, } #endif // ENABLE_SECURITY +// DEPRECATED uint32_t ConnectionHandlerImpl::OnSessionStartedCallback( const transport_manager::ConnectionUID connection_handle, const uint8_t session_id, @@ -290,6 +296,7 @@ uint32_t ConnectionHandlerImpl::OnSessionStartedCallback( if (hash_id) { *hash_id = protocol_handler::HASH_ID_WRONG; } + #ifdef ENABLE_SECURITY if (!AllowProtection(get_settings(), service_type, is_protected)) { return 0; @@ -348,6 +355,163 @@ uint32_t ConnectionHandlerImpl::OnSessionStartedCallback( return new_session_id; } +void ConnectionHandlerImpl::OnSessionStartedCallback( + const transport_manager::ConnectionUID connection_handle, + const uint8_t session_id, + const protocol_handler::ServiceType& service_type, + const bool is_protected, + const BsonObject* params) { + LOG4CXX_AUTO_TRACE(logger_); + + uint32_t new_session_id = 0; + uint32_t hash_id = protocol_handler::HASH_ID_WRONG; + +#ifdef ENABLE_SECURITY + if (!AllowProtection(get_settings(), service_type, is_protected)) { + std::vector<std::string> empty; + protocol_handler_->NotifySessionStartedResult(connection_handle, + session_id, + new_session_id, + hash_id, + is_protected, + empty); + return; + } +#endif // ENABLE_SECURITY + sync_primitives::AutoReadLock lock(connection_list_lock_); + ConnectionList::iterator it = connection_list_.find(connection_handle); + if (connection_list_.end() == it) { + LOG4CXX_ERROR(logger_, "Unknown connection!"); + NotifySessionStartedFailure(connection_handle, session_id, is_protected); + return; + } + + Connection* connection = it->second; + if ((0 == session_id) && (protocol_handler::kRpc == service_type)) { + new_session_id = connection->AddNewSession(); + if (0 == new_session_id) { + LOG4CXX_ERROR(logger_, "Couldn't start new session!"); + NotifySessionStartedFailure(connection_handle, session_id, is_protected); + return; + } + hash_id = KeyFromPair(connection_handle, new_session_id); + } else { // Could be create new service or protected exists one + if (!connection->AddNewService(session_id, service_type, is_protected)) { + LOG4CXX_ERROR(logger_, + "Couldn't establish " +#ifdef ENABLE_SECURITY + << (is_protected ? "protected" : "non-protected") +#endif // ENABLE_SECURITY + << " service " << static_cast<int>(service_type) + << " for session " << static_cast<int>(session_id)); + NotifySessionStartedFailure(connection_handle, session_id, is_protected); + return; + } + new_session_id = session_id; + hash_id = protocol_handler::HASH_ID_NOT_SUPPORTED; + } + sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_); + if (connection_handler_observer_) { + const uint32_t session_key = KeyFromPair(connection_handle, new_session_id); + + ServiceStartedContext context(connection_handle, + session_id, + new_session_id, + service_type, + hash_id, + is_protected); + { + sync_primitives::AutoLock auto_lock(start_service_context_map_lock_); + start_service_context_map_[session_key] = context; + } + + connection_handler_observer_->OnServiceStartedCallback( + connection->connection_device_handle(), + session_key, + service_type, + params); + } else { + if (protocol_handler_) { + std::vector<std::string> empty; + protocol_handler_->NotifySessionStartedResult(connection_handle, + session_id, + new_session_id, + hash_id, + is_protected, + empty); + } + } +} + +void ConnectionHandlerImpl::NotifyServiceStartedResult( + uint32_t session_key, + bool result, + std::vector<std::string>& rejected_params) { + LOG4CXX_AUTO_TRACE(logger_); + + ServiceStartedContext context; + { + sync_primitives::AutoLock auto_lock(start_service_context_map_lock_); + std::map<uint32_t, ServiceStartedContext>::iterator it = + start_service_context_map_.find(session_key); + if (it == start_service_context_map_.end()) { + LOG4CXX_ERROR(logger_, "context for start service not found!"); + return; + } + context = it->second; + start_service_context_map_.erase(it); + } + + Connection* connection = NULL; + { + sync_primitives::AutoReadLock lock(connection_list_lock_); + ConnectionList::iterator it = + connection_list_.find(context.connection_handle_); + if (connection_list_.end() == it) { + LOG4CXX_ERROR(logger_, "connection not found"); + return; + } + connection = it->second; + } + + if (!result) { + LOG4CXX_WARN(logger_, + "Service starting forbidden by connection_handler_observer"); + if (protocol_handler::kRpc == context.service_type_) { + connection->RemoveSession(context.new_session_id_); + } else { + connection->RemoveService(context.session_id_, context.service_type_); + } + context.new_session_id_ = 0; + } + + if (protocol_handler_ != NULL) { + protocol_handler_->NotifySessionStartedResult(context.connection_handle_, + context.session_id_, + context.new_session_id_, + context.hash_id_, + context.is_protected_, + rejected_params); + } +} + +void ConnectionHandlerImpl::NotifySessionStartedFailure( + const transport_manager::ConnectionUID connection_handle, + const uint8_t session_id, + bool is_protected) { + LOG4CXX_AUTO_TRACE(logger_); + if (protocol_handler_) { + std::vector<std::string> empty; + protocol_handler_->NotifySessionStartedResult( + connection_handle, + session_id, + 0, + protocol_handler::HASH_ID_WRONG, + is_protected, + empty); + } +} + void ConnectionHandlerImpl::OnApplicationFloodCallBack( const uint32_t& connection_key) { LOG4CXX_AUTO_TRACE(logger_); @@ -378,11 +542,22 @@ void ConnectionHandlerImpl::OnMalformedMessageCallback( CloseConnection(connection_handle); } +// DEPRECATED uint32_t ConnectionHandlerImpl::OnSessionEndedCallback( const transport_manager::ConnectionUID connection_handle, const uint8_t session_id, const uint32_t& hashCode, const protocol_handler::ServiceType& service_type) { + uint32_t hashValue = hashCode; + return OnSessionEndedCallback( + connection_handle, session_id, &hashValue, service_type); +} + +uint32_t ConnectionHandlerImpl::OnSessionEndedCallback( + const transport_manager::ConnectionUID connection_handle, + const uint8_t session_id, + uint32_t* hashCode, + const protocol_handler::ServiceType& service_type) { LOG4CXX_AUTO_TRACE(logger_); connection_list_lock_.AcquireForReading(); @@ -402,12 +577,13 @@ uint32_t ConnectionHandlerImpl::OnSessionEndedCallback( "Session " << static_cast<uint32_t>(session_id) << " to be removed"); // old version of protocol doesn't support hash - if (protocol_handler::HASH_ID_NOT_SUPPORTED != hashCode) { - if (protocol_handler::HASH_ID_WRONG == hashCode || - session_key != hashCode) { + if (protocol_handler::HASH_ID_NOT_SUPPORTED != *hashCode) { + if (protocol_handler::HASH_ID_WRONG == *hashCode || + session_key != *hashCode) { LOG4CXX_WARN(logger_, "Wrong hash_id for session " << static_cast<uint32_t>(session_id)); + *hashCode = protocol_handler::HASH_ID_WRONG; return 0; } } @@ -669,6 +845,7 @@ security_manager::SSLContext::HandshakeContext ConnectionHandlerImpl::GetHandshakeContext(uint32_t key) const { return connection_handler_observer_->GetHandshakeContext(key); } + #endif // ENABLE_SECURITY void ConnectionHandlerImpl::StartDevicesDiscovery() { diff --git a/src/components/connection_handler/test/connection_handler_impl_test.cc b/src/components/connection_handler/test/connection_handler_impl_test.cc index 6b5c2c89ad..ec4e12ffe2 100644 --- a/src/components/connection_handler/test/connection_handler_impl_test.cc +++ b/src/components/connection_handler/test/connection_handler_impl_test.cc @@ -54,10 +54,18 @@ using namespace ::connection_handler; using ::protocol_handler::ServiceType; using namespace ::protocol_handler; using ::testing::_; +using ::testing::ByRef; +using ::testing::DoAll; using ::testing::InSequence; using ::testing::Mock; using ::testing::Return; using ::testing::ReturnRefOfCopy; +using ::testing::SaveArg; + +// custom action to call a member function with 3 arguments +ACTION_P5(InvokeMemberFuncWithArg3, ptr, memberFunc, a, b, c) { + (ptr->*memberFunc)(a, b, c); +} namespace { const uint32_t kAsyncExpectationsTimeout = 10000u; @@ -108,8 +116,16 @@ class ConnectionHandlerTest : public ::testing::Test { // Remove all specific services } void AddTestSession() { - start_session_id_ = connection_handler_->OnSessionStartedCallback( - uid_, 0, kRpc, PROTECTION_OFF, &out_hash_id_); + protocol_handler_test::MockProtocolHandler temp_protocol_handler; + connection_handler_->set_protocol_handler(&temp_protocol_handler); + EXPECT_CALL(temp_protocol_handler, + NotifySessionStartedResult(_, _, _, _, _, _)) + .WillOnce( + DoAll(SaveArg<2>(&start_session_id_), SaveArg<3>(&out_hash_id_))); + + connection_handler_->OnSessionStartedCallback( + uid_, 0, kRpc, PROTECTION_OFF, static_cast<BsonObject*>(NULL)); + connection_handler_->set_protocol_handler(NULL); EXPECT_NE(0u, start_session_id_); EXPECT_EQ(SessionHash(uid_, start_session_id_), out_hash_id_); connection_key_ = connection_handler_->KeyFromPair(uid_, start_session_id_); @@ -123,8 +139,20 @@ class ConnectionHandlerTest : public ::testing::Test { EXPECT_EQ(SessionHash(uid_, start_session_id_), out_hash_id_); connection_key_ = connection_handler_->KeyFromPair(uid_, start_session_id_); CheckSessionExists(uid_, start_session_id_); - uint32_t session_id = connection_handler_->OnSessionStartedCallback( - uid_, start_session_id_, service_type, PROTECTION_OFF, 0); + + uint32_t session_id = 0; + protocol_handler_test::MockProtocolHandler temp_protocol_handler; + connection_handler_->set_protocol_handler(&temp_protocol_handler); + EXPECT_CALL(temp_protocol_handler, + NotifySessionStartedResult(_, _, _, _, _, _)) + .WillOnce(SaveArg<2>(&session_id)); + + connection_handler_->OnSessionStartedCallback(uid_, + start_session_id_, + service_type, + PROTECTION_OFF, + static_cast<BsonObject*>(0)); + connection_handler_->set_protocol_handler(NULL); EXPECT_EQ(session_id, start_session_id_); } @@ -267,8 +295,14 @@ TEST_F(ConnectionHandlerTest, StartSession_NoConnection) { // Null sessionId for start new session const uint8_t sessionID = 0; // Start new session with RPC service - const uint32_t result_fail = connection_handler_->OnSessionStartedCallback( - uid_, sessionID, kRpc, PROTECTION_ON, &out_hash_id_); + uint32_t result_fail = 0; + connection_handler_->set_protocol_handler(&mock_protocol_handler_); + EXPECT_CALL(mock_protocol_handler_, + NotifySessionStartedResult(_, _, _, _, _, _)) + .WillOnce(DoAll(SaveArg<2>(&result_fail), SaveArg<3>(&out_hash_id_))); + + connection_handler_->OnSessionStartedCallback( + uid_, sessionID, kRpc, PROTECTION_ON, static_cast<BsonObject*>(NULL)); // Unknown connection error is '0' EXPECT_EQ(0u, result_fail); EXPECT_EQ(protocol_handler::HASH_ID_WRONG, out_hash_id_); @@ -1013,26 +1047,66 @@ TEST_F(ConnectionHandlerTest, StartService_withServices) { AddTestDeviceConnection(); AddTestSession(); + uint32_t start_audio = 0; + uint32_t start_video = 0; + connection_handler_->set_protocol_handler(&mock_protocol_handler_); + EXPECT_CALL(mock_protocol_handler_, + NotifySessionStartedResult(_, _, _, _, _, _)) + .WillOnce(DoAll(SaveArg<2>(&start_audio), SaveArg<3>(&out_hash_id_))) + .WillOnce(DoAll(SaveArg<2>(&start_video), SaveArg<3>(&out_hash_id_))); + // Start Audio service - const uint32_t start_audio = connection_handler_->OnSessionStartedCallback( - uid_, start_session_id_, kAudio, PROTECTION_OFF, &out_hash_id_); + connection_handler_->OnSessionStartedCallback(uid_, + start_session_id_, + kAudio, + PROTECTION_OFF, + static_cast<BsonObject*>(NULL)); EXPECT_EQ(start_session_id_, start_audio); CheckServiceExists(uid_, start_session_id_, kAudio, true); EXPECT_EQ(protocol_handler::HASH_ID_NOT_SUPPORTED, out_hash_id_); // Start Audio service - const uint32_t start_video = connection_handler_->OnSessionStartedCallback( - uid_, start_session_id_, kMobileNav, PROTECTION_OFF, &out_hash_id_); + connection_handler_->OnSessionStartedCallback(uid_, + start_session_id_, + kMobileNav, + PROTECTION_OFF, + static_cast<BsonObject*>(NULL)); EXPECT_EQ(start_session_id_, start_video); CheckServiceExists(uid_, start_session_id_, kMobileNav, true); EXPECT_EQ(protocol_handler::HASH_ID_NOT_SUPPORTED, out_hash_id_); + + connection_handler_->set_protocol_handler(NULL); } -TEST_F(ConnectionHandlerTest, ServiceStop_UnExistSession) { +TEST_F(ConnectionHandlerTest, StartService_withServices_withParams) { AddTestDeviceConnection(); + AddTestSession(); + uint32_t start_video = 0; + // create a dummy pointer + int dummy = 0; + std::vector<std::string> empty; + BsonObject* dummy_param = reinterpret_cast<BsonObject*>(&dummy); + connection_handler_->set_protocol_handler(&mock_protocol_handler_); + EXPECT_CALL(mock_protocol_handler_, + NotifySessionStartedResult(_, _, _, _, _, empty)) + .WillOnce(DoAll(SaveArg<2>(&start_video), SaveArg<3>(&out_hash_id_))); + + connection_handler_->OnSessionStartedCallback( + uid_, start_session_id_, kMobileNav, PROTECTION_OFF, dummy_param); + EXPECT_EQ(start_session_id_, start_video); + CheckServiceExists(uid_, start_session_id_, kMobileNav, true); + EXPECT_EQ(protocol_handler::HASH_ID_NOT_SUPPORTED, out_hash_id_); + + connection_handler_->set_protocol_handler(NULL); +} + +TEST_F(ConnectionHandlerTest, ServiceStop_UnExistSession) { + AddTestDeviceConnection(); + uint32_t dummy_hash = 0u; const uint32_t end_session_result = - connection_handler_->OnSessionEndedCallback(uid_, 0u, 0u, kAudio); + connection_handler_->OnSessionEndedCallback( + uid_, 0u, &dummy_hash, kAudio); EXPECT_EQ(0u, end_session_result); CheckSessionExists(uid_, 0); } @@ -1040,9 +1114,10 @@ TEST_F(ConnectionHandlerTest, ServiceStop_UnExistSession) { TEST_F(ConnectionHandlerTest, ServiceStop_UnExistService) { AddTestDeviceConnection(); AddTestSession(); + uint32_t dummy_hash = 0u; const uint32_t end_session_result = connection_handler_->OnSessionEndedCallback( - uid_, start_session_id_, 0u, kAudio); + uid_, start_session_id_, &dummy_hash, kAudio); EXPECT_EQ(0u, end_session_result); CheckServiceExists(uid_, start_session_id_, kAudio, false); } @@ -1050,17 +1125,29 @@ TEST_F(ConnectionHandlerTest, ServiceStop_UnExistService) { TEST_F(ConnectionHandlerTest, ServiceStop) { AddTestDeviceConnection(); AddTestSession(); + + uint32_t start_audio = 0; + connection_handler_->set_protocol_handler(&mock_protocol_handler_); + EXPECT_CALL(mock_protocol_handler_, + NotifySessionStartedResult(_, _, _, _, _, _)) + .WillRepeatedly( + DoAll(SaveArg<2>(&start_audio), SaveArg<3>(&out_hash_id_))); + // Check ignoring hash_id on stop non-rpc service for (uint32_t some_hash_id = 0; some_hash_id < 0xFF; ++some_hash_id) { // Start audio service - const uint32_t start_audio = connection_handler_->OnSessionStartedCallback( - uid_, start_session_id_, kAudio, PROTECTION_OFF, &out_hash_id_); + connection_handler_->OnSessionStartedCallback( + uid_, + start_session_id_, + kAudio, + PROTECTION_OFF, + static_cast<BsonObject*>(NULL)); EXPECT_EQ(start_session_id_, start_audio); EXPECT_EQ(protocol_handler::HASH_ID_NOT_SUPPORTED, out_hash_id_); const uint32_t end_session_result = connection_handler_->OnSessionEndedCallback( - uid_, start_session_id_, some_hash_id, kAudio); + uid_, start_session_id_, &some_hash_id, kAudio); EXPECT_EQ(connection_key_, end_session_result); CheckServiceExists(uid_, start_session_id_, kAudio, false); } @@ -1072,12 +1159,13 @@ TEST_F(ConnectionHandlerTest, SessionStop_CheckHash) { AddTestSession(); const uint32_t hash = connection_key_; - const uint32_t wrong_hash = hash + 1; + uint32_t wrong_hash = hash + 1; const uint32_t end_audio_wrong_hash = connection_handler_->OnSessionEndedCallback( - uid_, start_session_id_, wrong_hash, kRpc); + uid_, start_session_id_, &wrong_hash, kRpc); EXPECT_EQ(0u, end_audio_wrong_hash); + EXPECT_EQ(protocol_handler::HASH_ID_WRONG, wrong_hash); CheckSessionExists(uid_, start_session_id_); const uint32_t end_audio = connection_handler_->OnSessionEndedCallback( @@ -1092,13 +1180,14 @@ TEST_F(ConnectionHandlerTest, SessionStop_CheckSpecificHash) { for (uint32_t session = 0; session < 0xFF; ++session) { AddTestSession(); - const uint32_t wrong_hash = protocol_handler::HASH_ID_WRONG; + uint32_t wrong_hash = protocol_handler::HASH_ID_WRONG; const uint32_t hash = protocol_handler::HASH_ID_NOT_SUPPORTED; const uint32_t end_audio_wrong_hash = connection_handler_->OnSessionEndedCallback( uid_, start_session_id_, wrong_hash, kRpc); EXPECT_EQ(0u, end_audio_wrong_hash); + EXPECT_EQ(protocol_handler::HASH_ID_WRONG, wrong_hash); CheckSessionExists(uid_, start_session_id_); const uint32_t end_audio = connection_handler_->OnSessionEndedCallback( @@ -1118,17 +1207,197 @@ TEST_F(ConnectionHandlerTest, SessionStarted_WithRpc) { &mock_connection_handler_observer); uint32_t session_key = connection_handler_->KeyFromPair(uid_, start_session_id_); + std::vector<std::string> empty; EXPECT_CALL(mock_connection_handler_observer, - OnServiceStartedCallback(device_handle_, session_key, kRpc)) - .WillOnce(Return(true)); + OnServiceStartedCallback(device_handle_, session_key, kRpc, NULL)) + .WillOnce(InvokeMemberFuncWithArg3( + connection_handler_, + &ConnectionHandler::NotifyServiceStartedResult, + session_key, + true, + ByRef(empty))); + + uint32_t new_session_id = 0; + connection_handler_->set_protocol_handler(&mock_protocol_handler_); + EXPECT_CALL(mock_protocol_handler_, + NotifySessionStartedResult(_, _, _, _, _, _)) + .WillOnce(DoAll(SaveArg<2>(&new_session_id), SaveArg<3>(&out_hash_id_))); // Start new session with RPC service - uint32_t new_session_id = connection_handler_->OnSessionStartedCallback( - uid_, 0, kRpc, PROTECTION_OFF, &out_hash_id_); + connection_handler_->OnSessionStartedCallback( + uid_, 0, kRpc, PROTECTION_OFF, static_cast<BsonObject*>(NULL)); + + EXPECT_NE(0u, new_session_id); +} + +TEST_F(ConnectionHandlerTest, ServiceStarted_Video_SUCCESS) { + AddTestDeviceConnection(); + AddTestSession(); + + int dummy = 0; + BsonObject* dummy_params = reinterpret_cast<BsonObject*>(&dummy); + + connection_handler_test::MockConnectionHandlerObserver + mock_connection_handler_observer; + connection_handler_->set_connection_handler_observer( + &mock_connection_handler_observer); + uint32_t session_key = + connection_handler_->KeyFromPair(uid_, start_session_id_); + std::vector<std::string> empty; + EXPECT_CALL(mock_connection_handler_observer, + OnServiceStartedCallback( + device_handle_, session_key, kMobileNav, dummy_params)) + .WillOnce(InvokeMemberFuncWithArg3( + connection_handler_, + &ConnectionHandler::NotifyServiceStartedResult, + session_key, + true, + ByRef(empty))); + + // confirm that NotifySessionStartedResult() is called + uint32_t new_session_id = 0; + connection_handler_->set_protocol_handler(&mock_protocol_handler_); + EXPECT_CALL(mock_protocol_handler_, + NotifySessionStartedResult(_, _, _, _, false, empty)) + .WillOnce(DoAll(SaveArg<2>(&new_session_id), SaveArg<3>(&out_hash_id_))); + + connection_handler_->OnSessionStartedCallback( + uid_, start_session_id_, kMobileNav, PROTECTION_OFF, dummy_params); EXPECT_NE(0u, new_session_id); } +TEST_F(ConnectionHandlerTest, ServiceStarted_Video_FAILURE) { + AddTestDeviceConnection(); + AddTestSession(); + + int dummy = 0; + BsonObject* dummy_params = reinterpret_cast<BsonObject*>(&dummy); + + connection_handler_test::MockConnectionHandlerObserver + mock_connection_handler_observer; + connection_handler_->set_connection_handler_observer( + &mock_connection_handler_observer); + uint32_t session_key = + connection_handler_->KeyFromPair(uid_, start_session_id_); + std::vector<std::string> empty; + EXPECT_CALL(mock_connection_handler_observer, + OnServiceStartedCallback( + device_handle_, session_key, kMobileNav, dummy_params)) + .WillOnce(InvokeMemberFuncWithArg3( + connection_handler_, + &ConnectionHandler::NotifyServiceStartedResult, + session_key, + false, + ByRef(empty))); + + // confirm that NotifySessionStartedResult() is called + uint32_t new_session_id = 0; + connection_handler_->set_protocol_handler(&mock_protocol_handler_); + EXPECT_CALL(mock_protocol_handler_, + NotifySessionStartedResult(_, _, _, _, false, empty)) + .WillOnce(DoAll(SaveArg<2>(&new_session_id), SaveArg<3>(&out_hash_id_))); + + connection_handler_->OnSessionStartedCallback( + uid_, start_session_id_, kMobileNav, PROTECTION_OFF, dummy_params); + + EXPECT_EQ(0u, new_session_id); +} + +/* + * Simulate two OnSessionStartedCallback calls, and connection handler observer + * returns a positive reply for the first call with delay and a negative reply + * for the second call immediately. + */ +TEST_F(ConnectionHandlerTest, ServiceStarted_Video_Multiple) { + AddTestDeviceConnection(); + + uint32_t rpc_session_id1; + uint32_t rpc_session_id2; + uint32_t hash_id1; + uint32_t hash_id2; + + protocol_handler_test::MockProtocolHandler temp_protocol_handler; + connection_handler_->set_protocol_handler(&temp_protocol_handler); + EXPECT_CALL(temp_protocol_handler, + NotifySessionStartedResult(_, _, _, _, _, _)) + .WillOnce(DoAll(SaveArg<2>(&rpc_session_id1), SaveArg<3>(&hash_id1))) + .WillOnce(DoAll(SaveArg<2>(&rpc_session_id2), SaveArg<3>(&hash_id2))); + + // add two sessions + connection_handler_->OnSessionStartedCallback( + uid_, 0, kRpc, PROTECTION_OFF, static_cast<BsonObject*>(NULL)); + connection_handler_->OnSessionStartedCallback( + uid_, 0, kRpc, PROTECTION_OFF, static_cast<BsonObject*>(NULL)); + + EXPECT_NE(0u, rpc_session_id1); + EXPECT_NE(0u, rpc_session_id2); + EXPECT_EQ(SessionHash(uid_, rpc_session_id1), hash_id1); + EXPECT_EQ(SessionHash(uid_, rpc_session_id2), hash_id2); + CheckSessionExists(uid_, rpc_session_id1); + CheckSessionExists(uid_, rpc_session_id2); + + connection_handler_->set_protocol_handler(NULL); + + int dummy = 0; + BsonObject* dummy_params = reinterpret_cast<BsonObject*>(&dummy); + + connection_handler_test::MockConnectionHandlerObserver + mock_connection_handler_observer; + connection_handler_->set_connection_handler_observer( + &mock_connection_handler_observer); + uint32_t session_key1 = + connection_handler_->KeyFromPair(uid_, rpc_session_id1); + uint32_t session_key2 = + connection_handler_->KeyFromPair(uid_, rpc_session_id2); + + std::vector<std::string> empty; + + EXPECT_CALL(mock_connection_handler_observer, + OnServiceStartedCallback( + device_handle_, session_key1, kMobileNav, dummy_params)) + // don't call NotifyServiceStartedResult() with this event + .Times(1); + EXPECT_CALL(mock_connection_handler_observer, + OnServiceStartedCallback( + device_handle_, session_key2, kMobileNav, dummy_params)) + // call NotifyServiceStartedResult() twice, first for the second session + // then for the first session + .WillOnce(DoAll(InvokeMemberFuncWithArg3( + connection_handler_, + &ConnectionHandler::NotifyServiceStartedResult, + session_key2, + false, + ByRef(empty)), + InvokeMemberFuncWithArg3( + connection_handler_, + &ConnectionHandler::NotifyServiceStartedResult, + session_key1, + true, + ByRef(empty)))); + + // verify that connection handler will not mix up the two results + uint32_t new_session_id1 = 0; + uint32_t new_session_id2 = 0; + connection_handler_->set_protocol_handler(&mock_protocol_handler_); + EXPECT_CALL( + mock_protocol_handler_, + NotifySessionStartedResult(_, rpc_session_id1, _, _, false, empty)) + .WillOnce(SaveArg<2>(&new_session_id1)); + EXPECT_CALL( + mock_protocol_handler_, + NotifySessionStartedResult(_, rpc_session_id2, _, _, false, empty)) + .WillOnce(SaveArg<2>(&new_session_id2)); + + connection_handler_->OnSessionStartedCallback( + uid_, rpc_session_id1, kMobileNav, PROTECTION_OFF, dummy_params); + connection_handler_->OnSessionStartedCallback( + uid_, rpc_session_id2, kMobileNav, PROTECTION_OFF, dummy_params); + + EXPECT_NE(0u, new_session_id1); // result is positive + EXPECT_EQ(0u, new_session_id2); // result is negative +} + TEST_F(ConnectionHandlerTest, SessionStarted_StartSession_SecureSpecific_Unprotect) { EXPECT_CALL(mock_connection_handler_settings, heart_beat_timeout()) @@ -1138,10 +1407,18 @@ TEST_F(ConnectionHandlerTest, // Forbid start kRPC without encryption protected_services_.push_back(kRpc); SetSpecificServices(); + + uint32_t session_id_fail = 0; + uint32_t session_id = 0; + connection_handler_->set_protocol_handler(&mock_protocol_handler_); + EXPECT_CALL(mock_protocol_handler_, + NotifySessionStartedResult(_, _, _, _, _, _)) + .WillOnce(DoAll(SaveArg<2>(&session_id_fail), SaveArg<3>(&out_hash_id_))) + .WillOnce(DoAll(SaveArg<2>(&session_id), SaveArg<3>(&out_hash_id_))); + // Start new session with RPC service - const uint32_t session_id_fail = - connection_handler_->OnSessionStartedCallback( - uid_, 0, kRpc, PROTECTION_OFF, &out_hash_id_); + connection_handler_->OnSessionStartedCallback( + uid_, 0, kRpc, PROTECTION_OFF, static_cast<BsonObject*>(NULL)); #ifdef ENABLE_SECURITY EXPECT_EQ(0u, session_id_fail); EXPECT_EQ(protocol_handler::HASH_ID_WRONG, out_hash_id_); @@ -1155,8 +1432,8 @@ TEST_F(ConnectionHandlerTest, protected_services_.push_back(kControl); SetSpecificServices(); // Start new session with RPC service - const uint32_t session_id = connection_handler_->OnSessionStartedCallback( - uid_, 0, kRpc, PROTECTION_OFF, &out_hash_id_); + connection_handler_->OnSessionStartedCallback( + uid_, 0, kRpc, PROTECTION_OFF, static_cast<BsonObject*>(NULL)); EXPECT_NE(0u, session_id); CheckService(uid_, session_id, kRpc, NULL, PROTECTION_OFF); EXPECT_EQ(SessionHash(uid_, session_id), out_hash_id_); @@ -1172,10 +1449,18 @@ TEST_F(ConnectionHandlerTest, unprotected_services_.push_back(UnnamedService::kServedService2); unprotected_services_.push_back(kControl); SetSpecificServices(); + + uint32_t session_id_fail = 0; + uint32_t session_id = 0; + connection_handler_->set_protocol_handler(&mock_protocol_handler_); + EXPECT_CALL(mock_protocol_handler_, + NotifySessionStartedResult(_, _, _, _, _, _)) + .WillOnce(SaveArg<2>(&session_id_fail)) + .WillOnce(DoAll(SaveArg<2>(&session_id), SaveArg<3>(&out_hash_id_))); + // Start new session with RPC service - const uint32_t session_id_fail = - connection_handler_->OnSessionStartedCallback( - uid_, 0, kRpc, PROTECTION_ON, NULL); + connection_handler_->OnSessionStartedCallback( + uid_, 0, kRpc, PROTECTION_ON, static_cast<BsonObject*>(NULL)); #ifdef ENABLE_SECURITY EXPECT_EQ(0u, session_id_fail); #else @@ -1187,8 +1472,8 @@ TEST_F(ConnectionHandlerTest, unprotected_services_.push_back(kControl); SetSpecificServices(); // Start new session with RPC service - const uint32_t session_id = connection_handler_->OnSessionStartedCallback( - uid_, 0, kRpc, PROTECTION_ON, &out_hash_id_); + connection_handler_->OnSessionStartedCallback( + uid_, 0, kRpc, PROTECTION_ON, static_cast<BsonObject*>(NULL)); EXPECT_NE(0u, session_id); EXPECT_EQ(SessionHash(uid_, session_id), out_hash_id_); @@ -1207,9 +1492,21 @@ TEST_F(ConnectionHandlerTest, protected_services_.push_back(UnnamedService::kServedService2); protected_services_.push_back(kControl); SetSpecificServices(); + + uint32_t session_id2 = 0; + uint32_t session_id3 = 0; + connection_handler_->set_protocol_handler(&mock_protocol_handler_); + EXPECT_CALL(mock_protocol_handler_, + NotifySessionStartedResult(_, _, _, _, _, _)) + .WillOnce(SaveArg<2>(&session_id2)) + .WillOnce(DoAll(SaveArg<2>(&session_id3), SaveArg<3>(&out_hash_id_))); + // Start new session with Audio service - const uint32_t session_id2 = connection_handler_->OnSessionStartedCallback( - uid_, start_session_id_, kAudio, PROTECTION_OFF, NULL); + connection_handler_->OnSessionStartedCallback(uid_, + start_session_id_, + kAudio, + PROTECTION_OFF, + static_cast<BsonObject*>(NULL)); #ifdef ENABLE_SECURITY EXPECT_EQ(0u, session_id2); #else @@ -1222,8 +1519,11 @@ TEST_F(ConnectionHandlerTest, protected_services_.push_back(UnnamedService::kServedService2); protected_services_.push_back(kControl); SetSpecificServices(); - const uint32_t session_id3 = connection_handler_->OnSessionStartedCallback( - uid_, start_session_id_, kAudio, PROTECTION_OFF, &out_hash_id_); + connection_handler_->OnSessionStartedCallback(uid_, + start_session_id_, + kAudio, + PROTECTION_OFF, + static_cast<BsonObject*>(NULL)); // Returned original session id #ifdef ENABLE_SECURITY EXPECT_EQ(start_session_id_, session_id3); @@ -1246,10 +1546,21 @@ TEST_F(ConnectionHandlerTest, unprotected_services_.push_back(UnnamedService::kServedService2); unprotected_services_.push_back(kControl); SetSpecificServices(); + + uint32_t session_id_reject = 0; + uint32_t session_id3 = 0; + connection_handler_->set_protocol_handler(&mock_protocol_handler_); + EXPECT_CALL(mock_protocol_handler_, + NotifySessionStartedResult(_, _, _, _, _, _)) + .WillOnce(SaveArg<2>(&session_id_reject)) + .WillOnce(DoAll(SaveArg<2>(&session_id3), SaveArg<3>(&out_hash_id_))); + // Start new session with Audio service - const uint32_t session_id_reject = - connection_handler_->OnSessionStartedCallback( - uid_, start_session_id_, kAudio, PROTECTION_ON, NULL); + connection_handler_->OnSessionStartedCallback(uid_, + start_session_id_, + kAudio, + PROTECTION_ON, + static_cast<BsonObject*>(NULL)); #ifdef ENABLE_SECURITY EXPECT_EQ(0u, session_id_reject); #else @@ -1258,8 +1569,11 @@ TEST_F(ConnectionHandlerTest, // Allow start kAudio with encryption unprotected_services_.clear(); SetSpecificServices(); - const uint32_t session_id3 = connection_handler_->OnSessionStartedCallback( - uid_, start_session_id_, kAudio, PROTECTION_ON, &out_hash_id_); + connection_handler_->OnSessionStartedCallback(uid_, + start_session_id_, + kAudio, + PROTECTION_ON, + static_cast<BsonObject*>(NULL)); // Returned original session id #ifdef ENABLE_SECURITY EXPECT_EQ(start_session_id_, session_id3); @@ -1276,9 +1590,22 @@ TEST_F(ConnectionHandlerTest, SessionStarted_DealyProtect) { AddTestDeviceConnection(); AddTestSession(); + uint32_t session_id_new = 0; + uint32_t session_id2 = 0; + uint32_t session_id3 = 0; + connection_handler_->set_protocol_handler(&mock_protocol_handler_); + EXPECT_CALL(mock_protocol_handler_, + NotifySessionStartedResult(_, _, _, _, _, _)) + .WillOnce(DoAll(SaveArg<2>(&session_id_new), SaveArg<3>(&out_hash_id_))) + .WillOnce(DoAll(SaveArg<2>(&session_id2), SaveArg<3>(&out_hash_id_))) + .WillOnce(DoAll(SaveArg<2>(&session_id3), SaveArg<3>(&out_hash_id_))); + // Start RPC protection - const uint32_t session_id_new = connection_handler_->OnSessionStartedCallback( - uid_, start_session_id_, kRpc, PROTECTION_ON, &out_hash_id_); + connection_handler_->OnSessionStartedCallback(uid_, + start_session_id_, + kRpc, + PROTECTION_ON, + static_cast<BsonObject*>(NULL)); #ifdef ENABLE_SECURITY EXPECT_EQ(start_session_id_, session_id_new); // Post protection nedd no hash @@ -1292,15 +1619,21 @@ TEST_F(ConnectionHandlerTest, SessionStarted_DealyProtect) { #endif // ENABLE_SECURITY // Start Audio session without protection - const uint32_t session_id2 = connection_handler_->OnSessionStartedCallback( - uid_, start_session_id_, kAudio, PROTECTION_OFF, &out_hash_id_); + connection_handler_->OnSessionStartedCallback(uid_, + start_session_id_, + kAudio, + PROTECTION_OFF, + static_cast<BsonObject*>(NULL)); EXPECT_EQ(start_session_id_, session_id2); EXPECT_EQ(protocol_handler::HASH_ID_NOT_SUPPORTED, out_hash_id_); CheckService(uid_, start_session_id_, kAudio, NULL, PROTECTION_OFF); // Start Audio protection - const uint32_t session_id3 = connection_handler_->OnSessionStartedCallback( - uid_, start_session_id_, kAudio, PROTECTION_ON, &out_hash_id_); + connection_handler_->OnSessionStartedCallback(uid_, + start_session_id_, + kAudio, + PROTECTION_ON, + static_cast<BsonObject*>(NULL)); #ifdef ENABLE_SECURITY EXPECT_EQ(start_session_id_, session_id3); EXPECT_EQ(protocol_handler::HASH_ID_NOT_SUPPORTED, out_hash_id_); @@ -1316,8 +1649,16 @@ TEST_F(ConnectionHandlerTest, SessionStarted_DealyProtectBulk) { AddTestDeviceConnection(); AddTestSession(); - const uint32_t session_id_new = connection_handler_->OnSessionStartedCallback( - uid_, start_session_id_, kBulk, PROTECTION_ON, NULL); + uint32_t session_id_new = 0; + connection_handler_->set_protocol_handler(&mock_protocol_handler_); + EXPECT_CALL(mock_protocol_handler_, + NotifySessionStartedResult(_, _, _, _, _, _)) + .WillOnce(SaveArg<2>(&session_id_new)); + connection_handler_->OnSessionStartedCallback(uid_, + start_session_id_, + kBulk, + PROTECTION_ON, + static_cast<BsonObject*>(NULL)); #ifdef ENABLE_SECURITY EXPECT_EQ(start_session_id_, session_id_new); CheckService(uid_, start_session_id_, kRpc, NULL, PROTECTION_ON); @@ -1412,9 +1753,19 @@ TEST_F(ConnectionHandlerTest, GetSSLContext_ByProtectedService) { // kAudio is not exists yet EXPECT_EQ(connection_handler_->GetSSLContext(connection_key_, kAudio), reinterpret_cast<security_manager::SSLContext*>(NULL)); + + uint32_t session_id = 0; + connection_handler_->set_protocol_handler(&mock_protocol_handler_); + EXPECT_CALL(mock_protocol_handler_, + NotifySessionStartedResult(_, _, _, _, _, _)) + .WillOnce(SaveArg<2>(&session_id)); + // Open kAudio service - const uint32_t session_id = connection_handler_->OnSessionStartedCallback( - uid_, start_session_id_, kAudio, PROTECTION_ON, NULL); + connection_handler_->OnSessionStartedCallback(uid_, + start_session_id_, + kAudio, + PROTECTION_ON, + static_cast<BsonObject*>(NULL)); EXPECT_EQ(session_id, start_session_id_); CheckService(uid_, session_id, kAudio, &mock_ssl_context, PROTECTION_ON); @@ -1437,9 +1788,18 @@ TEST_F(ConnectionHandlerTest, GetSSLContext_ByDealyProtectedRPC) { EXPECT_EQ(connection_handler_->GetSSLContext(connection_key_, kRpc), reinterpret_cast<security_manager::SSLContext*>(NULL)); + uint32_t session_id = 0; + connection_handler_->set_protocol_handler(&mock_protocol_handler_); + EXPECT_CALL(mock_protocol_handler_, + NotifySessionStartedResult(_, _, _, _, _, _)) + .WillOnce(SaveArg<2>(&session_id)); + // Protect kRpc (Bulk will be protect also) - const uint32_t session_id = connection_handler_->OnSessionStartedCallback( - uid_, start_session_id_, kRpc, PROTECTION_ON, NULL); + connection_handler_->OnSessionStartedCallback(uid_, + start_session_id_, + kRpc, + PROTECTION_ON, + static_cast<BsonObject*>(NULL)); EXPECT_EQ(start_session_id_, session_id); CheckService(uid_, session_id, kRpc, &mock_ssl_context, PROTECTION_ON); @@ -1465,9 +1825,18 @@ TEST_F(ConnectionHandlerTest, GetSSLContext_ByDealyProtectedBulk) { EXPECT_EQ(connection_handler_->GetSSLContext(connection_key_, kRpc), reinterpret_cast<security_manager::SSLContext*>(NULL)); + uint32_t session_id = 0; + connection_handler_->set_protocol_handler(&mock_protocol_handler_); + EXPECT_CALL(mock_protocol_handler_, + NotifySessionStartedResult(_, _, _, _, _, _)) + .WillOnce(SaveArg<2>(&session_id)); + // Protect Bulk (kRpc will be protected also) - const uint32_t session_id = connection_handler_->OnSessionStartedCallback( - uid_, start_session_id_, kBulk, PROTECTION_ON, NULL); + connection_handler_->OnSessionStartedCallback(uid_, + start_session_id_, + kBulk, + PROTECTION_ON, + static_cast<BsonObject*>(NULL)); EXPECT_EQ(start_session_id_, session_id); CheckService(uid_, session_id, kRpc, &mock_ssl_context, PROTECTION_ON); diff --git a/src/components/connection_handler/test/connection_test.cc b/src/components/connection_handler/test/connection_test.cc index 85f43f3785..4582cc10ee 100644 --- a/src/components/connection_handler/test/connection_test.cc +++ b/src/components/connection_handler/test/connection_test.cc @@ -201,6 +201,32 @@ TEST_F(ConnectionTest, HeartBeat_Protocol4_ZeroHeartBeat_NotSupported) { EXPECT_FALSE(connection_->SupportHeartBeat(session_id)); } +TEST_F(ConnectionTest, HeartBeat_Protocol5_PositiveHeartBeat_Supported) { + // Arrange + StartSession(); + // Check execution if protocol version is 5 + const uint8_t protocol_version = static_cast<uint8_t>(PROTOCOL_VERSION_5); + connection_->UpdateProtocolVersionSession(session_id, protocol_version); + EXPECT_TRUE(connection_->SupportHeartBeat(session_id)); +} + +TEST_F(ConnectionTest, HeartBeat_Protocol5_ZeroHeartBeat_NotSupported) { + // Correctc of connection (need connection with heartbeat=0) + delete connection_; + connection_ = 0; + + const ConnectionHandle connectionHandle = 0; + const DeviceHandle device_handle = 0u; + const uint32_t heart_beat = 0u; + connection_ = new Connection( + connectionHandle, device_handle, connection_handler_, heart_beat); + StartSession(); + // Check execution if protocol version is 5 + const uint8_t protocol_version = static_cast<uint8_t>(PROTOCOL_VERSION_5); + connection_->UpdateProtocolVersionSession(session_id, protocol_version); + EXPECT_FALSE(connection_->SupportHeartBeat(session_id)); +} + // Try to add service without session TEST_F(ConnectionTest, Session_AddNewServiceWithoutSession) { EXPECT_EQ(connection_->AddNewService(session_id, kAudio, true), diff --git a/src/components/formatters/test/meta_formatter_test.cc b/src/components/formatters/test/meta_formatter_test.cc index 293f881c4a..87f05ab50e 100644 --- a/src/components/formatters/test/meta_formatter_test.cc +++ b/src/components/formatters/test/meta_formatter_test.cc @@ -68,20 +68,6 @@ TEST_F(CMetaFormatterTestHelper, CMetaFormatter::CreateObjectByPattern(object2, schema, result_object2); EXPECT_TRUE(creationresult); - // Uncomment code to print objects in console - // std::string formatted_string; - // CFormatterJsonSDLRPCv1::toString(object1, formatted_string); - // printf("object1 %s\n", formatted_string.c_str()); - // - // CFormatterJsonSDLRPCv1::toString(result_object1, formatted_string); - // printf("result_object1 %s\n", formatted_string.c_str()); - // - // CFormatterJsonSDLRPCv1::toString(object2, formatted_string); - // printf("object2 %s\n", formatted_string.c_str()); - // - // CFormatterJsonSDLRPCv1::toString(result_object2, formatted_string); - // printf("result_object2 %s\n", formatted_string.c_str()); - CompareObjects(object1, result_object1); CompareObjects(object2, result_object2); @@ -112,13 +98,6 @@ TEST_F(CMetaFormatterTestHelper, NormalSchemaWithEmptyObject) { FillObjectWithDefaultValues(expected_object); CompareObjects(expected_object, result_object); - - // Uncomment code to print objects in console - // std::string str; - // AnyObjectToJsonString(result_object, str); - // printf("result_object(default) %s", str.c_str()); - // AnyObjectToJsonString(expected_object, str); - // printf("expected_object %s", str.c_str()); } TEST_F(CMetaFormatterTestHelper, @@ -140,11 +119,6 @@ TEST_F(CMetaFormatterTestHelper, 0, result_object[S_MSG_PARAMS]["syncMsgVersion"]["minorVersion"].asInt()); EXPECT_EQ( 0, result_object[S_MSG_PARAMS]["syncMsgVersion"]["patchVersion"].asInt()); - - // Uncomment code to print object in console - // std::string str; - // AnyObjectToJsonString(result_object, str); - // printf("result_object %s", str.c_str()); } TEST_F(CMetaFormatterTestHelper, ObjectWithEmptyMap) { @@ -191,11 +165,6 @@ TEST_F(CMetaFormatterTestHelper, ObjectWithEmptyMap) { EXPECT_EQ(SmartType_Map, result_object_empty_map.getType()) << "smartObject is not map type"; EXPECT_EQ(0u, result_object_empty_map.length()) << "non empty map"; - - // Uncomment code to print object in console - // std::string str; - // AnyObjectToJsonString(result_object_empty_map, str); - // printf("result_object(empty map) %s", str.c_str()); } TEST_F(CMetaFormatterTestHelper, ObjectWithEmptyArray) { @@ -233,11 +202,6 @@ TEST_F(CMetaFormatterTestHelper, ObjectWithEmptyArray) { EXPECT_EQ(SmartType_Array, result_object_empty_array.getType()) << "smartObject is not array type"; EXPECT_EQ(0u, result_object_empty_array.length()) << "non empty array"; - - // Uncomment code to print object in console - // std::string str; - // AnyObjectToJsonString(result_object_empty_array, str); - // printf("result_object(empty array) %s", str.c_str()); } TEST_F(CMetaFormatterTestHelper, @@ -325,13 +289,6 @@ TEST_F(CMetaFormatterTestHelper, CMetaFormatter::CreateObjectByPattern(object, schema, result_object); - // Uncomment code to print object in console - // std::string str; - // AnyObjectToJsonString(object, str); - // printf("object %s", str.c_str()); - // AnyObjectToJsonString(result_object, str); - // printf("result_object %s", str.c_str()); - // Assert EXPECT_EQ(500, result_object[S_PARAMS][S_FUNCTION_ID].asInt()); EXPECT_EQ(-1, result_object[S_PARAMS][S_MESSAGE_TYPE].asInt()); diff --git a/src/components/formatters/test/src/create_smartSchema.cc b/src/components/formatters/test/src/create_smartSchema.cc index 4ae692429c..1497fbf281 100644 --- a/src/components/formatters/test/src/create_smartSchema.cc +++ b/src/components/formatters/test/src/create_smartSchema.cc @@ -339,7 +339,6 @@ CSmartSchema initSchemaForMetaFormatter() { ISchemaItemPtr majorVersion_SchemaItem = TNumberSchemaItem<int>::create(); ISchemaItemPtr minorVersion_SchemaItem = TNumberSchemaItem<int>::create(); ISchemaItemPtr patchVersion_SchemaItem = TNumberSchemaItem<int>::create(); - ISchemaItemPtr syncMsg_SchemaItem = CStringSchemaItem::create(TSchemaItemParameter<size_t>(0), TSchemaItemParameter<size_t>(1000), diff --git a/src/components/formatters/test/src/meta_formatter_test_helper.cc b/src/components/formatters/test/src/meta_formatter_test_helper.cc index a29c1bceb3..897c8d364d 100644 --- a/src/components/formatters/test/src/meta_formatter_test_helper.cc +++ b/src/components/formatters/test/src/meta_formatter_test_helper.cc @@ -109,17 +109,6 @@ void CMetaFormatterTestHelper:: obj[S_MSG_PARAMS]["languageDesired"] = Language::EN_EU; obj[S_MSG_PARAMS]["hmiDisplayLanguageDesired"] = Language::RU_RU; obj[S_MSG_PARAMS]["appID"] = "APP ID"; - - // Commented not mandatory params for check creation object without them - // obj[S_MSG_PARAMS]["ttsName"][0]["text"] = "ABC"; - // obj[S_MSG_PARAMS]["ttsName"][0]["type"] = - // SpeechCapabilities::SC_TEXT; - - // obj[S_MSG_PARAMS]["vrSynonyms"][0] = "Synonym1"; - // obj[S_MSG_PARAMS]["vrSynonyms"][1] = "Synonym2"; - - // obj[S_MSG_PARAMS]["appType"][0] = AppTypeTest::SYSTEM; // not mandatory - // obj[S_MSG_PARAMS]["appType"][1] = AppTypeTest::MEDIA; } void CMetaFormatterTestHelper::FillObjectWithoutSomeMandatoryFields( @@ -130,11 +119,6 @@ void CMetaFormatterTestHelper::FillObjectWithoutSomeMandatoryFields( obj[S_PARAMS][S_PROTOCOL_VERSION] = 1; obj[S_PARAMS][S_PROTOCOL_TYPE] = 0; - // Commented mandatory params for check creation object without them - // obj[S_PARAMS][S_CORRELATION_ID] = 12; - // obj[S_MSG_PARAMS]["syncMsgVersion"]["majorVersion"] = 2; - // obj[S_MSG_PARAMS]["syncMsgVersion"]["minorVersion"] = 10; - obj[S_MSG_PARAMS]["appName"] = "APP NAME"; obj[S_MSG_PARAMS]["ttsName"][0]["text"] = "ABC"; obj[S_MSG_PARAMS]["ttsName"][0]["type"] = SpeechCapabilities::SC_TEXT; @@ -200,17 +184,6 @@ void CMetaFormatterTestHelper::FillObjectWithDefaultValues(SmartObject& obj) { obj[S_MSG_PARAMS]["languageDesired"] = -1; obj[S_MSG_PARAMS]["hmiDisplayLanguageDesired"] = -1; obj[S_MSG_PARAMS]["appID"] = ""; - - // Commented params for check creation object with only default values - // obj[S_MSG_PARAMS]["ttsName"][0]["text"] = "ABC"; - // obj[S_MSG_PARAMS]["ttsName"][0]["type"] = - // SpeechCapabilities::SC_TEXT; - - // obj[S_MSG_PARAMS]["vrSynonyms"][0] = "Synonym1"; - // obj[S_MSG_PARAMS]["vrSynonyms"][1] = "Synonym2"; - - // obj[S_MSG_PARAMS]["appType"][0] = AppTypeTest::SYSTEM; - // obj[S_MSG_PARAMS]["appType"][1] = AppTypeTest::MEDIA; } } // namespace formatters diff --git a/src/components/functional_module/CMakeLists.txt b/src/components/functional_module/CMakeLists.txt new file mode 100644 index 0000000000..07db91fc38 --- /dev/null +++ b/src/components/functional_module/CMakeLists.txt @@ -0,0 +1,58 @@ +if (ENABLE_GCOV) + set(GCOV_FLAGS "-ftest-coverage -fprofile-arcs") +else() + set(GCOV_FLAGS "") +endif() + +set(CMAKE_CXX_FLAGS "-fPIC -std=gnu++0x -Wno-deprecated-declarations -Wall -Werror ${GCOV_FLAGS}") + +if (CMAKE_BUILD_TYPE) + if (${CMAKE_BUILD_TYPE} STREQUAL "Release") + set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG") + set(CMAKE_CXX_FLAGS_DEBUG "") + else () + set(CMAKE_CXX_FLAGS_RELEASE "") + set(CMAKE_CXX_FLAGS_DEBUG "-g3 -ggdb3 -DDEBUG") + endif() +endif() + +set(GCOV gcov) + +include_directories ( + ${COMPONENTS_DIR}/functional_module/include/ + ${COMPONENTS_DIR}/remote_control/include/ + ${COMPONENTS_DIR}/include/ + ${COMPONENTS_DIR}/application_manager/include + ${COMPONENTS_DIR}/connection_handler/include/ + ${COMPONENTS_DIR}/utils/include + ${POLICY_PATH}/include/ + ${POLICY_GLOBAL_INCLUDE_PATH}/ + ${COMPONENTS_DIR}/config_profile/include + ${COMPONENTS_DIR}/smart_objects/include + ${JSONCPP_INCLUDE_DIRECTORY} + ${LOG4CXX_INCLUDE_DIRECTORY} + ${CMAKE_BINARY_DIR}/src/components/ + + ${COMPONENTS_DIR}/application_manager/test/include/ +) + +set (SOURCES + ./src/generic_module.cc + ./src/plugin_manager.cc + ./src/timer/timer_director.cc +) +set (LIBRARIES + ApplicationManager + jsoncpp +) + +add_library("FunctionalModule" ${SOURCES}) +target_link_libraries("FunctionalModule" ${LIBRARIES} ) + +if(ENABLE_LOG) + target_link_libraries("FunctionalModule" log4cxx -L${LOG4CXX_LIBS_DIRECTORY} ${GCOV}) +endif() + +if(BUILD_TESTS) + add_subdirectory(test) +endif() diff --git a/src/components/functional_module/include/functional_module/function_ids.h b/src/components/functional_module/include/functional_module/function_ids.h new file mode 100644 index 0000000000..1a504df6c9 --- /dev/null +++ b/src/components/functional_module/include/functional_module/function_ids.h @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2017, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_FUNCTIONAL_MODULE_INCLUDE_FUNCTIONAL_MODULE_FUNCTION_IDS_H_ +#define SRC_COMPONENTS_FUNCTIONAL_MODULE_INCLUDE_FUNCTIONAL_MODULE_FUNCTION_IDS_H_ +#include "interfaces/MOBILE_API.h" +#include "interfaces/HMI_API.h" + +namespace functional_modules { + +enum RCFunctionID { + // Remote SDL functions ids + BUTTON_PRESS = mobile_apis::FunctionID::ButtonPressID, + GET_INTERIOR_VEHICLE_DATA = mobile_apis::FunctionID::GetInteriorVehicleDataID, + SET_INTERIOR_VEHICLE_DATA = mobile_apis::FunctionID::SetInteriorVehicleDataID, + ON_INTERIOR_VEHICLE_DATA = mobile_apis::FunctionID::OnInteriorVehicleDataID, + ON_REMOTE_CONTROL_SETTINGS = hmi_apis::FunctionID::RC_OnRemoteControlSettings, +}; + +namespace hmi_api { +const char get_interior_vehicle_data[] = "RC.GetInteriorVehicleData"; +const char set_interior_vehicle_data[] = "RC.SetInteriorVehicleData"; +const char on_interior_vehicle_data[] = "RC.OnInteriorVehicleData"; +const char button_press[] = "Buttons.ButtonPress"; +const char on_remote_control_settings[] = "RC.OnRemoteControlSettings"; + +const char get_user_consent[] = "RC.GetInteriorVehicleDataConsent"; +const char on_app_deactivated[] = "BasicCommunication.OnAppDeactivated"; +const char sdl_activate_app[] = "SDL.ActivateApp"; +} + +} // namespace functional_modules + +#endif // SRC_COMPONENTS_FUNCTIONAL_MODULE_INCLUDE_FUNCTIONAL_MODULE_FUNCTION_IDS_H_ diff --git a/src/components/functional_module/include/functional_module/generic_module.h b/src/components/functional_module/include/functional_module/generic_module.h new file mode 100644 index 0000000000..0c686d3501 --- /dev/null +++ b/src/components/functional_module/include/functional_module/generic_module.h @@ -0,0 +1,179 @@ +/* + * Copyright (c) 2017, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_FUNCTIONAL_MODULE_INCLUDE_FUNCTIONAL_MODULE_GENERIC_MODULE_H_ +#define SRC_COMPONENTS_FUNCTIONAL_MODULE_INCLUDE_FUNCTIONAL_MODULE_GENERIC_MODULE_H_ + +#include <deque> +#include <string> +#include "functional_module/module_observer.h" +#include "functional_module/function_ids.h" +#include "utils/shared_ptr.h" +#include "application_manager/service.h" + +namespace functional_modules { + +/** + * @brief The PolicyEvent enum defines events related to policy + */ +enum PolicyEvent { kApplicationPolicyUpdated = 0, kApplicationsDisabled }; + +/** + * @brief The ApplicationEvent enum defines events related to single application + */ +enum ApplicationEvent { kApplicationExit = 0, kApplicationUnregistered }; + +enum ProcessResult { + NONE = -1, + PROCESSED, + PARTIALLY_PROCESSED, + CANNOT_PROCESS, + FAILED +}; + +enum ServiceState { IDLE = 0, SUSPENDED, LOWVOLTAGE, HMI_ADAPTER_INITIALIZED }; + +typedef std::string HMIFunctionID; + +class GenericModule; +typedef utils::SharedPtr<GenericModule> ModulePtr; + +struct PluginInfo { + std::string name; + int version; + std::deque<RCFunctionID> rc_function_list; + std::deque<HMIFunctionID> hmi_function_list; +}; + +class GenericModule { + public: + typedef std::deque<ModuleObserver*> Observers; + + virtual ~GenericModule(); + ModuleID GetModuleID() const { + return kModuleId_; + } + virtual PluginInfo GetPluginInfo() const = 0; + + /** + * @brief Setter for service (interface for plugin t access SDL functionality) + * @param service pointer to new service instance + */ + virtual void set_service(application_manager::ServicePtr service); + + /** + * @brief Returns pointer to SDL core service interface + * @return pointer to core service interface + */ + virtual application_manager::ServicePtr service(); + + virtual ProcessResult ProcessMessage(application_manager::MessagePtr msg) = 0; + virtual ProcessResult ProcessHMIMessage( + application_manager::MessagePtr msg) = 0; + virtual void OnServiceStateChanged(ServiceState state); + + /** + * @brief Adds pointer to observer of module to be notified about + * exceptional sutiations in module. + * Raw pointer is passed to avoid circular dependencies. + * Module is not responsible for freeing observer's memory. + */ + void AddObserver(ModuleObserver* const observer); + + /** + * @brief Removes pointer to observer of module when it's no loger + * wants to be notified about exceptional sutiations in module. + * Raw pointer is passed to avoid circular dependencies. + * Module is not responsible for freeing observer's memory. + */ + void RemoveObserver(ModuleObserver* const observer); + + /** + * @brief Remove extension created for specified application + * @param app_id application id + */ + virtual void RemoveAppExtension(uint32_t app_id) = 0; + + /** + * @brief Check registering app can be handled by plugin + * @param msg Registration message + * @param app Application basis already create by Core + */ + virtual bool IsAppForPlugin( + application_manager::ApplicationSharedPtr app) = 0; + + /** + * @brief Notify about change of HMILevel of plugin's app + * @param app App with new HMILevel + * @param old_level Old HMILevel of app + */ + virtual void OnAppHMILevelChanged( + application_manager::ApplicationSharedPtr app, + mobile_apis::HMILevel::eType old_level) = 0; + + /** + * @brief OnApplicationEvent Processes application related events + * @param event Event + * @param application_id Application id + */ + virtual void OnApplicationEvent(ApplicationEvent event, + const uint32_t application_id) = 0; + + /** + * @brief OnPolicyEvent Processes policy related events + * @param event Policy event + */ + virtual void OnPolicyEvent(PolicyEvent event) = 0; + + protected: + explicit GenericModule(ModuleID module_id); + void NotifyObservers(ModuleObserver::Errors error); + + /** + * @brief Remove extension for all applications + */ + virtual void RemoveAppExtensions() = 0; + + private: + application_manager::ServicePtr service_; + const ModuleID kModuleId_; + + Observers observers_; + ServiceState state_; + + friend class DriverGenericModuleTest; + DISALLOW_COPY_AND_ASSIGN(GenericModule); +}; + +} // namespace functional_modules + +#endif // SRC_COMPONENTS_FUNCTIONAL_MODULE_INCLUDE_FUNCTIONAL_MODULE_GENERIC_MODULE_H_ diff --git a/src/components/functional_module/include/functional_module/module_observer.h b/src/components/functional_module/include/functional_module/module_observer.h new file mode 100644 index 0000000000..a5e34db040 --- /dev/null +++ b/src/components/functional_module/include/functional_module/module_observer.h @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2017, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_FUNCTIONAL_MODULE_INCLUDE_FUNCTIONAL_MODULE_MODULE_OBSERVER_H_ +#define SRC_COMPONENTS_FUNCTIONAL_MODULE_INCLUDE_FUNCTIONAL_MODULE_MODULE_OBSERVER_H_ + +namespace functional_modules { + +typedef int ModuleID; + +class ModuleObserver { + public: + enum Errors { NONE = -1, OUT_OF_MEMORY, FS_FAILURE }; + virtual ~ModuleObserver() {} + + /** + * @brief OnError callback for module to notify SDL about internal error + * @param error error type + * @param module_id module that triggered error + */ + virtual void OnError(Errors error, ModuleID module_id) = 0; +}; +} // namespace functional_modules { + +#endif // SRC_COMPONENTS_FUNCTIONAL_MODULE_INCLUDE_FUNCTIONAL_MODULE_MODULE_OBSERVER_H_ diff --git a/src/components/functional_module/include/functional_module/plugin_manager.h b/src/components/functional_module/include/functional_module/plugin_manager.h new file mode 100644 index 0000000000..1fb5ac9838 --- /dev/null +++ b/src/components/functional_module/include/functional_module/plugin_manager.h @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2017, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_FUNCTIONAL_MODULE_INCLUDE_FUNCTIONAL_MODULE_PLUGIN_MANAGER_H_ +#define SRC_COMPONENTS_FUNCTIONAL_MODULE_INCLUDE_FUNCTIONAL_MODULE_PLUGIN_MANAGER_H_ + +#include <map> +#include <string> +#include "functional_module/generic_module.h" +#include "application_manager/service.h" +#include "application_manager/message.h" + +namespace functional_modules { + +class PluginManager : public ModuleObserver { + public: + PluginManager(); + ~PluginManager(); + typedef std::map<ModuleID, ModulePtr> Modules; + + /** + * @brief LoadPlugins initialize loading plugins + * @param plugin_path path to search to plugin shared libraries + * @return count of loaded plugins + */ + int LoadPlugins(const std::string& plugin_path); + + /** + * @brief UnloadPlugins unload from memory all plugins + */ + void UnloadPlugins(); + + /** + * @brief IsMessageForPlugin Verifies whether mobile message will be processed + * by plugins + * @param msg Mobile message + * @return True if any of plugins will process the message, otherwise - false + */ + bool IsMessageForPlugin(application_manager::MessagePtr msg); + + /** + * @brief IsHMIMessageForPlugin Verifies whether HMI message will be processed + * by plugins + * @param msg HMI message + * @return True if any of plugins will process the message, otherwise - false + */ + bool IsHMIMessageForPlugin(application_manager::MessagePtr msg); + + /** + * @brief ProcessMessage forwards mobile message to modules if any is + * subsribed for the message. + * @param msg Mobile message to process + * @return Result of processing + */ + ProcessResult ProcessMessage(application_manager::MessagePtr msg); + + /** + * @brief ProcessHMIMessage forwards HMI message to modules if any is + * subscribed for the message + * @param msg HMI message to process + * @return Result of processing + */ + ProcessResult ProcessHMIMessage(application_manager::MessagePtr msg); + void SetServiceHandler(application_manager::ServicePtr service) { + service_ = service; + } + void OnServiceStateChanged(ServiceState state); + void OnError(ModuleObserver::Errors error, ModuleID module_id) FINAL; + + /** + * @brief Remove extension created for specified application + * @param app_id application id + */ + void RemoveAppExtension(uint32_t app_id); + + /** + * @brief Check if app cooperates with one or more plugins, init it + * inside plugin accordingly if needed. + * @param app Application in question. + */ + bool IsAppForPlugins(application_manager::ApplicationSharedPtr app); + + /** + * Check if app cooperates with plugin + * @param app application + * @param module_id unique identifier of plugin + * @return true if application cooperates with this plugin + */ + bool IsAppForPlugin(application_manager::ApplicationSharedPtr app, + ModuleID module_id) const; + + /** + * @brief Notify plugins about change of HMILevel of app + * if app is related to plugin + * @param app App with new HMILevel + * @param old_level Old HMILevel of app + */ + void OnAppHMILevelChanged(application_manager::ApplicationSharedPtr app, + mobile_apis::HMILevel::eType old_level); + + /** + * @brief OnApplicationEvent Notifies modules on certain application events + * @param event Event + * @param application_id Application id of particular application + */ + void OnApplicationEvent(functional_modules::ApplicationEvent event, + const uint32_t application_id); + + /** + * @brief OnPolicyEvent Notifies modules on certain events from policy + * @param event Policy event + */ + void OnPolicyEvent(functional_modules::PolicyEvent event); + + Modules& plugins(); + + private: + Modules plugins_; + std::map<ModuleID, void*> dlls_; + std::map<RCFunctionID, ModulePtr> mobile_subscribers_; + std::map<HMIFunctionID, ModulePtr> hmi_subscribers_; + application_manager::ServicePtr service_; + + DISALLOW_COPY_AND_ASSIGN(PluginManager); +}; + +} // namespace functional_modules + +#endif // SRC_COMPONENTS_FUNCTIONAL_MODULE_INCLUDE_FUNCTIONAL_MODULE_PLUGIN_MANAGER_H_ diff --git a/src/components/functional_module/include/functional_module/timer/module_timer.h b/src/components/functional_module/include/functional_module/timer/module_timer.h new file mode 100644 index 0000000000..e24259241b --- /dev/null +++ b/src/components/functional_module/include/functional_module/timer/module_timer.h @@ -0,0 +1,246 @@ +/* + * Copyright (c) 2017, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_FUNCTIONAL_MODULE_INCLUDE_FUNCTIONAL_MODULE_TIMER_MODULE_TIMER_H_ +#define SRC_COMPONENTS_FUNCTIONAL_MODULE_INCLUDE_FUNCTIONAL_MODULE_TIMER_MODULE_TIMER_H_ + +#include <list> +#include <deque> +#include <algorithm> +#include <time.h> +#include "utils/lock.h" + +namespace functional_modules { + +typedef unsigned int TimeUnit; // seconds + +class Trackable { + public: + Trackable() : start_time_(0) {} + virtual ~Trackable() {} + + /** + * @brief custom_interval getter for custom interval + * @return return timer interval for trackable message + */ + virtual TimeUnit custom_interval() const { + return 0; + } + + /** + * @brief start_time getter for start time of message + * @return start time of message + */ + virtual TimeUnit start_time() const { + return start_time_; + } + + /** + * @brief set_start_time setting start time of message + * @param start_time start time + */ + virtual void set_start_time(TimeUnit start_time) { + start_time_ = start_time; + } + + private: + TimeUnit start_time_; +}; + +template <class Trackable> +class TimerObserver { + public: + virtual ~TimerObserver() {} + virtual void OnTimeoutTriggered(const Trackable& expired) = 0; +}; + +template <class Trackable> +class ModuleTimer { + public: + ModuleTimer(); + ~ModuleTimer(); + void set_period(TimeUnit period) { + period_ = period; + } + TimeUnit period() const { + return period_; + } + void AddObserver(TimerObserver<Trackable>* observer); + void RemoveObserver(TimerObserver<Trackable>* observer); + + void CheckTimeout(); + /** + * @brief Gets time in seconds when the nearest request timeout will be + * triggered + * @return time in seconds when the nearest request timeout will be triggered + */ + TimeUnit GetSecondsToNearestTimeout(); + + /* + * @brief Adds object to be tracked by timer. + If same object is already added replaces it with new one + correspondingly updating start time of tracking. + */ + void AddTrackable(const Trackable& object); + void RemoveTrackable(const Trackable& object); + + protected: + void Notify(const Trackable& object); + void OnTimeout(const Trackable& object); + TimeUnit CurrentTime() const; + typename std::list<Trackable> trackables_; + volatile TimeUnit period_; + + private: + std::deque<TimerObserver<Trackable>*> observers_; + mutable sync_primitives::Lock trackables_lock_; + friend class ModuleTimerTest; +}; + +template <class Trackable> +ModuleTimer<Trackable>::ModuleTimer() + : period_(10) {} + +template <class Trackable> +ModuleTimer<Trackable>::~ModuleTimer() { + observers_.clear(); + sync_primitives::AutoLock auto_lock(trackables_lock_); + trackables_.clear(); +} + +template <class Trackable> +void ModuleTimer<Trackable>::AddObserver(TimerObserver<Trackable>* observer) { + DCHECK(observer); + if (!observer) { + return; + } + observers_.push_back(observer); +} + +template <class Trackable> +void ModuleTimer<Trackable>::RemoveObserver( + TimerObserver<Trackable>* observer) { + DCHECK(observer); + if (!observer) { + return; + } + for (typename std::deque<TimerObserver<Trackable>*>::iterator it = + observers_.begin(); + observers_.end() != it; + ++it) { + if (*it == observer) { + observers_.erase(it); + return; + } + } +} + +template <class Trackable> +void ModuleTimer<Trackable>::CheckTimeout() { + sync_primitives::AutoLock trackables_lock(trackables_lock_); + for (typename std::list<Trackable>::iterator it = trackables_.begin(); + trackables_.end() != it; + ++it) { + TimeUnit period = it->custom_interval(); + if (!period) { + period = period_; + } + if (CurrentTime() - it->start_time() >= period) { + OnTimeout(*it); + it = trackables_.erase(it); + } + } +} + +template <class Trackable> +TimeUnit ModuleTimer<Trackable>::GetSecondsToNearestTimeout() { + sync_primitives::AutoLock trackables_lock(trackables_lock_); + TimeUnit result = period_; + for (typename std::list<Trackable>::iterator it = trackables_.begin(); + trackables_.end() != it; + ++it) { + TimeUnit period = it->custom_interval(); + if (!period) { + period = period_; + } + const TimeUnit current_secs_to_timeout = + period - (CurrentTime() - it->start_time()); + if (result > current_secs_to_timeout) { + result = current_secs_to_timeout; + } + } + return result; +} + +template <class Trackable> +void ModuleTimer<Trackable>::AddTrackable(const Trackable& object) { + sync_primitives::AutoLock trackables_lock(trackables_lock_); + trackables_.remove(object); + trackables_.push_back(object); + trackables_.back().set_start_time(CurrentTime()); +} + +template <class Trackable> +void ModuleTimer<Trackable>::RemoveTrackable(const Trackable& object) { + sync_primitives::AutoLock trackables_lock(trackables_lock_); + trackables_.remove(object); +} + +template <class Trackable> +void ModuleTimer<Trackable>::Notify(const Trackable& object) { + for (typename std::deque<TimerObserver<Trackable>*>::const_iterator it = + observers_.begin(); + observers_.end() != it; + ++it) { + (*it)->OnTimeoutTriggered(object); + } +} + +template <class Trackable> +void ModuleTimer<Trackable>::OnTimeout(const Trackable& object) { + Notify(object); +} + +template <class Trackable> +TimeUnit ModuleTimer<Trackable>::CurrentTime() const { + // TODO(PV): move outside to platform-dependant parts + struct timespec current_time; + if (0 == clock_gettime(CLOCK_MONOTONIC, ¤t_time)) { + return current_time.tv_sec; + } else { + return 0; + } +} + +} // namespace functional_modules + +#endif // SRC_COMPONENTS_FUNCTIONAL_MODULE_INCLUDE_FUNCTIONAL_MODULE_TIMER_MODULE_TIMER_H_ diff --git a/src/components/functional_module/include/functional_module/timer/timer_director.h b/src/components/functional_module/include/functional_module/timer/timer_director.h new file mode 100644 index 0000000000..fb67b9b5de --- /dev/null +++ b/src/components/functional_module/include/functional_module/timer/timer_director.h @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2017, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_FUNCTIONAL_MODULE_INCLUDE_FUNCTIONAL_MODULE_TIMER_TIMER_DIRECTOR_H_ +#define SRC_COMPONENTS_FUNCTIONAL_MODULE_INCLUDE_FUNCTIONAL_MODULE_TIMER_TIMER_DIRECTOR_H_ + +#include <map> +#include "utils/threads/thread.h" +#include "utils/conditional_variable.h" +#include "functional_module/timer/module_timer.h" + +namespace functional_modules { + +template <class T> +class TimerThreadDelegate : public threads::ThreadDelegate { + public: + explicit TimerThreadDelegate(ModuleTimer<T>& timer); + void threadMain(); + void exitThreadMain(); + + /** + * @brief Reset awaiting timer by notifying cond var + */ + void ResetTimer(); + + private: + ModuleTimer<T>& timer_; + volatile bool keep_running_; + mutable sync_primitives::Lock keep_running_lock_; + mutable sync_primitives::ConditionalVariable keep_running_cond_; + friend class TimerThreadDelegateTest; +}; + +class TimerDirector { + public: + TimerDirector(); + ~TimerDirector(); + + /** + * @brief Register timer for execution in separate thread. + Registers only one timer of a type. Attempt to register timer + of already existing type will fail. + */ + template <class T> + void RegisterTimer(ModuleTimer<T>& timer); + template <class T> + void UnregisterTimer(const ModuleTimer<T>& timer); + void UnregisterAllTimers(); + /** + * @brief Reset awaiting timeout for specified module timer + * @param timer timer to reset awaiting timeout + */ + template <class T> + void ResetTimer(ModuleTimer<T>& timer); + + private: + DISALLOW_COPY_AND_ASSIGN(TimerDirector); + std::map<std::string, threads::Thread*> timer_threads_; +}; + +} // namespace functional_modules + +#endif // SRC_COMPONENTS_FUNCTIONAL_MODULE_INCLUDE_FUNCTIONAL_MODULE_TIMER_TIMER_DIRECTOR_H_ diff --git a/src/components/functional_module/src/generic_module.cc b/src/components/functional_module/src/generic_module.cc new file mode 100644 index 0000000000..142b1ef58c --- /dev/null +++ b/src/components/functional_module/src/generic_module.cc @@ -0,0 +1,54 @@ +#include "functional_module/generic_module.h" +namespace functional_modules { + +typedef std::deque<ModuleObserver*>::iterator ModuleObserverIterator; + +GenericModule::GenericModule(ModuleID module_id) + : kModuleId_(module_id), state_(ServiceState::IDLE) {} + +GenericModule::~GenericModule() { + observers_.clear(); +} + +void GenericModule::AddObserver(ModuleObserver* const observer) { + DCHECK(observer); + if (!observer) { + return; + } + observers_.push_back(observer); +} + +void GenericModule::RemoveObserver(ModuleObserver* const observer) { + DCHECK(observer); + if (!observer) { + return; + } + for (ModuleObserverIterator it = observers_.begin(); observers_.end() != it; + ++it) { + if (*it == observer) { + observers_.erase(it); + return; + } + } +} + +void GenericModule::NotifyObservers(ModuleObserver::Errors error) { + for (ModuleObserverIterator it = observers_.begin(); observers_.end() != it; + ++it) { + (*it)->OnError(error, kModuleId_); + } +} + +void GenericModule::set_service(application_manager::ServicePtr service) { + service_ = service; +} + +void GenericModule::OnServiceStateChanged(ServiceState state) { + state_ = state; +} + +application_manager::ServicePtr GenericModule::service() { + return service_; +} + +} // namespace functional_modules diff --git a/src/components/functional_module/src/plugin_manager.cc b/src/components/functional_module/src/plugin_manager.cc new file mode 100644 index 0000000000..b38048f843 --- /dev/null +++ b/src/components/functional_module/src/plugin_manager.cc @@ -0,0 +1,393 @@ +/* + * Copyright (c) 2017, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include <dlfcn.h> +#include <algorithm> +#include "functional_module/plugin_manager.h" +#include "functional_module/function_ids.h" +#include "protocol/common.h" +#include "utils/file_system.h" +#include "utils/logger.h" +#include "json/json.h" + +namespace functional_modules { + +CREATE_LOGGERPTR_GLOBAL(logger_, "PluginManager") + +namespace { +const std::string ExtractMethodName(application_manager::MessagePtr msg) { + DCHECK_OR_RETURN(msg, ""); + Json::Value value; + Json::Reader reader; + reader.parse(msg->json_message(), value); + + const char* kMethod = "method"; + const char* kResult = "result"; + const char* kError = "error"; + const char* kData = "data"; + + if (value.isMember(kMethod)) { + return value.get(kMethod, "").asCString(); + } + if (value.isMember(kResult)) { + const Json::Value& result = value.get(kResult, Json::Value()); + return result.get(kMethod, "").asCString(); + } + if (value.isMember(kError)) { + const Json::Value& error = value.get(kError, Json::Value()); + const Json::Value& data = error.get(kData, Json::Value()); + return data.get(kMethod, "").asCString(); + } + + return std::string(); +} +} // namespace + +typedef std::map<ModuleID, ModulePtr>::iterator PluginsIterator; +typedef std::map<RCFunctionID, ModulePtr>::iterator PluginFunctionsIterator; +typedef std::map<HMIFunctionID, ModulePtr>::iterator PluginHMIFunctionsIterator; + +PluginManager::PluginManager() : service_() { + LOG4CXX_DEBUG(logger_, "Creating plugin mgr"); +} + +PluginManager::~PluginManager() { + mobile_subscribers_.clear(); + hmi_subscribers_.clear(); + UnloadPlugins(); +} + +int PluginManager::LoadPlugins(const std::string& plugin_path) { + LOG4CXX_INFO(logger_, "Loading plugins from " << plugin_path); + std::vector<std::string> plugin_files = file_system::ListFiles(plugin_path); + for (size_t i = 0; i < plugin_files.size(); ++i) { + size_t pos = plugin_files[i].find_last_of("."); + if (std::string::npos != pos) { + if (plugin_files[i].substr(pos + 1).compare("so") != 0) { + continue; + } + } else { + continue; + } + std::string full_name = plugin_path + '/' + plugin_files[i]; + void* generic_plugin_dll = dlopen(full_name.c_str(), RTLD_LAZY); + if (NULL == generic_plugin_dll) { + LOG4CXX_ERROR(logger_, + "Failed to open dll " << plugin_files[i] << "\n" + << dlerror()); + continue; + } + typedef GenericModule* (*Create)(); + Create create_manager = + reinterpret_cast<Create>(dlsym(generic_plugin_dll, "Create")); + char* error_string = dlerror(); + if (NULL != error_string) { + LOG4CXX_ERROR(logger_, + "Failed to export dll's " << plugin_files[i] << " symbols\n" + << error_string); + dlclose(generic_plugin_dll); + continue; + } + ModulePtr module = create_manager(); + if (!module) { + LOG4CXX_ERROR(logger_, + "Failed to create plugin main class " << plugin_files[i]); + dlclose(generic_plugin_dll); + continue; + } else { + LOG4CXX_DEBUG(logger_, + "Opened and working plugin from " << plugin_files[i] + << " with id " + << module->GetModuleID()); + dlls_.insert(std::pair<ModuleID, void*>(module->GetModuleID(), + generic_plugin_dll)); + plugins_.insert( + std::pair<ModuleID, ModulePtr>(module->GetModuleID(), module)); + std::deque<RCFunctionID> subscribers = + module->GetPluginInfo().rc_function_list; + for (size_t i = 0; i < subscribers.size(); ++i) { + mobile_subscribers_.insert( + std::pair<RCFunctionID, ModulePtr>(subscribers[i], module)); + } + + std::deque<HMIFunctionID> hmi_subscribers = + module->GetPluginInfo().hmi_function_list; + for (size_t i = 0; i < hmi_subscribers.size(); ++i) { + hmi_subscribers_.insert( + std::pair<HMIFunctionID, ModulePtr>(hmi_subscribers[i], module)); + } + module->set_service(service_); + module->AddObserver(this); + } + } + return plugins_.size(); +} + +void PluginManager::UnloadPlugins() { + for (Modules::iterator it = plugins_.begin(); plugins_.end() != it; ++it) { + it->second->RemoveObserver(this); + } + plugins_.clear(); + + for (std::map<ModuleID, void*>::iterator it = dlls_.begin(); + dlls_.end() != it; + ++it) { + dlclose(it->second); + } + dlls_.clear(); +} + +bool PluginManager::IsMessageForPlugin(application_manager::MessagePtr msg) { + DCHECK(msg); + if (!msg) { + LOG4CXX_ERROR(logger_, "Null pointer message was received."); + return false; + } + if (protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_UNKNOWN != + msg->protocol_version() && + protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_HMI != + msg->protocol_version()) { + RCFunctionID id = static_cast<RCFunctionID>(msg->function_id()); + return (mobile_subscribers_.find(id) != mobile_subscribers_.end()); + } else { + return false; + } +} + +bool PluginManager::IsHMIMessageForPlugin(application_manager::MessagePtr msg) { + DCHECK(msg); + if (!msg) { + LOG4CXX_ERROR(logger_, "Null pointer message was received."); + return false; + } + + Json::Value value; + Json::Reader reader; + reader.parse(msg->json_message(), value); + if (protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_HMI == + msg->protocol_version()) { + std::string msg_method; + // Request or notification from HMI + if (value.isMember("method") && value["method"].isString()) { + msg_method = value["method"].asCString(); + // Response from HMI + } else if (value.isMember("result") && value["result"].isMember("method") && + value["result"]["method"].isString()) { + msg_method = value["result"]["method"].asCString(); + // Error response from HMI + } else if (value.isMember("error") && value["error"].isMember("data") && + value["error"]["data"].isMember("method") && + value["error"]["data"]["method"].isString()) { + msg_method = value["error"]["data"]["method"].asCString(); + } else { + LOG4CXX_WARN(logger_, + "Message with HMI protocol version can not be handled by " + "plugin manager, because required 'method' field was not " + "found, or was containing an invalid string."); + return false; + } + + return (hmi_subscribers_.find(msg_method) != hmi_subscribers_.end()); + } + + return false; +} + +ProcessResult PluginManager::ProcessMessage( + application_manager::MessagePtr msg) { + DCHECK(msg); + if (!msg) { + LOG4CXX_ERROR(logger_, "Null pointer message was received."); + return ProcessResult::CANNOT_PROCESS; + } + + protocol_handler::MajorProtocolVersion version = msg->protocol_version(); + if (protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_UNKNOWN == + version || + protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_HMI == version) { + return ProcessResult::CANNOT_PROCESS; + } + + ProcessResult result = ProcessResult::CANNOT_PROCESS; + PluginFunctionsIterator subscribed_plugin_itr = + mobile_subscribers_.find(static_cast<RCFunctionID>(msg->function_id())); + if (mobile_subscribers_.end() != subscribed_plugin_itr) { + result = subscribed_plugin_itr->second->ProcessMessage(msg); + if (ProcessResult::PROCESSED != result) { + LOG4CXX_ERROR(logger_, "Plugin failed to process message."); + } + } + + return result; +} + +ProcessResult PluginManager::ProcessHMIMessage( + application_manager::MessagePtr msg) { + DCHECK_OR_RETURN(msg, ProcessResult::CANNOT_PROCESS); + + if (protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_HMI != + msg->protocol_version()) { + return ProcessResult::CANNOT_PROCESS; + } + + const std::string& msg_method = ExtractMethodName(msg); + if (msg_method.empty()) { + LOG4CXX_WARN(logger_, + "Message with HMI protocol version can not be handled by " + "plugin manager, because required 'method' field was not " + "found, or was containing an invalid string."); + return ProcessResult::CANNOT_PROCESS; + } + + LOG4CXX_DEBUG(logger_, "Parsed method name is " << msg_method); + + ProcessResult result = ProcessResult::CANNOT_PROCESS; + PluginHMIFunctionsIterator subscribed_plugin_itr = + hmi_subscribers_.find(msg_method); + if (hmi_subscribers_.end() != subscribed_plugin_itr) { + result = subscribed_plugin_itr->second->ProcessHMIMessage(msg); + } + + return result; +} + +void PluginManager::OnServiceStateChanged(ServiceState state) { + for (PluginsIterator it = plugins_.begin(); plugins_.end() != it; ++it) { + it->second->OnServiceStateChanged(state); + } +} + +void PluginManager::OnError(ModuleObserver::Errors error, ModuleID module_id) { + std::string error_string; + switch (error) { + case ModuleObserver::Errors::OUT_OF_MEMORY: + error_string = "Module run out of memory."; + break; + case ModuleObserver::Errors::FS_FAILURE: + error_string = "Plugin failed to run file system operation."; + break; + default: { + LOG4CXX_ERROR(logger_, + "Error " << error_string << " was received from module " + << module_id); + } break; + } +} + +void PluginManager::RemoveAppExtension(uint32_t app_id) { + for (PluginsIterator it = plugins_.begin(); plugins_.end() != it; ++it) { + it->second->RemoveAppExtension(app_id); + } +} + +bool PluginManager::IsAppForPlugins( + application_manager::ApplicationSharedPtr app) { + DCHECK(app); + if (!app) { + return false; + } + + bool res = false; + for (PluginsIterator it = plugins_.begin(); plugins_.end() != it; ++it) { + res = res || it->second->IsAppForPlugin(app); + } + return res; +} + +bool PluginManager::IsAppForPlugin( + application_manager::ApplicationSharedPtr app, ModuleID module_id) const { + DCHECK_OR_RETURN(app, false); + Modules::const_iterator i = plugins_.find(module_id); + return i != plugins_.end() ? i->second->IsAppForPlugin(app) : false; +} + +void PluginManager::OnAppHMILevelChanged( + application_manager::ApplicationSharedPtr app, + mobile_apis::HMILevel::eType old_level) { + DCHECK_OR_RETURN_VOID(app); + for (PluginsIterator it = plugins_.begin(); plugins_.end() != it; ++it) { + if (it->second->IsAppForPlugin(app)) { + LOG4CXX_DEBUG(logger_, + "Application " << app->name().AsMBString() << " of plugin " + << it->second->GetModuleID() + << " has changed level from " << old_level + << " to " << app->hmi_level()); + it->second->OnAppHMILevelChanged(app, old_level); + } + } +} + +typedef std::map<ModuleID, ModulePtr>::value_type PluginsValueType; + +struct HandleApplicationEvent { + private: + const functional_modules::ApplicationEvent event_; + const uint32_t app_id_; + + public: + HandleApplicationEvent(functional_modules::ApplicationEvent e, + const uint32_t app_id) + : event_(e), app_id_(app_id) {} + void operator()(PluginsValueType& p) { + p.second->OnApplicationEvent(event_, app_id_); + } +}; + +struct HandlePolicyEvent { + private: + const functional_modules::PolicyEvent event_; + + public: + HandlePolicyEvent(functional_modules::PolicyEvent e) : event_(e) {} + void operator()(PluginsValueType& p) { + p.second->OnPolicyEvent(event_); + } +}; + +void PluginManager::OnApplicationEvent( + functional_modules::ApplicationEvent event, const uint32_t application_id) { + LOG4CXX_AUTO_TRACE(logger_); + std::for_each(plugins_.begin(), + plugins_.end(), + HandleApplicationEvent(event, application_id)); +} + +void PluginManager::OnPolicyEvent(PolicyEvent event) { + LOG4CXX_AUTO_TRACE(logger_); + std::for_each(plugins_.begin(), plugins_.end(), HandlePolicyEvent(event)); +} + +PluginManager::Modules& PluginManager::plugins() { + return plugins_; +} + +} // namespace functional_modules diff --git a/src/components/functional_module/src/timer/timer_director.cc b/src/components/functional_module/src/timer/timer_director.cc new file mode 100644 index 0000000000..81ce117851 --- /dev/null +++ b/src/components/functional_module/src/timer/timer_director.cc @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2017, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include <typeinfo> +#include "functional_module/timer/timer_director.h" +#include "remote_control/rc_module_timer.h" +#include "utils/logger.h" + +namespace functional_modules { + +template <class T> +TimerThreadDelegate<T>::TimerThreadDelegate(ModuleTimer<T>& timer) + : timer_(timer), keep_running_(false) {} + +template <class T> +void TimerThreadDelegate<T>::threadMain() { + if (keep_running_) { + this->exitThreadMain(); + } + { + sync_primitives::AutoLock run_lock(keep_running_lock_); + keep_running_ = true; + } + sync_primitives::AutoLock run_lock(keep_running_lock_); + while (keep_running_) { + const TimeUnit msecs_to_wait = timer_.GetSecondsToNearestTimeout() * 1000; + sync_primitives::ConditionalVariable::WaitStatus wait_status = + keep_running_cond_.WaitFor(run_lock, msecs_to_wait); + if (sync_primitives::ConditionalVariable::kTimeout == wait_status && + keep_running_) { + timer_.CheckTimeout(); + } + } +} + +template <class T> +void TimerThreadDelegate<T>::exitThreadMain() { + if (keep_running_) { + sync_primitives::AutoLock run_lock(keep_running_lock_); + keep_running_ = false; + keep_running_cond_.NotifyOne(); + } +} + +template <class T> +void TimerThreadDelegate<T>::ResetTimer() { + if (keep_running_) { + sync_primitives::AutoLock run_lock(keep_running_lock_); + keep_running_cond_.NotifyOne(); + } +} + +TimerDirector::TimerDirector() {} + +TimerDirector::~TimerDirector() { + UnregisterAllTimers(); +} + +template <class T> +void TimerDirector::RegisterTimer(ModuleTimer<T>& timer) { + std::string type_name = typeid(timer).name(); + std::map<std::string, threads::Thread*>::iterator it = + timer_threads_.find(type_name); + if (timer_threads_.end() != it) { + // Attempt to register timer of already existing type fail. + return; + } + TimerThreadDelegate<T>* delegate = new TimerThreadDelegate<T>(timer); + threads::Thread* thread = threads::CreateThread(type_name.c_str(), delegate); + + const size_t kStackSize = 16384; + if (thread->start(threads::ThreadOptions(kStackSize))) { + timer_threads_.insert(std::make_pair(type_name, thread)); + } else { + // Failed to start timer thread for + } +} + +template void TimerDirector::RegisterTimer<remote_control::TrackableMessage>( + ModuleTimer<remote_control::TrackableMessage>& timer); + +template <class T> +void TimerDirector::UnregisterTimer(const ModuleTimer<T>& timer) { + std::string type_name = typeid(timer).name(); + std::map<std::string, threads::Thread*>::iterator it = + timer_threads_.find(type_name); + if (timer_threads_.end() == it) { + /// Failed to unregister timer that was not registered + return; + } + threads::ThreadDelegate* delegate = it->second->delegate(); + DeleteThread(it->second); + delete delegate; + timer_threads_.erase(it); +} + +template void TimerDirector::UnregisterTimer<remote_control::TrackableMessage>( + const ModuleTimer<remote_control::TrackableMessage>& timer); + +template <class T> +void TimerDirector::ResetTimer(ModuleTimer<T>& timer) { + const std::string type_name = typeid(timer).name(); + std::map<std::string, threads::Thread*>::iterator it = + timer_threads_.find(type_name); + if (timer_threads_.end() == it) { + return; + } + TimerThreadDelegate<T>* delegate = + static_cast<TimerThreadDelegate<T>*>(it->second->delegate()); + delegate->ResetTimer(); +} + +template void TimerDirector::ResetTimer<remote_control::TrackableMessage>( + ModuleTimer<remote_control::TrackableMessage>& timer); + +void TimerDirector::UnregisterAllTimers() { + for (std::map<std::string, threads::Thread*>::iterator it = + timer_threads_.begin(); + timer_threads_.end() != it; + ++it) { + threads::ThreadDelegate* delegate = it->second->delegate(); + DeleteThread(it->second); + delete delegate; + } + timer_threads_.clear(); +} + +} // namespace functional_modules diff --git a/src/components/functional_module/test/CMakeLists.txt b/src/components/functional_module/test/CMakeLists.txt new file mode 100644 index 0000000000..c4e966c84e --- /dev/null +++ b/src/components/functional_module/test/CMakeLists.txt @@ -0,0 +1,53 @@ +include_directories ( + ${LOG4CXX_INCLUDE_DIRECTORY} + ${GMOCK_INCLUDE_DIRECTORY} + ${CMAKE_SOURCE_DIR}/src/components/functional_module/include/ + ${CMAKE_SOURCE_DIR}/src/components/include/ + ${CMAKE_SOURCE_DIR}/src/components/application_manager/include + ${CMAKE_SOURCE_DIR}/src/components/connection_handler/include + ${CMAKE_SOURCE_DIR}/src/components/utils/include + ${CMAKE_SOURCE_DIR}/src/components/policy/include + ${CMAKE_SOURCE_DIR}/src/components/smart_objects/include + ${JSONCPP_INCLUDE_DIRECTORY} + ${CMAKE_BINARY_DIR}/src/components/ + include + plugins +) + +set (LIBRARIES + gtest + gmock + gmock_main + FunctionalModule + dl + ApplicationManager + jsoncpp + Utils + ConfigProfile + gcov +) + +set(SOURCES + ./src/generic_module_test.cc + ./src/plugin_manager_test.cc + ./src/module_timer_test.cc +) + +# use, i.e. don't skip the full RPATH for the build tree +SET(CMAKE_SKIP_BUILD_RPATH FALSE) + +# when building, don't use the install RPATH already +# (but later on when installing) +SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) + +SET(RPATH_DIRECTORIES + /usr/local/lib + /usr/local + ${CMAKE_BINARY_DIR}/src/components/utils +) + +SET(CMAKE_INSTALL_RPATH "${RPATH_DIRECTORIES}") + +add_subdirectory(plugins) + +create_test("function_module_test" "${SOURCES}" "${LIBRARIES}") diff --git a/src/components/functional_module/test/include/driver_generic_module_test.h b/src/components/functional_module/test/include/driver_generic_module_test.h new file mode 100644 index 0000000000..0d5aae1f37 --- /dev/null +++ b/src/components/functional_module/test/include/driver_generic_module_test.h @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2015, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef SRC_COMPONENTS_FUNCTIONAL_MODULE_TEST_INCLUDE_DRIVER_GENERIC_MODULE_TEST_H_ +#define SRC_COMPONENTS_FUNCTIONAL_MODULE_TEST_INCLUDE_DRIVER_GENERIC_MODULE_TEST_H_ + +#include "functional_module/generic_module.h" + +namespace functional_modules { + +class DriverGenericModuleTest : public GenericModule { + public: + explicit DriverGenericModuleTest(ModuleID module_id) + : GenericModule(module_id) {} + virtual ~DriverGenericModuleTest() {} + virtual PluginInfo GetPluginInfo() const { + PluginInfo info; + info.name = "DriverGenericModuleTest"; + info.version = 1; + return info; + } + virtual ProcessResult ProcessMessage(application_manager::MessagePtr msg) { + NotifyObservers(ModuleObserver::FS_FAILURE); + return ProcessResult::FAILED; + } + virtual ProcessResult ProcessHMIMessage(application_manager::MessagePtr msg) { + return ProcessResult::PROCESSED; + } + virtual void RemoveAppExtension(uint32_t app_id) {} + virtual void RemoveAppExtensions() {} + bool IsAppForPlugin(application_manager::ApplicationSharedPtr app) { + return true; + } + + void OnAppHMILevelChanged(application_manager::ApplicationSharedPtr, + mobile_apis::HMILevel::eType) {} + + const Observers& observers() { + return observers_; + } + + void OnApplicationEvent(functional_modules::ApplicationEvent event, + const uint32_t application_id) {} + + void OnPolicyEvent(functional_modules::PolicyEvent event) {} + + void OnUnregisterApplication(const uint32_t app_id) {} +}; + +} // namespace functional_modules + +#endif // SRC_COMPONENTS_FUNCTIONAL_MODULE_TEST_INCLUDE_DRIVER_GENERIC_MODULE_TEST_H_ diff --git a/src/components/functional_module/test/include/mock_application.h b/src/components/functional_module/test/include/mock_application.h new file mode 100644 index 0000000000..e73851094e --- /dev/null +++ b/src/components/functional_module/test/include/mock_application.h @@ -0,0 +1,248 @@ +/* + * Copyright (c) 2015, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef SRC_COMPONENTS_FUNCTIONAL_MODULE_TEST_INCLUDE_MOCK_APPLICATION_H_ +#define SRC_COMPONENTS_FUNCTIONAL_MODULE_TEST_INCLUDE_MOCK_APPLICATION_H_ + +#include "gmock/gmock.h" +#include "application_manager/application.h" +#include "application_manager/usage_statistics.h" +#include "smart_objects/smart_object.h" + +namespace application_manager { + +class MockApplication : public Application { + public: + MOCK_CONST_METHOD0(active_message, const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(curHash, const std::string&()); + MOCK_METHOD0(UpdateHash, void()); + MOCK_METHOD0(CloseActiveMessage, void()); + MOCK_CONST_METHOD0(IsFullscreen, bool()); + MOCK_METHOD0(MakeFullscreen, bool()); + MOCK_CONST_METHOD0(IsAudible, bool()); + MOCK_METHOD0(MakeNotAudible, void()); + MOCK_CONST_METHOD0(allowed_support_navigation, bool()); + MOCK_METHOD1(set_allowed_support_navigation, void(bool allow)); + MOCK_CONST_METHOD0(hmi_supports_navi_streaming, bool()); + MOCK_METHOD1(set_hmi_supports_navi_streaming, void(const bool& supports)); + MOCK_CONST_METHOD0(app_allowed, bool()); + MOCK_CONST_METHOD0(has_been_activated, bool()); + MOCK_CONST_METHOD0(version, const Version&()); + MOCK_METHOD1(set_hmi_application_id, void(uint32_t hmi_app_id)); + MOCK_CONST_METHOD0(hmi_app_id, uint32_t()); + MOCK_CONST_METHOD0(app_id, uint32_t()); + MOCK_CONST_METHOD0(name, const std::string&()); + MOCK_CONST_METHOD0(folder_name, const std::string()); + MOCK_CONST_METHOD0(is_media_application, bool()); + MOCK_CONST_METHOD0(hmi_level, const mobile_api::HMILevel::eType&()); + MOCK_CONST_METHOD0(put_file_in_none_count, const uint32_t()); + MOCK_CONST_METHOD0(delete_file_in_none_count, const uint32_t()); + MOCK_CONST_METHOD0(list_files_in_none_count, const uint32_t()); + MOCK_CONST_METHOD0(system_context, const mobile_api::SystemContext::eType&()); + MOCK_CONST_METHOD0(audio_streaming_state, + const mobile_api::AudioStreamingState::eType&()); + MOCK_CONST_METHOD0(app_icon_path, const std::string&()); + MOCK_CONST_METHOD0(device, connection_handler::DeviceHandle()); + MOCK_METHOD1(set_tts_speak_state, void(bool state_tts_speak)); + MOCK_METHOD0(tts_speak_state, bool()); + MOCK_METHOD1(set_tts_properties_in_none, void(bool active)); + MOCK_METHOD0(tts_properties_in_none, bool()); + MOCK_METHOD1(set_tts_properties_in_full, void(bool active)); + MOCK_METHOD0(tts_properties_in_full, bool()); + MOCK_METHOD1(set_version, void(const Version& version)); + MOCK_METHOD1(set_name, void(const std::string& name)); + MOCK_METHOD1(set_is_media_application, void(bool is_media)); + MOCK_METHOD1(set_hmi_level, + void(const mobile_api::HMILevel::eType& hmi_level)); + MOCK_METHOD0(increment_put_file_in_none_count, void()); + MOCK_METHOD0(increment_delete_file_in_none_count, void()); + MOCK_METHOD0(increment_list_files_in_none_count, void()); + MOCK_METHOD1(set_system_context, + void(const mobile_api::SystemContext::eType& system_context)); + MOCK_METHOD1(set_audio_streaming_state, + void(const mobile_api::AudioStreamingState::eType& state)); + MOCK_METHOD1(set_app_icon_path, bool(const std::string& file_name)); + MOCK_METHOD1(set_app_allowed, void(const bool& allowed)); + MOCK_METHOD1(set_device, void(connection_handler::DeviceHandle device)); + MOCK_CONST_METHOD0(get_grammar_id, uint32_t()); + MOCK_METHOD1(set_grammar_id, void(uint32_t value)); + MOCK_METHOD1(set_protocol_version, + void(const ProtocolVersion& protocol_version)); + MOCK_CONST_METHOD0(protocol_version, ProtocolVersion()); + MOCK_METHOD1(AddFile, bool(AppFile& file)); + MOCK_CONST_METHOD0(getAppFiles, const AppFilesMap&()); + MOCK_METHOD1(UpdateFile, bool(AppFile& file)); + MOCK_METHOD1(DeleteFile, bool(const std::string& file_name)); + MOCK_METHOD1(GetFile, const AppFile*(const std::string& file_name)); + MOCK_METHOD1(SubscribeToButton, + bool(mobile_apis::ButtonName::eType btn_name)); + MOCK_METHOD1(IsSubscribedToButton, + bool(mobile_apis::ButtonName::eType btn_name)); + MOCK_METHOD1(UnsubscribeFromButton, + bool(mobile_apis::ButtonName::eType btn_name)); + MOCK_METHOD1(SubscribeToIVI, bool(uint32_t vehicle_info_type_)); + MOCK_METHOD1(IsSubscribedToIVI, bool(uint32_t vehicle_info_type_)); + MOCK_METHOD1(UnsubscribeFromIVI, bool(uint32_t vehicle_info_type_)); + MOCK_METHOD2(IsCommandLimitsExceeded, + bool(mobile_apis::FunctionID::eType cmd_id, + TLimitSource source)); + MOCK_METHOD0(usage_report, UsageStatistics&()); + MOCK_METHOD2(SubscribeToSoftButtons, + void(int32_t cmd_id, const SoftButtonID& softbuttons_id)); + MOCK_METHOD1(IsSubscribedToSoftButton, bool(const uint32_t softbutton_id)); + MOCK_METHOD1(UnsubscribeFromSoftButtons, void(int32_t cmd_id)); + MOCK_METHOD1(QueryInterface, AppExtensionPtr(AppExtensionUID uid)); + MOCK_METHOD1(AddExtension, bool(AppExtensionPtr extention)); + MOCK_METHOD1(RemoveExtension, bool(AppExtensionUID uid)); + MOCK_METHOD0(RemoveExtensions, void()); + MOCK_CONST_METHOD0(help_prompt, const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(timeout_prompt, const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(vr_help_title, const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(vr_help, const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(tbt_state, const mobile_api::TBTState::eType&()); + MOCK_CONST_METHOD0(show_command, const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(tbt_show_command, const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(SubscribedButtons, + const std::set<mobile_apis::ButtonName::eType>&()); + MOCK_CONST_METHOD0(SubscribesIVI, const std::set<uint32_t>&()); + MOCK_CONST_METHOD0(keyboard_props, const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(menu_title, const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(menu_icon, const smart_objects::SmartObject*()); + MOCK_METHOD1(set_help_prompt, + void(const smart_objects::SmartObject& help_prompt)); + MOCK_METHOD1(set_timeout_prompt, + void(const smart_objects::SmartObject& timeout_prompt)); + MOCK_METHOD1(set_vr_help_title, + void(const smart_objects::SmartObject& vr_help_title)); + MOCK_METHOD0(reset_vr_help_title, void()); + MOCK_METHOD1(set_vr_help, void(const smart_objects::SmartObject& vr_help)); + MOCK_METHOD0(reset_vr_help, void()); + MOCK_METHOD1(set_tbt_state, + void(const mobile_api::TBTState::eType& tbt_state)); + MOCK_METHOD1(set_show_command, + void(const smart_objects::SmartObject& show_command)); + MOCK_METHOD1(set_tbt_show_command, + void(const smart_objects::SmartObject& tbt_show)); + MOCK_METHOD1(set_keyboard_props, + void(const smart_objects::SmartObject& keyboard_props)); + MOCK_METHOD1(set_menu_title, + void(const smart_objects::SmartObject& menu_title)); + MOCK_METHOD1(set_menu_icon, + void(const smart_objects::SmartObject& menu_icon)); + MOCK_METHOD2(AddCommand, + void(uint32_t cmd_id, + const smart_objects::SmartObject& command)); + MOCK_METHOD1(RemoveCommand, void(uint32_t cmd_id)); + MOCK_METHOD1(FindCommand, smart_objects::SmartObject*(uint32_t cmd_id)); + MOCK_METHOD2(AddSubMenu, + void(uint32_t menu_id, const smart_objects::SmartObject& menu)); + MOCK_METHOD1(RemoveSubMenu, void(uint32_t menu_id)); + MOCK_CONST_METHOD1(FindSubMenu, + smart_objects::SmartObject*(uint32_t menu_id)); + MOCK_METHOD1(IsSubMenuNameAlreadyExist, bool(const std::string& name)); + MOCK_METHOD2(AddChoiceSet, + void(uint32_t choice_set_id, + const smart_objects::SmartObject& choice_set)); + MOCK_METHOD1(RemoveChoiceSet, void(uint32_t choice_set_id)); + MOCK_METHOD1(FindChoiceSet, + smart_objects::SmartObject*(uint32_t choice_set_id)); + MOCK_METHOD2(AddPerformInteractionChoiceSet, + void(uint32_t choice_set_id, + const smart_objects::SmartObject& choice_set)); + MOCK_METHOD0(DeletePerformInteractionChoiceSetMap, void()); + MOCK_CONST_METHOD0(performinteraction_choice_set_map, + DataAccessor<PerformChoiceSetMap>()); + MOCK_CONST_METHOD1(FindPerformInteractionChoiceSet, + smart_objects::SmartObject*(uint32_t choice_set_id)); + MOCK_CONST_METHOD0(commands_map, DataAccessor<CommandsMap>()); + MOCK_CONST_METHOD0(sub_menu_map, DataAccessor<SubMenuMap>()); + MOCK_CONST_METHOD0(choice_set_map, DataAccessor<ChoiceSetMap>()); + MOCK_METHOD1(set_perform_interaction_active, void(uint32_t active)); + MOCK_CONST_METHOD0(is_perform_interaction_active, uint32_t()); + MOCK_METHOD1(set_perform_interaction_ui_corrid, void(uint32_t choice)); + MOCK_CONST_METHOD0(perform_interaction_ui_corrid, uint32_t()); + MOCK_METHOD1(set_perform_interaction_mode, void(int32_t mode)); + MOCK_CONST_METHOD0(perform_interaction_mode, int32_t()); + MOCK_METHOD1(set_reset_global_properties_active, void(bool active)); + MOCK_CONST_METHOD0(is_reset_global_properties_active, bool()); + MOCK_CONST_METHOD0(app_types, const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(vr_synonyms, const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(mobile_app_id, std::string()); + MOCK_CONST_METHOD0(tts_name, const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(ngn_media_screen_name, + const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(language, const mobile_api::Language::eType&()); + MOCK_CONST_METHOD0(ui_language, const mobile_api::Language::eType&()); + MOCK_METHOD1(set_app_types, + void(const smart_objects::SmartObject& app_types)); + MOCK_METHOD1(set_vr_synonyms, + void(const smart_objects::SmartObject& vr_synonyms)); + MOCK_METHOD1(set_mobile_app_id, + void(const smart_objects::SmartObject& mobile_app_id)); + MOCK_METHOD1(set_tts_name, void(const smart_objects::SmartObject& tts_name)); + MOCK_METHOD1(set_ngn_media_screen_name, + void(const smart_objects::SmartObject& ngn_name)); + MOCK_METHOD1(set_language, void(const mobile_api::Language::eType& language)); + MOCK_METHOD1(set_ui_language, + void(const mobile_api::Language::eType& ui_language)); + MOCK_METHOD1(load_global_properties, + void(const smart_objects::SmartObject& so)); + MOCK_METHOD1(set_mobile_app_id, void(const std::string& mobile_app_id)); + MOCK_METHOD0(ChangeSupportingAppHMIType, void()); + MOCK_CONST_METHOD0(is_navi, bool()); + MOCK_METHOD1(set_is_navi, void(bool allow)); + MOCK_CONST_METHOD0(hmi_supports_navi_video_streaming, bool()); + MOCK_METHOD1(set_hmi_supports_navi_video_streaming, void(bool supports)); + MOCK_CONST_METHOD0(hmi_supports_navi_audio_streaming, bool()); + MOCK_METHOD1(set_hmi_supports_navi_audio_streaming, void(bool supports)); + MOCK_CONST_METHOD0(is_voice_communication_supported, bool()); + MOCK_METHOD1(set_voice_communication_supported, void(bool)); + MOCK_METHOD1(set_activated, bool(bool is_active)); + MOCK_CONST_METHOD0(is_foreground, bool()); + MOCK_METHOD1(set_foreground, void(bool is_foreground)); + MOCK_CONST_METHOD0(IsAudioApplication, bool()); + MOCK_CONST_METHOD0(video_stream_retry_active, bool()); + MOCK_METHOD1(set_video_stream_retry_active, void(bool active)); + MOCK_CONST_METHOD0(audio_stream_retry_active, bool()); + MOCK_METHOD1(set_audio_stream_retry_active, void(bool active)); + MOCK_METHOD0(OnVideoStreamRetry, void()); + MOCK_METHOD0(OnAudioStreamRetry, void()); + MOCK_METHOD1(SubscribeToInteriorVehicleData, + bool(smart_objects::SmartObject module)); + MOCK_METHOD1(IsSubscribedToInteriorVehicleData, + bool(smart_objects::SmartObject module)); + MOCK_METHOD1(UnsubscribeFromInteriorVehicleData, + bool(smart_objects::SmartObject module)); +}; + +} // namespace application_manager + +#endif // SRC_COMPONENTS_FUNCTIONAL_MODULE_TEST_INCLUDE_MOCK_APPLICATION_H_ diff --git a/src/components/functional_module/test/include/mock_module_observer.h b/src/components/functional_module/test/include/mock_module_observer.h new file mode 100644 index 0000000000..bfa5117b29 --- /dev/null +++ b/src/components/functional_module/test/include/mock_module_observer.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2015, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef SRC_COMPONENTS_FUNCTIONAL_MODULE_TEST_INCLUDE_MOCK_MODULE_OBSERVER_H_ +#define SRC_COMPONENTS_FUNCTIONAL_MODULE_TEST_INCLUDE_MOCK_MODULE_OBSERVER_H_ + +#include "gmock/gmock.h" +#include "functional_module/module_observer.h" + +namespace functional_modules { + +class MockModuleObserver : public ModuleObserver { + public: + MOCK_METHOD2(OnError, void(Errors error, ModuleID module_id)); + int ObserverMethod() { + return 13; + } +}; + +} // namespace functional_modules + +#endif // SRC_COMPONENTS_FUNCTIONAL_MODULE_TEST_INCLUDE_MOCK_MODULE_OBSERVER_H_ diff --git a/src/components/functional_module/test/include/mock_service.h b/src/components/functional_module/test/include/mock_service.h new file mode 100644 index 0000000000..d1fa7f2747 --- /dev/null +++ b/src/components/functional_module/test/include/mock_service.h @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2015, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef SRC_COMPONENTS_FUNCTIONAL_MODULE_TEST_INCLUDE_MOCK_SERVICE_H_ +#define SRC_COMPONENTS_FUNCTIONAL_MODULE_TEST_INCLUDE_MOCK_SERVICE_H_ + +#include "gmock/gmock.h" +#include "application_manager/service.h" + +namespace application_manager { + +class MockService : public Service { + public: + MOCK_METHOD1(CheckPolicyPermissions, + mobile_apis::Result::eType(MessagePtr msg)); + MOCK_METHOD1(GetApplication, ApplicationSharedPtr(ApplicationId app_id)); + MOCK_METHOD1(SendMessageToHMI, void(const MessagePtr& message)); + MOCK_METHOD1(SendMessageToMobile, void(const MessagePtr& message)); + MOCK_METHOD0(GetNextCorrelationID, uint32_t()); + MOCK_METHOD1(GetApplications, + std::vector<ApplicationSharedPtr>(AppExtensionUID)); + MOCK_METHOD2(ChangeNotifyHMILevel, + void(ApplicationSharedPtr app, + mobile_apis::HMILevel::eType level)); + MOCK_METHOD2(NotifyHMIAboutHMILevel, + void(ApplicationSharedPtr app, + mobile_apis::HMILevel::eType level)); + MOCK_CONST_METHOD0(GetRCCapabilities, const smart_objects::SmartObject*()); + MOCK_METHOD2(CheckModule, + bool(const ApplicationId& app_id, const std::string& module)); + MOCK_METHOD1(RemoveHMIFakeParameters, + void(application_manager::MessagePtr& message)); + MOCK_CONST_METHOD1(IsRemoteControlApplication, + bool(ApplicationSharedPtr app)); + MOCK_CONST_METHOD1(IsInterfaceAvailable, + bool(const HmiInterfaces::InterfaceID interface)); + MOCK_CONST_METHOD2(GetModuleTypes, + bool(const std::string& application_id, + std::vector<std::string>* modules)); + MOCK_METHOD1(ValidateMessageBySchema, + application_manager::MessageValidationResult( + const application_manager::Message& message)); + MOCK_CONST_METHOD0(GetSettings, const ApplicationManagerSettings&()); +}; +} +// namespace application_manager + +#endif // SRC_COMPONENTS_FUNCTIONAL_MODULE_TEST_INCLUDE_MOCK_SERVICE_H_ diff --git a/src/components/functional_module/test/include/module_timer_test.h b/src/components/functional_module/test/include/module_timer_test.h new file mode 100644 index 0000000000..456346b544 --- /dev/null +++ b/src/components/functional_module/test/include/module_timer_test.h @@ -0,0 +1,56 @@ +#include "utils/macro.h" +#include "functional_module/timer/module_timer.h" + +namespace functional_modules { + +class TestTrackable : public Trackable { + public: + explicit TestTrackable(TimeUnit interval = 0) + : Trackable(), custom_interval_(interval) {} + + virtual TimeUnit custom_interval() const { + return custom_interval_; + } + + bool operator==(const TestTrackable& other) const { + return custom_interval_ == other.custom_interval_; + } + + private: + TimeUnit custom_interval_; +}; + +class ModuleTimerTest { + public: + ModuleTimerTest(ModuleTimer<TestTrackable>& timer) : timer_(timer) {} + + TimeUnit period() const { + return timer_.period_; + } + + int observers_size() const { + return timer_.observers_.size(); + } + + int trackables_size() const { + return timer_.trackables_.size(); + } + + TestTrackable trackable(const TestTrackable& track) const { + return *std::find( + timer_.trackables_.begin(), timer_.trackables_.end(), track); + } + + TimeUnit current_time() const { + return timer_.CurrentTime(); + } + + private: + ModuleTimer<TestTrackable>& timer_; +}; + +class MockTimerObserver : public TimerObserver<TestTrackable> { + public: + MOCK_METHOD1(OnTimeoutTriggered, void(const TestTrackable& expired)); +}; +} // namespace functional_modules diff --git a/src/components/functional_module/test/plugins/CMakeLists.txt b/src/components/functional_module/test/plugins/CMakeLists.txt new file mode 100644 index 0000000000..7afe8387b8 --- /dev/null +++ b/src/components/functional_module/test/plugins/CMakeLists.txt @@ -0,0 +1,17 @@ +set(target PluginMock) + +include_directories ( + ${LOG4CXX_INCLUDE_DIRECTORY} + ${GMOCK_INCLUDE_DIRECTORY} + ${CMAKE_SOURCE_DIR}/src/components/functional_module/include/ + ${CMAKE_SOURCE_DIR}/src/components/include/ + ${JSONCPP_INCLUDE_DIRECTORY} +) + +set(SOURCES + ./mock_generic_module.cc +) + +add_library(${target} SHARED ${SOURCES}) +target_link_libraries(${target}) +add_dependencies(${target} MOBILE_API HMI_API) diff --git a/src/components/functional_module/test/plugins/mock_generic_module.cc b/src/components/functional_module/test/plugins/mock_generic_module.cc new file mode 100644 index 0000000000..dcf6d7d4fe --- /dev/null +++ b/src/components/functional_module/test/plugins/mock_generic_module.cc @@ -0,0 +1,23 @@ +#include "mock_generic_module.h" + +using functional_modules::GenericModule; +using functional_modules::RCFunctionID; +using functional_modules::PluginInfo; + +using ::testing::_; +using ::testing::Return; + +MockGenericModule::MockGenericModule() : GenericModule(19) { + PluginInfo info; + info.name = "MockGenericModule"; + info.version = 1; + info.rc_function_list.push_back(static_cast<RCFunctionID>(101)); + info.hmi_function_list.push_back("HMI-Func-1"); + + EXPECT_CALL(*this, GetPluginInfo()).Times(2).WillRepeatedly(Return(info)); + EXPECT_CALL(*this, set_service(_)).Times(1); +} + +extern "C" GenericModule* Create() { + return new MockGenericModule(); +} diff --git a/src/components/functional_module/test/plugins/mock_generic_module.h b/src/components/functional_module/test/plugins/mock_generic_module.h new file mode 100644 index 0000000000..0139866d67 --- /dev/null +++ b/src/components/functional_module/test/plugins/mock_generic_module.h @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2015, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef TEST_COMPONENTS_FUNCTIONAL_MODULE_PLUGINS_MOCK_GENERIC_MODULE_H_ +#define TEST_COMPONENTS_FUNCTIONAL_MODULE_PLUGINS_MOCK_GENERIC_MODULE_H_ + +#include "gmock/gmock.h" +#include "functional_module/generic_module.h" + +using functional_modules::GenericModule; +using functional_modules::PluginInfo; +using functional_modules::ProcessResult; +using functional_modules::ServiceState; + +using ::testing::_; +using ::testing::Return; + +class MockGenericModule : public GenericModule { + public: + MockGenericModule(); + MOCK_CONST_METHOD0(GetPluginInfo, PluginInfo()); + MOCK_METHOD1(set_service, void(application_manager::ServicePtr service)); + MOCK_METHOD0(service, application_manager::ServicePtr()); + MOCK_METHOD1(ProcessMessage, + ProcessResult(application_manager::MessagePtr msg)); + MOCK_METHOD1(ProcessHMIMessage, + ProcessResult(application_manager::MessagePtr msg)); + MOCK_METHOD1(OnServiceStateChanged, void(ServiceState state)); + MOCK_METHOD1(RemoveAppExtension, void(uint32_t app_id)); + MOCK_METHOD1(IsAppForPlugin, + bool(application_manager::ApplicationSharedPtr app)); + MOCK_METHOD2(OnAppHMILevelChanged, + void(application_manager::ApplicationSharedPtr app, + mobile_apis::HMILevel::eType old_level)); + MOCK_METHOD1(OnUnregisterApplication, void(const uint32_t app_id)); + MOCK_METHOD2(OnApplicationEvent, + void(functional_modules::ApplicationEvent event, + const uint32_t application_id)); + MOCK_METHOD1(OnPolicyEvent, void(functional_modules::PolicyEvent event)); + MOCK_METHOD0(RemoveAppExtensions, void()); +}; + +#endif // TEST_COMPONENTS_FUNCTIONAL_MODULE_PLUGINS_MOCK_GENERIC_MODULE_H_ diff --git a/src/components/functional_module/test/src/generic_module_test.cc b/src/components/functional_module/test/src/generic_module_test.cc new file mode 100644 index 0000000000..71d8325f6d --- /dev/null +++ b/src/components/functional_module/test/src/generic_module_test.cc @@ -0,0 +1,106 @@ +#include "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "driver_generic_module_test.h" + +#include "mock_module_observer.h" +#include "mock_service.h" + +using application_manager::ServicePtr; +using application_manager::MockService; + +using ::testing::_; + +namespace functional_modules { + +TEST(GenericModuleTest, SetService) { + DriverGenericModuleTest module(18); + MockService* mock_service = new MockService(); + ServicePtr exp_service(mock_service); + + module.set_service(exp_service); + ServicePtr out_service = module.service(); + + EXPECT_EQ(exp_service.get(), out_service.get()); +} + +TEST(GenericModuleTest, RemoveObserver) { + DriverGenericModuleTest module(18); + MockModuleObserver* observer = new MockModuleObserver(); + module.AddObserver(observer); + + module.RemoveObserver(observer); + const DriverGenericModuleTest::Observers& empty = module.observers(); + ASSERT_TRUE(empty.empty()); + delete observer; +} + +TEST(GenericModuleTest, EmptyRemoveObserver) { + DriverGenericModuleTest module(18); + MockModuleObserver* observer = new MockModuleObserver(); + module.RemoveObserver(observer); + const DriverGenericModuleTest::Observers& empty = module.observers(); + ASSERT_TRUE(empty.empty()); + delete observer; +} + +TEST(GenericModuleTest, WrongRemoveObserver) { + DriverGenericModuleTest module(18); + MockModuleObserver observer; + module.AddObserver(&observer); + + MockModuleObserver* wrong_observer = new MockModuleObserver(); + module.RemoveObserver(wrong_observer); + const DriverGenericModuleTest::Observers& empty = module.observers(); + ASSERT_EQ(1u, empty.size()); + EXPECT_EQ(&observer, empty[0]); + delete wrong_observer; +} + +TEST(GenericModuleTest, CrashRemovedObserver) { + DriverGenericModuleTest module(18); + MockModuleObserver* observer = new MockModuleObserver(); + module.AddObserver(observer); + EXPECT_EQ(13, observer->ObserverMethod()); + module.RemoveObserver(observer); + EXPECT_EQ(13, observer->ObserverMethod()); + delete observer; + MockModuleObserver second_observer; + module.AddObserver(&second_observer); + EXPECT_EQ(13, second_observer.ObserverMethod()); + module.RemoveObserver(&second_observer); + EXPECT_EQ(13, second_observer.ObserverMethod()); +} + +TEST(GenericModuleTest, NotifyObservers) { + DriverGenericModuleTest module(3); + MockModuleObserver observer; + module.AddObserver(&observer); + + EXPECT_CALL(observer, OnError(ModuleObserver::FS_FAILURE, 3)).Times(1); + + application_manager::MessagePtr message; + module.ProcessMessage(message); +} + +TEST(GenericModuleTest, NotifyObserversComplex) { + DriverGenericModuleTest module(3); + MockModuleObserver observer_1; + module.AddObserver(&observer_1); + MockModuleObserver observer_2; + module.AddObserver(&observer_2); + + EXPECT_CALL(observer_1, OnError(ModuleObserver::FS_FAILURE, 3)).Times(1); + EXPECT_CALL(observer_2, OnError(ModuleObserver::FS_FAILURE, 3)).Times(1); + + application_manager::MessagePtr message; + module.ProcessMessage(message); + + module.RemoveObserver(&observer_1); + EXPECT_CALL(observer_1, OnError(ModuleObserver::FS_FAILURE, 3)).Times(0); + EXPECT_CALL(observer_2, OnError(ModuleObserver::FS_FAILURE, 3)).Times(1); + + module.ProcessMessage(message); +} + +} // namespace functional_modules diff --git a/src/components/functional_module/test/src/module_timer_test.cc b/src/components/functional_module/test/src/module_timer_test.cc new file mode 100644 index 0000000000..668c3e2955 --- /dev/null +++ b/src/components/functional_module/test/src/module_timer_test.cc @@ -0,0 +1,123 @@ +#include "gtest/gtest.h" +#include "gmock/gmock.h" +#include "module_timer_test.h" + +namespace functional_modules { + +TEST(ModuleTimerTest, set_period) { + ModuleTimer<TestTrackable> timer; + timer.set_period(10000); + ModuleTimerTest test(timer); + EXPECT_EQ(10000u, test.period()); +} + +TEST(ModuleTimerTest, add_observer) { + ModuleTimer<TestTrackable> timer; + ModuleTimerTest test(timer); + for (size_t i = 0; i < 5; ++i) { + MockTimerObserver observer; + timer.AddObserver(&observer); + } + EXPECT_EQ(5, test.observers_size()); +} + +TEST(ModuleTimerTest, remove_observer) { + ModuleTimer<TestTrackable> timer; + ModuleTimerTest test(timer); + + MockTimerObserver observer; + timer.AddObserver(&observer); + MockTimerObserver observer2; + timer.AddObserver(&observer2); + timer.RemoveObserver(&observer); + EXPECT_EQ(1, test.observers_size()); + MockTimerObserver observer3; + timer.RemoveObserver(&observer3); + EXPECT_EQ(1, test.observers_size()); + timer.RemoveObserver(&observer2); + EXPECT_EQ(0, test.observers_size()); +} + +TEST(ModuleTimerTest, start) { + ModuleTimer<TestTrackable> timer; + ModuleTimerTest test(timer); + timer.set_period(1); + MockTimerObserver observer; + timer.AddObserver(&observer); + TestTrackable track; + timer.AddTrackable(track); + sleep(2); + EXPECT_CALL(observer, OnTimeoutTriggered(track)).Times(1); + timer.CheckTimeout(); + EXPECT_EQ(0, test.trackables_size()); + timer.set_period(4); + timer.AddTrackable(track); + sleep(2); + EXPECT_CALL(observer, OnTimeoutTriggered(track)).Times(0); + timer.CheckTimeout(); + EXPECT_EQ(1, test.trackables_size()); + TestTrackable track2(1); + timer.AddTrackable(track2); + timer.AddTrackable(track); + sleep(2); + EXPECT_CALL(observer, OnTimeoutTriggered(track2)).Times(1); + EXPECT_CALL(observer, OnTimeoutTriggered(track)).Times(0); + timer.CheckTimeout(); + EXPECT_EQ(1, test.trackables_size()); +} + +TEST(ModuleTimerTest, add_trackable) { + ModuleTimer<TestTrackable> timer; + ModuleTimerTest test(timer); + timer.AddTrackable(TestTrackable()); + ASSERT_EQ(1, test.trackables_size()); + // adding the same object twice + timer.AddTrackable(TestTrackable()); + EXPECT_EQ(1, test.trackables_size()); + // adding another object + TestTrackable track(3); + timer.AddTrackable(track); + ASSERT_EQ(2, test.trackables_size()); + EXPECT_TRUE(test.trackable(track).start_time() - test.current_time() < 1); + timer.AddTrackable(track); + sleep(3); + EXPECT_TRUE(test.current_time() - test.trackable(track).start_time() < 4 && + test.current_time() - test.trackable(track).start_time() > 2); +} + +TEST(ModuleTimerTest, remove_trackable) { + ModuleTimer<TestTrackable> timer; + ModuleTimerTest test(timer); + EXPECT_EQ(0, test.trackables_size()); + TestTrackable track1; + TestTrackable track2(1); + timer.AddTrackable(track1); + timer.AddTrackable(track2); + EXPECT_EQ(2, test.trackables_size()); + timer.RemoveTrackable(track2); + ASSERT_EQ(1, test.trackables_size()); + TestTrackable track3(2); + timer.RemoveTrackable(track3); + ASSERT_EQ(1, test.trackables_size()); + timer.RemoveTrackable(track1); + ASSERT_EQ(0, test.trackables_size()); +} + +TEST(ModuleTimerTest, notify) { + ModuleTimer<TestTrackable> timer; + ModuleTimerTest test(timer); + timer.set_period(1); + MockTimerObserver observer; + timer.AddObserver(&observer); + TestTrackable track; + timer.AddTrackable(track); + TestTrackable track2(2); + timer.AddTrackable(track2); + sleep(2); + EXPECT_CALL(observer, OnTimeoutTriggered(track)).Times(1); + EXPECT_CALL(observer, OnTimeoutTriggered(track2)).Times(0); + timer.CheckTimeout(); + EXPECT_EQ(1, test.trackables_size()); +} + +} // namespace functional_modules diff --git a/src/components/functional_module/test/src/plugin_manager_test.cc b/src/components/functional_module/test/src/plugin_manager_test.cc new file mode 100644 index 0000000000..5c251113a8 --- /dev/null +++ b/src/components/functional_module/test/src/plugin_manager_test.cc @@ -0,0 +1,146 @@ +#include "gtest/gtest.h" +#include "gmock/gmock.h" +#include "functional_module/plugin_manager.h" +#include "mock_generic_module.h" +#include "mock_service.h" +#include "application_manager/mock_application.h" +#include "utils/shared_ptr.h" +#include "utils/make_shared.h" + +using application_manager::Message; +using protocol_handler::MajorProtocolVersion; +using application_manager::MockService; +using ::testing::NiceMock; +using ::testing::Expectation; +using ::testing::ReturnRef; + +namespace functional_modules { + +class PluginManagerTest : public ::testing::Test { + public: + PluginManagerTest() + : manager(utils::MakeShared<PluginManager>()) + , service(utils::MakeShared<MockService>()) {} + + protected: + utils::SharedPtr<PluginManager> manager; + utils::SharedPtr<MockService> service; + MockGenericModule* module; + + void SetUp() OVERRIDE { + manager->SetServiceHandler(service); + + ASSERT_EQ(1, manager->LoadPlugins("./plugins/")); + const PluginManager::Modules& plugins = manager->plugins(); + PluginManager::Modules::const_iterator i = plugins.begin(); + module = static_cast<MockGenericModule*>(i->second.get()); + } +}; + +TEST_F(PluginManagerTest, ChangePluginsState) { + ServiceState kState = ServiceState::SUSPENDED; + EXPECT_CALL(*module, OnServiceStateChanged(kState)); + manager->OnServiceStateChanged(kState); +} + +TEST_F(PluginManagerTest, RemoveAppExtension) { + const uint32_t kAppId = 2; + EXPECT_CALL(*module, RemoveAppExtension(kAppId)).Times(1); + manager->RemoveAppExtension(kAppId); +} + +TEST_F(PluginManagerTest, ProcessMessageFail) { + Message* msg = new Message(protocol_handler::MessagePriority::FromServiceType( + protocol_handler::ServiceType::kRpc)); + application_manager::MessagePtr message(msg); + msg->set_protocol_version(MajorProtocolVersion::PROTOCOL_VERSION_UNKNOWN); + EXPECT_CALL(*module, ProcessMessage(message)).Times(0); + manager->ProcessMessage(message); +} + +TEST_F(PluginManagerTest, ProcessMessagePass) { + Message* msg = new Message(protocol_handler::MessagePriority::FromServiceType( + protocol_handler::ServiceType::kRpc)); + application_manager::MessagePtr message(msg); + msg->set_protocol_version(MajorProtocolVersion::PROTOCOL_VERSION_3); + msg->set_function_id(101); // see MockGenericModule + EXPECT_CALL(*module, ProcessMessage(message)) + .Times(1) + .WillOnce(Return(ProcessResult::PROCESSED)); + manager->ProcessMessage(message); +} + +TEST_F(PluginManagerTest, SDL_events_triggers_module) { + using namespace functional_modules; + std::vector<ApplicationEvent> app_events; + app_events.push_back(ApplicationEvent::kApplicationExit); + app_events.push_back(ApplicationEvent::kApplicationUnregistered); + + std::vector<ApplicationEvent>::const_iterator ev = app_events.begin(); + const uint32_t kDummyAppId = 1; + for (; app_events.end() != ev; ++ev) { + EXPECT_CALL(*module, OnApplicationEvent(*ev, kDummyAppId)); + manager->OnApplicationEvent(*ev, kDummyAppId); + } + + std::vector<PolicyEvent> policy_events; + policy_events.push_back(PolicyEvent::kApplicationPolicyUpdated); + policy_events.push_back(PolicyEvent::kApplicationsDisabled); + + std::vector<PolicyEvent>::const_iterator ev_policy = policy_events.begin(); + for (; policy_events.end() != ev_policy; ++ev_policy) { + EXPECT_CALL(*module, OnPolicyEvent(*ev_policy)); + manager->OnPolicyEvent(*ev_policy); + } +} + +TEST_F(PluginManagerTest, ProcessHMIMessageFail) { + Message* msg = new Message(protocol_handler::MessagePriority::FromServiceType( + protocol_handler::ServiceType::kRpc)); + application_manager::MessagePtr message(msg); + message->set_protocol_version(MajorProtocolVersion::PROTOCOL_VERSION_UNKNOWN); + EXPECT_CALL(*module, ProcessHMIMessage(message)).Times(0); + manager->ProcessHMIMessage(message); +} + +TEST_F(PluginManagerTest, ProcessHMIMessagePass) { + Message* msg = new Message(protocol_handler::MessagePriority::FromServiceType( + protocol_handler::ServiceType::kRpc)); + application_manager::MessagePtr message(msg); + message->set_protocol_version(MajorProtocolVersion::PROTOCOL_VERSION_HMI); + std::string json = "{\"method\": \"HMI-Func-1\"}"; // see MockGenericModule + message->set_json_message(json); + EXPECT_CALL(*module, ProcessHMIMessage(message)) + .Times(1) + .WillOnce(Return(ProcessResult::PROCESSED)); + manager->ProcessHMIMessage(message); +} + +TEST_F(PluginManagerTest, IsAppForPlugins) { + using test::components::application_manager_test::MockApplication; + MockApplication* app = new MockApplication(); + application_manager::ApplicationSharedPtr app_ptr(app); + EXPECT_CALL(*module, IsAppForPlugin(app_ptr)).Times(1); + manager->IsAppForPlugins(app_ptr); +} + +TEST_F(PluginManagerTest, OnAppHMILevelChanged) { + using test::components::application_manager_test::MockApplication; + NiceMock<MockApplication>* app = new NiceMock<MockApplication>(); + application_manager::ApplicationSharedPtr app_ptr(app); + + const application_manager::custom_str::CustomString name("name"); + ON_CALL(*app, name()).WillByDefault(ReturnRef(name)); + mobile_apis::HMILevel::eType level = mobile_apis::HMILevel::eType::HMI_NONE; + ON_CALL(*app, hmi_level()).WillByDefault(Return(level)); + + Expectation is_for_plugin = + EXPECT_CALL(*module, IsAppForPlugin(app_ptr)).WillOnce(Return(true)); + EXPECT_CALL(*module, OnAppHMILevelChanged(app_ptr, _)) + .Times(1) + .After(is_for_plugin); + manager->OnAppHMILevelChanged(app_ptr, + mobile_apis::HMILevel::eType::HMI_FULL); +} + +} // namespace functional_modules diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_adapter_impl.h b/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_adapter_impl.h index bd118032d6..f2a5ce2dd8 100644 --- a/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_adapter_impl.h +++ b/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_adapter_impl.h @@ -51,7 +51,7 @@ class HMIMessageAdapterImpl : public HMIMessageAdapter { /** * \brief Destructor */ - virtual ~HMIMessageAdapterImpl(); + ~HMIMessageAdapterImpl(); protected: virtual HMIMessageHandler* handler() const { diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_handler_impl.h b/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_handler_impl.h index 8b238b4aa8..0d85c30fc2 100644 --- a/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_handler_impl.h +++ b/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_handler_impl.h @@ -89,14 +89,14 @@ class HMIMessageHandlerImpl : public HMIMessageHandler, explicit HMIMessageHandlerImpl(const HMIMessageHandlerSettings& settings); ~HMIMessageHandlerImpl(); - void OnMessageReceived(MessageSharedPointer message); - void SendMessageToHMI(MessageSharedPointer message); + void OnMessageReceived(MessageSharedPointer message) OVERRIDE; + void SendMessageToHMI(MessageSharedPointer message) OVERRIDE; void set_message_observer(HMIMessageObserver* observer); - void OnErrorSending(MessageSharedPointer message); - void AddHMIMessageAdapter(HMIMessageAdapter* adapter); - void RemoveHMIMessageAdapter(HMIMessageAdapter* adapter); + void OnErrorSending(MessageSharedPointer message) OVERRIDE; + void AddHMIMessageAdapter(HMIMessageAdapter* adapter) OVERRIDE; + void RemoveHMIMessageAdapter(HMIMessageAdapter* adapter) OVERRIDE; - virtual const HMIMessageHandlerSettings& get_settings() const OVERRIDE; + const HMIMessageHandlerSettings& get_settings() const OVERRIDE; #ifdef BUILD_TESTS std::set<HMIMessageAdapter*> message_adapters() const { @@ -120,15 +120,16 @@ class HMIMessageHandlerImpl : public HMIMessageHandler, // threads::MessageLoopThread<*>::Handler implementations // CALLED ON messages_from_hmi_ THREAD! - virtual void Handle(const impl::MessageFromHmi message) OVERRIDE; + void Handle(const impl::MessageFromHmi message) OVERRIDE; // CALLED ON messages_to_hmi_ THREAD! - virtual void Handle(const impl::MessageToHmi message) OVERRIDE; + void Handle(const impl::MessageToHmi message) OVERRIDE; private: const HMIMessageHandlerSettings& settings_; HMIMessageObserver* observer_; - mutable sync_primitives::Lock observer_locker_; std::set<HMIMessageAdapter*> message_adapters_; + mutable sync_primitives::Lock observer_locker_; + mutable sync_primitives::Lock message_adapters_locker_; // Construct message threads when everything is already created diff --git a/src/components/hmi_message_handler/src/dbus_message_adapter.cc b/src/components/hmi_message_handler/src/dbus_message_adapter.cc index 00f5ad6be8..5b0b11e557 100644 --- a/src/components/hmi_message_handler/src/dbus_message_adapter.cc +++ b/src/components/hmi_message_handler/src/dbus_message_adapter.cc @@ -179,7 +179,8 @@ void DBusMessageAdapter::SendMessageToCore( // merge // MessagePriority::FromServiceType(message.servicetype) // shall be used instead - message->set_protocol_version(application_manager::ProtocolVersion::kHMI); + message->set_protocol_version( + protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_HMI); message->set_smart_object(obj); handler()->OnMessageReceived(message); LOG4CXX_INFO(logger_, "Successfully sent to observer"); diff --git a/src/components/hmi_message_handler/src/hmi_message_handler_impl.cc b/src/components/hmi_message_handler/src/hmi_message_handler_impl.cc index 1c774b9efe..70865f7771 100644 --- a/src/components/hmi_message_handler/src/hmi_message_handler_impl.cc +++ b/src/components/hmi_message_handler/src/hmi_message_handler_impl.cc @@ -94,6 +94,7 @@ void HMIMessageHandlerImpl::AddHMIMessageAdapter(HMIMessageAdapter* adapter) { LOG4CXX_WARN(logger_, "HMIMessageAdapter is not valid!"); return; } + sync_primitives::AutoLock lock(message_adapters_locker_); message_adapters_.insert(adapter); } @@ -104,6 +105,7 @@ void HMIMessageHandlerImpl::RemoveHMIMessageAdapter( LOG4CXX_WARN(logger_, "HMIMessageAdapter is not valid!"); return; } + sync_primitives::AutoLock lock(message_adapters_locker_); message_adapters_.erase(adapter); } @@ -123,6 +125,7 @@ void HMIMessageHandlerImpl::Handle(const impl::MessageFromHmi message) { LOG4CXX_INFO(logger_, "Message from hmi given away."); } void HMIMessageHandlerImpl::Handle(const impl::MessageToHmi message) { + sync_primitives::AutoLock lock(message_adapters_locker_); for (std::set<HMIMessageAdapter*>::iterator it = message_adapters_.begin(); it != message_adapters_.end(); ++it) { diff --git a/src/components/hmi_message_handler/src/messagebroker_adapter.cc b/src/components/hmi_message_handler/src/messagebroker_adapter.cc index 27cf9df8cd..abefbe3e24 100644 --- a/src/components/hmi_message_handler/src/messagebroker_adapter.cc +++ b/src/components/hmi_message_handler/src/messagebroker_adapter.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Ford Motor Company + * Copyright (c) 2017, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -135,6 +135,8 @@ void MessageBrokerAdapter::SubscribeTo() { MessageBrokerController::subscribeTo("SDL.OnDeviceStateChanged"); MessageBrokerController::subscribeTo("SDL.OnPolicyUpdate"); MessageBrokerController::subscribeTo("BasicCommunication.OnEventChanged"); + MessageBrokerController::subscribeTo("RC.OnInteriorVehicleData"); + MessageBrokerController::subscribeTo("RC.OnRemoteControlSettings"); LOG4CXX_INFO(logger_, "Subscribed to notifications."); } @@ -171,7 +173,8 @@ void MessageBrokerAdapter::ProcessRecievedFromMB(Json::Value& root) { protocol_handler::MessagePriority::kDefault)); // message->set_message_type() message->set_json_message(message_string); - message->set_protocol_version(application_manager::ProtocolVersion::kHMI); + message->set_protocol_version( + protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_HMI); if (!handler()) { LOG4CXX_WARN(logger_, "handler is NULL"); diff --git a/src/components/hmi_message_handler/test/hmi_message_adapter_test.cc b/src/components/hmi_message_handler/test/hmi_message_adapter_test.cc index b0f63c6a0c..eead7106c6 100644 --- a/src/components/hmi_message_handler/test/hmi_message_adapter_test.cc +++ b/src/components/hmi_message_handler/test/hmi_message_adapter_test.cc @@ -42,7 +42,7 @@ namespace test { namespace components { namespace hmi_message_handler_test { -using ::testing::ReturnRef; +using ::testing::Return; using hmi_message_handler::HMIMessageHandlerImpl; typedef utils::SharedPtr<MockHMIMessageAdapterImpl> @@ -53,7 +53,7 @@ TEST(HMIMessageAdapterImplTest, Handler_CorrectPointer_CorrectReturnedPointer) { mock_hmi_message_handler_settings; const uint64_t stack_size = 1000u; ON_CALL(mock_hmi_message_handler_settings, thread_min_stack_size()) - .WillByDefault(ReturnRef(stack_size)); + .WillByDefault(Return(stack_size)); HMIMessageHandler* message_handler = new hmi_message_handler::HMIMessageHandlerImpl( mock_hmi_message_handler_settings); diff --git a/src/components/hmi_message_handler/test/hmi_message_handler_impl_test.cc b/src/components/hmi_message_handler/test/hmi_message_handler_impl_test.cc index 09f20ed75d..33be4a9228 100644 --- a/src/components/hmi_message_handler/test/hmi_message_handler_impl_test.cc +++ b/src/components/hmi_message_handler/test/hmi_message_handler_impl_test.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Ford Motor Company + * Copyright (c) 2017, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,7 +43,7 @@ namespace test { namespace components { namespace hmi_message_handler_test { -using ::testing::ReturnRef; +using ::testing::Return; using ::testing::_; class HMIMessageHandlerImplTest : public ::testing::Test { @@ -63,7 +63,7 @@ class HMIMessageHandlerImplTest : public ::testing::Test { virtual void SetUp() OVERRIDE { ON_CALL(mock_hmi_message_handler_settings, thread_min_stack_size()) - .WillByDefault(ReturnRef(stack_size)); + .WillByDefault(Return(stack_size)); hmi_handler_ = new hmi_message_handler::HMIMessageHandlerImpl( mock_hmi_message_handler_settings); ASSERT_TRUE(NULL != hmi_handler_); diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h index 180be220cc..c1a37a24f1 100644 --- a/src/components/include/application_manager/application_manager.h +++ b/src/components/include/application_manager/application_manager.h @@ -49,6 +49,9 @@ #include "application_manager/state_controller.h" #include "application_manager/hmi_interfaces.h" #include "policy/policy_types.h" +#ifdef SDL_REMOTE_CONTROL +#include "functional_module/plugin_manager.h" +#endif namespace resumption { class LastState; @@ -85,6 +88,7 @@ class Application; class StateControllerImpl; struct CommandParametersPermissions; using policy::RPCParams; +typedef std::vector<ApplicationSharedPtr> AppSharedPtrs; struct ApplicationsAppIdSorter { bool operator()(const ApplicationSharedPtr lhs, const ApplicationSharedPtr rhs) const { @@ -153,10 +157,35 @@ class ApplicationManager { virtual ApplicationSharedPtr application_by_policy_id( const std::string& policy_app_id) const = 0; - virtual std::vector<ApplicationSharedPtr> applications_by_button( - uint32_t button) = 0; - virtual std::vector<ApplicationSharedPtr> applications_with_navi() = 0; + virtual AppSharedPtrs applications_by_button(uint32_t button) = 0; + virtual AppSharedPtrs applications_with_navi() = 0; +#ifdef SDL_REMOTE_CONTROL + /** + * @brief application find application by device and policy identifier + * @param device_id device id + * @param policy_app_id poilcy identifier + * @return pointer to application in case if application exist, in other case + * return empty shared pointer + */ + virtual ApplicationSharedPtr application( + const std::string& device_id, const std::string& policy_app_id) const = 0; + + virtual void ChangeAppsHMILevel(uint32_t app_id, + mobile_apis::HMILevel::eType level) = 0; + + virtual std::vector<std::string> devices( + const std::string& policy_app_id) const = 0; + + virtual void SendPostMessageToMobile(const MessagePtr& message) = 0; + + virtual void SendPostMessageToHMI(const MessagePtr& message) = 0; + + virtual functional_modules::PluginManager& GetPluginManager() = 0; +#endif // SDL_REMOTE_CONTROL + + virtual std::vector<ApplicationSharedPtr> + applications_with_mobile_projection() = 0; /** * @brief Returns media application with LIMITED HMI Level if exists * @@ -182,6 +211,9 @@ class ApplicationManager { */ virtual ApplicationSharedPtr get_limited_voice_application() const = 0; + virtual ApplicationSharedPtr get_limited_mobile_projection_application() + const = 0; + /** * @brief Retrieves application id associated with correlation id * @@ -259,9 +291,16 @@ class ApplicationManager { virtual void SendMessageToHMI(const commands::MessageSharedPtr message) = 0; + virtual void RemoveHMIFakeParameters( + application_manager::MessagePtr& message) = 0; + virtual bool ManageHMICommand(const commands::MessageSharedPtr message) = 0; virtual bool ManageMobileCommand(const commands::MessageSharedPtr message, commands::Command::CommandOrigin origin) = 0; + + virtual MessageValidationResult ValidateMessageBySchema( + const Message& message) = 0; + virtual mobile_api::HMILevel::eType GetDefaultHmiLevel( ApplicationConstSharedPtr application) const = 0; /** @@ -335,8 +374,8 @@ class ApplicationManager { * @param vehicle_info Enum value of type of vehicle data * @param new value (for integer values currently) of vehicle data */ - virtual std::vector<ApplicationSharedPtr> IviInfoUpdated( - VehicleDataType vehicle_info, int value) = 0; + virtual AppSharedPtrs IviInfoUpdated(VehicleDataType vehicle_info, + int value) = 0; virtual ApplicationSharedPtr RegisterApplication(const utils::SharedPtr< smart_objects::SmartObject>& request_for_registration) = 0; @@ -587,9 +626,28 @@ class ApplicationManager { */ virtual void ForbidStreaming(uint32_t app_id) = 0; + /** + * @brief Called when application completes streaming configuration + * @param app_id Streaming application id + * @param service_type Streaming service type + * @param result true if configuration is successful, false otherwise + * @param rejected_params list of rejected parameters' name. Valid + * only when result is false. + */ + virtual void OnStreamingConfigured( + uint32_t app_id, + protocol_handler::ServiceType service_type, + bool result, + std::vector<std::string>& rejected_params) = 0; + virtual const ApplicationManagerSettings& get_settings() const = 0; virtual event_engine::EventDispatcher& event_dispatcher() = 0; + + virtual uint32_t GetAvailableSpaceForApp(const std::string& folder_name) = 0; + virtual void OnTimerSendTTSGlobalProperties() = 0; + virtual void OnLowVoltage() = 0; + virtual void OnWakeUp() = 0; }; } // namespace application_manager diff --git a/src/components/include/application_manager/application_manager_settings.h b/src/components/include/application_manager/application_manager_settings.h index fa01b34783..e745a831c6 100644 --- a/src/components/include/application_manager/application_manager_settings.h +++ b/src/components/include/application_manager/application_manager_settings.h @@ -63,6 +63,7 @@ class ApplicationManagerSettings : public RequestControlerSettings, virtual bool launch_hmi() const = 0; virtual const uint32_t& delete_file_in_none() const = 0; virtual const std::vector<uint32_t>& supported_diag_modes() const = 0; + virtual const std::string& app_info_storage() const = 0; virtual const uint32_t& list_files_in_none() const = 0; virtual const std::string& tts_delimiter() const = 0; virtual const uint32_t& put_file_in_none() const = 0; @@ -93,6 +94,7 @@ class ApplicationManagerSettings : public RequestControlerSettings, virtual const uint32_t& app_icons_folder_max_size() const = 0; virtual const uint32_t& app_icons_amount_to_remove() const = 0; virtual const uint32_t& list_files_response_size() const = 0; + virtual const std::string& plugins_folder() const = 0; }; } // namespace application_manager diff --git a/src/components/include/application_manager/hmi_capabilities.h b/src/components/include/application_manager/hmi_capabilities.h index 556620b644..fb40367b00 100644 --- a/src/components/include/application_manager/hmi_capabilities.h +++ b/src/components/include/application_manager/hmi_capabilities.h @@ -90,6 +90,9 @@ class HMICapabilities { virtual bool is_ivi_cooperating() const = 0; virtual void set_is_ivi_cooperating(const bool value) = 0; + virtual bool is_rc_cooperating() const = 0; + virtual void set_is_rc_cooperating(const bool value) = 0; + /* * @brief Interface used to store information about software version of the *target @@ -409,6 +412,79 @@ class HMICapabilities { */ virtual bool phone_call_supported() const = 0; + /* + * @brief Interface to store whether HMI supports video streaming + * + * @param supported Indicates whether video streaming is supported by HMI + */ + virtual void set_video_streaming_supported(const bool supported) = 0; + + /* + * @brief Retrieves whether HMI supports video streaming + * + * @return TRUE if it supported, otherwise FALSE + */ + virtual bool video_streaming_supported() const = 0; + + /* + * @brief Interface used to store information regarding + * the navigation "System Capability" + * + * @param navigation_capability contains information related + * to the navigation system capability. + */ + virtual void set_navigation_capability( + const smart_objects::SmartObject& navigation_capability) = 0; + + /* + * @brief Retrieves information regarding the navigation system capability + * + * @return NAVIGATION system capability + */ + virtual const smart_objects::SmartObject* navigation_capability() const = 0; + + /* + * @brief Interface used to store information regarding + * the phone "System Capability" + * + * @param phone_capability contains information related + * to the phone system capability. + */ + virtual void set_phone_capability( + const smart_objects::SmartObject& phone_capability) = 0; + + /* + * @brief Retrieves information regarding the phone call system capability + * + * @return PHONE_CALL system capability + */ + virtual const smart_objects::SmartObject* phone_capability() const = 0; + + /* + * @brief Sets HMI's video streaming related capability information + * + * @param video_streaming_capability the video streaming related capabilities + */ + virtual void set_video_streaming_capability( + const smart_objects::SmartObject& video_streaming_capability) = 0; + + /* + * @brief Retrieves HMI's video streaming related capabilities + * + * @return HMI's video streaming related capability information + */ + virtual const smart_objects::SmartObject* video_streaming_capability() + const = 0; + + /** + * @brief Sets available RC capabilities for further usage by RC functionality + * @param rc_capability capabilities to set + */ + virtual void set_rc_capability( + const smart_objects::SmartObject& rc_capability) = 0; + + virtual const smart_objects::SmartObject* rc_capability() const = 0; + virtual void Init(resumption::LastState* last_state) = 0; /** diff --git a/src/components/include/application_manager/policies/policy_handler_interface.h b/src/components/include/application_manager/policies/policy_handler_interface.h index a1c45c0bd6..d7e9f1cea7 100644 --- a/src/components/include/application_manager/policies/policy_handler_interface.h +++ b/src/components/include/application_manager/policies/policy_handler_interface.h @@ -40,6 +40,7 @@ #include <queue> #include "interfaces/MOBILE_API.h" #include "application_manager/policies/policy_handler_observer.h" +#include "application_manager/core_service.h" #include "application_manager/application.h" #include "policy/usage_statistics/statistics_manager.h" #include "utils/custom_string.h" @@ -105,7 +106,17 @@ class PolicyHandlerInterface { EndpointUrls& out_end_points) = 0; virtual std::string GetLockScreenIconUrl() const = 0; virtual uint32_t NextRetryTimeout() = 0; + + /** + * Gets timeout to wait until receive response + * @return timeout in seconds + */ virtual uint32_t TimeoutExchangeSec() const = 0; + + /** + * Gets timeout to wait until receive response + * @return timeout in miliseconds + */ virtual uint32_t TimeoutExchangeMSec() const = 0; virtual void OnExceededTimeout() = 0; virtual void OnSystemReady() = 0; @@ -416,6 +427,73 @@ class PolicyHandlerInterface { virtual const PolicySettings& get_settings() const = 0; virtual const std::string RemoteAppsUrl() const = 0; +#ifdef SDL_REMOTE_CONTROL + /** + * @brief Sets HMI default type for specified application + * @param application_id ID application + * @param app_types list of HMI types + */ + virtual void SetDefaultHmiTypes( + const std::string& application_id, + const smart_objects::SmartObject* app_types) = 0; + + /** + * Checks if application has HMI type + * @param application_id ID application + * @param hmi HMI type to check + * @param app_types additional list of HMI type to search in it + * @return true if hmi is contained in policy or app_types + */ + virtual bool CheckHMIType(const std::string& application_id, + mobile_apis::AppHMIType::eType hmi, + const smart_objects::SmartObject* app_types) = 0; + + /** + * Notifies about changing HMI level + * @param device_id unique identifier of device + * @param policy_app_id unique identifier of application in policy + * @param hmi_level default HMI level for this application + */ + virtual void OnUpdateHMILevel(const std::string& device_id, + const std::string& policy_app_id, + const std::string& hmi_level) = 0; + + /** + * Checks if module for application is present in policy table + * @param app_id id of application + * @param module type + * @return true if module is present, otherwise - false + */ + virtual bool CheckModule(const PTString& app_id, const PTString& module) = 0; + + /** + * @brief Notifies Remote apps about change in permissions + * @param device_id Device on which app is running + * @param application_id ID of app whose permissions are changed + */ + virtual void OnRemoteAppPermissionsChanged( + const std::string& device_id, const std::string& application_id) = 0; + + /** + * @brief Notifies Remote apps about change in HMI status + * @param device_id Device on which app is running + * @param policy_app_id ID of application + * @param hmi_level new HMI level for this application + */ + virtual void OnUpdateHMIStatus(const std::string& device_id, + const std::string& policy_app_id, + const std::string& hmi_level) = 0; + + /** + * Gets all allowed module types + * @param app_id unique identifier of application + * @param list of allowed module types + * @return true if application has allowed modules + */ + virtual bool GetModuleTypes(const std::string& policy_app_id, + std::vector<std::string>* modules) const = 0; +#endif // SDL_REMOTE_CONTROL + private: /** * @brief Processes data received via OnAppPermissionChanged notification diff --git a/src/components/include/connection_handler/connection_handler.h b/src/components/include/connection_handler/connection_handler.h index e8e1af715a..c70861b5f6 100644 --- a/src/components/include/connection_handler/connection_handler.h +++ b/src/components/include/connection_handler/connection_handler.h @@ -198,6 +198,22 @@ class ConnectionHandler { virtual DevicesDiscoveryStarter& get_device_discovery_starter() = 0; + /** + * \brief Invoked when observer's OnServiceStartedCallback is completed + * \param session_key the key of started session passed to + * OnServiceStartedCallback(). + * \param result true if observer accepts starting service, false otherwise + * \param rejected_params list of rejected parameters' name. Only valid when + * result is false. Note that even if result is false, this may be empty. + * + * \note This is invoked only once but can be invoked by multiple threads. + * Also it can be invoked before OnServiceStartedCallback() returns. + **/ + virtual void NotifyServiceStartedResult( + uint32_t session_key, + bool result, + std::vector<std::string>& rejected_params) = 0; + protected: /** * \brief Destructor diff --git a/src/components/include/connection_handler/connection_handler_observer.h b/src/components/include/connection_handler/connection_handler_observer.h index e25b0aaea5..6bfc78af24 100644 --- a/src/components/include/connection_handler/connection_handler_observer.h +++ b/src/components/include/connection_handler/connection_handler_observer.h @@ -42,6 +42,8 @@ #include "security_manager/ssl_context.h" #endif // ENABLE_SECURITY +struct BsonObject; + /** * \namespace connection_handler * \brief SmartDeviceLink connection_handler namespace. @@ -95,6 +97,22 @@ class ConnectionHandlerObserver { /** * \brief Callback function used by connection_handler + * when Mobile Application initiates start of new service. + * Result must be notified through NotifyServiceStartedResult(). + * \param deviceHandle Device identifier within which session has to be + * started. + * \param sessionKey Key of started session. + * \param type Established service type + * \param params Configuration parameters for this service + */ + virtual void OnServiceStartedCallback( + const connection_handler::DeviceHandle& device_handle, + const int32_t& session_key, + const protocol_handler::ServiceType& type, + const BsonObject* params) = 0; + + /** + * \brief Callback function used by connection_handler * when Mobile Application initiates service ending. * \param session_key Key of session which should be ended * \param type Type of service which should be ended diff --git a/src/components/include/hmi_message_handler/hmi_message_adapter.h b/src/components/include/hmi_message_handler/hmi_message_adapter.h index 10e4231528..704cc619be 100644 --- a/src/components/include/hmi_message_handler/hmi_message_adapter.h +++ b/src/components/include/hmi_message_handler/hmi_message_adapter.h @@ -43,6 +43,12 @@ namespace hmi_message_handler { * SDL with HMI has to implement this interface. */ class HMIMessageAdapter : public HMIMessageSender { + public: + /** + * \brief Destructor + */ + virtual ~HMIMessageAdapter() {} + protected: /** * \brief Interface for subscriptions. diff --git a/src/components/include/hmi_message_handler/hmi_message_handler_settings.h b/src/components/include/hmi_message_handler/hmi_message_handler_settings.h index 5386869555..8b24f2cf7d 100644 --- a/src/components/include/hmi_message_handler/hmi_message_handler_settings.h +++ b/src/components/include/hmi_message_handler/hmi_message_handler_settings.h @@ -44,7 +44,7 @@ class HMIMessageHandlerSettings { public: virtual ~HMIMessageHandlerSettings() {} - virtual const uint64_t& thread_min_stack_size() const = 0; + virtual const uint64_t thread_min_stack_size() const = 0; }; } // namespace hmi_message_handler #endif // SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_HANDLER_SETTINGS_H_ diff --git a/src/components/include/hmi_message_handler/hmi_message_observer.h b/src/components/include/hmi_message_handler/hmi_message_observer.h index aef1e33379..0676615b53 100644 --- a/src/components/include/hmi_message_handler/hmi_message_observer.h +++ b/src/components/include/hmi_message_handler/hmi_message_observer.h @@ -43,6 +43,7 @@ namespace hmi_message_handler { class HMIMessageObserver { public: + virtual ~HMIMessageObserver() {} virtual void OnMessageReceived( utils::SharedPtr<application_manager::Message> message) = 0; virtual void OnErrorSending( diff --git a/src/components/include/hmi_message_handler/hmi_message_sender.h b/src/components/include/hmi_message_handler/hmi_message_sender.h index 95ed2c63c4..91c20a1986 100644 --- a/src/components/include/hmi_message_handler/hmi_message_sender.h +++ b/src/components/include/hmi_message_handler/hmi_message_sender.h @@ -40,6 +40,7 @@ typedef utils::SharedPtr<application_manager::Message> MessageSharedPointer; class HMIMessageSender { public: + virtual ~HMIMessageSender() {} virtual void SendMessageToHMI(MessageSharedPointer message) = 0; }; } diff --git a/src/components/include/policy/policy_external/policy/policy_listener.h b/src/components/include/policy/policy_external/policy/policy_listener.h index f3388beb95..e850a3fa2b 100644 --- a/src/components/include/policy/policy_external/policy/policy_listener.h +++ b/src/components/include/policy/policy_external/policy/policy_listener.h @@ -30,8 +30,8 @@ POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_POLICY_LISTENER_H_ -#define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_POLICY_LISTENER_H_ +#ifndef SRC_COMPONENTS_INCLUDE_POLICY_POLICY_EXTERNAL_POLICY_POLICY_LISTENER_H_ +#define SRC_COMPONENTS_INCLUDE_POLICY_POLICY_EXTERNAL_POLICY_POLICY_LISTENER_H_ #include <queue> @@ -52,12 +52,13 @@ class PolicyListener { const Permissions& permissions) = 0; virtual void OnPendingPermissionChange(const std::string& policy_app_id) = 0; virtual void OnUpdateStatusChanged(const std::string&) = 0; + /** - * Gets device ID - * @param policy_app_id - * @return device ID - * @deprecated see std::vector<std::string> GetDevicesIds(const std::string&) - */ + * Gets device ID + * @param policy_app_id + * @return device ID + * @deprecated see std::vector<std::string> GetDevicesIds(const std::string&) + */ virtual std::string OnCurrentDeviceIdUpdateRequired( const std::string& policy_app_id) = 0; virtual void OnSystemInfoUpdateRequired() = 0; @@ -67,12 +68,12 @@ class PolicyListener { std::map<std::string, StringArray> app_hmi_types) = 0; /** - * @brief CanUpdate allows to find active application - * and check whether related device consented. - * - * @return true if there are at least one application has been registered - * with consented device. - */ + * @brief CanUpdate allows to find active application + * and check whether related device consented. + * + * @return true if there are at least one application has been registered + * with consented device. + */ virtual bool CanUpdate() = 0; /** @@ -129,12 +130,51 @@ class PolicyListener { virtual void OnPTUFinished(const bool ptu_result) = 0; /** - * @brief Collects currently registered applications ids linked to their - * device id - * @return Collection of device_id-to-app_id links - */ + * @brief Collects currently registered applications ids linked to their + * device id + * @return Collection of device_id-to-app_id links + */ virtual void GetRegisteredLinks( std::map<std::string, std::string>& out_links) const = 0; + +#ifdef SDL_REMOTE_CONTROL + /** + * Gets devices ids by policy application id + * @param policy_app_id + * @return list devices ids + */ + virtual std::vector<std::string> GetDevicesIds( + const std::string& policy_app_id) = 0; + + /** + * Notifies about changing HMI level + * @param device_id unique identifier of device + * @param policy_app_id unique identifier of application in policy + * @param hmi_level default HMI level for this application + */ + virtual void OnUpdateHMILevel(const std::string& device_id, + const std::string& policy_app_id, + const std::string& hmi_level) = 0; + + /** + * @brief Notifies Remote apps about change in permissions + * @param device_id Device on which app is running + * @param application_id ID of app whose permissions are changed + */ + virtual void OnRemoteAppPermissionsChanged( + const std::string& device_id, const std::string& application_id) = 0; + + /** + * Notifies about changing HMI status + * @param device_id unique identifier of device + * @param policy_app_id unique identifier of application in policy + * @param hmi_level default HMI level for this application + */ + virtual void OnUpdateHMIStatus(const std::string& device_id, + const std::string& policy_app_id, + const std::string& hmi_level) = 0; + +#endif // SDL_REMOTE_CONTROL }; -} // namespace policy -#endif // SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_POLICY_LISTENER_H_ +} // namespace policy +#endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_EXTERNAL_POLICY_POLICY_LISTENER_H_ diff --git a/src/components/include/policy/policy_external/policy/policy_manager.h b/src/components/include/policy/policy_external/policy/policy_manager.h index 9201956e2a..adf195e3a9 100644 --- a/src/components/include/policy/policy_external/policy/policy_manager.h +++ b/src/components/include/policy/policy_external/policy/policy_manager.h @@ -30,8 +30,8 @@ POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SRC_COMPONENTS_INCLUDE_POLICY_POLICY_MANAGER_H_ -#define SRC_COMPONENTS_INCLUDE_POLICY_POLICY_MANAGER_H_ +#ifndef SRC_COMPONENTS_INCLUDE_POLICY_POLICY_EXTERNAL_POLICY_POLICY_MANAGER_H_ +#define SRC_COMPONENTS_INCLUDE_POLICY_POLICY_EXTERNAL_POLICY_POLICY_MANAGER_H_ #include <vector> @@ -40,7 +40,11 @@ #include "policy/policy_types.h" #include "policy/policy_table/types.h" #include "policy/policy_listener.h" -#include "usage_statistics/statistics_manager.h" +#include "policy/usage_statistics/statistics_manager.h" + +#ifdef SDL_REMOTE_CONTROL +#include "policy/access_remote.h" +#endif // SDL_REMOTE_CONTROL namespace policy { class PolicySettings; @@ -55,12 +59,17 @@ class PolicyManager : public usage_statistics::StatisticsManager { enum NotificationMode { kSilentMode, kNotifyApplicationMode }; virtual ~PolicyManager() {} + /** + * @brief set_listener set new policy listener instance + * @param listener new policy listener + */ virtual void set_listener(PolicyListener* listener) = 0; /** - * Inits Policy Table - * @param file_name Path to preloaded PT file - * @return true if successfully + * @brief Inits Policy Table + * @param file_name path to preloaded PT file + * @param settings pointer to policy init settings + * @return true if init is successful */ virtual bool InitPT(const std::string& file_name, const PolicySettings* settings) = 0; @@ -71,26 +80,30 @@ class PolicyManager : public usage_statistics::StatisticsManager { * sent in snapshot and received Policy Table. * @param file name of file with update policy table * @param pt_content PTU as binary string - * @return bool Success of operation + * @return true if successfully */ virtual bool LoadPT(const std::string& file, const BinaryMessage& pt_content) = 0; /** - * Resets Policy Table + * @brief Resets Policy Table * @param file_name Path to preloaded PT file * @return true if successfully */ virtual bool ResetPT(const std::string& file_name) = 0; + /** + * @brief Gets last URL for sending PTS to from PT itself + * @param service_type Service specifies user of URL + * @return last URL or empty string if endpoint entry is empty + */ virtual std::string GetUpdateUrl(int service_type) = 0; /** - * @brief Gets all URLs for sending PTS to from PT itself. - * @param service_type Service specifies user of URL - * @return vector of urls - */ - + * @brief Gets all URLs for sending PTS to from PT itself. + * @param service_type Service specifies user of URL + * @return vector of urls + */ virtual void GetUpdateUrls(const uint32_t service_type, EndpointUrls& out_end_points) = 0; virtual void GetUpdateUrls(const std::string& service_type, @@ -98,7 +111,6 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief GetLockScreenIcon allows to obtain lock screen icon url; - * * @return url which point to the resourse where lock screen icon could be *obtained. */ @@ -116,6 +128,7 @@ class PolicyManager : public usage_statistics::StatisticsManager { * @param app_id Id of application provided during registration * @param hmi_level Current HMI Level of application * @param rpc Name of RPC + * @param rpc_params List of RPC params * @param CheckPermissionResult containing flag if HMI Level is allowed * and list of allowed params. */ @@ -138,41 +151,43 @@ class PolicyManager : public usage_statistics::StatisticsManager { virtual std::string GetPolicyTableStatus() const = 0; /** - * Checks is PT exceeded kilometers + * @brief Checks is PT exceeded kilometers * @param kilometers current kilometers at odometer * @return true if exceeded */ virtual void KmsChanged(int kilometers) = 0; /** - * Increments counter of ignition cycles + * @brief Increments counter of ignition cycles */ virtual void IncrementIgnitionCycles() = 0; /** * @brief Exchange by hmi or mobile request + * @return Current status of policy table */ virtual std::string ForcePTExchange() = 0; /** - * @brief ExchangeByUserRequest + * @brief Exchange by user request + * @return Current status of policy table */ virtual std::string ForcePTExchangeAtUserRequest() = 0; /** - * Resets retry sequence + * @brief Resets retry sequence */ virtual void ResetRetrySequence() = 0; /** - * Gets timeout to wait before next retry updating PT + * @brief Gets timeout to wait before next retry updating PT * If timeout is less or equal to zero then the retry sequence is not need. * @return timeout in seconds */ virtual int NextRetryTimeout() = 0; /** - * Gets timeout to wait until receive response + * @brief Gets timeout to wait until receive response * @return timeout in seconds */ virtual uint32_t TimeoutExchangeMSec() = 0; @@ -185,7 +200,7 @@ class PolicyManager : public usage_statistics::StatisticsManager { virtual const std::vector<int> RetrySequenceDelaysSeconds() = 0; /** - * Handler of exceeding timeout of exchanging policy table + * @brief Handler of exceeding timeout of exchanging policy table */ virtual void OnExceededTimeout() = 0; @@ -224,21 +239,24 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief Update Application Policies as reaction * on User allowing/disallowing device this app is running on. + * @param app_id Unique application id + * @param is_device_allowed true if user allowing device otherwise false + * @return true if operation was successful */ virtual bool ReactOnUserDevConsentForApp(const std::string& app_id, const bool is_device_allowed) = 0; /** - * Sets counter value that passed for receiving PT UPdate. + * @brief Sets counter value that passed for receiving PT UPdate. */ virtual void PTUpdatedAt(Counters counter, int value) = 0; /** * @brief Retrieves data from app_policies about app on its registration: - * @param app_id - id of registered app - * @param app_types Section on HMI where app can appear (Navigation, Phone - * etc) + * @param application_id - id of registered app * @param nicknames Synonyms for application + * @param app_hmi_types Section on HMI where app can appear (Navigation, Phone + * etc) */ virtual bool GetInitialAppData(const std::string& application_id, StringArray* nicknames = NULL, @@ -267,6 +285,7 @@ class PolicyManager : public usage_statistics::StatisticsManager { * The permissions is not const reference because it may contains * valid data as well as invalid. So we will remove all invalid data * from this structure. + * @param mode notification mode */ virtual void SetUserConsentForApp(const PermissionConsent& permissions, const NotificationMode mode) = 0; @@ -294,6 +313,7 @@ class PolicyManager : public usage_statistics::StatisticsManager { * @brief Get user friendly messages for given RPC messages and language * @param message_codes RPC message codes * @param language Language + * @param active_hmi_language Currently active language * @return Array of structs with appropriate message parameters */ virtual std::vector<UserFriendlyMessage> GetUserFriendlyMessages( @@ -302,7 +322,7 @@ class PolicyManager : public usage_statistics::StatisticsManager { const std::string& active_hmi_language) = 0; /** - * Checks if the application is revoked + * @brief Checks if the application is revoked * @param app_id application id * @return true if application is revoked */ @@ -329,11 +349,15 @@ class PolicyManager : public usage_statistics::StatisticsManager { virtual AppPermissions GetAppPermissionsChanges( const std::string& policy_app_id) = 0; + /** + * @brief Removes specific application permissions changes + * @param app_id Unique application id + */ virtual void RemovePendingPermissionChanges(const std::string& app_id) = 0; /** * @brief Return device id, which hosts specific application - * @param Application id, which is required to update device id + * @param policy_app_id Application id, which is required to update device id */ virtual std::string& GetCurrentDeviceId( const std::string& policy_app_id) const = 0; @@ -356,13 +380,13 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief Send OnPermissionsUpdated for choosen application - * @param application_id + * @param application_id Unique application id */ virtual void SendNotificationOnPermissionsUpdated( const std::string& application_id) = 0; /** - * Marks device as upaired + * @brief Marks device as upaired * @param device_id id device */ virtual void MarkUnpairedDevice(const std::string& device_id) = 0; @@ -370,7 +394,8 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief Adds, application to the db or update existed one * run PTU if policy update is necessary for application. - * @param Application id assigned by Ford to the application + * @param application_id Unique application id + * @param hmi_types application HMI types * @return function that will notify update manager about new application */ virtual StatusNotifier AddApplication( @@ -379,18 +404,21 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief Removes unpaired device records and related records from DB - * @param device_ids List of device_id, which should be removed * @return true, if succedeed, otherwise - false */ virtual bool CleanupUnpairedDevices() = 0; /** * @brief Check if app can keep context. + * @param app_id Unique application id + * @return true if app can keep context, otherwise - false */ virtual bool CanAppKeepContext(const std::string& app_id) const = 0; /** * @brief Check if app can steal focus. + * @param app_id Unique application id + * @return true if app can steal focus, otherwise - false */ virtual bool CanAppStealFocus(const std::string& app_id) const = 0; @@ -402,9 +430,9 @@ class PolicyManager : public usage_statistics::StatisticsManager { virtual void OnSystemReady() = 0; /** - * @brief GetNotificationNumber - * @param priority - * @return + * @brief Get number of notification by priority + * @param priority Specified priority + * @return notification number */ virtual uint32_t GetNotificationsNumber( const std::string& priority) const = 0; @@ -423,7 +451,7 @@ class PolicyManager : public usage_statistics::StatisticsManager { virtual bool IsPredataPolicy(const std::string& policy_app_id) const = 0; /** - * Returns heart beat timeout + * @brief Returns heart beat timeout * @param app_id application id * @return if timeout was set then value in milliseconds greater zero * otherwise heart beat for specific application isn't set @@ -431,7 +459,8 @@ class PolicyManager : public usage_statistics::StatisticsManager { virtual uint32_t HeartBeatTimeout(const std::string& app_id) const = 0; /** - * @brief SaveUpdateStatusRequired alows to save update status. + * @brief SaveUpdateStatusRequired allows to save update status. + * @param is_update_needed true if update needed */ virtual void SaveUpdateStatusRequired(bool is_update_needed) = 0; @@ -442,14 +471,14 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief Handler on applications search completed + * @param trigger_ptu contains true if PTU should be triggered */ virtual void OnAppsSearchCompleted(const bool trigger_ptu) = 0; /** * @brief OnAppRegisteredOnMobile allows to handle event when application were * succesfully registered on mobile device. - * It will send OnAppPermissionSend notification and will try to start PTU. - * + * It will send OnAppPermissionSend notification and will try to start PTU. * * @param application_id registered application. */ virtual void OnAppRegisteredOnMobile(const std::string& application_id) = 0; @@ -457,13 +486,14 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief Gets request types for application * @param policy_app_id Unique application id - * @return request_types Request types of application + * @return request types of application */ virtual const std::vector<std::string> GetAppRequestTypes( const std::string policy_app_id) const = 0; /** * @brief Get information about vehicle + * @return vehicle information */ virtual const VehicleInfo GetVehicleInfo() const = 0; @@ -476,7 +506,6 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief RetrieveCertificate Allows to obtain certificate in order * to start secure connection. - * * @return The certificate in PKCS#7 format. */ virtual std::string RetrieveCertificate() const = 0; @@ -484,7 +513,6 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief HasCertificate check whether policy table has certificate * int module_config section. - * * @return true in case certificate exists, false otherwise */ virtual bool HasCertificate() const = 0; @@ -495,6 +523,10 @@ class PolicyManager : public usage_statistics::StatisticsManager { */ virtual void SetDecryptedCertificate(const std::string& certificate) = 0; + /** + * @brief Getter for policy settings + * @return policy settings instance + */ virtual const PolicySettings& get_settings() const = 0; /** @@ -505,6 +537,57 @@ class PolicyManager : public usage_statistics::StatisticsManager { */ virtual AppIdURL GetNextUpdateUrl(const EndpointUrls& urls) = 0; +#ifdef SDL_REMOTE_CONTROL + /** + * @brief Assigns new HMI types for specified application + * @param application_id Unique application id + * @param hmi_types new HMI types list + */ + virtual void SetDefaultHmiTypes(const std::string& application_id, + const std::vector<int>& hmi_types) = 0; + /** + * @brief Gets HMI types + * @param application_id ID application + * @param app_types list to save HMI types + * @return true if policy has specific policy for this application + */ + virtual bool GetHMITypes(const std::string& application_id, + std::vector<int>* app_types) = 0; + + /** + * @brief Checks if module for application is present in policy table + * @param app_id id of application + * @param module type + * @return true if module is present, otherwise - false + */ + virtual bool CheckModule(const PTString& app_id, const PTString& module) = 0; + + /** + * @brief Send OnPermissionsChange notification to mobile app + * when it's permissions are changed. + * @param device_id Device on which app is running + * @param application_id ID of app whose permissions are changed + */ + virtual void SendAppPermissionsChanged(const std::string& device_id, + const std::string& application_id) = 0; + + /** + * @brief Gets all allowed module types + * @param policy_app_id unique identifier of application + * @param modules list of allowed module types + * @return true if application has allowed modules + */ + virtual bool GetModuleTypes(const std::string& policy_app_id, + std::vector<std::string>* modules) const = 0; + + /** + * @brief Setter for access_remote instance + * @param access_remote pointer to new access_remote instance + */ + virtual void set_access_remote( + utils::SharedPtr<AccessRemote> access_remote) = 0; +#endif // SDL_REMOTE_CONTROL + /** * @brief Checks if there is existing URL in the EndpointUrls vector with * index saved in the policy manager and if not, it moves to the next @@ -518,11 +601,11 @@ class PolicyManager : public usage_statistics::StatisticsManager { const EndpointUrls& urls) const = 0; /** - * @brief Checks, if SDL needs to update it's policy table "external consent - * status" section - * @param status ExternalConsent status - * @return true if there's such a need, otherwise - false - */ + * @brief Checks, if SDL needs to update it's policy table section + "external_consent_status" + * @param ExternalConsent status + * @return true if such check is needed, false - if not. + */ virtual bool IsNeedToUpdateExternalConsentStatus( const ExternalConsentStatus& status) const = 0; @@ -536,19 +619,19 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief Gets customer connectivity settings status - * @return external consent status + * @return ExternalConsent status */ virtual ExternalConsentStatus GetExternalConsentStatus() = 0; protected: /** - * Checks is PT exceeded IgnitionCycles + * @brief Checks is PT exceeded IgnitionCycles * @return true if exceeded */ virtual bool ExceededIgnitionCycles() = 0; /** - * Checks is PT exceeded days + * @brief Checks is PT exceeded days * @return true if exceeded */ virtual bool ExceededDays() = 0; @@ -566,4 +649,4 @@ class PolicyManager : public usage_statistics::StatisticsManager { extern "C" policy::PolicyManager* CreateManager(); extern "C" void DeleteManager(policy::PolicyManager*); -#endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_MANAGER_H_ +#endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_EXTERNAL_POLICY_POLICY_MANAGER_H_ diff --git a/src/components/include/policy/policy_external/policy/usage_statistics/app_stopwatch.h b/src/components/include/policy/policy_external/policy/usage_statistics/app_stopwatch.h index 45883163c4..3f01a30a62 100644 --- a/src/components/include/policy/policy_external/policy/usage_statistics/app_stopwatch.h +++ b/src/components/include/policy/policy_external/policy/usage_statistics/app_stopwatch.h @@ -30,10 +30,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SRC_COMPONENTS_INCLUDE_POLICY_USAGE_STATISTICS_APP_STOPWATCH_H_ -#define SRC_COMPONENTS_INCLUDE_POLICY_USAGE_STATISTICS_APP_STOPWATCH_H_ +#ifndef SRC_COMPONENTS_INCLUDE_POLICY_POLICY_EXTERNAL_POLICY_USAGE_STATISTICS_APP_STOPWATCH_H_ +#define SRC_COMPONENTS_INCLUDE_POLICY_POLICY_EXTERNAL_POLICY_USAGE_STATISTICS_APP_STOPWATCH_H_ -#include "statistics_manager.h" +#include "policy/usage_statistics/statistics_manager.h" namespace usage_statistics { @@ -47,4 +47,4 @@ class AppStopwatch { } // namespace usage_statistics -#endif // SRC_COMPONENTS_INCLUDE_POLICY_USAGE_STATISTICS_APP_STOPWATCH_H_ +#endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_EXTERNAL_POLICY_USAGE_STATISTICS_APP_STOPWATCH_H_ diff --git a/src/components/include/policy/policy_external/policy/usage_statistics/statistics_manager.h b/src/components/include/policy/policy_external/policy/usage_statistics/statistics_manager.h index 8cf3beaa55..7186400ff4 100644 --- a/src/components/include/policy/policy_external/policy/usage_statistics/statistics_manager.h +++ b/src/components/include/policy/policy_external/policy/usage_statistics/statistics_manager.h @@ -30,8 +30,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SRC_COMPONENTS_INCLUDE_POLICY_USAGE_STATISTICS_STATISTICS_MANAGER_H_ -#define SRC_COMPONENTS_INCLUDE_POLICY_USAGE_STATISTICS_STATISTICS_MANAGER_H_ +#ifndef SRC_COMPONENTS_INCLUDE_POLICY_POLICY_EXTERNAL_POLICY_USAGE_STATISTICS_STATISTICS_MANAGER_H_ +#define SRC_COMPONENTS_INCLUDE_POLICY_POLICY_EXTERNAL_POLICY_USAGE_STATISTICS_STATISTICS_MANAGER_H_ #include <stdint.h> #include <string> @@ -71,11 +71,36 @@ enum AppCounterId { class StatisticsManager { public: virtual ~StatisticsManager() {} + + /** + * @brief Increments global counter + * @param type counter type + */ virtual void Increment(GlobalCounterId type) = 0; + + /** + * @brief Increments specified application counter + * @param app_id Unique ID of application + * @param type application counter type + */ virtual void Increment(const std::string& app_id, AppCounterId type) = 0; + + /** + * @brief Sets specified application info value + * @param app_id Unique ID of application + * @param type application info type + * @param value new value for counter + */ virtual void Set(const std::string& app_id, AppInfoId type, const std::string& value) = 0; + + /** + * @brief Add seconds for specified application stopwatch + * @param app_id Unique ID of application + * @param type application stopwatch type + * @param timespan_seconds seconds to add + */ virtual void Add(const std::string& app_id, AppStopwatchId type, int32_t timespan_seconds) = 0; @@ -83,4 +108,4 @@ class StatisticsManager { } // namespace usage_statistics -#endif // SRC_COMPONENTS_INCLUDE_POLICY_USAGE_STATISTICS_STATISTICS_MANAGER_H_ +#endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_EXTERNAL_POLICY_USAGE_STATISTICS_STATISTICS_MANAGER_H_ diff --git a/src/components/policy/policy_regular/include/policy/policy_listener.h b/src/components/include/policy/policy_regular/policy/policy_listener.h index 0170f421e4..e8de37d5de 100644 --- a/src/components/policy/policy_regular/include/policy/policy_listener.h +++ b/src/components/include/policy/policy_regular/policy/policy_listener.h @@ -30,8 +30,8 @@ POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_LISTENER_H_ -#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_LISTENER_H_ +#ifndef SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_POLICY_LISTENER_H_ +#define SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_POLICY_LISTENER_H_ #include <queue> @@ -111,6 +111,45 @@ class PolicyListener { * @param certificate_data the value of the updated field. */ virtual void OnCertificateUpdated(const std::string& certificate_data) = 0; + +#ifdef SDL_REMOTE_CONTROL + /** + * Gets devices ids by policy application id + * @param policy_app_id + * @return list devices ids + */ + virtual std::vector<std::string> GetDevicesIds( + const std::string& policy_app_id) = 0; + + /** + * Notifies about changing HMI level + * @param device_id unique identifier of device + * @param policy_app_id unique identifier of application in policy + * @param hmi_level default HMI level for this application + */ + virtual void OnUpdateHMILevel(const std::string& device_id, + const std::string& policy_app_id, + const std::string& hmi_level) = 0; + + /** + * @brief Notifies Remote apps about change in permissions + * @param device_id Device on which app is running + * @param application_id ID of app whose permissions are changed + */ + virtual void OnRemoteAppPermissionsChanged( + const std::string& device_id, const std::string& application_id) = 0; + + /** + * Notifies about changing HMI status + * @param device_id unique identifier of device + * @param policy_app_id unique identifier of application in policy + * @param hmi_level default HMI level for this application + */ + virtual void OnUpdateHMIStatus(const std::string& device_id, + const std::string& policy_app_id, + const std::string& hmi_level) = 0; + +#endif // SDL_REMOTE_CONTROL }; } // namespace policy -#endif // SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_LISTENER_H_ +#endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_POLICY_LISTENER_H_ diff --git a/src/components/include/policy/policy_regular/policy/policy_manager.h b/src/components/include/policy/policy_regular/policy/policy_manager.h index c8074b3528..510e35e699 100644 --- a/src/components/include/policy/policy_regular/policy/policy_manager.h +++ b/src/components/include/policy/policy_regular/policy/policy_manager.h @@ -30,8 +30,8 @@ POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_MANAGER_H_ -#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_MANAGER_H_ +#ifndef SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_POLICY_MANAGER_H_ +#define SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_POLICY_MANAGER_H_ #include <vector> #include <cstdint> @@ -41,6 +41,9 @@ #include "policy/policy_table/types.h" #include "policy/policy_listener.h" #include "policy/usage_statistics/statistics_manager.h" +#ifdef SDL_REMOTE_CONTROL +#include "policy/access_remote.h" +#endif // SDL_REMOTE_CONTROL namespace policy { class PolicySettings; @@ -50,12 +53,17 @@ class PolicyManager : public usage_statistics::StatisticsManager { public: virtual ~PolicyManager() {} + /** + * @brief set_listener set new policy listener instance + * @param listener new policy listener + */ virtual void set_listener(PolicyListener* listener) = 0; /** - * Inits Policy Table - * @param file_name Path to preloaded PT file - * @return true if successfully + * @brief Inits Policy Table + * @param file_name path to preloaded PT file + * @param settings pointer to policy init settings + * @return true if init is successful */ virtual bool InitPT(const std::string& file_name, const PolicySettings* settings) = 0; @@ -66,13 +74,13 @@ class PolicyManager : public usage_statistics::StatisticsManager { * sent in snapshot and received Policy Table. * @param file name of file with update policy table * @param pt_content PTU as binary string - * @return bool Success of operation + * @return true if successfully */ virtual bool LoadPT(const std::string& file, const BinaryMessage& pt_content) = 0; /** - * Resets Policy Table + * @brief Resets Policy Table * @param file_name Path to preloaded PT file * @return true if successfully */ @@ -80,7 +88,6 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief GetLockScreenIcon allows to obtain lock screen icon url; - * * @return url which point to the resourse where lock screen icon could be *obtained. */ @@ -89,7 +96,7 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief Gets all URLs for sending PTS to from PT itself. * @param service_type Service specifies user of URL - * @return vector of urls + * @param out_end_points output vector of urls */ virtual void GetUpdateUrls(const std::string& service_type, EndpointUrls& out_end_points) = 0; @@ -105,11 +112,13 @@ class PolicyManager : public usage_statistics::StatisticsManager { * @brief Check if specified RPC for specified application * has permission to be executed in specified HMI Level * and also its permitted params. + * @param device_id Id of device of application * @param app_id Id of application provided during registration * @param hmi_level Current HMI Level of application * @param rpc Name of RPC - * @param CheckPermissionResult containing flag if HMI Level is allowed - * and list of allowed params. + * @param rpc_params List of RPC params + * @param result containing flag if HMI Level is allowed and list of + * allowed params. */ virtual void CheckPermissions(const PTString& device_id, const PTString& app_id, @@ -118,6 +127,12 @@ class PolicyManager : public usage_statistics::StatisticsManager { const RPCParams& rpc_params, CheckPermissionResult& result) = 0; + /** + * @brief Changes isConsentNeeded for app pending permissions, in case + * user set permissions before app activation. + * @param Unique app id + * @param Current permissions for app + */ virtual void CheckPendingPermissionsChanges( const std::string& policy_app_id, const std::vector<FunctionalGroupPermission>& current_permissions) = 0; @@ -135,36 +150,38 @@ class PolicyManager : public usage_statistics::StatisticsManager { virtual std::string GetPolicyTableStatus() const = 0; /** - * Checks is PT exceeded kilometers + * @brief Checks is PT exceeded kilometers * @param kilometers current kilometers at odometer * @return true if exceeded */ virtual void KmsChanged(int kilometers) = 0; /** - * Increments counter of ignition cycles + * @brief Increments counter of ignition cycles */ virtual void IncrementIgnitionCycles() = 0; /** * @brief Exchange by hmi or mobile request + * @return Current status of policy table */ virtual std::string ForcePTExchange() = 0; /** - * @brief ExchangeByUserRequest + * @brief Exchange by user request + * @return Current status of policy table */ virtual std::string ForcePTExchangeAtUserRequest() = 0; /** - * Gets timeout to wait before next retry updating PT - * If timeout is equal to zero then the retry sequence is not need. + * @brief Gets timeout to wait before next retry updating PT + * If timeout is less or equal to zero then the retry sequence is not need. * @return timeout in seconds */ virtual uint32_t NextRetryTimeout() = 0; /** - * Gets timeout to wait until receive response + * @brief Gets timeout to wait until receive response * @return timeout in seconds */ virtual uint32_t TimeoutExchangeMSec() = 0; @@ -177,7 +194,7 @@ class PolicyManager : public usage_statistics::StatisticsManager { virtual const std::vector<int> RetrySequenceDelaysSeconds() = 0; /** - * Handler of exceeding timeout of exchanging policy table + * @brief Handler of exceeding timeout of exchanging policy table */ virtual void OnExceededTimeout() = 0; @@ -187,7 +204,7 @@ class PolicyManager : public usage_statistics::StatisticsManager { virtual void OnUpdateStarted() = 0; /** - * @brief Check user consent for mobile device data connection + * @brief Gets user consent for mobile device data connection * @param device_id Unique device identifier * @return status of device consent */ @@ -195,7 +212,7 @@ class PolicyManager : public usage_statistics::StatisticsManager { const std::string& device_id) const = 0; /** - * @brief Get user consent for application + * @brief Gets user consent for application * @param device_id Device id * @param policy_app_id Unique application id * @param permissions Array of functional groups permissions @@ -216,20 +233,24 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief Update Application Policies as reaction * on User allowing/disallowing device this app is running on. + * @param app_id Unique application id + * @param is_device_allowed true if user allowing device otherwise false + * @return true if operation was successful */ virtual bool ReactOnUserDevConsentForApp(const std::string app_id, bool is_device_allowed) = 0; + /** - * Sets counter value that passed for receiving PT UPdate. + * @brief Sets counter value that passed for receiving PT UPdate. */ virtual void PTUpdatedAt(Counters counter, int value) = 0; /** * @brief Retrieves data from app_policies about app on its registration: - * @param app_id - id of registered app - * @param app_types Section on HMI where app can appear (Navigation, Phone - * etc) + * @param application_id - id of registered app * @param nicknames Synonyms for application + * @param app_hmi_types Section on HMI where app can appear (Navigation, Phone + * etc) */ virtual bool GetInitialAppData(const std::string& application_id, StringArray* nicknames = NULL, @@ -291,7 +312,7 @@ class PolicyManager : public usage_statistics::StatisticsManager { const std::string& language) = 0; /** - * Checks if the application is revoked + * @brief Checks if the application is revoked * @param app_id application id * @return true if application is revoked */ @@ -318,11 +339,15 @@ class PolicyManager : public usage_statistics::StatisticsManager { virtual AppPermissions GetAppPermissionsChanges( const std::string& policy_app_id) = 0; + /** + * @brief Removes specific application permissions changes + * @param app_id Unique application id + */ virtual void RemovePendingPermissionChanges(const std::string& app_id) = 0; /** * @brief Return device id, which hosts specific application - * @param Application id, which is required to update device id + * @param policy_app_id Application id, which is required to update device id */ virtual std::string& GetCurrentDeviceId( const std::string& policy_app_id) const = 0; @@ -345,13 +370,13 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief Send OnPermissionsUpdated for choosen application - * @param application_id + * @param application_id Unique application id */ virtual void SendNotificationOnPermissionsUpdated( const std::string& application_id) = 0; /** - * Marks device as upaired + * @brief Marks device as upaired * @param device_id id device */ virtual void MarkUnpairedDevice(const std::string& device_id) = 0; @@ -359,26 +384,31 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief Adds, application to the db or update existed one * run PTU if policy update is necessary for application. - * @param Application id assigned by Ford to the application + * @param application_id Unique application id + * @param hmi_types application HMI types * @return function that will notify update manager about new application */ virtual StatusNotifier AddApplication( const std::string& application_id, const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) = 0; + /** * @brief Removes unpaired device records and related records from DB - * @param device_ids List of device_id, which should be removed * @return true, if succedeed, otherwise - false */ virtual bool CleanupUnpairedDevices() = 0; /** * @brief Check if app can keep context. + * @param app_id Unique application id + * @return true if app can keep context, otherwise - false */ virtual bool CanAppKeepContext(const std::string& app_id) const = 0; /** * @brief Check if app can steal focus. + * @param app_id Unique application id + * @return true if app can steal focus, otherwise - false */ virtual bool CanAppStealFocus(const std::string& app_id) const = 0; @@ -390,9 +420,9 @@ class PolicyManager : public usage_statistics::StatisticsManager { virtual void OnSystemReady() = 0; /** - * @brief GetNotificationNumber - * @param priority - * @return + * @brief Get number of notification by priority + * @param priority Specified priority + * @return notification number */ virtual uint32_t GetNotificationsNumber( const std::string& priority) const = 0; @@ -411,7 +441,7 @@ class PolicyManager : public usage_statistics::StatisticsManager { virtual bool IsPredataPolicy(const std::string& policy_app_id) const = 0; /** - * Returns heart beat timeout + * @brief Returns heart beat timeout * @param app_id application id * @return if timeout was set then value in milliseconds greater zero * otherwise heart beat for specific application isn't set @@ -419,7 +449,8 @@ class PolicyManager : public usage_statistics::StatisticsManager { virtual uint32_t HeartBeatTimeout(const std::string& app_id) const = 0; /** - * @brief SaveUpdateStatusRequired alows to save update status. + * @brief SaveUpdateStatusRequired allows to save update status. + * @param is_update_needed true if update needed */ virtual void SaveUpdateStatusRequired(bool is_update_needed) = 0; @@ -430,26 +461,28 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief Handler on applications search completed + * @param trigger_ptu contains true if PTU should be triggered */ virtual void OnAppsSearchCompleted(const bool trigger_ptu) = 0; + /** * @brief Gets request types for application * @param policy_app_id Unique application id - * @return request_types Request types of application + * @return request types of application */ virtual const std::vector<std::string> GetAppRequestTypes( const std::string policy_app_id) const = 0; /** * @brief Get information about vehicle + * @return vehicle information */ virtual const VehicleInfo GetVehicleInfo() const = 0; /** - * @brief OnAppRegisteredOnMobile alows to handle event when application were + * @brief OnAppRegisteredOnMobile allows to handle event when application were * succesfully registered on mobile device. - * It will send OnAppPermissionSend notification and will try to start PTU. - * + * It will send OnAppPermissionSend notification and will try to start PTU. * * @param application_id registered application. */ virtual void OnAppRegisteredOnMobile(const std::string& application_id) = 0; @@ -457,7 +490,6 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief RetrieveCertificate Allows to obtain certificate in order * to start secure connection. - * * @return The certificate in PKCS#7 format. */ virtual std::string RetrieveCertificate() const = 0; @@ -465,11 +497,14 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief HasCertificate check whether policy table has certificate * int module_config section. - * * @return true in case certificate exists, false otherwise */ virtual bool HasCertificate() const = 0; + /** + * @brief Getter for policy settings + * @return policy settings instance + */ virtual const PolicySettings& get_settings() const = 0; /** @@ -479,6 +514,57 @@ class PolicyManager : public usage_statistics::StatisticsManager { * urls vector */ virtual AppIdURL GetNextUpdateUrl(const EndpointUrls& urls) = 0; +#ifdef SDL_REMOTE_CONTROL + /** + * @brief Assigns new HMI types for specified application + * @param application_id Unique application id + * @param hmi_types new HMI types list + */ + virtual void SetDefaultHmiTypes(const std::string& application_id, + const std::vector<int>& hmi_types) = 0; + + /** + * @brief Gets HMI types + * @param application_id ID application + * @param app_types list to save HMI types + * @return true if policy has specific policy for this application + */ + virtual bool GetHMITypes(const std::string& application_id, + std::vector<int>* app_types) = 0; + + /** + * @brief Checks if module for application is present in policy table + * @param app_id id of application + * @param module type + * @return true if module is present, otherwise - false + */ + virtual bool CheckModule(const PTString& app_id, const PTString& module) = 0; + + /** + * @brief Send OnPermissionsChange notification to mobile app + * when it's permissions are changed. + * @param device_id Device on which app is running + * @param application_id ID of app whose permissions are changed + */ + virtual void SendAppPermissionsChanged(const std::string& device_id, + const std::string& application_id) = 0; + + /** + * @brief Gets all allowed module types + * @param policy_app_id unique identifier of application + * @param modules list of allowed module types + * @return true if application has allowed modules + */ + virtual bool GetModuleTypes(const std::string& policy_app_id, + std::vector<std::string>* modules) const = 0; + + /** + * @brief Setter for access_remote instance + * @param access_remote pointer to new access_remote instance + */ + virtual void set_access_remote( + utils::SharedPtr<AccessRemote> access_remote) = 0; +#endif // SDL_REMOTE_CONTROL /** * @brief Checks if there is existing URL in the EndpointUrls vector with @@ -494,13 +580,13 @@ class PolicyManager : public usage_statistics::StatisticsManager { protected: /** - * Checks is PT exceeded IgnitionCycles + * @brief Checks is PT exceeded IgnitionCycles * @return true if exceeded */ virtual bool ExceededIgnitionCycles() = 0; /** - * Checks is PT exceeded days + * @brief Checks is PT exceeded days * @return true if exceeded */ virtual bool ExceededDays() = 0; @@ -518,4 +604,4 @@ class PolicyManager : public usage_statistics::StatisticsManager { extern "C" policy::PolicyManager* CreateManager(); extern "C" void DeleteManager(policy::PolicyManager*); -#endif // SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_MANAGER_H_ +#endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_POLICY_MANAGER_H_ diff --git a/src/components/policy/policy_regular/include/policy/usage_statistics/app_stopwatch.h b/src/components/include/policy/policy_regular/policy/usage_statistics/app_stopwatch.h index 8093c11467..0bcd585737 100644 --- a/src/components/policy/policy_regular/include/policy/usage_statistics/app_stopwatch.h +++ b/src/components/include/policy/policy_regular/policy/usage_statistics/app_stopwatch.h @@ -30,8 +30,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_USAGE_STATISTICS_APP_STOPWATCH_H_ -#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_USAGE_STATISTICS_APP_STOPWATCH_H_ +#ifndef SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_USAGE_STATISTICS_APP_STOPWATCH_H_ +#define SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_USAGE_STATISTICS_APP_STOPWATCH_H_ #include "policy/usage_statistics/statistics_manager.h" @@ -47,4 +47,4 @@ class AppStopwatch { } // namespace usage_statistics -#endif // SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_USAGE_STATISTICS_APP_STOPWATCH_H_ +#endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_USAGE_STATISTICS_APP_STOPWATCH_H_ diff --git a/src/components/include/policy/policy_regular/policy/usage_statistics/statistics_manager.h b/src/components/include/policy/policy_regular/policy/usage_statistics/statistics_manager.h index 8cf3beaa55..23df30510b 100644 --- a/src/components/include/policy/policy_regular/policy/usage_statistics/statistics_manager.h +++ b/src/components/include/policy/policy_regular/policy/usage_statistics/statistics_manager.h @@ -30,8 +30,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SRC_COMPONENTS_INCLUDE_POLICY_USAGE_STATISTICS_STATISTICS_MANAGER_H_ -#define SRC_COMPONENTS_INCLUDE_POLICY_USAGE_STATISTICS_STATISTICS_MANAGER_H_ +#ifndef SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_USAGE_STATISTICS_STATISTICS_MANAGER_H_ +#define SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_USAGE_STATISTICS_STATISTICS_MANAGER_H_ #include <stdint.h> #include <string> @@ -71,11 +71,36 @@ enum AppCounterId { class StatisticsManager { public: virtual ~StatisticsManager() {} + + /** + * @brief Increments global counter + * @param type counter type + */ virtual void Increment(GlobalCounterId type) = 0; + + /** + * @brief Increments specified application counter + * @param app_id Unique ID of application + * @param type application counter type + */ virtual void Increment(const std::string& app_id, AppCounterId type) = 0; + + /** + * @brief Sets specified application info value + * @param app_id Unique ID of application + * @param type application info type + * @param value new value for counter + */ virtual void Set(const std::string& app_id, AppInfoId type, const std::string& value) = 0; + + /** + * @brief Add seconds for specified application stopwatch + * @param app_id Unique ID of application + * @param type application stopwatch type + * @param timespan_seconds seconds to add + */ virtual void Add(const std::string& app_id, AppStopwatchId type, int32_t timespan_seconds) = 0; @@ -83,4 +108,4 @@ class StatisticsManager { } // namespace usage_statistics -#endif // SRC_COMPONENTS_INCLUDE_POLICY_USAGE_STATISTICS_STATISTICS_MANAGER_H_ +#endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_USAGE_STATISTICS_STATISTICS_MANAGER_H_ diff --git a/src/components/include/protocol/bson_object_keys.h b/src/components/include/protocol/bson_object_keys.h new file mode 100644 index 0000000000..6f80aeec2b --- /dev/null +++ b/src/components/include/protocol/bson_object_keys.h @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2017, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace protocol_handler { + +namespace strings { + +extern const char* hash_id; +extern const char* protocol_version; +extern const char* mtu; +extern const char* rejected_params; +extern const char* height; +extern const char* width; +extern const char* video_protocol; +extern const char* video_codec; + +} // namespace strings + +} // namespace protocol_handler diff --git a/src/components/include/protocol/common.h b/src/components/include/protocol/common.h index ce4c4adf6f..00d57a9bf5 100644 --- a/src/components/include/protocol/common.h +++ b/src/components/include/protocol/common.h @@ -56,8 +56,9 @@ const uint8_t PROTOCOL_HEADER_V2_SIZE = 12; *\brief Protocol versions constants * First 4-bit field of AppLink protocol packet */ -enum { - +enum MajorProtocolVersion { + PROTOCOL_VERSION_UNKNOWN = -1, + PROTOCOL_VERSION_HMI = 0x00, /** *\brief Constant: number of protocol version (1). */ @@ -85,6 +86,12 @@ enum { */ PROTOCOL_VERSION_4 = 0x04, /** + *@brief Constant: number of protocol version (5). + * Supports constructed payloads for protocol packets + * SDL4.4 feature. + */ + PROTOCOL_VERSION_5 = 0x05, + /** *\brief Maximum value of packet version field (size 4-bit) specified AppLink *Protocol v.7 */ diff --git a/src/components/include/protocol_handler/protocol_handler.h b/src/components/include/protocol_handler/protocol_handler.h index 183db21532..34135617bd 100644 --- a/src/components/include/protocol_handler/protocol_handler.h +++ b/src/components/include/protocol_handler/protocol_handler.h @@ -108,6 +108,27 @@ class ProtocolHandler { virtual const ProtocolHandlerSettings& get_settings() const = 0; virtual SessionObserver& get_session_observer() = 0; + /** + * \brief Called by connection handler to notify the result of + * OnSessionStartedCallback(). + * \param connection_id Identifier of connection within which session exists + * \param session_id session ID passed to OnSessionStartedCallback() + * \param generated_session_id Generated session ID, will be 0 if session is + * not started + * \param hash_id Generated Hash ID + * \param protection whether the service will be protected + * \param rejected_params list of parameters' name that are rejected. + * Only valid when generated_session_id is 0. Note, even if + * generated_session_id is 0, the list may be empty. + */ + virtual void NotifySessionStartedResult( + int32_t connection_id, + uint8_t session_id, + uint8_t generated_session_id, + uint32_t hash_id, + bool protection, + std::vector<std::string>& rejected_params) = 0; + protected: /** * \brief Destructor diff --git a/src/components/include/protocol_handler/protocol_handler_settings.h b/src/components/include/protocol_handler/protocol_handler_settings.h index 987b0ac449..362f49e140 100644 --- a/src/components/include/protocol_handler/protocol_handler_settings.h +++ b/src/components/include/protocol_handler/protocol_handler_settings.h @@ -15,6 +15,10 @@ class ProtocolHandlerSettings { virtual ~ProtocolHandlerSettings() {} virtual size_t maximum_payload_size() const = 0; + virtual size_t maximum_control_payload_size() const = 0; + virtual size_t maximum_rpc_payload_size() const = 0; + virtual size_t maximum_audio_payload_size() const = 0; + virtual size_t maximum_video_payload_size() const = 0; virtual size_t message_frequency_count() const = 0; virtual size_t message_frequency_time() const = 0; virtual bool malformed_message_filtering() const = 0; @@ -25,10 +29,12 @@ class ProtocolHandlerSettings { */ virtual uint32_t heart_beat_timeout() const = 0; - virtual uint16_t max_supported_protocol_version() const = 0; /* * @brief Protocol version, from .ini file. */ + virtual uint16_t max_supported_protocol_version() const = 0; + + // DEPRECATED virtual bool enable_protocol_4() const = 0; virtual uint32_t multiframe_waiting_timeout() const = 0; diff --git a/src/components/include/protocol_handler/session_observer.h b/src/components/include/protocol_handler/session_observer.h index 5e630c6c74..e58d959c8c 100644 --- a/src/components/include/protocol_handler/session_observer.h +++ b/src/components/include/protocol_handler/session_observer.h @@ -39,10 +39,13 @@ #ifdef ENABLE_SECURITY #include "security_manager/ssl_context.h" #endif // ENABLE_SECURITY - /** - *\namespace protocol_handlerHandler - *\brief Namespace for SmartDeviceLink ProtocolHandler related functionality. - */ + +struct BsonObject; + +/** + *\namespace protocol_handler + *\brief Namespace for SmartDeviceLink ProtocolHandler related functionality. + */ namespace protocol_handler { /** * \brief HASH_ID constants. @@ -73,6 +76,7 @@ class SessionObserver { * \param hash_id pointer for session hash identifier, uint32_t* hash_id * \return uint32_t Id (number) of new session if successful, otherwise 0. */ + // DEPRECATED virtual uint32_t OnSessionStartedCallback( const transport_manager::ConnectionUID connection_handle, const uint8_t sessionId, @@ -82,6 +86,32 @@ class SessionObserver { /** * \brief Callback function used by ProtocolHandler + * when Mobile Application initiates start of new session. + * Result must be notified through NotifySessionStartedResult(). + * \param connection_handle Connection identifier within which session + * has to be started. + * \param sessionId Identifier of the session to be start + * \param service_type Type of service + * \param protocol_version Version of protocol + * \param is_protected would be service protected + * \param params configuration parameters specified by mobile + */ + virtual void OnSessionStartedCallback( + const transport_manager::ConnectionUID connection_handle, + const uint8_t sessionId, + const protocol_handler::ServiceType& service_type, + const bool is_protected, + const BsonObject* params) = 0; + + // DEPRECATED + virtual uint32_t OnSessionEndedCallback( + const transport_manager::ConnectionUID connection_handle, + const uint8_t sessionId, + const uint32_t& hashCode, + const protocol_handler::ServiceType& service_type) = 0; + + /** + * \brief Callback function used by ProtocolHandler * when Mobile Application initiates session ending. * \param connection_handle Connection identifier within which session exists * \param sessionId Identifier of the session to be ended @@ -94,7 +124,7 @@ class SessionObserver { virtual uint32_t OnSessionEndedCallback( const transport_manager::ConnectionUID connection_handle, const uint8_t sessionId, - const uint32_t& hashCode, + uint32_t* hashCode, const protocol_handler::ServiceType& service_type) = 0; /** diff --git a/src/components/include/test/application_manager/mock_application_manager.h b/src/components/include/test/application_manager/mock_application_manager.h index fc9b213d04..e94d9b4b3a 100644 --- a/src/components/include/test/application_manager/mock_application_manager.h +++ b/src/components/include/test/application_manager/mock_application_manager.h @@ -45,6 +45,7 @@ #include "application_manager/hmi_capabilities.h" #include "application_manager/vehicle_info_data.h" #include "application_manager/state_controller.h" +#include "application_manager/message.h" #include "resumption/last_state.h" #include "interfaces/MOBILE_API.h" #include "application_manager/app_launch/app_launch_ctrl.h" @@ -74,6 +75,23 @@ class MockApplicationManager : public application_manager::ApplicationManager { application, application_manager::ApplicationSharedPtr(uint32_t app_id)); MOCK_CONST_METHOD0(active_application, application_manager::ApplicationSharedPtr()); + +#ifdef SDL_REMOTE_CONTROL + MOCK_CONST_METHOD2(application, + application_manager::ApplicationSharedPtr( + const std::string& device_id, + const std::string& policy_app_id)); + MOCK_METHOD2(ChangeAppsHMILevel, + void(uint32_t app_id, mobile_apis::HMILevel::eType level)); + MOCK_METHOD0(GetPluginManager, functional_modules::PluginManager&()); + MOCK_CONST_METHOD1( + devices, std::vector<std::string>(const std::string& policy_app_id)); + MOCK_METHOD1(SendPostMessageToMobile, + void(const application_manager::MessagePtr& message)); + MOCK_METHOD1(SendPostMessageToHMI, + void(const application_manager::MessagePtr& message)); +#endif // SDL_REMOTE_CONTROL + MOCK_CONST_METHOD1( application_by_hmi_app, application_manager::ApplicationSharedPtr(uint32_t hmi_app_id)); @@ -85,12 +103,16 @@ class MockApplicationManager : public application_manager::ApplicationManager { std::vector<application_manager::ApplicationSharedPtr>(uint32_t button)); MOCK_METHOD0(applications_with_navi, std::vector<application_manager::ApplicationSharedPtr>()); + MOCK_METHOD0(applications_with_mobile_projection, + std::vector<application_manager::ApplicationSharedPtr>()); MOCK_CONST_METHOD0(get_limited_media_application, application_manager::ApplicationSharedPtr()); MOCK_CONST_METHOD0(get_limited_navi_application, application_manager::ApplicationSharedPtr()); MOCK_CONST_METHOD0(get_limited_voice_application, application_manager::ApplicationSharedPtr()); + MOCK_CONST_METHOD0(get_limited_mobile_projection_application, + application_manager::ApplicationSharedPtr()); MOCK_METHOD1(application_id, uint32_t(const int32_t correlation_id)); MOCK_METHOD2(set_application_id, void(const int32_t correlation_id, const uint32_t app_id)); @@ -106,6 +128,8 @@ class MockApplicationManager : public application_manager::ApplicationManager { MOCK_METHOD1( SendMessageToHMI, void(const application_manager::commands::MessageSharedPtr message)); + MOCK_METHOD1(RemoveHMIFakeParameters, + void(application_manager::MessagePtr& message)); MOCK_METHOD1( ManageHMICommand, bool(const application_manager::commands::MessageSharedPtr message)); @@ -257,6 +281,14 @@ class MockApplicationManager : public application_manager::ApplicationManager { MOCK_METHOD0(OnTimerSendTTSGlobalProperties, void()); MOCK_METHOD0(OnLowVoltage, void()); MOCK_METHOD0(OnWakeUp, void()); + MOCK_METHOD4(OnStreamingConfigured, + void(uint32_t app_id, + protocol_handler::ServiceType service_type, + bool result, + std::vector<std::string>& rejected_params)); + MOCK_METHOD1(ValidateMessageBySchema, + application_manager::MessageValidationResult( + const application_manager::Message& message)); }; } // namespace application_manager_test diff --git a/src/components/include/test/application_manager/mock_application_manager_settings.h b/src/components/include/test/application_manager/mock_application_manager_settings.h index fd9e2aa8a3..25cf994566 100644 --- a/src/components/include/test/application_manager/mock_application_manager_settings.h +++ b/src/components/include/test/application_manager/mock_application_manager_settings.h @@ -57,6 +57,7 @@ class MockApplicationManagerSettings const std::pair<uint32_t, int32_t>&()); MOCK_CONST_METHOD0(hash_string_size, uint32_t()); MOCK_CONST_METHOD0(app_storage_folder, const std::string&()); + MOCK_CONST_METHOD0(app_info_storage, const std::string&()); MOCK_CONST_METHOD0(app_dir_quota, const uint32_t&()); MOCK_CONST_METHOD0(stop_streaming_timeout, uint32_t()); MOCK_CONST_METHOD0(application_list_update_timeout, uint32_t()); @@ -101,6 +102,7 @@ class MockApplicationManagerSettings MOCK_CONST_METHOD0(start_stream_retry_amount, const std::pair<uint32_t, int32_t>&()); MOCK_CONST_METHOD0(app_icons_folder, const std::string&()); + MOCK_CONST_METHOD0(plugins_folder, const std::string&()); MOCK_CONST_METHOD0(app_icons_folder_max_size, const uint32_t&()); MOCK_CONST_METHOD0(app_icons_amount_to_remove, const uint32_t&()); MOCK_CONST_METHOD0(list_files_response_size, const uint32_t&()); diff --git a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h index 2fad7b757e..812df19ccd 100644 --- a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h +++ b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h @@ -227,6 +227,36 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface { void(const std::string& service_type, policy::EndpointUrls& end_points)); +#ifdef SDL_REMOTE_CONTROL + MOCK_METHOD3(OnUpdateHMILevel, + void(const std::string& device_id, + const std::string& policy_app_id, + const std::string& hmi_level)); + MOCK_METHOD3(CheckHMIType, + bool(const std::string& application_id, + mobile_apis::AppHMIType::eType hmi, + const smart_objects::SmartObject* app_types)); + + MOCK_METHOD2(CheckModule, + bool(const policy::PTString& app_id, + const policy::PTString& module)); + + MOCK_METHOD2(OnRemoteAppPermissionsChanged, + void(const std::string& device_id, + const std::string& application_id)); + + MOCK_METHOD3(OnUpdateHMIStatus, + void(const std::string& device_id, + const std::string& policy_app_id, + const std::string& hmi_level)); + MOCK_CONST_METHOD2(GetModuleTypes, + bool(const std::string& policy_app_id, + std::vector<std::string>* modules)); + MOCK_METHOD2(SetDefaultHmiTypes, + void(const std::string& application_id, + const smart_objects::SmartObject* app_types)); +#endif // SDL_REMOTE_CONTROL + private: #ifdef EXTERNAL_PROPRIETARY_MODE MOCK_METHOD3(OnAppPermissionConsentInternal, diff --git a/src/components/include/test/connection_handler/mock_connection_handler.h b/src/components/include/test/connection_handler/mock_connection_handler.h index e17224b097..5cb5f471b5 100644 --- a/src/components/include/test/connection_handler/mock_connection_handler.h +++ b/src/components/include/test/connection_handler/mock_connection_handler.h @@ -96,6 +96,10 @@ class MockConnectionHandler : public connection_handler::ConnectionHandler { MOCK_METHOD0(get_device_discovery_starter, DevicesDiscoveryStarter&()); MOCK_CONST_METHOD1(GetConnectedDevicesMAC, void(std::vector<std::string>& macs)); + MOCK_METHOD3(NotifyServiceStartedResult, + void(uint32_t session_key, + bool result, + std::vector<std::string>& rejected_params)); }; } // namespace connection_handler_test diff --git a/src/components/include/test/connection_handler/mock_connection_handler_observer.h b/src/components/include/test/connection_handler/mock_connection_handler_observer.h index 6ca4557b35..dead5bc61e 100644 --- a/src/components/include/test/connection_handler/mock_connection_handler_observer.h +++ b/src/components/include/test/connection_handler/mock_connection_handler_observer.h @@ -48,10 +48,16 @@ class MockConnectionHandlerObserver MOCK_METHOD0(OnFindNewApplicationsRequest, void()); MOCK_METHOD1(RemoveDevice, void(const connection_handler::DeviceHandle& device_handle)); + // DEPRECATED MOCK_METHOD3(OnServiceStartedCallback, bool(const connection_handler::DeviceHandle& device_handle, const int32_t& session_key, const protocol_handler::ServiceType& type)); + MOCK_METHOD4(OnServiceStartedCallback, + void(const connection_handler::DeviceHandle& device_handle, + const int32_t& session_key, + const protocol_handler::ServiceType& type, + const BsonObject* params)); MOCK_METHOD3( OnServiceEndedCallback, void(const int32_t& session_key, diff --git a/src/components/include/test/hmi_message_handler/mock_hmi_message_handler_settings.h b/src/components/include/test/hmi_message_handler/mock_hmi_message_handler_settings.h index fcbae93a70..a7e93ec25c 100644 --- a/src/components/include/test/hmi_message_handler/mock_hmi_message_handler_settings.h +++ b/src/components/include/test/hmi_message_handler/mock_hmi_message_handler_settings.h @@ -44,7 +44,7 @@ namespace hmi_message_handler_test { class MockHMIMessageHandlerSettings : public ::hmi_message_handler::HMIMessageHandlerSettings { public: - MOCK_CONST_METHOD0(thread_min_stack_size, const uint64_t&()); + MOCK_CONST_METHOD0(thread_min_stack_size, const uint64_t()); }; } // namespace hmi_message_handler_test } // namespace components diff --git a/src/components/policy/policy_external/test/include/policy/mock_cache_manager.h b/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h index 617e99358e..e90fa63075 100644 --- a/src/components/policy/policy_external/test/include/policy/mock_cache_manager.h +++ b/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h @@ -29,8 +29,8 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_TEST_INCLUDE_POLICY_MOCK_CACHE_MANAGER_H_ -#define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_TEST_INCLUDE_POLICY_MOCK_CACHE_MANAGER_H_ +#ifndef SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_EXTERNAL_POLICY_MOCK_CACHE_MANAGER_H_ +#define SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_EXTERNAL_POLICY_MOCK_CACHE_MANAGER_H_ #include <string> #include <vector> @@ -253,4 +253,4 @@ class MockCacheManagerInterface : public ::policy::CacheManagerInterface { } // namespace components } // namespace test -#endif // SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_TEST_INCLUDE_POLICY_MOCK_CACHE_MANAGER_H_ +#endif // SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_EXTERNAL_POLICY_MOCK_CACHE_MANAGER_H_ diff --git a/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h b/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h index 893d5a334f..ad2f1fd56c 100644 --- a/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h +++ b/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h @@ -29,8 +29,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SRC_COMPONENTS_INCLUDE_TEST_POLICY_MOCK_POLICY_LISTENER_H_ -#define SRC_COMPONENTS_INCLUDE_TEST_POLICY_MOCK_POLICY_LISTENER_H_ +#ifndef SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_EXTERNAL_POLICY_MOCK_POLICY_LISTENER_H_ +#define SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_EXTERNAL_POLICY_MOCK_POLICY_LISTENER_H_ #include <string> #include <map> @@ -92,10 +92,20 @@ class MockPolicyListener : public ::policy::PolicyListener { const std::string& hmi_level)); MOCK_CONST_METHOD1(GetRegisteredLinks, void(std::map<std::string, std::string>&)); +#ifdef SDL_REMOTE_CONTROL + MOCK_METHOD1(OnRemoteAllowedChanged, void(bool new_consent)); + MOCK_METHOD2(OnRemoteAppPermissionsChanged, + void(const std::string& device_id, + const std::string& application_id)); + MOCK_METHOD3(OnUpdateHMIStatus, + void(const std::string& device_id, + const std::string& policy_app_id, + const std::string& hmi_level)); +#endif // SDL_REMOTE_CONTROL }; } // namespace policy_test } // namespace components } // namespace test -#endif // SRC_COMPONENTS_INCLUDE_TEST_POLICY_MOCK_POLICY_LISTENER_H_ +#endif // SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_EXTERNAL_POLICY_MOCK_POLICY_LISTENER_H_ diff --git a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h index 0332b94a89..6227e7e85c 100644 --- a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h +++ b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h @@ -30,8 +30,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SRC_COMPONENTS_INCLUDE_TEST_POLICY_MOCK_POLICY_MANAGER_H_ -#define SRC_COMPONENTS_INCLUDE_TEST_POLICY_MOCK_POLICY_MANAGER_H_ +#ifndef SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_EXTERNAL_POLICY_MOCK_POLICY_MANAGER_H_ +#define SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_EXTERNAL_POLICY_MOCK_POLICY_MANAGER_H_ #include <string> #include <vector> @@ -148,6 +148,25 @@ class MockPolicyManager : public PolicyManager { StatusNotifier( const std::string& application_id, const rpc::policy_table_interface_base::AppHmiTypes& hmi_types)); +#ifdef SDL_REMOTE_CONTROL + MOCK_METHOD2(SetDefaultHmiTypes, + void(const std::string& application_id, + const std::vector<int>& hmi_types)); + MOCK_METHOD2(GetHMITypes, + bool(const std::string& application_id, + std::vector<int>* app_types)); + MOCK_METHOD2(CheckModule, + bool(const PTString& app_id, const PTString& module)); + MOCK_METHOD2(SendAppPermissionsChanged, + void(const std::string& device_id, + const std::string& application_id)); + MOCK_CONST_METHOD2(GetModuleTypes, + bool(const std::string& policy_app_id, + std::vector<std::string>* modules)); + MOCK_METHOD1(set_access_remote, + void(utils::SharedPtr<AccessRemote> access_remote)); +#endif // SDL_REMOTE_CONTROL + MOCK_METHOD0(CleanupUnpairedDevices, bool()); MOCK_CONST_METHOD1(CanAppKeepContext, bool(const std::string& app_id)); MOCK_CONST_METHOD1(CanAppStealFocus, bool(const std::string& app_id)); @@ -201,4 +220,4 @@ class MockPolicyManager : public PolicyManager { } // namespace components } // namespace test -#endif // SRC_COMPONENTS_INCLUDE_TEST_POLICY_MOCK_POLICY_MANAGER_H_ +#endif // SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_EXTERNAL_POLICY_MOCK_POLICY_MANAGER_H_ diff --git a/src/components/policy/policy_regular/test/include/policy/mock_cache_manager.h b/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h index 7569e2195d..39876cf713 100644 --- a/src/components/policy/policy_regular/test/include/policy/mock_cache_manager.h +++ b/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h @@ -29,8 +29,8 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_TEST_INCLUDE_MOCK_CACHE_MANAGER_H_ -#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_TEST_INCLUDE_MOCK_CACHE_MANAGER_H_ +#ifndef SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_REGULAR_POLICY_MOCK_CACHE_MANAGER_H_ +#define SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_REGULAR_POLICY_MOCK_CACHE_MANAGER_H_ #include <string> #include <vector> @@ -202,7 +202,9 @@ class MockCacheManagerInterface : public CacheManagerInterface { bool(const std::string& device_id, const std::string& policy_app_id, policy::Permissions& permission)); - MOCK_CONST_METHOD0(GetPT, utils::SharedPtr<policy_table::Table>()); + MOCK_CONST_METHOD0(pt, utils::SharedPtr<policy_table::Table>()); + MOCK_METHOD1(GetHMITypes, + const policy_table::AppHMITypes*(const std::string& app_id)); MOCK_CONST_METHOD0(GetCertificate, std::string()); MOCK_METHOD1(SetDecryptedCertificate, void(const std::string&)); MOCK_METHOD1(GetGroups, const policy_table::Strings&(const PTString& app_id)); @@ -215,4 +217,4 @@ class MockCacheManagerInterface : public CacheManagerInterface { } // namespace components } // namespace test -#endif // SRC_COMPONENTS_POLICY_POLICY_REGULAR_TEST_INCLUDE_MOCK_CACHE_MANAGER_H_ +#endif // SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_REGULAR_POLICY_MOCK_CACHE_MANAGER_H_ diff --git a/src/components/policy/policy_regular/test/include/policy/mock_policy_listener.h b/src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h index 2e4073aae9..d98a0279d7 100644 --- a/src/components/policy/policy_regular/test/include/policy/mock_policy_listener.h +++ b/src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h @@ -29,8 +29,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_TEST_INCLUDE_MOCK_POLICY_LISTENER_H_ -#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_TEST_INCLUDE_MOCK_POLICY_LISTENER_H_ +#ifndef SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_REGULAR_POLICY_MOCK_POLICY_LISTENER_H_ +#define SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_REGULAR_POLICY_MOCK_POLICY_LISTENER_H_ #include <string> @@ -43,19 +43,21 @@ namespace policy_table = ::rpc::policy_table_interface_base; -namespace policy { +namespace test { +namespace components { +namespace policy_test { namespace custom_str = utils::custom_string; -class MockPolicyListener : public PolicyListener { +class MockPolicyListener : public ::policy::PolicyListener { public: MOCK_METHOD3(OnPermissionsUpdated, void(const std::string& policy_app_id, - const Permissions& permissions, + const policy::Permissions& permissions, const policy::HMILevel& default_hmi)); MOCK_METHOD2(OnPermissionsUpdated, void(const std::string& policy_app_id, - const Permissions& permissions)); + const policy::Permissions& permissions)); MOCK_METHOD1(OnPendingPermissionChange, void(const std::string& policy_app_id)); MOCK_METHOD1(OnUpdateStatusChanged, void(const std::string& status)); @@ -67,17 +69,36 @@ class MockPolicyListener : public PolicyListener { MOCK_METHOD0(OnUserRequestedUpdateCheckRequired, void()); MOCK_METHOD2(OnDeviceConsentChanged, void(const std::string& device_id, bool is_allowed)); - MOCK_METHOD1(OnUpdateHMIAppType, void(std::map<std::string, StringArray>)); + MOCK_METHOD1(OnUpdateHMIAppType, + void(std::map<std::string, policy::StringArray>)); MOCK_METHOD1(GetAvailableApps, void(std::queue<std::string>&)); - MOCK_METHOD1(OnSnapshotCreated, void(const BinaryMessage& pt_string)); + MOCK_METHOD1(OnSnapshotCreated, void(const policy::BinaryMessage& pt_string)); MOCK_METHOD0(CanUpdate, bool()); MOCK_METHOD1(OnCertificateUpdated, void(const std::string&)); MOCK_CONST_METHOD2(SendOnAppPermissionsChanged, - void(const AppPermissions&, const std::string&)); + void(const policy::AppPermissions&, const std::string&)); + MOCK_METHOD3(OnUpdateHMILevel, + void(const std::string& device_id, + const std::string& policy_app_id, + const std::string& hmi_level)); + MOCK_METHOD1(GetDevicesIds, + std::vector<std::string>(const std::string& policy_app_id)); MOCK_CONST_METHOD1(GetRegisteredLinks, void(std::map<std::string, std::string>&)); +#ifdef SDL_REMOTE_CONTROL + MOCK_METHOD1(OnRemoteAllowedChanged, void(bool new_consent)); + MOCK_METHOD2(OnRemoteAppPermissionsChanged, + void(const std::string& device_id, + const std::string& application_id)); + MOCK_METHOD3(OnUpdateHMIStatus, + void(const std::string& device_id, + const std::string& policy_app_id, + const std::string& hmi_level)); +#endif // SDL_REMOTE_CONTROL }; -} // namespace policy +} // namespace policy_test +} // namespace components +} // namespace test -#endif // SRC_COMPONENTS_POLICY_POLICY_REGULAR_TEST_INCLUDE_MOCK_POLICY_LISTENER_H_ +#endif // SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_REGULAR_POLICY_MOCK_POLICY_LISTENER_H_ diff --git a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h index 1ccca81d79..cfe41ee64c 100644 --- a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h +++ b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h @@ -30,8 +30,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SRC_COMPONENTS_INCLUDE_TEST_POLICY_MOCK_POLICY_MANAGER_H_ -#define SRC_COMPONENTS_INCLUDE_TEST_POLICY_MOCK_POLICY_MANAGER_H_ +#ifndef SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_REGULAR_POLICY_MOCK_POLICY_MANAGER_H_ +#define SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_REGULAR_POLICY_MOCK_POLICY_MANAGER_H_ #include <string> #include <vector> @@ -147,6 +147,24 @@ class MockPolicyManager : public PolicyManager { StatusNotifier( const std::string& application_id, const rpc::policy_table_interface_base::AppHmiTypes& hmi_types)); +#ifdef SDL_REMOTE_CONTROL + MOCK_METHOD2(SetDefaultHmiTypes, + void(const std::string& application_id, + const std::vector<int>& hmi_types)); + MOCK_METHOD2(GetHMITypes, + bool(const std::string& application_id, + std::vector<int>* app_types)); + MOCK_METHOD2(CheckModule, + bool(const PTString& app_id, const PTString& module)); + MOCK_METHOD2(SendAppPermissionsChanged, + void(const std::string& device_id, + const std::string& application_id)); + MOCK_CONST_METHOD2(GetModuleTypes, + bool(const std::string& policy_app_id, + std::vector<std::string>* modules)); + MOCK_METHOD1(set_access_remote, + void(utils::SharedPtr<AccessRemote> access_remote)); +#endif // SDL_REMOTE_CONTROL MOCK_METHOD0(CleanupUnpairedDevices, bool()); MOCK_CONST_METHOD1(CanAppKeepContext, bool(const std::string& app_id)); MOCK_CONST_METHOD1(CanAppStealFocus, bool(const std::string& app_id)); @@ -210,4 +228,4 @@ class MockPolicyManager : public PolicyManager { } // namespace components } // namespace test -#endif // SRC_COMPONENTS_INCLUDE_TEST_POLICY_MOCK_POLICY_MANAGER_H_ +#endif // SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_REGULAR_POLICY_MOCK_POLICY_MANAGER_H_ diff --git a/src/components/include/test/protocol_handler/mock_protocol_handler.h b/src/components/include/test/protocol_handler/mock_protocol_handler.h index 44287edd4d..37fbbb9742 100644 --- a/src/components/include/test/protocol_handler/mock_protocol_handler.h +++ b/src/components/include/test/protocol_handler/mock_protocol_handler.h @@ -62,6 +62,13 @@ class MockProtocolHandler : public ::protocol_handler::ProtocolHandler { MOCK_CONST_METHOD0(get_settings, const ::protocol_handler::ProtocolHandlerSettings&()); MOCK_METHOD0(get_session_observer, protocol_handler::SessionObserver&()); + MOCK_METHOD6(NotifySessionStartedResult, + void(int32_t connection_id, + uint8_t session_id, + uint8_t generated_session_id, + uint32_t hash_id, + bool protection, + std::vector<std::string>& rejected_params)); }; } // namespace protocol_handler_test } // namespace components diff --git a/src/components/include/test/protocol_handler/mock_protocol_handler_settings.h b/src/components/include/test/protocol_handler/mock_protocol_handler_settings.h index d12e7899e0..8ddeded889 100644 --- a/src/components/include/test/protocol_handler/mock_protocol_handler_settings.h +++ b/src/components/include/test/protocol_handler/mock_protocol_handler_settings.h @@ -43,6 +43,10 @@ class MockProtocolHandlerSettings : public protocol_handler::ProtocolHandlerSettings { public: MOCK_CONST_METHOD0(maximum_payload_size, size_t()); + MOCK_CONST_METHOD0(maximum_control_payload_size, size_t()); + MOCK_CONST_METHOD0(maximum_rpc_payload_size, size_t()); + MOCK_CONST_METHOD0(maximum_audio_payload_size, size_t()); + MOCK_CONST_METHOD0(maximum_video_payload_size, size_t()); MOCK_CONST_METHOD0(message_frequency_count, size_t()); MOCK_CONST_METHOD0(message_frequency_time, size_t()); MOCK_CONST_METHOD0(malformed_message_filtering, bool()); diff --git a/src/components/include/test/protocol_handler/mock_session_observer.h b/src/components/include/test/protocol_handler/mock_session_observer.h index c376cb85f5..4d2072624d 100644 --- a/src/components/include/test/protocol_handler/mock_session_observer.h +++ b/src/components/include/test/protocol_handler/mock_session_observer.h @@ -46,6 +46,7 @@ namespace protocol_handler_test { */ class MockSessionObserver : public ::protocol_handler::SessionObserver { public: + // DEPRECATED MOCK_METHOD5( OnSessionStartedCallback, uint32_t(const transport_manager::ConnectionUID connection_handle, @@ -53,12 +54,24 @@ class MockSessionObserver : public ::protocol_handler::SessionObserver { const protocol_handler::ServiceType& service_type, const bool is_protected, uint32_t* hash_id)); + MOCK_METHOD5(OnSessionStartedCallback, + void(const transport_manager::ConnectionUID connection_handle, + const uint8_t sessionId, + const protocol_handler::ServiceType& service_type, + const bool is_protected, + const BsonObject* params)); MOCK_METHOD4( OnSessionEndedCallback, uint32_t(const transport_manager::ConnectionUID connection_handle, const uint8_t sessionId, const uint32_t& hashCode, const protocol_handler::ServiceType& service_type)); + MOCK_METHOD4( + OnSessionEndedCallback, + uint32_t(const transport_manager::ConnectionUID connection_handle, + const uint8_t sessionId, + uint32_t* hashCode, + const protocol_handler::ServiceType& service_type)); MOCK_METHOD1(OnApplicationFloodCallBack, void(const uint32_t& connection_key)); MOCK_METHOD1(OnMalformedMessageCallback, diff --git a/src/components/include/utils/macro.h b/src/components/include/utils/macro.h index 0e029e4b06..4cf76fe022 100644 --- a/src/components/include/utils/macro.h +++ b/src/components/include/utils/macro.h @@ -113,6 +113,13 @@ return; \ } +#define EXPORT_FUNCTION(TypeName) extern "C" TypeName* Create(); + +#define EXPORT_FUNCTION_IMPL(TypeName) \ + extern "C" TypeName* Create() { \ + return new TypeName(); \ + } + #define NOTREACHED() DCHECK(!"Unreachable code") // Allows to perform static check that virtual function from base class is @@ -134,6 +141,8 @@ #ifdef BUILD_TESTS #define FRIEND_TEST(test_case_name, test_name) \ friend class test_case_name##_##test_name##_Test -#endif +#else // BUILD_TESTS +#define FRIEND_TEST(test_case_name, test_name) +#endif // BUILD_TESTS #endif // SRC_COMPONENTS_INCLUDE_UTILS_MACRO_H_ diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml index 0d6d5fad3d..32360aa357 100644 --- a/src/components/interfaces/HMI_API.xml +++ b/src/components/interfaces/HMI_API.xml @@ -1,7 +1,10 @@ <?xml version="1.0" standalone="yes"?> <!-- -* Copyright (c) 2016, Ford Motor Company + * Copyright (c) 2016, Ford Motor Company + * All rights reserved. + * + * Copyright (c) 2017 Xevo Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -63,6 +66,7 @@ <element name="USER_DISALLOWED" value="23"/> <element name="TRUNCATED_DATA" value="24"/> <element name="SAVED" value="25"/> + <element name="READ_ONLY" value="26"/> </enum> <enum name="TransportType"> @@ -92,6 +96,27 @@ <element name="PRESET_9"/> <element name="CUSTOM_BUTTON"/> <element name="SEARCH"/> + <!-- Climate Buttons --> + <element name="AC_MAX" /> + <element name="AC" /> + <element name="RECIRCULATE" /> + <element name="FAN_UP" /> + <element name="FAN_DOWN" /> + <element name="TEMP_UP" /> + <element name="TEMP_DOWN" /> + <element name="DEFROST_MAX" /> + <element name="DEFROST" /> + <element name="DEFROST_REAR" /> + <element name="UPPER_VENT" /> + <element name="LOWER_VENT" /> + + <!-- Radio Buttons --> + <element name="VOLUME_UP" /> + <element name="VOLUME_DOWN" /> + <element name="EJECT" /> + <element name="SOURCE" /> + <element name="SHUFFLE" /> + <element name="REPEAT" /> </enum> <enum name="ButtonEventMode"> @@ -200,6 +225,36 @@ <element name="SK-SK" internal_name="SK_SK"> <description>Slovak - Slovakia</description> </element> + <element name="EN-IN" internal_name="EN_IN"> + <description>English - India</description> + </element> + <element name="TH-TH" internal_name="TH_TH"> + <description>Thai - Thailand</description> + </element> + <element name="EN-SA" internal_name="EN_SA"> + <description>English - Middle East</description> + </element> + <element name="HE-IL" internal_name="HE_IL"> + <description>Hebrew - Israel</description> + </element> + <element name="RO-RO" internal_name="RO_RO"> + <description>Romanian - Romania</description> + </element> + <element name="UK-UA" internal_name="UK_UA"> + <description>Ukrainian - Ukraine</description> + </element> + <element name="ID-ID" internal_name="ID_ID"> + <description>Indonesian - Indonesia</description> + </element> + <element name="VI-VN" internal_name="VI_VN"> + <description>Vietnamese - Vietnam</description> + </element> + <element name="MS-MY" internal_name="MS_MY"> + <description>Malay - Malaysia</description> + </element> + <element name="HI-IN" internal_name="HI_IN"> + <description>Hindi - India</description> + </element> </enum> <enum name="SoftButtonType"> @@ -234,6 +289,8 @@ <element name="BACKGROUND_PROCESS" /> <element name="TESTING" /> <element name="SYSTEM" /> + <element name="PROJECTION" /> + <element name="REMOTE_CONTROL" /> </enum> <enum name="WayPointType"> @@ -502,6 +559,45 @@ <element name="turnText"/> </enum> +<enum name="MetadataType"> + <element name="mediaTitle"> + <description>The data in this field contains the title of the currently playing audio track.</description> + </element> + <element name="mediaArtist"> + <description>The data in this field contains the artist or creator of the currently playing audio track.</description> + </element> + <element name="mediaAlbum"> + <description>The data in this field contains the album title of the currently playing audio track.</description> + </element> + <element name="mediaYear"> + <description>The data in this field contains the creation year of the currently playing audio track.</description> + </element> + <element name="mediaGenre"> + <description>The data in this field contains the genre of the currently playing audio track.</description> + </element> + <element name="mediaStation"> + <description>The data in this field contains the name of the current source for the media.</description> + </element> + <element name="rating"> + <description>The data in this field is a rating.</description> + </element> + <element name="currentTemperature"> + <description>The data in this field is the current temperature.</description> + </element> + <element name="maximumTemperature"> + <description>The data in this field is the maximum temperature for the day.</description> + </element> + <element name="minimumTemperature"> + <description>The data in this field is the minimum temperature for the day.</description> + </element> + <element name="weatherTerm"> + <description>The data in this field describes the current weather (ex. cloudy, clear, etc.).</description> + </element> + <element name="humidity"> + <description>The data in this field describes the current humidity value.</description> + </element> +</enum> + <enum name="ImageFieldName"> <element name="softButtonImage"> <description>The image field for SoftButton</description> @@ -824,6 +920,7 @@ <element name="BEGIN"/> <element name="MOVE"/> <element name="END"/> + <element name="CANCEL"/> </enum> <enum name="WarningLightStatus"> @@ -1206,6 +1303,86 @@ <element name="QUEUE" /> </enum> +<enum name="VideoStreamingProtocol"> + <description>Enum for each type of video streaming protocol type.</description> + <element name="RAW"> + <description> + Raw stream bytes that contains no timestamp data and is the lowest supported video streaming + </description> + </element> + <element name="RTP"> + <description> + RTP facilitates the transfer of real-time data. Information provided by this protocol include + timestamps (for synchronization), sequence numbers (for packet loss and reordering detection) + and the payload format which indicates the encoded format of the data. + </description> + </element> + <element name="RTSP"> + <description> + The transmission of streaming data itself is not a task of RTSP. Most RTSP servers use the + Real-time Transport Protocol (RTP) in conjunction with Real-time Control Protocol (RTCP) + for media stream delivery. However, some vendors implement proprietary transport protocols. + </description> + </element> + <element name="RTMP"> + <description> + Real-Time Messaging Protocol (RTMP) was initially a proprietary protocol developed by + Macromedia for streaming audio, video and data over the Internet, between a Flash player + and a server. Macromedia is now owned by Adobe, which has released an incomplete version + of the specification of the protocol for public use. + </description> + </element> + <element name="WEBM"> + <description> + The WebM container is based on a profile of Matroska. WebM initially supported VP8 video and + Vorbis audio streams. In 2013 it was updated to accommodate VP9 video and Opus audio. + </description> + </element> +</enum> + +<enum name="VideoStreamingCodec"> + <description>Enum for each type of video streaming codec.</description> + <element name="H264"> + <description> + A block-oriented motion-compensation-based video compression standard. + As of 2014 it is one of the most commonly used formats for the recording, compression, and + distribution of video content. + </description> + </element> + <element name="H265"> + <description> + High Efficiency Video Coding (HEVC), also known as H.265 and MPEG-H Part 2, is a video + compression standard, one of several potential successors to the widely used AVC (H.264 or + MPEG-4 Part 10). In comparison to AVC, HEVC offers about double the data compression ratio + at the same level of video quality, or substantially improved video quality at the same + bit rate. It supports resolutions up to 8192x4320, including 8K UHD. + </description> + </element> + <element name="Theora"> + <description> + Theora is derived from the formerly proprietary VP3 codec, released into the public domain + by On2 Technologies. It is broadly comparable in design and bitrate efficiency to + MPEG-4 Part 2, early versions of Windows Media Video, and RealVideo while lacking some of + the features present in some of these other codecs. It is comparable in open standards + philosophy to the BBC's Dirac codec. + </description> + </element> + <element name="VP8"> + <description> + VP8 can be multiplexed into the Matroska-based container format WebM along with Vorbis and + Opus audio. The image format WebP is based on VP8's intra-frame coding. VP8's direct + successor, VP9, and the emerging royalty-free internet video format AV1 from the Alliance for + Open Media (AOMedia) are based on VP8. + </description> + </element> + <element name="VP9"> + <description> + Similar to VP8, but VP9 is customized for video resolutions beyond high-definition video (UHD) + and also enables lossless compression. + </description> + </element> +</enum> + <!-- Policies --> <enum name="UpdateResult"> <element name="UP_TO_DATE"/> @@ -1278,17 +1455,299 @@ </struct> <!-- End of Policies --> +<!-- Remote Control --> +<enum name="ModuleType"> + <element name="CLIMATE"/> + <element name="RADIO"/> + </enum> + + <enum name="RadioBand"> + <element name="AM"/> + <element name="FM"/> + <element name="XM"/> + </enum> + + <struct name="RdsData"> + <param name="PS" type="String" minlength="0" maxlength="8" mandatory="false"> + <description>Program Service Name</description> + </param> + <param name="RT" type="String" minlength="0" maxlength="64" mandatory="false"> + <description>Radio Text</description> + </param> + <param name="CT" type="String" minlength="24" maxlength="24" mandatory="false"> + <description>The clock text in UTC format as YYYY-MM-DDThh:mm:ss.sTZD</description> + </param> + <param name="PI" type="String" minlength="0" maxlength="6" mandatory="false"> + <description>Program Identification - the call sign for the radio station</description> + </param> + <param name="PTY" type="Integer" minvalue="0" maxvalue="31" mandatory="false"> + <description>The program type - The region should be used to differentiate between EU and North America program types</description> + </param> + <param name="TP" type="Boolean" mandatory="false"> + <description>Traffic Program Identification - Identifies a station that offers traffic</description> + </param> + <param name="TA" type="Boolean" mandatory="false"> + <description>Traffic Announcement Identification - Indicates an ongoing traffic announcement</description> + </param> + <param name="REG" type="String" mandatory="false"> + <description>Region</description> + </param> + </struct> + + <enum name="RadioState"> + <element name="ACQUIRING"/> + <element name="ACQUIRED"/> + <element name="MULTICAST"/> + <element name="NOT_FOUND"/> + </enum> + + <struct name="RadioControlData"> + <param name="frequencyInteger" type="Integer" minvalue="0" maxvalue="1710" mandatory="false"> + <description>The integer part of the frequency ie for 101.7 this value should be 101</description> + </param> + <param name="frequencyFraction" type="Integer" minvalue="0" maxvalue="9" mandatory="false"> + <description>The fractional part of the frequency for 101.7 is 7</description> + </param> + <param name="band" type="Common.RadioBand" mandatory="false"> + </param> + <param name="rdsData" type="Common.RdsData" mandatory="false"> + </param> + <param name="availableHDs" type="Integer" minvalue="1" maxvalue="3" mandatory="false"> + <description>number of HD sub-channels if available</description> + </param> + <param name="hdChannel" type="Integer" minvalue="1" maxvalue="3" mandatory="false"> + <description>Current HD sub-channel if available</description> + </param> + <param name="signalStrength" type="Integer" minvalue="0" maxvalue="100" mandatory="false"> + </param> + <param name="signalChangeThreshold" type="Integer" minvalue="0" maxvalue="100" mandatory="false"> + <description>If the signal strength falls below the set value for this parameter, the radio will tune to an alternative frequency</description> + </param> + <param name="radioEnable" type="Boolean" mandatory="false"> + <description> True if the radio is on, false is the radio is off</description> + </param> + <param name="state" type="Common.RadioState" mandatory="false"> + </param> + </struct> + + <struct name="RadioControlCapabilities"> + <description>Contains information about a radio control module's capabilities.</description> + <param name="moduleName" type="String" maxlength="100" mandatory="true" > + <description>The short name or a short description of the radio control module.</description> + </param> + <param name="radioEnableAvailable" type="Boolean" mandatory="false"> + <description> + Availability of the control of enable/disable radio. + True: Available, False: Not Available, Not present: Not Available. + </description> + </param> + <param name="radioBandAvailable" type="Boolean" mandatory="false" > + <description> + Availability of the control of radio band. + True: Available, False: Not Available, Not present: Not Available. + </description> + </param> + <param name="radioFrequencyAvailable" type="Boolean" mandatory="false" > + <description> + Availability of the control of radio frequency. + True: Available, False: Not Available, Not present: Not Available. + </description> + </param> + <param name="hdChannelAvailable" type="Boolean" mandatory="false" > + <description> + Availability of the control of HD radio channel. + True: Available, False: Not Available, Not present: Not Available. + </description> + </param> + <param name="rdsDataAvailable" type="Boolean" mandatory="false" > + <description> + Availability of the getting Radio Data System (RDS) data. + True: Available, False: Not Available, Not present: Not Available. + </description> + </param> + <param name="availableHDsAvailable" type="Boolean" mandatory="false" > + <description> + Availability of the getting the number of available HD channels. + True: Available, False: Not Available, Not present: Not Available. + </description> + </param> + <param name="stateAvailable" type="Boolean" mandatory="false" > + <description> + Availability of the getting the Radio state. + True: Available, False: Not Available, Not present: Not Available. + </description> + </param> + <param name="signalStrengthAvailable" type="Boolean" mandatory="false" > + <description> + Availability of the getting the signal strength. + True: Available, False: Not Available, Not present: Not Available. + </description> + </param> + <param name="signalChangeThresholdAvailable" type="Boolean" mandatory="false" > + <description> + Availability of the getting the signal Change Threshold. + True: Available, False: Not Available, Not present: Not Available. + </description> + </param> + </struct> + + <enum name="DefrostZone"> + <element name="FRONT"/> + <element name="REAR"/> + <element name="ALL"/> + <element name="NONE"/> + </enum> + + <enum name="VentilationMode"> + <element name="UPPER"/> + <element name="LOWER"/> + <element name="BOTH"/> + <element name="NONE"/> + </enum> + + <enum name="TemperatureUnit"> + <element name="FAHRENHEIT"/> + <element name="CELSIUS"/> + </enum> + + <struct name="Temperature"> + <param name="unit" type="TemperatureUnit" mandatory="true" > + <description>Temperature Unit</description> + </param> + <param name="value" type="Float" mandatory="true" > + <description>Temperature Value in TemperatureUnit specified unit. Range depends on OEM and is not checked by SDL.</description> + </param> + </struct> + + <struct name="ClimateControlData"> + <param name="fanSpeed" type="Integer" minvalue="0" maxvalue="100" mandatory="false"> + </param> + <param name="currentTemperature" type="Common.Temperature" mandatory="false"> + </param> + <param name="desiredTemperature" type="Common.Temperature" mandatory="false"> + </param> + <param name="acEnable" type="Boolean" mandatory="false"> + </param> + <param name="circulateAirEnable" type="Boolean" mandatory="false"> + </param> + <param name="autoModeEnable" type="Boolean" mandatory="false"> + </param> + <param name="defrostZone" type="DefrostZone" mandatory="false"> + </param> + <param name="dualModeEnable" type="Boolean" mandatory="false"> + </param> + <param name="acMaxEnable" type="Boolean" mandatory="false"> + </param> + <param name="ventilationMode" type="Common.VentilationMode" mandatory="false"> + </param> + </struct> + + <struct name="ClimateControlCapabilities"> + <description>Contains information about a climate control module's capabilities.</description> + <param name="moduleName" type="String" maxlength="100" mandatory="true" > + <description>The short name or a short description of the climate control module.</description> + </param> + <param name="currentTemperatureAvailable" type="Boolean" mandatory="false"> + <description> + Availability of the reading of current temperature. + True: Available, False: Not Available, Not present: Not Available. + </description> + </param> + <param name="fanSpeedAvailable" type="Boolean" mandatory="false"> + <description> + Availability of the control of fan speed. + True: Available, False: Not Available, Not present: Not Available. + </description> + </param> + <param name="desiredTemperatureAvailable" type="Boolean" mandatory="false"> + <description> + Availability of the control of desired temperature. + True: Available, False: Not Available, Not present: Not Available. + </description> + </param> + <param name="acEnableAvailable" type="Boolean" mandatory="false"> + <description> + Availability of the control of turn on/off AC. + True: Available, False: Not Available, Not present: Not Available. + </description> + </param> + <param name="acMaxEnableAvailable" type="Boolean" mandatory="false"> + <description> + Availability of the control of enable/disable air conditioning is ON on the maximum level. + True: Available, False: Not Available, Not present: Not Available. + </description> + </param> + <param name="circulateAirEnableAvailable" type="Boolean" mandatory="false"> + <description> + Availability of the control of enable/disable circulate Air mode. + True: Available, False: Not Available, Not present: Not Available. + </description> + </param> + <param name="autoModeEnableAvailable" type="Boolean" mandatory="false"> + <description> + Availability of the control of enable/disable auto mode. + True: Available, False: Not Available, Not present: Not Available. + </description> + </param> + <param name="dualModeEnableAvailable" type="Boolean" mandatory="false"> + <description> + Availability of the control of enable/disable dual mode. + True: Available, False: Not Available, Not present: Not Available. + </description> + </param> + <param name="defrostZoneAvailable" type="Boolean" mandatory="false"> + <description> + Availability of the control of defrost zones. + True: Available, False: Not Available, Not present: Not Available. + </description> + </param> + <param name="defrostZone" type="Common.DefrostZone" minsize="1" maxsize="100" array="true" mandatory="false"> + <description> + A set of all defrost zones that are controllable. + </description> + </param> + <param name="ventilationModeAvailable" type="Boolean" mandatory="false"> + <description> + Availability of the control of air ventilation mode. + True: Available, False: Not Available, Not present: Not Available. + </description> + </param> + <param name="ventilationMode" type="Common.VentilationMode" minsize="1" maxsize="100" array="true" mandatory="false"> + <description> + A set of all ventilation modes that are controllable. + </description> + </param> + </struct> + + <struct name="ModuleData"> + <description>The moduleType indicates which type of data should be changed and identifies which data object exists in this struct. For example, if the moduleType is CLIMATE then a "climateControlData" should exist</description> + <param name="moduleType" type="Common.ModuleType" mandatory="true" > + </param> + <param name="radioControlData" type="Common.RadioControlData" mandatory="false"> + </param> + <param name="climateControlData" type="Common.ClimateControlData" mandatory="false"> + </param> + </struct> + +<enum name="RCAccessMode"> + <description>Enumeration that describes possible remote control access mode the application might be in on HU.</description> + <element name="AUTO_ALLOW"/> + <element name="AUTO_DENY"/> + <element name="ASK_DRIVER"/> +</enum> + +<!-- End Remote Control --> <struct name="TextField"> - <param name="name" type="Common.TextFieldName"> + <param name="name" type="Common.TextFieldName" mandatory="true"> <description>The name that identifies the field. See TextFieldName.</description> </param> - <param name="characterSet" type="Common.CharacterSet"> + <param name="characterSet" type="Common.CharacterSet" mandatory="true"> <description>The character set that is supported in this field. See CharacterSet.</description> </param> - <param name="width" type="Integer" minvalue="1" maxvalue="500"> + <param name="width" type="Integer" minvalue="1" maxvalue="500" mandatory="true"> <description>The number of characters in one row of this field.</description> </param> - <param name="rows" type="Integer" minvalue="1" maxvalue="8"> + <param name="rows" type="Integer" minvalue="1" maxvalue="8" mandatory="true"> <description>The number of rows of this field.</description> </param> </struct> @@ -1311,10 +1770,10 @@ <struct name="VehicleDataResult"> <description>Individual published data request result</description> - <param name="dataType" type="Common.VehicleDataType"> + <param name="dataType" type="Common.VehicleDataType" mandatory="true"> <description>Defined published data element type.</description> </param> - <param name="resultCode" type="Common.VehicleDataResultCode"> + <param name="resultCode" type="Common.VehicleDataResultCode" mandatory="true"> <description>Published data result code.</description> </param> </struct> @@ -1569,6 +2028,32 @@ </param> </struct> +<struct name="VideoStreamingFormat"> + <description>Video streaming formats and their specifications.</description> + <param name="protocol" type="Common.VideoStreamingProtocol" mandatory="true"> + <description>Protocol type, see VideoStreamingProtocol</description> + </param> + <param name="codec" type="Common.VideoStreamingCodec" mandatory="true"> + <description>Codec type, see VideoStreamingCodec</description> + </param> +</struct> + +<struct name="VideoConfig"> + <description>Configuration of a video stream.</description> + <param name="protocol" type="Common.VideoStreamingProtocol" mandatory="false"> + <description>The video protocol configuration</description> + </param> + <param name="codec" type="Common.VideoStreamingCodec" mandatory="false"> + <description>The video codec configuration</description> + </param> + <param name="width" type="Integer" mandatory="false"> + <description>Width of the video stream, in pixels.</description> + </param> + <param name="height" type="Integer" mandatory="false"> + <description>Height of the video stream, in pixels.</description> + </param> +</struct> + <struct name="DisplayCapabilities"> <description>Contains information about the display capabilities.</description> <param name="displayType" type="Common.DisplayType" mandatory="true"> @@ -1646,6 +2131,9 @@ <param name="fieldText" type="String" maxlength="500" mandatory="true"> <description>The text itself.</description> </param> + <param name="fieldTypes" type="Common.MetadataType" minsize="0" maxsize="5" array="true" mandatory="false"> + <description>The type of data contained in the field.</description> + </param> </struct> <struct name="KeyboardProperties"> @@ -1924,73 +2412,73 @@ </struct> <struct name="ECallInfo"> - <param name="eCallNotificationStatus" type="Common.VehicleDataNotificationStatus"> + <param name="eCallNotificationStatus" type="Common.VehicleDataNotificationStatus" mandatory="true"> <description>References signal "eCallNotification_4A". See VehicleDataNotificationStatus.</description> </param> - <param name="auxECallNotificationStatus" type="Common.VehicleDataNotificationStatus"> + <param name="auxECallNotificationStatus" type="Common.VehicleDataNotificationStatus" mandatory="true"> <description>References signal "eCallNotification". See VehicleDataNotificationStatus.</description> </param> - <param name="eCallConfirmationStatus" type="Common.ECallConfirmationStatus"> + <param name="eCallConfirmationStatus" type="Common.ECallConfirmationStatus" mandatory="true"> <description>References signal "eCallConfirmation". See ECallConfirmationStatus.</description> </param> </struct> <struct name="AirbagStatus"> - <param name="driverAirbagDeployed" type="Common.VehicleDataEventStatus"> + <param name="driverAirbagDeployed" type="Common.VehicleDataEventStatus" mandatory="true"> <description>References signal "VedsDrvBag_D_Ltchd". See VehicleDataEventStatus.</description> </param> - <param name="driverSideAirbagDeployed" type="Common.VehicleDataEventStatus"> + <param name="driverSideAirbagDeployed" type="Common.VehicleDataEventStatus" mandatory="true"> <description>References signal "VedsDrvSideBag_D_Ltchd". See VehicleDataEventStatus.</description> </param> - <param name="driverCurtainAirbagDeployed" type="Common.VehicleDataEventStatus"> + <param name="driverCurtainAirbagDeployed" type="Common.VehicleDataEventStatus" mandatory="true"> <description>References signal "VedsDrvCrtnBag_D_Ltchd". See VehicleDataEventStatus.</description> </param> - <param name="passengerAirbagDeployed" type="Common.VehicleDataEventStatus"> + <param name="passengerAirbagDeployed" type="Common.VehicleDataEventStatus" mandatory="true"> <description>References signal "VedsPasBag_D_Ltchd". See VehicleDataEventStatus.</description> </param> - <param name="passengerCurtainAirbagDeployed" type="Common.VehicleDataEventStatus"> + <param name="passengerCurtainAirbagDeployed" type="Common.VehicleDataEventStatus" mandatory="true"> <description>References signal "VedsPasCrtnBag_D_Ltchd". See VehicleDataEventStatus.</description> </param> - <param name="driverKneeAirbagDeployed" type="Common.VehicleDataEventStatus"> + <param name="driverKneeAirbagDeployed" type="Common.VehicleDataEventStatus" mandatory="true"> <description>References signal "VedsKneeDrvBag_D_Ltchd". See VehicleDataEventStatus.</description> </param> - <param name="passengerSideAirbagDeployed" type="Common.VehicleDataEventStatus"> + <param name="passengerSideAirbagDeployed" type="Common.VehicleDataEventStatus" mandatory="true"> <description>References signal "VedsPasSideBag_D_Ltchd". See VehicleDataEventStatus.</description> </param> - <param name="passengerKneeAirbagDeployed" type="Common.VehicleDataEventStatus"> + <param name="passengerKneeAirbagDeployed" type="Common.VehicleDataEventStatus" mandatory="true"> <description>References signal "VedsKneePasBag_D_Ltchd". See VehicleDataEventStatus.</description> </param> </struct> <struct name="EmergencyEvent"> - <param name="emergencyEventType" type="Common.EmergencyEventType"> + <param name="emergencyEventType" type="Common.EmergencyEventType" mandatory="true"> <description>References signal "VedsEvntType_D_Ltchd". See EmergencyEventType.</description> </param> - <param name="fuelCutoffStatus" type="Common.FuelCutoffStatus"> + <param name="fuelCutoffStatus" type="Common.FuelCutoffStatus" mandatory="true"> <description>References signal "RCM_FuelCutoff". See FuelCutoffStatus.</description> </param> - <param name="rolloverEvent" type="Common.VehicleDataEventStatus"> + <param name="rolloverEvent" type="Common.VehicleDataEventStatus" mandatory="true"> <description>References signal "VedsEvntRoll_D_Ltchd". See VehicleDataEventStatus.</description> </param> - <param name="maximumChangeVelocity" type="Common.VehicleDataEventStatus"> + <param name="maximumChangeVelocity" type="Common.VehicleDataEventStatus" mandatory="true"> <description>References signal "VedsMaxDeltaV_D_Ltchd". See VehicleDataEventStatus.</description> </param> - <param name="multipleEvents" type="Common.VehicleDataEventStatus"> + <param name="multipleEvents" type="Common.VehicleDataEventStatus" mandatory="true"> <description>References signal "VedsMultiEvnt_D_Ltchd". See VehicleDataEventStatus.</description> </param> </struct> <struct name="ClusterModeStatus"> - <param name="powerModeActive" type="Boolean"> + <param name="powerModeActive" type="Boolean" mandatory="true"> <description>References signal "PowerMode_UB".</description> </param> - <param name="powerModeQualificationStatus" type="Common.PowerModeQualificationStatus"> + <param name="powerModeQualificationStatus" type="Common.PowerModeQualificationStatus" mandatory="true"> <description>References signal "PowerModeQF". See PowerModeQualificationStatus.</description> </param> - <param name="carModeStatus" type="Common.CarModeStatus"> + <param name="carModeStatus" type="Common.CarModeStatus" mandatory="true"> <description>References signal "CarMode". See CarMode.</description> </param> - <param name="powerModeStatus" type="Common.PowerModeStatus"> + <param name="powerModeStatus" type="Common.PowerModeStatus" mandatory="true"> <description>References signal "PowerMode". See PowerMode.</description> </param> </struct> @@ -2086,6 +2574,89 @@ </param> </struct> + <struct name="NavigationCapability"> + <description>Extended capabilities for an onboard navigation system</description> + <param name="sendLocationEnabled" type="Boolean" mandatory="false"> + <description>If the module has the ability to add locations to the onboard nav</description> + </param> + <param name="getWayPointsEnabled" type="Boolean" mandatory="false"> + <description>If the module has the ability to return way points from onboard nav</description> + </param> + </struct> + + <struct name="PhoneCapability"> + <description>Extended capabilities of the module's phone feature</description> + <param name="dialNumberEnabled" type="Boolean" mandatory="false"> + <description>If the module has the abiulity to perform dial number</description> + </param> + </struct> + + <struct name="VideoStreamingCapability"> + <description>Contains information about this system's video streaming capabilities.</description> + <param name="preferredResolution" type="Common.ImageResolution" mandatory="false"> + <description>The preferred resolution of a video stream for decoding and rendering on HMI.</description> + </param> + <param name="maxBitrate" type="Integer" minvalue="0" maxvalue="2147483647" mandatory="false"> + <description>The maximum bitrate of video stream that is supported, in kbps.</description> + </param> + <param name="supportedFormats" type="Common.VideoStreamingFormat" array="true" mandatory="false"> + <description> + Detailed information on each format supported by this system, in its preferred order + (i.e. the first element in the array is most preferable to the system). + Each object will contain a VideoStreamingFormat that describes what can be expected. + </description> + </param> + <param name="hapticSpatialDataSupported" type="Boolean" mandatory="false"> + <description>True if the system can utilize the haptic spatial data from the source being streamed. </description> + </param> + </struct> + + <struct name="SystemCapabilities"> + <param name="navigationCapability" type="NavigationCapability" mandatory="false"> + </param> + <param name="phoneCapability" type="PhoneCapability" mandatory="false"> + </param> + <param name="videoStreamingCapability" type="VideoStreamingCapability" mandatory="false"> + </param> + </struct> + + <struct name="RemoteControlCapabilities"> + <param name="climateControlCapabilities" type="ClimateControlCapabilities" mandatory="false" minsize="1" maxsize="100" array="true"> + <description>If included, the platform supports RC climate controls. For this baseline version, maxsize=1. i.e. only one climate control module is supported.</description > + </param> + <param name="radioControlCapabilities" type="RadioControlCapabilities" mandatory="false" minsize="1" maxsize="100" array="true"> + <description>If included, the platform supports RC radio controls. For this baseline version, maxsize=1. i.e. only one climate control module is supported.</description > + </param> + <param name="buttonCapabilities" type="ButtonCapabilities" mandatory="false" minsize="1" maxsize="100" array="true" > + <description>If included, the platform supports RC button controls with the included button names.</description > + </param> + </struct> + + <struct name="Rectangle"> + <param name="x" type="Float" mandatory="true"> + <description>The X-coordinate of the user control</description> + </param> + <param name="y" type="Float" mandatory="true"> + <description>The Y-coordinate of the user control</description> + </param> + <param name="width" type="Float" mandatory="true"> + <description>The width of the user control's bounding rectangle</description> + </param> + <param name="height" type="Float" mandatory="true"> + <description>The height of the user control's bounding rectangle</description> + </param> + </struct> + + <struct name="HapticRect"> + <description>Defines haptic rectangle data for each user control object for video streaming application</description> + <param name="id" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true"> + <description>A user control spatial identifier</description> + </param> + <param name="rect" type="Common.Rectangle" mandatory="true"> + <description>The position of the haptic rectangle to be highlighted. The center of this rectangle will be "touched" when a press occurs.</description> + </param> + </struct> + </interface> <interface name="Buttons" version="1.2.0" date="2017-04-27"> @@ -2100,6 +2671,23 @@ <description>Must be returned if the platform supports custom on-screen Presets</description> </param> </function> + + <function name="ButtonPress" messagetype="request"> + <description>Method is invoked when the application tries to press a button</description> + <param name="moduleType" type="Common.ModuleType" mandatory="true" > + <description>The module where the button should be pressed</description> + </param> + <param name="buttonName" type="Common.ButtonName" mandatory="true" /> + <param name="buttonPressMode" type="Common.ButtonPressMode" mandatory="true" > + <description>Indicates whether this is a LONG or SHORT button press event.</description> + </param> + <param name="appID" type="Integer" mandatory="true"> + <description>ID of the application that triggers the permission prompt.</description> + </param> + </function> + <function name="ButtonPress" messagetype="response"> + </function> + <function name="OnButtonEvent" messagetype="notification"> <description>HU system must notify about every UP/DOWN event for buttons</description> <param name="name" type="Common.ButtonName" mandatory="true"/> @@ -2317,7 +2905,7 @@ </function> <function name="DialNumber" messagetype="request"> <description>Request from SDL to call a specific number.</description> - <param name="number" type="String" maxlength="40"> + <param name="number" type="String" maxlength="40" mandatory="true"> <description>The number to dial. Only the character + and numbers are allowed.</description> </param> <param name="appID" type="Integer" mandatory="true"> @@ -2953,7 +3541,7 @@ <description>Optional text to label an app menu button (for certain touchscreen platforms).</description> </param> <param name="menuIcon" type="Common.Image" mandatory="false"> - <description>>Optional icon to draw on an app menu button (for certain touchscreen platforms).</description> + <description>Optional icon to draw on an app menu button (for certain touchscreen platforms).</description> </param> <param name="keyboardProperties" type="Common.KeyboardProperties" mandatory="false"> <description>On-screen keybaord configuration (if available).</description> @@ -3000,6 +3588,9 @@ <param name="hmiCapabilities" type="Common.HMICapabilities" mandatory="false"> <description>Specifies the HMI’s capabilities. See HMICapabilities.</description> </param> + <param name="systemCapabilities" type="Common.SystemCapabilities" mandatory="false"> + <description>Specifies system capabilities. See SystemCapabilities</description> + </param> </function> <function name="ChangeRegistration" messagetype="request"> <description>Request from SmartDeviceLink to HMI to change language for app.</description> @@ -3252,6 +3843,22 @@ <description>ID of application related to this RPC.</description> </param> </function> + <function name="SendHapticData" messagetype="request"> + <description>Send the UI spatial data from MOBILE. This data will be utilized by the HMI to determine how and when haptic events should occur</description> + <param name="appID" type="Integer" mandatory="true"> + <description>Internal ID of the application that requested this RPC.</description> + </param> + <param name="hapticRectData" type="Common.HapticRect" minsize="0" maxsize="1000" mandatory="false" array="true"> + <description> + Array of rectangle data structures that represent the locations of all user controls present on the HMI. + This data should be updated if/when the application presents a new screen. + When a request is sent, if successful, it will replace all rectangle data previously sent through RPC. + Avoidance of doubt, when an empty hapticRectData, it will be clear all rectangle data previously sent through RPC. + </description> + </param> + </function> + <function name="SendHapticData" messagetype="response"> + </function> </interface> <interface name="Navigation" version="1.4.0" date="2017-04-27"> @@ -3369,6 +3976,27 @@ <description>Current State of TBT client</description> </param> </function> + <function name="SetVideoConfig" messagetype="request"> + <description>Request from SDL to HMI to ask whether HMI accepts a video stream with given configuration.</description> + <param name="config" type="Common.VideoConfig" mandatory="true"> + <description>Configuration of a video stream.</description> + </param> + <param name="appID" type="Integer" mandatory="true"> + <description>ID of application related to this RPC.</description> + </param> + </function> + <function name="SetVideoConfig" messagetype="response"> + <description> + Response from HMI to SDL whether the configuration is accepted. + In a negative response, a list of rejected parameters are supplied. + </description> + <param name="rejectedParams" type="String" array="true" minsize="1" maxsize="1000" mandatory="false"> + <description> + List of params of VideoConfig struct which are not accepted by HMI, e.g. "protocol" and "codec". + This param exists only when the response is negative. + </description> + </param> + </function> <function name="StartStream" messagetype="request"> <description>Request from SmartDeviceLinkCore to HMI to start playing video streaming.</description> <param name="url" type="String" minlength="21" maxlength="500" mandatory="true"> @@ -4255,4 +4883,94 @@ <param name="deviceId" type="Common.DeviceInfo" mandatory="false"/> </function> </interface> + +<interface name="RC" version="1.1" date="2017-07-18"> + <function name="IsReady" messagetype="request"> + <description>Method is invoked at system startup. Response should provide information about presence of any of remote controllable module and its readiness to cooperate with SDL.</description> + </function> + <function name="IsReady" messagetype="response"> + <param name="available" type="Boolean" mandatory="true"> + <description>Must be true if vehicle RC modules are present and ready to communicate with SDL.</description> + </param> + </function> + + <function name="GetCapabilities" messagetype="request"> + <description>Method is invoked at system startup by SDL to request information about Remote Control capabilities of HMI.</description> + </function> + <function name="GetCapabilities" messagetype="response"> + <param name="remoteControlCapability" type="Common.RemoteControlCapabilities" mandatory="false"> + <description>See RemoteControlCapabilities, all available RC modules and buttons shall be returned.</description> + </param> + </function> + + <function name="SetInteriorVehicleData" functionID="SetInteriorVehicleDataID" messagetype="request"> + <param name="moduleData" type="Common.ModuleData" mandatory="true" > + <description>The module type and data to set</description> + </param> + <param name="appID" type="Integer" mandatory="true"> + <description>Internal SDL-assigned ID of the related application</description> + </param> + </function> + + <function name="SetInteriorVehicleData" messagetype="response"> + <description>Used to set the values of one zone and one data type within that zone</description> + <param name="moduleData" type="Common.ModuleData" mandatory="true" > + </param> + </function> + +<function name="GetInteriorVehicleData" messagetype="request"> + <param name="moduleType" type="Common.ModuleType" mandatory="true" > + <description>The module data to retrieve from the vehicle for that type</description> + </param> + <param name="subscribe" type="Boolean" mandatory="false" defvalue="false"> + <description>If subscribe is true, the head unit will send onInteriorVehicleData notifications for the module type</description> + </param> + <param name="appID" type="Integer" mandatory="true"> + <description>Internal SDL-assigned ID of the related application</description> + </param> +</function> + +<function name="GetInteriorVehicleData" messagetype="response"> + <param name="moduleData" type="Common.ModuleData" mandatory="true" > + </param> + <param name="isSubscribed" type="Boolean" mandatory="false" > + <description>Is a conditional-mandatory parameter: must be returned in case "subscribe" parameter was present in the related request. + if "true" - the "moduleType" from request is successfully subscribed and the head unit will send onInteriorVehicleData notifications for the moduleDescription. + if "false" - the "moduleType" from request is either unsubscribed or failed to subscribe.</description> + </param> +</function> + +<function name="GetInteriorVehicleDataConsent" messagetype="request"> + <description>Sender: SDL->HMI. </description> + <description>HMI is expected to display a permission prompt to the driver showing the RC module and app details (for example, app's name). + The driver is expected to have an ability to grant or deny the permission.</description> + <param name="moduleType" type="Common.ModuleType" mandatory="true"> + <description>The module type that the app requests to control.</description> + </param> + <param name="appID" type="Integer" mandatory="true"> + <description>ID of the application that triggers the permission prompt.</description> + </param> + </function> + <function name="GetInteriorVehicleDataConsent" messagetype="response"> + <param name="allowed" type="Boolean" mandatory="true"> + <description>"true" - if the driver grants the permission for controlling to the named app; + "false" - in case the driver denies the permission for controlling to the named app.</description> + </param> +</function> + +<function name="OnInteriorVehicleData" messagetype="notification"> + <param name="moduleData" type="Common.ModuleData" mandatory="true" > + </param> +</function> + +<function name="OnRemoteControlSettings" messagetype="notification"> + <description>Sender: vehicle -> RSDL. Notification about remote-control settings changed. Sent after User`s choice through HMI.</description> + <param name="allowed" type="Boolean" mandatory="false" > + <description>If "true" - RC is allowed; if "false" - RC is disallowed.</description> + </param> + <param name="accessMode" type="Common.RCAccessMode" mandatory="false" > + <description>The remote control access mode specified by the driver via HMI.</description> + </param> +</function> +</interface> </interfaces> diff --git a/src/components/interfaces/MOBILE_API.xml b/src/components/interfaces/MOBILE_API.xml index 953f270741..73fe9f3d0c 100644 --- a/src/components/interfaces/MOBILE_API.xml +++ b/src/components/interfaces/MOBILE_API.xml @@ -132,6 +132,12 @@ <element name="RESUME_FAILED">
<description>The provided hash ID does not match the hash of the current set of registered data or the core could not resume the previous data.</description>
</element>
+ <element name="DATA_NOT_AVAILABLE">
+ <description>The requested data is not available on this vehicle or is not published for the connected app </description>
+ </element>
+ <element name="READ_ONLY">
+ <description>The value being set is read only</description>
+ </element>
</enum>
<enum name="ButtonPressMode">
@@ -246,6 +252,36 @@ <element name="SK-SK" internal_name="SK_SK">
<description>Slovak - Slovakia</description>
</element>
+ <element name="EN-IN" internal_name="EN_IN">
+ <description>English - India</description>
+ </element>
+ <element name="TH-TH" internal_name="TH_TH">
+ <description>Thai - Thailand</description>
+ </element>
+ <element name="EN-SA" internal_name="EN_SA">
+ <description>English - Middle East</description>
+ </element>
+ <element name="HE-IL" internal_name="HE_IL">
+ <description>Hebrew - Israel</description>
+ </element>
+ <element name="RO-RO" internal_name="RO_RO">
+ <description>Romanian - Romania</description>
+ </element>
+ <element name="UK-UA" internal_name="UK_UA">
+ <description>Ukrainian - Ukraine</description>
+ </element>
+ <element name="ID-ID" internal_name="ID_ID">
+ <description>Indonesian - Indonesia</description>
+ </element>
+ <element name="VI-VN" internal_name="VI_VN">
+ <description>Vietnamese - Vietnam</description>
+ </element>
+ <element name="MS-MY" internal_name="MS_MY">
+ <description>Malay - Malaysia</description>
+ </element>
+ <element name="HI-IN" internal_name="HI_IN">
+ <description>Hindi - India</description>
+ </element>
</enum>
<enum name="UpdateMode">
@@ -449,9 +485,9 @@ Describes different audio type configurations for PerformAudioPassThru.
e.g. {8kHz,8-bit,PCM}
</description>
- <param name="samplingRate" type="SamplingRate"/>
- <param name="bitsPerSample" type="BitsPerSample"/>
- <param name="audioType" type="AudioType"/>
+ <param name="samplingRate" type="SamplingRate" mandatory="true"/>
+ <param name="bitsPerSample" type="BitsPerSample" mandatory="true"/>
+ <param name="audioType" type="AudioType" mandatory="true"/>
</struct>
<enum name="VehicleDataType">
@@ -505,6 +541,28 @@ <element name="PRESET_9" />
<element name="CUSTOM_BUTTON" />
<element name="SEARCH" />
+
+ <!-- Climate Buttons -->
+ <element name="AC_MAX" />
+ <element name="AC" />
+ <element name="RECIRCULATE" />
+ <element name="FAN_UP" />
+ <element name="FAN_DOWN" />
+ <element name="TEMP_UP" />
+ <element name="TEMP_DOWN" />
+ <element name="DEFROST_MAX" />
+ <element name="DEFROST" />
+ <element name="DEFROST_REAR" />
+ <element name="UPPER_VENT" />
+ <element name="LOWER_VENT" />
+
+ <!-- Radio Buttons -->
+ <element name="VOLUME_UP" />
+ <element name="VOLUME_DOWN" />
+ <element name="EJECT" />
+ <element name="SOURCE" />
+ <element name="SHUFFLE" />
+ <element name="REPEAT" />
</enum>
<enum name="MediaClockFormat">
@@ -698,6 +756,45 @@ </enum>
+ <enum name="MetadataType">
+ <element name="mediaTitle">
+ <description>The data in this field contains the title of the currently playing audio track.</description>
+ </element>
+ <element name="mediaArtist">
+ <description>The data in this field contains the artist or creator of the currently playing audio track.</description>
+ </element>
+ <element name="mediaAlbum">
+ <description>The data in this field contains the album title of the currently playing audio track.</description>
+ </element>
+ <element name="mediaYear">
+ <description>The data in this field contains the creation year of the currently playing audio track.</description>
+ </element>
+ <element name="mediaGenre">
+ <description>The data in this field contains the genre of the currently playing audio track.</description>
+ </element>
+ <element name="mediaStation">
+ <description>The data in this field contains the name of the current source for the media.</description>
+ </element>
+ <element name="rating">
+ <description>The data in this field is a rating.</description>
+ </element>
+ <element name="currentTemperature">
+ <description>The data in this field is the current temperature.</description>
+ </element>
+ <element name="maximumTemperature">
+ <description>The data in this field is the maximum temperature for the day.</description>
+ </element>
+ <element name="minimumTemperature">
+ <description>The data in this field is the minimum temperature for the day.</description>
+ </element>
+ <element name="weatherTerm">
+ <description>The data in this field describes the current weather (ex. cloudy, clear, etc.).</description>
+ </element>
+ <element name="humidity">
+ <description>The data in this field describes the current humidity value.</description>
+ </element>
+ </enum>
+
<enum name="ImageFieldName">
<element name="softButtonImage">
<description>The image field for SoftButton</description>
@@ -805,17 +902,97 @@ <element name="QUEUE" />
</enum>
+ <enum name="VideoStreamingProtocol">
+ <description>Enum for each type of video streaming protocol type.</description>
+ <element name="RAW">
+ <description>
+ Raw stream bytes that contains no timestamp data and is the lowest supported video streaming
+ </description>
+ </element>
+ <element name="RTP">
+ <description>
+ RTP facilitates the transfer of real-time data. Information provided by this protocol include
+ timestamps (for synchronization), sequence numbers (for packet loss and reordering detection)
+ and the payload format which indicates the encoded format of the data.
+ </description>
+ </element>
+ <element name="RTSP">
+ <description>
+ The transmission of streaming data itself is not a task of RTSP. Most RTSP servers use the
+ Real-time Transport Protocol (RTP) in conjunction with Real-time Control Protocol (RTCP)
+ for media stream delivery. However, some vendors implement proprietary transport protocols.
+ </description>
+ </element>
+ <element name="RTMP">
+ <description>
+ Real-Time Messaging Protocol (RTMP) was initially a proprietary protocol developed by
+ Macromedia for streaming audio, video and data over the Internet, between a Flash player
+ and a server. Macromedia is now owned by Adobe, which has released an incomplete version
+ of the specification of the protocol for public use.
+ </description>
+ </element>
+ <element name="WEBM">
+ <description>
+ The WebM container is based on a profile of Matroska. WebM initially supported VP8 video and
+ Vorbis audio streams. In 2013 it was updated to accommodate VP9 video and Opus audio.
+ </description>
+ </element>
+ </enum>
+
+ <enum name="VideoStreamingCodec">
+ <description>Enum for each type of video streaming codec.</description>
+ <element name="H264">
+ <description>
+ A block-oriented motion-compensation-based video compression standard.
+ As of 2014 it is one of the most commonly used formats for the recording, compression, and
+ distribution of video content.
+ </description>
+ </element>
+ <element name="H265">
+ <description>
+ High Efficiency Video Coding (HEVC), also known as H.265 and MPEG-H Part 2, is a video
+ compression standard, one of several potential successors to the widely used AVC (H.264 or
+ MPEG-4 Part 10). In comparison to AVC, HEVC offers about double the data compression ratio
+ at the same level of video quality, or substantially improved video quality at the same
+ bit rate. It supports resolutions up to 8192x4320, including 8K UHD.
+ </description>
+ </element>
+ <element name="Theora">
+ <description>
+ Theora is derived from the formerly proprietary VP3 codec, released into the public domain
+ by On2 Technologies. It is broadly comparable in design and bitrate efficiency to
+ MPEG-4 Part 2, early versions of Windows Media Video, and RealVideo while lacking some of
+ the features present in some of these other codecs. It is comparable in open standards
+ philosophy to the BBC's Dirac codec.
+ </description>
+ </element>
+ <element name="VP8">
+ <description>
+ VP8 can be multiplexed into the Matroska-based container format WebM along with Vorbis and
+ Opus audio. The image format WebP is based on VP8's intra-frame coding. VP8's direct
+ successor, VP9, and the emerging royalty-free internet video format AV1 from the Alliance for
+ Open Media (AOMedia) are based on VP8.
+ </description>
+ </element>
+ <element name="VP9">
+ <description>
+ Similar to VP8, but VP9 is customized for video resolutions beyond high-definition video (UHD)
+ and also enables lossless compression.
+ </description>
+ </element>
+ </enum>
+
<struct name="Image">
- <param name="value" minlength="0" maxlength="65535" type="String">
+ <param name="value" minlength="0" maxlength="65535" type="String" mandatory="true">
<description>Either the static hex icon value or the binary image file name identifier (sent by PutFile).</description>
</param>
- <param name="imageType" type="ImageType">
+ <param name="imageType" type="ImageType" mandatory="true">
<description>Describes, whether it is a static or dynamic image.</description>
</param>
</struct>
<struct name="SoftButton">
- <param name="type" type="SoftButtonType">
+ <param name="type" type="SoftButtonType" mandatory="true">
<description>Describes, whether it is text, highlighted text, icon, or dynamic image. See softButtonType</description>
</param>
<param name="text" minlength="0" maxlength="500" type="String" mandatory="false">
@@ -830,7 +1007,7 @@ False, if not highlighted
</description>
</param>
- <param name="softButtonID" type="Integer" minvalue="0" maxvalue="65535">
+ <param name="softButtonID" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
<description>Value which is returned via OnButtonPress / OnButtonEvent</description>
</param>
<param name="systemAction" type="SystemAction" defvalue="DEFAULT_ACTION" mandatory="false">
@@ -838,11 +1015,26 @@ </param>
</struct>
+ <struct name="MetadataTags">
+ <param name="mainField1" type="MetadataType" minsize="0" maxsize="5" array="true" mandatory="false">
+ <description>The type of data contained in the "mainField1" text field.</description>
+ </param>
+ <param name="mainField2" type="MetadataType" minsize="0" maxsize="5" array="true" mandatory="false">
+ <description>The type of data contained in the "mainField2" text field.</description>
+ </param>
+ <param name="mainField3" type="MetadataType" minsize="0" maxsize="5" array="true" mandatory="false">
+ <description>The type of data contained in the "mainField3" text field.</description>
+ </param>
+ <param name="mainField4" type="MetadataType" minsize="0" maxsize="5" array="true" mandatory="false">
+ <description>The type of data contained in the "mainField4" text field.</description>
+ </param>
+ </struct>
+
<struct name="Choice">
<description>A choice is an option given to the user, which can be selected either by menu, or through voice recognition system.</description>
- <param name="choiceID" type="Integer" minvalue="0" maxvalue="65535" />
- <param name="menuName" type="String" maxlength="500" />
- <param name="vrCommands" type="String" minsize="1" maxsize="100" maxlength="99" array="true" />
+ <param name="choiceID" type="Integer" minvalue="0" maxvalue="65535" mandatory="true"/>
+ <param name="menuName" type="String" maxlength="500" mandatory="true"/>
+ <param name="vrCommands" type="String" minsize="1" maxsize="100" maxlength="99" array="true" mandatory="true"/>
<param name="image" type="Image" mandatory="false"/>
<param name="secondaryText" maxlength="500" type="String" mandatory="false">
<description>Optional secondary text to display; e.g. address of POI in a search result entry</description>
@@ -856,13 +1048,13 @@ </struct>
<struct name="VrHelpItem">
- <param name="text" maxlength="500" type="String">
+ <param name="text" maxlength="500" type="String" mandatory="true">
<description>Text to display for VR Help item</description>
</param>
<param name="image" type="Image" mandatory="false">
<description>Image struct for VR Help item</description>
</param>
- <param name="position" type="Integer" minvalue="1" maxvalue="100">
+ <param name="position" type="Integer" minvalue="1" maxvalue="100" mandatory="true">
<description>Position to display item in VR Help list</description>
</param>
</struct>
@@ -870,10 +1062,10 @@ <struct name="SyncMsgVersion">
<description>Specifies the version number of the SYNC V4 protocol, that is supported by the mobile application</description>
- <param name="majorVersion" type="Integer" minvalue="1" maxvalue="10">
+ <param name="majorVersion" type="Integer" minvalue="1" maxvalue="10" mandatory="true">
<description>The major version indicates versions that is not-compatible to previous versions.</description>
</param>
- <param name="minorVersion" type="Integer" minvalue="0" maxvalue="1000">
+ <param name="minorVersion" type="Integer" minvalue="0" maxvalue="1000" mandatory="true">
<description>The minor version indicates a change to a previous version that should still allow to be run on an older version (with limited functionality)</description>
</param>
<param name="patchVersion" type="Integer" minvalue="0" maxvalue="1000" mandatory="false">
@@ -997,7 +1189,7 @@ </enum>
<struct name="SingleTireStatus">
- <param name="status" type="ComponentVolumeStatus">
+ <param name="status" type="ComponentVolumeStatus" mandatory="true">
<description>See ComponentVolumeStatus.</description>
</param>
</struct>
@@ -1168,61 +1360,61 @@ </enum>
<struct name="BeltStatus">
- <param name="driverBeltDeployed" type="VehicleDataEventStatus">
+ <param name="driverBeltDeployed" type="VehicleDataEventStatus" mandatory="true">
<description>References signal "VedsDrvBelt_D_Ltchd". See VehicleDataEventStatus.</description>
</param>
- <param name="passengerBeltDeployed" type="VehicleDataEventStatus">
+ <param name="passengerBeltDeployed" type="VehicleDataEventStatus" mandatory="true">
<description>References signal "VedsPasBelt_D_Ltchd". See VehicleDataEventStatus.</description>
</param>
- <param name="passengerBuckleBelted" type="VehicleDataEventStatus">
+ <param name="passengerBuckleBelted" type="VehicleDataEventStatus" mandatory="true">
<description>References signal "VedsRw1PasBckl_D_Ltchd". See VehicleDataEventStatus.</description>
</param>
- <param name="driverBuckleBelted" type="VehicleDataEventStatus">
+ <param name="driverBuckleBelted" type="VehicleDataEventStatus" mandatory="true">
<description>References signal "VedsRw1DrvBckl_D_Ltchd". See VehicleDataEventStatus.</description>
</param>
- <param name="leftRow2BuckleBelted" type="VehicleDataEventStatus">
+ <param name="leftRow2BuckleBelted" type="VehicleDataEventStatus" mandatory="true">
<description>References signal "VedsRw2lBckl_D_Ltchd". See VehicleDataEventStatus.</description>
</param>
- <param name="passengerChildDetected" type="VehicleDataEventStatus">
+ <param name="passengerChildDetected" type="VehicleDataEventStatus" mandatory="true">
<description>References signal "VedsRw1PasChld_D_Ltchd". See VehicleDataEventStatus.</description>
</param>
- <param name="rightRow2BuckleBelted" type="VehicleDataEventStatus">
+ <param name="rightRow2BuckleBelted" type="VehicleDataEventStatus" mandatory="true">
<description>References signal "VedsRw2rBckl_D_Ltchd". See VehicleDataEventStatus.</description>
</param>
- <param name="middleRow2BuckleBelted" type="VehicleDataEventStatus">
+ <param name="middleRow2BuckleBelted" type="VehicleDataEventStatus" mandatory="true">
<description>References signal "VedsRw2mBckl_D_Ltchd". See VehicleDataEventStatus.</description>
</param>
- <param name="middleRow3BuckleBelted" type="VehicleDataEventStatus">
+ <param name="middleRow3BuckleBelted" type="VehicleDataEventStatus" mandatory="true">
<description>References signal "VedsRw3mBckl_D_Ltchd". See VehicleDataEventStatus.</description>
</param>
- <param name="leftRow3BuckleBelted" type="VehicleDataEventStatus">
+ <param name="leftRow3BuckleBelted" type="VehicleDataEventStatus" mandatory="true">
<description>References signal "VedsRw3lBckl_D_Ltchd". See VehicleDataEventStatus.</description>
</param>
- <param name="rightRow3BuckleBelted" type="VehicleDataEventStatus">
+ <param name="rightRow3BuckleBelted" type="VehicleDataEventStatus" mandatory="true">
<description>References signal "VedsRw3rBckl_D_Ltchd". See VehicleDataEventStatus.</description>
</param>
- <param name="leftRearInflatableBelted" type="VehicleDataEventStatus">
+ <param name="leftRearInflatableBelted" type="VehicleDataEventStatus" mandatory="true">
<description>References signal "VedsRw2lRib_D_Ltchd". See VehicleDataEventStatus.</description>
</param>
- <param name="rightRearInflatableBelted" type="VehicleDataEventStatus">
+ <param name="rightRearInflatableBelted" type="VehicleDataEventStatus" mandatory="true">
<description>References signal "VedsRw2rRib_D_Ltchd". See VehicleDataEventStatus.</description>
</param>
- <param name="middleRow1BeltDeployed" type="VehicleDataEventStatus">
+ <param name="middleRow1BeltDeployed" type="VehicleDataEventStatus" mandatory="true">
<description>References signal "VedsRw1mBelt_D_Ltchd". See VehicleDataEventStatus.</description>
</param>
- <param name="middleRow1BuckleBelted" type="VehicleDataEventStatus">
+ <param name="middleRow1BuckleBelted" type="VehicleDataEventStatus" mandatory="true">
<description>References signal "VedsRw1mBckl_D_Ltchd". See VehicleDataEventStatus.</description>
</param>
</struct>
<struct name="BodyInformation">
- <param name="parkBrakeActive" type="Boolean">
+ <param name="parkBrakeActive" type="Boolean" mandatory="true">
<description>References signal "PrkBrkActv_B_Actl".</description>
</param>
- <param name="ignitionStableStatus" type="IgnitionStableStatus">
+ <param name="ignitionStableStatus" type="IgnitionStableStatus" mandatory="true">
<description>References signal "Ignition_Switch_Stable". See IgnitionStableStatus.</description>
</param>
- <param name="ignitionStatus" type="IgnitionStatus">
+ <param name="ignitionStatus" type="IgnitionStatus" mandatory="true">
<description>References signal "Ignition_status". See IgnitionStatus.</description>
</param>
<param name="driverDoorAjar" type="Boolean" mandatory="false">
@@ -1240,46 +1432,46 @@ </struct>
<struct name="DeviceStatus">
- <param name="voiceRecOn" type="Boolean">
+ <param name="voiceRecOn" type="Boolean" mandatory="true">
<description>References signal "CPM_VoiceRec_STAT".</description>
</param>
- <param name="btIconOn" type="Boolean">
+ <param name="btIconOn" type="Boolean" mandatory="true">
<description>References signal "BT_ICON".</description>
</param>
- <param name="callActive" type="Boolean">
+ <param name="callActive" type="Boolean" mandatory="true">
<description>References signal "CPM_Call_Active_STAT".</description>
</param>
- <param name="phoneRoaming" type="Boolean">
+ <param name="phoneRoaming" type="Boolean" mandatory="true">
<description>References signal "CPM_Phone_Roaming_STAT".</description>
</param>
- <param name="textMsgAvailable" type="Boolean">
+ <param name="textMsgAvailable" type="Boolean" mandatory="true">
<description>References signal "CPM_TextMsg_AVAL".</description>
</param>
- <param name="battLevelStatus" type="DeviceLevelStatus">
+ <param name="battLevelStatus" type="DeviceLevelStatus" mandatory="true">
<description>Device battery level status. References signal "CPM_Batt_Level_STAT". See DeviceLevelStatus.</description>
</param>
- <param name="stereoAudioOutputMuted" type="Boolean">
+ <param name="stereoAudioOutputMuted" type="Boolean" mandatory="true">
<description>References signal "CPM_Stereo_Audio_Output".</description>
</param>
- <param name="monoAudioOutputMuted" type="Boolean">
+ <param name="monoAudioOutputMuted" type="Boolean" mandatory="true">
<description>References signal "CPM_Mono_Audio_Output".</description>
</param>
- <param name="signalLevelStatus" type="DeviceLevelStatus">
+ <param name="signalLevelStatus" type="DeviceLevelStatus" mandatory="true">
<description>Device signal level status. References signal "CPM_Signal_Strength_STAT". See DeviceLevelStatus.</description>
</param>
- <param name="primaryAudioSource" type="PrimaryAudioSource">
+ <param name="primaryAudioSource" type="PrimaryAudioSource" mandatory="true">
<description>References signal "CPM_Stereo_PAS_Source". See PrimaryAudioSource.</description>
</param>
- <param name="eCallEventActive" type="Boolean">
+ <param name="eCallEventActive" type="Boolean" mandatory="true">
<description>References signal "eCall_Event".</description>
</param>
</struct>
<struct name="HeadLampStatus">
- <param name="lowBeamsOn" type="Boolean">
+ <param name="lowBeamsOn" type="Boolean" mandatory="true">
<description>Status of the low beam lamps. References signal "HeadLampLoActv_B_Stat".</description>
</param>
- <param name="highBeamsOn" type="Boolean">
+ <param name="highBeamsOn" type="Boolean" mandatory="true">
<description>Status of the high beam lamps. References signal "HeadLghtHiOn_B_Stat".</description>
</param>
<param name="ambientLightSensorStatus" type="AmbientLightStatus" mandatory="false">
@@ -1307,6 +1499,284 @@ </param>
</struct>
+ <enum name="ModuleType">
+ <element name="CLIMATE"/>
+ <element name="RADIO"/>
+ </enum>
+
+ <enum name="RadioBand">
+ <element name="AM"/>
+ <element name="FM"/>
+ <element name="XM"/>
+ </enum>
+
+ <struct name="RdsData">
+ <param name="PS" type="String" minlength="0" maxlength="8" mandatory="false" >
+ <description>Program Service Name</description>
+ </param>
+ <param name="RT" type="String" minlength="0" maxlength="64" mandatory="false" >
+ <description>Radio Text</description>
+ </param>
+ <param name="CT" type="String" minlength="24" maxlength="24" mandatory="false">
+ <description>The clock text in UTC format as YYYY-MM-DDThh:mm:ss.sTZD</description>
+ </param>
+ <param name="PI" type="String" minlength="0" maxlength="6" mandatory="false" >
+ <description>Program Identification - the call sign for the radio station</description>
+ </param>
+ <param name="PTY" type="Integer" minvalue="0" maxvalue="31" mandatory="false" >
+ <description>The program type - The region should be used to differentiate between EU and North America program types</description>
+ </param>
+ <param name="TP" type="Boolean" mandatory="false" >
+ <description>Traffic Program Identification - Identifies a station that offers traffic</description>
+ </param>
+ <param name="TA" type="Boolean" mandatory="false" >
+ <description>Traffic Announcement Identification - Indicates an ongoing traffic announcement</description>
+ </param>
+ <param name="REG" type="String" mandatory="false" >
+ <description>Region</description>
+ </param>
+ </struct>
+
+ <enum name="RadioState">
+ <element name="ACQUIRING"/>
+ <element name="ACQUIRED"/>
+ <element name="MULTICAST"/>
+ <element name="NOT_FOUND"/>
+ </enum>
+
+ <struct name="RadioControlData">
+ <param name="frequencyInteger" type="Integer" minvalue="0" maxvalue="1710" mandatory="false">
+ <description>The integer part of the frequency ie for 101.7 this value should be 101</description>
+ </param>
+ <param name="frequencyFraction" type="Integer" minvalue="0" maxvalue="9" mandatory="false">
+ <description>The fractional part of the frequency for 101.7 is 7</description>
+ </param>
+ <param name="band" type="RadioBand" mandatory="false">
+ </param>
+ <param name="rdsData" type="RdsData" mandatory="false">
+ <description> Read only parameter.</description>
+ </param>
+ <param name="availableHDs" type="Integer" minvalue="1" maxvalue="3" mandatory="false">
+ <description>number of HD sub-channels if available. Read only parameter.</description>
+ </param>
+ <param name="hdChannel" type="Integer" minvalue="1" maxvalue="3" mandatory="false">
+ <description>Current HD sub-channel if available</description>
+ </param>
+ <param name="signalStrength" type="Integer" minvalue="0" maxvalue="100" mandatory="false">
+ <description> Read only parameter.</description>
+ </param>
+ <param name="signalChangeThreshold" type="Integer" minvalue="0" maxvalue="100" mandatory="false">
+ <description>If the signal strength falls below the set value for this parameter,
+ the radio will tune to an alternative frequency. Read only parameter.</description>
+ </param>
+ <param name="radioEnable" type="Boolean" mandatory="false">
+ <description> True if the radio is on, false is the radio is off.</description>
+ </param>
+ <param name="state" type="RadioState" mandatory="false">
+ <description> Read only parameter.</description>
+ </param>
+ </struct>
+
+ <struct name="RadioControlCapabilities">
+ <description>Contains information about a radio control module's capabilities.</description>
+ <param name="moduleName" type="String" maxlength="100" mandatory="true" >
+ <description>The short name or a short description of the radio control module.</description>
+ </param>
+ <param name="radioEnableAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control of enable/disable radio.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="radioBandAvailable" type="Boolean" mandatory="false" >
+ <description>
+ Availability of the control of radio band.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="radioFrequencyAvailable" type="Boolean" mandatory="false" >
+ <description>
+ Availability of the control of radio frequency.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="hdChannelAvailable" type="Boolean" mandatory="false" >
+ <description>
+ Availability of the control of HD radio channel.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="rdsDataAvailable" type="Boolean" mandatory="false" >
+ <description>
+ Availability of the getting Radio Data System (RDS) data.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="availableHDsAvailable" type="Boolean" mandatory="false" >
+ <description>
+ Availability of the getting the number of available HD channels.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="stateAvailable" type="Boolean" mandatory="false" >
+ <description>
+ Availability of the getting the Radio state.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="signalStrengthAvailable" type="Boolean" mandatory="false" >
+ <description>
+ Availability of the getting the signal strength.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="signalChangeThresholdAvailable" type="Boolean" mandatory="false" >
+ <description>
+ Availability of the getting the signal Change Threshold.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ </struct>
+
+ <enum name="DefrostZone">
+ <element name="FRONT"/>
+ <element name="REAR"/>
+ <element name="ALL"/>
+ <element name="NONE"/>
+ </enum>
+
+ <enum name="VentilationMode">
+ <element name="UPPER"/>
+ <element name="LOWER"/>
+ <element name="BOTH"/>
+ <element name="NONE"/>
+ </enum>
+
+ <enum name="TemperatureUnit">
+ <element name="FAHRENHEIT"/>
+ <element name="CELSIUS"/>
+ </enum>
+
+ <struct name="Temperature">
+ <param name="unit" type="TemperatureUnit" mandatory="true" >
+ <description>Temperature Unit</description>
+ </param>
+ <param name="value" type="Float" mandatory="true" >
+ <description>Temperature Value in TemperatureUnit specified unit. Range depends on OEM and is not checked by SDL.</description>
+ </param>
+ </struct>
+
+ <struct name="ClimateControlData">
+ <param name="fanSpeed" type="Integer" minvalue="0" maxvalue="100" mandatory="false">
+ </param>
+ <param name="currentTemperature" type="Temperature" mandatory="false">
+ <description> Read only parameter.</description>
+ </param>
+ <param name="desiredTemperature" type="Temperature" mandatory="false">
+ </param>
+ <param name="acEnable" type="Boolean" mandatory="false">
+ </param>
+ <param name="circulateAirEnable" type="Boolean" mandatory="false">
+ </param>
+ <param name="autoModeEnable" type="Boolean" mandatory="false">
+ </param>
+ <param name="defrostZone" type="DefrostZone" mandatory="false">
+ </param>
+ <param name="dualModeEnable" type="Boolean" mandatory="false">
+ </param>
+ <param name="acMaxEnable" type="Boolean" mandatory="false">
+ </param>
+ <param name="ventilationMode" type="VentilationMode" mandatory="false">
+ </param>
+ </struct>
+
+<struct name="ClimateControlCapabilities">
+ <description>Contains information about a climate control module's capabilities.</description>
+ <param name="moduleName" type="String" maxlength="100" mandatory="true" >
+ <description>The short name or a short description of the climate control module.</description>
+ </param>
+ <param name="currentTemperatureAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the reading of current temperature.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="fanSpeedAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control of fan speed.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="desiredTemperatureAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control of desired temperature.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="acEnableAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control of turn on/off AC.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="acMaxEnableAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control of enable/disable air conditioning is ON on the maximum level.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="circulateAirEnableAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control of enable/disable circulate Air mode.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="autoModeEnableAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control of enable/disable auto mode.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="dualModeEnableAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control of enable/disable dual mode.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="defrostZoneAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control of defrost zones.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="defrostZone" type="DefrostZone" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>
+ A set of all defrost zones that are controllable.
+ </description>
+ </param>
+ <param name="ventilationModeAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control of air ventilation mode.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="ventilationMode" type="VentilationMode" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>
+ A set of all ventilation modes that are controllable.
+ </description>
+ </param>
+</struct>
+
+ <struct name="ModuleData">
+ <description>The moduleType indicates which type of data should be changed and identifies which data object exists in this struct. For example, if the moduleType is CLIMATE then a "climateControlData" should exist</description>
+ <param name="moduleType" type="ModuleType" mandatory="true" >
+ </param>
+ <param name="radioControlData" type="RadioControlData" mandatory="false">
+ </param>
+ <param name="climateControlData" type="ClimateControlData" mandatory="false">
+ </param>
+ </struct>
+
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- Ford Specific Data Items -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~ -->
@@ -1415,84 +1885,84 @@ </enum>
<struct name="ECallInfo">
- <param name="eCallNotificationStatus" type="VehicleDataNotificationStatus">
+ <param name="eCallNotificationStatus" type="VehicleDataNotificationStatus" mandatory="true">
<description>References signal "eCallNotification_4A". See VehicleDataNotificationStatus.</description>
</param>
- <param name="auxECallNotificationStatus" type="VehicleDataNotificationStatus">
+ <param name="auxECallNotificationStatus" type="VehicleDataNotificationStatus" mandatory="true">
<description>References signal "eCallNotification". See VehicleDataNotificationStatus.</description>
</param>
- <param name="eCallConfirmationStatus" type="ECallConfirmationStatus">
+ <param name="eCallConfirmationStatus" type="ECallConfirmationStatus" mandatory="true">
<description>References signal "eCallConfirmation". See ECallConfirmationStatus.</description>
</param>
</struct>
<struct name="AirbagStatus">
- <param name="driverAirbagDeployed" type="VehicleDataEventStatus">
+ <param name="driverAirbagDeployed" type="VehicleDataEventStatus" mandatory="true">
<description>References signal "VedsDrvBag_D_Ltchd". See VehicleDataEventStatus.</description>
</param>
- <param name="driverSideAirbagDeployed" type="VehicleDataEventStatus">
+ <param name="driverSideAirbagDeployed" type="VehicleDataEventStatus" mandatory="true">
<description>References signal "VedsDrvSideBag_D_Ltchd". See VehicleDataEventStatus.</description>
</param>
- <param name="driverCurtainAirbagDeployed" type="VehicleDataEventStatus">
+ <param name="driverCurtainAirbagDeployed" type="VehicleDataEventStatus" mandatory="true">
<description>References signal "VedsDrvCrtnBag_D_Ltchd". See VehicleDataEventStatus.</description>
</param>
- <param name="passengerAirbagDeployed" type="VehicleDataEventStatus">
+ <param name="passengerAirbagDeployed" type="VehicleDataEventStatus" mandatory="true">
<description>References signal "VedsPasBag_D_Ltchd". See VehicleDataEventStatus.</description>
</param>
- <param name="passengerCurtainAirbagDeployed" type="VehicleDataEventStatus">
+ <param name="passengerCurtainAirbagDeployed" type="VehicleDataEventStatus" mandatory="true">
<description>References signal "VedsPasCrtnBag_D_Ltchd". See VehicleDataEventStatus.</description>
</param>
- <param name="driverKneeAirbagDeployed" type="VehicleDataEventStatus">
+ <param name="driverKneeAirbagDeployed" type="VehicleDataEventStatus" mandatory="true">
<description>References signal "VedsKneeDrvBag_D_Ltchd". See VehicleDataEventStatus.</description>
</param>
- <param name="passengerSideAirbagDeployed" type="VehicleDataEventStatus">
+ <param name="passengerSideAirbagDeployed" type="VehicleDataEventStatus" mandatory="true">
<description>References signal "VedsPasSideBag_D_Ltchd". See VehicleDataEventStatus.</description>
</param>
- <param name="passengerKneeAirbagDeployed" type="VehicleDataEventStatus">
+ <param name="passengerKneeAirbagDeployed" type="VehicleDataEventStatus" mandatory="true">
<description>References signal "VedsKneePasBag_D_Ltchd". See VehicleDataEventStatus.</description>
</param>
</struct>
<struct name="EmergencyEvent">
- <param name="emergencyEventType" type="EmergencyEventType">
+ <param name="emergencyEventType" type="EmergencyEventType" mandatory="true">
<description>References signal "VedsEvntType_D_Ltchd". See EmergencyEventType.</description>
</param>
- <param name="fuelCutoffStatus" type="FuelCutoffStatus">
+ <param name="fuelCutoffStatus" type="FuelCutoffStatus" mandatory="true">
<description>References signal "RCM_FuelCutoff". See FuelCutoffStatus.</description>
</param>
- <param name="rolloverEvent" type="VehicleDataEventStatus">
+ <param name="rolloverEvent" type="VehicleDataEventStatus" mandatory="true">
<description>References signal "VedsEvntRoll_D_Ltchd". See VehicleDataEventStatus.</description>
</param>
- <param name="maximumChangeVelocity" type="Integer" minvalue="0" maxvalue="255">
+ <param name="maximumChangeVelocity" type="Integer" minvalue="0" maxvalue="255" mandatory="true">
<description>References signal "VedsMaxDeltaV_D_Ltchd". Change in velocity in KPH. Additional reserved values:
0x00 No event
0xFE Not supported
0xFF Fault
</description>
</param>
- <param name="multipleEvents" type="VehicleDataEventStatus">
+ <param name="multipleEvents" type="VehicleDataEventStatus" mandatory="true">
<description>References signal "VedsMultiEvnt_D_Ltchd". See VehicleDataEventStatus.</description>
</param>
</struct>
<struct name="ClusterModeStatus">
- <param name="powerModeActive" type="Boolean">
+ <param name="powerModeActive" type="Boolean" mandatory="true">
<description>References signal "PowerMode_UB".</description>
</param>
- <param name="powerModeQualificationStatus" type="PowerModeQualificationStatus">
+ <param name="powerModeQualificationStatus" type="PowerModeQualificationStatus" mandatory="true">
<description>References signal "PowerModeQF". See PowerModeQualificationStatus.</description>
</param>
- <param name="carModeStatus" type="CarModeStatus">
+ <param name="carModeStatus" type="CarModeStatus" mandatory="true">
<description>References signal "CarMode". See CarMode.</description>
</param>
- <param name="powerModeStatus" type="PowerModeStatus">
+ <param name="powerModeStatus" type="PowerModeStatus" mandatory="true">
<description>References signal "PowerMode". See PowerMode.</description>
</param>
</struct>
<struct name="MyKey">
- <param name="e911Override" type="VehicleDataStatus">
+ <param name="e911Override" type="VehicleDataStatus" mandatory="true">
<description>Indicates whether e911 override is on. References signal "MyKey_e911Override_St". See VehicleDataStatus.</description>
</param>
</struct>
@@ -1535,101 +2005,101 @@ <struct name="TireStatus">
<description>The status and pressure of the tires.</description>
- <param name="pressureTelltale" type="WarningLightStatus">
+ <param name="pressureTelltale" type="WarningLightStatus" mandatory="true">
<description>Status of the Tire Pressure Telltale. See WarningLightStatus.</description>
</param>
- <param name="leftFront" type="SingleTireStatus">
+ <param name="leftFront" type="SingleTireStatus" mandatory="true">
<description>The status of the left front tire.</description>
</param>
- <param name="rightFront" type="SingleTireStatus">
+ <param name="rightFront" type="SingleTireStatus" mandatory="true">
<description>The status of the right front tire.</description>
</param>
- <param name="leftRear" type="SingleTireStatus">
+ <param name="leftRear" type="SingleTireStatus" mandatory="true">
<description>The status of the left rear tire.</description>
</param>
- <param name="rightRear" type="SingleTireStatus">
+ <param name="rightRear" type="SingleTireStatus" mandatory="true">
<description>The status of the right rear tire.</description>
</param>
- <param name="innerLeftRear" type="SingleTireStatus">
+ <param name="innerLeftRear" type="SingleTireStatus" mandatory="true">
<description>The status of the inner left rear.</description>
</param>
- <param name="innerRightRear" type="SingleTireStatus">
+ <param name="innerRightRear" type="SingleTireStatus" mandatory="true">
<description>The status of the inner right rear.</description>
</param>
</struct>
<struct name="GPSData">
<description>Struct with the GPS data.</description>
- <param name="longitudeDegrees" type="Float" minvalue="-180" maxvalue="180">
+ <param name="longitudeDegrees" type="Float" minvalue="-180" maxvalue="180" mandatory="true">
</param>
- <param name="latitudeDegrees" type="Float" minvalue="-90" maxvalue="90">
+ <param name="latitudeDegrees" type="Float" minvalue="-90" maxvalue="90" mandatory="true">
</param>
- <param name="utcYear" type="Integer" minvalue="2010" maxvalue="2100">
+ <param name="utcYear" type="Integer" minvalue="2010" maxvalue="2100" mandatory="true">
<description>The current UTC year.</description>
</param>
- <param name="utcMonth" type="Integer" minvalue="1" maxvalue="12">
+ <param name="utcMonth" type="Integer" minvalue="1" maxvalue="12" mandatory="true">
<description>The current UTC month.</description>
</param>
- <param name="utcDay" type="Integer" minvalue="1" maxvalue="31">
+ <param name="utcDay" type="Integer" minvalue="1" maxvalue="31" mandatory="true">
<description>The current UTC day.</description>
</param>
- <param name="utcHours" type="Integer" minvalue="0" maxvalue="23">
+ <param name="utcHours" type="Integer" minvalue="0" maxvalue="23" mandatory="true">
<description>The current UTC hour.</description>
</param>
- <param name="utcMinutes" type="Integer" minvalue="0" maxvalue="59">
+ <param name="utcMinutes" type="Integer" minvalue="0" maxvalue="59" mandatory="true">
<description>The current UTC minute.</description>
</param>
- <param name="utcSeconds" type="Integer" minvalue="0" maxvalue="59">
+ <param name="utcSeconds" type="Integer" minvalue="0" maxvalue="59" mandatory="true">
<description>The current UTC second.</description>
</param>
- <param name="compassDirection" type="CompassDirection">
+ <param name="compassDirection" type="CompassDirection" mandatory="true">
<description>See CompassDirection.</description>
</param>
- <param name="pdop" type="Float" minvalue="0" maxvalue="10" defvalue="0">
+ <param name="pdop" type="Float" minvalue="0" maxvalue="10" defvalue="0" mandatory="true">
<description>PDOP. If undefined or unavailable, then value shall be set to 0.</description>
</param>
- <param name="hdop" type="Float" minvalue="0" maxvalue="10" defvalue="0">
+ <param name="hdop" type="Float" minvalue="0" maxvalue="10" defvalue="0" mandatory="true">
<description>HDOP. If value is unknown, value shall be set to 0.</description>
</param>
- <param name="vdop" type="Float" minvalue="0" maxvalue="10" defvalue="0">
+ <param name="vdop" type="Float" minvalue="0" maxvalue="10" defvalue="0" mandatory="true">
<description>VDOP. If value is unknown, value shall be set to 0.</description>
</param>
- <param name="actual" type="Boolean">
+ <param name="actual" type="Boolean" mandatory="true">
<description>
True, if actual.
False, if infered.
</description>
</param>
- <param name="satellites" type="Integer" minvalue="0" maxvalue="31">
+ <param name="satellites" type="Integer" minvalue="0" maxvalue="31" mandatory="true">
<description>Number of satellites in view</description>
</param>
- <param name="dimension" type="Dimension">
+ <param name="dimension" type="Dimension" mandatory="true">
<description>See Dimension</description>
</param>
- <param name="altitude" type="Float" minvalue="-10000" maxvalue="10000">
+ <param name="altitude" type="Float" minvalue="-10000" maxvalue="10000" mandatory="true">
<description>Altitude in meters</description>
</param>
- <param name="heading" type="Float" minvalue="0" maxvalue="359.99">
+ <param name="heading" type="Float" minvalue="0" maxvalue="359.99" mandatory="true">
<description>The heading. North is 0. Resolution is 0.01</description>
</param>
- <param name="speed" type="Float" minvalue="0" maxvalue="500">
+ <param name="speed" type="Float" minvalue="0" maxvalue="500" mandatory="true">
<description>The speed in KPH</description>
</param>
</struct>
<struct name="VehicleDataResult">
<description>Individual published data request result</description>
- <param name="dataType" type="VehicleDataType">
+ <param name="dataType" type="VehicleDataType" mandatory="true">
<description>Defined published data element type.</description>
</param>
- <param name="resultCode" type="VehicleDataResultCode">
+ <param name="resultCode" type="VehicleDataResultCode" mandatory="true">
<description>Published data result code.</description>
</param>
</struct>
<struct name="DIDResult">
<description>Individual requested DID result and data</description>
- <param name="resultCode" type="VehicleDataResultCode">
+ <param name="resultCode" type="VehicleDataResultCode" mandatory="true">
<description>Individual DID result code.</description>
</param>
<param name="didLocation" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
@@ -1641,45 +2111,45 @@ </struct>
<struct name="StartTime">
- <param name="hours" type="Integer" minvalue="0" maxvalue="59">
+ <param name="hours" type="Integer" minvalue="0" maxvalue="59" mandatory="true">
<description>
The hour of the media clock.
Some radios only support a max of 19 hours. If out of range, it will be rejected.
</description>
</param>
- <param name="minutes" type="Integer" minvalue="0" maxvalue="59" />
- <param name="seconds" type="Integer" minvalue="0" maxvalue="59" />
+ <param name="minutes" type="Integer" minvalue="0" maxvalue="59" mandatory="true"/>
+ <param name="seconds" type="Integer" minvalue="0" maxvalue="59" mandatory="true"/>
</struct>
<struct name="TextField">
- <param name="name" type="TextFieldName">
+ <param name="name" type="TextFieldName" mandatory="true">
<description>The name that identifies the field. See TextFieldName.</description>
</param>
- <param name="characterSet" type="CharacterSet">
+ <param name="characterSet" type="CharacterSet" mandatory="true">
<description>The character set that is supported in this field. See CharacterSet.</description>
</param>
- <param name="width" type="Integer" minvalue="1" maxvalue="500">
+ <param name="width" type="Integer" minvalue="1" maxvalue="500" mandatory="true">
<description>The number of characters in one row of this field.</description>
</param>
- <param name="rows" type="Integer" minvalue="1" maxvalue="8">
+ <param name="rows" type="Integer" minvalue="1" maxvalue="8" mandatory="true">
<description>The number of rows of this field.</description>
</param>
</struct>
<struct name="ImageResolution">
- <param name="resolutionWidth" type="Integer" minvalue="1" maxvalue="10000">
+ <param name="resolutionWidth" type="Integer" minvalue="1" maxvalue="10000" mandatory="true">
<description>The image resolution width.</description>
</param>
- <param name="resolutionHeight" type="Integer" minvalue="1" maxvalue="10000">
+ <param name="resolutionHeight" type="Integer" minvalue="1" maxvalue="10000" mandatory="true">
<description>The image resolution height.</description>
</param>
</struct>
<struct name="ImageField">
- <param name="name" type="ImageFieldName">
+ <param name="name" type="ImageFieldName" mandatory="true">
<description>The name that identifies the field. See ImageFieldName.</description>
</param>
- <param name="imageTypeSupported" type="FileType" minsize="1" maxsize="100" array="true">
+ <param name="imageTypeSupported" type="FileType" minsize="1" maxsize="100" array="true" mandatory="true">
<description>The image types that are supported in this field. See FileType.</description>
</param>
<param name="imageResolution" type="ImageResolution" mandatory="false">
@@ -1700,6 +2170,7 @@ <element name="BEGIN"/>
<element name="MOVE"/>
<element name="END"/>
+ <element name="CANCEL"/>
</enum>
<struct name="TouchEvent">
@@ -1749,46 +2220,56 @@ </enum>
<struct name="HMIPermissions">
- <param name="allowed" type="HMILevel" minsize="0" maxsize="100" array="true">
+ <param name="allowed" type="HMILevel" minsize="0" maxsize="100" array="true" mandatory="true">
<description>A set of all HMI levels that are permitted for this given RPC.</description>
</param>
- <param name="userDisallowed" type="HMILevel" minsize="0" maxsize="100" array="true">
+ <param name="userDisallowed" type="HMILevel" minsize="0" maxsize="100" array="true" mandatory="true">
<description>A set of all HMI levels that are prohibited for this given RPC.</description>
</param>
</struct>
<struct name="ParameterPermissions">
- <param name="allowed" type="String" minsize="0" maxsize="100" maxlength = "100" array="true">
+ <param name="allowed" type="String" minsize="0" maxsize="100" maxlength = "100" array="true" mandatory="true">
<description>A set of all parameters that are permitted for this given RPC.</description>
</param>
- <param name="userDisallowed" type="String" minsize="0" maxsize="100" maxlength = "100" array="true">
+ <param name="userDisallowed" type="String" minsize="0" maxsize="100" maxlength = "100" array="true" mandatory="true">
<description>A set of all parameters that are prohibited for this given RPC.</description>
</param>
</struct>
<struct name="PermissionItem">
- <param name="rpcName" type="String" maxlength="100">
+ <param name="rpcName" type="String" maxlength="100" mandatory="true">
<description>Name of the individual RPC in the policy table.</description>
</param>
- <param name="hmiPermissions" type="HMIPermissions" />
- <param name="parameterPermissions" type="ParameterPermissions" />
+ <param name="hmiPermissions" type="HMIPermissions" mandatory="true"/>
+ <param name="parameterPermissions" type="ParameterPermissions" mandatory="true"/>
</struct>
+ <struct name="VideoStreamingFormat">
+ <description>Video streaming formats and their specifications.</description>
+ <param name="protocol" type="VideoStreamingProtocol" mandatory="true">
+ <description>Protocol type, see VideoStreamingProtocol</description>
+ </param>
+ <param name="codec" type="VideoStreamingCodec" mandatory="true">
+ <description>Codec type, see VideoStreamingCodec</description>
+ </param>
+ </struct>
+
<struct name="DisplayCapabilities">
<description>Contains information about the display capabilities.</description>
- <param name="displayType" type="DisplayType">
+ <param name="displayType" type="DisplayType" mandatory="true">
<description>The type of the display. See DisplayType</description>
</param>
- <param name="textFields" type="TextField" minsize="1" maxsize="100" array="true">
+ <param name="textFields" type="TextField" minsize="1" maxsize="100" array="true" mandatory="true">
<description>A set of all fields that support text data. See TextField</description>
</param>
<param name="imageFields" type="ImageField" minsize="1" maxsize="100" array="true" mandatory="false">
<description>A set of all fields that support images. See ImageField</description>
</param>
- <param name="mediaClockFormats" type="MediaClockFormat" minsize="0" maxsize="100" array="true">
+ <param name="mediaClockFormats" type="MediaClockFormat" minsize="0" maxsize="100" array="true" mandatory="true">
<description>A set of all supported formats of the media clock. See MediaClockFormat</description>
</param>
- <param name="graphicSupported" type="Boolean">
+ <param name="graphicSupported" type="Boolean" mandatory="true">
<description>The display's persistent screen supports referencing a static or dynamic image.</description>
</param>
<param name="templatesAvailable" type="String" minsize="0" maxsize="100" maxlength="100" array="true" mandatory="false">
@@ -1806,22 +2287,22 @@ <struct name="ButtonCapabilities">
<description>Contains information about a button's capabilities.</description>
- <param name="name" type="ButtonName">
+ <param name="name" type="ButtonName" mandatory="true">
<description>The name of the button. See ButtonName.</description>
</param>
- <param name="shortPressAvailable" type="Boolean">
+ <param name="shortPressAvailable" type="Boolean" mandatory="true">
<description>
The button supports a short press.
Whenever the button is pressed short, onButtonPressed( SHORT) will be invoked.
</description>
</param>
- <param name="longPressAvailable" type="Boolean">
+ <param name="longPressAvailable" type="Boolean" mandatory="true">
<description>
The button supports a LONG press.
Whenever the button is pressed long, onButtonPressed( LONG) will be invoked.
</description>
</param>
- <param name="upDownAvailable" type="Boolean">
+ <param name="upDownAvailable" type="Boolean" mandatory="true">
<description>
The button supports "button down" and "button up".
Whenever the button is pressed, onButtonEvent( DOWN) will be invoked.
@@ -1830,35 +2311,53 @@ </param>
</struct>
+ <struct name="RemoteControlCapabilities">
+ <param name="climateControlCapabilities" type="ClimateControlCapabilities" mandatory="false" minsize="1" maxsize="100" array="true">
+ <description>
+ If included, the platform supports RC climate controls.
+ For this baseline version, maxsize=1. i.e. only one climate control module is supported.
+ </description >
+ </param>
+ <param name="radioControlCapabilities" type="RadioControlCapabilities" mandatory="false" minsize="1" maxsize="100" array="true">
+ <description>
+ If included, the platform supports RC radio controls.
+ For this baseline version, maxsize=1. i.e. only one radio control module is supported.
+ </description >
+ </param>
+ <param name="buttonCapabilities" type="ButtonCapabilities" mandatory="false" minsize="1" maxsize="100" array="true" >
+ <description>If included, the platform supports RC button controls with the included button names.</description >
+ </param>
+ </struct>
+
<struct name="SoftButtonCapabilities">
<description>Contains information about a SoftButton's capabilities.</description>
- <param name="shortPressAvailable" type="Boolean">
+ <param name="shortPressAvailable" type="Boolean" mandatory="true">
<description>
The button supports a short press.
Whenever the button is pressed short, onButtonPressed( SHORT) will be invoked.
</description>
</param>
- <param name="longPressAvailable" type="Boolean">
+ <param name="longPressAvailable" type="Boolean" mandatory="true">
<description>
The button supports a LONG press.
Whenever the button is pressed long, onButtonPressed( LONG) will be invoked.
</description>
</param>
- <param name="upDownAvailable" type="Boolean">
+ <param name="upDownAvailable" type="Boolean" mandatory="true">
<description>
The button supports "button down" and "button up".
Whenever the button is pressed, onButtonEvent( DOWN) will be invoked.
Whenever the button is released, onButtonEvent( UP) will be invoked.
</description>
</param>
- <param name="imageSupported" type="Boolean">
+ <param name="imageSupported" type="Boolean" mandatory="true">
<description>The button supports referencing a static or dynamic image.</description>
</param>
</struct>
<struct name="PresetBankCapabilities">
<description>Contains information about on-screen preset capabilities.</description>
- <param name="onScreenPresetsAvailable" type="Boolean">
+ <param name="onScreenPresetsAvailable" type="Boolean" mandatory="true">
<description>Onscreen custom presets are available.</description>
</param>
</struct>
@@ -1870,6 +2369,9 @@ <param name="phoneCall" type="Boolean" mandatory="false">
<description>Availability of build in phone. True: Available, False: Not Available </description>
</param>
+ <param name="videoStreaming" type="Boolean" mandatory="false">
+ <description>Availability of video streaming. True: Available, False: Not Available</description>
+ </param>
</struct>
<struct name="MenuParams">
@@ -1890,20 +2392,20 @@ </description>
</param>
- <param name="menuName" type="String" maxlength="500">
+ <param name="menuName" type="String" maxlength="500" mandatory="true">
<description>Text to show in the menu for this sub menu.</description>
</param>
</struct>
<struct name="TTSChunk">
<description>A TTS chunk, that consists of the text/phonemes to speak and the type (like text or SAPI)</description>
- <param name="text" minlength="0" maxlength="500" type="String">
+ <param name="text" minlength="0" maxlength="500" type="String" mandatory="true">
<description>
The text or phonemes to speak.
May not be empty.
</description>
</param>
- <param name="type" type="SpeechCapabilities">
+ <param name="type" type="SpeechCapabilities" mandatory="true">
<description>Describes, whether it is text or a specific phoneme set. See SpeechCapabilities</description>
</param>
</struct>
@@ -2051,6 +2553,8 @@ <element name="BACKGROUND_PROCESS" />
<element name="TESTING" />
<element name="SYSTEM" />
+ <element name="PROJECTION" />
+ <element name="REMOTE_CONTROL" />
</enum>
<enum name="PredefinedLayout" platform="documentation">
@@ -2226,9 +2730,14 @@ <element name="SystemRequestID" value="38" hexvalue="26" />
<element name="SendLocationID" value="39" hexvalue="27" />
<element name="DialNumberID" value="40" hexvalue="28" />
+ <element name="ButtonPressID" value="41" hexvalue="29" />
+ <element name="GetInteriorVehicleDataID" value="43" hexvalue="2B" />
+ <element name="SetInteriorVehicleDataID" value="44" hexvalue="2C" />
<element name="GetWayPointsID" value="45" hexvalue="2D" />
<element name="SubscribeWayPointsID" value="46" hexvalue="2E"/>
<element name="UnsubscribeWayPointsID" value="47" hexvalue="2F"/>
+ <element name="GetSystemCapabilityID" value="48" hexvalue="30"/>
+ <element name="SendHapticDataID" value="49" hexvalue="31" />
<!--
Base Notifications
@@ -2250,6 +2759,7 @@ <element name="OnTouchEventID" value="32780" hexvalue="800C" />
<element name="OnSystemRequestID" value="32781" hexvalue="800D" />
<element name="OnHashChangeID" value="32782" hexvalue="800E" />
+ <element name="OnInteriorVehicleDataID" value="32783" hexvalue="800F" />
<element name="OnWayPointChangeID" value="32784" hexvalue="8010" />
<!--
@@ -2267,7 +2777,6 @@ <element name="OnEncodedSyncPDataID" value="98304" hexvalue="18000" />
<element name="OnSyncPDataID" value="98305" hexvalue="18001" />
-
</enum>
<enum name="messageType">
@@ -2378,6 +2887,91 @@ <description>Address to be used by navigation engines for search</description>
</param>
</struct>
+
+ <enum name="SystemCapabilityType">
+ <element name="NAVIGATION"/>
+ <element name="PHONE_CALL"/>
+ <element name="VIDEO_STREAMING"/>
+ <element name="AUDIO_STREAMING"/>
+ <element name="REMOTE_CONTROL"/>
+ </enum>
+
+ <struct name="NavigationCapability">
+ <description>Extended capabilities for an onboard navigation system</description>
+ <param name="sendLocationEnabled" type="Boolean" mandatory="false">
+ <description>If the module has the ability to add locations to the onboard nav</description>
+ </param>
+ <param name="getWayPointsEnabled" type="Boolean" mandatory="false">
+ <description>If the module has the ability to return way points from onboard nav</description>
+ </param>
+ </struct>
+
+ <struct name="PhoneCapability">
+ <description>Extended capabilities of the module's phone feature</description>
+ <param name="dialNumberEnabled" type="Boolean" mandatory="false">
+ <description>If the module has the abiulity to perform dial number</description>
+ </param>
+ </struct>
+
+ <struct name="VideoStreamingCapability">
+ <description>Contains information about this system's video streaming capabilities.</description>
+ <param name="preferredResolution" type="ImageResolution" mandatory="false">
+ <description>The preferred resolution of a video stream for decoding and rendering on HMI.</description>
+ </param>
+ <param name="maxBitrate" type="Integer" minvalue="0" maxvalue="2147483647" mandatory="false">
+ <description>The maximum bitrate of video stream that is supported, in kbps.</description>
+ </param>
+ <param name="supportedFormats" type="VideoStreamingFormat" array="true" mandatory="false">
+ <description>
+ Detailed information on each format supported by this system, in its preferred order
+ (i.e. the first element in the array is most preferable to the system).
+ Each object will contain a VideoStreamingFormat that describes what can be expected.
+ </description>
+ </param>
+ <param name="hapticSpatialDataSupported" type="Boolean" mandatory="false">
+ <description>True if the system can utilize the haptic spatial data from the source being streamed.</description>
+ </param>
+ </struct>
+
+ <struct name="SystemCapability">
+ <description>The systemCapabilityType indicates which type of data should be changed and identifies which data object exists in this struct. For example, if the SystemCapability Type is NAVIGATION then a "navigationCapability" should exist</description>
+ <param name="systemCapabilityType" type="SystemCapabilityType" mandatory="true">
+ </param>
+ <param name="navigationCapability" type="NavigationCapability" mandatory="false">
+ </param>
+ <param name="phoneCapability" type="PhoneCapability" mandatory="false">
+ </param>
+ <param name="videoStreamingCapability" type="VideoStreamingCapability" mandatory="false">
+ </param>
+ <param name="remoteControlCapability" type="RemoteControlCapabilities" mandatory="false">
+ </param>
+ </struct>
+
+ <struct name="Rectangle">
+ <param name="x" type="Float" mandatory="true">
+ <description>The upper left X-coordinate of the rectangle</description>
+ </param>
+ <param name="y" type="Float" mandatory="true">
+ <description>The upper left Y-coordinate of the rectangle</description>
+ </param>
+ <param name="width" type="Float" mandatory="true">
+ <description>The width of the rectangle</description>
+ </param>
+ <param name="height" type="Float" mandatory="true">
+ <description>The height of the rectangle</description>
+ </param>
+ </struct>
+
+ <struct name="HapticRect">
+ <description>Defines haptic data for each user control object for video streaming application</description>
+ <param name="id" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
+ <description>A user control spatial identifier</description>
+ </param>
+ <param name="rect" type="Rectangle" mandatory="true">
+ <description>The position of the haptic rectangle to be highlighted. The center of this rectangle will be "touched" when a press occurs.</description>
+ </param>
+ </struct>
+
<!-- Requests/Responses -->
<function name="RegisterAppInterface" functionID="RegisterAppInterfaceID" messagetype="request">
@@ -2386,11 +2980,11 @@ Before registerAppInterface no other commands will be accepted/executed.
</description>
- <param name="syncMsgVersion" type="SyncMsgVersion">
+ <param name="syncMsgVersion" type="SyncMsgVersion" mandatory="true">
<description>See SyncMsgVersion</description>
</param>
- <param name="appName" type="String" maxlength="100">
+ <param name="appName" type="String" maxlength="100" mandatory="true">
<description>
The mobile application name, e.g. "Ford Drive Green".
Needs to be unique over all applications.
@@ -2429,7 +3023,7 @@ </description>
</param>
- <param name="isMediaApplication" type="Boolean">
+ <param name="isMediaApplication" type="Boolean" mandatory="true">
<description>
Indicates if the application is a media or a non-media application.
Only media applications will be able to stream audio to Sync that is audible outside of the BT media source.
@@ -2483,11 +3077,11 @@ <function name="RegisterAppInterface" functionID="RegisterAppInterfaceID" messagetype="response">
<description>The response to registerAppInterface</description>
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -2596,11 +3190,11 @@ <function name="UnregisterAppInterface" functionID="UnregisterAppInterfaceID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -2666,11 +3260,11 @@ <function name="SetGlobalProperties" functionID="SetGlobalPropertiesID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -2693,18 +3287,18 @@ <function name="ResetGlobalProperties" functionID="ResetGlobalPropertiesID" messagetype="request">
<description>Allows resetting global properties.</description>
- <param name="properties" type="GlobalProperty" minsize="1" maxsize="100" array="true" >
+ <param name="properties" type="GlobalProperty" minsize="1" maxsize="100" array="true" mandatory="true">
<description>Contains the names of all global properties (like timeoutPrompt) that should be unset. Resetting means, that they have the same value as at start up (default)</description>
</param>
</function>
<function name="ResetGlobalProperties" functionID="ResetGlobalPropertiesID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -2753,11 +3347,11 @@ <function name="AddCommand" functionID="AddCommandID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -2782,18 +3376,18 @@ <function name="DeleteCommand" functionID="DeleteCommandID" messagetype="request">
<description>Deletes all commands from the in-application menu with the specified command id.</description>
- <param name="cmdID" type="Integer" minvalue="0" maxvalue="2000000000">
+ <param name="cmdID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
<description>ID of the command(s) to delete.</description>
</param>
</function>
<function name="DeleteCommand" functionID="DeleteCommandID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -2815,7 +3409,7 @@ <function name="AddSubMenu" functionID="AddSubMenuID" messagetype="request">
<description>Adds a sub menu to the in-application menu.</description>
- <param name="menuID" type="Integer" minvalue="1" maxvalue="2000000000">
+ <param name="menuID" type="Integer" minvalue="1" maxvalue="2000000000" mandatory="true">
<description>unique ID of the sub menu to add.</description>
</param>
@@ -2830,17 +3424,17 @@ </description>
</param>
- <param name="menuName" maxlength="500" type="String">
+ <param name="menuName" maxlength="500" type="String" mandatory="true">
<description>Text to show in the menu for this sub menu.</description>
</param>
</function>
<function name="AddSubMenu" functionID="AddSubMenuID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -2861,7 +3455,7 @@ <function name="DeleteSubMenu" functionID="DeleteSubMenuID" messagetype="request">
<description>Deletes a submenu from the in-application menu.</description>
- <param name="menuID" type="Integer" minvalue="1" maxvalue="2000000000">
+ <param name="menuID" type="Integer" minvalue="1" maxvalue="2000000000" mandatory="true">
<description>The "menuID" of the submenu to delete. (See addSubMenu.menuID)</description>
</param>
@@ -2869,11 +3463,11 @@ <function name="DeleteSubMenu" functionID="DeleteSubMenuID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -2895,19 +3489,19 @@ <function name="CreateInteractionChoiceSet" functionID="CreateInteractionChoiceSetID" messagetype="request">
<description>creates interaction choice set to be used later by performInteraction</description>
- <param name="interactionChoiceSetID" type="Integer" minvalue="0" maxvalue="2000000000">
+ <param name="interactionChoiceSetID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
<description>Unique ID used for this interaction choice set.</description>
</param>
- <param name="choiceSet" type="Choice" minsize="1" maxsize="100" array="true" />
+ <param name="choiceSet" type="Choice" minsize="1" maxsize="100" array="true" mandatory="true"/>
</function>
<function name="CreateInteractionChoiceSet" functionID="CreateInteractionChoiceSetID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -2929,7 +3523,7 @@ <function name="PerformInteraction" functionID="PerformInteractionID" messagetype="request">
<description>Triggers an interaction (e.g. "Permit GPS?" - Yes, no, Always Allow).</description>
- <param name="initialText" type="String" maxlength="500" >
+ <param name="initialText" type="String" maxlength="500" mandatory="true">
<description>
Text to be displayed first.
</description>
@@ -2943,11 +3537,11 @@ </description>
</param>
- <param name="interactionMode" type="InteractionMode">
+ <param name="interactionMode" type="InteractionMode" mandatory="true">
<description>See InteractionMode.</description>
</param>
- <param name="interactionChoiceSetIDList" type="Integer" minsize="0" maxsize="100" minvalue="0" maxvalue="2000000000" array="true">
+ <param name="interactionChoiceSetIDList" type="Integer" minsize="0" maxsize="100" minvalue="0" maxvalue="2000000000" array="true" mandatory="true">
<description>List of interaction choice set IDs to use with an interaction.</description>
</param>
@@ -2990,11 +3584,11 @@ <function name="PerformInteraction" functionID="PerformInteractionID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -3042,17 +3636,17 @@ <description>Deletes interaction choice set that has been created with "CreateInteractionChoiceSet".</description>
<description>The interaction may only be deleted when not currently in use by a "performInteraction".</description>
- <param name="interactionChoiceSetID" type="Integer" minvalue="0" maxvalue="2000000000">
+ <param name="interactionChoiceSetID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
<description>ID of the interaction choice set to delete.</description>
</param>
</function>
<function name="DeleteInteractionChoiceSet" functionID="DeleteInteractionChoiceSetID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -3124,11 +3718,11 @@ <function name="Alert" functionID="AlertID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -3248,15 +3842,23 @@ </description>
</param>
+ <param name="metadataTags" type="MetadataTags" mandatory="false">
+ <description>
+ App defined metadata information. See MetadataTags. Uses mainField1, mainField2, mainField3, mainField4.
+ If omitted on supported displays, the currently set metadata tags will not change.
+ If any text field contains no tags, the metadata tag for that textfield should be removed.
+ </description>
+ </param>
+
</function>
<function name="Show" functionID="ShowID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -3279,7 +3881,7 @@ <function name="Speak" functionID="SpeakID" messagetype="request">
<description>Speaks a text.</description>
- <param name="ttsChunks" type="TTSChunk" minsize="1" maxsize="100" array="true">
+ <param name="ttsChunks" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="true">
<description>
An array of text chunks of type TTSChunk. See TTSChunk.
The array must have at least one item.
@@ -3290,11 +3892,11 @@ <function name="Speak" functionID="SpeakID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -3345,11 +3947,11 @@ </function>
<function name="SetMediaClockTimer" functionID="SetMediaClockTimerID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -3403,11 +4005,11 @@ </function>
<function name="PerformAudioPassThru" functionID="PerformAudioPassThruID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -3432,11 +4034,11 @@ </function>
<function name="EndAudioPassThru" functionID="EndAudioPassThruID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -3460,17 +4062,17 @@ To unsubscribe the notifications, use unsubscribeButton.
</description>
- <param name="buttonName" type="ButtonName">
+ <param name="buttonName" type="ButtonName" mandatory="true">
<description>Name of the button to subscribe.</description>
</param>
</function>
<function name="SubscribeButton" functionID="SubscribeButtonID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -3491,17 +4093,17 @@ <function name="UnsubscribeButton" functionID="UnsubscribeButtonID" messagetype="request">
<description>Unsubscribes from built-in HMI buttons.</description>
- <param name="buttonName" type="ButtonName">
+ <param name="buttonName" type="ButtonName" mandatory="true">
<description>Name of the button to unsubscribe.</description>
</param>
</function>
<function name="UnsubscribeButton" functionID="UnsubscribeButtonID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -3607,11 +4209,11 @@ </function>
<function name="SubscribeVehicleData" functionID="SubscribeVehicleDataID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true, if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="WARNINGS"/>
@@ -3790,11 +4392,11 @@ </function>
<function name="UnsubscribeVehicleData" functionID="UnsubscribeVehicleDataID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true, if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="WARNINGS"/>
@@ -3976,11 +4578,11 @@ <function name="GetVehicleData" functionID="GetVehicleDataID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true, if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -4092,11 +4694,11 @@ <function name="ReadDID" functionID="ReadDIDID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true, if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -4135,11 +4737,11 @@ <function name="GetDTCs" functionID="GetDTCsID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true, if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -4190,11 +4792,11 @@ <function name="DiagnosticMessage" functionID="DiagnosticMessageID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true, if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -4222,7 +4824,7 @@ <function name="ScrollableMessage" functionID="ScrollableMessageID" messagetype="request">
<description>Creates a full screen overlay containing a large block of formatted text that can be scrolled with up to 8 SoftButtons defined</description>
- <param name="scrollableMessageBody" type="String" maxlength="500">
+ <param name="scrollableMessageBody" type="String" maxlength="500" mandatory="true">
<description>Body of text that can include newlines and tabs.</description>
</param>
<param name="timeout" type="Integer" minvalue="1000" maxvalue="65535" defvalue="30000" mandatory="false">
@@ -4237,11 +4839,11 @@ </function>
<function name="ScrollableMessage" functionID="ScrollableMessageID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true, if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -4291,11 +4893,11 @@ </function>
<function name="Slider" functionID="SliderID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true, if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="SAVED"/>
@@ -4365,10 +4967,10 @@ </function>
<function name="ShowConstantTBT" functionID="ShowConstantTBTID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true, if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -4396,10 +4998,10 @@ </function>
<function name="AlertManeuver" functionID="AlertManeuverID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true, if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -4429,10 +5031,10 @@ </function>
<function name="UpdateTurnList" functionID="UpdateTurnListID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true, if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -4476,14 +5078,14 @@ <function name="ChangeRegistration" functionID="ChangeRegistrationID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description>
true, if successful
false, if failed
</description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -4506,11 +5108,11 @@ Generic Response is sent, when the name of a received msg cannot be retrieved. Only used in case of an error.
Currently, only resultCode INVALID_DATA is used.
</description>
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true, if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="INVALID_DATA"/>
</param>
@@ -4568,11 +5170,11 @@ <function name="PutFile" functionID="PutFileID" messagetype="response">
<description>Response is sent, when the file data was copied (success case). Or when an error occured.</description>
<description>Not supported on First generation SYNC vehicles. </description>
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true, if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -4584,7 +5186,7 @@ <element name="UNSUPPORTED_REQUEST"/>
</param>
- <param name="spaceAvailable" type="Integer" minvalue="0" maxvalue="2000000000">
+ <param name="spaceAvailable" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
<description>
Provides the total local space available in SDL Core for the registered app.
If the transfer has systemFile enabled, then the value will be set to 0 automatically.
@@ -4613,11 +5215,11 @@ Response is sent, when the file data was deleted (success case). Or when an error occured.
Not supported on First generation SYNC vehicles.
</description>
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -4629,7 +5231,7 @@ <element name="UNSUPPORTED_REQUEST"/>
</param>
- <param name="spaceAvailable" type="Integer" minvalue="0" maxvalue="2000000000">
+ <param name="spaceAvailable" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
<description>Provides the total local space available on SYNC for the registered app.</description>
</param>
@@ -4650,11 +5252,11 @@ Returns the current list of resident filenames for the registered app along with the current space available
Not supported on First generation SYNC vehicles.
</description>
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true, if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -4673,7 +5275,7 @@ </description>
</param>
- <param name="spaceAvailable" type="Integer" minvalue="0" maxvalue="2000000000">
+ <param name="spaceAvailable" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
<description>Provides the total local space available on SYNC for the registered app.</description>
</param>
@@ -4700,11 +5302,11 @@ Not supported on First generation SYNC vehicles.
</description>
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true, if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -4739,11 +5341,11 @@ <function name="SetDisplayLayout" functionID="SetDisplayLayoutID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true, if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -4795,11 +5397,11 @@ </function>
<function name="SystemRequest" functionID="SystemRequestID" messagetype="response" >
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true, if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -4820,6 +5422,36 @@ </param>
</function>
+ <function name="SendHapticData" functionID="SendHapticDataID" messagetype="request" >
+ <description>
+ Send the spatial data gathered from SDLCarWindow or VirtualDisplayEncoder to the HMI.
+ This data will be utilized by the HMI to determine how and when haptic events should occur
+ </description>
+ <param name="hapticRectData" type="HapticRect" minsize="0" maxsize="1000" mandatory="false" array="true">
+ <description>
+ Array of rectangle data structures that represent the locations of all user controls present on the HMI.
+ This data should be updated if/when the application presents a new screen.
+ When a request is sent, if successful, it will replace all rectangle data previously sent through RPC.
+ If an empty array is sent, the existing rectangle data will be cleared
+ </description>
+ </param>
+ </function>
+
+ <function name="SendHapticData" functionID="SendHapticDataID" messagetype="response" >
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="DISALLOWED"/>
+ </param>
+ </function>
+
<function name="SendLocation" functionID="SendLocationID" messagetype="request">
<param name="longitudeDegrees" type="Float" minvalue="-180" maxvalue="180" mandatory="false">
</param>
@@ -4866,11 +5498,11 @@ </function>
<function name="SendLocation" functionID="SendLocationID" messagetype="response" >
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true, if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -4891,7 +5523,7 @@ <function name="DialNumber" functionID="DialNumberID" messagetype="request">
<description>Dials a phone number and switches to phone application.</description>
- <param name="number" type="String" maxlength="40">
+ <param name="number" type="String" maxlength="40" mandatory="true">
<description>
Phone number is a string, which can be up to 40 chars.
All characters shall be stripped from string except digits 0-9 and * # , ; +
@@ -4900,12 +5532,12 @@ </function>
<function name="DialNumber" functionID="DialNumberID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description>true, if successful</description>
<description>false, if failed</description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -4926,10 +5558,10 @@ </function>
<function name="SubscribeWayPoints" functionID="SubscribeWayPointsID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true, if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -4952,10 +5584,10 @@ </function>
<function name="GetWayPoints" functionID="GetWayPointsID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true, if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -4980,10 +5612,10 @@ </function>
<function name="UnsubscribeWayPoints" functionID="UnsubscribeWayPointsID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true, if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -5001,32 +5633,63 @@ </param>
</function>
+ <function name="GetSystemCapability" functionID="GetSystemCapabilityID" messagetype="request">
+ <param name="systemCapabilityType" type="SystemCapabilityType" mandatory="true">
+ <description>The type of system capability to get more information on</description>
+ </param>
+ </function>
+
+ <function name="GetSystemCapability" functionID="GetSystemCapabilityID" messagetype="response">
+ <param name="systemCapability" type="SystemCapability" mandatory="true">
+ </param>
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="IGNORED"/>
+ <element name="DISALLOWED"/>
+ <element name="USER_DISALLOWED"/>
+ <element name="UNSUPPORTED_RESOURCE"/><description>The capability does not exist on the module</description>
+ <element name="DATA_NOT_AVAILABLE"/><description>The capability should exist on the module but there was an error retrieving the data.</description>
+ </param>
+ <param name="info" type="String" maxlength="1000" mandatory="false">
+ </param>
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+ </function>
+
<!-- Notifications -->
<function name="OnHMIStatus" functionID="OnHMIStatusID" messagetype="notification">
- <param name="hmiLevel" type="HMILevel">
+ <param name="hmiLevel" type="HMILevel" mandatory="true">
<description>See HMILevel</description>
</param>
- <param name="audioStreamingState" type="AudioStreamingState">
+ <param name="audioStreamingState" type="AudioStreamingState" mandatory="true">
<description>See AudioStreamingState</description>
</param>
- <param name="systemContext" type="SystemContext">
+ <param name="systemContext" type="SystemContext" mandatory="true">
<description>See SystemContext</description>
</param>
</function>
<function name="OnAppInterfaceUnregistered" functionID="OnAppInterfaceUnregisteredID" messagetype="notification">
- <param name="reason" type="AppInterfaceUnregisteredReason">
+ <param name="reason" type="AppInterfaceUnregisteredReason" mandatory="true">
<description>See AppInterfaceUnregisteredReason</description>
</param>
</function>
<function name="OnButtonEvent" functionID="OnButtonEventID" messagetype="notification">
<description>Notifies application of UP/DOWN events for buttons to which the application is subscribed.</description>
- <param name="buttonName" type="ButtonName"/>
- <param name="buttonEventMode" type="ButtonEventMode">
+ <param name="buttonName" type="ButtonName" mandatory="true"/>
+ <param name="buttonEventMode" type="ButtonEventMode" mandatory="true">
<description>Indicates whether this is an UP or DOWN event.</description>
</param>
<param name="customButtonID" type="Integer" minvalue="0" maxvalue="65536" mandatory="false">
@@ -5036,8 +5699,8 @@ <function name="OnButtonPress" functionID="OnButtonPressID" messagetype="notification">
<description>Notifies application of LONG/SHORT press events for buttons to which the application is subscribed.</description>
- <param name="buttonName" type="ButtonName"/>
- <param name="buttonPressMode" type="ButtonPressMode">
+ <param name="buttonName" type="ButtonName" mandatory="true"/>
+ <param name="buttonPressMode" type="ButtonPressMode" mandatory="true">
<description>Indicates whether this is a LONG or SHORT button press event.</description>
</param>
<param name="customButtonID" type="Integer" minvalue="0" maxvalue="65536" mandatory="false">
@@ -5129,32 +5792,32 @@ </function>
<function name="OnCommand" functionID="OnCommandID" messagetype="notification">
- <param name="cmdID" type="Integer" minvalue="0" maxvalue="2000000000">
+ <param name="cmdID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
<description>Command ID, which is related to a specific menu entry</description>
</param>
- <param name="triggerSource" type="TriggerSource">
+ <param name="triggerSource" type="TriggerSource" mandatory="true">
<description>See TriggerSource</description>
</param>
</function>
<function name="OnTBTClientState" functionID="OnTBTClientStateID" messagetype="notification" >
<description>Provides applications with notifications specific to the current TBT client status on the module</description>
- <param name="state" type="TBTState">
+ <param name="state" type="TBTState" mandatory="true">
<description>Current State of TBT client</description>
</param>
</function>
<function name="OnDriverDistraction" functionID="OnDriverDistractionID" messagetype="notification" >
<description>Provides driver distraction state to mobile applications</description>
- <param name="state" type="DriverDistractionState">
+ <param name="state" type="DriverDistractionState" mandatory="true">
<description>Current State of Driver Distraction</description>
</param>
</function>
<function name="OnPermissionsChange" functionID="OnPermissionsChangeID" messagetype="notification" >
<description>Provides update to app of which policy-table-enabled functions are available</description>
- <param name="permissionItem" type="PermissionItem" minsize="0" maxsize="500" array="true">
+ <param name="permissionItem" type="PermissionItem" minsize="0" maxsize="500" array="true" mandatory="true">
<description>Change in permissions for a given set of RPCs</description>
</param>
</function>
@@ -5164,10 +5827,10 @@ </function>
<function name="OnLanguageChange" functionID="OnLanguageChangeID" messagetype="notification">
- <param name="language" type="Language">
+ <param name="language" type="Language" mandatory="true">
<description>Current SYNC voice engine (VR+TTS) language</description>
</param>
- <param name="hmiDisplayLanguage" type="Language">
+ <param name="hmiDisplayLanguage" type="Language" mandatory="true">
<description>Current display language</description>
</param>
</function>
@@ -5267,11 +5930,11 @@ </function>
<function name="EncodedSyncPData" functionID="EncodedSyncPDataID" messagetype="response" >
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true, if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -5296,11 +5959,11 @@ </function>
<function name="SyncPData" functionID="SyncPDataID" messagetype="response" >
- <param name="success" type="Boolean" platform="documentation">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true, if successful; false, if failed </description>
</param>
- <param name="resultCode" type="Result" platform="documentation">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -5340,6 +6003,123 @@ </param>
</function>
+<function name="ButtonPress" functionID="ButtonPressID" messagetype="request">
+ <param name="moduleType" type="ModuleType" mandatory="true" >
+ <description>The module where the button should be pressed</description>
+ </param>
+ <param name="buttonName" type="ButtonName" mandatory="true" >
+ <description>The name of supported RC climate or radio button.</description>
+ </param>
+ <param name="buttonPressMode" type="ButtonPressMode" mandatory="true" >
+ <description>Indicates whether this is a LONG or SHORT button press event.</description>
+ </param>
+</function>
+
+<function name="ButtonPress" functionID="ButtonPressID" messagetype="response">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true" >
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="IGNORED"/>
+ <element name="DISALLOWED"/>
+ <element name="USER_DISALLOWED"/>
+ <element name="IN_USE"/>
+ </param>
+ <param name="info" type="String" maxlength="1000" mandatory="false">
+ </param>
+ <param name="success" type="Boolean" platform="documentation" mandatory="true" >
+ <description> true if successful; false, if failed </description>
+ </param>
+</function>
+
+<function name="GetInteriorVehicleData" functionID="GetInteriorVehicleDataID" messagetype="request">
+ <param name="moduleType" type="ModuleType" mandatory="true" >
+ <description>
+ The type of a RC module to retrieve module data from the vehicle.
+ In the future, this should be the Identification of a module.
+ </description>
+ </param>
+ <param name="subscribe" type="Boolean" mandatory="false" defvalue="false">
+ <description>
+ If subscribe is true, the head unit will register onInteriorVehicleData notifications for the requested moduelType.
+ If subscribe is false, the head unit will unregister onInteriorVehicleData notifications for the requested moduelType.
+ </description>
+ </param>
+</function>
+
+ <function name="GetInteriorVehicleData" functionID="GetInteriorVehicleDataID" messagetype="response">
+ <param name="moduleData" type="ModuleData" mandatory="true" >
+ </param>
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true" >
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="IGNORED"/>
+ <element name="DISALLOWED"/>
+ <element name="USER_DISALLOWED"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ </param>
+ <param name="info" type="String" maxlength="1000" mandatory="false">
+ </param>
+ <param name="success" type="Boolean" platform="documentation" mandatory="true" >
+ <description> true if successful; false, if failed </description>
+ </param>
+ <param name="isSubscribed" type="Boolean" mandatory="false" >
+ <description>
+ It is a conditional-mandatory parameter: must be returned in case "subscribe" parameter was present in the related request.
+ if "true" - the "moduleType" from request is successfully subscribed and the head unit will send onInteriorVehicleData notifications for the moduleType.
+ if "false" - the "moduleType" from request is either unsubscribed or failed to subscribe.
+ </description>
+ </param>
+
+ </function>
+
+ <function name="SetInteriorVehicleData" functionID="SetInteriorVehicleDataID" messagetype="request">
+ <param name="moduleData" type="ModuleData" mandatory="true" >
+ <description>The module data to set for the requested RC module.</description>
+ </param>
+ </function>
+
+ <function name="SetInteriorVehicleData" functionID="SetInteriorVehicleDataID" messagetype="response">
+ <description>Used to set the values of one remote control module </description>
+ <param name="moduleData" type="ModuleData" mandatory="true" >
+ </param>
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true" >
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="IGNORED"/>
+ <element name="DISALLOWED"/>
+ <element name="USER_DISALLOWED"/>
+ <element name="READ_ONLY"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ </param>
+ <param name="info" type="String" maxlength="1000" mandatory="false">
+ </param>
+ <param name="success" type="Boolean" platform="documentation" mandatory="true" >
+ <description> true if successful; false, if failed </description>
+ </param>
+ </function>
+
+
+ <function name="OnInteriorVehicleData" functionID="OnInteriorVehicleDataID" messagetype="notification">
+ <param name="moduleData" type="ModuleData" mandatory="true">
+ </param>
+ </function>
<!-- Deprecating - covered by OnSystemRequest
<function name="OnSyncPData" functionID="OnSyncPDataID" messagetype="notification" >
diff --git a/src/components/interfaces/QT_HMI_API.xml b/src/components/interfaces/QT_HMI_API.xml index 2d53559ad1..72076ca198 100644 --- a/src/components/interfaces/QT_HMI_API.xml +++ b/src/components/interfaces/QT_HMI_API.xml @@ -191,6 +191,36 @@ <element name="SK-SK" internal_name="SK_SK"> <description>Slovak - Slovakia</description> </element> + <element name="EN-IN" internal_name="EN_IN"> + <description>English - India</description> + </element> + <element name="TH-TH" internal_name="TH_TH"> + <description>Thai - Thailand</description> + </element> + <element name="EN-SA" internal_name="EN_SA"> + <description>English - Middle East</description> + </element> + <element name="HE-IL" internal_name="HE_IL"> + <description>Hebrew - Israel</description> + </element> + <element name="RO-RO" internal_name="RO_RO"> + <description>Romanian - Romania</description> + </element> + <element name="UK-UA" internal_name="UK_UA"> + <description>Ukrainian - Ukraine</description> + </element> + <element name="ID-ID" internal_name="ID_ID"> + <description>Indonesian - Indonesia</description> + </element> + <element name="VI-VN" internal_name="VI_VN"> + <description>Vietnamese - Vietnam</description> + </element> + <element name="MS-MY" internal_name="MS_MY"> + <description>Malay - Malaysia</description> + </element> + <element name="HI-IN" internal_name="HI_IN"> + <description>Hindi - India</description> + </element> </enum> <enum name="SoftButtonType"> <description>Contains information about the SoftButton capabilities.</description> diff --git a/src/components/interfaces/v4_protocol_v1_2_no_extra.xml b/src/components/interfaces/v4_protocol_v1_2_no_extra.xml index ead8596ee6..cc522d9f1c 100644 --- a/src/components/interfaces/v4_protocol_v1_2_no_extra.xml +++ b/src/components/interfaces/v4_protocol_v1_2_no_extra.xml @@ -326,16 +326,16 @@ </enum>
<struct name="Choice">
<description>A choice is an option given to the user, which can be selected either by menu, or through voice recognition system.</description>
- <param name="choiceID" type="Integer" minvalue="0" maxvalue="65535"/>
- <param name="menuName" type="String" maxlength="500"/>
- <param name="vrCommands" type="String" minsize="1" maxsize="100" maxlength="99" array="true"/>
+ <param name="choiceID" type="Integer" minvalue="0" maxvalue="65535" mandatory="true"/>
+ <param name="menuName" type="String" maxlength="500" mandatory="true"/>
+ <param name="vrCommands" type="String" minsize="1" maxsize="100" maxlength="99" array="true" mandatory="true"/>
</struct>
<struct name="SyncMsgVersion">
<description>Specifies the version number of the SYNC V4 protocol, that is supported by the mobile application</description>
- <param name="majorVersion" type="Integer" minvalue="1" maxvalue="1">
+ <param name="majorVersion" type="Integer" minvalue="1" maxvalue="1" mandatory="true">
<description>The major version indicates versions that is not-compatible to previous versions.</description>
</param>
- <param name="minorVersion" type="Integer" minvalue="0" maxvalue="1000">
+ <param name="minorVersion" type="Integer" minvalue="0" maxvalue="1000" mandatory="true">
<description>The minor version indicates a change to a previous version that should still allow to be run on an older version (with limited functionality)</description>
</param>
</struct>
@@ -349,53 +349,53 @@ </element>
</enum>
<struct name="StartTime">
- <param name="hours" type="Integer" minvalue="0" maxvalue="59">
+ <param name="hours" type="Integer" minvalue="0" maxvalue="59" mandatory="true">
<description>The hour of the media clock.</description>
<description>Some radios only support a max of 19 hours. If out of range, it will be rejected.</description>
</param>
- <param name="minutes" type="Integer" minvalue="0" maxvalue="59"/>
- <param name="seconds" type="Integer" minvalue="0" maxvalue="59"/>
+ <param name="minutes" type="Integer" minvalue="0" maxvalue="59" mandatory="true"/>
+ <param name="seconds" type="Integer" minvalue="0" maxvalue="59" mandatory="true"/>
</struct>
<struct name="TextField">
- <param name="name" type="TextFieldName">
+ <param name="name" type="TextFieldName" mandatory="true">
<description>The name that identifies the field. See TextFieldName.</description>
</param>
- <param name="characterSet" type="CharacterSet">
+ <param name="characterSet" type="CharacterSet" mandatory="true">
<description>The character set that is supported in this field. See CharacterSet.</description>
</param>
- <param name="width" type="Integer" minvalue="1" maxvalue="40">
+ <param name="width" type="Integer" minvalue="1" maxvalue="40" mandatory="true">
<description>The number of characters in one row of this field.</description>
</param>
- <param name="rows" type="Integer" minvalue="1" maxvalue="3">
+ <param name="rows" type="Integer" minvalue="1" maxvalue="3" mandatory="true">
<description>The number of rows of this field.</description>
</param>
</struct>
<struct name="DisplayCapabilities">
<description>Contains information about the display capabilities.</description>
- <param name="displayType" type="DisplayType">
+ <param name="displayType" type="DisplayType" mandatory="true">
<description>The type of the display. See DisplayType</description>
</param>
- <param name="textFields" type="TextField" minsize="1" maxsize="100" array="true">
+ <param name="textFields" type="TextField" minsize="1" maxsize="100" array="true" mandatory="true">
<description>A set of all fields that support text data. See TextField</description>
</param>
- <param name="mediaClockFormats" type="MediaClockFormat" minsize="1" maxsize="100" array="true">
+ <param name="mediaClockFormats" type="MediaClockFormat" minsize="1" maxsize="100" array="true" mandatory="true">
<description>A set of all supported formats of the media clock. See MediaClockFormat</description>
</param>
</struct>
<struct name="ButtonCapabilities">
<description>Contains information about a buttons capabilities.</description>
- <param name="name" type="ButtonName">
+ <param name="name" type="ButtonName" mandatory="true">
<description>The name of the button. See ButtonName.</description>
</param>
- <param name="shortPressAvailable" type="Boolean">
+ <param name="shortPressAvailable" type="Boolean" mandatory="true">
<description>The button supports a short press.</description>
<description>Whenever the button is pressed short, onButtonPressed( SHORT) will be invoked.</description>
</param>
- <param name="longPressAvailable" type="Boolean">
+ <param name="longPressAvailable" type="Boolean" mandatory="true">
<description>The button supports a LONG press.</description>
<description>Whenever the button is pressed long, onButtonPressed( LONG) will be invoked.</description>
</param>
- <param name="upDownAvailable" type="Boolean">
+ <param name="upDownAvailable" type="Boolean" mandatory="true">
<description>The button supports "button down" and "button up".</description>
<description>Whenever the button is pressed, onButtonEvent( DOWN) will be invoked.</description>
<description>Whenever the button is released, onButtonEvent( UP) will be invoked.</description>
@@ -413,17 +413,17 @@ <description>if position is greater or equal than the number of items on top level, the sub menu will be appended to the end.</description>
<description>If this param was omitted the entry will be added at the end.</description>
</param>
- <param name="menuName" type="String" maxlength="500">
+ <param name="menuName" type="String" maxlength="500" mandatory="true">
<description>Text to show in the menu for this sub menu.</description>
</param>
</struct>
<struct name="TTSChunk">
<description>A TTS chunk, that consists of the text/phonemes to speak and the type (like text or SAPI)</description>
- <param name="text" maxlength="500" type="String">
+ <param name="text" maxlength="500" type="String" mandatory="true">
<description>The text or phonemes to speak.</description>
<description>May not be empty.</description>
</param>
- <param name="type" type="SpeechCapabilities">
+ <param name="type" type="SpeechCapabilities" mandatory="true">
<description>Describes, whether it is text or a specific phoneme set. See SpeechCapabilities</description>
</param>
</struct>
@@ -431,10 +431,10 @@ <function name="RegisterAppInterface" messagetype="request">
<description>Establishes an interface with a mobile application.</description>
<description>Before registerAppInterface no other commands will be accepted/executed.</description>
- <param name="syncMsgVersion" type="SyncMsgVersion">
+ <param name="syncMsgVersion" type="SyncMsgVersion" mandatory="true">
<description>See SyncMsgVersion</description>
</param>
- <param name="appName" type="String" maxlength="100">
+ <param name="appName" type="String" maxlength="100" mandatory="true">
<description>The mobile application name, e.g. "Ford Drive Green".</description>
<description>Needs to be unique over all applications.</description>
<description>May not be empty.</description>
@@ -457,11 +457,11 @@ <description>If not provided, the default is equal to False"</description>
<description>Indicates if the mobile application wants to use vehicle data like GPS or speed.</description>
</param>
- <param name="isMediaApplication" type="Boolean">
+ <param name="isMediaApplication" type="Boolean" mandatory="true">
<description>Indicates if the application is a media or a non-media application.</description>
<description>Only media applications will be able to stream audio to Sync that is audible outside of the BT media source.</description>
</param>
- <param name="languageDesired" type="Language">
+ <param name="languageDesired" type="Language" mandatory="true">
<description>See Language</description>
<description>If the language doesn't match the active language on Sync, it will be rejected.</description>
<description>If the language is changed, while an app is registered, it will get disconnected.</description>
@@ -475,11 +475,11 @@ </function>
<function name="RegisterAppInterface" messagetype="response">
<description>The response to registerAppInterface</description>
- <param name="success" type="Boolean">
+ <param name="success" type="Boolean" mandatory="true">
<description>true, if successful</description>
<description>false, if failed</description>
</param>
- <param name="resultCode" type="Result">
+ <param name="resultCode" type="Result" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -527,11 +527,11 @@ <description>Will fail, if no registerAppInterface was completed successfully before.</description>
</function>
<function name="UnregisterAppInterface" messagetype="response">
- <param name="success" type="Boolean">
+ <param name="success" type="Boolean" mandatory="true">
<description>true, if successful</description>
<description>false, if failed</description>
</param>
- <param name="resultCode" type="Result">
+ <param name="resultCode" type="Result" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -559,11 +559,11 @@ <issue creator="rs">Do we want to add VR threshold params?</issue>
</function>
<function name="SetGlobalProperties" messagetype="response">
- <param name="success" type="Boolean">
+ <param name="success" type="Boolean" mandatory="true">
<description>true, if successful</description>
<description>false, if failed</description>
</param>
- <param name="resultCode" type="Result">
+ <param name="resultCode" type="Result" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -579,16 +579,16 @@ </function>
<function name="ResetGlobalProperties" messagetype="request">
<description>Allows resetting global properties.</description>
- <param name="properties" type="GlobalProperty" minsize="1" maxsize="100" array="true">
+ <param name="properties" type="GlobalProperty" minsize="1" maxsize="100" array="true" mandatory="true">
<description>Contains the names of all global properties (like timeoutPrompt) that should be unset. Resetting means, that they have the same value as at start up (default)</description>
</param>
</function>
<function name="ResetGlobalProperties" messagetype="response">
- <param name="success" type="Boolean">
+ <param name="success" type="Boolean" mandatory="true">
<description>true, if successful</description>
<description>false, if failed</description>
</param>
- <param name="resultCode" type="Result">
+ <param name="resultCode" type="Result" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -605,7 +605,7 @@ <function name="AddCommand" messagetype="request">
<description>Adds a command to the in application menu.</description>
<description>Either menuParams or vrCommands must be provided.</description>
- <param name="cmdID" type="Integer" minvalue="0" maxvalue="2000000000">
+ <param name="cmdID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
<description>unique ID of the command to add.</description>
</param>
<param name="menuParams" type="MenuParams" mandatory="false">
@@ -617,11 +617,11 @@ </param>
</function>
<function name="AddCommand" messagetype="response">
- <param name="success" type="Boolean">
+ <param name="success" type="Boolean" mandatory="true">
<description>true, if successful</description>
<description>false, if failed</description>
</param>
- <param name="resultCode" type="Result">
+ <param name="resultCode" type="Result" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -639,16 +639,16 @@ </function>
<function name="DeleteCommand" messagetype="request">
<description>Deletes all commands from the in-application menu with the specified command id.</description>
- <param name="cmdID" type="Integer" minvalue="0" maxvalue="2000000000">
+ <param name="cmdID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
<description>ID of the command(s) to delete.</description>
</param>
</function>
<function name="DeleteCommand" messagetype="response">
- <param name="success" type="Boolean">
+ <param name="success" type="Boolean" mandatory="true">
<description>true, if successful</description>
<description>false, if failed</description>
</param>
- <param name="resultCode" type="Result">
+ <param name="resultCode" type="Result" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -666,7 +666,7 @@ </function>
<function name="AddSubMenu" messagetype="request">
<description>Adds a sub menu to the in-application menu.</description>
- <param name="menuID" type="Integer" minvalue="0" maxvalue="2000000000">
+ <param name="menuID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
<description>unique ID of the sub menu to add.</description>
</param>
<param name="position" type="Integer" minvalue="0" maxvalue="1000" mandatory="false">
@@ -677,16 +677,16 @@ <description>Position of any submenu will always be located before the return and exit options</description>
<description>If this param was omitted the entry will be added at the end.</description>
</param>
- <param name="menuName" maxlength="500" type="String">
+ <param name="menuName" maxlength="500" type="String" mandatory="true">
<description>Text to show in the menu for this sub menu.</description>
</param>
</function>
<function name="AddSubMenu" messagetype="response">
- <param name="success" type="Boolean">
+ <param name="success" type="Boolean" mandatory="true">
<description>true, if successful</description>
<description>false, if failed</description>
</param>
- <param name="resultCode" type="Result">
+ <param name="resultCode" type="Result" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -704,16 +704,16 @@ </function>
<function name="DeleteSubMenu" messagetype="request">
<description>Deletes a submenu from the in-application menu.</description>
- <param name="menuID" type="Integer" minvalue="0" maxvalue="2000000000">
+ <param name="menuID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
<description>The "menuID" of the submenu to delete. (See addSubMenu.menuID)</description>
</param>
</function>
<function name="DeleteSubMenu" messagetype="response">
- <param name="success" type="Boolean">
+ <param name="success" type="Boolean" mandatory="true">
<description>true, if successful</description>
<description>false, if failed</description>
</param>
- <param name="resultCode" type="Result">
+ <param name="resultCode" type="Result" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -731,17 +731,17 @@ </function>
<function name="CreateInteractionChoiceSet" messagetype="request">
<description>creates interaction choice set to be used later by performInteraction</description>
- <param name="interactionChoiceSetID" type="Integer" minvalue="0" maxvalue="2000000000">
+ <param name="interactionChoiceSetID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
<description>Unique ID used for this interaction choice set.</description>
</param>
- <param name="choiceSet" type="Choice" minsize="1" maxsize="100" array="true"/>
+ <param name="choiceSet" type="Choice" minsize="1" maxsize="100" array="true" mandatory="true"/>
</function>
<function name="CreateInteractionChoiceSet" messagetype="response">
- <param name="success" type="Boolean">
+ <param name="success" type="Boolean" mandatory="true">
<description>true, if successful</description>
<description>false, if failed</description>
</param>
- <param name="resultCode" type="Result">
+ <param name="resultCode" type="Result" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -759,18 +759,18 @@ </function>
<function name="PerformInteraction" messagetype="request">
<description>Triggers an interaction (e.g. "Permit GPS?" - Yes, no, Always Allow).</description>
- <param name="initialText" type="String" maxlength="500">
+ <param name="initialText" type="String" maxlength="500" mandatory="true">
<description>Text to be displayed first.</description>
</param>
- <param name="initialPrompt" type="TTSChunk" minsize="1" maxsize="100" array="true">
+ <param name="initialPrompt" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="true">
<description>This is the intial prompt spoken to the user at the start of an interaction</description>
<description>An array of text chunks of type TTSChunk. See TTSChunk</description>
<description>The array must have at least one item</description>
</param>
- <param name="interactionMode" type="InteractionMode">
+ <param name="interactionMode" type="InteractionMode" mandatory="true">
<description>See InteractionMode.</description>
</param>
- <param name="interactionChoiceSetIDList" type="Integer" minsize="1" maxsize="100" minvalue="0" maxvalue="2000000000" array="true">
+ <param name="interactionChoiceSetIDList" type="Integer" minsize="1" maxsize="100" minvalue="0" maxvalue="2000000000" array="true" mandatory="true">
<description>List of interaction choice set IDs to use with an interaction.</description>
</param>
<param name="helpPrompt" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false">
@@ -789,11 +789,11 @@ </param>
</function>
<function name="PerformInteraction" messagetype="response">
- <param name="success" type="Boolean">
+ <param name="success" type="Boolean" mandatory="true">
<description>true, if successful</description>
<description>false, if failed</description>
</param>
- <param name="resultCode" type="Result">
+ <param name="resultCode" type="Result" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -819,16 +819,16 @@ <function name="DeleteInteractionChoiceSet" messagetype="request">
<description>Deletes interaction choice set that has been created with "CreateInteractionChoiceSet".</description>
<description>The interaction may only be deleted when not currently in use by a "performInteraction".</description>
- <param name="interactionChoiceSetID" type="Integer" minvalue="0" maxvalue="2000000000">
+ <param name="interactionChoiceSetID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
<description>ID of the interaction choice set to delete.</description>
</param>
</function>
<function name="DeleteInteractionChoiceSet" messagetype="response">
- <param name="success" type="Boolean">
+ <param name="success" type="Boolean" mandatory="true">
<description>true, if successful</description>
<description>false, if failed</description>
</param>
- <param name="resultCode" type="Result">
+ <param name="resultCode" type="Result" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -867,11 +867,11 @@ </param>
</function>
<function name="Alert" messagetype="response">
- <param name="success" type="Boolean">
+ <param name="success" type="Boolean" mandatory="true">
<description>true, if successful</description>
<description>false, if failed</description>
</param>
- <param name="resultCode" type="Result">
+ <param name="resultCode" type="Result" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -917,11 +917,11 @@ </param>
</function>
<function name="Show" messagetype="response">
- <param name="success" type="Boolean">
+ <param name="success" type="Boolean" mandatory="true">
<description>true, if successful</description>
<description>false, if failed</description>
</param>
- <param name="resultCode" type="Result">
+ <param name="resultCode" type="Result" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -937,17 +937,17 @@ </function>
<function name="Speak" messagetype="request">
<description>Speaks a text.</description>
- <param name="ttsChunks" type="TTSChunk" minsize="1" maxsize="100" array="true">
+ <param name="ttsChunks" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="true">
<description>An array of text chunks of type TTSChunk. See TTSChunk</description>
<description>The array must have at least one item</description>
</param>
</function>
<function name="Speak" messagetype="response">
- <param name="success" type="Boolean">
+ <param name="success" type="Boolean" mandatory="true">
<description>true, if successful</description>
<description>false, if failed</description>
</param>
- <param name="resultCode" type="Result">
+ <param name="resultCode" type="Result" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -969,17 +969,17 @@ <description>startTime must be provided for "run"</description>
<description>startTime will be ignored for "pause" and "resum"</description>
</param>
- <param name="updateMode" type="UpdateMode">
+ <param name="updateMode" type="UpdateMode" mandatory="true">
<description>Enumeration to control the media clock.</description>
<description>In case of pause or resume, the start time value is ignored and shall be left out. For resume, the time continues with the same value as it was when paused.</description>
</param>
</function>
<function name="SetMediaClockTimer" messagetype="response">
- <param name="success" type="Boolean">
+ <param name="success" type="Boolean" mandatory="true">
<description>true, if successful</description>
<description>false, if failed</description>
</param>
- <param name="resultCode" type="Result">
+ <param name="resultCode" type="Result" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -1002,11 +1002,11 @@ </param>
</function>
<function name="EncodedSyncPData" messagetype="response">
- <param name="success" type="Boolean">
+ <param name="success" type="Boolean" mandatory="true">
<description>true, if successful</description>
<description>false, if failed</description>
</param>
- <param name="resultCode" type="Result">
+ <param name="resultCode" type="Result" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -1024,16 +1024,16 @@ <description>Subscribes to built-in HMI buttons.</description>
<description>The application will be notified by the OnButtonEvent and OnButtonPress.</description>
<description>To unsubscribe the notifications, use unsubscribeButton.</description>
- <param name="buttonName" type="ButtonName">
+ <param name="buttonName" type="ButtonName" mandatory="true">
<description>Name of the button to subscribe.</description>
</param>
</function>
<function name="SubscribeButton" messagetype="response">
- <param name="success" type="Boolean">
+ <param name="success" type="Boolean" mandatory="true">
<description>true, if successful</description>
<description>false, if failed</description>
</param>
- <param name="resultCode" type="Result">
+ <param name="resultCode" type="Result" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -1051,16 +1051,16 @@ </function>
<function name="UnsubscribeButton" messagetype="request">
<description>Unsubscribes from built-in HMI buttons.</description>
- <param name="buttonName" type="ButtonName">
+ <param name="buttonName" type="ButtonName" mandatory="true">
<description>Name of the button to unsubscribe.</description>
</param>
</function>
<function name="UnsubscribeButton" messagetype="response">
- <param name="success" type="Boolean">
+ <param name="success" type="Boolean" mandatory="true">
<description>true, if successful</description>
<description>false, if failed</description>
</param>
- <param name="resultCode" type="Result">
+ <param name="resultCode" type="Result" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
<element name="INVALID_DATA"/>
@@ -1079,11 +1079,11 @@ <function name="GenericResponse" messagetype="response">
<description>Generic Response is sent, when the name of a received msg cannot be retrieved. Only used in case of an error.</description>
<description>Currently, only resultCode INVALID_DATA is used.</description>
- <param name="success" type="Boolean">
+ <param name="success" type="Boolean" mandatory="true">
<description>true, if successful</description>
<description>false, if failed</description>
</param>
- <param name="resultCode" type="Result">
+ <param name="resultCode" type="Result" mandatory="true">
<description>See Result</description>
<element name="INVALID_DATA"/>
</param>
@@ -1093,40 +1093,40 @@ </function>
<!-- Notifications -->
<function name="OnHMIStatus" messagetype="notification">
- <param name="hmiLevel" type="HMILevel">
+ <param name="hmiLevel" type="HMILevel" mandatory="true">
<description>See HMILevel</description>
</param>
- <param name="audioStreamingState" type="AudioStreamingState">
+ <param name="audioStreamingState" type="AudioStreamingState" mandatory="true">
<description>See AudioStreamingState</description>
</param>
- <param name="systemContext" type="SystemContext">
+ <param name="systemContext" type="SystemContext" mandatory="true">
<description>See SystemContext</description>
</param>
</function>
<function name="OnAppInterfaceUnregistered" messagetype="notification">
- <param name="reason" type="AppInterfaceUnregisteredReason">
+ <param name="reason" type="AppInterfaceUnregisteredReason" mandatory="true">
<description>See AppInterfaceUnregisteredReason</description>
</param>
</function>
<function name="OnButtonEvent" messagetype="notification">
<description>Notifies application of UP/DOWN events for buttons to which the application is subscribed.</description>
- <param name="buttonName" type="ButtonName"/>
- <param name="buttonEventMode" type="ButtonEventMode">
+ <param name="buttonName" type="ButtonName" mandatory="true"/>
+ <param name="buttonEventMode" type="ButtonEventMode" mandatory="true">
<description>Indicates whether this is an UP or DOWN event.</description>
</param>
</function>
<function name="OnButtonPress" messagetype="notification">
<description>Notifies application of LONG/SHORT press events for buttons to which the application is subscribed.</description>
- <param name="buttonName" type="ButtonName"/>
- <param name="buttonPressMode" type="ButtonPressMode">
+ <param name="buttonName" type="ButtonName" mandatory="true"/>
+ <param name="buttonPressMode" type="ButtonPressMode" mandatory="true">
<description>Indicates whether this is a LONG or SHORT button press event.</description>
</param>
</function>
<function name="OnCommand" messagetype="notification">
- <param name="cmdID" type="Integer" minvalue="0" maxvalue="2000000000">
+ <param name="cmdID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
<description>Command ID, which is related to a specific menu entry.</description>
</param>
- <param name="triggerSource" type="TriggerSource">
+ <param name="triggerSource" type="TriggerSource" mandatory="true">
<description>See TriggerSource</description>
</param>
</function>
@@ -1138,13 +1138,13 @@ </function>
<function name="OnTBTClientState" messagetype="notification">
<description>Provides applications with notifications specific to the current TBT client status on the module</description>
- <param name="state" type="TBTState">
+ <param name="state" type="TBTState" mandatory="true">
<description>Current State of TBT client</description>
</param>
</function>
<function name="OnDriverDistraction" messagetype="notification">
<description>Provides driver distraction state to mobile applications</description>
- <param name="state" type="DriverDistractionState">
+ <param name="state" type="DriverDistractionState" mandatory="true">
<description>Current State of Driver Distraction</description>
</param>
</function>
diff --git a/src/components/media_manager/CMakeLists.txt b/src/components/media_manager/CMakeLists.txt index c5b94ea7e1..4913102c9c 100644 --- a/src/components/media_manager/CMakeLists.txt +++ b/src/components/media_manager/CMakeLists.txt @@ -32,17 +32,20 @@ include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/platform.cmake) include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake) include_directories( - include + ${COMPONENTS_DIR}/media_manager/include/ ${COMPONENTS_DIR}/media_manager/include/audio/ ${COMPONENTS_DIR}/media_manager/include/video/ + ${COMPONENTS_DIR}/remote_control/include/ ${COMPONENTS_DIR}/utils/include/ ${COMPONENTS_DIR}/protocol_handler/include/ ${COMPONENTS_DIR}/connection_handler/include/ ${COMPONENTS_DIR}/application_manager/include/ ${COMPONENTS_DIR}/smart_objects/include/ + ${COMPONENTS_DIR}/policy/include/ + ${COMPONENTS_DIR}/rpc_base/include/ + ${COMPONENTS_DIR}/functional_module/include/ ${COMPONENTS_DIR}/hmi_message_handler/include/ ${COMPONENTS_DIR}/formatters/include/ - ${COMPONENTS_DIR}/rpc_base/include/ ${COMPONENTS_DIR}/config_profile/include/ ${JSONCPP_INCLUDE_DIRECTORY} ${CMAKE_BINARY_DIR}/src/components/ diff --git a/src/components/media_manager/include/media_manager/media_manager_impl.h b/src/components/media_manager/include/media_manager/media_manager_impl.h index c84a5a884f..7fbd4f2f6f 100644 --- a/src/components/media_manager/include/media_manager/media_manager_impl.h +++ b/src/components/media_manager/include/media_manager/media_manager_impl.h @@ -86,9 +86,10 @@ class MediaManagerImpl : public MediaManager, void set_mock_mic_listener(MediaListenerPtr media_listener); void set_mock_mic_recorder(MediaAdapterImpl* media_adapter); void set_mock_streamer(protocol_handler::ServiceType stype, - MediaAdapterImpl* mock_stream); - void set_mock_streamer_listener(protocol_handler::ServiceType stype, - MediaAdapterListener* mock_stream); + ::utils::SharedPtr<MediaAdapterImpl> mock_stream); + void set_mock_streamer_listener( + protocol_handler::ServiceType stype, + ::utils::SharedPtr<MediaAdapterListener> mock_stream); #endif // BUILD_TESTS protected: diff --git a/src/components/media_manager/src/media_manager_impl.cc b/src/components/media_manager/src/media_manager_impl.cc index b89fc4c71f..6a9ded9029 100644 --- a/src/components/media_manager/src/media_manager_impl.cc +++ b/src/components/media_manager/src/media_manager_impl.cc @@ -96,13 +96,15 @@ void MediaManagerImpl::set_mock_mic_recorder(MediaAdapterImpl* media_adapter) { #endif // EXTENDED_MEDIA_MODE -void MediaManagerImpl::set_mock_streamer(protocol_handler::ServiceType stype, - MediaAdapterImpl* mock_stream) { +void MediaManagerImpl::set_mock_streamer( + protocol_handler::ServiceType stype, + ::utils::SharedPtr<MediaAdapterImpl> mock_stream) { streamer_[stype] = mock_stream; } void MediaManagerImpl::set_mock_streamer_listener( - protocol_handler::ServiceType stype, MediaAdapterListener* mock_stream) { + protocol_handler::ServiceType stype, + ::utils::SharedPtr<MediaAdapterListener> mock_stream) { streamer_listener_[stype] = mock_stream; } diff --git a/src/components/media_manager/test/media_manager_impl_test.cc b/src/components/media_manager/test/media_manager_impl_test.cc index f9618c7fb8..7d0226fa67 100644 --- a/src/components/media_manager/test/media_manager_impl_test.cc +++ b/src/components/media_manager/test/media_manager_impl_test.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Ford Motor Company + * Copyright (c) 2017, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,147 +33,376 @@ #include "gmock/gmock.h" #include "media_manager/media_manager_impl.h" #include "media_manager/mock_media_adapter.h" -#include "media_manager/mock_media_adapter_listener.h" #include "media_manager/mock_media_adapter_impl.h" -#include "protocol_handler/mock_protocol_handler.h" +#include "media_manager/mock_media_adapter_listener.h" #include "media_manager/mock_media_manager_settings.h" -#include "application_manager/mock_application_manager.h" -#include "utils/shared_ptr.h" -#include "utils/make_shared.h" #include "application_manager/event_engine/event_dispatcher.h" -#include "application_manager/state_controller.h" +#include "application_manager/message.h" +#include "application_manager/mock_application.h" +#include "application_manager/mock_application_manager.h" #include "application_manager/resumption/resume_ctrl.h" -#include "resumption/last_state.h" +#include "application_manager/state_controller.h" +#include "protocol_handler/mock_protocol_handler.h" +#include "protocol/common.h" +#include "utils/make_shared.h" +#include "utils/shared_ptr.h" +#include "utils/file_system.h" +#include "utils/scope_guard.h" namespace test { namespace components { namespace media_manager_test { +using namespace file_system; +using namespace ::media_manager; using ::testing::_; +using ::testing::Return; using ::testing::ReturnRef; -using protocol_handler::ServiceType; +using ::utils::SharedPtr; +using ::utils::ScopeGuard; +using ::utils::MakeGuard; +using ::testing::NiceMock; +using ::protocol_handler::ServiceType; +using ::protocol_handler::RawMessagePtr; +using application_manager::ApplicationSharedPtr; +using application_manager::BinaryData; + +namespace { +const uint16_t kVideoStreamingPort = 8901u; +const uint16_t kAudioStreamingPort = 8000u; +const int32_t kApplicationKey = 1; +const int32_t kDuration = 1000; +const std::string kStorageFolder = "test_storage_folder"; +const std::string kOutputFile = "test_output_file"; +const std::string kResourceFolder = "test_resource_folder"; +const std::string kRecordingFileSource = "test_recording_file_source"; +const std::string kNamedVideoPipePath = "named_video_pipe_path"; +const std::string kNamedAudioPipePath = "named_audio_pipe_path"; +const std::string kVideoStreamFile = "video_stream_file"; +const std::string kAudioStreamFile = "audio_stream_file"; +const std::string kServerAddress = "server_address"; +const std::string kSocketValue = "socket"; +const std::string kPipeValue = "pipe"; +const std::string kFileValue = "file"; +const std::string kDefaultValue = ""; +const std::string kOutputFilePath = kStorageFolder + "/" + kOutputFile; +const uint32_t kProtocolVersion = ::protocol_handler::PROTOCOL_VERSION_2; +const uint32_t kConnectionKey = 1u; + +void dealloc_data(uint8_t* data) { + delete[] data; +} + +void dealloc_file(std::ofstream* test_file) { + delete test_file; +} +} // namespace + +typedef NiceMock<application_manager_test::MockApplication> MockApp; +typedef SharedPtr<MockApp> MockAppPtr; +typedef SharedPtr<MockMediaAdapterImpl> MockMediaAdapterImplPtr; class MediaManagerImplTest : public ::testing::Test { + public: + // media_adapter_mock_ will be deleted in media_manager_impl (dtor) + MediaManagerImplTest() : media_adapter_mock_(new MockMediaAdapter()) { + media_adapter_listener_mock_ = + utils::MakeShared<MockMediaAdapterListener>(); + ON_CALL(mock_media_manager_settings_, video_server_type()) + .WillByDefault(ReturnRef(kDefaultValue)); + ON_CALL(mock_media_manager_settings_, audio_server_type()) + .WillByDefault(ReturnRef(kDefaultValue)); + mock_app_ = ::utils::MakeShared<MockApp>(); + media_manager_impl_.reset( + new MediaManagerImpl(app_mngr_, mock_media_manager_settings_)); + } + protected: + void StartMicrophoneCheckHelper() { + EXPECT_CALL(app_mngr_, application(kApplicationKey)) + .WillOnce(Return(mock_app_)); + EXPECT_CALL(mock_media_manager_settings_, app_storage_folder()) + .WillOnce(ReturnRef(kStorageFolder)); + EXPECT_CALL(mock_media_manager_settings_, app_resource_folder()) + .WillOnce(ReturnRef(kResourceFolder)); + EXPECT_CALL(mock_media_manager_settings_, recording_file_source()) + .WillOnce(ReturnRef(kRecordingFileSource)); + } + + void InitMediaManagerPrecondition(const std::string& server_type) { + EXPECT_CALL(mock_media_manager_settings_, video_server_type()) + .WillRepeatedly(ReturnRef(server_type)); + EXPECT_CALL(mock_media_manager_settings_, audio_server_type()) + .WillRepeatedly(ReturnRef(server_type)); + } + + void InitMediaManagerSocketServerType() { + InitMediaManagerPrecondition(kSocketValue); + EXPECT_CALL(mock_media_manager_settings_, server_address()) + .WillRepeatedly(ReturnRef(kServerAddress)); + EXPECT_CALL(mock_media_manager_settings_, video_streaming_port()) + .WillOnce(Return(kVideoStreamingPort)); + EXPECT_CALL(mock_media_manager_settings_, audio_streaming_port()) + .WillOnce(Return(kAudioStreamingPort)); + media_manager_impl_.reset( + new MediaManagerImpl(app_mngr_, mock_media_manager_settings_)); + } + + void InitMediaManagerPipeServerType() { + InitMediaManagerPrecondition(kPipeValue); + EXPECT_CALL(mock_media_manager_settings_, named_video_pipe_path()) + .WillOnce(ReturnRef(kNamedAudioPipePath)); + EXPECT_CALL(mock_media_manager_settings_, named_audio_pipe_path()) + .WillOnce(ReturnRef(kNamedAudioPipePath)); + EXPECT_CALL(mock_media_manager_settings_, app_storage_folder()) + .WillRepeatedly(ReturnRef(kStorageFolder)); + media_manager_impl_.reset( + new MediaManagerImpl(app_mngr_, mock_media_manager_settings_)); + } + + void InitMediaManagerFileServerType() { + InitMediaManagerPrecondition(kFileValue); + EXPECT_CALL(mock_media_manager_settings_, video_stream_file()) + .WillOnce(ReturnRef(kVideoStreamFile)); + EXPECT_CALL(mock_media_manager_settings_, audio_stream_file()) + .WillOnce(ReturnRef(kAudioStreamFile)); + EXPECT_CALL(mock_media_manager_settings_, app_storage_folder()) + .WillRepeatedly(ReturnRef(kStorageFolder)); + media_manager_impl_.reset( + new MediaManagerImpl(app_mngr_, mock_media_manager_settings_)); + } + + void ReceivedMessage(const ServiceType service_type) { + EXPECT_CALL(app_mngr_, CanAppStream(kConnectionKey, service_type)) + .WillOnce(Return(true)); + EXPECT_CALL(app_mngr_, application(kConnectionKey)) + .WillOnce(Return(mock_app_)); + EXPECT_CALL(*mock_app_, WakeUpStreaming(service_type)); + MockMediaAdapterImplPtr mock_media_streamer = + utils::MakeShared<MockMediaAdapterImpl>(); + media_manager_impl_->set_mock_streamer(service_type, mock_media_streamer); + media_manager_impl_->set_mock_streamer_listener( + service_type, media_adapter_listener_mock_); + EXPECT_CALL(*mock_media_streamer, SendData(kConnectionKey, _)); + EmulateMobileMessage(service_type); + } + + void EmulateMobileMessage(const ServiceType serviceType) { + const uint32_t data_sending_size = 3u; + unsigned char data_sending[data_sending_size] = {0x20, 0x07, 0x01}; + const RawMessagePtr raw_message_ptr( + new ::protocol_handler::RawMessage(kConnectionKey, + kProtocolVersion, + data_sending, + data_sending_size, + serviceType)); + media_manager_impl_->OnMessageReceived(raw_message_ptr); + media_manager_impl_->OnMobileMessageSent(raw_message_ptr); + } + + application_manager_test::MockApplicationManager app_mngr_; + MockAppPtr mock_app_; + SharedPtr<MockMediaAdapterListener> media_adapter_listener_mock_; + MockMediaAdapter* media_adapter_mock_; const ::testing::NiceMock<MockMediaManagerSettings> mock_media_manager_settings_; - const std::string kDefaultValue_ = ""; + SharedPtr<MediaManagerImpl> media_manager_impl_; }; -TEST_F(MediaManagerImplTest, PlayA2DPSource) { - MockMediaAdapter* media_mock_ = new MockMediaAdapter(); +TEST_F(MediaManagerImplTest, + OnMessageReceived_WithUnsupportedServiceType_Cancelled) { + EXPECT_CALL(app_mngr_, CanAppStream(_, _)).Times(0); + EXPECT_CALL(app_mngr_, application(_)).Times(0); + EmulateMobileMessage(ServiceType::kInvalidServiceType); +} - application_manager_test::MockApplicationManager mock_application_manager; +TEST_F(MediaManagerImplTest, + OnMessageReceived_WithAudioServiceType_ApplicationNotFound_Cancelled) { + const ServiceType audio_type = ServiceType::kAudio; + EXPECT_CALL(app_mngr_, CanAppStream(kConnectionKey, audio_type)) + .WillOnce(Return(true)); + EXPECT_CALL(app_mngr_, application(kConnectionKey)) + .WillOnce(Return(ApplicationSharedPtr())); + EmulateMobileMessage(audio_type); +} - ON_CALL(mock_media_manager_settings_, video_server_type()) - .WillByDefault(ReturnRef(kDefaultValue_)); - ON_CALL(mock_media_manager_settings_, audio_server_type()) - .WillByDefault(ReturnRef(kDefaultValue_)); - MediaManagerImpl mediaManagerImpl(mock_application_manager, - mock_media_manager_settings_); - int32_t application_key = 1; +TEST_F(MediaManagerImplTest, + OnMessageReceived_WithVideoServiceType_ApplicationNotFound_Cancelled) { + const ServiceType video_type = ServiceType::kMobileNav; + EXPECT_CALL(app_mngr_, CanAppStream(kConnectionKey, video_type)) + .WillOnce(Return(true)); + EXPECT_CALL(app_mngr_, application(kConnectionKey)) + .WillOnce(Return(ApplicationSharedPtr())); + EmulateMobileMessage(video_type); +} - mediaManagerImpl.set_mock_a2dp_player(media_mock_); - EXPECT_CALL(*media_mock_, StartActivity(application_key)); - mediaManagerImpl.PlayA2DPSource(application_key); +TEST_F(MediaManagerImplTest, + OnMessageReceived_WithAudioServiceType_ForbidStreaming_Cancelled) { + const ServiceType audio_type = ServiceType::kAudio; + EXPECT_CALL(app_mngr_, CanAppStream(kConnectionKey, audio_type)) + .WillOnce(Return(false)); + EXPECT_CALL(app_mngr_, ForbidStreaming(kConnectionKey)); + EmulateMobileMessage(audio_type); } -TEST_F(MediaManagerImplTest, StopA2DPSource) { - MockMediaAdapter* media_mock_ = new MockMediaAdapter(); - application_manager_test::MockApplicationManager mock_application_manager; +TEST_F(MediaManagerImplTest, + OnMessageReceived_WithVideoServiceType_ForbidStreaming_Cancelled) { + const ServiceType video_type = ServiceType::kMobileNav; + EXPECT_CALL(app_mngr_, CanAppStream(kConnectionKey, video_type)) + .WillOnce(Return(false)); + EXPECT_CALL(app_mngr_, ForbidStreaming(kConnectionKey)); + EmulateMobileMessage(video_type); +} - ON_CALL(mock_media_manager_settings_, video_server_type()) - .WillByDefault(ReturnRef(kDefaultValue_)); - ON_CALL(mock_media_manager_settings_, audio_server_type()) - .WillByDefault(ReturnRef(kDefaultValue_)); - MediaManagerImpl mediaManagerImpl(mock_application_manager, - mock_media_manager_settings_); - int32_t application_key = 1; +TEST_F(MediaManagerImplTest, OnMessageReceived_WithAudioServiceType_SUCCESS) { + ReceivedMessage(ServiceType::kAudio); +} - mediaManagerImpl.set_mock_a2dp_player(media_mock_); - EXPECT_CALL(*media_mock_, StopActivity(application_key)); - mediaManagerImpl.StopA2DPSource(application_key); +TEST_F(MediaManagerImplTest, OnMessageReceived_WithVideoServiceType_SUCCESS) { + ReceivedMessage(ServiceType::kMobileNav); } -TEST_F(MediaManagerImplTest, StopMicrophoneRecording) { - MockMediaAdapterListener* media_adapter_listener_mock_ = - new MockMediaAdapterListener(); - application_manager_test::MockApplicationManager mock_application_manager; +TEST_F(MediaManagerImplTest, Init_Settings_ExpectSocketValue) { + InitMediaManagerSocketServerType(); +} - ON_CALL(mock_media_manager_settings_, video_server_type()) - .WillByDefault(ReturnRef(kDefaultValue_)); - ON_CALL(mock_media_manager_settings_, audio_server_type()) - .WillByDefault(ReturnRef(kDefaultValue_)); - MediaManagerImpl mediaManagerImpl(mock_application_manager, - mock_media_manager_settings_); - int32_t application_key = 1; +TEST_F(MediaManagerImplTest, Init_Settings_ExpectPipeValue) { + InitMediaManagerPipeServerType(); +} + +TEST_F(MediaManagerImplTest, Init_Settings_ExpectFileValue) { + InitMediaManagerFileServerType(); +} + +TEST_F(MediaManagerImplTest, PlayA2DPSource_WithCorrectA2DP_SUCCESS) { + media_manager_impl_->set_mock_a2dp_player(media_adapter_mock_); + EXPECT_CALL(*media_adapter_mock_, StartActivity(kApplicationKey)); + media_manager_impl_->PlayA2DPSource(kApplicationKey); +} + +TEST_F(MediaManagerImplTest, StopA2DPSource_WithCorrectA2DP_SUCCESS) { + media_manager_impl_->set_mock_a2dp_player(media_adapter_mock_); + EXPECT_CALL(*media_adapter_mock_, StopActivity(kApplicationKey)); + media_manager_impl_->StopA2DPSource(kApplicationKey); +} + +TEST_F(MediaManagerImplTest, + StartMicrophoneRecording_SourceFileIsWritable_ExpectTrue) { + StartMicrophoneCheckHelper(); + if (!DirectoryExists(kStorageFolder)) { + CreateDirectory(kStorageFolder); + } + EXPECT_FALSE(FileExists(kOutputFilePath)); + EXPECT_TRUE(CreateFile(kOutputFilePath)); - mediaManagerImpl.set_mock_mic_listener(media_adapter_listener_mock_); + const std::string record_file_path = + kResourceFolder + "/" + kRecordingFileSource; + if (!DirectoryExists(kResourceFolder)) { + CreateDirectory(kResourceFolder); + } + EXPECT_FALSE(FileExists(record_file_path)); + EXPECT_TRUE(CreateFile(record_file_path)); + std::ofstream* test_file = Open(record_file_path); + ScopeGuard file_guard = MakeGuard(dealloc_file, test_file); + UNUSED(file_guard); + EXPECT_TRUE(test_file->is_open()); + const uint32_t data_size = 4u; + uint8_t* data = new uint8_t[data_size]; + ScopeGuard data_guard = MakeGuard(dealloc_data, data); + UNUSED(data_guard); + for (uint32_t i = 0u; i < data_size; ++i) { + data[i] = i; + } + EXPECT_TRUE(Write(test_file, data, data_size)); + Close(test_file); + EXPECT_FALSE(test_file->is_open()); + BinaryData result; + EXPECT_TRUE(ReadBinaryFile(record_file_path, result)); + EXPECT_FALSE(result.empty()); + for (uint32_t i = 0u; i < data_size; ++i) { + EXPECT_EQ(data[i], result[i]); + } + media_manager_impl_->StartMicrophoneRecording( + kApplicationKey, kOutputFile, kDuration); + EXPECT_TRUE(RemoveDirectory(kResourceFolder, true)); + EXPECT_TRUE(RemoveDirectory(kStorageFolder, true)); +} + +TEST_F(MediaManagerImplTest, + StartMicrophoneRecording_OutputFileNotExists_ExpectFalse) { + StartMicrophoneCheckHelper(); + media_manager_impl_->set_mock_mic_listener(media_adapter_listener_mock_); + EXPECT_FALSE(FileExists(kOutputFilePath)); + media_manager_impl_->StartMicrophoneRecording( + kApplicationKey, kOutputFile, kDuration); +} + +TEST_F(MediaManagerImplTest, + StartMicrophoneRecording_OutputFileCouldNotDeleted_ExpectTrue) { + StartMicrophoneCheckHelper(); + if (!DirectoryExists(kStorageFolder)) { + CreateDirectory(kStorageFolder); + } + EXPECT_FALSE(FileExists(kOutputFilePath)); + EXPECT_TRUE(CreateFile(kOutputFilePath)); + chmod(kOutputFilePath.c_str(), S_IRUSR); + EXPECT_FALSE(DeleteFile(kOutputFilePath)); + media_manager_impl_->set_mock_mic_listener(media_adapter_listener_mock_); + EXPECT_TRUE(FileExists(kOutputFilePath)); + media_manager_impl_->StartMicrophoneRecording( + kApplicationKey, kOutputFile, kDuration); + chmod(kOutputFilePath.c_str(), S_IWUSR); + EXPECT_TRUE(RemoveDirectory(kStorageFolder, true)); +} + +TEST_F(MediaManagerImplTest, StopMicrophoneRecording_SUCCESS) { + media_manager_impl_->set_mock_mic_listener(media_adapter_listener_mock_); #ifdef EXTENDED_MEDIA_MODE MockMediaAdapterImpl* media_adapter_recorder_mock = new MockMediaAdapterImpl(); - mediaManagerImpl.set_mock_mic_recorder(media_adapter_recorder_mock); - EXPECT_CALL(*media_adapter_recorder_mock, StopActivity(application_key)); + media_manager_impl_->set_mock_mic_recorder(media_adapter_recorder_mock); + EXPECT_CALL(*media_adapter_recorder_mock, StopActivity(kApplicationKey)); #endif // EXTENDED_MEDIA_MODE - EXPECT_CALL(*media_adapter_listener_mock_, OnActivityEnded(application_key)); + EXPECT_CALL(*media_adapter_listener_mock_, OnActivityEnded(kApplicationKey)); #ifdef EXTENDED_MEDIA_MODE EXPECT_CALL(*media_adapter_recorder_mock, RemoveListener(_)); #endif // EXTENDED_MEDIA_MODE - mediaManagerImpl.StopMicrophoneRecording(application_key); + media_manager_impl_->StopMicrophoneRecording(kApplicationKey); } -TEST_F(MediaManagerImplTest, StartStopStreaming) { - application_manager_test::MockApplicationManager mock_application_manager; +TEST_F(MediaManagerImplTest, + StartStopStreaming_AudioAndVideoServiceType_SUCCESS) { + MockMediaAdapterImplPtr mock_audio_media_streamer = + utils::MakeShared<MockMediaAdapterImpl>(); + media_manager_impl_->set_mock_streamer(ServiceType::kAudio, + mock_audio_media_streamer); + MockMediaAdapterImplPtr mock_nav_media_streamer = + utils::MakeShared<MockMediaAdapterImpl>(); + media_manager_impl_->set_mock_streamer(ServiceType::kMobileNav, + mock_nav_media_streamer); - ON_CALL(mock_media_manager_settings_, video_server_type()) - .WillByDefault(ReturnRef(kDefaultValue_)); - ON_CALL(mock_media_manager_settings_, audio_server_type()) - .WillByDefault(ReturnRef(kDefaultValue_)); - MediaManagerImpl mediaManagerImpl(mock_application_manager, - mock_media_manager_settings_); - - int32_t application_key = 1; - MockMediaAdapterImpl* mock_audio_media_streamer = new MockMediaAdapterImpl(); - mediaManagerImpl.set_mock_streamer(protocol_handler::ServiceType::kAudio, - mock_audio_media_streamer); - MockMediaAdapterImpl* mock_nav_media_streamer = new MockMediaAdapterImpl(); - mediaManagerImpl.set_mock_streamer(protocol_handler::ServiceType::kMobileNav, - mock_nav_media_streamer); - - EXPECT_CALL(*mock_audio_media_streamer, StartActivity(application_key)); - mediaManagerImpl.StartStreaming(application_key, - protocol_handler::ServiceType::kAudio); - - EXPECT_CALL(*mock_nav_media_streamer, StartActivity(application_key)); - mediaManagerImpl.StartStreaming(application_key, - protocol_handler::ServiceType::kMobileNav); - - EXPECT_CALL(*mock_audio_media_streamer, StopActivity(application_key)); - mediaManagerImpl.StopStreaming(application_key, - protocol_handler::ServiceType::kAudio); - - EXPECT_CALL(*mock_nav_media_streamer, StopActivity(application_key)); - mediaManagerImpl.StopStreaming(application_key, - protocol_handler::ServiceType::kMobileNav); + EXPECT_CALL(*mock_audio_media_streamer, StartActivity(kApplicationKey)); + media_manager_impl_->StartStreaming(kApplicationKey, ServiceType::kAudio); + EXPECT_CALL(*mock_nav_media_streamer, StartActivity(kApplicationKey)); + media_manager_impl_->StartStreaming(kApplicationKey, ServiceType::kMobileNav); + EXPECT_CALL(*mock_audio_media_streamer, StopActivity(kApplicationKey)); + media_manager_impl_->StopStreaming(kApplicationKey, ServiceType::kAudio); + EXPECT_CALL(*mock_nav_media_streamer, StopActivity(kApplicationKey)); + media_manager_impl_->StopStreaming(kApplicationKey, ServiceType::kMobileNav); } -TEST_F(MediaManagerImplTest, CheckFramesProcessed) { - application_manager_test::MockApplicationManager mock_application_manager; - +TEST_F(MediaManagerImplTest, + CheckFramesProcessed_WithCorrectFramesNumber_SUCCESS) { ON_CALL(mock_media_manager_settings_, video_server_type()) - .WillByDefault(ReturnRef(kDefaultValue_)); + .WillByDefault(ReturnRef(kDefaultValue)); ON_CALL(mock_media_manager_settings_, audio_server_type()) - .WillByDefault(ReturnRef(kDefaultValue_)); - MediaManagerImpl mediaManagerImpl(mock_application_manager, - mock_media_manager_settings_); + .WillByDefault(ReturnRef(kDefaultValue)); protocol_handler_test::MockProtocolHandler mock_protocol_handler; - mediaManagerImpl.SetProtocolHandler(&mock_protocol_handler); - int32_t application_key = 1; - int32_t frame_number = 10; - + media_manager_impl_->SetProtocolHandler(&mock_protocol_handler); + const int32_t frame_number = 10; EXPECT_CALL(mock_protocol_handler, - SendFramesNumber(application_key, frame_number)); - mediaManagerImpl.FramesProcessed(application_key, frame_number); + SendFramesNumber(kApplicationKey, frame_number)); + media_manager_impl_->FramesProcessed(kApplicationKey, frame_number); } } // namespace media_manager_test diff --git a/src/components/policy/policy_external/CMakeLists.txt b/src/components/policy/policy_external/CMakeLists.txt index 2cbdbd7f64..8d04f20470 100644 --- a/src/components/policy/policy_external/CMakeLists.txt +++ b/src/components/policy/policy_external/CMakeLists.txt @@ -58,6 +58,10 @@ set(SOURCES ${COMPONENTS_DIR}/rpc_base/src/rpc_base/rpc_base.cc ) +if (REMOTE_CONTROL) + list(APPEND SOURCES ${POLICY_PATH}/src/access_remote_impl.cc) +endif() + list(APPEND SOURCES ${POLICY_PATH}/src/sql_pt_ext_queries.cc ${POLICY_PATH}/src/sql_pt_ext_representation.cc diff --git a/src/components/policy/policy_external/include/policy/access_remote.h b/src/components/policy/policy_external/include/policy/access_remote.h new file mode 100644 index 0000000000..fd185af075 --- /dev/null +++ b/src/components/policy/policy_external/include/policy/access_remote.h @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2015, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_ACCESS_REMOTE_H_ +#define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_ACCESS_REMOTE_H_ + +#include <vector> +#include <ostream> +#include <string> +#include "policy/policy_table/types.h" +#include "policy/policy_types.h" + +namespace policy_table = ::rpc::policy_table_interface_base; + +namespace policy { + +enum TypeAccess { kDisallowed, kAllowed }; +inline std::ostream& operator<<(std::ostream& output, TypeAccess x) { + output << "Access: "; + switch (x) { + case kDisallowed: + output << "DISALLOWED"; + break; + case kAllowed: + output << "ALLOWED"; + break; + default: + output << "Error: Unknown type"; + } + return output; +} + +struct ApplicationOnDevice { + PTString dev_id; + PTString app_id; +}; +inline bool operator<(const ApplicationOnDevice& x, + const ApplicationOnDevice& y) { + return x.dev_id < y.dev_id || (x.dev_id == y.dev_id && x.app_id < y.app_id); +} +inline bool operator==(const ApplicationOnDevice& x, + const ApplicationOnDevice& y) { + return x.dev_id == y.dev_id && x.app_id == y.app_id; +} +inline std::ostream& operator<<(std::ostream& output, + const ApplicationOnDevice& who) { + output << "Subject(dev:" << who.dev_id << ", app:" << who.app_id << ")"; + return output; +} + +typedef std::vector<PTString> RemoteControlParams; + +class AccessRemote { + public: + virtual ~AccessRemote() {} + /** + * @brief CheckModuleType check if module type is allowed for application + * @param app_id application id + * @param module module + * @return true if allowed, if not - false + */ + virtual bool CheckModuleType(const PTString& app_id, + policy_table::ModuleType module) const = 0; + + /** + * @brief SetDefaultHmiTypes setup default hmi typed for application + * @param who application on specific device + * @param hmi_types hmi types list + */ + virtual void SetDefaultHmiTypes(const ApplicationOnDevice& who, + const std::vector<int>& hmi_types) = 0; + + /** + * @brief GetGroups return list of groups for applicaiton + * @param who application on specific device + * @return list of groups + */ + virtual const policy_table::Strings& GetGroups( + const ApplicationOnDevice& who) = 0; + + /** + * @brief GetPermissionsForApp read list of permissions for application + * @param device_id device + * @param app_id application + * @param group_types output parameter for permissions + * @return true + */ + virtual bool GetPermissionsForApp(const std::string& device_id, + const std::string& app_id, + FunctionalIdType& group_types) = 0; + + /** + * @brief IsAppRemoteControl check is app is remote controll + * @param who application on specific device + * @return true is remote controll aotherwise return false + */ + virtual bool IsAppRemoteControl(const ApplicationOnDevice& who) = 0; + + /** + * @brief GetModuleTypes get list of module types of application + * @param policy_app_id application id + * @param modules output parameter for module types + * @return true on success otherwise false + */ + virtual bool GetModuleTypes(const std::string& policy_app_id, + std::vector<std::string>* modules) = 0; +}; + +} // namespace policy + +#endif // SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_ACCESS_REMOTE_H_ diff --git a/src/components/policy/policy_external/include/policy/access_remote_impl.h b/src/components/policy/policy_external/include/policy/access_remote_impl.h new file mode 100644 index 0000000000..0fa53b0237 --- /dev/null +++ b/src/components/policy/policy_external/include/policy/access_remote_impl.h @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2015, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_ACCESS_REMOTE_IMPL_H_ +#define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_ACCESS_REMOTE_IMPL_H_ + +#include <map> +#include "policy/policy_table/types.h" +#include "utils/macro.h" +#include "utils/shared_ptr.h" +#include "policy/access_remote.h" +#include "policy/cache_manager.h" + +using policy_table::FunctionalGroupings; + +namespace policy { + +class AccessRemoteImpl : public AccessRemote { + public: + AccessRemoteImpl(); + explicit AccessRemoteImpl(utils::SharedPtr<CacheManager> cache); + /** + * @brief CheckModuleType check if module type is allowed for application + * @param app_id application id + * @param module module + * @return true if allowed, if not - false + */ + bool CheckModuleType(const PTString& app_id, + policy_table::ModuleType module) const OVERRIDE; + + /** + * @brief SetDefaultHmiTypes setup default hmi typed for application + * @param who application on specific device + * @param hmi_types hmi types list + */ + void SetDefaultHmiTypes(const ApplicationOnDevice& who, + const std::vector<int>& hmi_types) OVERRIDE; + + /** + * @brief GetGroups return list of groups for applicaiton + * @param who application on specific device + * @return list of groups + */ + const policy_table::Strings& GetGroups( + const ApplicationOnDevice& who) OVERRIDE; + + /** + * @brief GetPermissionsForApp read list of permissions for application + * @param device_id device + * @param app_id application + * @param group_types output parameter for permissions + * @return true + */ + bool GetPermissionsForApp(const std::string& device_id, + const std::string& app_id, + FunctionalIdType& group_types) OVERRIDE; + + /** + * @brief IsAppRemoteControl check is app is remote controll + * @param who application on specific device + * @return true is remote controll aotherwise return false + */ + bool IsAppRemoteControl(const ApplicationOnDevice& who) OVERRIDE; + + /** + * @brief GetModuleTypes get list of module types of application + * @param policy_app_id application id + * @param modules output parameter for module types + * @return true on success otherwise false + */ + bool GetModuleTypes(const std::string& policy_app_id, + std::vector<std::string>* modules) OVERRIDE; + + private: + inline void set_enabled(bool value); + inline bool country_consent() const; + /** + * @brief HmiTypes get list of hmi types for application + * @param who application on specific device + * @return list of hmi types + */ + const policy_table::AppHMITypes& HmiTypes(const ApplicationOnDevice& who); + + /** + * @brief GetGroupsIds get list of groups for application + * @param device_id device id + * @param app_id application id + * @param grops_ids output parameter for group ids storing + */ + void GetGroupsIds(const std::string& device_id, + const std::string& app_id, + FunctionalGroupIDs& grops_ids); + + /** + * @brief IsAllowed check if modulename and rpc is allowed for application + * @param modules list of access modules + * @param module_name module name to check + * @param rpc_name rpc name to check + * @param input list of rpc parameters + * @return true if allowed otherwise return false + */ + bool IsAllowed(const policy_table::AccessModules& modules, + const std::string& module_name, + const std::string& rpc_name, + RemoteControlParams* input) const; + + /** + * @brief CompareParameters check if app parameters allowed + * @param parameters list of allowed parameters + * @param input list of parameters to check + * @return true if allowed otherwise return false + */ + bool CompareParameters(const policy_table::Strings& parameters, + RemoteControlParams* input) const; + + /** + * @brief cache_ contains pointer to cache manager instance + */ + utils::SharedPtr<CacheManager> cache_; + + /** + * @brief hmi_types_ contains list of default HMI types for applications + */ + typedef std::map<ApplicationOnDevice, policy_table::AppHMITypes> HMIList; + HMIList hmi_types_; + +#ifdef BUILD_TESTS + FRIEND_TEST(AccessRemoteImplTest, KeyMapTest); + FRIEND_TEST(AccessRemoteImplTest, Allow); + FRIEND_TEST(AccessRemoteImplTest, Deny); + FRIEND_TEST(AccessRemoteImplTest, ChangeAccess); + FRIEND_TEST(AccessRemoteImplTest, ResetBySubject); + FRIEND_TEST(AccessRemoteImplTest, ResetByObject); + FRIEND_TEST(AccessRemoteImplTest, CheckAllowed); + FRIEND_TEST(AccessRemoteImplTest, CheckDisallowed); + FRIEND_TEST(AccessRemoteImplTest, CheckManual); + FRIEND_TEST(AccessRemoteImplTest, CheckModuleType); + FRIEND_TEST(AccessRemoteImplTest, EnableDisable); + FRIEND_TEST(AccessRemoteImplTest, SetDefaultHmiTypes); + FRIEND_TEST(AccessRemoteImplTest, GetGroups); +#endif // BUILD_TESTS +}; + +} // namespace policy + +#endif // SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_ACCESS_REMOTE_IMPL_H_ diff --git a/src/components/policy/policy_external/include/policy/cache_manager.h b/src/components/policy/policy_external/include/policy/cache_manager.h index 95aed36f89..428a9bd2f6 100644 --- a/src/components/policy/policy_external/include/policy/cache_manager.h +++ b/src/components/policy/policy_external/include/policy/cache_manager.h @@ -914,6 +914,14 @@ class CacheManager : public CacheManagerInterface { sync_primitives::Lock backuper_locker_; BackgroundBackuper* backuper_; const PolicySettings* settings_; + + friend class AccessRemoteImpl; + +#ifdef BUILD_TESTS + FRIEND_TEST(AccessRemoteImplTest, CheckModuleType); + FRIEND_TEST(AccessRemoteImplTest, EnableDisable); + FRIEND_TEST(AccessRemoteImplTest, GetGroups); +#endif // BUILD_TESTS }; } // namespace policy #endif // SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_CACHE_MANAGER_H_ diff --git a/src/components/policy/policy_external/include/policy/cache_manager_interface.h b/src/components/policy/policy_external/include/policy/cache_manager_interface.h index 66631f32cf..ae1f8922ba 100644 --- a/src/components/policy/policy_external/include/policy/cache_manager_interface.h +++ b/src/components/policy/policy_external/include/policy/cache_manager_interface.h @@ -36,8 +36,10 @@ #include <string> #include <vector> +#include "policy/policy_table/types.h" +#include "policy/pt_representation.h" #include "utils/shared_ptr.h" -#include "usage_statistics/counter.h" +#include "policy/usage_statistics/counter.h" #include "policy/policy_types.h" #include "policy/policy_settings.h" diff --git a/src/components/policy/policy_external/include/policy/policy_helper.h b/src/components/policy/policy_external/include/policy/policy_helper.h index 10d6908b14..42c1ec0b46 100644 --- a/src/components/policy/policy_external/include/policy/policy_helper.h +++ b/src/components/policy/policy_external/include/policy/policy_helper.h @@ -323,6 +323,7 @@ FunctionalGroupIDs FindSame(const FunctionalGroupIDs& first, * @return true, if succeded, otherwise - false */ bool UnwrapAppPolicies(policy_table::ApplicationPolicies& app_policies); -} + +} // namespace policy #endif // SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_POLICY_HELPER_H_ diff --git a/src/components/policy/policy_external/include/policy/policy_manager_impl.h b/src/components/policy/policy_external/include/policy/policy_manager_impl.h index a37d0d66b9..f8d226c86a 100644 --- a/src/components/policy/policy_external/include/policy/policy_manager_impl.h +++ b/src/components/policy/policy_external/include/policy/policy_manager_impl.h @@ -43,6 +43,11 @@ #include "policy/policy_table/functions.h" #include "policy/usage_statistics/statistics_manager.h" +#ifdef SDL_REMOTE_CONTROL +#include "policy/access_remote.h" +#include "policy/access_remote_impl.h" +#endif // SDL_REMOTE_CONTROL + namespace policy_table = rpc::policy_table_interface_base; namespace policy { @@ -52,172 +57,557 @@ class PolicyManagerImpl : public PolicyManager { public: PolicyManagerImpl(); explicit PolicyManagerImpl(bool in_memory); - virtual void set_listener(PolicyListener* listener); + + /** + * @brief set_listener set new policy listener instance + * @param listener new policy listener + */ + void set_listener(PolicyListener* listener) OVERRIDE; + + /** + * @brief listener get current policy listener instance + * @return current policy listener + */ PolicyListener* listener() const { return listener_; } - virtual bool InitPT(const std::string& file_name, - const PolicySettings* settings); - virtual bool LoadPT(const std::string& file, const BinaryMessage& pt_content); - virtual bool ResetPT(const std::string& file_name); - - virtual std::string GetUpdateUrl(int service_type); - virtual void GetUpdateUrls(const uint32_t service_type, - EndpointUrls& out_end_points); - virtual void GetUpdateUrls(const std::string& service_type, - EndpointUrls& out_end_points); - virtual void RequestPTUpdate(); - virtual void CheckPermissions(const PTString& app_id, - const PTString& hmi_level, - const PTString& rpc, - const RPCParams& rpc_params, - CheckPermissionResult& result); - virtual bool ResetUserConsent(); - virtual void KmsChanged(int kilometers); - virtual void IncrementIgnitionCycles(); - virtual std::string ForcePTExchange(); - virtual std::string ForcePTExchangeAtUserRequest(); - virtual std::string GetPolicyTableStatus() const; - virtual void ResetRetrySequence(); - virtual int NextRetryTimeout(); - virtual uint32_t TimeoutExchangeMSec(); - virtual const std::vector<int> RetrySequenceDelaysSeconds(); - virtual void OnExceededTimeout(); - virtual std::string GetLockScreenIconUrl() const OVERRIDE; - virtual void OnUpdateStarted(); - virtual void PTUpdatedAt(Counters counter, int value); - - /** - * Refresh data about retry sequence from policy table + + /** + * @brief Inits Policy Table + * @param file_name path to preloaded PT file + * @param settings pointer to policy init settings + * @return true if init is successful + */ + bool InitPT(const std::string& file_name, + const PolicySettings* settings) OVERRIDE; + + /** + * @brief Updates Policy Table from binary message received from + * mobile device. Saves to Policy Table diff between Policy Table + * sent in snapshot and received Policy Table. + * @param file name of file with update policy table + * @param pt_content PTU as binary string + * @return true if successfully + */ + bool LoadPT(const std::string& file, + const BinaryMessage& pt_content) OVERRIDE; + + /** + * @brief Resets Policy Table + * @param file_name Path to preloaded PT file + * @return true if successfully + */ + bool ResetPT(const std::string& file_name) OVERRIDE; + + /** + * @brief Gets last URL for sending PTS to from PT itself + * @param service_type Service specifies user of URL + * @return last URL or empty string if endpoint entry is empty + */ + std::string GetUpdateUrl(int service_type) OVERRIDE; + + /** + * @brief Gets all URLs for sending PTS to from PT itself. + * @param service_type Service specifies user of URL + * @param out_end_points output vector of urls + */ + void GetUpdateUrls(const uint32_t service_type, + EndpointUrls& out_end_points) OVERRIDE; + void GetUpdateUrls(const std::string& service_type, + EndpointUrls& out_end_points) OVERRIDE; + + /** + * @brief PTU is needed, for this PTS has to be formed and sent. + */ + void RequestPTUpdate() OVERRIDE; + + /** + * @brief Check if specified RPC for specified application + * has permission to be executed in specified HMI Level + * and also its permitted params. + * @param app_id Id of application provided during registration + * @param hmi_level Current HMI Level of application + * @param rpc Name of RPC + * @param rpc_params List of RPC params + * @param result containing flag if HMI Level is allowed + * and list of allowed params. + */ + void CheckPermissions(const PTString& app_id, + const PTString& hmi_level, + const PTString& rpc, + const RPCParams& rpc_params, + CheckPermissionResult& result) OVERRIDE; + + /** + * @brief Clear all record of user consents. Used during Factory Reset. + * @return bool Success of operation + */ + bool ResetUserConsent() OVERRIDE; + + /** + * @brief Checks is PT exceeded kilometers + * @param kilometers current kilometers at odometer + * @return true if exceeded + */ + void KmsChanged(int kilometers) OVERRIDE; + + /** + * @brief Increments counter of ignition cycles + */ + void IncrementIgnitionCycles() OVERRIDE; + + /** + * @brief Exchange by hmi or mobile request + * @return Current status of policy table + */ + std::string ForcePTExchange() OVERRIDE; + + /** + * @brief Exchange by user request + * @return Current status of policy table + */ + std::string ForcePTExchangeAtUserRequest() OVERRIDE; + + /** + * @brief Returns current status of policy table for HMI + * @return Current status of policy table + */ + std::string GetPolicyTableStatus() const OVERRIDE; + + /** + * @brief Resets retry sequence + */ + void ResetRetrySequence() OVERRIDE; + + /** + * @brief Gets timeout to wait before next retry updating PT + * If timeout is less or equal to zero then the retry sequence is not need. + * @return timeout in seconds + */ + int NextRetryTimeout() OVERRIDE; + + /** + * @brief Gets timeout to wait until receive response + * @return timeout in seconds + */ + uint32_t TimeoutExchangeMSec() OVERRIDE; + + /** + * @brief List of timeouts in seconds between retries + * when attempt to update PT fails + * @return List of delays between attempts. + */ + const std::vector<int> RetrySequenceDelaysSeconds() OVERRIDE; + + /** + * @brief Handler of exceeding timeout of exchanging policy table + */ + void OnExceededTimeout() OVERRIDE; + + /** + * @brief GetLockScreenIcon allows to obtain lock screen icon url; + * @return url which point to the resourse where lock screen icon could be + *obtained. + */ + std::string GetLockScreenIconUrl() const OVERRIDE; + + /** + * @brief Handler of PTS sending out + */ + void OnUpdateStarted() OVERRIDE; + + /** + * @brief Sets counter value that passed for receiving PT UPdate. + */ + void PTUpdatedAt(Counters counter, int value) OVERRIDE; + + /** + * @brief Refresh data about retry sequence from policy table */ virtual void RefreshRetrySequence(); - virtual DeviceConsent GetUserConsentForDevice( + + /** + * @brief Gets user consent for mobile device data connection + * @param device_id Unique device identifier + * @return status of device consent + */ + DeviceConsent GetUserConsentForDevice( const std::string& device_id) const OVERRIDE; - virtual void GetUserConsentForApp( + + /** + * @brief Gets user consent for application + * @param device_id Device id + * @param policy_app_id Unique application id + * @param permissions Array of functional groups permissions + */ + void GetUserConsentForApp( const std::string& device_id, const std::string& policy_app_id, - std::vector<FunctionalGroupPermission>& permissions); - virtual void SetUserConsentForDevice(const std::string& device_id, - const bool is_allowed); - virtual bool ReactOnUserDevConsentForApp(const std::string& app_id, - const bool is_device_allowed); - virtual bool GetInitialAppData(const std::string& application_id, - StringArray* nicknames = NULL, - StringArray* app_hmi_types = NULL); + std::vector<FunctionalGroupPermission>& permissions) OVERRIDE; + + /** + * @brief Set user consent for mobile device data connection + * @param device_id Unique device identifier + * @param is_allowed User consent for usage device data connection + */ + void SetUserConsentForDevice(const std::string& device_id, + const bool is_allowed) OVERRIDE; - virtual void AddDevice(const std::string& device_id, - const std::string& connection_type); + /** + * @brief Update Application Policies as reaction + * on User allowing/disallowing device this app is running on. + * @param app_id Unique application id + * @param is_device_allowed true if user allowing device otherwise false + * @return true if operation was successful + */ + bool ReactOnUserDevConsentForApp(const std::string& app_id, + const bool is_device_allowed) OVERRIDE; + + /** + * @brief Retrieves data from app_policies about app on its registration: + * @param application_id - id of registered app + * @param nicknames Synonyms for application + * @param app_hmi_types Section on HMI where app can appear (Navigation, Phone + * etc) + */ + bool GetInitialAppData(const std::string& application_id, + StringArray* nicknames = NULL, + StringArray* app_hmi_types = NULL) OVERRIDE; + + /** + * @brief Add's device to policy table + * @param device_id Device mac address + * @param connection_type Device connection type + */ + void AddDevice(const std::string& device_id, + const std::string& connection_type) OVERRIDE; - virtual void SetDeviceInfo(const std::string& device_id, - const DeviceInfo& device_info); + /** + * @brief Stores device parameters received during application registration + * to policy table + * @param device_id Device mac address + * @param device_info Received device parameters + */ + void SetDeviceInfo(const std::string& device_id, + const DeviceInfo& device_info) OVERRIDE; + /** + * @brief Set user consent for application functional groups + * @param permissions User-defined application group pemissions. + * The permissions is not const reference because it may contains + * valid data as well as invalid. So we will remove all invalid data + * from this structure. + * @param mode notification mode + */ void SetUserConsentForApp(const PermissionConsent& permissions, const NotificationMode mode) OVERRIDE; - virtual bool GetDefaultHmi(const std::string& policy_app_id, - std::string* default_hmi) const; + /** + * @brief Get default HMI level for application + * @param policy_app_id Unique application id + * @param default_hmi Default HMI level for application or empty, if value + * was not set + * @return true, if succedeed, otherwise - false + */ + bool GetDefaultHmi(const std::string& policy_app_id, + std::string* default_hmi) const OVERRIDE; - virtual bool GetPriority(const std::string& policy_app_id, - std::string* priority) const; + /** + * @brief Get priority for application + * @param policy_app_id Unique application id + * @param priority Priority for application or empty, if value was not set + * @return true, if succedeed, otherwise - false + */ + bool GetPriority(const std::string& policy_app_id, + std::string* priority) const OVERRIDE; - virtual std::vector<UserFriendlyMessage> GetUserFriendlyMessages( + /** + * @brief Get user friendly messages for given RPC messages and language + * @param message_codes RPC message codes + * @param language Language + * @param active_hmi_language Currently active language + * @return Array of structs with appropriate message parameters + */ + std::vector<UserFriendlyMessage> GetUserFriendlyMessages( const std::vector<std::string>& message_code, const std::string& language, - const std::string& active_hmi_language); + const std::string& active_hmi_language) OVERRIDE; - virtual bool IsApplicationRevoked(const std::string& app_id) const; + /** + * @brief Checks if the application is revoked + * @param app_id application id + * @return true if application is revoked + */ + bool IsApplicationRevoked(const std::string& app_id) const OVERRIDE; - virtual void GetPermissionsForApp( + /** + * @brief Get resulting RPCs permissions for application which started on + * specific device + * @param device_id Device id + * @param policy_app_id Unique application id + * @param permissions Array of functional groups permissions + */ + void GetPermissionsForApp( const std::string& device_id, const std::string& policy_app_id, - std::vector<FunctionalGroupPermission>& permissions); + std::vector<FunctionalGroupPermission>& permissions) OVERRIDE; - virtual std::string& GetCurrentDeviceId( - const std::string& policy_app_id) const; + /** + * @brief Return device id, which hosts specific application + * @param policy_app_id Application id, which is required to update device id + */ + std::string& GetCurrentDeviceId( + const std::string& policy_app_id) const OVERRIDE; - virtual void SetSystemLanguage(const std::string& language); + /** + * @brief Set current system language + * @param language Language + */ + void SetSystemLanguage(const std::string& language) OVERRIDE; - virtual void SetSystemInfo(const std::string& ccpu_version, - const std::string& wers_country_code, - const std::string& language); - virtual void OnSystemReady(); + /** + * @brief Set data from GetSystemInfo response to policy table + * @param ccpu_version CCPU version + * @param wers_country_code WERS country code + * @param language System language + */ + void SetSystemInfo(const std::string& ccpu_version, + const std::string& wers_country_code, + const std::string& language) OVERRIDE; - virtual uint32_t GetNotificationsNumber( - const std::string& priority) const OVERRIDE; + /** + * @brief Runs necessary operations, which is depends on external system + * state, e.g. getting system-specific parameters which are need to be + * filled into policy table + */ + void OnSystemReady() OVERRIDE; - virtual void SetVINValue(const std::string& value); + /** + * @brief Get number of notification by priority + * @param priority Specified priority + * @return notification number + */ + uint32_t GetNotificationsNumber(const std::string& priority) const OVERRIDE; - // Interface StatisticsManager (begin) - virtual void Increment(usage_statistics::GlobalCounterId type); - virtual void Increment(const std::string& app_id, - usage_statistics::AppCounterId type); - virtual void Set(const std::string& app_id, - usage_statistics::AppInfoId type, - const std::string& value); - virtual void Add(const std::string& app_id, - usage_statistics::AppStopwatchId type, - int32_t timespan_seconds); - // Interface StatisticsManager (end) + /** + * @brief Allows to update Vehicle Identification Number in policy table. + * @param new value for the parameter. + */ + void SetVINValue(const std::string& value) OVERRIDE; - AppPermissions GetAppPermissionsChanges(const std::string& policy_app_id); - void RemovePendingPermissionChanges(const std::string& app_id); + /** + * @brief Gets specific application permissions changes since last policy + * table update + * @param policy_app_id Unique application id + * @return Permissions changes + */ + AppPermissions GetAppPermissionsChanges( + const std::string& policy_app_id) OVERRIDE; - void SendNotificationOnPermissionsUpdated(const std::string& application_id); + /** + * @brief Removes specific application permissions changes + * @param app_id Unique application id + */ + void RemovePendingPermissionChanges(const std::string& app_id) OVERRIDE; - bool CleanupUnpairedDevices(); + /** + * @brief Send OnPermissionsUpdated for choosen application + * @param application_id Unique application id + */ + void SendNotificationOnPermissionsUpdated( + const std::string& application_id) OVERRIDE; - bool CanAppKeepContext(const std::string& app_id) const; - bool CanAppStealFocus(const std::string& app_id) const; - void MarkUnpairedDevice(const std::string& device_id); + /** + * @brief Removes unpaired device records and related records from DB + * @return true, if succedeed, otherwise - false + */ + bool CleanupUnpairedDevices() OVERRIDE; + /** + * @brief Check if app can keep context. + * @param app_id Unique application id + * @return true if app can keep context, otherwise - false + */ + bool CanAppKeepContext(const std::string& app_id) const OVERRIDE; + + /** + * @brief Check if app can steal focus. + * @param app_id Unique application id + * @return true if app can steal focus, otherwise - false + */ + bool CanAppStealFocus(const std::string& app_id) const OVERRIDE; + + /** + * @brief Marks device as upaired + * @param device_id id device + */ + void MarkUnpairedDevice(const std::string& device_id) OVERRIDE; + + /** + * @brief Adds, application to the db or update existed one + * run PTU if policy update is necessary for application. + * @param application_id Unique application id + * @param hmi_types application HMI types + * @return function that will notify update manager about new application + */ StatusNotifier AddApplication( const std::string& application_id, - const rpc::policy_table_interface_base::AppHmiTypes& hmi_types); + const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) OVERRIDE; + +#ifdef SDL_REMOTE_CONTROL + /** + * @brief Assigns new HMI types for specified application + * @param application_id Unique application id + * @param hmi_types new HMI types list + */ + void SetDefaultHmiTypes(const std::string& application_id, + const std::vector<int>& hmi_types) OVERRIDE; + + /** + * @brief Gets HMI types + * @param application_id ID application + * @param app_types list to save HMI types + * @return true if policy has specific policy for this application + */ + bool GetHMITypes(const std::string& application_id, + std::vector<int>* app_types) OVERRIDE; + /** + * @brief Setter for access_remote instance + * @param access_remote pointer to new access_remote instance + */ + void set_access_remote(utils::SharedPtr<AccessRemote> access_remote) OVERRIDE; + + /** + * @brief Sends notification about application HMI level changed + * @param who application information structure + */ + void SendHMILevelChanged(const ApplicationOnDevice& who); + + /** + * @brief Sends notification if application permissions were changed + * @param application_id Unique id of application + */ + void OnPrimaryGroupsChanged(const std::string& application_id); +#endif // SDL_REMOTE_CONTROL + + /** + * @brief Removes consent for application functional group + * @param application_id Unique id of application + * @param group_name application functional group name + */ virtual void RemoveAppConsentForGroup(const std::string& app_id, const std::string& group_name); - virtual uint32_t HeartBeatTimeout(const std::string& app_id) const; + /** + * @brief Returns heart beat timeout + * @param app_id application id + * @return if timeout was set then value in milliseconds greater zero + * otherwise heart beat for specific application isn't set + */ + uint32_t HeartBeatTimeout(const std::string& app_id) const OVERRIDE; - virtual void SaveUpdateStatusRequired(bool is_update_needed); + /** + * @brief SaveUpdateStatusRequired allows to save update status. + * @param is_update_needed true if update needed + */ + void SaveUpdateStatusRequired(bool is_update_needed) OVERRIDE; - virtual bool IsPredataPolicy(const std::string& policy_app_id) const OVERRIDE; - void set_cache_manager(CacheManagerInterface* cache_manager); + /** + * @brief Checks, if application has policy assigned w/o data consent + * @param policy_app_id Unique application id + * @return true, if policy assigned w/o data consent, otherwise -false + */ + bool IsPredataPolicy(const std::string& policy_app_id) const OVERRIDE; - virtual void OnAppsSearchStarted(); + /** + * @brief Setter for cache_manager instance + * @param cache_manager pointer to new cache_manager instance + */ + void set_cache_manager(CacheManagerInterface* cache_manager); - virtual void OnAppsSearchCompleted(const bool trigger_ptu); + /** + * @brief Handler on applications search started + */ + void OnAppsSearchStarted() OVERRIDE; -#ifdef BUILD_TESTS - inline CacheManagerInterfaceSPtr GetCache() { - return cache_; - } - inline void SetSendOnUpdateFlags(const bool send_on_update_sent_out, - const bool wrong_ptu_update_received) { - send_on_update_sent_out_ = send_on_update_sent_out; - wrong_ptu_update_received_ = wrong_ptu_update_received; - } -#endif // BUILD_TESTS + /** + * @brief Handler on applications search completed + * @param trigger_ptu contains true if PTU should be triggered + */ + void OnAppsSearchCompleted(const bool trigger_ptu) OVERRIDE; - virtual const std::vector<std::string> GetAppRequestTypes( - const std::string policy_app_id) const; + /** + * @brief Gets request types for application + * @param policy_app_id Unique application id + * @return request types of application + */ + const std::vector<std::string> GetAppRequestTypes( + const std::string policy_app_id) const OVERRIDE; - virtual const VehicleInfo GetVehicleInfo() const; + /** + * @brief Get information about vehicle + * @return vehicle information + */ + const VehicleInfo GetVehicleInfo() const OVERRIDE; - virtual void OnAppRegisteredOnMobile(const std::string& application_id); + /** + * @brief OnAppRegisteredOnMobile allows to handle event when application were + * succesfully registered on mobile device. + * It will send OnAppPermissionSend notification and will try to start PTU. * + * @param application_id registered application. + */ + void OnAppRegisteredOnMobile(const std::string& application_id) OVERRIDE; - virtual const MetaInfo GetMetaInfo() const OVERRIDE; + /** + * @brief Gets meta information + * @return meta information + */ + const MetaInfo GetMetaInfo() const OVERRIDE; - virtual std::string RetrieveCertificate() const OVERRIDE; + /** + * @brief RetrieveCertificate Allows to obtain certificate in order + * to start secure connection. + * @return The certificate in PKCS#7 format. + */ + std::string RetrieveCertificate() const OVERRIDE; - virtual bool HasCertificate() const OVERRIDE; + /** + * @brief HasCertificate check whether policy table has certificate + * int module_config section. + * @return true in case certificate exists, false otherwise + */ + bool HasCertificate() const OVERRIDE; - virtual void SetDecryptedCertificate(const std::string& certificate) OVERRIDE; + /** + * @brief Sets decrypted certificate in policy table + * @param certificate content of certificate + */ + void SetDecryptedCertificate(const std::string& certificate) OVERRIDE; + /** + * @brief Getter for policy settings + * @return policy settings instance + */ const PolicySettings& get_settings() const OVERRIDE; + /** + * @brief Finds the next URL that must be sent on OnSystemRequest retry + * @param urls vector of vectors that contain urls for each application + * @return Pair of policy application id and application url id from the + * urls vector + */ AppIdURL GetNextUpdateUrl(const EndpointUrls& urls) OVERRIDE; + /** + * @brief Checks if there is existing URL in the EndpointUrls vector with + * index saved in the policy manager and if not, it moves to the next + * application index + * @param rs contains the application index and url index from the + * urls vector that are to be sent on the next OnSystemRequest + * @param urls vector of vectors that contain urls for each application + * @return Pair of application index and url index + */ AppIdURL RetrySequenceUrl(const struct RetrySequenceURL& rs, const EndpointUrls& urls) const OVERRIDE; @@ -228,20 +618,90 @@ class PolicyManagerImpl : public PolicyManager { * @return true if such check is needed, false - if not. */ bool IsNeedToUpdateExternalConsentStatus( - const ExternalConsentStatus& status) const; + const ExternalConsentStatus& status) const OVERRIDE; + + /** + * @brief Saves customer connectivity settings status + * @param status ExternalConsent status + * @return true if succeeded, otherwise - false + */ + bool SetExternalConsentStatus(const ExternalConsentStatus& status) OVERRIDE; /** * @brief Gets customer connectivity settings status * @return ExternalConsent status */ - bool SetExternalConsentStatus(const ExternalConsentStatus& status) OVERRIDE; ExternalConsentStatus GetExternalConsentStatus() OVERRIDE; +#ifdef BUILD_TESTS + /** + * @brief Getter for cache_manager instance + * @return cache_manager instance + */ + inline CacheManagerInterfaceSPtr GetCache() { + return cache_; + } + + /** + * @brief Setter for send_on_update_sent_out and wrong_ptu_update_received + * @param send_on_update_sent_out new value of this flag + * @param wrong_ptu_update_received new value of this flag + */ + inline void SetSendOnUpdateFlags(const bool send_on_update_sent_out, + const bool wrong_ptu_update_received) { + send_on_update_sent_out_ = send_on_update_sent_out; + wrong_ptu_update_received_ = wrong_ptu_update_received; + } +#endif // BUILD_TESTS + + // Interface StatisticsManager (begin) + /** + * @brief Increments global counter + * @param type counter type + */ + void Increment(usage_statistics::GlobalCounterId type) OVERRIDE; + + /** + * @brief Increments specified application counter + * @param app_id Unique ID of application + * @param type application counter type + */ + void Increment(const std::string& app_id, + usage_statistics::AppCounterId type) OVERRIDE; + /** + * @brief Sets specified application info value + * @param app_id Unique ID of application + * @param type application info type + * @param value new value for counter + */ + void Set(const std::string& app_id, + usage_statistics::AppInfoId type, + const std::string& value) OVERRIDE; + + /** + * @brief Add seconds for specified application stopwatch + * @param app_id Unique ID of application + * @param type application stopwatch type + * @param timespan_seconds seconds to add + */ + void Add(const std::string& app_id, + usage_statistics::AppStopwatchId type, + int32_t timespan_seconds) OVERRIDE; + // Interface StatisticsManager (end) + protected: + /** + * @brief Parse policy table content and convert to PT object + * @param pt_content binary content of PT + * @return pointer to converted PT + */ virtual utils::SharedPtr<policy_table::Table> Parse( const BinaryMessage& pt_content); private: + /** + * @brief Checks if PT update should be started and schedules it if needed + */ void CheckTriggers(); /** @@ -339,12 +799,73 @@ class PolicyManagerImpl : public PolicyManager { const std::string& policy_app_id, const std::vector<FunctionalGroupPermission>& current_permissions); - virtual void StartPTExchange(); - virtual bool ExceededDays(); - virtual bool ExceededIgnitionCycles(); + /** + * @brief StartPTExchange allows to start PTU. The function will check + * if one is required and starts the update flow in only case when previous + * condition is true. + */ + void StartPTExchange() OVERRIDE; + + /** + * @brief Checks is PT exceeded days + * @return true if exceeded + */ + bool ExceededDays() OVERRIDE; + + /** + * @brief Checks is PT exceeded IgnitionCycles + * @return true if exceeded + */ + bool ExceededIgnitionCycles() OVERRIDE; + + /** + * @brief Checks is specified policy table valid + * @param policy_table pointer to policy table to check + * @param type policy table type + * @return true if policy table valid, otherwise false + */ bool IsPTValid(utils::SharedPtr<policy_table::Table> policy_table, policy_table::PolicyTableType type) const; +#ifdef SDL_REMOTE_CONTROL + /** + * @brief Get resulting RPCs permissions for application which started on + * specific device + * @param device_id Device id + * @param policy_app_id Unique application id + * @param permissions Array of RPC param/HMI permissions + */ + void GetPermissions(const std::string device_id, + const std::string application_id, + Permissions* data); + + /** + * @brief Checks if module for application is present in policy table + * @param app_id id of application + * @param module type + * @return true if module is present, otherwise - false + */ + bool CheckModule(const PTString& app_id, const PTString& module) OVERRIDE; + + /** + * @brief Send OnPermissionsChange notification to mobile app + * when it's permissions are changed. + * @param device_id Device on which app is running + * @param application_id ID of app whose permissions are changed + */ + void SendAppPermissionsChanged(const std::string& device_id, + const std::string& application_id) OVERRIDE; + + /** + * @brief Gets all allowed module types + * @param policy_app_id unique identifier of application + * @param modules list of allowed module types + * @return true if application has allowed modules + */ + bool GetModuleTypes(const std::string& policy_app_id, + std::vector<std::string>* modules) const OVERRIDE; +#endif // SDL_REMOTE_CONTROL + /** * @brief Notify application about its permissions changes by preparing and * sending OnPermissionsChanged notification @@ -445,11 +966,35 @@ class PolicyManagerImpl : public PolicyManager { GroupsNames& out_allowed_groups, GroupsNames& out_disallowed_groups) const; + /** + * @brief pointer to policy table listener for callbacks + */ PolicyListener* listener_; + /** + * @brief UpdateStatusManager instance for controlling PT status + */ UpdateStatusManager update_status_manager_; + + /** + * @brief pointer to CacheManagerInterface instance for getting policy data + */ CacheManagerInterfaceSPtr cache_; +#ifdef SDL_REMOTE_CONTROL + /** + * @brief pointer to AccessRemote instance for working with RC applications + */ + utils::SharedPtr<AccessRemote> access_remote_; +#endif + + /** + * @brief lock guard for protecting applications list access + */ sync_primitives::Lock apps_registration_lock_; + + /** + * @brief lock guard for protecting application permissions access + */ sync_primitives::Lock app_permissions_diff_lock_; /** @@ -461,22 +1006,22 @@ class PolicyManagerImpl : public PolicyManager { PendingPermissions app_permissions_diff_; /** - * Timeout to wait response with UpdatePT + * @brief Timeout to wait response with UpdatePT */ - int retry_sequence_timeout_; + uint32_t retry_sequence_timeout_; /** - * Seconds between retries to update PT + * @brief Seconds between retries to update PT */ std::vector<int> retry_sequence_seconds_; /** - * Current index trying of retry sequence + * @brief Current index trying of retry sequence */ uint32_t retry_sequence_index_; /** - * Lock for guarding retry sequence + * @brief Lock for guarding retry sequence */ sync_primitives::Lock retry_sequence_lock_; @@ -486,8 +1031,14 @@ class PolicyManagerImpl : public PolicyManager { */ mutable std::string last_device_id_; + /** + * @brief Flag for checking first ignition cycle + */ bool ignition_check; + /** + * @brief Pointer to current policy settings structure + */ const PolicySettings* settings_; friend struct CheckAppPolicy; @@ -498,8 +1049,19 @@ class PolicyManagerImpl : public PolicyManager { RetrySequenceURL retry_sequence_url_; friend struct ProccessAppGroups; + /** + * @brief Flag for notifying that invalid PTU was received + */ bool wrong_ptu_update_received_; + + /** + * @brief Flag for notifying that PTU was started + */ bool send_on_update_sent_out_; + + /** + * @brief Flag for notifying that invalid PTU should be triggered + */ bool trigger_ptu_; }; diff --git a/src/components/policy/policy_external/include/policy/policy_table/enums.h b/src/components/policy/policy_external/include/policy/policy_table/enums.h index 45fad03dae..4f8ae5c98d 100644 --- a/src/components/policy/policy_external/include/policy/policy_table/enums.h +++ b/src/components/policy/policy_external/include/policy/policy_table/enums.h @@ -119,7 +119,9 @@ enum AppHMIType { AHT_SOCIAL, AHT_BACKGROUND_PROCESS, AHT_TESTING, - AHT_SYSTEM + AHT_SYSTEM, + AHT_PROJECTION, + AHT_REMOTE_CONTROL, }; bool IsValidEnum(AppHMIType val); const char* EnumToJsonString(AppHMIType val); diff --git a/src/components/policy/policy_external/include/policy/policy_table/types.h b/src/components/policy/policy_external/include/policy/policy_table/types.h index 774ef3ee59..53f5a35b99 100644 --- a/src/components/policy/policy_external/include/policy/policy_table/types.h +++ b/src/components/policy/policy_external/include/policy/policy_table/types.h @@ -69,9 +69,9 @@ typedef Array<Enum<HmiLevel>, 0, 4> HmiLevels; typedef Array<Enum<Parameter>, 0, 100> Parameters; -typedef Map<RpcParameters, 0, 65535> Rpc; +typedef Map<RpcParameters, 0, UINT_MAX> Rpc; -typedef Array<String<10, 65535>, 1, 3> URL; +typedef Array<String<10, 255>, 1, 3> URL; typedef Map<URL, 1, 255> URLList; @@ -102,6 +102,12 @@ typedef Map<DeviceParams, 0, 255> DeviceData; typedef Array<Enum<RequestType>, 0, 255> RequestsTypeArray; +#ifdef SDL_REMOTE_CONTROL +typedef Map<Strings, 0, 255> RemoteRpcs; +typedef Map<RemoteRpcs, 0, 255> AccessModules; +typedef Array<Enum<ModuleType>, 0, 255> ModuleTypes; +#endif // SDL_REMOTE_CONTROL + typedef AppHMIType AppHmiType; typedef std::vector<AppHMIType> AppHmiTypes; @@ -169,6 +175,9 @@ struct ApplicationParams : PolicyBase { Optional<RequestTypes> RequestType; Optional<Integer<uint16_t, 0, 65225> > memory_kb; Optional<Integer<uint32_t, 0, UINT_MAX> > heart_beat_timeout_ms; +#ifdef SDL_REMOTE_CONTROL + mutable Optional<ModuleTypes> moduleType; +#endif // SDL_REMOTE_CONTROL public: ApplicationParams(); @@ -188,6 +197,9 @@ struct ApplicationParams : PolicyBase { private: bool Validate() const; +#ifdef SDL_REMOTE_CONTROL + bool ValidateModuleTypes() const; +#endif // SDL_REMOTE_CONTROL }; struct ApplicationPoliciesSection : CompositeType { @@ -360,7 +372,7 @@ struct MessageLanguages : CompositeType { private: bool Validate() const; - static const std::string kMandatoryLanguage_; + static const std::string default_language_; }; struct ConsumerFriendlyMessages : CompositeType { diff --git a/src/components/policy/policy_external/include/policy/policy_types.h b/src/components/policy/policy_external/include/policy/policy_types.h index ab95659917..9ba1a1cfff 100644 --- a/src/components/policy/policy_external/include/policy/policy_types.h +++ b/src/components/policy/policy_external/include/policy/policy_types.h @@ -57,7 +57,6 @@ const std::string kDefaultDeviceConnectionType = "UNKNOWN"; const std::string kPreDataConsentId = "pre_DataConsent"; const std::string kDefaultId = "default"; const std::string kDeviceId = "device"; -const std::string kPrimary = "rc_primaryDevice"; /* *@brief Policy Services specifies Users of Updates diff --git a/src/components/policy/policy_external/include/policy/sql_pt_queries.h b/src/components/policy/policy_external/include/policy/sql_pt_queries.h index 685c84742f..a69df20cfc 100644 --- a/src/components/policy/policy_external/include/policy/sql_pt_queries.h +++ b/src/components/policy/policy_external/include/policy/sql_pt_queries.h @@ -117,27 +117,15 @@ extern const std::string kSelectApplicationFull; extern const std::string kUpdatePreloaded; extern const std::string kUpdateRemoteControlDenied; extern const std::string kSelectRemoteControlDenied; -extern const std::string kDeleteAppGroupPrimaryByApplicationId; -extern const std::string kDeleteAppGroupNonPrimaryByApplicationId; extern const std::string kCollectFriendlyMsg; -extern const std::string kSelectAppGroupsPrimary; -extern const std::string kSelectAppGroupsNonPrimary; extern const std::string kSelectModuleTypes; -extern const std::string kInsertAppGroupPrimary; -extern const std::string kInsertAppGroupNonPrimary; extern const std::string kInsertModuleType; -extern const std::string kInsertInteriorZone; -extern const std::string kCountInteriorZones; -extern const std::string kSelectInteriorZones; -extern const std::string kDeleteInteriorZones; extern const std::string kInsertAccessModule; extern const std::string kSelectAccessModules; extern const std::string kDeleteAccessModules; extern const std::string kInsertRemoteRpc; extern const std::string kSelectRemoteRpcs; extern const std::string kDeleteRemoteRpc; -extern const std::string kDeleteAppGroupPrimary; -extern const std::string kDeleteAppGroupNonPrimary; extern const std::string kDeleteModuleTypes; extern const std::string kDeleteAllDevices; extern const std::string kSelectDBVersion; diff --git a/src/components/policy/policy_external/include/policy/sql_pt_representation.h b/src/components/policy/policy_external/include/policy/sql_pt_representation.h index b3ce0a69be..54dfb9f0b7 100644 --- a/src/components/policy/policy_external/include/policy/sql_pt_representation.h +++ b/src/components/policy/policy_external/include/policy/sql_pt_representation.h @@ -98,6 +98,23 @@ class SQLPTRepresentation : public virtual PTRepresentation { } #endif // BUILD_TESTS protected: +#ifdef SDL_REMOTE_CONTROL + enum TypeAccess { kAllowed, kManual }; + bool GatherModuleType(const std::string& app_id, + policy_table::ModuleTypes* module_types) const; + bool GatherRemoteControlDenied(const std::string& app_id, bool* denied) const; + bool GatherAccessModule(TypeAccess access, + policy_table::AccessModules* modules) const; + bool GatherRemoteRpc(int module_id, policy_table::RemoteRpcs* rpcs) const; + bool SaveModuleType(const std::string& app_id, + const policy_table::ModuleTypes& types); + bool SaveRemoteControlDenied(const std::string& app_id, bool deny); + + bool SaveAccessModule(TypeAccess access, + const policy_table::AccessModules& modules); + bool SaveRemoteRpc(int module_id, const policy_table::RemoteRpcs& rpcs); +#endif // SDL_REMOTE_CONTROL + virtual void GatherModuleMeta(policy_table::ModuleMeta* meta) const; virtual void GatherModuleConfig(policy_table::ModuleConfig* config) const; virtual bool GatherUsageAndErrorCounts( diff --git a/src/components/policy/policy_external/src/access_remote_impl.cc b/src/components/policy/policy_external/src/access_remote_impl.cc new file mode 100644 index 0000000000..d042d8c402 --- /dev/null +++ b/src/components/policy/policy_external/src/access_remote_impl.cc @@ -0,0 +1,261 @@ +/* + * Copyright (c) 2015, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include "policy/access_remote_impl.h" + +#include <algorithm> +#include <iterator> +#include "policy/cache_manager.h" +#include "utils/logger.h" + +CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyManagerImpl") + +using policy_table::DeviceData; +using policy_table::FunctionalGroupings; +using rpc::policy_table_interface_base::EnumFromJsonString; + +namespace policy { + +struct ToHMIType { + policy_table::AppHMITypes::value_type operator()(int item) const { + policy_table::AppHMIType type = static_cast<policy_table::AppHMIType>(item); + if (!IsValidEnum(type)) { + LOG4CXX_WARN(logger_, "HMI type isn't known " << item); + type = policy_table::AHT_DEFAULT; + } + LOG4CXX_DEBUG(logger_, + "HMI type: " << item << " - " << EnumToJsonString(type)); + return policy_table::AppHMITypes::value_type(type); + } +}; + +struct Contained { + private: + const policy_table::Strings& params_; + + public: + explicit Contained(const policy_table::Strings& params) : params_(params) {} + bool operator()(const RemoteControlParams::value_type& item) const { + return std::find_if(params_.begin(), params_.end(), CompareString(item)) != + params_.end(); + } + struct CompareString { + private: + const RemoteControlParams::value_type& value_; + + public: + explicit CompareString(const RemoteControlParams::value_type& value) + : value_(value) {} + bool operator()(const policy_table::Strings::value_type& item) const { + return value_ == static_cast<std::string>(item); + } + }; +}; + +struct ToModuleType { + std::string operator()(policy_table::ModuleTypes::value_type item) const { + policy_table::ModuleType type = static_cast<policy_table::ModuleType>(item); + return EnumToJsonString(type); + } +}; + +AccessRemoteImpl::AccessRemoteImpl() : cache_(new CacheManager()) {} + +AccessRemoteImpl::AccessRemoteImpl(utils::SharedPtr<CacheManager> cache) + : cache_(cache) {} + +bool AccessRemoteImpl::CheckModuleType(const PTString& app_id, + policy_table::ModuleType module) const { + LOG4CXX_AUTO_TRACE(logger_); + if (!cache_->IsApplicationRepresented(app_id)) { + return false; + } + + const policy_table::ApplicationParams& app = + cache_->pt_->policy_table.app_policies_section.apps[app_id]; + if (!app.moduleType.is_initialized()) { + return false; + } + + const policy_table::ModuleTypes& modules = *app.moduleType; + if (modules.empty()) { + return true; + } + + return std::find(modules.begin(), modules.end(), module) != modules.end(); +} + +bool AccessRemoteImpl::IsAllowed(const policy_table::AccessModules& modules, + const std::string& module_name, + const std::string& rpc_name, + RemoteControlParams* input) const { + LOG4CXX_AUTO_TRACE(logger_); + policy_table::AccessModules::const_iterator i = modules.find(module_name); + if (i == modules.end()) { + LOG4CXX_DEBUG(logger_, "Module " << module_name << " wasn't found"); + return false; + } + + const policy_table::RemoteRpcs& rpcs = i->second; + if (rpcs.empty()) { + return true; + } + policy_table::RemoteRpcs::const_iterator j = rpcs.find(rpc_name); + if (j != rpcs.end()) { + const policy_table::Strings& parameters = j->second; + return CompareParameters(parameters, input); + } + LOG4CXX_DEBUG(logger_, "RPC " << rpc_name << " wasn't found"); + return false; +} + +bool AccessRemoteImpl::CompareParameters( + const policy_table::Strings& parameters, RemoteControlParams* input) const { + LOG4CXX_AUTO_TRACE(logger_); + if (parameters.empty()) { + return true; + } + + if (input->empty()) { + LOG4CXX_DEBUG(logger_, "Input is empty"); + return false; + } + + input->erase( + std::remove_if(input->begin(), input->end(), Contained(parameters)), + input->end()); + return input->empty(); +} + +void AccessRemoteImpl::SetDefaultHmiTypes(const ApplicationOnDevice& who, + const std::vector<int>& hmi_types) { + LOG4CXX_AUTO_TRACE(logger_); + HMIList::mapped_type types; + std::transform(hmi_types.begin(), + hmi_types.end(), + std::back_inserter(types), + ToHMIType()); + hmi_types_[who] = types; +} + +const policy_table::AppHMITypes& AccessRemoteImpl::HmiTypes( + const ApplicationOnDevice& who) { + LOG4CXX_AUTO_TRACE(logger_); + if (cache_->IsDefaultPolicy(who.app_id)) { + return hmi_types_[who]; + } else { + return *cache_->pt_->policy_table.app_policies_section.apps[who.app_id] + .AppHMIType; + } +} + +const policy_table::Strings& AccessRemoteImpl::GetGroups( + const ApplicationOnDevice& who) { + LOG4CXX_AUTO_TRACE(logger_); + return cache_->GetGroups(who.app_id); +} + +bool AccessRemoteImpl::IsAppRemoteControl(const ApplicationOnDevice& who) { + const policy_table::AppHMITypes& hmi_types = HmiTypes(who); + return std::find(hmi_types.begin(), + hmi_types.end(), + policy_table::AHT_REMOTE_CONTROL) != hmi_types.end(); +} + +bool AccessRemoteImpl::GetPermissionsForApp(const std::string& device_id, + const std::string& app_id, + FunctionalIdType& group_types) { + LOG4CXX_AUTO_TRACE(logger_); + GetGroupsIds(device_id, app_id, group_types[kTypeGeneral]); + GetGroupsIds(device_id, kDefaultId, group_types[kTypeDefault]); + GetGroupsIds( + device_id, kPreDataConsentId, group_types[kTypePreDataConsented]); + + cache_->GetPreConsentedGroups(app_id, group_types[kTypePreconsented]); + + cache_->GetConsentedGroups(device_id, + app_id, + group_types[kTypeAllowed], + group_types[kTypeDisallowed]); + + cache_->GetUnconsentedGroups( + device_id, app_id, group_types[kTypeUnconsented]); + + cache_->GetAllAppGroups(kDeviceId, group_types[kTypeDevice]); + return true; +} + +std::ostream& operator<<(std::ostream& output, + const FunctionalGroupIDs& types) { + std::copy(types.begin(), + types.end(), + std::ostream_iterator<FunctionalGroupIDs::value_type>(output, " ")); + return output; +} + +extern std::ostream& operator<<(std::ostream& output, + const policy_table::Strings& groups); + +void AccessRemoteImpl::GetGroupsIds(const std::string& device_id, + const std::string& app_id, + FunctionalGroupIDs& groups_ids) { + ApplicationOnDevice who = {device_id, app_id}; + const policy_table::Strings& groups = GetGroups(who); + LOG4CXX_DEBUG(logger_, "Groups Names: " << groups); + groups_ids.resize(groups.size()); + std::transform(groups.begin(), + groups.end(), + groups_ids.begin(), + &CacheManager::GenerateHash); + LOG4CXX_DEBUG(logger_, "Groups Ids: " << groups_ids); +} + +bool AccessRemoteImpl::GetModuleTypes(const std::string& application_id, + std::vector<std::string>* modules) { + DCHECK(modules); + policy_table::ApplicationPolicies& apps = + cache_->pt_->policy_table.app_policies_section.apps; + policy_table::ApplicationPolicies::iterator i = apps.find(application_id); + if (i == apps.end()) { + return false; + } + rpc::Optional<policy_table::ModuleTypes> moduleTypes = i->second.moduleType; + if (!moduleTypes.is_initialized()) { + return false; + } + std::transform(moduleTypes->begin(), + moduleTypes->end(), + std::back_inserter(*modules), + ToModuleType()); + return true; +} + +} // namespace policy diff --git a/src/components/policy/policy_external/src/policy_helper.cc b/src/components/policy/policy_external/src/policy_helper.cc index cb27e7f0b3..3041323489 100644 --- a/src/components/policy/policy_external/src/policy_helper.cc +++ b/src/components/policy/policy_external/src/policy_helper.cc @@ -865,4 +865,5 @@ bool UnwrapAppPolicies(policy_table::ApplicationPolicies& app_policies) { return true; } -} + +} // namespace policy diff --git a/src/components/policy/policy_external/src/policy_manager_impl.cc b/src/components/policy/policy_external/src/policy_manager_impl.cc index 0a774f6b79..8a80e7755b 100644 --- a/src/components/policy/policy_external/src/policy_manager_impl.cc +++ b/src/components/policy/policy_external/src/policy_manager_impl.cc @@ -51,6 +51,11 @@ #include "config_profile/profile.h" #include "utils/make_shared.h" +#ifdef SDL_REMOTE_CONTROL +#include "policy/access_remote.h" +#include "policy/access_remote_impl.h" +#endif // SDL_REMOTE_CONTROL + policy::PolicyManager* CreateManager() { return new policy::PolicyManagerImpl(); } @@ -211,22 +216,32 @@ PolicyManagerImpl::PolicyManagerImpl() : PolicyManager() , listener_(NULL) , cache_(new CacheManager) +#ifdef SDL_REMOTE_CONTROL + , access_remote_(new AccessRemoteImpl( + CacheManagerInterfaceSPtr::static_pointer_cast<CacheManager>(cache_))) +#endif // SDL_REMOTE_CONTROL , retry_sequence_timeout_(60) , retry_sequence_index_(0) , ignition_check(true) - , retry_sequence_url_(0, 0, "") {} + , retry_sequence_url_(0, 0, "") { +} PolicyManagerImpl::PolicyManagerImpl(bool in_memory) : PolicyManager() , listener_(NULL) , cache_(new CacheManager(in_memory)) +#ifdef SDL_REMOTE_CONTROL + , access_remote_(new AccessRemoteImpl( + CacheManagerInterfaceSPtr::static_pointer_cast<CacheManager>(cache_))) +#endif // SDL_REMOTE_CONTROL , retry_sequence_timeout_(60) , retry_sequence_index_(0) , ignition_check(true) , retry_sequence_url_(0, 0, "") , wrong_ptu_update_received_(false) , send_on_update_sent_out_(false) - , trigger_ptu_(false) {} + , trigger_ptu_(false) { +} void PolicyManagerImpl::set_listener(PolicyListener* listener) { listener_ = listener; @@ -268,6 +283,9 @@ std::string PolicyManagerImpl::GetLockScreenIconUrl() const { bool PolicyManagerImpl::LoadPT(const std::string& file, const BinaryMessage& pt_content) { LOG4CXX_INFO(logger_, "LoadPT of size " << pt_content.size()); + LOG4CXX_DEBUG( + logger_, + "PTU content is: " << std::string(pt_content.begin(), pt_content.end())); // Parse message into table struct utils::SharedPtr<policy_table::Table> pt_update = Parse(pt_content); @@ -578,7 +596,13 @@ void PolicyManagerImpl::CheckPermissions(const PTString& app_id, policy_table::FunctionalGroupings functional_groupings; cache_->GetFunctionalGroupings(functional_groupings); - policy_table::Strings app_groups = GetGroupsNames(app_group_permissions); +#ifdef SDL_REMOTE_CONTROL + ApplicationOnDevice who = {device_id, app_id}; + const policy_table::Strings app_groups = access_remote_->GetGroups(who); +#else // SDL_REMOTE_CONTROL + const policy_table::Strings app_groups = + GetGroupsNames(app_group_permissions); +#endif // SDL_REMOTE_CONTROL // Undefined groups (without user consent) disallowed by default, since // OnPermissionsChange notification has no "undefined" section @@ -713,10 +737,7 @@ void PolicyManagerImpl::CheckPermissions(const PTString& app_id, } bool PolicyManagerImpl::ResetUserConsent() { - bool result = true; - result = cache_->ResetUserConsent(); - - return result; + return cache_->ResetUserConsent(); } policy_table::Strings PolicyManagerImpl::GetGroupsNames( @@ -757,6 +778,14 @@ void PolicyManagerImpl::SendNotificationOnPermissionsUpdated( LOG4CXX_INFO(logger_, "Send notification for application_id:" << application_id); +#ifdef SDL_REMOTE_CONTROL + const ApplicationOnDevice who = {device_id, application_id}; + if (access_remote_->IsAppRemoteControl(who)) { + listener()->OnPermissionsUpdated(application_id, notification_data); + return; + } +#endif // SDL_REMOTE_CONTROL + std::string default_hmi; GetDefaultHmi(application_id, &default_hmi); @@ -1135,7 +1164,17 @@ void PolicyManagerImpl::GetPermissionsForApp( } FunctionalIdType group_types; - if (!cache_->GetPermissionsForApp(device_id, app_id_to_check, group_types)) { + +#ifdef SDL_REMOTE_CONTROL + allowed_by_default = false; + const bool ret = access_remote_->GetPermissionsForApp( + device_id, app_id_to_check, group_types); +#else + const bool ret = + cache_->GetPermissionsForApp(device_id, app_id_to_check, group_types); +#endif // REMOTE_CONTROL + + if (!ret) { LOG4CXX_WARN(logger_, "Can't get user permissions for app " << policy_app_id); return; @@ -1880,4 +1919,122 @@ void PolicyManagerImpl::set_cache_manager( cache_ = cache_manager; } +std::ostream& operator<<(std::ostream& output, + const policy_table::Strings& groups) { + for (policy_table::Strings::const_iterator i = groups.begin(); + i != groups.end(); + ++i) { + output << static_cast<std::string>(*i) << " "; + } + return output; +} + +#ifdef SDL_REMOTE_CONTROL +void PolicyManagerImpl::SetDefaultHmiTypes(const std::string& application_id, + const std::vector<int>& hmi_types) { + LOG4CXX_INFO(logger_, "SetDefaultHmiTypes"); + const std::string device_id = GetCurrentDeviceId(application_id); + ApplicationOnDevice who = {device_id, application_id}; + access_remote_->SetDefaultHmiTypes(who, hmi_types); +} + +struct HMITypeToInt { + int operator()(const policy_table::AppHMITypes::value_type item) { + return policy_table::AppHMIType(item); + } +}; + +bool PolicyManagerImpl::GetHMITypes(const std::string& application_id, + std::vector<int>* app_types) { + LOG4CXX_AUTO_TRACE(logger_); + if (cache_->IsDefaultPolicy(application_id)) { + return false; + } + const policy_table::AppHMITypes* hmi_types = + cache_->GetHMITypes(application_id); + if (hmi_types) { + std::transform(hmi_types->begin(), + hmi_types->end(), + std::back_inserter(*app_types), + HMITypeToInt()); + } + return hmi_types; +} + +bool PolicyManagerImpl::CheckModule(const PTString& app_id, + const PTString& module) { + LOG4CXX_AUTO_TRACE(logger_); + policy_table::ModuleType module_type; + return EnumFromJsonString(module, &module_type) && + access_remote_->CheckModuleType(app_id, module_type); +} + +void PolicyManagerImpl::SendHMILevelChanged(const ApplicationOnDevice& who) { + std::string default_hmi("NONE"); + if (GetDefaultHmi(who.app_id, &default_hmi)) { + listener()->OnUpdateHMIStatus(who.dev_id, who.app_id, default_hmi); + } else { + LOG4CXX_WARN(logger_, + "Couldn't get default HMI level for application " + << who.app_id); + } +} + +void PolicyManagerImpl::GetPermissions(const std::string device_id, + const std::string application_id, + Permissions* data) { + LOG4CXX_AUTO_TRACE(logger_); + DCHECK(data); + std::vector<FunctionalGroupPermission> app_group_permissions; + GetPermissionsForApp(device_id, application_id, app_group_permissions); + + policy_table::FunctionalGroupings functional_groupings; + cache_->GetFunctionalGroupings(functional_groupings); + + policy_table::Strings app_groups; + std::vector<FunctionalGroupPermission>::const_iterator it = + app_group_permissions.begin(); + std::vector<FunctionalGroupPermission>::const_iterator it_end = + app_group_permissions.end(); + for (; it != it_end; ++it) { + app_groups.push_back((*it).group_name); + } + + PrepareNotificationData( + functional_groupings, app_groups, app_group_permissions, *data); +} + +void PolicyManagerImpl::SendAppPermissionsChanged( + const std::string& device_id, const std::string& application_id) { + Permissions notification_data; + GetPermissions(device_id, application_id, ¬ification_data); + listener()->OnPermissionsUpdated(application_id, notification_data); +} + +void PolicyManagerImpl::OnPrimaryGroupsChanged( + const std::string& application_id) { + const std::vector<std::string> devices = + listener()->GetDevicesIds(application_id); + for (std::vector<std::string>::const_iterator i = devices.begin(); + i != devices.end(); + ++i) { + const ApplicationOnDevice who = {*i, application_id}; + if (access_remote_->IsAppRemoteControl(who)) { + SendAppPermissionsChanged(who.dev_id, who.app_id); + } + } +} + +bool PolicyManagerImpl::GetModuleTypes( + const std::string& application_id, + std::vector<std::string>* modules) const { + return access_remote_->GetModuleTypes(application_id, modules); +} + +void PolicyManagerImpl::set_access_remote( + utils::SharedPtr<AccessRemote> access_remote) { + access_remote_ = access_remote; +} +#endif // SDL_REMOTE_CONTROL + } // namespace policy diff --git a/src/components/policy/policy_external/src/policy_table/enums.cc b/src/components/policy/policy_external/src/policy_table/enums.cc index e70167c94b..168ff86b27 100644 --- a/src/components/policy/policy_external/src/policy_table/enums.cc +++ b/src/components/policy/policy_external/src/policy_table/enums.cc @@ -1,4 +1,3 @@ -// This file is generated, do not edit #include "policy/policy_table/enums.h" namespace rpc { @@ -438,6 +437,10 @@ bool IsValidEnum(AppHMIType val) { return true; case AHT_SYSTEM: return true; + case AHT_PROJECTION: + return true; + case AHT_REMOTE_CONTROL: + return true; default: return false; } @@ -464,6 +467,10 @@ const char* EnumToJsonString(AppHMIType val) { return "TESTING"; case AHT_SYSTEM: return "SYSTEM"; + case AHT_PROJECTION: + return "PROJECTION"; + case AHT_REMOTE_CONTROL: + return "REMOTE_CONTROL"; default: return ""; } @@ -499,6 +506,12 @@ bool EnumFromJsonString(const std::string& literal, AppHMIType* result) { } else if ("SYSTEM" == literal) { *result = AHT_SYSTEM; return true; + } else if ("PROJECTION" == literal) { + *result = AHT_PROJECTION; + return true; + } else if ("REMOTE_CONTROL" == literal) { + *result = AHT_REMOTE_CONTROL; + return true; } else { return false; } @@ -715,6 +728,41 @@ bool EnumFromJsonString(const std::string& literal, RequestType* result) { } } +#ifdef SDL_REMOTE_CONTROL +bool IsValidEnum(ModuleType val) { + switch (val) { + case MT_CLIMATE: + return true; + case MT_RADIO: + return true; + default: + return false; + } +} +const char* EnumToJsonString(ModuleType val) { + switch (val) { + case MT_CLIMATE: + return "CLIMATE"; + case MT_RADIO: + return "RADIO"; + default: + return ""; + } +} + +bool EnumFromJsonString(const std::string& literal, ModuleType* result) { + if ("CLIMATE" == literal) { + *result = MT_CLIMATE; + return true; + } else if ("RADIO" == literal) { + *result = MT_RADIO; + return true; + } else { + return false; + } +} +#endif // SDL_REMOTE_CONTROL + const std::string kDefaultApp = "default"; const std::string kPreDataConsentApp = "pre_DataConsent"; const std::string kDeviceApp = "device"; diff --git a/src/components/policy/policy_external/src/policy_table/types.cc b/src/components/policy/policy_external/src/policy_table/types.cc index 528d70a426..da83626448 100644 --- a/src/components/policy/policy_external/src/policy_table/types.cc +++ b/src/components/policy/policy_external/src/policy_table/types.cc @@ -239,8 +239,12 @@ ApplicationParams::ApplicationParams(const Json::Value* value__) , AppHMIType(impl::ValueMember(value__, "AppHMIType")) , RequestType(impl::ValueMember(value__, "RequestType")) , memory_kb(impl::ValueMember(value__, "memory_kb"), 0) - , heart_beat_timeout_ms( - impl::ValueMember(value__, "heart_beat_timeout_ms")) {} + , heart_beat_timeout_ms(impl::ValueMember(value__, "heart_beat_timeout_ms")) +#ifdef SDL_REMOTE_CONTROL + , moduleType(impl::ValueMember(value__, "moduleType")) +#endif // SDL_REMOTE_CONTROL +{ +} Json::Value ApplicationParams::ToJsonValue() const { Json::Value result__(PolicyBase::ToJsonValue()); @@ -250,6 +254,9 @@ Json::Value ApplicationParams::ToJsonValue() const { impl::WriteJsonField("memory_kb", memory_kb, &result__); impl::WriteJsonField( "heart_beat_timeout_ms", heart_beat_timeout_ms, &result__); +#ifdef SDL_REMOTE_CONTROL + impl::WriteJsonField("moduleType", moduleType, &result__); +#endif // SDL_REMOTE_CONTROL return result__; } @@ -271,6 +278,11 @@ bool ApplicationParams::is_valid() const { if (!heart_beat_timeout_ms.is_valid()) { return false; } +#ifdef SDL_REMOTE_CONTROL + if (!moduleType.is_valid()) { + return false; + } +#endif // SDL_REMOTE_CONTROL return Validate(); } @@ -297,6 +309,11 @@ bool ApplicationParams::struct_empty() const { if (heart_beat_timeout_ms.is_initialized()) { return false; } +#ifdef SDL_REMOTE_CONTROL + if (moduleType.is_initialized()) { + return false; + } +#endif // SDL_REMOTE_CONTROL return true; } @@ -339,6 +356,12 @@ void ApplicationParams::ReportErrors(rpc::ValidationReport* report__) const { heart_beat_timeout_ms.ReportErrors( &report__->ReportSubobject("heart_beat_timeout_ms")); } + +#ifdef SDL_REMOTE_CONTROL + if (!moduleType.is_valid()) { + moduleType.ReportErrors(&report__->ReportSubobject("moduleType")); + } +#endif // SDL_REMOTE_CONTROL } void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) { @@ -347,6 +370,9 @@ void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) { RequestType.SetPolicyTableType(pt_type); memory_kb.SetPolicyTableType(pt_type); heart_beat_timeout_ms.SetPolicyTableType(pt_type); +#ifdef SDL_REMOTE_CONTROL + moduleType.SetPolicyTableType(pt_type); +#endif // SDL_REMOTE_CONTROL } // RpcParameters methods @@ -890,7 +916,7 @@ void MessageString::SetPolicyTableType(PolicyTableType pt_type) { } // MessageLanguages methods -const std::string MessageLanguages::kMandatoryLanguage_("en-us"); +const std::string MessageLanguages::default_language_("en-us"); MessageLanguages::MessageLanguages() : CompositeType(kUninitialized) {} @@ -914,7 +940,7 @@ bool MessageLanguages::is_valid() const { return false; } // Each RPC must have message in english - if (languages.end() == languages.find(kMandatoryLanguage_)) { + if (languages.end() == languages.find(default_language_)) { return false; } return Validate(); @@ -947,9 +973,10 @@ void MessageLanguages::ReportErrors(rpc::ValidationReport* report__) const { if (!languages.is_valid()) { languages.ReportErrors(&report__->ReportSubobject("languages")); } - if (languages.end() == languages.find(kMandatoryLanguage_)) { - report__->set_validation_info("no mandatory language '" + - kMandatoryLanguage_ + "' is present"); + if (languages.end() == languages.find(default_language_)) { + report__->set_validation_info( + "this message does not support the default language '" + + default_language_ + "'"); } } diff --git a/src/components/policy/policy_external/src/policy_table/validation.cc b/src/components/policy/policy_external/src/policy_table/validation.cc index 45034c6fe8..48a8578855 100644 --- a/src/components/policy/policy_external/src/policy_table/validation.cc +++ b/src/components/policy/policy_external/src/policy_table/validation.cc @@ -135,6 +135,39 @@ bool ApplicationPoliciesSection::Validate() const { return true; } + +#ifdef SDL_REMOTE_CONTROL +bool ApplicationParams::ValidateModuleTypes() const { + // moduleType is optional so see Optional<T>::is_valid() + bool is_initialized = moduleType->is_initialized(); + if (!is_initialized) { + // valid if not initialized + return true; + } + bool is_valid = moduleType->is_valid(); + if (is_valid) { + return true; + } + + struct IsInvalid { + bool operator()(Enum<ModuleType> item) const { + return !item.is_valid(); + } + }; + // cut invalid items + moduleType->erase( + std::remove_if(moduleType->begin(), moduleType->end(), IsInvalid()), + moduleType->end()); + bool empty = moduleType->empty(); + if (empty) { + // set non initialized value + ModuleTypes non_initialized; + moduleType = Optional<ModuleTypes>(non_initialized); + } + return true; +} +#endif // SDL_REMOTE_CONTROL + bool ApplicationParams::Validate() const { if (is_initialized()) { if (preconsented_groups.is_initialized()) { @@ -145,8 +178,13 @@ bool ApplicationParams::Validate() const { } } } +#ifdef SDL_REMOTE_CONTROL + return ValidateModuleTypes(); +#else // SDL_REMOTE_CONTROL return true; +#endif // SDL_REMOTE_CONTROL } + bool RpcParameters::Validate() const { return true; } @@ -177,6 +215,19 @@ bool ModuleConfig::Validate() const { default: break; } + + for (ServiceEndpoints::const_iterator it_endpoints = endpoints.begin(); + it_endpoints != endpoints.end(); + ++it_endpoints) { + const URLList& endpoint_list = it_endpoints->second; + if (endpoint_list.end() == endpoint_list.find(kDefaultApp)) { + LOG4CXX_ERROR(logger_, + "Endpoint " << it_endpoints->first + << "does not contain default group"); + return false; + } + } + return true; } diff --git a/src/components/policy/policy_external/src/sql_pt_queries.cc b/src/components/policy/policy_external/src/sql_pt_queries.cc index 1cd789f00d..e3e1029692 100644 --- a/src/components/policy/policy_external/src/sql_pt_queries.cc +++ b/src/components/policy/policy_external/src/sql_pt_queries.cc @@ -76,9 +76,7 @@ const std::string kCreateSchema = " `vehicle_model` VARCHAR(45), " " `vehicle_year` VARCHAR(4), " " `preloaded_date` VARCHAR (10), " - " `certificate` VARCHAR (45), " - " `user_consent_passengersRC` BOOL," - " `country_consent_passengersRC` BOOL " + " `certificate` VARCHAR (45) " "); " "CREATE TABLE IF NOT EXISTS `functional_group`( " " `id` INTEGER PRIMARY KEY NOT NULL, " @@ -353,70 +351,12 @@ const std::string kCreateSchema = " REFERENCES `message_type`(`name`) " "); " - "CREATE TABLE IF NOT EXISTS `app_group_primary`( " - " `application_id` VARCHAR(45) NOT NULL, " - " `functional_group_id` INTEGER NOT NULL, " - " PRIMARY KEY(`application_id`,`functional_group_id`), " - " CONSTRAINT `fk_application_has_functional_group_application1` " - " FOREIGN KEY(`application_id`) " - " REFERENCES `application`(`id`), " - " CONSTRAINT `fk_application_has_functional_group_functional_group1` " - " FOREIGN KEY(`functional_group_id`) " - " REFERENCES `functional_group`(`id`) " - "); " - "CREATE INDEX IF NOT EXISTS " - "`app_group_primary.fk_application_has_functional_group_functional_group1_" - "idx` " - " ON `app_group_primary`(`functional_group_id`); " - "CREATE INDEX IF NOT EXISTS " - "`app_group_primary.fk_application_has_functional_group_application1_idx` " - " ON `app_group_primary`(`application_id`); " - - "CREATE TABLE IF NOT EXISTS `app_group_non_primary`( " - " `application_id` VARCHAR(45) NOT NULL, " - " `functional_group_id` INTEGER NOT NULL, " - " PRIMARY KEY(`application_id`,`functional_group_id`), " - " CONSTRAINT `fk_application_has_functional_group_application1` " - " FOREIGN KEY(`application_id`) " - " REFERENCES `application`(`id`), " - " CONSTRAINT `fk_application_has_functional_group_functional_group1` " - " FOREIGN KEY(`functional_group_id`) " - " REFERENCES `functional_group`(`id`) " - "); " - "CREATE INDEX IF NOT EXISTS " - "`app_group_non_primary.fk_application_has_functional_group_functional_" - "group1_idx` " - " ON `app_group_non_primary`(`functional_group_id`); " - "CREATE INDEX IF NOT EXISTS " - "`app_group_non_primary.fk_application_has_functional_group_application1_" - "idx` " - " ON `app_group_non_primary`(`application_id`); " - - /* interior_zone */ - "CREATE TABLE `interior_zone`( " - " `id` INTEGER PRIMARY KEY NOT NULL, " - " `name` VARCHAR(100) NOT NULL, " - " `col` INTEGER NOT NULL, " - " `row` INTEGER NOT NULL, " - " `level` INTEGER NOT NULL " - "); " - "CREATE UNIQUE INDEX `interior_zone.room` ON " - "`interior_zone`(`col`,`row`,`level`); " - /* access_module */ "CREATE TABLE `access_module`( " " `id` INTEGER PRIMARY KEY NOT NULL, " " `name` VARCHAR(45) NOT NULL, " - " `zone_id` INTEGER NOT NULL, " - " `user_consent_needed` INTEGER NOT NULL, " - "CONSTRAINT `fk_module_1` " - " FOREIGN KEY(`zone_id`) " - " REFERENCES `interior_zone`(`id`) " + " `user_consent_needed` INTEGER NOT NULL " "); " - "CREATE INDEX `access_module.zone_module` ON " - "`access_module`(`name`,`zone_id`); " - "CREATE INDEX `access_module.fk_module_1_idx` ON " - "`access_module`(`zone_id`); " /* remote_rpc */ "CREATE TABLE `remote_rpc`( " @@ -486,71 +426,27 @@ const std::string kInsertInitData = "INSERT OR IGNORE INTO `_internal_data` (`db_version_hash`) VALUES(0); " ""; -const std::string kDeleteAppGroupPrimary = "DELETE FROM `app_group_primary`"; - -const std::string kDeleteAppGroupNonPrimary = - "DELETE FROM `app_group_non_primary`"; - const std::string kDeleteModuleTypes = "DELETE FROM `module_type`"; const std::string kDeleteAllDevices = "DELETE FROM `device`;"; -const std::string kSelectAppGroupsPrimary = - "SELECT `f`.`name` FROM `app_group_primary` AS `a`" - " LEFT JOIN `functional_group` AS `f` " - " ON (`f`.`id` = `a`.`functional_group_id`)" - " WHERE `a`.`application_id` = ?"; - -const std::string kSelectAppGroupsNonPrimary = - "SELECT `f`.`name` FROM `app_group_non_primary` AS `a`" - " LEFT JOIN `functional_group` AS `f` " - " ON (`f`.`id` = `a`.`functional_group_id`)" - " WHERE `a`.`application_id` = ?"; - const std::string kSelectRemoteControlDenied = "SELECT `remote_control_denied` FROM `application` WHERE `id` = ? LIMIT 1"; -const std::string kInsertAppGroupPrimary = - "INSERT INTO `app_group_primary` (`application_id`, `functional_group_id`)" - " SELECT ?, `id` FROM `functional_group` WHERE `name` = ? LIMIT 1"; - -const std::string kInsertAppGroupNonPrimary = - "INSERT INTO `app_group_non_primary` (`application_id`, " - "`functional_group_id`)" - " SELECT ?, `id` FROM `functional_group` WHERE `name` = ? LIMIT 1"; - const std::string kUpdateRemoteControlDenied = "UPDATE `application` SET `remote_control_denied` = ? WHERE `id` = ?"; -const std::string kCountInteriorZones = - "SELECT COUNT(`id`) FROM `interior_zone`"; - -const std::string kDeleteInteriorZones = "DELETE FROM `interior_zone`"; - const std::string kDeleteAccessModules = "DELETE FROM `access_module`"; const std::string kDeleteRemoteRpc = "DELETE FROM `remote_rpc`"; -const std::string kInsertInteriorZone = - "INSERT INTO `interior_zone` (`name`, `col`, `row`, `level`) " - " VALUES(?, ?, ?, ?)"; - -const std::string kSelectInteriorZones = - "SELECT `id`, `name`, `col`, `row`, `level` FROM `interior_zone`"; - const std::string kInsertAccessModule = - "INSERT INTO `access_module` (`name`, `zone_id`, `user_consent_needed`) " + "INSERT INTO `access_module` (`name`, `user_consent_needed`) " " VALUES(?, ?, ?)"; -const std::string kDeleteAppGroupPrimaryByApplicationId = - "DELETE FROM `app_group_primary` WHERE `application_id` = ?"; - -const std::string kDeleteAppGroupNonPrimaryByApplicationId = - "DELETE FROM `app_group_non_primary` WHERE `application_id` = ?"; - const std::string kSelectAccessModules = "SELECT `id`, `name` FROM `access_module` " - " WHERE `zone_id` = ? AND `user_consent_needed` = ?"; + " WHERE `user_consent_needed` = ?"; const std::string kInsertRemoteRpc = "INSERT INTO `remote_rpc` (`module_id`, `name`, `parameter`) " @@ -606,22 +502,7 @@ const std::string kDropSchema = "`preconsented_group.fk_application_has_functional_group_functional_group2_" "idx`; " "DROP TABLE IF EXISTS `preconsented_group`; " - "DROP INDEX IF EXISTS " - "`app_group_primary.fk_application_has_functional_group_application1_idx`; " - "DROP INDEX IF EXISTS " - "`app_group_primary.fk_application_has_functional_group_functional_group1_" - "idx`; " - "DROP TABLE IF EXISTS `app_group_primary`; " - "DROP INDEX IF EXISTS " - "`app_group_non_primary.fk_application_has_functional_group_application1_" - "idx`; " - "DROP INDEX IF EXISTS " - "`app_group_non_primary.fk_application_has_functional_group_functional_" - "group1_idx`; " - "DROP TABLE IF EXISTS `app_group_non_primary`; " - "DROP TABLE IF EXISTS `interior_zone`; " "DROP TABLE IF EXISTS `access_module`; " - "DROP INDEX IF EXISTS `access_module.zone_module`; " "DROP INDEX IF EXISTS `access_module.fk_module_1_idx`; " "DROP INDEX IF EXISTS " "`app_group.fk_application_has_functional_group_application1_idx`; " @@ -672,9 +553,6 @@ const std::string kDeleteData = "DELETE FROM `app_group`; " "DELETE FROM `application`; " "DELETE FROM `rpc`; " - "DELETE FROM `app_group_primary`; " - "DELETE FROM `app_group_non_primary`; " - "DELETE FROM `interior_zone`; " "DELETE FROM `access_module`; " "DELETE FROM `version`; " "DELETE FROM `message_type`; " @@ -776,8 +654,7 @@ const std::string kUpdateModuleConfig = " `exchange_after_x_kilometers` = ?, `exchange_after_x_days` = ?, " " `timeout_after_x_seconds` = ?, `vehicle_make` = ?, " " `vehicle_model` = ?, `vehicle_year` = ?, `preloaded_date` = ?, " - "`certificate` = ?, `user_consent_passengersRC` = ?, " - "`country_consent_passengersRC` = ?"; + " `certificate` = ? "; const std::string kInsertEndpoint = "INSERT INTO `endpoint` (`service`, `url`, `application_id`) " @@ -828,8 +705,7 @@ const std::string kSelectModuleConfig = "SELECT `preloaded_pt`, `exchange_after_x_ignition_cycles`, " " `exchange_after_x_kilometers`, `exchange_after_x_days`, " " `timeout_after_x_seconds`, `vehicle_make`," - " `vehicle_model`, `vehicle_year`, `preloaded_date`, `certificate`, " - " `user_consent_passengersRC` , `country_consent_passengersRC` " + " `vehicle_model`, `vehicle_year`, `preloaded_date`, `certificate` " " FROM `module_config`"; const std::string kSelectEndpoints = diff --git a/src/components/policy/policy_external/src/sql_pt_representation.cc b/src/components/policy/policy_external/src/sql_pt_representation.cc index 1732f3c774..f9cc5e5ed5 100644 --- a/src/components/policy/policy_external/src/sql_pt_representation.cc +++ b/src/components/policy/policy_external/src/sql_pt_representation.cc @@ -764,6 +764,19 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection( if (!GatherAppGroup(app_id, ¶ms.groups)) { return false; } + +#ifdef SDL_REMOTE_CONTROL + bool denied = false; + if (!GatherRemoteControlDenied(app_id, &denied)) { + return false; + } + if (!denied) { + if (!GatherModuleType(app_id, &*params.moduleType)) { + return false; + } + } +#endif // SDL_REMOTE_CONTROL + if (!GatherNickName(app_id, &*params.nicknames)) { return false; } @@ -953,6 +966,7 @@ bool SQLPTRepresentation::SaveApplicationPoliciesSection( LOG4CXX_WARN(logger_, "Incorrect delete from app_group."); return false; } + if (!query_delete.Exec(sql_pt::kDeleteApplication)) { LOG4CXX_WARN(logger_, "Incorrect delete from application."); return false; @@ -1033,6 +1047,16 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy( if (!SaveAppGroup(app.first, app.second.groups)) { return false; } + +#ifdef SDL_REMOTE_CONTROL + + bool denied = !app.second.moduleType->is_initialized(); + if (!SaveRemoteControlDenied(app.first, denied) || + !SaveModuleType(app.first, *app.second.moduleType)) { + return false; + } +#endif // SDL_REMOTE_CONTROL + if (!SaveNickname(app.first, *app.second.nicknames)) { return false; } @@ -1263,46 +1287,48 @@ bool SQLPTRepresentation::SaveConsumerFriendlyMessages( // According CRS-2419 If there is no “consumer_friendly_messages” key, // the current local consumer_friendly_messages section shall be maintained in // the policy table. So it won't be changed/updated - if (messages.messages.is_initialized()) { - utils::dbms::SQLQuery query(db()); - if (!messages.messages->empty()) { - if (!query.Exec(sql_pt::kDeleteMessageString)) { - LOG4CXX_WARN(logger_, "Incorrect delete from message."); - return false; - } - } + if (!messages.messages.is_initialized()) { + LOG4CXX_INFO(logger_, "ConsumerFriendlyMessages messages list is empty"); + return true; + } - if (query.Prepare(sql_pt::kUpdateVersion)) { - query.Bind(0, messages.version); - if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect update into version."); - return false; - } - } else { - LOG4CXX_WARN(logger_, "Incorrect update statement for version."); + utils::dbms::SQLQuery query(db()); + bool delete_query_exec_result = true; + if (!messages.messages->empty()) { + delete_query_exec_result = query.Exec(sql_pt::kDeleteMessageString); + } + + if (!delete_query_exec_result) { + LOG4CXX_WARN(logger_, "Failed to delete messages from DB."); + return false; + } + + if (!query.Prepare(sql_pt::kUpdateVersion)) { + LOG4CXX_WARN(logger_, "Invalid update messages version statement."); + return false; + } + + query.Bind(0, messages.version); + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Failed to update messages version number in DB."); + return false; + } + + policy_table::Messages::const_iterator it; + for (it = messages.messages->begin(); it != messages.messages->end(); ++it) { + if (!SaveMessageType(it->first)) { return false; } - - policy_table::Messages::const_iterator it; - // TODO(IKozyrenko): Check logic if optional container is missing - for (it = messages.messages->begin(); it != messages.messages->end(); - ++it) { - if (!SaveMessageType(it->first)) { + const policy_table::Languages& langs = it->second.languages; + policy_table::Languages::const_iterator lang_it; + for (lang_it = langs.begin(); lang_it != langs.end(); ++lang_it) { + if (!SaveLanguage(lang_it->first)) { return false; } - const policy_table::Languages& langs = it->second.languages; - policy_table::Languages::const_iterator lang_it; - for (lang_it = langs.begin(); lang_it != langs.end(); ++lang_it) { - if (!SaveLanguage(lang_it->first)) { - return false; - } - if (!SaveMessageString(it->first, lang_it->first, lang_it->second)) { - return false; - } + if (!SaveMessageString(it->first, lang_it->first, lang_it->second)) { + return false; } } - } else { - LOG4CXX_INFO(logger_, "Messages list is empty"); } return true; @@ -1596,6 +1622,199 @@ bool SQLPTRepresentation::GatherAppGroup( return true; } +#ifdef SDL_REMOTE_CONTROL + +bool SQLPTRepresentation::GatherRemoteControlDenied(const std::string& app_id, + bool* denied) const { + LOG4CXX_AUTO_TRACE(logger_); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kSelectRemoteControlDenied)) { + LOG4CXX_WARN(logger_, "Incorrect select remote control flag"); + return false; + } + query.Bind(0, app_id); + if (query.Next()) { + *denied = query.GetBoolean(0); + } else { + return false; + } + return true; +} + +bool SQLPTRepresentation::GatherModuleType( + const std::string& app_id, policy_table::ModuleTypes* app_types) const { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kSelectModuleTypes)) { + LOG4CXX_WARN(logger_, "Incorrect select from app types"); + return false; + } + + query.Bind(0, app_id); + while (query.Next()) { + policy_table::ModuleType type; + if (!policy_table::EnumFromJsonString(query.GetString(0), &type)) { + return false; + } + app_types->push_back(type); + } + return true; +} + +bool SQLPTRepresentation::SaveRemoteControlDenied(const std::string& app_id, + bool deny) { + LOG4CXX_AUTO_TRACE(logger_); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kUpdateRemoteControlDenied)) { + LOG4CXX_WARN(logger_, "Incorrect update statement for remote control flag"); + return false; + } + LOG4CXX_DEBUG(logger_, "App: " << app_id << std::boolalpha << " - " << deny); + query.Bind(0, deny); + query.Bind(1, app_id); + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Incorrect update remote control flag."); + return false; + } + return true; +} + +bool SQLPTRepresentation::SaveModuleType( + const std::string& app_id, const policy_table::ModuleTypes& types) { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kInsertModuleType)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement for module type"); + return false; + } + + policy_table::ModuleTypes::const_iterator it; + for (it = types.begin(); it != types.end(); ++it) { + query.Bind(0, app_id); + std::string module(policy_table::EnumToJsonString(*it)); + query.Bind(1, module); + LOG4CXX_DEBUG(logger_, + "Module(app: " << app_id << ", type: " << module << ")"); + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into module type."); + return false; + } + } + + return true; +} + +bool SQLPTRepresentation::SaveAccessModule( + TypeAccess access, const policy_table::AccessModules& modules) { + LOG4CXX_AUTO_TRACE(logger_); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kInsertAccessModule)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement for access module"); + return false; + } + + policy_table::AccessModules::const_iterator i; + for (i = modules.begin(); i != modules.end(); ++i) { + const std::string& name = i->first; + const policy_table::RemoteRpcs& rpcs = i->second; + query.Bind(0, name); + query.Bind(1, access); + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Incorrect insert into access module."); + return false; + } + int id = query.LastInsertId(); + if (!query.Reset()) { + LOG4CXX_WARN(logger_, "Couldn't reset query access module."); + return false; + } + if (!SaveRemoteRpc(id, rpcs)) { + return false; + } + } + return true; +} + +bool SQLPTRepresentation::GatherAccessModule( + TypeAccess access, policy_table::AccessModules* modules) const { + LOG4CXX_AUTO_TRACE(logger_); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kSelectAccessModules)) { + LOG4CXX_WARN(logger_, "Incorrect select from access module"); + return false; + } + + query.Bind(0, access); + while (query.Next()) { + int id = query.GetInteger(0); + std::string name = query.GetString(1); + policy_table::RemoteRpcs rpcs; + if (!GatherRemoteRpc(id, &rpcs)) { + return false; + } + modules->insert(std::make_pair(name, rpcs)); + } + return true; +} + +bool SQLPTRepresentation::SaveRemoteRpc(int module_id, + const policy_table::RemoteRpcs& rpcs) { + LOG4CXX_AUTO_TRACE(logger_); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kInsertRemoteRpc)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement for remote rpc"); + return false; + } + policy_table::RemoteRpcs::const_iterator i; + for (i = rpcs.begin(); i != rpcs.end(); ++i) { + const std::string& name = i->first; + const policy_table::Strings& params = i->second; + policy_table::Strings::const_iterator j; + if (params.empty()) { + query.Bind(0, module_id); + query.Bind(1, name); + query.Bind(2); + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into remote rpc."); + return false; + } + } else { + for (j = params.begin(); j != params.end(); ++j) { + const std::string& param = *j; + query.Bind(0, module_id); + query.Bind(1, name); + query.Bind(2, param); + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into remote rpc."); + return false; + } + } + } + } + return true; +} + +bool SQLPTRepresentation::GatherRemoteRpc( + int module_id, policy_table::RemoteRpcs* rpcs) const { + LOG4CXX_AUTO_TRACE(logger_); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kSelectRemoteRpcs)) { + LOG4CXX_WARN(logger_, "Incorrect select from remote rpc"); + return false; + } + + query.Bind(0, module_id); + while (query.Next()) { + std::string name = query.GetString(0); + if (!query.IsNull(1)) { + std::string parameter = query.GetString(1); + (*rpcs)[name].push_back(parameter); + } else { + rpcs->insert(std::make_pair(name, policy_table::Strings())); + } + } + return true; +} +#endif // SDL_REMOTE_CONTROL + bool SQLPTRepresentation::SaveApplicationCustomData(const std::string& app_id, bool is_revoked, bool is_default, @@ -1699,8 +1918,9 @@ bool SQLPTRepresentation::SetDefaultPolicy(const std::string& app_id) { } policy_table::Strings default_groups; - if (GatherAppGroup(kDefaultId, &default_groups) && - SaveAppGroup(app_id, default_groups)) { + bool ret = (GatherAppGroup(kDefaultId, &default_groups) && + SaveAppGroup(app_id, default_groups)); + if (ret) { return SetIsDefault(app_id, true); } return false; diff --git a/src/components/policy/policy_external/test/CMakeLists.txt b/src/components/policy/policy_external/test/CMakeLists.txt index 8b77c90dd2..a455d43b91 100644 --- a/src/components/policy/policy_external/test/CMakeLists.txt +++ b/src/components/policy/policy_external/test/CMakeLists.txt @@ -55,6 +55,12 @@ file (GLOB POLICY_TEST_SOURCES list (REMOVE_ITEM POLICY_TEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/policy_manager_impl_stress_test.cc) +if (REMOTE_CONTROL) + list (APPEND testSources + access_remote_impl_test.cc + ) +endif () + create_test("policy_test" "${POLICY_TEST_SOURCES}" "${testLibraries}") #Additional test files (json) diff --git a/src/components/policy/policy_external/test/include/policy/mock_access_remote.h b/src/components/policy/policy_external/test/include/policy/mock_access_remote.h new file mode 100644 index 0000000000..486c27590d --- /dev/null +++ b/src/components/policy/policy_external/test/include/policy/mock_access_remote.h @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2015, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_TEST_INCLUDE_POLICY_MOCK_ACCESS_REMOTE_H_ +#define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_TEST_INCLUDE_POLICY_MOCK_ACCESS_REMOTE_H_ + +#include "gmock/gmock.h" +#include "policy/access_remote.h" + +namespace test { +namespace components { +namespace access_remote_test { + +class MockAccessRemote : public policy::AccessRemote { + public: + MOCK_CONST_METHOD3( + FindGroup, + policy::PTString(const policy::ApplicationOnDevice& who, + const policy::PTString& rpc, + const policy::RemoteControlParams& params)); + MOCK_METHOD2(SetDefaultHmiTypes, + void(const policy::ApplicationOnDevice& who, + const std::vector<int>& hmi_types)); + MOCK_METHOD1( + GetGroups, + const policy_table::Strings&(const policy::ApplicationOnDevice& who)); + MOCK_METHOD3(GetPermissionsForApp, + bool(const std::string& device_id, + const std::string& app_id, + policy::FunctionalIdType& group_types)); + MOCK_CONST_METHOD2(CheckModuleType, + bool(const policy::PTString& app_id, + policy_table::ModuleType module)); + MOCK_METHOD1(IsAppRemoteControl, + bool(const policy::ApplicationOnDevice& who)); + MOCK_METHOD2(GetModuleTypes, + bool(const std::string& application_id, + std::vector<std::string>* modules)); +}; + +} // namespace access_remote_test +} // namespace components +} // namespace test + +#endif // SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_TEST_INCLUDE_POLICY_MOCK_ACCESS_REMOTE_H_ diff --git a/src/components/policy/policy_external/test/include/policy/mock_app_stopwatch.h b/src/components/policy/policy_external/test/include/policy/mock_app_stopwatch.h new file mode 100644 index 0000000000..397201ce40 --- /dev/null +++ b/src/components/policy/policy_external/test/include/policy/mock_app_stopwatch.h @@ -0,0 +1,53 @@ +/* Copyright (c) 2016, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_TEST_INCLUDE_POLICY_MOCK_APP_STOPWATCH_H_ +#define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_TEST_INCLUDE_POLICY_MOCK_APP_STOPWATCH_H_ + +#include "gmock/gmock.h" +#include "policy/usage_statistics/app_stopwatch.h" + +namespace test { +namespace components { +namespace usage_statistics_test { + +class MockAppStopwatch : public usage_statistics::AppStopwatch { + public: + MOCK_METHOD1(Start, void(usage_statistics::AppStopwatchId stopwatch_type)); + MOCK_METHOD1(Switch, void(usage_statistics::AppStopwatchId stopwatch_type)); + MOCK_METHOD0(WriteTime, void()); +}; + +} // namespace usage_statistics_test +} // namespace components +} // namespace test + +#endif // SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_TEST_INCLUDE_POLICY_MOCK_APP_STOPWATCH_H_ diff --git a/src/components/policy/policy_external/test/policy_manager_impl_test_base.cc b/src/components/policy/policy_external/test/policy_manager_impl_test_base.cc index ce34ca4400..0608799535 100644 --- a/src/components/policy/policy_external/test/policy_manager_impl_test_base.cc +++ b/src/components/policy/policy_external/test/policy_manager_impl_test_base.cc @@ -243,7 +243,7 @@ PolicyManagerImplTest2::PolicyManagerImplTest2() , device_id_1_("XXX123456789ZZZ") , device_id_2_("08-00-27-CE-76-FE") , application_id_("1234") - , app_storage_folder_("storage1") + , app_storage_folder_("storage_PolicyManagerImplTest2") , preloaded_pt_filename_(kSdlPreloadedPtJson) , in_memory_(true) , policy_manager_(NULL) diff --git a/src/components/policy/policy_external/test/sql_pt_representation_test.cc b/src/components/policy/policy_external/test/sql_pt_representation_test.cc index a0a544deeb..a657a01145 100644 --- a/src/components/policy/policy_external/test/sql_pt_representation_test.cc +++ b/src/components/policy/policy_external/test/sql_pt_representation_test.cc @@ -85,7 +85,7 @@ class SQLPTRepresentationTest : public SQLPTRepresentation, policy_settings_; static void SetUpTestCase() { - const std::string kAppStorageFolder = "storage1"; + const std::string kAppStorageFolder = "storage_SQLPTRepresentationTest"; reps = new SQLPTRepresentation(in_memory_); ASSERT_TRUE(reps != NULL); policy_settings_ = std::auto_ptr<policy_handler_test::MockPolicySettings>( @@ -407,7 +407,7 @@ TEST_F(SQLPTRepresentationTest, query.Prepare(query_select); query.Next(); - const int policy_tables_number = 35; + const int policy_tables_number = 32; ASSERT_EQ(policy_tables_number, query.GetInteger(0)); const std::string query_select_count_of_iap_buffer_full = diff --git a/src/components/policy/policy_regular/CMakeLists.txt b/src/components/policy/policy_regular/CMakeLists.txt index 76e10a58b0..c7b9c068b9 100644 --- a/src/components/policy/policy_regular/CMakeLists.txt +++ b/src/components/policy/policy_regular/CMakeLists.txt @@ -65,12 +65,17 @@ set(EXCLUDE_PATHS ) set(PATHS - ${CMAKE_CURRENT_SOURCE_DIR}/include/ - ${CMAKE_CURRENT_SOURCE_DIR}/src/ + ${CMAKE_CURRENT_SOURCE_DIR}/include + ${CMAKE_CURRENT_SOURCE_DIR}/src ${COMPONENTS_DIR}/rpc_base/src/rpc_base/rpc_base.cc ) collect_sources(SOURCES "${PATHS}" "${EXCLUDE_PATHS}") +if (NOT REMOTE_CONTROL) + list(REMOVE_ITEM SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/src/access_remote_impl.cc) +endif() + set(LIBRARIES ConfigProfile policy_struct diff --git a/src/components/policy/policy_regular/include/policy/access_remote.h b/src/components/policy/policy_regular/include/policy/access_remote.h new file mode 100644 index 0000000000..c4de9b7e1f --- /dev/null +++ b/src/components/policy/policy_regular/include/policy/access_remote.h @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2015, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_ACCESS_REMOTE_H_ +#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_ACCESS_REMOTE_H_ + +#include <vector> +#include <ostream> +#include <string> +#include "policy/policy_table/types.h" +#include "policy/policy_types.h" + +namespace policy_table = ::rpc::policy_table_interface_base; + +namespace policy { +struct ApplicationOnDevice { + PTString dev_id; + PTString app_id; +}; +inline bool operator<(const ApplicationOnDevice& x, + const ApplicationOnDevice& y) { + return x.dev_id < y.dev_id || (x.dev_id == y.dev_id && x.app_id < y.app_id); +} +inline bool operator==(const ApplicationOnDevice& x, + const ApplicationOnDevice& y) { + return x.dev_id == y.dev_id && x.app_id == y.app_id; +} +inline std::ostream& operator<<(std::ostream& output, + const ApplicationOnDevice& who) { + output << "Subject(dev:" << who.dev_id << ", app:" << who.app_id << ")"; + return output; +} + +typedef std::vector<PTString> RemoteControlParams; + +class AccessRemote { + public: + virtual ~AccessRemote() {} + /** + * @brief CheckModuleType check if module type is allowed for application + * @param app_id application id + * @param module module + * @return true if allowed, if not - false + */ + virtual bool CheckModuleType(const PTString& app_id, + policy_table::ModuleType module) const = 0; + + /** + * @brief SetDefaultHmiTypes setup default hmi typed for application + * @param who application on specific device + * @param hmi_types hmi types list + */ + virtual void SetDefaultHmiTypes(const ApplicationOnDevice& who, + const std::vector<int>& hmi_types) = 0; + + /** + * @brief GetGroups return list of groups for applicaiton + * @param who application on specific device + * @return list of groups + */ + virtual const policy_table::Strings& GetGroups( + const ApplicationOnDevice& who) = 0; + + /** + * @brief GetPermissionsForApp read list of permissions for application + * @param device_id device + * @param app_id application + * @param group_types output parameter for permissions + * @return true + */ + virtual bool GetPermissionsForApp(const std::string& device_id, + const std::string& app_id, + FunctionalIdType& group_types) = 0; + + /** + * @brief IsAppRemoteControl check is app is remote controll + * @param who application on specific device + * @return true is remote controll aotherwise return false + */ + virtual bool IsAppRemoteControl(const ApplicationOnDevice& who) = 0; + + /** + * @brief GetModuleTypes get list of module types of application + * @param policy_app_id application id + * @param modules output parameter for module types + * @return true on success otherwise false + */ + virtual bool GetModuleTypes(const std::string& policy_app_id, + std::vector<std::string>* modules) = 0; +}; + +} // namespace policy + +#endif // SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_ACCESS_REMOTE_H_ diff --git a/src/components/policy/policy_regular/include/policy/access_remote_impl.h b/src/components/policy/policy_regular/include/policy/access_remote_impl.h new file mode 100644 index 0000000000..933690dc49 --- /dev/null +++ b/src/components/policy/policy_regular/include/policy/access_remote_impl.h @@ -0,0 +1,169 @@ +/* + * Copyright (c) 2015, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_ACCESS_REMOTE_IMPL_H_ +#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_ACCESS_REMOTE_IMPL_H_ + +#include <map> +#include "policy/policy_table/types.h" +#include "utils/macro.h" +#include "utils/shared_ptr.h" +#include "policy/access_remote.h" +#include "policy/cache_manager.h" + +using policy_table::FunctionalGroupings; + +namespace policy { + +class AccessRemoteImpl : public AccessRemote { + public: + AccessRemoteImpl(); + explicit AccessRemoteImpl(utils::SharedPtr<CacheManager> cache); + /** + * @brief CheckModuleType check if module type is allowed for application + * @param app_id application id + * @param module module + * @return true if allowed, if not - false + */ + bool CheckModuleType(const PTString& app_id, + policy_table::ModuleType module) const OVERRIDE; + /** + * @brief SetDefaultHmiTypes setup default hmi typed for application + * @param who application on specific device + * @param hmi_types hmi types list + */ + void SetDefaultHmiTypes(const ApplicationOnDevice& who, + const std::vector<int>& hmi_types) OVERRIDE; + /** + * @brief GetGroups return list of groups for applicaiton + * @param who application on specific device + * @return list of groups + */ + const policy_table::Strings& GetGroups( + const ApplicationOnDevice& who) OVERRIDE; + + /** + * @brief GetPermissionsForApp read list of permissions for application + * @param device_id device + * @param app_id application + * @param group_types output parameter for permissions + * @return true + */ + bool GetPermissionsForApp(const std::string& device_id, + const std::string& app_id, + FunctionalIdType& group_types) OVERRIDE; + + /** + * @brief IsAppRemoteControl check is app is remote controll + * @param who application on specific device + * @return true is remote controll aotherwise return false + */ + bool IsAppRemoteControl(const ApplicationOnDevice& who) OVERRIDE; + + /** + * @brief GetModuleTypes get list of module types of application + * @param policy_app_id application id + * @param modules output parameter for module types + * @return true on success otherwise false + */ + bool GetModuleTypes(const std::string& policy_app_id, + std::vector<std::string>* modules) OVERRIDE; + + private: + /** + * @brief HmiTypes get list of hmi types for application + * @param who application on specific device + * @return list of hmi types + */ + const policy_table::AppHMITypes& HmiTypes(const ApplicationOnDevice& who); + + /** + * @brief GetGroupsIds get list of groups for application + * @param device_id device id + * @param app_id application id + * @param grops_ids output parameter for group ids storing + */ + void GetGroupsIds(const std::string& device_id, + const std::string& app_id, + FunctionalGroupIDs& grops_ids); + + /** + * @brief IsAllowed check if modulename and rpc is allowed for application + * @param modules list of access modules + * @param module_name module name to check + * @param rpc_name rpc name to check + * @param input list of rpc parameters + * @return true if allowed otherwise return false + */ + bool IsAllowed(const policy_table::AccessModules& modules, + const std::string& module_name, + const std::string& rpc_name, + RemoteControlParams* input) const; + /** + * @brief CompareParameters check if app parameters allowed + * @param parameters list of allowed parameters + * @param input list of parameters to check + * @return true if allowed otherwise return false + */ + bool CompareParameters(const policy_table::Strings& parameters, + RemoteControlParams* input) const; + + /** + * @brief cache_ contains pointer to cache manager instance + */ + utils::SharedPtr<CacheManager> cache_; + + /** + * @brief hmi_types_ contains list of default HMI types for applications + */ + typedef std::map<ApplicationOnDevice, policy_table::AppHMITypes> HMIList; + HMIList hmi_types_; + +#ifdef BUILD_TESTS + FRIEND_TEST(AccessRemoteImplTest, KeyMapTest); + FRIEND_TEST(AccessRemoteImplTest, Allow); + FRIEND_TEST(AccessRemoteImplTest, Deny); + FRIEND_TEST(AccessRemoteImplTest, ChangeAccess); + FRIEND_TEST(AccessRemoteImplTest, ResetBySubject); + FRIEND_TEST(AccessRemoteImplTest, ResetByObject); + FRIEND_TEST(AccessRemoteImplTest, CheckAllowed); + FRIEND_TEST(AccessRemoteImplTest, CheckDisallowed); + FRIEND_TEST(AccessRemoteImplTest, CheckManual); + FRIEND_TEST(AccessRemoteImplTest, CheckModuleType); + FRIEND_TEST(AccessRemoteImplTest, EnableDisable); + FRIEND_TEST(AccessRemoteImplTest, SetDefaultHmiTypes); + FRIEND_TEST(AccessRemoteImplTest, GetGroups); +#endif // BUILD_TESTS +}; + +} // namespace policy + +#endif // SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_ACCESS_REMOTE_IMPL_H_ diff --git a/src/components/policy/policy_regular/include/policy/cache_manager.h b/src/components/policy/policy_regular/include/policy/cache_manager.h index 73c010ce33..c5d4c848f4 100644 --- a/src/components/policy/policy_regular/include/policy/cache_manager.h +++ b/src/components/policy/policy_regular/include/policy/cache_manager.h @@ -325,6 +325,13 @@ class CacheManager : public CacheManagerInterface { bool GetDefaultHMI(const std::string& app_id, std::string& default_hmi) const; /** + * Gets HMI types from specific policy + * @param app_id ID application + * @return list of HMI types + */ + const policy_table::AppHMITypes* GetHMITypes(const std::string& app_id); + + /** * @brief Reset user consent for device data and applications permissions * @return */ @@ -690,11 +697,9 @@ class CacheManager : public CacheManagerInterface { const PolicySettings& get_settings() const; -#ifdef BUILD_TESTS - utils::SharedPtr<policy_table::Table> GetPT() const { + utils::SharedPtr<policy_table::Table> pt() const { return pt_; } -#endif private: std::string currentDateTime(); @@ -767,6 +772,13 @@ class CacheManager : public CacheManagerInterface { sync_primitives::Lock backuper_locker_; BackgroundBackuper* backuper_; const PolicySettings* settings_; + +#ifdef BUILD_TESTS + friend class AccessRemoteImpl; + FRIEND_TEST(AccessRemoteImplTest, CheckModuleType); + FRIEND_TEST(AccessRemoteImplTest, EnableDisable); + FRIEND_TEST(AccessRemoteImplTest, GetGroups); +#endif // BUILD_TESTS }; } // namespace policy #endif // SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_CACHE_MANAGER_H_ diff --git a/src/components/policy/policy_regular/include/policy/cache_manager_interface.h b/src/components/policy/policy_regular/include/policy/cache_manager_interface.h index 50896bb8f1..9712b799dc 100644 --- a/src/components/policy/policy_regular/include/policy/cache_manager_interface.h +++ b/src/components/policy/policy_regular/include/policy/cache_manager_interface.h @@ -323,6 +323,14 @@ class CacheManagerInterface { std::string& default_hmi) const = 0; /** + * Gets HMI types from specific policy + * @param app_id ID application + * @return list of HMI types + */ + virtual const policy_table::AppHMITypes* GetHMITypes( + const std::string& app_id) = 0; + + /** * @brief Reset user consent for device data and applications permissions * @return */ @@ -626,15 +634,13 @@ class CacheManagerInterface { */ virtual std::string GetCertificate() const = 0; -#ifdef BUILD_TESTS /** - * @brief GetPT allows to obtain SharedPtr to PT. + * @brief pt allows to obtain SharedPtr to PT. * Used ONLY in Unit tests * @return SharedPTR to PT * */ - virtual utils::SharedPtr<policy_table::Table> GetPT() const = 0; -#endif + virtual utils::SharedPtr<policy_table::Table> pt() const = 0; }; typedef utils::SharedPtr<CacheManagerInterface> CacheManagerInterfaceSPtr; diff --git a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h index 3ca9994a8a..1b39392c0c 100644 --- a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h +++ b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h @@ -47,6 +47,10 @@ #include "policy/usage_statistics/statistics_manager.h" #include "policy/policy_helper.h" #include "utils/timer.h" +#ifdef SDL_REMOTE_CONTROL +#include "policy/access_remote.h" +#include "policy/access_remote_impl.h" +#endif // SDL_REMOTE_CONTROL namespace policy_table = rpc::policy_table_interface_base; @@ -56,185 +60,626 @@ struct CheckAppPolicy; class PolicyManagerImpl : public PolicyManager { public: PolicyManagerImpl(); - virtual void set_listener(PolicyListener* listener); + + /** + * @brief set_listener set new policy listener instance + * @param listener new policy listener + */ + void set_listener(PolicyListener* listener) OVERRIDE; + + /** + * @brief listener get current policy listener instance + * @return current policy listener + */ PolicyListener* listener() const { return listener_; } - virtual bool InitPT(const std::string& file_name, - const PolicySettings* settings); - virtual bool LoadPT(const std::string& file, const BinaryMessage& pt_content); - virtual bool ResetPT(const std::string& file_name); - - virtual void GetUpdateUrls(const uint32_t service_type, - EndpointUrls& out_end_points); - virtual void GetUpdateUrls(const std::string& service_type, - EndpointUrls& out_end_points); - - virtual std::string GetLockScreenIconUrl() const; - virtual bool RequestPTUpdate(); - virtual void CheckPermissions(const PTString& device_id, - const PTString& app_id, - const PTString& hmi_level, - const PTString& rpc, - const RPCParams& rpc_params, - CheckPermissionResult& result) OVERRIDE; - virtual bool ResetUserConsent(); - virtual void KmsChanged(int kilometers); - virtual void IncrementIgnitionCycles(); - virtual std::string ForcePTExchange(); - virtual std::string ForcePTExchangeAtUserRequest(); - virtual std::string GetPolicyTableStatus() const; - virtual void ResetRetrySequence(); - virtual uint32_t NextRetryTimeout(); - virtual uint32_t TimeoutExchangeMSec(); - virtual const std::vector<int> RetrySequenceDelaysSeconds(); - virtual void OnExceededTimeout(); - virtual void OnUpdateStarted(); - virtual void PTUpdatedAt(Counters counter, int value); - - /** - * Refresh data about retry sequence from policy table + + /** + * @brief Inits Policy Table + * @param file_name path to preloaded PT file + * @param settings pointer to policy init settings + * @return true if init is successful + */ + bool InitPT(const std::string& file_name, + const PolicySettings* settings) OVERRIDE; + + /** + * @brief Updates Policy Table from binary message received from + * mobile device. Saves to Policy Table diff between Policy Table + * sent in snapshot and received Policy Table. + * @param file name of file with update policy table + * @param pt_content PTU as binary string + * @return true if successfully + */ + bool LoadPT(const std::string& file, + const BinaryMessage& pt_content) OVERRIDE; + + /** + * @brief Resets Policy Table + * @param file_name Path to preloaded PT file + * @return true if successfully + */ + bool ResetPT(const std::string& file_name) OVERRIDE; + + /** + * @brief Gets all URLs for sending PTS to from PT itself. + * @param service_type Service specifies user of URL + * @param out_end_points output vector of urls + */ + void GetUpdateUrls(const uint32_t service_type, + EndpointUrls& out_end_points) OVERRIDE; + void GetUpdateUrls(const std::string& service_type, + EndpointUrls& out_end_points) OVERRIDE; + + /** + * @brief GetLockScreenIcon allows to obtain lock screen icon url; + * @return url which point to the resourse where lock screen icon could be + *obtained. + */ + std::string GetLockScreenIconUrl() const OVERRIDE; + + /** + * @brief PTU is needed, for this PTS has to be formed and sent. + */ + bool RequestPTUpdate() OVERRIDE; + + /** + * @brief Check if specified RPC for specified application + * has permission to be executed in specified HMI Level + * and also its permitted params. + * @param device_id Id of device of application + * @param app_id Id of application provided during registration + * @param hmi_level Current HMI Level of application + * @param rpc Name of RPC + * @param rpc_params List of RPC params + * @param result containing flag if HMI Level is allowed and list of + * allowed params. + */ + void CheckPermissions(const PTString& device_id, + const PTString& app_id, + const PTString& hmi_level, + const PTString& rpc, + const RPCParams& rpc_params, + CheckPermissionResult& result) OVERRIDE; + + /** + * @brief Clear all record of user consents. Used during Factory Reset. + * @return bool Success of operation + */ + bool ResetUserConsent() OVERRIDE; + + /** + * @brief Checks is PT exceeded kilometers + * @param kilometers current kilometers at odometer + * @return true if exceeded + */ + void KmsChanged(int kilometers) OVERRIDE; + + /** + * @brief Increments counter of ignition cycles + */ + void IncrementIgnitionCycles() OVERRIDE; + + /** + * @brief Exchange by hmi or mobile request + * @return Current status of policy table + */ + std::string ForcePTExchange() OVERRIDE; + + /** + * @brief Exchange by user request + * @return Current status of policy table + */ + std::string ForcePTExchangeAtUserRequest() OVERRIDE; + + /** + * @brief Returns current status of policy table for HMI + * @return Current status of policy table + */ + std::string GetPolicyTableStatus() const OVERRIDE; + + /** + * @brief Resets retry sequence + */ + void ResetRetrySequence(); + + /** + * @brief Gets timeout to wait before next retry updating PT + * If timeout is less or equal to zero then the retry sequence is not need. + * @return timeout in seconds + */ + uint32_t NextRetryTimeout() OVERRIDE; + + /** + * @brief Gets timeout to wait until receive response + * @return timeout in seconds + */ + uint32_t TimeoutExchangeMSec() OVERRIDE; + + /** + * @brief List of timeouts in seconds between retries + * when attempt to update PT fails + * @return List of delays between attempts. + */ + const std::vector<int> RetrySequenceDelaysSeconds() OVERRIDE; + + /** + * @brief Handler of exceeding timeout of exchanging policy table + */ + void OnExceededTimeout() OVERRIDE; + + /** + * @brief Handler of PTS sending out + */ + void OnUpdateStarted() OVERRIDE; + + /** + * @brief Sets counter value that passed for receiving PT UPdate. + */ + void PTUpdatedAt(Counters counter, int value) OVERRIDE; + + /** + * @brief Refresh data about retry sequence from policy table */ virtual void RefreshRetrySequence(); - virtual DeviceConsent GetUserConsentForDevice( + + /** + * @brief Gets user consent for mobile device data connection + * @param device_id Unique device identifier + * @return status of device consent + */ + DeviceConsent GetUserConsentForDevice( const std::string& device_id) const OVERRIDE; - virtual void GetUserConsentForApp( + + /** + * @brief Gets user consent for application + * @param device_id Device id + * @param policy_app_id Unique application id + * @param permissions Array of functional groups permissions + */ + void GetUserConsentForApp( const std::string& device_id, const std::string& policy_app_id, - std::vector<FunctionalGroupPermission>& permissions); - virtual void SetUserConsentForDevice(const std::string& device_id, - bool is_allowed); - virtual bool ReactOnUserDevConsentForApp(const std::string app_id, - bool is_device_allowed); - virtual bool GetInitialAppData(const std::string& application_id, - StringArray* nicknames = NULL, - StringArray* app_hmi_types = NULL); + std::vector<FunctionalGroupPermission>& permissions) OVERRIDE; - virtual void AddDevice(const std::string& device_id, - const std::string& connection_type); + /** + * @brief Set user consent for mobile device data connection + * @param device_id Unique device identifier + * @param is_allowed User consent for usage device data connection + */ + void SetUserConsentForDevice(const std::string& device_id, + const bool is_allowed) OVERRIDE; - virtual void SetDeviceInfo(const std::string& device_id, - const DeviceInfo& device_info); + /** + * @brief Update Application Policies as reaction + * on User allowing/disallowing device this app is running on. + * @param app_id Unique application id + * @param is_device_allowed true if user allowing device otherwise false + * @return true if operation was successful + */ + bool ReactOnUserDevConsentForApp(const std::string app_id, + const bool is_device_allowed) OVERRIDE; + + /** + * @brief Retrieves data from app_policies about app on its registration: + * @param application_id - id of registered app + * @param nicknames Synonyms for application + * @param app_hmi_types Section on HMI where app can appear (Navigation, Phone + * etc) + */ + bool GetInitialAppData(const std::string& application_id, + StringArray* nicknames = NULL, + StringArray* app_hmi_types = NULL) OVERRIDE; + + /** + * @brief Add's device to policy table + * @param device_id Device mac address + * @param connection_type Device connection type + */ + void AddDevice(const std::string& device_id, + const std::string& connection_type) OVERRIDE; + + /** + * @brief Stores device parameters received during application registration + * to policy table + * @param device_id Device mac address + * @param device_info Received device parameters + */ + void SetDeviceInfo(const std::string& device_id, + const DeviceInfo& device_info) OVERRIDE; - virtual void SetUserConsentForApp(const PermissionConsent& permissions); + /** + * @brief Set user consent for application functional groups + * @param permissions User-defined application group pemissions. + * The permissions is not const reference because it may contains + * valid data as well as invalid. So we will remove all invalid data + * from this structure. + */ + void SetUserConsentForApp(const PermissionConsent& permissions) OVERRIDE; - virtual bool GetDefaultHmi(const std::string& policy_app_id, - std::string* default_hmi) const; + /** + * @brief Get default HMI level for application + * @param policy_app_id Unique application id + * @param default_hmi Default HMI level for application or empty, if value + * was not set + * @return true, if succedeed, otherwise - false + */ + bool GetDefaultHmi(const std::string& policy_app_id, + std::string* default_hmi) const OVERRIDE; - virtual bool GetPriority(const std::string& policy_app_id, - std::string* priority) const; + /** + * @brief Get priority for application + * @param policy_app_id Unique application id + * @param priority Priority for application or empty, if value was not set + * @return true, if succedeed, otherwise - false + */ + bool GetPriority(const std::string& policy_app_id, + std::string* priority) const OVERRIDE; - virtual std::vector<UserFriendlyMessage> GetUserFriendlyMessages( + /** + * @brief Get user friendly messages for given RPC messages and language + * @param message_codes RPC message codes + * @param language Language + * @return Array of structs with appropriate message parameters + */ + std::vector<UserFriendlyMessage> GetUserFriendlyMessages( const std::vector<std::string>& message_code, - const std::string& language); + const std::string& language) OVERRIDE; - virtual bool IsApplicationRevoked(const std::string& app_id) const; + /** + * @brief Checks if the application is revoked + * @param app_id application id + * @return true if application is revoked + */ + bool IsApplicationRevoked(const std::string& app_id) const OVERRIDE; - virtual void GetPermissionsForApp( + /** + * @brief Get resulting RPCs permissions for application which started on + * specific device + * @param device_id Device id + * @param policy_app_id Unique application id + * @param permissions Array of functional groups permissions + */ + void GetPermissionsForApp( const std::string& device_id, const std::string& policy_app_id, - std::vector<FunctionalGroupPermission>& permissions); + std::vector<FunctionalGroupPermission>& permissions) OVERRIDE; + + /** + * @brief Return device id, which hosts specific application + * @param policy_app_id Application id, which is required to update device id + */ + std::string& GetCurrentDeviceId( + const std::string& policy_app_id) const OVERRIDE; + + /** + * @brief Set current system language + * @param language Language + */ + void SetSystemLanguage(const std::string& language) OVERRIDE; - virtual std::string& GetCurrentDeviceId( - const std::string& policy_app_id) const; + /** + * @brief Set data from GetSystemInfo response to policy table + * @param ccpu_version CCPU version + * @param wers_country_code WERS country code + * @param language System language + */ + void SetSystemInfo(const std::string& ccpu_version, + const std::string& wers_country_code, + const std::string& language) OVERRIDE; - virtual void SetSystemLanguage(const std::string& language); + /** + * @brief Runs necessary operations, which is depends on external system + * state, e.g. getting system-specific parameters which are need to be + * filled into policy table + */ + void OnSystemReady() OVERRIDE; - virtual void SetSystemInfo(const std::string& ccpu_version, - const std::string& wers_country_code, - const std::string& language); - virtual void OnSystemReady(); + /** + * @brief Get number of notification by priority + * @param priority Specified priority + * @return notification number + */ + uint32_t GetNotificationsNumber(const std::string& priority) const OVERRIDE; - virtual uint32_t GetNotificationsNumber( - const std::string& priority) const OVERRIDE; + /** + * @brief Allows to update Vehicle Identification Number in policy table. + * @param new value for the parameter. + */ + void SetVINValue(const std::string& value) OVERRIDE; - virtual void SetVINValue(const std::string& value); + /** + * @brief Gets specific application permissions changes since last policy + * table update + * @param policy_app_id Unique application id + * @return Permissions changes + */ + AppPermissions GetAppPermissionsChanges( + const std::string& policy_app_id) OVERRIDE; - // Interface StatisticsManager (begin) - virtual void Increment(usage_statistics::GlobalCounterId type); - virtual void Increment(const std::string& app_id, - usage_statistics::AppCounterId type); - virtual void Set(const std::string& app_id, - usage_statistics::AppInfoId type, - const std::string& value); - virtual void Add(const std::string& app_id, - usage_statistics::AppStopwatchId type, - int32_t timespan_seconds); - // Interface StatisticsManager (end) + /** + * @brief Removes specific application permissions changes + * @param app_id Unique application id + */ + void RemovePendingPermissionChanges(const std::string& app_id) OVERRIDE; + + /** + * @brief Send OnPermissionsUpdated for choosen application + * @param application_id Unique application id + */ + void SendNotificationOnPermissionsUpdated( + const std::string& application_id) OVERRIDE; - AppPermissions GetAppPermissionsChanges(const std::string& policy_app_id); - void RemovePendingPermissionChanges(const std::string& app_id); + /** + * @brief Removes unpaired device records and related records from DB + * @return true, if succedeed, otherwise - false + */ + bool CleanupUnpairedDevices() OVERRIDE; - void SendNotificationOnPermissionsUpdated(const std::string& application_id); + /** + * @brief Check if app can keep context. + * @param app_id Unique application id + * @return true if app can keep context, otherwise - false + */ + bool CanAppKeepContext(const std::string& app_id) const OVERRIDE; - bool CleanupUnpairedDevices(); + /** + * @brief Check if app can steal focus. + * @param app_id Unique application id + * @return true if app can steal focus, otherwise - false + */ + bool CanAppStealFocus(const std::string& app_id) const OVERRIDE; - bool CanAppKeepContext(const std::string& app_id) const; - bool CanAppStealFocus(const std::string& app_id) const; - void MarkUnpairedDevice(const std::string& device_id); + /** + * @brief Marks device as upaired + * @param device_id id device + */ + void MarkUnpairedDevice(const std::string& device_id) OVERRIDE; + /** + * @brief Adds, application to the db or update existed one + * run PTU if policy update is necessary for application. + * @param application_id Unique application id + * @param hmi_types application HMI types + * @return function that will notify update manager about new application + */ StatusNotifier AddApplication( const std::string& application_id, - const rpc::policy_table_interface_base::AppHmiTypes& hmi_types); + const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) OVERRIDE; +#ifdef SDL_REMOTE_CONTROL + /** + * @brief Assigns new HMI types for specified application + * @param application_id Unique application id + * @param hmi_types new HMI types list + */ + void SetDefaultHmiTypes(const std::string& application_id, + const std::vector<int>& hmi_types) OVERRIDE; + + /** + * @brief Gets HMI types + * @param application_id ID application + * @param app_types list to save HMI types + * @return true if policy has specific policy for this application + */ + bool GetHMITypes(const std::string& application_id, + std::vector<int>* app_types) OVERRIDE; + + /** + * @brief Setter for access_remote instance + * @param access_remote pointer to new access_remote instance + */ + void set_access_remote(utils::SharedPtr<AccessRemote> access_remote) OVERRIDE; + + /** + * @brief Sends notification about application HMI level changed + * @param who application information structure + */ + void SendHMILevelChanged(const ApplicationOnDevice& who); + + /** + * @brief Sends notification if application permissions were changed + * @param application_id Unique id of application + */ + void OnPrimaryGroupsChanged(const std::string& application_id); +#endif // SDL_REMOTE_CONTROL + + /** + * @brief Removes consent for application functional group + * @param application_id Unique id of application + * @param group_name application functional group name + */ virtual void RemoveAppConsentForGroup(const std::string& app_id, const std::string& group_name); - virtual uint32_t HeartBeatTimeout(const std::string& app_id) const; + /** + * @brief Returns heart beat timeout + * @param app_id application id + * @return if timeout was set then value in milliseconds greater zero + * otherwise heart beat for specific application isn't set + */ + uint32_t HeartBeatTimeout(const std::string& app_id) const OVERRIDE; + + /** + * @brief SaveUpdateStatusRequired allows to save update status. + * @param is_update_needed true if update needed + */ + void SaveUpdateStatusRequired(bool is_update_needed) OVERRIDE; - virtual void SaveUpdateStatusRequired(bool is_update_needed); + /** + * @brief Checks, if application has policy assigned w/o data consent + * @param policy_app_id Unique application id + * @return true, if policy assigned w/o data consent, otherwise -false + */ + bool IsPredataPolicy(const std::string& policy_app_id) const OVERRIDE; - virtual bool IsPredataPolicy(const std::string& policy_app_id) const OVERRIDE; + /** + * @brief Setter for cache_manager instance + * @param cache_manager pointer to new cache_manager instance + */ void set_cache_manager(CacheManagerInterface* cache_manager); - virtual void OnAppsSearchStarted(); + /** + * @brief Handler on applications search started + */ + void OnAppsSearchStarted() OVERRIDE; + + /** + * @brief Handler on applications search completed + * @param trigger_ptu contains true if PTU should be triggered + */ + void OnAppsSearchCompleted(const bool trigger_ptu) OVERRIDE; + + /** + * @brief Gets request types for application + * @param policy_app_id Unique application id + * @return request types of application + */ + const std::vector<std::string> GetAppRequestTypes( + const std::string policy_app_id) const OVERRIDE; + + /** + * @brief Get information about vehicle + * @return vehicle information + */ + const VehicleInfo GetVehicleInfo() const OVERRIDE; + + /** + * @brief OnAppRegisteredOnMobile allows to handle event when application were + * succesfully registered on mobile device. + * It will send OnAppPermissionSend notification and will try to start PTU. * + * @param application_id registered application. + */ + void OnAppRegisteredOnMobile(const std::string& application_id) OVERRIDE; - virtual void OnAppsSearchCompleted(const bool trigger_ptu); + /** + * @brief RetrieveCertificate Allows to obtain certificate in order + * to start secure connection. + * @return The certificate in PKCS#7 format. + */ + std::string RetrieveCertificate() const OVERRIDE; + + /** + * @brief HasCertificate check whether policy table has certificate + * int module_config section. + * @return true in case certificate exists, false otherwise + */ + bool HasCertificate() const OVERRIDE; + + /** + * @brief Finds the next URL that must be sent on OnSystemRequest retry + * @param urls vector of vectors that contain urls for each application + * @return Pair of policy application id and application url id from the + * urls vector + */ + AppIdURL GetNextUpdateUrl(const EndpointUrls& urls) OVERRIDE; + + /** + * @brief Checks if there is existing URL in the EndpointUrls vector with + * index saved in the policy manager and if not, it moves to the next + * application index + * @param rs contains the application index and url index from the + * urls vector that are to be sent on the next OnSystemRequest + * @param urls vector of vectors that contain urls for each application + * @return Pair of application index and url index + */ + AppIdURL RetrySequenceUrl(const struct RetrySequenceURL& rs, + const EndpointUrls& urls) const OVERRIDE; #ifdef BUILD_TESTS + /** + * @brief Getter for cache_manager instance + * @return cache_manager instance + */ inline CacheManagerInterfaceSPtr GetCache() { return cache_; } + /** + * @brief Setter for send_on_update_sent_out + * @param send_on_update_sent_out new value of this flag + */ inline void SetSendOnUpdateSentOut(const bool send_on_update_sent_out) { send_on_update_sent_out_ = send_on_update_sent_out; } #endif // BUILD_TESTS - virtual const std::vector<std::string> GetAppRequestTypes( - const std::string policy_app_id) const; - virtual const VehicleInfo GetVehicleInfo() const; - - virtual void OnAppRegisteredOnMobile( - const std::string& application_id) OVERRIDE; - - virtual std::string RetrieveCertificate() const OVERRIDE; + // Interface StatisticsManager (begin) + /** + * @brief Increments global counter + * @param type counter type + */ + void Increment(usage_statistics::GlobalCounterId type) OVERRIDE; - virtual bool HasCertificate() const OVERRIDE; + /** + * @brief Increments specified application counter + * @param app_id Unique ID of application + * @param type application counter type + */ + void Increment(const std::string& app_id, + usage_statistics::AppCounterId type) OVERRIDE; - AppIdURL GetNextUpdateUrl(const EndpointUrls& urls) OVERRIDE; + /** + * @brief Sets specified application info value + * @param app_id Unique ID of application + * @param type application info type + * @param value new value for counter + */ + void Set(const std::string& app_id, + usage_statistics::AppInfoId type, + const std::string& value) OVERRIDE; - AppIdURL RetrySequenceUrl(const struct RetrySequenceURL& rs, - const EndpointUrls& urls) const OVERRIDE; + /** + * @brief Add seconds for specified application stopwatch + * @param app_id Unique ID of application + * @param type application stopwatch type + * @param timespan_seconds seconds to add + */ + void Add(const std::string& app_id, + usage_statistics::AppStopwatchId type, + int32_t timespan_seconds) OVERRIDE; + // Interface StatisticsManager (end) protected: #ifdef USE_HMI_PTU_DECRYPTION + /** + * @brief Parse policy table content and convert to PT object + * @param pt_content binary content of PT + * @return pointer to converted PT + */ virtual utils::SharedPtr<policy_table::Table> Parse( const BinaryMessage& pt_content); #else + /** + * @brief Parse policy table content and convert to PT object + * @param pt_content binary content of PT + * @return pointer to converted PT + */ virtual utils::SharedPtr<policy_table::Table> ParseArray( const BinaryMessage& pt_content); #endif + /** + * @brief Getter for policy settings + * @return policy settings instance + */ const PolicySettings& get_settings() const OVERRIDE; private: + /** + * @brief Checks if PT update should be started and schedules it if needed + */ void CheckTriggers(); - /* - * @brief Checks policy table update along with current data for any changes - * in assigned functional group list of application - * - * @param Policy table update struct + + /** + * @brief Compares current applications policies to the updated one and + * returns apporopriate result codes per application, which that are being + * processed by sending notification to applications registered and to the + * system + * @param update Shared pointer to policy table udpate + * @param snapshot Shared pointer to current copy of policy table + * @return Collection per-application results */ void CheckPermissionsChanges( const utils::SharedPtr<policy_table::Table> update, @@ -310,46 +755,140 @@ class PolicyManagerImpl : public PolicyManager { const std::string& policy_app_id, const std::vector<FunctionalGroupPermission>& current_permissions); - virtual void StartPTExchange(); - virtual bool ExceededDays(); - virtual bool ExceededIgnitionCycles(); + /** + * @brief StartPTExchange allows to start PTU. The function will check + * if one is required and starts the update flow in only case when previous + * condition is true. + */ + void StartPTExchange() OVERRIDE; + + /** + * @brief Checks is PT exceeded days + * @return true if exceeded + */ + bool ExceededDays() OVERRIDE; + + /** + * @brief Checks is PT exceeded IgnitionCycles + * @return true if exceeded + */ + bool ExceededIgnitionCycles() OVERRIDE; + + /** + * @brief Checks is specified policy table valid + * @param policy_table pointer to policy table to check + * @param type policy table type + * @return true if policy table valid, otherwise false + */ bool IsPTValid(utils::SharedPtr<policy_table::Table> policy_table, policy_table::PolicyTableType type) const; + /** + * @brief Starts new retry sequence + */ void RetrySequence(); private: +#ifdef SDL_REMOTE_CONTROL + /** + * @brief Get resulting RPCs permissions for application which started on + * specific device + * @param device_id Device id + * @param policy_app_id Unique application id + * @param permissions Array of RPC param/HMI permissions + */ + void GetPermissions(const std::string device_id, + const std::string application_id, + Permissions* data); + + /** + * @brief Checks if module for application is present in policy table + * @param app_id id of application + * @param module type + * @return true if module is present, otherwise - false + */ + bool CheckModule(const PTString& app_id, const PTString& module) OVERRIDE; + + /** + * @brief Send OnPermissionsChange notification to mobile app + * when it's permissions are changed. + * @param device_id Device on which app is running + * @param application_id ID of app whose permissions are changed + */ + void SendAppPermissionsChanged(const std::string& device_id, + const std::string& application_id) OVERRIDE; + + /** + * @brief Gets all allowed module types + * @param policy_app_id unique identifier of application + * @param modules list of allowed module types + * @return true if application has allowed modules + */ + bool GetModuleTypes(const std::string& policy_app_id, + std::vector<std::string>* modules) const OVERRIDE; +#endif // SDL_REMOTE_CONTROL + /** + * @brief pointer to policy table listener for callbacks + */ PolicyListener* listener_; + /** + * @brief UpdateStatusManager instance for controlling PT status + */ UpdateStatusManager update_status_manager_; + + /** + * @brief pointer to CacheManagerInterface instance for getting policy data + */ CacheManagerInterfaceSPtr cache_; +#ifdef SDL_REMOTE_CONTROL + /** + * @brief pointer to AccessRemote instance for working with RC applications + */ + utils::SharedPtr<AccessRemote> access_remote_; +#endif + + /** + * @brief lock guard for protecting applications list access + */ sync_primitives::Lock apps_registration_lock_; + + /** + * @brief lock guard for protecting application permissions access + */ sync_primitives::Lock app_permissions_diff_lock_; - std::map<std::string, AppPermissions> app_permissions_diff_; /** - * Timeout to wait response with UpdatePT (msec) + * @brief Collection of parameters to be reported to the system with + * SDL.ActivateApp response or OnAppPermissionsChanged notification + * Being set during policy table update processing + */ + typedef std::map<std::string, AppPermissions> PendingPermissions; + PendingPermissions app_permissions_diff_; + + /** + * @brief Timeout to wait response with UpdatePT */ uint32_t retry_sequence_timeout_; /** - * Seconds between retries to update PT + * @brief Seconds between retries to update PT */ std::vector<int> retry_sequence_seconds_; /** - * Current index trying of retry sequence + * @brief Current index trying of retry sequence */ uint32_t retry_sequence_index_; /** - * Lock for guarding retry sequence + * @brief Lock for guarding retry sequence */ sync_primitives::Lock retry_sequence_lock_; /** - * Timer to retry UpdatePT - */ + * @brief Timer to retry UpdatePT + */ timer::Timer timer_retry_sequence_; /** @@ -358,8 +897,14 @@ class PolicyManagerImpl : public PolicyManager { */ mutable std::string last_device_id_; + /** + * @brief Flag for checking first ignition cycle + */ bool ignition_check; + /** + * @brief Pointer to current policy settings structure + */ const PolicySettings* settings_; friend struct CheckAppPolicy; friend struct ProccessAppGroups; @@ -370,8 +915,19 @@ class PolicyManagerImpl : public PolicyManager { */ RetrySequenceURL retry_sequence_url_; + /** + * @brief Flag for notifying that invalid PTU was received + */ bool wrong_ptu_update_received_; + + /** + * @brief Flag for notifying that PTU was started + */ bool send_on_update_sent_out_; + + /** + * @brief Flag for notifying that invalid PTU should be triggered + */ bool trigger_ptu_; }; diff --git a/src/components/policy/policy_regular/include/policy/policy_table/enums.h b/src/components/policy/policy_regular/include/policy/policy_table/enums.h index 0554e94722..66ab9a1b60 100644 --- a/src/components/policy/policy_regular/include/policy/policy_table/enums.h +++ b/src/components/policy/policy_regular/include/policy/policy_table/enums.h @@ -104,7 +104,8 @@ enum AppHMIType { AHT_BACKGROUND_PROCESS, AHT_TESTING, AHT_SYSTEM, - AHT_REMOTE_CONTROL, + AHT_PROJECTION, + AHT_REMOTE_CONTROL }; bool IsValidEnum(AppHMIType val); const char* EnumToJsonString(AppHMIType val); diff --git a/src/components/policy/policy_regular/include/policy/policy_table/types.h b/src/components/policy/policy_regular/include/policy/policy_table/types.h index 66fddee592..61585776f2 100644 --- a/src/components/policy/policy_regular/include/policy/policy_table/types.h +++ b/src/components/policy/policy_regular/include/policy/policy_table/types.h @@ -67,9 +67,9 @@ typedef Array<Enum<HmiLevel>, 0, 4> HmiLevels; typedef Array<Enum<Parameter>, 0, 24> Parameters; -typedef Map<RpcParameters, 0, 50> Rpc; +typedef Map<RpcParameters, 0, UINT_MAX> Rpc; -typedef Array<String<10, 255>, 1, 255> URL; +typedef Array<String<10, 255>, 1, 3> URL; typedef Map<URL, 1, 255> URLList; @@ -79,7 +79,7 @@ typedef uint8_t NumberOfNotificationsType; typedef Map<Integer<NumberOfNotificationsType, 0, 255>, 0, 6> NumberOfNotificationsPerMinute; -typedef Array<Integer<uint16_t, 1, 1000>, 0, 10> SecondsBetweenRetries; +typedef Array<Integer<uint16_t, 1, 1000>, 0, 5> SecondsBetweenRetries; typedef Map<MessageString, 0, 500> Languages; @@ -96,6 +96,12 @@ typedef Map<DeviceParams, 0, 255> DeviceData; typedef Array<Enum<RequestType>, 0, 255> RequestTypes; +#ifdef SDL_REMOTE_CONTROL +typedef Map<Strings, 0, 255> RemoteRpcs; +typedef Map<RemoteRpcs, 0, 255> AccessModules; +typedef Array<Enum<ModuleType>, 0, 255> ModuleTypes; +#endif // SDL_REMOTE_CONTROL + typedef AppHMIType AppHmiType; typedef std::vector<AppHMIType> AppHmiTypes; @@ -136,6 +142,9 @@ struct ApplicationParams : PolicyBase { Optional<Integer<uint16_t, 0, 65225> > memory_kb; Optional<Integer<uint32_t, 0, UINT_MAX> > heart_beat_timeout_ms; Optional<String<0, 255> > certificate; +#ifdef SDL_REMOTE_CONTROL + mutable Optional<ModuleTypes> moduleType; +#endif // SDL_REMOTE_CONTROL public: ApplicationParams(); @@ -151,6 +160,9 @@ struct ApplicationParams : PolicyBase { private: bool Validate() const; +#ifdef SDL_REMOTE_CONTROL + bool ValidateModuleTypes() const; +#endif // SDL_REMOTE_CONTROL }; struct ApplicationPoliciesSection : CompositeType { @@ -298,6 +310,7 @@ struct MessageLanguages : CompositeType { virtual void SetPolicyTableType(PolicyTableType pt_type); private: + static const std::string default_language_; bool Validate() const; }; diff --git a/src/components/policy/policy_regular/include/policy/sql_pt_queries.h b/src/components/policy/policy_regular/include/policy/sql_pt_queries.h index 79a66ba41a..2ded25e456 100644 --- a/src/components/policy/policy_regular/include/policy/sql_pt_queries.h +++ b/src/components/policy/policy_regular/include/policy/sql_pt_queries.h @@ -114,6 +114,19 @@ extern const std::string kInsertApplicationFull; extern const std::string kDeletePreconsentedGroupsByApplicationId; extern const std::string kSelectApplicationFull; extern const std::string kUpdatePreloaded; +extern const std::string kUpdateRemoteControlDenied; +extern const std::string kSelectRemoteControlDenied; +extern const std::string kCollectFriendlyMsg; +extern const std::string kSelectModuleTypes; +extern const std::string kInsertModuleType; +extern const std::string kInsertAccessModule; +extern const std::string kSelectAccessModules; +extern const std::string kDeleteAccessModules; +extern const std::string kInsertRemoteRpc; +extern const std::string kSelectRemoteRpcs; +extern const std::string kDeleteRemoteRpc; +extern const std::string kDeleteModuleTypes; +extern const std::string kDeleteAllDevices; extern const std::string kSelectDBVersion; extern const std::string kUpdateDBVersion; extern const std::string kSaveModuleMeta; diff --git a/src/components/policy/policy_regular/include/policy/sql_pt_representation.h b/src/components/policy/policy_regular/include/policy/sql_pt_representation.h index bd867389ab..6b5d6111f1 100644 --- a/src/components/policy/policy_regular/include/policy/sql_pt_representation.h +++ b/src/components/policy/policy_regular/include/policy/sql_pt_representation.h @@ -97,6 +97,23 @@ class SQLPTRepresentation : public virtual PTRepresentation { } #endif // BUILD_TESTS protected: +#ifdef SDL_REMOTE_CONTROL + enum TypeAccess { kAllowed, kManual }; + bool GatherModuleType(const std::string& app_id, + policy_table::ModuleTypes* module_types) const; + bool GatherRemoteControlDenied(const std::string& app_id, bool* denied) const; + bool GatherAccessModule(TypeAccess access, + policy_table::AccessModules* modules) const; + bool GatherRemoteRpc(int module_id, policy_table::RemoteRpcs* rpcs) const; + bool SaveModuleType(const std::string& app_id, + const policy_table::ModuleTypes& types); + bool SaveRemoteControlDenied(const std::string& app_id, bool deny); + + bool SaveAccessModule(TypeAccess access, + const policy_table::AccessModules& modules); + bool SaveRemoteRpc(int module_id, const policy_table::RemoteRpcs& rpcs); +#endif // SDL_REMOTE_CONTROL + virtual void GatherModuleMeta(policy_table::ModuleMeta* meta) const; virtual void GatherModuleConfig(policy_table::ModuleConfig* config) const; virtual bool GatherUsageAndErrorCounts( diff --git a/src/components/policy/policy_regular/src/access_remote_impl.cc b/src/components/policy/policy_regular/src/access_remote_impl.cc new file mode 100644 index 0000000000..f99b226f2e --- /dev/null +++ b/src/components/policy/policy_regular/src/access_remote_impl.cc @@ -0,0 +1,247 @@ +/* + * Copyright (c) 2015, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include "policy/access_remote_impl.h" + +#include <algorithm> +#include <iterator> +#include "policy/cache_manager.h" +#include "utils/logger.h" + +CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyManagerImpl") + +using policy_table::DeviceData; +using policy_table::FunctionalGroupings; +using rpc::policy_table_interface_base::EnumFromJsonString; + +namespace policy { + +struct ToHMIType { + policy_table::AppHMITypes::value_type operator()(int item) const { + policy_table::AppHMIType type = static_cast<policy_table::AppHMIType>(item); + if (!IsValidEnum(type)) { + LOG4CXX_WARN(logger_, "HMI type isn't known " << item); + type = policy_table::AHT_DEFAULT; + } + LOG4CXX_DEBUG(logger_, + "HMI type: " << item << " - " << EnumToJsonString(type)); + return policy_table::AppHMITypes::value_type(type); + } +}; + +struct Contained { + private: + const policy_table::Strings& params_; + + public: + explicit Contained(const policy_table::Strings& params) : params_(params) {} + bool operator()(const RemoteControlParams::value_type& item) const { + return std::find_if(params_.begin(), params_.end(), CompareString(item)) != + params_.end(); + } + struct CompareString { + private: + const RemoteControlParams::value_type& value_; + + public: + explicit CompareString(const RemoteControlParams::value_type& value) + : value_(value) {} + bool operator()(const policy_table::Strings::value_type& item) const { + return value_ == static_cast<std::string>(item); + } + }; +}; + +struct ToModuleType { + std::string operator()(policy_table::ModuleTypes::value_type item) const { + policy_table::ModuleType type = static_cast<policy_table::ModuleType>(item); + return EnumToJsonString(type); + } +}; + +AccessRemoteImpl::AccessRemoteImpl() : cache_(new CacheManager()) {} + +AccessRemoteImpl::AccessRemoteImpl(utils::SharedPtr<CacheManager> cache) + : cache_(cache) {} + +bool AccessRemoteImpl::CheckModuleType(const PTString& app_id, + policy_table::ModuleType module) const { + LOG4CXX_AUTO_TRACE(logger_); + if (!cache_->IsApplicationRepresented(app_id)) { + return false; + } + + const policy_table::ApplicationParams& app = + cache_->pt()->policy_table.app_policies_section.apps[app_id]; + if (!app.moduleType.is_initialized()) { + return false; + } + + const policy_table::ModuleTypes& modules = *app.moduleType; + if (modules.empty()) { + return true; + } + + return std::find(modules.begin(), modules.end(), module) != modules.end(); +} + +bool AccessRemoteImpl::IsAllowed(const policy_table::AccessModules& modules, + const std::string& module_name, + const std::string& rpc_name, + RemoteControlParams* input) const { + LOG4CXX_AUTO_TRACE(logger_); + policy_table::AccessModules::const_iterator i = modules.find(module_name); + if (i == modules.end()) { + LOG4CXX_DEBUG(logger_, "Module " << module_name << " wasn't found"); + return false; + } + + const policy_table::RemoteRpcs& rpcs = i->second; + if (rpcs.empty()) { + return true; + } + policy_table::RemoteRpcs::const_iterator j = rpcs.find(rpc_name); + if (j != rpcs.end()) { + const policy_table::Strings& parameters = j->second; + return CompareParameters(parameters, input); + } + LOG4CXX_DEBUG(logger_, "RPC " << rpc_name << " wasn't found"); + return false; +} + +bool AccessRemoteImpl::CompareParameters( + const policy_table::Strings& parameters, RemoteControlParams* input) const { + LOG4CXX_AUTO_TRACE(logger_); + if (parameters.empty()) { + return true; + } + + if (input->empty()) { + LOG4CXX_DEBUG(logger_, "Input is empty"); + return false; + } + + input->erase( + std::remove_if(input->begin(), input->end(), Contained(parameters)), + input->end()); + return input->empty(); +} + +void AccessRemoteImpl::SetDefaultHmiTypes(const ApplicationOnDevice& who, + const std::vector<int>& hmi_types) { + LOG4CXX_AUTO_TRACE(logger_); + HMIList::mapped_type types; + std::transform(hmi_types.begin(), + hmi_types.end(), + std::back_inserter(types), + ToHMIType()); + hmi_types_[who] = types; +} + +const policy_table::AppHMITypes& AccessRemoteImpl::HmiTypes( + const ApplicationOnDevice& who) { + LOG4CXX_AUTO_TRACE(logger_); + if (cache_->IsDefaultPolicy(who.app_id)) { + return hmi_types_[who]; + } else { + return *cache_->pt() + ->policy_table.app_policies_section.apps[who.app_id] + .AppHMIType; + } +} + +const policy_table::Strings& AccessRemoteImpl::GetGroups( + const ApplicationOnDevice& who) { + LOG4CXX_AUTO_TRACE(logger_); + return cache_->GetGroups(who.app_id); +} + +bool AccessRemoteImpl::IsAppRemoteControl(const ApplicationOnDevice& who) { + LOG4CXX_AUTO_TRACE(logger_); + const policy_table::AppHMITypes& hmi_types = HmiTypes(who); + return std::find(hmi_types.begin(), + hmi_types.end(), + policy_table::AHT_REMOTE_CONTROL) != hmi_types.end(); +} + +bool AccessRemoteImpl::GetPermissionsForApp(const std::string& device_id, + const std::string& app_id, + FunctionalIdType& group_types) { + LOG4CXX_AUTO_TRACE(logger_); + GetGroupsIds(device_id, app_id, group_types[kTypeGeneral]); + GetGroupsIds(device_id, kDefaultId, group_types[kTypeDefault]); + GetGroupsIds( + device_id, kPreDataConsentId, group_types[kTypePreDataConsented]); + return true; +} + +std::ostream& operator<<(std::ostream& output, + const FunctionalGroupIDs& types) { + std::copy(types.begin(), + types.end(), + std::ostream_iterator<FunctionalGroupIDs::value_type>(output, " ")); + return output; +} + +void AccessRemoteImpl::GetGroupsIds(const std::string& device_id, + const std::string& app_id, + FunctionalGroupIDs& groups_ids) { + ApplicationOnDevice who = {device_id, app_id}; + const policy_table::Strings& groups = GetGroups(who); + groups_ids.resize(groups.size()); + std::transform(groups.begin(), + groups.end(), + groups_ids.begin(), + &CacheManager::GenerateHash); + LOG4CXX_DEBUG(logger_, "Groups Ids: " << groups_ids); +} + +bool AccessRemoteImpl::GetModuleTypes(const std::string& application_id, + std::vector<std::string>* modules) { + DCHECK(modules); + policy_table::ApplicationPolicies& apps = + cache_->pt()->policy_table.app_policies_section.apps; + policy_table::ApplicationPolicies::iterator i = apps.find(application_id); + if (i == apps.end()) { + return false; + } + rpc::Optional<policy_table::ModuleTypes> moduleTypes = i->second.moduleType; + if (!moduleTypes.is_initialized()) { + return false; + } + std::transform(moduleTypes->begin(), + moduleTypes->end(), + std::back_inserter(*modules), + ToModuleType()); + return true; +} + +} // namespace policy diff --git a/src/components/policy/policy_regular/src/cache_manager.cc b/src/components/policy/policy_regular/src/cache_manager.cc index 6184320306..78674c81f3 100644 --- a/src/components/policy/policy_regular/src/cache_manager.cc +++ b/src/components/policy/policy_regular/src/cache_manager.cc @@ -127,6 +127,17 @@ uint32_t CacheManager::HeartBeatTimeout(const std::string& app_id) const { return result; } +const policy_table::AppHMITypes* CacheManager::GetHMITypes( + const std::string& app_id) { + const policy_table::ApplicationPolicies& apps = + pt_->policy_table.app_policies_section.apps; + policy_table::ApplicationPolicies::const_iterator i = apps.find(app_id); + if (i != apps.end()) { + return &(*i->second.AppHMIType); + } + return NULL; +} + bool CacheManager::CanAppStealFocus(const std::string& app_id) const { CACHE_MANAGER_CHECK(false); bool result = true; @@ -136,8 +147,8 @@ bool CacheManager::CanAppStealFocus(const std::string& app_id) const { bool CacheManager::GetDefaultHMI(const std::string& app_id, std::string& default_hmi) const { CACHE_MANAGER_CHECK(false); - bool result = true; - return result; + default_hmi = "NONE"; + return true; } bool CacheManager::ResetUserConsent() { @@ -222,6 +233,8 @@ bool CacheManager::ApplyUpdate(const policy_table::Table& update_pt) { for (; iter != iter_end; ++iter) { if (iter->second.is_null()) { + pt_->policy_table.app_policies_section.apps[iter->first] = + policy_table::ApplicationParams(); pt_->policy_table.app_policies_section.apps[iter->first].set_to_null(); pt_->policy_table.app_policies_section.apps[iter->first].set_to_string( ""); diff --git a/src/components/policy/policy_regular/src/policy_manager_impl.cc b/src/components/policy/policy_regular/src/policy_manager_impl.cc index f05ac9cb67..640b9c1457 100644 --- a/src/components/policy/policy_regular/src/policy_manager_impl.cc +++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc @@ -51,6 +51,11 @@ #include "utils/timer_task_impl.h" #include "utils/make_shared.h" +#ifdef SDL_REMOTE_CONTROL +#include "policy/access_remote.h" +#include "policy/access_remote_impl.h" +#endif // SDL_REMOTE_CONTROL + policy::PolicyManager* CreateManager() { return new policy::PolicyManagerImpl(); } @@ -71,6 +76,10 @@ PolicyManagerImpl::PolicyManagerImpl() : PolicyManager() , listener_(NULL) , cache_(new CacheManager) +#ifdef SDL_REMOTE_CONTROL + , access_remote_(new AccessRemoteImpl( + CacheManagerInterfaceSPtr::static_pointer_cast<CacheManager>(cache_))) +#endif // SDL_REMOTE_CONTROL , retry_sequence_timeout_(kDefaultRetryTimeoutInMSec) , retry_sequence_index_(0) , timer_retry_sequence_("Retry sequence timer", @@ -80,7 +89,8 @@ PolicyManagerImpl::PolicyManagerImpl() , retry_sequence_url_(0, 0, "") , wrong_ptu_update_received_(false) , send_on_update_sent_out_(false) - , trigger_ptu_(false) {} + , trigger_ptu_(false) { +} void PolicyManagerImpl::set_listener(PolicyListener* listener) { listener_ = listener; @@ -142,6 +152,9 @@ void PolicyManagerImpl::CheckTriggers() { bool PolicyManagerImpl::LoadPT(const std::string& file, const BinaryMessage& pt_content) { LOG4CXX_INFO(logger_, "LoadPT of size " << pt_content.size()); + LOG4CXX_DEBUG( + logger_, + "PTU content is: " << std::string(pt_content.begin(), pt_content.end())); #ifdef USE_HMI_PTU_DECRYPTION // Assuemes Policy Table was parsed, formatted, and/or decrypted by @@ -381,7 +394,13 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id, "CheckPermissions for " << app_id << " and rpc " << rpc << " for " << hmi_level << " level."); +#ifdef SDL_REMOTE_CONTROL + ApplicationOnDevice who = {device_id, app_id}; + const policy_table::Strings& groups = access_remote_->GetGroups(who); +#else // SDL_REMOTE_CONTROL const policy_table::Strings& groups = cache_->GetGroups(app_id); +#endif // SDL_REMOTE_CONTROL + cache_->CheckPermissions(groups, hmi_level, rpc, result); if (cache_->IsApplicationRevoked(app_id)) { // SDL must be able to notify mobile side with its status after app has @@ -395,9 +414,7 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id, } bool PolicyManagerImpl::ResetUserConsent() { - bool result = true; - - return result; + return cache_->ResetUserConsent(); } void PolicyManagerImpl::SendNotificationOnPermissionsUpdated( @@ -438,6 +455,14 @@ void PolicyManagerImpl::SendNotificationOnPermissionsUpdated( std::string default_hmi; default_hmi = "NONE"; +#ifdef SDL_REMOTE_CONTROL + const ApplicationOnDevice who = {device_id, application_id}; + if (access_remote_->IsAppRemoteControl(who)) { + listener()->OnPermissionsUpdated(application_id, notification_data); + return; + } +#endif // SDL_REMOTE_CONTROL + listener()->OnPermissionsUpdated( application_id, notification_data, default_hmi); } @@ -674,7 +699,16 @@ void PolicyManagerImpl::GetPermissionsForApp( } FunctionalIdType group_types; - if (!cache_->GetPermissionsForApp(device_id, app_id_to_check, group_types)) { +#ifdef SDL_REMOTE_CONTROL + allowed_by_default = false; + bool ret = access_remote_->GetPermissionsForApp( + device_id, policy_app_id, group_types); +#else + bool ret = + cache_->GetPermissionsForApp(device_id, app_id_to_check, group_types); +#endif // REMOTE_CONTROL + + if (!ret) { LOG4CXX_WARN(logger_, "Can't get user permissions for app " << policy_app_id); return; @@ -1020,6 +1054,7 @@ StatusNotifier PolicyManagerImpl::AddApplication( return utils::MakeShared<utils::CallNothing>(); } } + void PolicyManagerImpl::RemoveAppConsentForGroup( const std::string& app_id, const std::string& group_name) { cache_->RemoveAppConsentForGroup(app_id, group_name); @@ -1127,4 +1162,112 @@ void PolicyManagerImpl::RetrySequence() { timer_retry_sequence_.Start(timeout_msec, timer::kPeriodic); } +#ifdef SDL_REMOTE_CONTROL +void PolicyManagerImpl::SetDefaultHmiTypes(const std::string& application_id, + const std::vector<int>& hmi_types) { + LOG4CXX_INFO(logger_, "SetDefaultHmiTypes"); + const std::string device_id = GetCurrentDeviceId(application_id); + ApplicationOnDevice who = {device_id, application_id}; + access_remote_->SetDefaultHmiTypes(who, hmi_types); +} + +struct HMITypeToInt { + int operator()(const policy_table::AppHMITypes::value_type item) { + return policy_table::AppHMIType(item); + } +}; + +bool PolicyManagerImpl::GetHMITypes(const std::string& application_id, + std::vector<int>* app_types) { + LOG4CXX_AUTO_TRACE(logger_); + if (cache_->IsDefaultPolicy(application_id)) { + return false; + } + const policy_table::AppHMITypes* hmi_types = + cache_->GetHMITypes(application_id); + if (hmi_types) { + std::transform(hmi_types->begin(), + hmi_types->end(), + std::back_inserter(*app_types), + HMITypeToInt()); + } + return hmi_types; +} + +bool PolicyManagerImpl::CheckModule(const PTString& app_id, + const PTString& module) { + LOG4CXX_AUTO_TRACE(logger_); + policy_table::ModuleType module_type; + return EnumFromJsonString(module, &module_type) && + access_remote_->CheckModuleType(app_id, module_type); +} + +void PolicyManagerImpl::SendHMILevelChanged(const ApplicationOnDevice& who) { + std::string default_hmi("NONE"); + if (GetDefaultHmi(who.app_id, &default_hmi)) { + listener()->OnUpdateHMIStatus(who.dev_id, who.app_id, default_hmi); + } else { + LOG4CXX_WARN(logger_, + "Couldn't get default HMI level for application " + << who.app_id); + } +} + +void PolicyManagerImpl::GetPermissions(const std::string device_id, + const std::string application_id, + Permissions* data) { + LOG4CXX_AUTO_TRACE(logger_); + DCHECK(data); + std::vector<FunctionalGroupPermission> app_group_permissions; + GetPermissionsForApp(device_id, application_id, app_group_permissions); + + policy_table::FunctionalGroupings functional_groupings; + cache_->GetFunctionalGroupings(functional_groupings); + + policy_table::Strings app_groups; + std::vector<FunctionalGroupPermission>::const_iterator it = + app_group_permissions.begin(); + std::vector<FunctionalGroupPermission>::const_iterator it_end = + app_group_permissions.end(); + for (; it != it_end; ++it) { + app_groups.push_back((*it).group_name); + } + + PrepareNotificationData( + functional_groupings, app_groups, app_group_permissions, *data); +} + +void PolicyManagerImpl::SendAppPermissionsChanged( + const std::string& device_id, const std::string& application_id) { + Permissions notification_data; + GetPermissions(device_id, application_id, ¬ification_data); + listener()->OnPermissionsUpdated(application_id, notification_data); +} + +void PolicyManagerImpl::OnPrimaryGroupsChanged( + const std::string& application_id) { + const std::vector<std::string> devices = + listener()->GetDevicesIds(application_id); + for (std::vector<std::string>::const_iterator i = devices.begin(); + i != devices.end(); + ++i) { + const ApplicationOnDevice who = {*i, application_id}; + if (access_remote_->IsAppRemoteControl(who)) { + SendAppPermissionsChanged(who.dev_id, who.app_id); + } + } +} + +bool PolicyManagerImpl::GetModuleTypes( + const std::string& application_id, + std::vector<std::string>* modules) const { + return access_remote_->GetModuleTypes(application_id, modules); +} + +void PolicyManagerImpl::set_access_remote( + utils::SharedPtr<AccessRemote> access_remote) { + access_remote_ = access_remote; +} +#endif // SDL_REMOTE_CONTROL + } // namespace policy diff --git a/src/components/policy/policy_regular/src/policy_table/enums.cc b/src/components/policy/policy_regular/src/policy_table/enums.cc index 26c7b96b32..e0f77be989 100644 --- a/src/components/policy/policy_regular/src/policy_table/enums.cc +++ b/src/components/policy/policy_regular/src/policy_table/enums.cc @@ -324,6 +324,10 @@ bool IsValidEnum(AppHMIType val) { return true; case AHT_SYSTEM: return true; + case AHT_PROJECTION: + return true; + case AHT_REMOTE_CONTROL: + return true; default: return false; } @@ -350,6 +354,10 @@ const char* EnumToJsonString(AppHMIType val) { return "TESTING"; case AHT_SYSTEM: return "SYSTEM"; + case AHT_PROJECTION: + return "PROJECTION"; + case AHT_REMOTE_CONTROL: + return "REMOTE_CONTROL"; default: return ""; } @@ -385,6 +393,12 @@ bool EnumFromJsonString(const std::string& literal, AppHMIType* result) { } else if ("SYSTEM" == literal) { *result = AHT_SYSTEM; return true; + } else if ("PROJECTION" == literal) { + *result = AHT_PROJECTION; + return true; + } else if ("REMOTE_CONTROL" == literal) { + *result = AHT_REMOTE_CONTROL; + return true; } else { return false; } @@ -569,6 +583,41 @@ bool EnumFromJsonString(const std::string& literal, RequestType* result) { } } +#ifdef SDL_REMOTE_CONTROL +bool IsValidEnum(ModuleType val) { + switch (val) { + case MT_CLIMATE: + return true; + case MT_RADIO: + return true; + default: + return false; + } +} +const char* EnumToJsonString(ModuleType val) { + switch (val) { + case MT_CLIMATE: + return "CLIMATE"; + case MT_RADIO: + return "RADIO"; + default: + return ""; + } +} + +bool EnumFromJsonString(const std::string& literal, ModuleType* result) { + if ("CLIMATE" == literal) { + *result = MT_CLIMATE; + return true; + } else if ("RADIO" == literal) { + *result = MT_RADIO; + return true; + } else { + return false; + } +} +#endif // SDL_REMOTE_CONTROL + const std::string kDefaultApp = "default"; const std::string kPreDataConsentApp = "pre_DataConsent"; const std::string kDeviceApp = "device"; diff --git a/src/components/policy/policy_regular/src/policy_table/types.cc b/src/components/policy/policy_regular/src/policy_table/types.cc index 7928973919..27a43c84ad 100644 --- a/src/components/policy/policy_regular/src/policy_table/types.cc +++ b/src/components/policy/policy_regular/src/policy_table/types.cc @@ -166,7 +166,12 @@ ApplicationParams::ApplicationParams(const Json::Value* value__) , RequestType(impl::ValueMember(value__, "RequestType")) , memory_kb(impl::ValueMember(value__, "memory_kb"), 0) , heart_beat_timeout_ms(impl::ValueMember(value__, "heart_beat_timeout_ms")) - , certificate(impl::ValueMember(value__, "certificate"), "not_specified") {} + , certificate(impl::ValueMember(value__, "certificate"), "not_specified") +#ifdef SDL_REMOTE_CONTROL + , moduleType(impl::ValueMember(value__, "moduleType")) +#endif // SDL_REMOTE_CONTROL +{ +} Json::Value ApplicationParams::ToJsonValue() const { Json::Value result__(PolicyBase::ToJsonValue()); @@ -177,6 +182,9 @@ Json::Value ApplicationParams::ToJsonValue() const { impl::WriteJsonField("memory_kb", memory_kb, &result__); impl::WriteJsonField( "heart_beat_timeout_ms", heart_beat_timeout_ms, &result__); +#ifdef SDL_REMOTE_CONTROL + impl::WriteJsonField("moduleType", moduleType, &result__); +#endif // SDL_REMOTE_CONTROL return result__; } @@ -204,6 +212,11 @@ bool ApplicationParams::is_valid() const { if (!certificate.is_valid()) { return false; } +#ifdef SDL_REMOTE_CONTROL + if (!moduleType.is_valid()) { + return false; + } +#endif // SDL_REMOTE_CONTROL return Validate(); } @@ -236,6 +249,11 @@ bool ApplicationParams::struct_empty() const { if (certificate.is_initialized()) { return false; } +#ifdef SDL_REMOTE_CONTROL + if (moduleType.is_initialized()) { + return false; + } +#endif // SDL_REMOTE_CONTROL return true; } @@ -268,6 +286,11 @@ void ApplicationParams::ReportErrors(rpc::ValidationReport* report__) const { if (!certificate.is_valid()) { certificate.ReportErrors(&report__->ReportSubobject("certificate")); } +#ifdef SDL_REMOTE_CONTROL + if (!moduleType.is_valid()) { + moduleType.ReportErrors(&report__->ReportSubobject("moduleType")); + } +#endif // SDL_REMOTE_CONTROL } void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) { @@ -278,6 +301,9 @@ void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) { memory_kb.SetPolicyTableType(pt_type); heart_beat_timeout_ms.SetPolicyTableType(pt_type); certificate.SetPolicyTableType(pt_type); +#ifdef SDL_REMOTE_CONTROL + moduleType.SetPolicyTableType(pt_type); +#endif // SDL_REMOTE_CONTROL } // RpcParameters methods @@ -559,7 +585,6 @@ bool ModuleConfig::struct_empty() const { if (vehicle_year.is_initialized()) { return false; } - return true; } void ModuleConfig::ReportErrors(rpc::ValidationReport* report__) const { @@ -737,6 +762,8 @@ void MessageString::SetPolicyTableType(PolicyTableType pt_type) { } // MessageLanguages methods +const std::string MessageLanguages::default_language_("en-us"); + MessageLanguages::MessageLanguages() : CompositeType(kUninitialized) {} MessageLanguages::MessageLanguages(const Languages& languages) : CompositeType(kUninitialized), languages(languages) {} @@ -753,6 +780,10 @@ bool MessageLanguages::is_valid() const { if (!languages.is_valid()) { return false; } + // Each RPC must have message in english + if (languages.end() == languages.find(default_language_)) { + return false; + } return Validate(); } bool MessageLanguages::is_initialized() const { @@ -781,6 +812,11 @@ void MessageLanguages::ReportErrors(rpc::ValidationReport* report__) const { if (!languages.is_valid()) { languages.ReportErrors(&report__->ReportSubobject("languages")); } + if (languages.end() == languages.find(default_language_)) { + report__->set_validation_info( + "this message does not support the default language '" + + default_language_ + "'"); + } } void MessageLanguages::SetPolicyTableType(PolicyTableType pt_type) { diff --git a/src/components/policy/policy_regular/src/policy_table/validation.cc b/src/components/policy/policy_regular/src/policy_table/validation.cc index e7a981e559..10b8e4bf7c 100644 --- a/src/components/policy/policy_regular/src/policy_table/validation.cc +++ b/src/components/policy/policy_regular/src/policy_table/validation.cc @@ -114,9 +114,46 @@ bool ApplicationPoliciesSection::Validate() const { return true; } +#ifdef SDL_REMOTE_CONTROL +bool ApplicationParams::ValidateModuleTypes() const { + // moduleType is optional so see Optional<T>::is_valid() + bool is_initialized = moduleType->is_initialized(); + if (!is_initialized) { + // valid if not initialized + return true; + } + bool is_valid = moduleType->is_valid(); + if (is_valid) { + return true; + } + + struct IsInvalid { + bool operator()(Enum<ModuleType> item) const { + return !item.is_valid(); + } + }; + // cut invalid items + moduleType->erase( + std::remove_if(moduleType->begin(), moduleType->end(), IsInvalid()), + moduleType->end()); + bool empty = moduleType->empty(); + if (empty) { + // set non initialized value + ModuleTypes non_initialized; + moduleType = Optional<ModuleTypes>(non_initialized); + } + return true; +} + +bool ApplicationParams::Validate() const { + return ValidateModuleTypes(); +} +#else // SDL_REMOTE_CONTROL bool ApplicationParams::Validate() const { return true; } +#endif // SDL_REMOTE_CONTROL + bool RpcParameters::Validate() const { return true; } @@ -136,6 +173,19 @@ bool ModuleConfig::Validate() const { return false; } } + + for (ServiceEndpoints::const_iterator it_endpoints = endpoints.begin(); + it_endpoints != endpoints.end(); + ++it_endpoints) { + const URLList& endpoint_list = it_endpoints->second; + if (endpoint_list.end() == endpoint_list.find(kDefaultApp)) { + LOG4CXX_ERROR(logger_, + "Endpoint " << it_endpoints->first + << "does not contain default group"); + return false; + } + } + return true; } @@ -178,20 +228,40 @@ bool UsageAndErrorCounts::Validate() const { } return true; } + bool DeviceParams::Validate() const { return true; } + bool PolicyTable::Validate() const { - if (PT_PRELOADED == GetPolicyTableType() || - PT_UPDATE == GetPolicyTableType()) { + const PolicyTableType policy_table_type = GetPolicyTableType(); + + if (PT_PRELOADED == policy_table_type || PT_UPDATE == policy_table_type) { if (device_data.is_initialized()) { return false; } } + + if (PT_PRELOADED == policy_table_type || PT_SNAPSHOT == policy_table_type) { + // Check upper bound of each "groups" sub section in the app policies + const FunctionalGroupings::size_type functional_groupings_count = + functional_groupings.size(); + for (ApplicationPolicies::const_iterator app_policiies_it = + app_policies_section.apps.begin(); + app_policies_section.apps.end() != app_policiies_it; + ++app_policiies_it) { + if (app_policiies_it->second.groups.size() > functional_groupings_count) { + return false; + } + } + } + return true; } + bool Table::Validate() const { return true; } + } // namespace policy_table_interface_base } // namespace rpc diff --git a/src/components/policy/policy_regular/src/sql_pt_queries.cc b/src/components/policy/policy_regular/src/sql_pt_queries.cc index df4bc74cc2..7938eb4085 100644 --- a/src/components/policy/policy_regular/src/sql_pt_queries.cc +++ b/src/components/policy/policy_regular/src/sql_pt_queries.cc @@ -134,6 +134,7 @@ const std::string kCreateSchema = " `memory_kb` INTEGER NOT NULL, " " `heart_beat_timeout_ms` INTEGER NOT NULL, " " `certificate` VARCHAR(45), " + " `remote_control_denied` BOOLEAN NOT NULL DEFAULT 0, " " CONSTRAINT `fk_application_hmi_level1` " " FOREIGN KEY(`default_hmi`) " " REFERENCES `hmi_level`(`value`), " @@ -316,6 +317,39 @@ const std::string kCreateSchema = " FOREIGN KEY(`message_type_name`) " " REFERENCES `message_type`(`name`) " "); " + + /* access_module */ + "CREATE TABLE `access_module`( " + " `id` INTEGER PRIMARY KEY NOT NULL, " + " `name` VARCHAR(45) NOT NULL, " + " `user_consent_needed` INTEGER NOT NULL " + "); " + + /* remote_rpc */ + "CREATE TABLE `remote_rpc`( " + " `id` INTEGER PRIMARY KEY NOT NULL, " + " `name` VARCHAR(255) NOT NULL, " + " `parameter` VARCHAR(45), " + " `module_id` INTEGER NOT NULL, " + "CONSTRAINT `fk_remote_rpc_1` " + " FOREIGN KEY(`module_id`) " + " REFERENCES `access_module`(`id`) " + "); " + "CREATE INDEX `remote_rpc.fk_remote_rpc_1_idx` ON " + "`remote_rpc`(`module_id`); " + + /* module type */ + "CREATE TABLE IF NOT EXISTS `module_type`( " + " `name` VARCHAR(50) NOT NULL, " + " `application_id` VARCHAR(45) NOT NULL, " + " PRIMARY KEY(`name`,`application_id`), " + " CONSTRAINT `fk_module_type_application1` " + " FOREIGN KEY(`application_id`) " + " REFERENCES `application`(`id`) " + "); " + "CREATE INDEX IF NOT EXISTS `module_type.fk_module_type_application1_idx` " + " ON `module_type`(`application_id`); " + "CREATE INDEX IF NOT EXISTS `message.fk_messages_languages1_idx` " " ON `message`(`language_code`);" "CREATE INDEX IF NOT EXISTS " @@ -353,8 +387,47 @@ const std::string kInsertInitData = "INSERT OR IGNORE INTO `_internal_data` (`db_version_hash`) VALUES(0); " ""; +const std::string kDeleteModuleTypes = "DELETE FROM `module_type`"; + +const std::string kDeleteAllDevices = "DELETE FROM `device`;"; + +const std::string kSelectRemoteControlDenied = + "SELECT `remote_control_denied` FROM `application` WHERE `id` = ? LIMIT 1"; + +const std::string kUpdateRemoteControlDenied = + "UPDATE `application` SET `remote_control_denied` = ? WHERE `id` = ?"; + +const std::string kDeleteAccessModules = "DELETE FROM `access_module`"; + +const std::string kDeleteRemoteRpc = "DELETE FROM `remote_rpc`"; + +const std::string kInsertAccessModule = + "INSERT INTO `access_module` (`name`, `user_consent_needed`) " + " VALUES(?, ?, ?)"; + +const std::string kSelectAccessModules = + "SELECT `id`, `name` FROM `access_module` " + " WHERE `user_consent_needed` = ?"; + +const std::string kInsertRemoteRpc = + "INSERT INTO `remote_rpc` (`module_id`, `name`, `parameter`) " + " VALUES(?, ?, ?)"; + +const std::string kSelectRemoteRpcs = + "SELECT `name`, `parameter` FROM `remote_rpc` " + " WHERE `module_id` = ?"; + +const std::string kInsertModuleType = + "INSERT OR IGNORE INTO `module_type` (`application_id`, `name`) VALUES (?, " + "?)"; + +const std::string kSelectModuleTypes = + "SELECT DISTINCT `name` FROM `module_type` WHERE `application_id` = ?"; + const std::string kDropSchema = "BEGIN; " + "DROP INDEX IF EXISTS `module_type.fk_module_type_application1_idx`; " + "DROP TABLE IF EXISTS `module_type`; " "DROP INDEX IF EXISTS `message.fk_messages_languages1_idx`; " "DROP INDEX IF EXISTS " "`message.fk_message_consumer_friendly_messages1_idx`; " @@ -387,6 +460,8 @@ const std::string kDropSchema = "`preconsented_group.fk_application_has_functional_group_functional_group2_" "idx`; " "DROP TABLE IF EXISTS `preconsented_group`; " + "DROP TABLE IF EXISTS `access_module`; " + "DROP INDEX IF EXISTS `access_module.fk_module_1_idx`; " "DROP INDEX IF EXISTS " "`app_group.fk_application_has_functional_group_application1_idx`; " "DROP INDEX IF EXISTS " @@ -409,6 +484,8 @@ const std::string kDropSchema = "DROP TABLE IF EXISTS `priority`; " "DROP TABLE IF EXISTS `functional_group`; " "DROP TABLE IF EXISTS `module_config`; " + "DROP TABLE IF EXISTS `remote_rpc`; " + "DROP INDEX IF EXISTS `remote_rpc.fk_remote_rpc_1_idx`; " "DROP TABLE IF EXISTS `module_meta`; " "DROP TABLE IF EXISTS `usage_and_error_count`; " "DROP TABLE IF EXISTS `device`; " @@ -419,6 +496,7 @@ const std::string kDropSchema = const std::string kDeleteData = "BEGIN; " "DELETE FROM `message`; " + "DELETE FROM `module_type`; " "DELETE FROM `endpoint`; " "DELETE FROM `consent_group`; " "DELETE FROM `app_type`; " @@ -430,6 +508,7 @@ const std::string kDeleteData = "DELETE FROM `app_group`; " "DELETE FROM `application`; " "DELETE FROM `rpc`; " + "DELETE FROM `access_module`; " "DELETE FROM `version`; " "DELETE FROM `message_type`; " "DELETE FROM `language`; " @@ -439,6 +518,7 @@ const std::string kDeleteData = "DELETE FROM `functional_group`; " "DELETE FROM `module_config`; " "DELETE FROM `module_meta`; " + "DELETE FROM `remote_rpc`; " "DELETE FROM `usage_and_error_count`; " "DELETE FROM `device`; " "COMMIT; " @@ -522,7 +602,7 @@ const std::string kUpdateModuleConfig = " `exchange_after_x_ignition_cycles` = ?," " `exchange_after_x_kilometers` = ?, `exchange_after_x_days` = ?, " " `timeout_after_x_seconds` = ?, `certificate` = ?, `vehicle_make` = ?, " - " `vehicle_model` = ?, `vehicle_year` = ?"; + " `vehicle_model` = ?, `vehicle_year` = ? "; const std::string kInsertEndpoint = "INSERT INTO `endpoint` (`service`, `url`, `application_id`) " diff --git a/src/components/policy/policy_regular/src/sql_pt_representation.cc b/src/components/policy/policy_regular/src/sql_pt_representation.cc index e94c853414..04fc0d7658 100644 --- a/src/components/policy/policy_regular/src/sql_pt_representation.cc +++ b/src/components/policy/policy_regular/src/sql_pt_representation.cc @@ -705,6 +705,17 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection( if (!GatherAppGroup(app_id, ¶ms.groups)) { return false; } +#ifdef SDL_REMOTE_CONTROL + bool denied = false; + if (!GatherRemoteControlDenied(app_id, &denied)) { + return false; + } + if (!denied) { + if (!GatherModuleType(app_id, &*params.moduleType)) { + return false; + } + } +#endif // SDL_REMOTE_CONTROL if (!GatherNickName(app_id, &*params.nicknames)) { return false; } @@ -859,6 +870,12 @@ bool SQLPTRepresentation::SaveApplicationPoliciesSection( LOG4CXX_WARN(logger_, "Incorrect delete from app_group."); return false; } +#ifdef SDL_REMOTE_CONTROL + if (!query_delete.Exec(sql_pt::kDeleteModuleTypes)) { + LOG4CXX_WARN(logger_, "Incorrect delete from module_type."); + return false; + } +#endif // SDL_REMOTE_CONTROL if (!query_delete.Exec(sql_pt::kDeleteApplication)) { LOG4CXX_WARN(logger_, "Incorrect delete from application."); return false; @@ -941,6 +958,13 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy( if (!SaveAppGroup(app.first, app.second.groups)) { return false; } +#ifdef SDL_REMOTE_CONTROL + bool denied = !app.second.moduleType->is_initialized(); + if (!SaveRemoteControlDenied(app.first, denied) || + !SaveModuleType(app.first, *app.second.moduleType)) { + return false; + } +#endif // SDL_REMOTE_CONTROL if (!SaveNickname(app.first, *app.second.nicknames)) { return false; } @@ -1111,7 +1135,6 @@ bool SQLPTRepresentation::SaveModuleConfig( : query.Bind(7); config.vehicle_year.is_initialized() ? query.Bind(8, *(config.vehicle_year)) : query.Bind(8); - if (!query.Exec()) { LOG4CXX_WARN(logger_, "Incorrect update module config"); return false; @@ -1175,43 +1198,48 @@ bool SQLPTRepresentation::SaveConsumerFriendlyMessages( // According CRS-2419 If there is no “consumer_friendly_messages” key, // the current local consumer_friendly_messages section shall be maintained in // the policy table. So it won't be changed/updated - if (messages.messages.is_initialized()) { - utils::dbms::SQLQuery query(db()); - if (!query.Exec(sql_pt::kDeleteMessageString)) { - LOG4CXX_WARN(logger_, "Incorrect delete from message."); - return false; - } + if (!messages.messages.is_initialized()) { + LOG4CXX_INFO(logger_, "ConsumerFriendlyMessages messages list is empty"); + return true; + } - if (query.Prepare(sql_pt::kUpdateVersion)) { - query.Bind(0, messages.version); - if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect update into version."); - return false; - } - } else { - LOG4CXX_WARN(logger_, "Incorrect update statement for version."); + utils::dbms::SQLQuery query(db()); + bool delete_query_exec_result = true; + if (!messages.messages->empty()) { + delete_query_exec_result = query.Exec(sql_pt::kDeleteMessageString); + } + + if (!delete_query_exec_result) { + LOG4CXX_WARN(logger_, "Failed to delete messages from DB."); + return false; + } + + if (!query.Prepare(sql_pt::kUpdateVersion)) { + LOG4CXX_WARN(logger_, "Invalid update messages version statement."); + return false; + } + + query.Bind(0, messages.version); + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Failed to update messages version number in DB."); + return false; + } + + policy_table::Messages::const_iterator it; + for (it = messages.messages->begin(); it != messages.messages->end(); ++it) { + if (!SaveMessageType(it->first)) { return false; } - - policy_table::Messages::const_iterator it; - for (it = messages.messages->begin(); it != messages.messages->end(); - ++it) { - if (!SaveMessageType(it->first)) { + const policy_table::Languages& langs = it->second.languages; + policy_table::Languages::const_iterator lang_it; + for (lang_it = langs.begin(); lang_it != langs.end(); ++lang_it) { + if (!SaveLanguage(lang_it->first)) { return false; } - const policy_table::Languages& langs = it->second.languages; - policy_table::Languages::const_iterator lang_it; - for (lang_it = langs.begin(); lang_it != langs.end(); ++lang_it) { - if (!SaveLanguage(lang_it->first)) { - return false; - } - if (!SaveMessageString(it->first, lang_it->first, lang_it->second)) { - return false; - } + if (!SaveMessageString(it->first, lang_it->first, lang_it->second)) { + return false; } } - } else { - LOG4CXX_INFO(logger_, "Messages list is empty"); } return true; @@ -1506,6 +1534,199 @@ bool SQLPTRepresentation::GatherAppGroup( return true; } +#ifdef SDL_REMOTE_CONTROL + +bool SQLPTRepresentation::GatherRemoteControlDenied(const std::string& app_id, + bool* denied) const { + LOG4CXX_AUTO_TRACE(logger_); + utils::dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kSelectRemoteControlDenied)) { + LOG4CXX_WARN(logger_, "Incorrect select remote control flag"); + return false; + } + query.Bind(0, app_id); + if (query.Next()) { + *denied = query.GetBoolean(0); + } else { + return false; + } + return true; +} + +bool SQLPTRepresentation::GatherModuleType( + const std::string& app_id, policy_table::ModuleTypes* app_types) const { + utils::dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kSelectModuleTypes)) { + LOG4CXX_WARN(logger_, "Incorrect select from app types"); + return false; + } + + query.Bind(0, app_id); + while (query.Next()) { + policy_table::ModuleType type; + if (!policy_table::EnumFromJsonString(query.GetString(0), &type)) { + return false; + } + app_types->push_back(type); + } + return true; +} + +bool SQLPTRepresentation::SaveRemoteControlDenied(const std::string& app_id, + bool deny) { + LOG4CXX_AUTO_TRACE(logger_); + utils::dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kUpdateRemoteControlDenied)) { + LOG4CXX_WARN(logger_, "Incorrect update statement for remote control flag"); + return false; + } + LOG4CXX_DEBUG(logger_, "App: " << app_id << std::boolalpha << " - " << deny); + query.Bind(0, deny); + query.Bind(1, app_id); + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Incorrect update remote control flag."); + return false; + } + return true; +} + +bool SQLPTRepresentation::SaveModuleType( + const std::string& app_id, const policy_table::ModuleTypes& types) { + utils::dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kInsertModuleType)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement for module type"); + return false; + } + + policy_table::ModuleTypes::const_iterator it; + for (it = types.begin(); it != types.end(); ++it) { + query.Bind(0, app_id); + std::string module(policy_table::EnumToJsonString(*it)); + query.Bind(1, module); + LOG4CXX_DEBUG(logger_, + "Module(app: " << app_id << ", type: " << module << ")"); + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into module type."); + return false; + } + } + + return true; +} + +bool SQLPTRepresentation::SaveAccessModule( + TypeAccess access, const policy_table::AccessModules& modules) { + LOG4CXX_AUTO_TRACE(logger_); + utils::dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kInsertAccessModule)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement for access module"); + return false; + } + + policy_table::AccessModules::const_iterator i; + for (i = modules.begin(); i != modules.end(); ++i) { + const std::string& name = i->first; + const policy_table::RemoteRpcs& rpcs = i->second; + query.Bind(0, name); + query.Bind(1, access); + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Incorrect insert into access module."); + return false; + } + int id = query.LastInsertId(); + if (!query.Reset()) { + LOG4CXX_WARN(logger_, "Couldn't reset query access module."); + return false; + } + if (!SaveRemoteRpc(id, rpcs)) { + return false; + } + } + return true; +} + +bool SQLPTRepresentation::GatherAccessModule( + TypeAccess access, policy_table::AccessModules* modules) const { + LOG4CXX_AUTO_TRACE(logger_); + utils::dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kSelectAccessModules)) { + LOG4CXX_WARN(logger_, "Incorrect select from access module"); + return false; + } + + query.Bind(0, access); + while (query.Next()) { + int id = query.GetInteger(0); + std::string name = query.GetString(1); + policy_table::RemoteRpcs rpcs; + if (!GatherRemoteRpc(id, &rpcs)) { + return false; + } + modules->insert(std::make_pair(name, rpcs)); + } + return true; +} + +bool SQLPTRepresentation::SaveRemoteRpc(int module_id, + const policy_table::RemoteRpcs& rpcs) { + LOG4CXX_AUTO_TRACE(logger_); + utils::dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kInsertRemoteRpc)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement for remote rpc"); + return false; + } + policy_table::RemoteRpcs::const_iterator i; + for (i = rpcs.begin(); i != rpcs.end(); ++i) { + const std::string& name = i->first; + const policy_table::Strings& params = i->second; + policy_table::Strings::const_iterator j; + if (params.empty()) { + query.Bind(0, module_id); + query.Bind(1, name); + query.Bind(2); + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into remote rpc."); + return false; + } + } else { + for (j = params.begin(); j != params.end(); ++j) { + const std::string& param = *j; + query.Bind(0, module_id); + query.Bind(1, name); + query.Bind(2, param); + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into remote rpc."); + return false; + } + } + } + } + return true; +} + +bool SQLPTRepresentation::GatherRemoteRpc( + int module_id, policy_table::RemoteRpcs* rpcs) const { + LOG4CXX_AUTO_TRACE(logger_); + utils::dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kSelectRemoteRpcs)) { + LOG4CXX_WARN(logger_, "Incorrect select from remote rpc"); + return false; + } + + query.Bind(0, module_id); + while (query.Next()) { + std::string name = query.GetString(0); + if (!query.IsNull(1)) { + std::string parameter = query.GetString(1); + (*rpcs)[name].push_back(parameter); + } else { + rpcs->insert(std::make_pair(name, policy_table::Strings())); + } + } + return true; +} +#endif // SDL_REMOTE_CONTROL + bool SQLPTRepresentation::SaveApplicationCustomData(const std::string& app_id, bool is_revoked, bool is_default, @@ -1612,7 +1833,13 @@ bool SQLPTRepresentation::SetDefaultPolicy(const std::string& app_id) { !SaveAppType(app_id, app_types)) { return false; } - return SetIsDefault(app_id, true); + + bool ret = (GatherAppGroup(kDefaultId, &default_groups) && + SaveAppGroup(app_id, default_groups)); + if (ret) { + return SetIsDefault(app_id, true); + } + return false; } bool SQLPTRepresentation::SetIsDefault(const std::string& app_id, diff --git a/src/components/policy/policy_regular/test/CMakeLists.txt b/src/components/policy/policy_regular/test/CMakeLists.txt index 997c3637e8..62ff691f83 100644 --- a/src/components/policy/policy_regular/test/CMakeLists.txt +++ b/src/components/policy/policy_regular/test/CMakeLists.txt @@ -39,11 +39,17 @@ include_directories( ${COMPONENTS_DIR}/rpc_base/include ${COMPONENTS_DIR}/config_profile/include ${COMPONENTS_DIR}/utils/include/ + ${COMPONENTS_DIR}/include/test/policy/policy_regular/ ${POLICY_PATH}/test/include/ ${POLICY_MOCK_INCLUDE_PATH}/ ) collect_sources(SOURCES "${CMAKE_CURRENT_SOURCE_DIR}") +if (NOT REMOTE_CONTROL) + list (REMOVE_ITEM SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/access_remote_impl_test.cc + ) +endif () set(LIBRARIES gmock diff --git a/src/components/policy/policy_regular/test/access_remote_impl_test.cc b/src/components/policy/policy_regular/test/access_remote_impl_test.cc new file mode 100644 index 0000000000..d086144d86 --- /dev/null +++ b/src/components/policy/policy_regular/test/access_remote_impl_test.cc @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2015, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "gtest/gtest.h" +#include "policy/access_remote_impl.h" + +namespace policy { + +TEST(AccessRemoteImplTest, CheckModuleType) { + AccessRemoteImpl access_remote; + access_remote.cache_->pt_ = new policy_table::Table(); + + // No application + EXPECT_FALSE(access_remote.CheckModuleType("1234", policy_table::MT_RADIO)); + + // No modules + policy_table::ApplicationPolicies& apps = + access_remote.cache_->pt_->policy_table.app_policies_section.apps; + apps["1234"]; + EXPECT_FALSE(access_remote.CheckModuleType("1234", policy_table::MT_RADIO)); + + // Empty modules + policy_table::ModuleTypes& modules = *apps["1234"].moduleType; + modules.mark_initialized(); + EXPECT_TRUE(access_remote.CheckModuleType("1234", policy_table::MT_RADIO)); + EXPECT_TRUE(access_remote.CheckModuleType("1234", policy_table::MT_CLIMATE)); + + // Specific modules + modules.push_back(policy_table::MT_RADIO); + EXPECT_TRUE(access_remote.CheckModuleType("1234", policy_table::MT_RADIO)); + EXPECT_FALSE(access_remote.CheckModuleType("1234", policy_table::MT_CLIMATE)); +} + +TEST(AccessRemoteImplTest, SetDefaultHmiTypes) { + AccessRemoteImpl access_remote; + + std::vector<int> hmi_expected; + hmi_expected.push_back(2); + hmi_expected.push_back(6); + ApplicationOnDevice who = {"dev1", "1234"}; + access_remote.SetDefaultHmiTypes(who, hmi_expected); + + EXPECT_NE(access_remote.hmi_types_.end(), access_remote.hmi_types_.find(who)); + policy_table::AppHMITypes& hmi_output = access_remote.hmi_types_[who]; + EXPECT_EQ(2u, hmi_output.size()); + EXPECT_EQ(policy_table::AHT_MEDIA, hmi_output[0]); + EXPECT_EQ(policy_table::AHT_SOCIAL, hmi_output[1]); +} + +TEST(AccessRemoteImplTest, GetGroups) { + AccessRemoteImpl access_remote; + ApplicationOnDevice who = {"dev1", "1234"}; + access_remote.hmi_types_[who].push_back(policy_table::AHT_REMOTE_CONTROL); + + access_remote.cache_->pt_ = new policy_table::Table(); + policy_table::ApplicationPolicies& apps = + access_remote.cache_->pt_->policy_table.app_policies_section.apps; + apps["1234"].groups.push_back("group_default"); + apps["1234"].AppHMIType->push_back(policy_table::AHT_MEDIA); + + // Default groups + const policy_table::Strings& groups1 = access_remote.GetGroups(who); + EXPECT_EQ(std::string("group_default"), std::string(groups1[0])); +} + +} // namespace policy diff --git a/src/components/policy/policy_regular/test/include/policy/mock_access_remote.h b/src/components/policy/policy_regular/test/include/policy/mock_access_remote.h new file mode 100644 index 0000000000..0b64ff645e --- /dev/null +++ b/src/components/policy/policy_regular/test/include/policy/mock_access_remote.h @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2015, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_TEST_INCLUDE_POLICY_MOCK_ACCESS_REMOTE_H_ +#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_TEST_INCLUDE_POLICY_MOCK_ACCESS_REMOTE_H_ + +#include "gmock/gmock.h" +#include "policy/access_remote.h" + +namespace test { +namespace components { +namespace access_remote_test { + +class MockAccessRemote : public policy::AccessRemote { + public: + MOCK_CONST_METHOD3( + FindGroup, + policy::PTString(const policy::ApplicationOnDevice& who, + const policy::PTString& rpc, + const policy::RemoteControlParams& params)); + MOCK_METHOD2(SetDefaultHmiTypes, + void(const policy::ApplicationOnDevice& who, + const std::vector<int>& hmi_types)); + MOCK_METHOD1( + GetGroups, + const policy_table::Strings&(const policy::ApplicationOnDevice& who)); + MOCK_METHOD3(GetPermissionsForApp, + bool(const std::string& device_id, + const std::string& app_id, + policy::FunctionalIdType& group_types)); + MOCK_CONST_METHOD2(CheckModuleType, + bool(const policy::PTString& app_id, + policy_table::ModuleType module)); + MOCK_METHOD1(IsAppRemoteControl, + bool(const policy::ApplicationOnDevice& who)); + MOCK_METHOD2(GetModuleTypes, + bool(const std::string& application_id, + std::vector<std::string>* modules)); +}; + +} // namespace access_remote_test +} // namespace components +} // namespace test + +#endif // SRC_COMPONENTS_POLICY_POLICY_REGULAR_TEST_INCLUDE_POLICY_MOCK_ACCESS_REMOTE_H_ diff --git a/src/components/policy/policy_regular/test/include/policy/mock_policy_manager.h b/src/components/policy/policy_regular/test/include/policy/mock_policy_manager.h deleted file mode 100644 index 7ab4b518cd..0000000000 --- a/src/components/policy/policy_regular/test/include/policy/mock_policy_manager.h +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (c) 2016, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_TEST_INCLUDE_MOCK_POLICY_MANAGER_H_ -#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_TEST_INCLUDE_MOCK_POLICY_MANAGER_H_ - -#include <string> -#include <vector> -#include "gmock/gmock.h" -#include "policy/policy_listener.h" -#include "policy/policy_types.h" -#include "policy/usage_statistics/statistics_manager.h" - -#include "rpc_base/rpc_base.h" -#include "policy/policy_table/types.h" -#include "policy/policy_manager.h" - -namespace policy_table = ::rpc::policy_table_interface_base; - -namespace policy_manager { - -using namespace policy; - -class MockPolicyManager : public PolicyManager { - public: - MOCK_METHOD1(set_listener, void(PolicyListener* listener)); - MOCK_METHOD2(InitPT, - bool(const std::string& file_name, - const PolicySettings* settings)); - MOCK_METHOD2(LoadPT, - bool(const std::string& file, const BinaryMessage& pt_content)); - MOCK_METHOD1(ResetPT, bool(const std::string& file_name)); - MOCK_METHOD2(GetUpdateUrls, - void(const uint32_t service_type, EndpointUrls& out_end_points)); - MOCK_METHOD2(GetUpdateUrls, - void(const std::string& service_type, - EndpointUrls& out_end_points)); - MOCK_METHOD0(RequestPTUpdate, bool()); - - MOCK_METHOD6(CheckPermissions, - void(const PTString& device_id, - const PTString& app_id, - const PTString& hmi_level, - const PTString& rpc, - const RPCParams& rpc_params, - CheckPermissionResult& result)); - MOCK_METHOD0(ResetUserConsent, bool()); - MOCK_CONST_METHOD0(GetPolicyTableStatus, std::string()); - MOCK_METHOD1(KmsChanged, void(int kilometers)); - MOCK_METHOD0(IncrementIgnitionCycles, void()); - MOCK_METHOD0(ForcePTExchange, std::string()); - MOCK_METHOD0(ResetRetrySequence, void()); - MOCK_METHOD0(NextRetryTimeout, int()); - MOCK_METHOD0(TimeoutExchangeMSec, uint32_t()); - MOCK_METHOD0(RetrySequenceDelaysSeconds, const std::vector<int>()); - MOCK_METHOD0(OnExceededTimeout, void()); - MOCK_METHOD0(OnUpdateStarted, void()); - MOCK_CONST_METHOD1(GetUserConsentForDevice, - DeviceConsent(const std::string& device_id)); - MOCK_METHOD3( - GetUserConsentForApp, - void(const std::string& device_id, - const std::string& policy_app_id, - std::vector<policy::FunctionalGroupPermission>& permissions)); - MOCK_METHOD2(SetUserConsentForDevice, - void(const std::string& device_id, bool is_allowed)); - MOCK_METHOD2(ReactOnUserDevConsentForApp, - bool(const std::string app_id, bool is_device_allowed)); - MOCK_METHOD2(PTUpdatedAt, void(policy::Counters counter, int value)); - - MOCK_METHOD3(GetInitialAppData, - bool(const std::string&, - policy::StringArray*, - policy::StringArray*)); - - MOCK_METHOD2(AddDevice, - void(const std::string& device_id, - const std::string& connection_type)); - MOCK_METHOD2(SetDeviceInfo, - void(const std::string& device_id, - const policy::DeviceInfo& device_info)); - MOCK_METHOD1(SetUserConsentForApp, - void(const policy::PermissionConsent& permissions)); - MOCK_CONST_METHOD2(GetDefaultHmi, - bool(const std::string& policy_app_id, - std::string* default_hmi)); - MOCK_CONST_METHOD2(GetPriority, - bool(const std::string& policy_app_id, - std::string* priority)); - MOCK_METHOD2(GetUserFriendlyMessages, - std::vector<policy::UserFriendlyMessage>( - const std::vector<std::string>& message_code, - const std::string& language)); - MOCK_CONST_METHOD1(IsApplicationRevoked, bool(const std::string& app_id)); - MOCK_METHOD3( - GetPermissionsForApp, - void(const std::string& device_id, - const std::string& policy_app_id, - std::vector<policy::FunctionalGroupPermission>& permissions)); - MOCK_METHOD1(GetAppPermissionsChanges, - policy::AppPermissions(const std::string& policy_app_id)); - MOCK_METHOD1(RemovePendingPermissionChanges, void(const std::string& app_id)); - MOCK_CONST_METHOD1(GetCurrentDeviceId, - std::string&(const std::string& policy_app_id)); - MOCK_METHOD1(SetSystemLanguage, void(const std::string& language)); - MOCK_METHOD3(SetSystemInfo, - void(const std::string& ccpu_version, - const std::string& wers_country_code, - const std::string& language)); - MOCK_METHOD1(SendNotificationOnPermissionsUpdated, - void(const std::string& application_id)); - MOCK_METHOD1(MarkUnpairedDevice, void(const std::string& device_id)); - MOCK_METHOD1(AddApplication, - StatusNotifier(const std::string& application_id)); - MOCK_METHOD0(CleanupUnpairedDevices, bool()); - MOCK_CONST_METHOD1(CanAppKeepContext, bool(const std::string& app_id)); - MOCK_CONST_METHOD1(CanAppStealFocus, bool(const std::string& app_id)); - MOCK_METHOD0(OnSystemReady, void()); - MOCK_CONST_METHOD1(GetNotificationsNumber, - uint32_t(const std::string& priority)); - MOCK_METHOD1(SetVINValue, void(const std::string& value)); - MOCK_CONST_METHOD1(IsPredataPolicy, bool(const std::string& policy_app_id)); - MOCK_CONST_METHOD1(HeartBeatTimeout, uint32_t(const std::string& app_id)); - MOCK_METHOD1(SaveUpdateStatusRequired, void(bool is_update_needed)); - MOCK_METHOD0(OnAppsSearchStarted, void()); - MOCK_METHOD0(OnAppsSearchCompleted, void()); - MOCK_METHOD1(OnAppRegisteredOnMobile, - void(const std::string& application_id)); - MOCK_CONST_METHOD1( - GetAppRequestTypes, - const std::vector<std::string>(const std::string policy_app_id)); - MOCK_CONST_METHOD0(GetVehicleInfo, const policy::VehicleInfo()); - MOCK_CONST_METHOD0(RetrieveCertificate, std::string()); - MOCK_METHOD1(SetDecryptedCertificate, void(const std::string&)); - MOCK_METHOD0(ExceededIgnitionCycles, bool()); - MOCK_METHOD0(ExceededDays, bool()); - MOCK_METHOD0(StartPTExchange, void()); - MOCK_METHOD1(Increment, void(usage_statistics::GlobalCounterId type)); - MOCK_METHOD2(Increment, - void(const std::string& app_id, - usage_statistics::AppCounterId type)); - MOCK_METHOD3(Set, - void(const std::string& app_id, - usage_statistics::AppInfoId type, - const std::string& value)); - MOCK_METHOD3(Add, - void(const std::string& app_id, - usage_statistics::AppStopwatchId type, - int32_t timespan_seconds)); - MOCK_CONST_METHOD0(get_settings, const PolicySettings&()); - MOCK_METHOD1(set_settings, void(const PolicySettings* get_settings)); -}; - -} // namespace policy_manager - -#endif // SRC_COMPONENTS_POLICY_POLICY_REGULAR_TEST_INCLUDE_MOCK_POLICY_MANAGER_H_ diff --git a/src/components/policy/policy_regular/test/policy_manager_impl_test.cc b/src/components/policy/policy_regular/test/policy_manager_impl_test.cc index e8bca3061f..f76e856cd0 100644 --- a/src/components/policy/policy_regular/test/policy_manager_impl_test.cc +++ b/src/components/policy/policy_regular/test/policy_manager_impl_test.cc @@ -53,7 +53,9 @@ #include "utils/date_time.h" #include "utils/make_shared.h" #include "utils/gen_hash.h" - +#ifdef SDL_REMOTE_CONTROL +#include "policy/mock_access_remote.h" +#endif // SDL_REMOTE_CONTROL using ::testing::ReturnRef; using ::testing::DoAll; using ::testing::SetArgReferee; @@ -144,12 +146,20 @@ class PolicyManagerImplTest : public ::testing::Test { MockCacheManagerInterface* cache_manager; NiceMock<MockPolicyListener> listener; const std::string device_id; +#ifdef SDL_REMOTE_CONTROL + utils::SharedPtr<access_remote_test::MockAccessRemote> access_remote; +#endif // SDL_REMOTE_CONTROL void SetUp() OVERRIDE { manager = new PolicyManagerImpl(); manager->set_listener(&listener); cache_manager = new MockCacheManagerInterface(); manager->set_cache_manager(cache_manager); + +#ifdef SDL_REMOTE_CONTROL + access_remote = new access_remote_test::MockAccessRemote(); + manager->set_access_remote(access_remote); +#endif // SDL_REMOTE_CONTROL } void TearDown() OVERRIDE { @@ -189,10 +199,10 @@ class PolicyManagerImplTest2 : public ::testing::Test { const std::string dev_id2; Json::Value PTU_request_types; NiceMock<policy_handler_test::MockPolicySettings> policy_settings_; - const std::string kAppStorageFolder = "storage1"; + const std::string kAppStorageFolder = "storage_PolicyManagerImplTest2"; void SetUp() OVERRIDE { - file_system::CreateDirectory("storage1"); + file_system::CreateDirectory(kAppStorageFolder); file_system::DeleteFile("policy.sqlite"); manager = new PolicyManagerImpl(); @@ -231,7 +241,7 @@ class PolicyManagerImplTest2 : public ::testing::Test { } void CreateLocalPT(const std::string& file_name) { - file_system::remove_directory_content("storage1"); + file_system::remove_directory_content(kAppStorageFolder); ON_CALL(policy_settings_, app_storage_folder()) .WillByDefault(ReturnRef(kAppStorageFolder)); ASSERT_TRUE(manager->InitPT(file_name, &policy_settings_)); @@ -355,6 +365,8 @@ class PolicyManagerImplTest2 : public ::testing::Test { void TearDown() OVERRIDE { delete manager; + file_system::remove_directory_content(kAppStorageFolder); + file_system::RemoveDirectory(kAppStorageFolder, true); } }; @@ -1247,7 +1259,7 @@ TEST_F(PolicyManagerImplTest2, // Arrange CreateLocalPT("sdl_preloaded_pt.json"); GetPTU("valid_sdl_pt_update.json"); - utils::SharedPtr<policy_table::Table> pt = (manager->GetCache())->GetPT(); + utils::SharedPtr<policy_table::Table> pt = (manager->GetCache())->pt(); policy_table::ModuleConfig& module_config = pt->policy_table.module_config; ::policy::VehicleInfo vehicle_info = manager->GetVehicleInfo(); @@ -1328,7 +1340,7 @@ TEST_F( HertBeatTimeout_AddApp_UpdateAppPolicies_ExpectReceivedHertBeatTimeoutCorrect) { // Arrange CreateLocalPT("sdl_preloaded_pt.json"); - utils::SharedPtr<policy_table::Table> pt = (manager->GetCache())->GetPT(); + utils::SharedPtr<policy_table::Table> pt = (manager->GetCache())->pt(); ::policy_table::PolicyTableType type1 = ::policy_table::PolicyTableType::PT_PRELOADED; pt->SetPolicyTableType(type1); diff --git a/src/components/policy/policy_regular/test/sql_pt_representation_test.cc b/src/components/policy/policy_regular/test/sql_pt_representation_test.cc index a313ce6d7f..fd83c82b1a 100644 --- a/src/components/policy/policy_regular/test/sql_pt_representation_test.cc +++ b/src/components/policy/policy_regular/test/sql_pt_representation_test.cc @@ -68,22 +68,23 @@ namespace test { namespace components { namespace policy_test { +using policy_handler_test::MockPolicySettings; + class SQLPTRepresentationTest : public SQLPTRepresentation, public ::testing::Test { protected: - static DBMS* dbms; - static SQLPTRepresentation* reps; + DBMS* dbms; + SQLPTRepresentation* reps; static const std::string kDatabaseName; static const std::string kAppStorageFolder; // Gtest can show message that this object doesn't destroyed - static std::auto_ptr<policy_handler_test::MockPolicySettings> - policy_settings_; + std::auto_ptr<NiceMock<MockPolicySettings> > policy_settings_; - static void SetUpTestCase() { - file_system::DeleteFile(kAppStorageFolder + "/policy.sqlite"); + void SetUp() OVERRIDE { + file_system::CreateDirectory(kAppStorageFolder); reps = new SQLPTRepresentation; - policy_settings_ = std::auto_ptr<policy_handler_test::MockPolicySettings>( - new policy_handler_test::MockPolicySettings()); + policy_settings_ = std::auto_ptr<NiceMock<MockPolicySettings> >( + new NiceMock<MockPolicySettings>()); ON_CALL(*policy_settings_, app_storage_folder()) .WillByDefault(ReturnRef(kAppStorageFolder)); EXPECT_EQ(::policy::SUCCESS, reps->Init(policy_settings_.get())); @@ -93,15 +94,13 @@ class SQLPTRepresentationTest : public SQLPTRepresentation, void TearDown() OVERRIDE { EXPECT_TRUE(reps->Clear()); - } - - static void TearDownTestCase() { EXPECT_TRUE(reps->Drop()); EXPECT_TRUE(reps->Close()); reps->RemoveDB(); delete reps; dbms->Close(); - file_system::RemoveDirectory(kAppStorageFolder); + file_system::remove_directory_content(kAppStorageFolder); + file_system::RemoveDirectory(kAppStorageFolder, true); policy_settings_.reset(); } @@ -346,12 +345,9 @@ class SQLPTRepresentationTest : public SQLPTRepresentation, } }; -DBMS* SQLPTRepresentationTest::dbms = 0; -SQLPTRepresentation* SQLPTRepresentationTest::reps = 0; const std::string SQLPTRepresentationTest::kDatabaseName = "policy.sqlite"; -const std::string SQLPTRepresentationTest::kAppStorageFolder = "storage1"; -std::auto_ptr<policy_handler_test::MockPolicySettings> - SQLPTRepresentationTest::policy_settings_; +const std::string SQLPTRepresentationTest::kAppStorageFolder = + "storage_SQLPTRepresentationTest"; class SQLPTRepresentationTest2 : public ::testing::Test { protected: @@ -378,7 +374,7 @@ class SQLPTRepresentationTest2 : public ::testing::Test { } SQLPTRepresentation* reps; - NiceMock<policy_handler_test::MockPolicySettings> policy_settings_; + NiceMock<MockPolicySettings> policy_settings_; const std::string kAppStorageFolder; const uint16_t kOpenAttemptTimeoutMs; const uint16_t kAttemptsToOpenPolicyDB; @@ -399,7 +395,7 @@ class SQLPTRepresentationTest3 : public ::testing::Test { } SQLPTRepresentation* reps; - NiceMock<policy_handler_test::MockPolicySettings> policy_settings_; + NiceMock<MockPolicySettings> policy_settings_; const std::string kAppStorageFolder; }; @@ -424,7 +420,8 @@ TEST_F(SQLPTRepresentationTest, ASSERT_EQ(0, dbms->FetchOneInt(query_select)); ASSERT_TRUE(reps->RefreshDB()); // Check PT structure destroyed and tables number is 0 - ASSERT_EQ(25, dbms->FetchOneInt(query_select)); + const int32_t total_tables_number = 28; + ASSERT_EQ(total_tables_number, dbms->FetchOneInt(query_select)); const char* query_select_count_of_iap_buffer_full = "SELECT `count_of_iap_buffer_full` FROM `usage_and_error_count`"; const char* query_select_count_sync_out_of_memory = @@ -1102,7 +1099,7 @@ TEST_F(SQLPTRepresentationTest, GetInitialAppData_SetData_ExpectCorrectValuesReceived) { // Arrange const char* query_insert = - "INSERT INTO `nickname` (`application_id`, `name`)" + "INSERT INTO `nickname` (`application_id`, `name`) " "VALUES ('1111', 'first_app') , " "('2222', 'second_app'), ('3333', 'third_app')"; ASSERT_TRUE(dbms->Exec(query_insert)); diff --git a/src/components/protocol/src/bson_object_keys.cc b/src/components/protocol/src/bson_object_keys.cc new file mode 100644 index 0000000000..fb225b1461 --- /dev/null +++ b/src/components/protocol/src/bson_object_keys.cc @@ -0,0 +1,18 @@ +#include <protocol/bson_object_keys.h> + +namespace protocol_handler { + +namespace strings { + +const char* hash_id = "hashId"; +const char* protocol_version = "protocolVersion"; +const char* mtu = "mtu"; +const char* rejected_params = "rejectedParams"; +const char* height = "height"; +const char* width = "width"; +const char* video_protocol = "videoProtocol"; +const char* video_codec = "videoCodec"; + +} // namespace strings + +} // namespace protocol_handler diff --git a/src/components/protocol_handler/CMakeLists.txt b/src/components/protocol_handler/CMakeLists.txt index c1dd9b2769..ebecff2402 100644 --- a/src/components/protocol_handler/CMakeLists.txt +++ b/src/components/protocol_handler/CMakeLists.txt @@ -35,6 +35,7 @@ include_directories( ${COMPONENTS_DIR}/protocol_handler/include/ ${COMPONENTS_DIR}/connection_handler/include/ ${LOG4CXX_INCLUDE_DIRECTORY} + ${BSON_INCLUDE_DIRECTORY} ) set(PATHS @@ -46,6 +47,8 @@ collect_sources(SOURCES "${PATHS}") set(LIBRARIES ProtocolLibrary Utils + bson -L${BSON_LIBS_DIRECTORY} + emhashmap -L${EMHASHMAP_LIBS_DIRECTORY} ) get_property(dirs DIRECTORY "" PROPERTY LIBRARIES) @@ -55,6 +58,7 @@ endforeach() add_library(ProtocolHandler ${SOURCES}) +add_dependencies(ProtocolHandler libbson) target_link_libraries(ProtocolHandler ${LIBRARIES}) if(BUILD_TESTS) diff --git a/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h b/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h index b18ee07d4d..c5a45c0dfe 100644 --- a/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h +++ b/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h @@ -84,6 +84,8 @@ class MessagesToMobileAppHandler; using transport_manager::TransportManagerListenerEmpty; typedef std::multimap<int32_t, RawMessagePtr> MessagesOverNaviMap; +typedef std::map<std::pair<ConnectionID, uint8_t>, ProtocolFramePtr> + StartSessionFrameMap; typedef std::set<ProtocolObserver*> ProtocolObservers; typedef transport_manager::ConnectionUID ConnectionID; @@ -245,11 +247,59 @@ class ProtocolHandlerImpl */ void SendStartSessionAck(ConnectionID connection_id, uint8_t session_id, - uint8_t protocol_version, + uint8_t input_protocol_version, uint32_t hash_code, uint8_t service_type, bool protection); + /** + * \brief Sends acknowledgement of starting session to mobile application + * with session number and hash code for second version of protocol + * was started + * \param connection_id Identifier of connection within which session + * \param session_id ID of session to be sent to mobile application + * \param protocol_version Version of protocol used for communication + * \param hash_code For second version of protocol: identifier of session + * to be sent to + * mobile app for using when ending session + * \param service_type Type of session: RPC or BULK Data. RPC by default + * \param protection Protection flag + * \param full_version full protocol version (major.minor.patch) used by the + * mobile proxy + */ + void SendStartSessionAck(ConnectionID connection_id, + uint8_t session_id, + uint8_t protocol_version, + uint32_t hash_code, + uint8_t service_type, + bool protection, + ProtocolPacket::ProtocolVersion& full_version); + + /** + * \brief Sends acknowledgement of starting session to mobile application + * with session number and hash code for second version of protocol + * was started + * \param connection_id Identifier of connection within which session + * \param session_id ID of session to be sent to mobile application + * \param protocol_version Version of protocol used for communication + * \param hash_code For second version of protocol: identifier of session + * to be sent to + * mobile app for using when ending session + * \param service_type Type of session: RPC or BULK Data. RPC by default + * \param protection Protection flag + * \param full_version full protocol version (major.minor.patch) used by the + * mobile proxy + * \param params Parameters added in the payload + */ + void SendStartSessionAck(ConnectionID connection_id, + uint8_t session_id, + uint8_t protocol_version, + uint32_t hash_code, + uint8_t service_type, + bool protection, + ProtocolPacket::ProtocolVersion& full_version, + BsonObject& params); + const ProtocolHandlerSettings& get_settings() const OVERRIDE { return settings_; } @@ -267,6 +317,20 @@ class ProtocolHandlerImpl uint8_t service_type); /** + * \brief Sends fail of starting session to mobile application + * \param connection_id Identifier of connection within which session + * \param session_id ID of session to be sent to mobile application + * \param protocol_version Version of protocol used for communication + * \param service_type Type of session: RPC or BULK Data. RPC by default + * \param rejected_params List of rejected params to send in payload + */ + void SendStartSessionNAck(ConnectionID connection_id, + uint8_t session_id, + uint8_t protocol_version, + uint8_t service_type, + std::vector<std::string>& rejectedParams); + + /** * \brief Sends acknowledgement of end session/service to mobile application * with session number for second version of protocol. * \param connection_id Identifier of connection @@ -294,9 +358,45 @@ class ProtocolHandlerImpl uint32_t session_id, uint8_t protocol_version, uint8_t service_type); + /** + * \brief Sends fail of ending session to mobile application (variant for + * Protocol v5) + * \param connection_id Identifier of connection within which + * session exists + * \param session_id ID of session ment to be ended + * \param protocol_version Version of protocol used for communication + * \param service_type Type of session: RPC or BULK Data. RPC by default + * \param rejected_params List of rejected params to send in payload + */ + void SendEndSessionNAck(ConnectionID connection_id, + uint32_t session_id, + uint8_t protocol_version, + uint8_t service_type, + std::vector<std::string>& rejected_params); SessionObserver& get_session_observer() OVERRIDE; + /** + * \brief Called by connection handler to notify the result of + * OnSessionStartedCallback(). + * \param connection_id Identifier of connection within which session exists + * \param session_id session ID passed to OnSessionStartedCallback() + * \param generated_session_id Generated session ID, will be 0 if session is + * not started + * \param hash_id Generated Hash ID + * \param protection whether the service will be protected + * \param rejected_params list of parameters' name that are rejected. + * Only valid when generated_session_id is 0. Note, even if + * generated_session_id is 0, the list may be empty. + */ + void NotifySessionStartedResult( + int32_t connection_id, + uint8_t session_id, + uint8_t generated_session_id, + uint32_t hash_id, + bool protection, + std::vector<std::string>& rejected_params) OVERRIDE; + #ifdef BUILD_TESTS const impl::FromMobileQueue& get_from_mobile_queue() const { return raw_ford_messages_from_mobile_; @@ -453,8 +553,11 @@ class ProtocolHandlerImpl RESULT_CODE HandleControlMessageEndServiceACK(const ProtocolPacket& packet); + // DEPRECATED RESULT_CODE HandleControlMessageStartSession(const ProtocolPacket& packet); + RESULT_CODE HandleControlMessageStartSession(const ProtocolFramePtr packet); + RESULT_CODE HandleControlMessageHeartBeat(const ProtocolPacket& packet); void PopValideAndExpirateMultiframes(); @@ -566,6 +669,9 @@ class ProtocolHandlerImpl sync_primitives::Lock protocol_observers_lock_; + sync_primitives::Lock start_session_frame_map_lock_; + StartSessionFrameMap start_session_frame_map_; + #ifdef TELEMETRY_MONITOR PHTelemetryObserver* metric_observer_; #endif // TELEMETRY_MONITOR diff --git a/src/components/protocol_handler/include/protocol_handler/protocol_packet.h b/src/components/protocol_handler/include/protocol_handler/protocol_packet.h index f8696c46a0..31b4c12ea6 100644 --- a/src/components/protocol_handler/include/protocol_handler/protocol_packet.h +++ b/src/components/protocol_handler/include/protocol_handler/protocol_packet.h @@ -64,6 +64,55 @@ class ProtocolPacket { }; /** + * \class ProtocolVersion + * \brief Used for storing the full protocol version of a service + * (major.minor.patch). + */ + class ProtocolVersion { + public: + ProtocolVersion(); + ProtocolVersion(uint8_t majorVersion, + uint8_t minorVersion, + uint8_t patchVersion); + ProtocolVersion(ProtocolVersion& other); + ProtocolVersion(std::string versionString); + uint8_t majorVersion; + uint8_t minorVersion; + uint8_t patchVersion; + static inline uint8_t cmp(const ProtocolVersion& version1, + const ProtocolVersion& version2) { + uint8_t diff = version1.majorVersion - version2.majorVersion; + if (diff == 0) { + diff = version1.minorVersion - version2.minorVersion; + if (diff == 0) { + diff = version1.minorVersion - version2.minorVersion; + } + } + return diff; + } + inline bool operator==(const ProtocolVersion& other) { + return ProtocolVersion::cmp(*this, other) == 0; + } + inline bool operator<(const ProtocolVersion& other) { + return ProtocolVersion::cmp(*this, other) < 0; + } + bool operator>(const ProtocolVersion& other) { + return ProtocolVersion::cmp(*this, other) > 0; + } + inline bool operator<=(const ProtocolVersion& other) { + return ProtocolVersion::cmp(*this, other) <= 0; + } + bool operator>=(const ProtocolVersion& other) { + return ProtocolVersion::cmp(*this, other) >= 0; + } + static inline ProtocolVersion* min(ProtocolVersion& version1, + ProtocolVersion& version2) { + return (version1 < version2) ? &version1 : &version2; + } + std::string to_string(); + }; + + /** * \class ProtocolHeader * \brief Used for storing protocol header of a message. */ @@ -99,7 +148,19 @@ class ProtocolPacket { * \brief Setter/getter maximum payload size of packets */ void set_max_payload_size(const size_t max_payload_size); + void set_max_control_payload_size(const size_t max_payload_size); + void set_max_rpc_payload_size(const size_t max_payload_size); + void set_max_audio_payload_size(const size_t max_payload_size); + void set_max_video_payload_size(const size_t max_payload_size); + size_t max_payload_size() const; + size_t max_control_payload_size() const; + size_t max_rpc_payload_size() const; + size_t max_audio_payload_size() const; + size_t max_video_payload_size() const; + + size_t max_payload_size_by_service_type(const ServiceType type) const; + /** * \brief Check ProtocolHeader according to protocol requiements */ @@ -107,6 +168,10 @@ class ProtocolPacket { private: size_t max_payload_size_; + size_t max_control_payload_size_; + size_t max_rpc_payload_size_; + size_t max_audio_payload_size_; + size_t max_video_payload_size_; }; /** diff --git a/src/components/protocol_handler/src/incoming_data_handler.cc b/src/components/protocol_handler/src/incoming_data_handler.cc index e1d08a6ada..4944ea9cc7 100644 --- a/src/components/protocol_handler/src/incoming_data_handler.cc +++ b/src/components/protocol_handler/src/incoming_data_handler.cc @@ -126,6 +126,7 @@ uint32_t IncomingDataHandler::GetPacketSize( case PROTOCOL_VERSION_2: case PROTOCOL_VERSION_3: case PROTOCOL_VERSION_4: + case PROTOCOL_VERSION_5: return header.dataSize + PROTOCOL_HEADER_V2_SIZE; default: LOG4CXX_WARN(logger_, diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc index aa2910722d..ec4663764a 100644 --- a/src/components/protocol_handler/src/protocol_handler_impl.cc +++ b/src/components/protocol_handler/src/protocol_handler_impl.cc @@ -33,6 +33,8 @@ #include "protocol_handler/protocol_handler_impl.h" #include <memory.h> #include <algorithm> // std::find +#include <bson_object.h> +#include <protocol/bson_object_keys.h> #include "connection_handler/connection_handler_impl.h" #include "protocol_handler/session_observer.h" @@ -55,7 +57,9 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler") std::string ConvertPacketDataToString(const uint8_t* data, const size_t data_size); -const size_t kStackSize = 32768; +const size_t kStackSize = 65536; + +ProtocolPacket::ProtocolVersion defaultProtocolVersion(5, 0, 0); ProtocolHandlerImpl::ProtocolHandlerImpl( const ProtocolHandlerSettings& settings, @@ -77,6 +81,8 @@ ProtocolHandlerImpl::ProtocolHandlerImpl( "PH FromMobile", this, threads::ThreadOptions(kStackSize)) , raw_ford_messages_to_mobile_( "PH ToMobile", this, threads::ThreadOptions(kStackSize)) + , start_session_frame_map_lock_() + , start_session_frame_map_() #ifdef TELEMETRY_MONITOR , metric_observer_(NULL) #endif // TELEMETRY_MONITOR @@ -85,6 +91,14 @@ ProtocolHandlerImpl::ProtocolHandlerImpl( LOG4CXX_AUTO_TRACE(logger_); protocol_header_validator_.set_max_payload_size( get_settings().maximum_payload_size()); + protocol_header_validator_.set_max_control_payload_size( + get_settings().maximum_control_payload_size()); + protocol_header_validator_.set_max_rpc_payload_size( + get_settings().maximum_rpc_payload_size()); + protocol_header_validator_.set_max_audio_payload_size( + get_settings().maximum_audio_payload_size()); + protocol_header_validator_.set_max_video_payload_size( + get_settings().maximum_video_payload_size()); incoming_data_handler_.set_validator(&protocol_header_validator_); const size_t& message_frequency_count = @@ -176,17 +190,82 @@ void set_hash_id(uint32_t hash_id, protocol_handler::ProtocolPacket& packet) { void ProtocolHandlerImpl::SendStartSessionAck(ConnectionID connection_id, uint8_t session_id, - uint8_t, + uint8_t input_protocol_version, uint32_t hash_id, uint8_t service_type, bool protection) { LOG4CXX_AUTO_TRACE(logger_); + ProtocolPacket::ProtocolVersion fullVersion; + SendStartSessionAck(connection_id, + session_id, + input_protocol_version, + hash_id, + service_type, + protection, + fullVersion); +} + +void ProtocolHandlerImpl::SendStartSessionAck( + ConnectionID connection_id, + uint8_t session_id, + uint8_t input_protocol_version, + uint32_t hash_id, + uint8_t service_type, + bool protection, + ProtocolPacket::ProtocolVersion& full_version) { + LOG4CXX_AUTO_TRACE(logger_); + + BsonObject empty_param; + bson_object_initialize_default(&empty_param); + + SendStartSessionAck(connection_id, + session_id, + input_protocol_version, + hash_id, + service_type, + protection, + full_version, + empty_param); + + bson_object_deinitialize(&empty_param); +} + +void ProtocolHandlerImpl::SendStartSessionAck( + ConnectionID connection_id, + uint8_t session_id, + uint8_t input_protocol_version, + uint32_t hash_id, + uint8_t service_type, + bool protection, + ProtocolPacket::ProtocolVersion& full_version, + BsonObject& params) { + LOG4CXX_AUTO_TRACE(logger_); + + uint8_t ack_protocol_version = SupportedSDLProtocolVersion(); - uint8_t protocolVersion = SupportedSDLProtocolVersion(); + const bool proxy_supports_v5_protocol = + input_protocol_version >= PROTOCOL_VERSION_5 || + (ServiceTypeFromByte(service_type) == kRpc && + full_version.majorVersion >= PROTOCOL_VERSION_5); + + if (kRpc != service_type) { + // In case if input protocol version os bigger then supported, SDL should + // respond with maximum supported protocol version + ack_protocol_version = input_protocol_version < ack_protocol_version + ? input_protocol_version + : ack_protocol_version; + } + + // We can't send a V5+ packet if the proxy doesn't support it, + // so we manually set a maximum of V4 in that case + if (!proxy_supports_v5_protocol && + ack_protocol_version >= PROTOCOL_VERSION_5) { + ack_protocol_version = PROTOCOL_VERSION_4; + } ProtocolFramePtr ptr( new protocol_handler::ProtocolPacket(connection_id, - protocolVersion, + ack_protocol_version, protection, FRAME_TYPE_CONTROL, service_type, @@ -195,7 +274,37 @@ void ProtocolHandlerImpl::SendStartSessionAck(ConnectionID connection_id, 0u, message_counters_[session_id]++)); - set_hash_id(hash_id, *ptr); + // Cannot include a constructed payload if either side doesn't support it + if (ack_protocol_version >= PROTOCOL_VERSION_5) { + ServiceType serviceTypeValue = ServiceTypeFromByte(service_type); + + bson_object_put_int64( + ¶ms, + strings::mtu, + static_cast<int64_t>( + protocol_header_validator_.max_payload_size_by_service_type( + serviceTypeValue))); + if (serviceTypeValue == kRpc) { + // Hash ID is only used in RPC case + bson_object_put_int32( + ¶ms, strings::hash_id, static_cast<int32_t>(hash_id)); + // Minimum protocol version supported by both + ProtocolPacket::ProtocolVersion* minVersion = + (full_version.majorVersion < PROTOCOL_VERSION_5) + ? &defaultProtocolVersion + : ProtocolPacket::ProtocolVersion::min(full_version, + defaultProtocolVersion); + char protocolVersionString[255]; + strncpy(protocolVersionString, (*minVersion).to_string().c_str(), 255); + bson_object_put_string( + ¶ms, strings::protocol_version, protocolVersionString); + } + uint8_t* payloadBytes = bson_object_to_bytes(¶ms); + ptr->set_data(payloadBytes, bson_object_size(¶ms)); + free(payloadBytes); + } else { + set_hash_id(hash_id, *ptr); + } raw_ford_messages_to_mobile_.PostMessage( impl::RawFordMessageToMobile(ptr, false)); @@ -212,6 +321,20 @@ void ProtocolHandlerImpl::SendStartSessionNAck(ConnectionID connection_id, uint8_t session_id, uint8_t protocol_version, uint8_t service_type) { + std::vector<std::string> rejectedParams; + SendStartSessionNAck(connection_id, + session_id, + protocol_version, + service_type, + rejectedParams); +} + +void ProtocolHandlerImpl::SendStartSessionNAck( + ConnectionID connection_id, + uint8_t session_id, + uint8_t protocol_version, + uint8_t service_type, + std::vector<std::string>& rejectedParams) { LOG4CXX_AUTO_TRACE(logger_); ProtocolFramePtr ptr( @@ -225,6 +348,27 @@ void ProtocolHandlerImpl::SendStartSessionNAck(ConnectionID connection_id, 0u, message_counters_[session_id]++)); + uint8_t maxProtocolVersion = SupportedSDLProtocolVersion(); + + if (protocol_version >= PROTOCOL_VERSION_5 && + maxProtocolVersion >= PROTOCOL_VERSION_5 && rejectedParams.size() > 0) { + BsonObject payloadObj; + bson_object_initialize_default(&payloadObj); + BsonArray rejectedParamsArr; + bson_array_initialize(&rejectedParamsArr, rejectedParams.size()); + for (std::string param : rejectedParams) { + char paramPtr[255]; + strncpy(paramPtr, param.c_str(), 255); + bson_array_add_string(&rejectedParamsArr, paramPtr); + } + bson_object_put_array( + &payloadObj, strings::rejected_params, &rejectedParamsArr); + uint8_t* payloadBytes = bson_object_to_bytes(&payloadObj); + ptr->set_data(payloadBytes, bson_object_size(&payloadObj)); + free(payloadBytes); + bson_object_deinitialize(&payloadObj); + } + raw_ford_messages_to_mobile_.PostMessage( impl::RawFordMessageToMobile(ptr, false)); @@ -239,6 +383,20 @@ void ProtocolHandlerImpl::SendEndSessionNAck(ConnectionID connection_id, uint32_t session_id, uint8_t protocol_version, uint8_t service_type) { + std::vector<std::string> rejectedParams; + SendEndSessionNAck(connection_id, + session_id, + protocol_version, + service_type, + rejectedParams); +} + +void ProtocolHandlerImpl::SendEndSessionNAck( + ConnectionID connection_id, + uint32_t session_id, + uint8_t protocol_version, + uint8_t service_type, + std::vector<std::string>& rejectedParams) { LOG4CXX_AUTO_TRACE(logger_); ProtocolFramePtr ptr( @@ -252,6 +410,27 @@ void ProtocolHandlerImpl::SendEndSessionNAck(ConnectionID connection_id, 0u, message_counters_[session_id]++)); + uint8_t maxProtocolVersion = SupportedSDLProtocolVersion(); + + if (protocol_version >= PROTOCOL_VERSION_5 && + maxProtocolVersion >= PROTOCOL_VERSION_5 && rejectedParams.size() > 0) { + BsonObject payloadObj; + bson_object_initialize_default(&payloadObj); + BsonArray rejectedParamsArr; + bson_array_initialize(&rejectedParamsArr, rejectedParams.size()); + for (std::string param : rejectedParams) { + char paramPtr[255]; + strncpy(paramPtr, param.c_str(), 255); + bson_array_add_string(&rejectedParamsArr, paramPtr); + } + bson_object_put_array( + &payloadObj, strings::rejected_params, &rejectedParamsArr); + uint8_t* payloadBytes = bson_object_to_bytes(&payloadObj); + ptr->set_data(payloadBytes, bson_object_size(&payloadObj)); + free(payloadBytes); + bson_object_deinitialize(&payloadObj); + } + raw_ford_messages_to_mobile_.PostMessage( impl::RawFordMessageToMobile(ptr, false)); @@ -413,7 +592,7 @@ void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message, metric_observer_->StartMessageProcess(message_id, start_time); } #endif // TELEMETRY_MONITOR - const size_t max_frame_size = get_settings().maximum_payload_size(); + size_t max_frame_size = get_settings().maximum_payload_size(); size_t frame_size = MAXIMUM_FRAME_DATA_V2_SIZE; switch (message->protocol_version()) { case PROTOCOL_VERSION_3: @@ -422,6 +601,13 @@ void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message, ? max_frame_size : MAXIMUM_FRAME_DATA_V2_SIZE; break; + case PROTOCOL_VERSION_5: + max_frame_size = + protocol_header_validator_.max_payload_size_by_service_type( + ServiceTypeFromByte(message->service_type())); + frame_size = max_frame_size > MAXIMUM_FRAME_DATA_V2_SIZE + ? max_frame_size + : MAXIMUM_FRAME_DATA_V2_SIZE; default: break; } @@ -883,7 +1069,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessage( switch (packet->frame_data()) { case FRAME_DATA_START_SERVICE: { LOG4CXX_TRACE(logger_, "FrameData: StartService"); - return HandleControlMessageStartSession(*packet); + return HandleControlMessageStartSession(packet); } case FRAME_DATA_END_SERVICE: { LOG4CXX_TRACE(logger_, "FrameData: StopService"); @@ -924,10 +1110,19 @@ uint32_t get_hash_id(const ProtocolPacket& packet) { LOG4CXX_WARN(logger_, "Packet without hash data (data size less 4)"); return HASH_ID_WRONG; } - const uint32_t hash_be = *(reinterpret_cast<uint32_t*>(packet.data())); - const uint32_t hash_le = BE_TO_LE32(hash_be); - // null hash is wrong hash value - return hash_le == HASH_ID_NOT_SUPPORTED ? HASH_ID_WRONG : hash_le; + if (packet.protocol_version() >= PROTOCOL_VERSION_5) { + BsonObject obj = bson_object_from_bytes(packet.data()); + const uint32_t hash_id = + (uint32_t)bson_object_get_int32(&obj, strings::hash_id); + bson_object_deinitialize(&obj); + return hash_id; + } else { + const uint32_t hash_be = *(reinterpret_cast<uint32_t*>(packet.data())); + const uint32_t hash_le = BE_TO_LE32(hash_be); + + // null hash is wrong hash value + return hash_le == HASH_ID_NOT_SUPPORTED ? HASH_ID_WRONG : hash_le; + } } RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndSession( @@ -935,12 +1130,12 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndSession( LOG4CXX_AUTO_TRACE(logger_); const uint8_t current_session_id = packet.session_id(); - const uint32_t hash_id = get_hash_id(packet); + uint32_t hash_id = get_hash_id(packet); const ServiceType service_type = ServiceTypeFromByte(packet.service_type()); const ConnectionID connection_id = packet.connection_id(); const uint32_t session_key = session_observer_.OnSessionEndedCallback( - connection_id, current_session_id, hash_id, service_type); + connection_id, current_session_id, &hash_id, service_type); // TODO(EZamakhov): add clean up output queue (for removed service) if (session_key != 0) { @@ -953,10 +1148,22 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndSession( LOG4CXX_WARN(logger_, "Refused to end session " << static_cast<int>(service_type) << " type."); - SendEndSessionNAck(connection_id, - current_session_id, - packet.protocol_version(), - service_type); + if (packet.protocol_version() >= PROTOCOL_VERSION_5) { + std::vector<std::string> rejectedParams; + if (hash_id == protocol_handler::HASH_ID_WRONG) { + rejectedParams.push_back(std::string(strings::hash_id)); + } + SendEndSessionNAck(connection_id, + current_session_id, + packet.protocol_version(), + service_type, + rejectedParams); + } else { + SendEndSessionNAck(connection_id, + current_session_id, + packet.protocol_version(), + service_type); + } } return RESULT_OK; } @@ -1006,12 +1213,36 @@ class StartSessionHandler : public security_manager::SecurityManagerListener { , protocol_version_(protocol_version) , hash_id_(hash_id) , service_type_(service_type) - , force_protected_service_(force_protected_service) {} + , force_protected_service_(force_protected_service) + , full_version_() {} + StartSessionHandler(uint32_t connection_key, + ProtocolHandlerImpl* protocol_handler, + SessionObserver& session_observer, + ConnectionID connection_id, + int32_t session_id, + uint8_t protocol_version, + uint32_t hash_id, + ServiceType service_type, + const std::vector<int>& force_protected_service, + ProtocolPacket::ProtocolVersion& full_version, + uint8_t* payload) + : connection_key_(connection_key) + , protocol_handler_(protocol_handler) + , session_observer_(session_observer) + , connection_id_(connection_id) + , session_id_(session_id) + , protocol_version_(protocol_version) + , hash_id_(hash_id) + , service_type_(service_type) + , force_protected_service_(force_protected_service) + , full_version_(full_version) + , payload_(payload) {} bool OnHandshakeDone( const uint32_t connection_key, security_manager::SSLContext::HandshakeResult result) OVERRIDE { if (connection_key != connection_key_) { + delete[] payload_; return false; } const bool success = @@ -1031,13 +1262,23 @@ class StartSessionHandler : public security_manager::SecurityManagerListener { if (success) { session_observer_.SetProtectionFlag(connection_key_, service_type_); } + BsonObject params; + if (payload_ != NULL) { + params = bson_object_from_bytes(payload_); + } else { + bson_object_initialize_default(¶ms); + } protocol_handler_->SendStartSessionAck(connection_id_, session_id_, protocol_version_, hash_id_, service_type_, - success); + success, + full_version_, + params); + bson_object_deinitialize(¶ms); } + delete[] payload_; delete this; return true; } @@ -1059,10 +1300,13 @@ class StartSessionHandler : public security_manager::SecurityManagerListener { const uint32_t hash_id_; const ServiceType service_type_; const std::vector<int> force_protected_service_; + ProtocolPacket::ProtocolVersion full_version_; + uint8_t* payload_; }; } // namespace #endif // ENABLE_SECURITY +// DEPRECATED RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession( const ProtocolPacket& packet) { LOG4CXX_AUTO_TRACE(logger_); @@ -1121,7 +1365,30 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession( PROTECTION_OFF); return RESULT_OK; } - if (ssl_context->IsInitCompleted()) { + ProtocolPacket::ProtocolVersion* fullVersion; + std::vector<std::string> rejectedParams(0, std::string("")); + // Can't check protocol_version because the first packet is v1, but there + // could still be a payload, in which case we can get the real protocol + // version + if (packet.service_type() == kRpc && packet.data_size() != 0) { + BsonObject obj = bson_object_from_bytes(packet.data()); + fullVersion = new ProtocolPacket::ProtocolVersion( + std::string(bson_object_get_string(&obj, "protocolVersion"))); + bson_object_deinitialize(&obj); + // Constructed payloads added in Protocol v5 + if (fullVersion->majorVersion < PROTOCOL_VERSION_5) { + rejectedParams.push_back(std::string("protocolVersion")); + } + } else { + fullVersion = new ProtocolPacket::ProtocolVersion(); + } + if (!rejectedParams.empty()) { + SendStartSessionNAck(connection_id, + packet.session_id(), + protocol_version, + packet.service_type(), + rejectedParams); + } else if (ssl_context->IsInitCompleted()) { // mark service as protected session_observer_.SetProtectionFlag(connection_key, service_type); // Start service as protected with current SSLContext @@ -1130,7 +1397,8 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession( packet.protocol_version(), hash_id, packet.service_type(), - PROTECTION_ON); + PROTECTION_ON, + *fullVersion); } else { security_manager_->AddListener( new StartSessionHandler(connection_key, @@ -1141,28 +1409,257 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession( packet.protocol_version(), hash_id, service_type, - get_settings().force_protected_service())); + get_settings().force_protected_service(), + *fullVersion, + NULL)); if (!ssl_context->IsHandshakePending()) { // Start handshake process security_manager_->StartHandshake(connection_key); } } + delete fullVersion; LOG4CXX_DEBUG(logger_, "Protection establishing for connection " << connection_key << " is in progress"); return RESULT_OK; } #endif // ENABLE_SECURITY - // Start service without protection - SendStartSessionAck(connection_id, - session_id, - packet.protocol_version(), - hash_id, - packet.service_type(), - PROTECTION_OFF); + if (packet.service_type() == kRpc && packet.data_size() != 0) { + BsonObject obj = bson_object_from_bytes(packet.data()); + ProtocolPacket::ProtocolVersion fullVersion( + bson_object_get_string(&obj, "protocolVersion")); + bson_object_deinitialize(&obj); + + if (fullVersion.majorVersion >= PROTOCOL_VERSION_5) { + // Start service without protection + SendStartSessionAck(connection_id, + session_id, + packet.protocol_version(), + hash_id, + packet.service_type(), + PROTECTION_OFF, + fullVersion); + } else { + std::vector<std::string> rejectedParams(1, + std::string("protocolVersion")); + SendStartSessionNAck(connection_id, + packet.session_id(), + protocol_version, + packet.service_type(), + rejectedParams); + } + + } else { + // Start service without protection + SendStartSessionAck(connection_id, + session_id, + packet.protocol_version(), + hash_id, + packet.service_type(), + PROTECTION_OFF); + } return RESULT_OK; } +RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession( + const ProtocolFramePtr packet) { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG( + logger_, + "Protocol version:" << static_cast<int>(packet->protocol_version())); + const ServiceType service_type = ServiceTypeFromByte(packet->service_type()); + const uint8_t protocol_version = packet->protocol_version(); + BsonObject bson_obj; + if (packet->data() != NULL) { + bson_obj = bson_object_from_bytes(packet->data()); + } else { + bson_object_initialize_default(&bson_obj); + } + +#ifdef ENABLE_SECURITY + const bool protection = + // Protocolo version 1 is not support protection + (protocol_version > PROTOCOL_VERSION_1) ? packet->protection_flag() + : false; +#else + const bool protection = false; +#endif // ENABLE_SECURITY + + const ConnectionID connection_id = packet->connection_id(); + const uint8_t session_id = packet->session_id(); + + { + sync_primitives::AutoLock auto_lock(start_session_frame_map_lock_); + start_session_frame_map_[std::make_pair(connection_id, session_id)] = + packet; + } + + session_observer_.OnSessionStartedCallback( + connection_id, packet->session_id(), service_type, protection, &bson_obj); + bson_object_deinitialize(&bson_obj); + + return RESULT_OK; +} + +void ProtocolHandlerImpl::NotifySessionStartedResult( + int32_t connection_id, + uint8_t session_id, + uint8_t generated_session_id, + uint32_t hash_id, + bool protection, + std::vector<std::string>& rejected_params) { + ProtocolFramePtr packet; + { + sync_primitives::AutoLock auto_lock(start_session_frame_map_lock_); + StartSessionFrameMap::iterator it = start_session_frame_map_.find( + std::make_pair(connection_id, session_id)); + if (it == start_session_frame_map_.end()) { + LOG4CXX_ERROR(logger_, "Cannot find Session Started packet"); + return; + } + packet = it->second; + start_session_frame_map_.erase(it); + } + + const ServiceType service_type = ServiceTypeFromByte(packet->service_type()); + const uint8_t protocol_version = packet->protocol_version(); + + if (0 == generated_session_id) { + LOG4CXX_WARN(logger_, + "Refused by session_observer to create service " + << static_cast<int32_t>(service_type) << " type."); + SendStartSessionNAck(connection_id, + packet->session_id(), + protocol_version, + packet->service_type(), + rejected_params); + return; + } + + BsonObject start_session_ack_params; + // when video service is successfully started, copy input parameters + // ("width", "height", "videoProtocol", "videoCodec") to the ACK packet + if (packet->service_type() == kMobileNav && packet->data() != NULL) { + start_session_ack_params = bson_object_from_bytes(packet->data()); + } else { + bson_object_initialize_default(&start_session_ack_params); + } + + ProtocolPacket::ProtocolVersion* fullVersion; + + // Can't check protocol_version because the first packet is v1, but there + // could still be a payload, in which case we can get the real protocol + // version + if (packet->service_type() == kRpc && packet->data() != NULL) { + BsonObject request_params = bson_object_from_bytes(packet->data()); + char* version_param = + bson_object_get_string(&request_params, strings::protocol_version); + std::string version_string(version_param == NULL ? "" : version_param); + fullVersion = new ProtocolPacket::ProtocolVersion(version_string); + // Constructed payloads added in Protocol v5 + if (fullVersion->majorVersion < PROTOCOL_VERSION_5) { + rejected_params.push_back(std::string(strings::protocol_version)); + } + bson_object_deinitialize(&request_params); + } else { + fullVersion = new ProtocolPacket::ProtocolVersion(); + } + +#ifdef ENABLE_SECURITY + // for packet is encrypted and security plugin is enable + if (protection && security_manager_) { + const uint32_t connection_key = + session_observer_.KeyFromPair(connection_id, generated_session_id); + + security_manager::SSLContext* ssl_context = + security_manager_->CreateSSLContext(connection_key); + if (!ssl_context) { + const std::string error("CreateSSLContext failed"); + LOG4CXX_ERROR(logger_, error); + security_manager_->SendInternalError( + connection_key, + security_manager::SecurityManager::ERROR_INTERNAL, + error); + // Start service without protection + SendStartSessionAck(connection_id, + generated_session_id, + packet->protocol_version(), + hash_id, + packet->service_type(), + PROTECTION_OFF, + *fullVersion, + start_session_ack_params); + delete fullVersion; + bson_object_deinitialize(&start_session_ack_params); + return; + } + + if (!rejected_params.empty()) { + SendStartSessionNAck(connection_id, + packet->session_id(), + protocol_version, + packet->service_type(), + rejected_params); + } else if (ssl_context->IsInitCompleted()) { + // mark service as protected + session_observer_.SetProtectionFlag(connection_key, service_type); + // Start service as protected with current SSLContext + SendStartSessionAck(connection_id, + generated_session_id, + packet->protocol_version(), + hash_id, + packet->service_type(), + PROTECTION_ON, + *fullVersion, + start_session_ack_params); + } else { + // Need a copy because fullVersion will be deleted + ProtocolPacket::ProtocolVersion fullVersionCopy(*fullVersion); + security_manager_->AddListener(new StartSessionHandler( + connection_key, + this, + session_observer_, + connection_id, + generated_session_id, + packet->protocol_version(), + hash_id, + service_type, + get_settings().force_protected_service(), + fullVersionCopy, + bson_object_to_bytes(&start_session_ack_params))); + if (!ssl_context->IsHandshakePending()) { + // Start handshake process + security_manager_->StartHandshake(connection_key); + } + } + delete fullVersion; + bson_object_deinitialize(&start_session_ack_params); + LOG4CXX_DEBUG(logger_, + "Protection establishing for connection " + << connection_key << " is in progress"); + return; + } +#endif // ENABLE_SECURITY + if (rejected_params.empty()) { + SendStartSessionAck(connection_id, + generated_session_id, + packet->protocol_version(), + hash_id, + packet->service_type(), + PROTECTION_OFF, + *fullVersion, + start_session_ack_params); + } else { + SendStartSessionNAck(connection_id, + packet->session_id(), + protocol_version, + packet->service_type(), + rejected_params); + } + delete fullVersion; + bson_object_deinitialize(&start_session_ack_params); +} + RESULT_CODE ProtocolHandlerImpl::HandleControlMessageHeartBeat( const ProtocolPacket& packet) { const ConnectionID connection_id = packet.connection_id(); @@ -1173,8 +1670,8 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageHeartBeat( if (session_observer_.ProtocolVersionUsed( connection_id, packet.session_id(), protocol_version)) { // TODO(EZamakhov): investigate message_id for HeartBeatAck - if (PROTOCOL_VERSION_3 == protocol_version || - PROTOCOL_VERSION_4 == protocol_version) { + if (protocol_version >= PROTOCOL_VERSION_3 && + protocol_version <= PROTOCOL_VERSION_5) { return SendHeartBeatAck( connection_id, packet.session_id(), packet.message_id()); } else { @@ -1329,6 +1826,9 @@ void ProtocolHandlerImpl::Handle(const impl::RawFordMessageToMobile message) { void ProtocolHandlerImpl::Stop() { raw_ford_messages_from_mobile_.Shutdown(); raw_ford_messages_to_mobile_.Shutdown(); + + sync_primitives::AutoLock auto_lock(start_session_frame_map_lock_); + start_session_frame_map_.clear(); } #ifdef ENABLE_SECURITY @@ -1504,17 +2004,6 @@ std::string ConvertPacketDataToString(const uint8_t* data, uint8_t ProtocolHandlerImpl::SupportedSDLProtocolVersion() const { LOG4CXX_AUTO_TRACE(logger_); - - bool heart_beat_support = (0 != get_settings().heart_beat_timeout()); - - bool sdl4_support = get_settings().enable_protocol_4(); - - if (sdl4_support) { - return PROTOCOL_VERSION_4; - } - if (heart_beat_support) { - return PROTOCOL_VERSION_3; - } - return PROTOCOL_VERSION_2; + return get_settings().max_supported_protocol_version(); } } // namespace protocol_handler diff --git a/src/components/protocol_handler/src/protocol_packet.cc b/src/components/protocol_handler/src/protocol_packet.cc index d766cf18c4..39871d5bae 100644 --- a/src/components/protocol_handler/src/protocol_packet.cc +++ b/src/components/protocol_handler/src/protocol_packet.cc @@ -52,6 +52,48 @@ ProtocolPacket::ProtocolData::~ProtocolData() { delete[] data; } +ProtocolPacket::ProtocolVersion::ProtocolVersion() + : majorVersion(0), minorVersion(0), patchVersion(0) {} + +ProtocolPacket::ProtocolVersion::ProtocolVersion(uint8_t majorVersion, + uint8_t minorVersion, + uint8_t patchVersion) + : majorVersion(majorVersion) + , minorVersion(minorVersion) + , patchVersion(patchVersion) {} + +ProtocolPacket::ProtocolVersion::ProtocolVersion(ProtocolVersion& other) { + this->majorVersion = other.majorVersion; + this->minorVersion = other.minorVersion; + this->patchVersion = other.patchVersion; +} + +ProtocolPacket::ProtocolVersion::ProtocolVersion(std::string versionString) + : majorVersion(0), minorVersion(0), patchVersion(0) { + unsigned int majorInt, minorInt, patchInt; + int readElements = sscanf( + versionString.c_str(), "%u.%u.%u", &majorInt, &minorInt, &patchInt); + if (readElements != 3) { + LOG4CXX_WARN(logger_, + "Error while parsing version string: " << versionString); + } else { + majorVersion = static_cast<uint8_t>(majorInt); + minorVersion = static_cast<uint8_t>(minorInt); + patchVersion = static_cast<uint8_t>(patchInt); + } +} + +std::string ProtocolPacket::ProtocolVersion::to_string() { + char versionString[255]; + snprintf(versionString, + 255, + "%u.%u.%u", + static_cast<unsigned int>(majorVersion), + static_cast<unsigned int>(minorVersion), + static_cast<unsigned int>(patchVersion)); + return std::string(versionString); +} + ProtocolPacket::ProtocolHeader::ProtocolHeader() : version(0x00) , protection_flag(PROTECTION_OFF) @@ -114,7 +156,8 @@ void ProtocolPacket::ProtocolHeader::deserialize(const uint8_t* message, switch (version) { case PROTOCOL_VERSION_2: case PROTOCOL_VERSION_3: - case PROTOCOL_VERSION_4: { + case PROTOCOL_VERSION_4: + case PROTOCOL_VERSION_5: { if (messageSize < PROTOCOL_HEADER_V2_SIZE) { LOG4CXX_DEBUG(logger_, "Message size less " << PROTOCOL_HEADER_V2_SIZE @@ -131,7 +174,11 @@ void ProtocolPacket::ProtocolHeader::deserialize(const uint8_t* message, } ProtocolPacket::ProtocolHeaderValidator::ProtocolHeaderValidator() - : max_payload_size_(std::numeric_limits<size_t>::max()) {} + : max_payload_size_(std::numeric_limits<size_t>::max()) + , max_control_payload_size_(0) + , max_rpc_payload_size_(0) + , max_audio_payload_size_(0) + , max_video_payload_size_(0) {} void ProtocolPacket::ProtocolHeaderValidator::set_max_payload_size( const size_t max_payload_size) { @@ -139,15 +186,92 @@ void ProtocolPacket::ProtocolHeaderValidator::set_max_payload_size( max_payload_size_ = max_payload_size; } +void ProtocolPacket::ProtocolHeaderValidator::set_max_control_payload_size( + const size_t max_payload_size) { + LOG4CXX_DEBUG(logger_, + "New maximum Control payload size is " << max_payload_size); + max_control_payload_size_ = max_payload_size; +} + +void ProtocolPacket::ProtocolHeaderValidator::set_max_rpc_payload_size( + const size_t max_payload_size) { + LOG4CXX_DEBUG(logger_, + "New maximum RPC payload size is " << max_payload_size); + max_rpc_payload_size_ = max_payload_size; +} + +void ProtocolPacket::ProtocolHeaderValidator::set_max_audio_payload_size( + const size_t max_payload_size) { + LOG4CXX_DEBUG(logger_, + "New maximum audio payload size is " << max_payload_size); + max_audio_payload_size_ = max_payload_size; +} + +void ProtocolPacket::ProtocolHeaderValidator::set_max_video_payload_size( + const size_t max_payload_size) { + LOG4CXX_DEBUG(logger_, + "New maximum video payload size is " << max_payload_size); + max_video_payload_size_ = max_payload_size; +} + size_t ProtocolPacket::ProtocolHeaderValidator::max_payload_size() const { return max_payload_size_; } +size_t ProtocolPacket::ProtocolHeaderValidator::max_control_payload_size() + const { + return max_control_payload_size_; +} + +size_t ProtocolPacket::ProtocolHeaderValidator::max_rpc_payload_size() const { + return max_rpc_payload_size_; +} + +size_t ProtocolPacket::ProtocolHeaderValidator::max_audio_payload_size() const { + return max_audio_payload_size_; +} + +size_t ProtocolPacket::ProtocolHeaderValidator::max_video_payload_size() const { + return max_video_payload_size_; +} + +size_t +ProtocolPacket::ProtocolHeaderValidator::max_payload_size_by_service_type( + const ServiceType type) const { + size_t payload_size = 0; + switch (type) { + case kControl: + // Default to the generic MTU if specific MTU is not set + payload_size = max_control_payload_size_ == 0 ? max_payload_size_ + : max_control_payload_size_; + break; + case kBulk: + case kRpc: + // Default to the generic MTU if specific MTU is not set + payload_size = max_rpc_payload_size_ == 0 ? max_payload_size_ + : max_rpc_payload_size_; + break; + case kAudio: + // Default to the generic MTU if specific MTU is not set + payload_size = max_audio_payload_size_ == 0 ? max_payload_size_ + : max_audio_payload_size_; + break; + case kMobileNav: + // Default to the generic MTU if specific MTU is not set + payload_size = max_video_payload_size_ == 0 ? max_payload_size_ + : max_video_payload_size_; + break; + case kInvalidServiceType: + LOG4CXX_WARN(logger_, "Invalid service type: " << static_cast<int>(type)); + } + return payload_size; +} + RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate( const ProtocolHeader& header) const { LOG4CXX_DEBUG(logger_, "Validating header - " << header); // expected payload size will be calculated depending - // on used protocol version + // on used protocol version and service type size_t payload_size = MAXIMUM_FRAME_DATA_V2_SIZE; // Protocol version shall be from 1 to 4 switch (header.version) { @@ -160,6 +284,10 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate( ? max_payload_size_ : MAXIMUM_FRAME_DATA_V2_SIZE; break; + case PROTOCOL_VERSION_5: + payload_size = max_payload_size_by_service_type( + ServiceTypeFromByte(header.serviceType)); + break; default: LOG4CXX_WARN(logger_, "Unknown version:" << static_cast<int>(header.version)); diff --git a/src/components/protocol_handler/test/incoming_data_handler_test.cc b/src/components/protocol_handler/test/incoming_data_handler_test.cc index 66f5aea712..d0a311583c 100644 --- a/src/components/protocol_handler/test/incoming_data_handler_test.cc +++ b/src/components/protocol_handler/test/incoming_data_handler_test.cc @@ -262,7 +262,7 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_Version) { FrameList malformed_packets; std::vector<uint8_t> malformed_versions; malformed_versions.push_back(0); - for (uint8_t version = PROTOCOL_VERSION_4 + 1; + for (uint8_t version = PROTOCOL_VERSION_5 + 1; version <= PROTOCOL_VERSION_MAX; ++version) { malformed_versions.push_back(version); diff --git a/src/components/protocol_handler/test/protocol_handler_tm_test.cc b/src/components/protocol_handler/test/protocol_handler_tm_test.cc index 308901e013..89b9faedaa 100644 --- a/src/components/protocol_handler/test/protocol_handler_tm_test.cc +++ b/src/components/protocol_handler/test/protocol_handler_tm_test.cc @@ -33,6 +33,7 @@ #include <string> #include "protocol_handler/protocol_handler.h" #include "protocol_handler/protocol_handler_impl.h" +#include "protocol/bson_object_keys.h" #include "protocol/common.h" #include "protocol_handler/control_message_matcher.h" #include "protocol_handler/mock_protocol_handler.h" @@ -45,6 +46,7 @@ #include "transport_manager/mock_transport_manager.h" #include "utils/make_shared.h" #include "utils/test_async_waiter.h" +#include <bson_object.h> namespace test { namespace components { @@ -96,8 +98,11 @@ using connection_handler::DeviceHandle; using ::testing::Return; using ::testing::ReturnRefOfCopy; using ::testing::ReturnNull; +using ::testing::An; using ::testing::AnyOf; +using ::testing::ByRef; using ::testing::DoAll; +using ::testing::Eq; using ::testing::_; using ::testing::Invoke; using ::testing::SetArgReferee; @@ -105,6 +110,11 @@ using ::testing::SetArgPointee; typedef std::vector<uint8_t> UCharDataVector; +// custom action to call a member function with 6 arguments +ACTION_P8(InvokeMemberFuncWithArg6, ptr, memberFunc, a, b, c, d, e, f) { + (ptr->*memberFunc)(a, b, c, d, e, f); +} + namespace { const uint32_t kAsyncExpectationsTimeout = 10000u; } @@ -178,6 +188,7 @@ class ProtocolHandlerImplTest : public ::testing::Test { void AddSession(const ::utils::SharedPtr<TestAsyncWaiter>& waiter, uint32_t& times) { + using namespace protocol_handler; ASSERT_TRUE(NULL != waiter.get()); AddConnection(); @@ -198,10 +209,19 @@ class ProtocolHandlerImplTest : public ::testing::Test { NEW_SESSION_ID, start_service, callback_protection_flag, - _)) + An<const BsonObject*>())) . // Return sessions start success - WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(session_id))); + WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), + InvokeMemberFuncWithArg6( + protocol_handler_impl.get(), + &ProtocolHandler::NotifySessionStartedResult, + connection_id, + NEW_SESSION_ID, + session_id, + HASH_ID_WRONG, + callback_protection_flag, + ByRef(empty_rejected_param_)))); times++; // Expect send Ack with PROTECTION_OFF (on no Security Manager) @@ -294,6 +314,7 @@ class ProtocolHandlerImplTest : public ::testing::Test { security_manager_mock; testing::NiceMock<security_manager_test::MockSSLContext> ssl_context_mock; #endif // ENABLE_SECURITY + std::vector<std::string> empty_rejected_param_; }; #ifdef ENABLE_SECURITY @@ -341,6 +362,7 @@ TEST_F(ProtocolHandlerImplTest, RecieveOnUnknownConnection) { */ TEST_F(ProtocolHandlerImplTest, StartSession_Unprotected_SessionObserverReject) { + using namespace protocol_handler; const int call_times = 5; AddConnection(); @@ -353,12 +375,20 @@ TEST_F(ProtocolHandlerImplTest, NEW_SESSION_ID, AnyOf(kControl, kRpc, kAudio, kMobileNav, kBulk), PROTECTION_OFF, - _)) + An<const BsonObject*>())) .Times(call_times) . // Return sessions start rejection - WillRepeatedly( - DoAll(NotifyTestAsyncWaiter(&waiter), Return(SESSION_START_REJECT))); + WillRepeatedly(DoAll( + NotifyTestAsyncWaiter(&waiter), + InvokeMemberFuncWithArg6(protocol_handler_impl.get(), + &ProtocolHandler::NotifySessionStartedResult, + connection_id, + NEW_SESSION_ID, + SESSION_START_REJECT, + HASH_ID_WRONG, + PROTECTION_OFF, + ByRef(empty_rejected_param_)))); times += call_times; // Expect send NAck @@ -389,6 +419,7 @@ TEST_F(ProtocolHandlerImplTest, * OFF */ TEST_F(ProtocolHandlerImplTest, StartSession_Protected_SessionObserverReject) { + using namespace protocol_handler; const int call_times = 5; AddConnection(); #ifdef ENABLE_SECURITY @@ -409,12 +440,20 @@ TEST_F(ProtocolHandlerImplTest, StartSession_Protected_SessionObserverReject) { NEW_SESSION_ID, AnyOf(kControl, kRpc, kAudio, kMobileNav, kBulk), callback_protection_flag, - _)) + An<const BsonObject*>())) .Times(call_times) . // Return sessions start rejection - WillRepeatedly( - DoAll(NotifyTestAsyncWaiter(&waiter), Return(SESSION_START_REJECT))); + WillRepeatedly(DoAll( + NotifyTestAsyncWaiter(&waiter), + InvokeMemberFuncWithArg6(protocol_handler_impl.get(), + &ProtocolHandler::NotifySessionStartedResult, + connection_id, + NEW_SESSION_ID, + SESSION_START_REJECT, + HASH_ID_WRONG, + callback_protection_flag, + ByRef(empty_rejected_param_)))); times += call_times; // Expect send NAck with encryption OFF @@ -444,19 +483,31 @@ TEST_F(ProtocolHandlerImplTest, StartSession_Protected_SessionObserverReject) { */ TEST_F(ProtocolHandlerImplTest, StartSession_Unprotected_SessionObserverAccept) { + using namespace protocol_handler; AddConnection(); const ServiceType start_service = kRpc; TestAsyncWaiter waiter; uint32_t times = 0; // Expect ConnectionHandler check - EXPECT_CALL( - session_observer_mock, - OnSessionStartedCallback( - connection_id, NEW_SESSION_ID, start_service, PROTECTION_OFF, _)) + EXPECT_CALL(session_observer_mock, + OnSessionStartedCallback(connection_id, + NEW_SESSION_ID, + start_service, + PROTECTION_OFF, + An<const BsonObject*>())) . // Return sessions start success - WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(session_id))); + WillOnce(DoAll( + NotifyTestAsyncWaiter(&waiter), + InvokeMemberFuncWithArg6(protocol_handler_impl.get(), + &ProtocolHandler::NotifySessionStartedResult, + connection_id, + NEW_SESSION_ID, + session_id, + HASH_ID_WRONG, + PROTECTION_OFF, + ByRef(empty_rejected_param_)))); times++; SetProtocolVersion2(); @@ -489,6 +540,193 @@ TEST_F(ProtocolHandlerImplTest, StartSession_Protected_SessionObserverAccept) { EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout)); } + +static std::vector<uint8_t> CreateVectorFromBsonObject(const BsonObject* bo) { + std::vector<uint8_t> output; + if (bo != NULL) { + size_t len = bson_object_size(const_cast<BsonObject*>(bo)); + uint8_t* bytes = bson_object_to_bytes(const_cast<BsonObject*>(bo)); + output.assign(bytes, bytes + len); + free(bytes); + } + return output; +} + +/* + * Simulate two StartService messages of video service from mobile. + * Session observer accepts the first message with delay, while rejects the + * second message immediately. + */ +TEST_F(ProtocolHandlerImplTest, + StartSession_Unprotected_Multiple_SessionObserverAcceptAndReject) { + using namespace protocol_handler; + + ON_CALL(protocol_handler_settings_mock, max_supported_protocol_version()) + .WillByDefault(Return(PROTOCOL_VERSION_5)); + + const size_t maximum_payload_size = 1000; + InitProtocolHandlerImpl(0u, 0u, false, 0u, 0u, 0, maximum_payload_size); + + const ServiceType start_service = kMobileNav; + const ::transport_manager::ConnectionUID connection_id1 = 0xAu; + const uint8_t session_id1 = 1u; + const ::transport_manager::ConnectionUID connection_id2 = 0xBu; + const uint8_t session_id2 = 2u; + + EXPECT_CALL(session_observer_mock, IsHeartBeatSupported(connection_id1, _)) + .WillRepeatedly(Return(false)); + EXPECT_CALL(session_observer_mock, IsHeartBeatSupported(connection_id2, _)) + .WillRepeatedly(Return(false)); + + // Add two connections + tm_listener->OnConnectionEstablished(DeviceInfo(DeviceHandle(1u), + std::string("mac"), + std::string("name"), + std::string("BTMAC")), + connection_id1); + tm_listener->OnConnectionEstablished(DeviceInfo(DeviceHandle(2u), + std::string("mac"), + std::string("name"), + std::string("BTMAC")), + connection_id2); + + TestAsyncWaiter waiter; + uint32_t times = 0; + + BsonObject bson_params1; + bson_object_initialize_default(&bson_params1); + bson_object_put_string(&bson_params1, + protocol_handler::strings::video_protocol, + const_cast<char*>("RAW")); + bson_object_put_string(&bson_params1, + protocol_handler::strings::video_codec, + const_cast<char*>("H264")); + std::vector<uint8_t> params1 = CreateVectorFromBsonObject(&bson_params1); + + uint8_t generated_session_id1 = 100; + + EXPECT_CALL(session_observer_mock, + OnSessionStartedCallback(connection_id1, + session_id1, + start_service, + PROTECTION_OFF, + An<const BsonObject*>())) + // don't call NotifySessionStartedResult() immediately, instead call it + // after second OnSessionStartedCallback() + .WillOnce(NotifyTestAsyncWaiter(&waiter)); + times++; + + BsonObject bson_params2; + bson_object_initialize_default(&bson_params2); + bson_object_put_string(&bson_params2, + protocol_handler::strings::video_protocol, + const_cast<char*>("RTP")); + bson_object_put_string(&bson_params2, + protocol_handler::strings::video_codec, + const_cast<char*>("H265")); + std::vector<uint8_t> params2 = CreateVectorFromBsonObject(&bson_params2); + + std::vector<std::string> rejected_param_list; + rejected_param_list.push_back(protocol_handler::strings::video_codec); + + EXPECT_CALL(session_observer_mock, + OnSessionStartedCallback(connection_id2, + session_id2, + start_service, + PROTECTION_OFF, + An<const BsonObject*>())) + .WillOnce(DoAll( + NotifyTestAsyncWaiter(&waiter), + InvokeMemberFuncWithArg6(protocol_handler_impl.get(), + &ProtocolHandler::NotifySessionStartedResult, + connection_id2, + session_id2, + SESSION_START_REJECT, + HASH_ID_WRONG, + PROTECTION_OFF, + ByRef(rejected_param_list)), + InvokeMemberFuncWithArg6(protocol_handler_impl.get(), + &ProtocolHandler::NotifySessionStartedResult, + connection_id1, + session_id1, + generated_session_id1, + HASH_ID_WRONG, + PROTECTION_OFF, + ByRef(empty_rejected_param_)))); + times++; + + BsonObject bson_ack_params; + bson_object_initialize_default(&bson_ack_params); + bson_object_put_int64( + &bson_ack_params, protocol_handler::strings::mtu, maximum_payload_size); + bson_object_put_string(&bson_ack_params, + protocol_handler::strings::video_protocol, + const_cast<char*>("RAW")); + bson_object_put_string(&bson_ack_params, + protocol_handler::strings::video_codec, + const_cast<char*>("H264")); + std::vector<uint8_t> ack_params = + CreateVectorFromBsonObject(&bson_ack_params); + bson_object_deinitialize(&bson_ack_params); + + EXPECT_CALL(transport_manager_mock, + SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, + PROTECTION_OFF, + connection_id1, + Eq(ack_params)))) + .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS))); + times++; + + BsonArray bson_arr; + bson_array_initialize(&bson_arr, rejected_param_list.size()); + for (unsigned int i = 0; i < rejected_param_list.size(); i++) { + bson_array_add_string(&bson_arr, + const_cast<char*>(rejected_param_list[i].c_str())); + } + BsonObject bson_nack_params; + bson_object_initialize_default(&bson_nack_params); + bson_object_put_array( + &bson_nack_params, protocol_handler::strings::rejected_params, &bson_arr); + std::vector<uint8_t> nack_params = + CreateVectorFromBsonObject(&bson_nack_params); + bson_object_deinitialize(&bson_nack_params); + + EXPECT_CALL(transport_manager_mock, + SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_NACK, + PROTECTION_OFF, + connection_id2, + Eq(nack_params)))) + .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS))); + times++; + + SendTMMessage(connection_id1, + PROTOCOL_VERSION_5, + PROTECTION_OFF, + FRAME_TYPE_CONTROL, + start_service, + FRAME_DATA_START_SERVICE, + session_id1, + params1.size(), + message_id, + params1.size() > 0 ? ¶ms1[0] : NULL); + + SendTMMessage(connection_id2, + PROTOCOL_VERSION_5, + PROTECTION_OFF, + FRAME_TYPE_CONTROL, + start_service, + FRAME_DATA_START_SERVICE, + session_id2, + params2.size(), + message_id, + params2.size() > 0 ? ¶ms2[0] : NULL); + + EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout)); + + bson_object_deinitialize(&bson_params1); + bson_object_deinitialize(&bson_params2); +} + // TODO(EZamakhov): add test for get_hash_id/set_hash_id from // protocol_handler_impl.cc /* @@ -500,12 +738,12 @@ TEST_F(ProtocolHandlerImplTest, EndSession_SessionObserverReject) { uint32_t times = 0; AddSession(waiter, times); - const ServiceType service = kRpc; // Expect ConnectionHandler check EXPECT_CALL(session_observer_mock, - OnSessionEndedCallback(connection_id, session_id, _, service)) + OnSessionEndedCallback( + connection_id, session_id, An<uint32_t*>(), service)) . // reject session start WillOnce( @@ -539,7 +777,8 @@ TEST_F(ProtocolHandlerImplTest, EndSession_Success) { // Expect ConnectionHandler check EXPECT_CALL(session_observer_mock, - OnSessionEndedCallback(connection_id, session_id, _, service)) + OnSessionEndedCallback( + connection_id, session_id, An<uint32_t*>(), service)) . // return sessions start success WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(connection_key))); @@ -565,6 +804,7 @@ TEST_F(ProtocolHandlerImplTest, EndSession_Success) { * Check session_observer with PROTECTION_OFF and Ack with PROTECTION_OFF */ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtocoloV1) { + using namespace protocol_handler; ::utils::SharedPtr<TestAsyncWaiter> waiter = utils::MakeShared<TestAsyncWaiter>(); uint32_t times = 0; @@ -575,13 +815,24 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtocoloV1) { AddSecurityManager(); const ServiceType start_service = kRpc; // Expect ConnectionHandler check - EXPECT_CALL( - session_observer_mock, - OnSessionStartedCallback( - connection_id, NEW_SESSION_ID, start_service, PROTECTION_OFF, _)) + EXPECT_CALL(session_observer_mock, + OnSessionStartedCallback(connection_id, + NEW_SESSION_ID, + start_service, + PROTECTION_OFF, + An<const BsonObject*>())) . // Return sessions start success - WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(session_id))); + WillOnce(DoAll( + NotifyTestAsyncWaiter(waiter), + InvokeMemberFuncWithArg6(protocol_handler_impl.get(), + &ProtocolHandler::NotifySessionStartedResult, + connection_id, + NEW_SESSION_ID, + session_id, + HASH_ID_WRONG, + PROTECTION_OFF, + ByRef(empty_rejected_param_)))); times++; SetProtocolVersion2(); @@ -610,6 +861,7 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtocoloV1) { * PROTECTION_OFF */ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionUnprotected) { + using namespace protocol_handler; AddConnection(); // Add security manager AddSecurityManager(); @@ -618,13 +870,24 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionUnprotected) { TestAsyncWaiter waiter; uint32_t times = 0; // Expect ConnectionHandler check - EXPECT_CALL( - session_observer_mock, - OnSessionStartedCallback( - connection_id, NEW_SESSION_ID, start_service, PROTECTION_OFF, _)) + EXPECT_CALL(session_observer_mock, + OnSessionStartedCallback(connection_id, + NEW_SESSION_ID, + start_service, + PROTECTION_OFF, + An<const BsonObject*>())) . // Return sessions start success - WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(session_id))); + WillOnce(DoAll( + NotifyTestAsyncWaiter(&waiter), + InvokeMemberFuncWithArg6(protocol_handler_impl.get(), + &ProtocolHandler::NotifySessionStartedResult, + connection_id, + NEW_SESSION_ID, + session_id, + HASH_ID_WRONG, + PROTECTION_OFF, + ByRef(empty_rejected_param_)))); times++; SetProtocolVersion2(); @@ -644,6 +907,7 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionUnprotected) { * ProtocolHandler shall send Ack with PROTECTION_OFF on fail SLL creation */ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_Fail) { + using namespace protocol_handler; AddConnection(); AddSecurityManager(); const ServiceType start_service = kRpc; @@ -651,13 +915,24 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_Fail) { TestAsyncWaiter waiter; uint32_t times = 0; // Expect ConnectionHandler check - EXPECT_CALL( - session_observer_mock, - OnSessionStartedCallback( - connection_id, NEW_SESSION_ID, start_service, PROTECTION_ON, _)) + EXPECT_CALL(session_observer_mock, + OnSessionStartedCallback(connection_id, + NEW_SESSION_ID, + start_service, + PROTECTION_ON, + An<const BsonObject*>())) . // Return sessions start success - WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(session_id))); + WillOnce(DoAll( + NotifyTestAsyncWaiter(&waiter), + InvokeMemberFuncWithArg6(protocol_handler_impl.get(), + &ProtocolHandler::NotifySessionStartedResult, + connection_id, + NEW_SESSION_ID, + session_id, + HASH_ID_WRONG, + PROTECTION_ON, + ByRef(empty_rejected_param_)))); times++; SetProtocolVersion2(); @@ -686,6 +961,7 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_Fail) { */ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_SSLInitialized) { + using namespace protocol_handler; AddConnection(); AddSecurityManager(); const ServiceType start_service = kRpc; @@ -693,13 +969,24 @@ TEST_F(ProtocolHandlerImplTest, TestAsyncWaiter waiter; uint32_t times = 0; // Expect ConnectionHandler check - EXPECT_CALL( - session_observer_mock, - OnSessionStartedCallback( - connection_id, NEW_SESSION_ID, start_service, PROTECTION_ON, _)) + EXPECT_CALL(session_observer_mock, + OnSessionStartedCallback(connection_id, + NEW_SESSION_ID, + start_service, + PROTECTION_ON, + An<const BsonObject*>())) . // Return sessions start success - WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(session_id))); + WillOnce(DoAll( + NotifyTestAsyncWaiter(&waiter), + InvokeMemberFuncWithArg6(protocol_handler_impl.get(), + &ProtocolHandler::NotifySessionStartedResult, + connection_id, + NEW_SESSION_ID, + session_id, + HASH_ID_WRONG, + PROTECTION_ON, + ByRef(empty_rejected_param_)))); times++; SetProtocolVersion2(); @@ -741,6 +1028,7 @@ TEST_F(ProtocolHandlerImplTest, */ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_HandshakeFail) { + using namespace protocol_handler; AddConnection(); AddSecurityManager(); const ServiceType start_service = kRpc; @@ -748,13 +1036,24 @@ TEST_F(ProtocolHandlerImplTest, TestAsyncWaiter waiter; uint32_t times = 0; // Expect ConnectionHandler check - EXPECT_CALL( - session_observer_mock, - OnSessionStartedCallback( - connection_id, NEW_SESSION_ID, start_service, PROTECTION_ON, _)) + EXPECT_CALL(session_observer_mock, + OnSessionStartedCallback(connection_id, + NEW_SESSION_ID, + start_service, + PROTECTION_ON, + An<const BsonObject*>())) . // Return sessions start success - WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(session_id))); + WillOnce(DoAll( + NotifyTestAsyncWaiter(&waiter), + InvokeMemberFuncWithArg6(protocol_handler_impl.get(), + &ProtocolHandler::NotifySessionStartedResult, + connection_id, + NEW_SESSION_ID, + session_id, + HASH_ID_WRONG, + PROTECTION_ON, + ByRef(empty_rejected_param_)))); times++; std::vector<int> services; @@ -816,6 +1115,7 @@ TEST_F(ProtocolHandlerImplTest, */ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_HandshakeSuccess) { + using namespace protocol_handler; AddConnection(); AddSecurityManager(); const ServiceType start_service = kRpc; @@ -828,13 +1128,24 @@ TEST_F(ProtocolHandlerImplTest, TestAsyncWaiter waiter; uint32_t times = 0; // Expect ConnectionHandler check - EXPECT_CALL( - session_observer_mock, - OnSessionStartedCallback( - connection_id, NEW_SESSION_ID, start_service, PROTECTION_ON, _)) + EXPECT_CALL(session_observer_mock, + OnSessionStartedCallback(connection_id, + NEW_SESSION_ID, + start_service, + PROTECTION_ON, + An<const BsonObject*>())) . // Return sessions start success - WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(session_id))); + WillOnce(DoAll( + NotifyTestAsyncWaiter(&waiter), + InvokeMemberFuncWithArg6(protocol_handler_impl.get(), + &ProtocolHandler::NotifySessionStartedResult, + connection_id, + NEW_SESSION_ID, + session_id, + HASH_ID_WRONG, + PROTECTION_ON, + ByRef(empty_rejected_param_)))); times++; // call new SSLContext creation @@ -902,6 +1213,7 @@ TEST_F(ProtocolHandlerImplTest, TEST_F( ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_HandshakeSuccess_ServiceProtectedBefore) { + using namespace protocol_handler; AddConnection(); AddSecurityManager(); const ServiceType start_service = kRpc; @@ -913,13 +1225,24 @@ TEST_F( TestAsyncWaiter waiter; uint32_t times = 0; // Expect ConnectionHandler check - EXPECT_CALL( - session_observer_mock, - OnSessionStartedCallback( - connection_id, NEW_SESSION_ID, start_service, PROTECTION_ON, _)) + EXPECT_CALL(session_observer_mock, + OnSessionStartedCallback(connection_id, + NEW_SESSION_ID, + start_service, + PROTECTION_ON, + An<const BsonObject*>())) . // Return sessions start success - WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(session_id))); + WillOnce(DoAll( + NotifyTestAsyncWaiter(&waiter), + InvokeMemberFuncWithArg6(protocol_handler_impl.get(), + &ProtocolHandler::NotifySessionStartedResult, + connection_id, + NEW_SESSION_ID, + session_id, + HASH_ID_WRONG, + PROTECTION_ON, + ByRef(empty_rejected_param_)))); times++; // call new SSLContext creation @@ -985,6 +1308,7 @@ TEST_F( */ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_HandshakeSuccess_SSLIsNotPending) { + using namespace protocol_handler; AddConnection(); AddSecurityManager(); const ServiceType start_service = kRpc; @@ -996,13 +1320,24 @@ TEST_F(ProtocolHandlerImplTest, TestAsyncWaiter waiter; uint32_t times = 0; // Expect ConnectionHandler check - EXPECT_CALL( - session_observer_mock, - OnSessionStartedCallback( - connection_id, NEW_SESSION_ID, start_service, PROTECTION_ON, _)) + EXPECT_CALL(session_observer_mock, + OnSessionStartedCallback(connection_id, + NEW_SESSION_ID, + start_service, + PROTECTION_ON, + An<const BsonObject*>())) . // Return sessions start success - WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(session_id))); + WillOnce(DoAll( + NotifyTestAsyncWaiter(&waiter), + InvokeMemberFuncWithArg6(protocol_handler_impl.get(), + &ProtocolHandler::NotifySessionStartedResult, + connection_id, + NEW_SESSION_ID, + session_id, + HASH_ID_WRONG, + PROTECTION_ON, + ByRef(empty_rejected_param_)))); times++; // call new SSLContext creation diff --git a/src/components/protocol_handler/test/protocol_header_validator_test.cc b/src/components/protocol_handler/test/protocol_header_validator_test.cc index 40b0f34846..e42ba96251 100644 --- a/src/components/protocol_handler/test/protocol_header_validator_test.cc +++ b/src/components/protocol_handler/test/protocol_header_validator_test.cc @@ -57,7 +57,7 @@ class ProtocolHeaderValidatorTest : public ::testing::Test { uint32_t some_session_id; }; -// Protocol version shall be from 1 to 3 +// Protocol version shall be from 1 to 5 TEST_F(ProtocolHeaderValidatorTest, MaxPayloadSizeSetGet) { EXPECT_EQ(std::numeric_limits<size_t>::max(), header_validator.max_payload_size()); @@ -67,11 +67,96 @@ TEST_F(ProtocolHeaderValidatorTest, MaxPayloadSizeSetGet) { } } -// Protocol version shall be from 1 to 4 +TEST_F(ProtocolHeaderValidatorTest, MaxControlPayloadSizeSetGet) { + EXPECT_EQ(0u, header_validator.max_control_payload_size()); + for (size_t value = 0; value < MAXIMUM_FRAME_DATA_V3_SIZE * 2; ++value) { + header_validator.set_max_control_payload_size(value); + EXPECT_EQ(value, header_validator.max_control_payload_size()); + } +} + +TEST_F(ProtocolHeaderValidatorTest, MaxRpcPayloadSizeSetGet) { + EXPECT_EQ(0u, header_validator.max_rpc_payload_size()); + for (size_t value = 0; value < MAXIMUM_FRAME_DATA_V3_SIZE * 2; ++value) { + header_validator.set_max_rpc_payload_size(value); + EXPECT_EQ(value, header_validator.max_rpc_payload_size()); + } +} + +TEST_F(ProtocolHeaderValidatorTest, MaxAudioPayloadSizeSetGet) { + EXPECT_EQ(0u, header_validator.max_audio_payload_size()); + for (size_t value = 0; value < MAXIMUM_FRAME_DATA_V3_SIZE * 2; ++value) { + header_validator.set_max_audio_payload_size(value); + EXPECT_EQ(value, header_validator.max_audio_payload_size()); + } +} + +TEST_F(ProtocolHeaderValidatorTest, MaxVideoPayloadSizeSetGet) { + EXPECT_EQ(0u, header_validator.max_video_payload_size()); + for (size_t value = 0; value < MAXIMUM_FRAME_DATA_V3_SIZE * 2; ++value) { + header_validator.set_max_video_payload_size(value); + EXPECT_EQ(value, header_validator.max_video_payload_size()); + } +} + +TEST_F(ProtocolHeaderValidatorTest, GetMaxPayloadSizeByServiceType_Control) { + size_t payload_size = MAXIMUM_FRAME_DATA_V2_SIZE; + header_validator.set_max_payload_size(payload_size); + // Default to max_payload_size if a specific MTU is not set + EXPECT_EQ(payload_size, + header_validator.max_payload_size_by_service_type(kControl)); + for (size_t value = 1; value < MAXIMUM_FRAME_DATA_V3_SIZE * 2; ++value) { + header_validator.set_max_control_payload_size(value); + EXPECT_EQ(value, + header_validator.max_payload_size_by_service_type(kControl)); + } +} + +TEST_F(ProtocolHeaderValidatorTest, GetMaxPayloadSizeByServiceType_Rpc) { + size_t payload_size = MAXIMUM_FRAME_DATA_V2_SIZE; + header_validator.set_max_payload_size(payload_size); + // Default to max_payload_size if a specific MTU is not set + EXPECT_EQ(payload_size, + header_validator.max_payload_size_by_service_type(kRpc)); + EXPECT_EQ(payload_size, + header_validator.max_payload_size_by_service_type(kBulk)); + for (size_t value = 1; value < MAXIMUM_FRAME_DATA_V3_SIZE * 2; ++value) { + header_validator.set_max_rpc_payload_size(value); + EXPECT_EQ(value, header_validator.max_payload_size_by_service_type(kRpc)); + EXPECT_EQ(value, header_validator.max_payload_size_by_service_type(kBulk)); + } +} + +TEST_F(ProtocolHeaderValidatorTest, GetMaxPayloadSizeByServiceType_Audio) { + size_t payload_size = MAXIMUM_FRAME_DATA_V2_SIZE; + header_validator.set_max_payload_size(payload_size); + // Default to max_payload_size if a specific MTU is not set + EXPECT_EQ(payload_size, + header_validator.max_payload_size_by_service_type(kAudio)); + for (size_t value = 1; value < MAXIMUM_FRAME_DATA_V3_SIZE * 2; ++value) { + header_validator.set_max_audio_payload_size(value); + EXPECT_EQ(value, header_validator.max_payload_size_by_service_type(kAudio)); + } +} + +TEST_F(ProtocolHeaderValidatorTest, GetMaxPayloadSizeByServiceType_Video) { + size_t payload_size = MAXIMUM_FRAME_DATA_V2_SIZE; + header_validator.set_max_payload_size(payload_size); + // Default to max_payload_size if a specific MTU is not set + EXPECT_EQ(payload_size, + header_validator.max_payload_size_by_service_type(kMobileNav)); + for (size_t value = 1; value < MAXIMUM_FRAME_DATA_V3_SIZE * 2; ++value) { + header_validator.set_max_video_payload_size(value); + EXPECT_EQ(value, + header_validator.max_payload_size_by_service_type(kMobileNav)); + } +} + +// Protocol version shall be from 1 to 5 TEST_F(ProtocolHeaderValidatorTest, Malformed_Version) { std::vector<uint8_t> malformed_versions; malformed_versions.push_back(0); - for (uint8_t version = PROTOCOL_VERSION_4 + 1; + for (uint8_t version = PROTOCOL_VERSION_5 + 1; version <= PROTOCOL_VERSION_MAX; ++version) { malformed_versions.push_back(version); diff --git a/src/components/protocol_handler/test/protocol_packet_test.cc b/src/components/protocol_handler/test/protocol_packet_test.cc index 7819c4b5b0..71c7726243 100644 --- a/src/components/protocol_handler/test/protocol_packet_test.cc +++ b/src/components/protocol_handler/test/protocol_packet_test.cc @@ -125,7 +125,9 @@ TEST_F(ProtocolPacketTest, SerializePacketWithDiffServiceType) { for (size_t i = 0; i < serv_types.size(); ++i) { RawMessagePtr res = GetRawMessage(PROTOCOL_VERSION_3, FRAME_TYPE_CONTROL, serv_types[i]); - EXPECT_EQ(PROTOCOL_VERSION_3, res->protocol_version()); + EXPECT_EQ(PROTOCOL_VERSION_3, + static_cast< ::protocol_handler::MajorProtocolVersion>( + res->protocol_version())); EXPECT_EQ(serv_types[i], res->service_type()); EXPECT_EQ(PROTOCOL_HEADER_V2_SIZE, res->data_size()); } @@ -146,7 +148,9 @@ TEST_F(ProtocolPacketTest, SerializePacketWithWrongServiceType) { for (size_t i = 0; i < serv_types.size(); ++i) { RawMessagePtr res = GetRawMessage(PROTOCOL_VERSION_3, FRAME_TYPE_CONTROL, serv_types[i]); - EXPECT_EQ(PROTOCOL_VERSION_3, res->protocol_version()); + EXPECT_EQ(PROTOCOL_VERSION_3, + static_cast< ::protocol_handler::MajorProtocolVersion>( + res->protocol_version())); EXPECT_EQ(kInvalidServiceType, res->service_type()); } } @@ -156,7 +160,9 @@ TEST_F(ProtocolPacketTest, SetPacketWithDiffFrameType) { for (frame_type = FRAME_TYPE_CONTROL + 1; frame_type <= FRAME_TYPE_MAX_VALUE; ++frame_type) { RawMessagePtr res = GetRawMessage(PROTOCOL_VERSION_3, frame_type, kControl); - EXPECT_EQ(PROTOCOL_VERSION_3, res->protocol_version()); + EXPECT_EQ(PROTOCOL_VERSION_3, + static_cast< ::protocol_handler::MajorProtocolVersion>( + res->protocol_version())); EXPECT_EQ(kControl, res->service_type()); } } diff --git a/src/components/remote_control/CMakeLists.txt b/src/components/remote_control/CMakeLists.txt new file mode 100644 index 0000000000..a320273a1e --- /dev/null +++ b/src/components/remote_control/CMakeLists.txt @@ -0,0 +1,83 @@ +set(target "RemoteControlModule") +set(install_destination ${CMAKE_BINARY_DIR}/bin/plugins) +if (ENABLE_GCOV) + set(GCOV_FLAGS "-ftest-coverage -fprofile-arcs") +else() + set(GCOV_FLAGS "") +endif() + +if (CMAKE_BUILD_TYPE) + if (${CMAKE_BUILD_TYPE} STREQUAL "Release") + set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG") + set(CMAKE_CXX_FLAGS_DEBUG "") + else () + set(CMAKE_CXX_FLAGS_RELEASE "") + set(CMAKE_CXX_FLAGS_DEBUG "-g3 -ggdb3 -DDEBUG") + endif() +endif() + +include_directories ( + ${COMPONENTS_DIR}/include/ + ${COMPONENTS_DIR}/application_manager/include + ${COMPONENTS_DIR}/remote_control/include/ + ${COMPONENTS_DIR}/connection_handler/include/ + ${COMPONENTS_DIR}/protocol_handler/include/ + ${COMPONENTS_DIR}/functional_module/include/ + ${COMPONENTS_DIR}/config_profile/include/ + + ${COMPONENTS_DIR}/hmi_message_handler/include/ + ${COMPONENTS_DIR}/formatters/include/ + ${POLICY_PATH}/include/ + ${POLICY_GLOBAL_INCLUDE_PATH}/ + ${COMPONENTS_DIR}/rpc_base/include/ + ${COMPONENTS_DIR}/application_manager/test/include/ + + ${COMPONENTS_DIR}/smart_objects/include/ + ${COMPONENTS_DIR}/utils/include/ + ${JSONCPP_INCLUDE_DIRECTORY} + ${LOG4CXX_INCLUDE_DIRECTORY} + ${CMAKE_BINARY_DIR}/src/components/ +) + +set (RC_SOURCE_DIR ${COMPONENTS_DIR}/remote_control/src) +set (RC_TEST_DIR ${COMPONENTS_DIR}/remote_control/test) +set (RC_COMMANDS_DIR ${RC_SOURCE_DIR}/commands) + +collect_sources(RC_SOURCES "${RC_SOURCE_DIR}") +collect_sources(RC_COMMANDS_SOURCES "${RC_COMMANDS_DIR}") + +set (SOURCES + ${RC_SOURCES} + ${RC_COMMANDS_SOURCES} +) + +set (LIBRARIES + jsoncpp + FunctionalModule + Utils + ConfigProfile +) + +add_library(${target} SHARED ${SOURCES}) +target_link_libraries(${target} ${LIBRARIES} ) + +if(ENABLE_LOG) + target_link_libraries(${target} log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) +endif() + + +install(TARGETS ${target} + DESTINATION ${install_destination} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE + GROUP_READ GROUP_EXECUTE + WORLD_READ WORLD_EXECUTE +) + +install( + FILES ${FILES_FOR_COPY} + DESTINATION ${install_destination} +) + +if(BUILD_TESTS) + add_subdirectory(test) +endif() diff --git a/src/components/remote_control/include/remote_control/commands/base_command_notification.h b/src/components/remote_control/include/remote_control/commands/base_command_notification.h new file mode 100644 index 0000000000..578afad67b --- /dev/null +++ b/src/components/remote_control/include/remote_control/commands/base_command_notification.h @@ -0,0 +1,110 @@ +/* + Copyright (c) 2017, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_BASE_COMMAND_NOTIFICATION_H_ +#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_BASE_COMMAND_NOTIFICATION_H_ + +#include "remote_control/commands/command.h" +#include "application_manager/message.h" +#include "application_manager/service.h" +#include "remote_control/rc_app_extension.h" +#include "remote_control/remote_plugin_interface.h" +#include "utils/logger.h" + +namespace Json { +class Value; +} + +namespace remote_control { + +namespace commands { + +/** + * @brief Base command class for notifications + */ +class BaseCommandNotification : public Command { + public: + /** + * @brief BaseCommandNotification class constructor + * + * @param message Message from mobile + **/ + BaseCommandNotification(const application_manager::MessagePtr& message, + RemotePluginInterface& rc_module); + + /** + * @brief BaseCommandNotification class destructor + */ + virtual ~BaseCommandNotification(); + + /** + * \brief BaseCommandNotification on timeout reaction + */ + virtual void OnTimeout() {} + + void Run(); + + protected: + application_manager::MessagePtr message() { + return message_; + } + application_manager::ServicePtr service_; + + RCAppExtensionPtr GetAppExtension( + application_manager::ApplicationSharedPtr app) const; + + /** + * @brief executes specific logic of children classes + */ + virtual void Execute() = 0; + + /** + * @brief Validates notification by xml schema + */ + virtual bool Validate(); + + virtual std::string ModuleType(const Json::Value& message); + virtual std::vector<std::string> ControlData(const Json::Value& message); + + void NotifyOneApplication(application_manager::MessagePtr message); + + private: + void NotifyApplications(); + bool CheckPolicy(application_manager::MessagePtr message); + application_manager::MessagePtr message_; +}; + +} // namespace commands + +} // namespace remote_control + +#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_BASE_COMMAND_NOTIFICATION_H_ diff --git a/src/components/remote_control/include/remote_control/commands/base_command_request.h b/src/components/remote_control/include/remote_control/commands/base_command_request.h new file mode 100644 index 0000000000..64128b971e --- /dev/null +++ b/src/components/remote_control/include/remote_control/commands/base_command_request.h @@ -0,0 +1,293 @@ +/* + Copyright (c) 2017, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_BASE_COMMAND_REQUEST_H_ +#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_BASE_COMMAND_REQUEST_H_ + +#include "remote_control/commands/command.h" +#include "remote_control/event_engine/event_observer.h" +#include "application_manager/message.h" +#include "application_manager/service.h" +#include "utils/logger.h" +#include "interfaces/HMI_API.h" +#include "remote_control/rc_app_extension.h" +#include "json/json.h" +#include "remote_control/remote_plugin_interface.h" + +namespace remote_control { + +namespace commands { + +// Forward declaration to make this struct friend to BaseCommandRequest +struct OnDriverAnswerCallback; + +/** + * @brief Base command class for requests + */ +class BaseCommandRequest + : public Command, + public rc_event_engine::EventObserver<application_manager::MessagePtr, + std::string> { + public: + /** + * @brief BaseCommandRequest class constructor + * + * @param message Message from mobile + **/ + BaseCommandRequest(const application_manager::MessagePtr& message, + RemotePluginInterface& rc_module); + + /** + * @brief BaseCommandRequest class destructor + */ + virtual ~BaseCommandRequest(); + + /** + * @brief BaseCommandRequest on timeout reaction + */ + virtual void OnTimeout(); + + void Run(); + void on_event(const rc_event_engine::Event<application_manager::MessagePtr, + std::string>& event); + + /** + * @brief Generates correct request to HMI + * @param function_id request ID + * @param msg_params json with message params + * @return generated request shared ptr + */ + application_manager::MessagePtr CreateHmiRequest( + const char* function_id, const Json::Value& message_params); + + /** + * @brief Prepares response for sending to mobile + * Adds necessary fields to message + * @param success true if successful; false, if failed + * @param result_code Mobile result code in string ("SUCCESS", "INVALID_DATA", + * e.t.c) + * @param info Provides additional human readable info regarding the + *result(may be empty) + */ + void PrepareResponse(const bool success, + const char* result_code, + const std::string& info); + + protected: + application_manager::MessagePtr message_; + Json::Value response_params_; + + /** + * @brief AcquireResource try to allocate resource for application + * In case if allocation of resource is not required, return ALLOWED by + * default. + * This method should be overrided in RPCs that requires resource allocation + * @return result of resource allocation, in case if allocation os not + * required, return ALLOWED + */ + virtual AcquireResult::eType AcquireResource(const Json::Value&) { + return AcquireResult::ALLOWED; + } + + /** + * @brief IsResourceFree check resource state + * This is default implementation which has to be redefined for RPCs which + * need to manage the resources + * @param module_type Resource name + * @return True if free, otherwise - false + */ + virtual bool IsResourceFree(const std::string& module_type) const { + UNUSED(module_type); + return true; + } + + /** + * @brief SetResourceState changes state of resource + * This is default implementation which has to be redefined for RPCs which + * need to manage the resources + * @param Message containing type of module to extract + * @param State to set for resource + */ + virtual void SetResourceState(const Json::Value&, + const ResourceState::eType) {} + + /** + * @brief Get extension for specified application. If extension doesn't exist, + * it will be created + * @param app pointer to application + * @return pointer to extension + */ + RCAppExtensionPtr GetAppExtension( + application_manager::ApplicationSharedPtr app) const; + + /** + * @brief Converts HMI result code to string with mobile result code + * + * @param hmi_code HMI result code + * @return String with mobile result code + */ + const char* GetMobileResultCode( + const hmi_apis::Common_Result::eType& hmi_code) const; + + /** + * @brief Sends Mobile response + * @param success true if successful; false, if failed + * @param result_code Mobile result code in string ("SUCCESS", "INVALID_DATA", + *e.t.c) + * @param info Provides additional human readable info regarding the + *result(may be empty) + */ + void SendResponse(const bool success, + const char* result_code, + const std::string& info); + + /** + * @brief Parse result code from response + * + * @param message Response from HMI or Can + * @param result_code Outgoing param with mobile result code in string + *("SUCCESS", "INVALID_DATA", e.t.c) + * @param info Outgoing param with additional human readable info regarding + *the result(may be empty) + * @return true if it is success response? otherwise false + */ + bool ParseResultCode(const Json::Value& value, + std::string& result_code, + std::string& info); + + /** + * @brief Sends request to HMI + * @param message_to_send to send + */ + void SendMessageToHMI(const application_manager::MessagePtr& message_to_send); + + /** + * @brief Sends request to CAN or HMI + * @param function_id request ID + * @param msg_params json with message params + */ + void SendRequest(const char* function_id, const Json::Value& message_params); + + application_manager::ApplicationSharedPtr app() { + DCHECK(app_); + return app_; + } + + /** + * @brief executes specific logic of children classes + */ + void virtual Execute() = 0; + + /** + * @brief Validates request by xml schema + */ + bool Validate(); + + /* + * @brief Parses incoming string into Json + * @param parsed_mgs Resulting json object (must be valid pointer) + * @returns True if json string was valid false otherwise. + */ + virtual bool ParseJsonString(Json::Value* parsed_msg); + + /** + * @brief Interface method that is called whenever new event received + * @param event The received event + */ + void virtual OnEvent( + const rc_event_engine::Event<application_manager::MessagePtr, + std::string>& event) = 0; + + virtual std::string ModuleType(const Json::Value& message); + virtual std::vector<std::string> ControlData(const Json::Value& message); + virtual application_manager::TypeAccess CheckModule( + const Json::Value& message); + + bool auto_allowed() const { + return auto_allowed_; + } + + void set_auto_allowed(bool value) { + auto_allowed_ = value; + } + + application_manager::ServicePtr service() { + return service_; + } + + void set_disallowed_info(const std::string& info) { + disallowed_info_ = info; + } + + private: + /** + * @brief CheckPolicyPermissions checks RPC permissions defined in policy + * table + * @return True if RPC is allowed, otherwise - false + */ + bool CheckPolicyPermissions(); + + /** + * @brief CheckDriverConsent checks driver consent defined in policy table + * @return True if no consent is required, otherwise - false + */ + bool CheckDriverConsent(); + + /** + * @brief AcquireResources checks whether resource status is busy or not and + * then tries to acquire this resource. In case driver consent is required - + * sends consent request to HMI. + * @return True in case of resource is free and successfully acquired, + * otherwise false + */ + bool AcquireResources(); + inline bool IsAutoAllowed(application_manager::TypeAccess access) const; + void SendDisallowed(application_manager::TypeAccess access); + void SendGetUserConsent(const Json::Value& value); + void ProcessAccessResponse( + const rc_event_engine::Event<application_manager::MessagePtr, + std::string>& event); + + const Json::Value msg_json_; + application_manager::ApplicationSharedPtr app_; + application_manager::ServicePtr service_; + bool auto_allowed_; + std::string disallowed_info_; + + friend struct OnDriverAnswerCallback; +}; + +} // namespace commands + +} // namespace remote_control + +#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_BASE_COMMAND_REQUEST_H_ diff --git a/src/components/remote_control/include/remote_control/commands/button_press_request.h b/src/components/remote_control/include/remote_control/commands/button_press_request.h new file mode 100644 index 0000000000..945f98bdc8 --- /dev/null +++ b/src/components/remote_control/include/remote_control/commands/button_press_request.h @@ -0,0 +1,104 @@ +/* + Copyright (c) 2017, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_BUTTON_PRESS_REQUEST_H_ +#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_BUTTON_PRESS_REQUEST_H_ + +#include "remote_control/commands/base_command_request.h" +#include "remote_control/event_engine/event.h" +#include "utils/macro.h" + +namespace remote_control { + +namespace commands { + +/** + * @brief ButtonPressRequest command class + */ +class ButtonPressRequest : public BaseCommandRequest { + public: + /** + * @brief ButtonPressRequest class constructor + * + * @param message Message from mobile + **/ + ButtonPressRequest(const application_manager::MessagePtr& message, + RemotePluginInterface& rc_module); + /** + * @brief Execute command + */ + void Execute() FINAL; + + /** + * @brief AcquireResource Tries to acquire specific resource + * @param message Incoming message containg the resource name + * @return Acquire result + */ + AcquireResult::eType AcquireResource( + const Json::Value& message) OVERRIDE FINAL; + + /** + * @brief IsResourceFree check resource state + * @param module_type Resource name + * @return True if free, otherwise - false + */ + bool IsResourceFree(const std::string& module_type) const FINAL; + + /** + * @brief SetResourceState changes state of resource + * @param state State to set for resource + */ + void SetResourceState(const Json::Value& message, + const ResourceState::eType state) FINAL; + + /** + * @brief Interface method that is called whenever new event received + * + * @param event The received event + */ + void OnEvent(const rc_event_engine::Event<application_manager::MessagePtr, + std::string>& event); + + /** + * @brief ButtonPressRequest class destructor + */ + virtual ~ButtonPressRequest(); + + protected: + std::string ModuleType(const Json::Value& message) FINAL; +}; + +} // namespace commands + +} // namespace remote_control + +#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_BUTTON_PRESS_REQUEST_H_ diff --git a/src/components/remote_control/include/remote_control/commands/command.h b/src/components/remote_control/include/remote_control/commands/command.h new file mode 100644 index 0000000000..0e03f8b330 --- /dev/null +++ b/src/components/remote_control/include/remote_control/commands/command.h @@ -0,0 +1,84 @@ +/* + Copyright (c) 2017, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_COMMAND_H_ +#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_COMMAND_H_ + +#include "utils/shared_ptr.h" +#include "remote_control/remote_plugin_interface.h" +#include "remote_control/event_engine/event.h" + +namespace remote_control { + +class RemotePluginInterface; + +namespace commands { + +/** + * @brief Command interface + **/ +class Command { + public: + /** + * @brief Execute command + */ + virtual void Run() = 0; + + /** + * \brief Command class destructor + */ + virtual ~Command() {} + + /** + * \brief Command on timeout reaction + */ + virtual void OnTimeout() = 0; + + /** + * @brief Interface method that is called whenever new event received + * @param event The received event + */ + virtual void on_event( + const rc_event_engine::Event<application_manager::MessagePtr, + std::string>& event) {} + + protected: + Command(RemotePluginInterface& rc_module) : rc_module_(rc_module) {} + + RemotePluginInterface& rc_module_; +}; + +} // namespace commands + +} // namespace remote_control + +#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_COMMAND_H_ diff --git a/src/components/remote_control/include/remote_control/commands/get_interior_vehicle_data_request.h b/src/components/remote_control/include/remote_control/commands/get_interior_vehicle_data_request.h new file mode 100644 index 0000000000..220f7da979 --- /dev/null +++ b/src/components/remote_control/include/remote_control/commands/get_interior_vehicle_data_request.h @@ -0,0 +1,101 @@ +/* + Copyright (c) 2017, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_GET_INTERIOR_VEHICLE_DATA_REQUEST_H_ +#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_GET_INTERIOR_VEHICLE_DATA_REQUEST_H_ + +#include "remote_control/commands/base_command_request.h" +#include "remote_control/event_engine/event.h" +#include "utils/macro.h" + +namespace remote_control { + +namespace commands { + +/** + * @brief GetInteriorVehicleDataRequest command class + */ +class GetInteriorVehicleDataRequest : public BaseCommandRequest { + public: + /** + * @brief GetInteriorVehicleDataRequest class constructor + * + * @param message Message from mobile + **/ + explicit GetInteriorVehicleDataRequest( + const application_manager::MessagePtr& message, + RemotePluginInterface& rc_module); + + /** + * @brief Execute command + */ + void Execute() FINAL; + + /** + * @brief Interface method that is called whenever new event received + * + * @param event The received event + */ + void OnEvent(const rc_event_engine::Event<application_manager::MessagePtr, + std::string>& event); + + /** + * @brief Check if app wants to proceed with already setup subscription + * @param request_params request parameters to check + * @return true if app already subscribed(unsubsribed) for module type but + * wants to subscribe(unsubscribe) for the same module again + * otherwise - false + */ + bool HasRequestExcessiveSubscription(const Json::Value& request_params); + + protected: + virtual std::string ModuleType(const Json::Value& message); + + private: + /** + * @brief Handle subscription to vehicle data + * @param hmi_response json message with response from HMI + */ + void ProccessSubscription(const Json::Value& hmi_response); + + /** + * @brief Cuts off subscribe parameter + * @param request_params request parameters to handle + */ + void RemoveExcessiveSubscription(Json::Value& request_params); +}; + +} // namespace commands + +} // namespace remote_control + +#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_GET_INTERIOR_VEHICLE_DATA_REQUEST_H_ diff --git a/src/components/remote_control/include/remote_control/commands/on_interior_vehicle_data_notification.h b/src/components/remote_control/include/remote_control/commands/on_interior_vehicle_data_notification.h new file mode 100644 index 0000000000..4ee9ce4709 --- /dev/null +++ b/src/components/remote_control/include/remote_control/commands/on_interior_vehicle_data_notification.h @@ -0,0 +1,75 @@ +/* + Copyright (c) 2017, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_ON_INTERIOR_VEHICLE_DATA_NOTIFICATION_H_ +#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_ON_INTERIOR_VEHICLE_DATA_NOTIFICATION_H_ + +#include "utils/macro.h" +#include "remote_control/commands/base_command_notification.h" + +namespace remote_control { + +namespace commands { + +/** + * @brief OnInteriorVehicleDataNotification command class + */ +class OnInteriorVehicleDataNotification : public BaseCommandNotification { + public: + /** + * @brief OnInteriorVehicleDataNotification class constructor + * + * @param message Message with notification + **/ + OnInteriorVehicleDataNotification( + const application_manager::MessagePtr& message, + RemotePluginInterface& rc_module); + + /** + * @brief Execute command + */ + void Execute() FINAL; + + /** + * @brief OnInteriorVehicleDataNotification class destructor + */ + virtual ~OnInteriorVehicleDataNotification(); + + protected: + std::string ModuleType(const Json::Value& message) FINAL; +}; + +} // namespace commands + +} // namespace remote_control + +#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_ON_INTERIOR_VEHICLE_DATA_NOTIFICATION_H_ diff --git a/src/components/remote_control/include/remote_control/commands/on_remote_control_settings_notification.h b/src/components/remote_control/include/remote_control/commands/on_remote_control_settings_notification.h new file mode 100644 index 0000000000..ef248a2b38 --- /dev/null +++ b/src/components/remote_control/include/remote_control/commands/on_remote_control_settings_notification.h @@ -0,0 +1,79 @@ +/* + Copyright (c) 2017, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_ON_REMOTE_CONTROL_SETTINGS_NOTIFICATION_H_ +#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_ON_REMOTE_CONTROL_SETTINGS_NOTIFICATION_H_ + +#include "utils/macro.h" +#include "remote_control/commands/base_command_notification.h" + +namespace remote_control { + +namespace commands { + +/** + * @brief OnRemoteControlSettingsNotification command class + */ +class OnRemoteControlSettingsNotification : public BaseCommandNotification { + public: + /** + * @brief OnRemoteControlSettingsNotification class constructor + * + * @param message Message with notification + * @param rc_module Module used for handling RC functionality + **/ + OnRemoteControlSettingsNotification( + const application_manager::MessagePtr& message, + RemotePluginInterface& rc_module); + + /** + * @brief Execute command + */ + void Execute() FINAL; + + private: + /** + * @brief Disalows RC functionality for all RC apps + * All registered apps with appHMIType REMOTE_CONTROL will be put to NONE hmi + * level + * OnHMIStatus (NONE) will be send to such apps + * All registered apps will be unsubsribed from OnInteriorVehicleData + * notifications + */ + void DisallowRCFunctionality(); +}; + +} // namespace commands + +} // namespace remote_control + +#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_ON_REMOTE_CONTROL_SETTINGS_NOTIFICATION_H_ diff --git a/src/components/remote_control/include/remote_control/commands/set_interior_vehicle_data_request.h b/src/components/remote_control/include/remote_control/commands/set_interior_vehicle_data_request.h new file mode 100644 index 0000000000..bc1e3942e5 --- /dev/null +++ b/src/components/remote_control/include/remote_control/commands/set_interior_vehicle_data_request.h @@ -0,0 +1,127 @@ +/* + Copyright (c) 2017, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_SET_INTERIOR_VEHICLE_DATA_REQUEST_H_ +#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_SET_INTERIOR_VEHICLE_DATA_REQUEST_H_ + +#include "remote_control/commands/base_command_request.h" +#include "remote_control/event_engine/event.h" +#include "utils/macro.h" + +namespace remote_control { + +namespace commands { + +/** + * @brief SetInteriorVehicleDataRequest command class + */ +class SetInteriorVehicleDataRequest : public BaseCommandRequest { + public: + /** + * @brief SetInteriorVehicleDataRequest class constructor + * + * @param message Message from mobile + * @param rc_module Module used for handling RC functionality + **/ + SetInteriorVehicleDataRequest(const application_manager::MessagePtr& message, + RemotePluginInterface& rc_module); + + /** + * @brief Execute command + */ + void Execute() FINAL; + + /** + * @brief AcquireResource proxy AcquireResource to Resource allocation manager + * @param message message of requires contatin module types + * @return result of acauiring resources + */ + AcquireResult::eType AcquireResource( + const Json::Value& message) OVERRIDE FINAL; + + /** + * @brief IsResourceFree check resource state + * @param module_type Resource name + * @return True if free, otherwise - false + */ + bool IsResourceFree(const std::string& module_type) const FINAL; + + /** + * @brief SetResourceState changes state of resource + * @param state State to set for resource + */ + void SetResourceState(const Json::Value& message, + const ResourceState::eType state) FINAL; + + /** + * @brief Interface method that is called whenever new event received + * + * @param event The received event + */ + void OnEvent(const rc_event_engine::Event<application_manager::MessagePtr, + std::string>& event) OVERRIDE; + /** + * @brief Method that check if READ_ONLY parameters present + * @param request_params params from received message + * @return true if present , false - otherwise + */ + bool AreReadOnlyParamsPresent(const Json::Value& request_params); + + /** + * @brief Method that check if all request parameters are READ_ONLY + * @param request_params params from received message + * @return true if all are read only , false - otherwise + */ + bool AreAllParamsReadOnly(const Json::Value& request_params); + + /** + * @brief Method that cuts-off READ_ONLY parameters + * @param request_params params to handle + */ + void CutOffReadOnlyParams(Json::Value& request_params); + + /** + * @brief SetInteriorVehicleDataRequest class destructor + */ + virtual ~SetInteriorVehicleDataRequest(); + + protected: + virtual std::string ModuleType(const Json::Value& message) FINAL; + virtual std::vector<std::string> ControlData( + const Json::Value& message) FINAL; +}; + +} // namespace commands + +} // namespace remote_control + +#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_SET_INTERIOR_VEHICLE_DATA_REQUEST_H_ diff --git a/src/components/remote_control/include/remote_control/event_engine/event.h b/src/components/remote_control/include/remote_control/event_engine/event.h new file mode 100644 index 0000000000..0da248e5a7 --- /dev/null +++ b/src/components/remote_control/include/remote_control/event_engine/event.h @@ -0,0 +1,127 @@ +/* + Copyright (c) 2017, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_EVENT_ENGINE_EVENT_H_ +#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_EVENT_ENGINE_EVENT_H_ + +#include <string> +#include "remote_control/event_engine/event_dispatcher.h" +#include "utils/shared_ptr.h" +#include "application_manager/message.h" + +namespace rc_event_engine { + +template <typename EventMessage, typename EventID> +class EventDispatcher; + +template <typename EventMessage, typename EventID> +class Event { + public: + /* + * @brief Constructor with parameters + * + * @param id Event ID. + * @param message Message received in event + */ + Event(EventMessage& message, const EventID& id); + + /* + * @brief Destructor + */ + virtual ~Event() {} + + /* + * @brief Provides event ID + */ + inline const EventID& id() const; + + /* + * @brief Sets event message + * + * @param message The message received in event + */ + void set_event_message(EventMessage& message); + + /* + * @brief Retrieves event message + * + * @return The message received in event + */ + inline const EventMessage& event_message() const; + + /* + * @brief Retrieves event message request ID + */ + virtual int32_t event_message_function_id() const = 0; + + /* + * @brief Retrieves event message correlation ID + */ + virtual int32_t event_message_correlation_id() const = 0; + + /* + * @brief Retrieves event message response type + */ + virtual int32_t event_message_type() const = 0; + + void raise(EventDispatcher<EventMessage, EventID>& event_dispatcher); + + protected: + EventMessage event_message_; + + private: + EventID id_; +}; + +template <typename EventMessage, typename EventID> +const EventID& Event<EventMessage, EventID>::id() const { + return id_; +} + +template <typename EventMessage, typename EventID> +const EventMessage& Event<EventMessage, EventID>::event_message() const { + return event_message_; +} + +template <typename EventMessage, typename EventID> +Event<EventMessage, EventID>::Event(EventMessage& message, const EventID& id) + : event_message_(message), id_(id) {} + +template <typename EventMessage, typename EventID> +void Event<EventMessage, EventID>::raise( + EventDispatcher<EventMessage, EventID>& event_dispatcher) { + event_dispatcher.raise_event(*this); +} + +} // namespace event_engine + +#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_EVENT_ENGINE_EVENT_H_ diff --git a/src/components/remote_control/include/remote_control/event_engine/event_dispatcher.h b/src/components/remote_control/include/remote_control/event_engine/event_dispatcher.h new file mode 100644 index 0000000000..ddee6caccc --- /dev/null +++ b/src/components/remote_control/include/remote_control/event_engine/event_dispatcher.h @@ -0,0 +1,203 @@ +/* + Copyright (c) 2017, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_EVENT_ENGINE_EVENT_DISPATCHER_H_ +#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_EVENT_ENGINE_EVENT_DISPATCHER_H_ + +#include <list> +#include <map> + +#include "utils/lock.h" + +#include "remote_control/event_engine/event.h" +#include "remote_control/event_engine/event_observer.h" + +#include "interfaces/HMI_API.h" + +namespace rc_event_engine { + +template <typename EventMessage, typename EventID> +class Event; + +template <typename EventMessage, typename EventID> +class EventObserver; + +template <typename EventMessage, typename EventID> +class EventDispatcher { + public: + /** + * @brief Default constructor + */ + EventDispatcher(); + + /** + * @brief Destructor + */ + virtual ~EventDispatcher(); + + /* + * @brief Delivers the event to all subscribers + * + * @param event Received event + */ + void raise_event(const Event<EventMessage, EventID>& event); + + /* + * @brief Subscribe the observer to event + * + * @param event_id The event ID to subscribe for + * @param hmi_correlation_id The event HMI correlation ID + * @param observer The observer to subscribe for event + */ + void add_observer(const EventID& event_id, + int32_t hmi_correlation_id, + EventObserver<EventMessage, EventID>* const observer); + + /* + * @brief Unsubscribes the observer from specific event + * + * @param event_id The event ID to unsubscribe from + * @param observer The observer to be unsubscribed + */ + void remove_observer( + const EventID& event_id, + const EventObserver<EventMessage, EventID>* const observer); + + /* + * @brief Unsubscribes the observer from all events + * + * @param observer The observer to be unsubscribed + */ + void remove_observer( + const EventObserver<EventMessage, EventID>* const observer); + + protected: + private: + DISALLOW_COPY_AND_ASSIGN(EventDispatcher); + + // Data types section + typedef std::list<EventObserver<EventMessage, EventID>*> ObserverList; + typedef std::map<int32_t, ObserverList> ObserversMap; + typedef std::map<EventID, ObserversMap> EventObserverMap; + + // Members section + sync_primitives::Lock state_lock_; + EventObserverMap observers_; +}; + +template <typename EventMessage, typename EventID> +EventDispatcher<EventMessage, EventID>::EventDispatcher() + : observers_() {} + +template <typename EventMessage, typename EventID> +EventDispatcher<EventMessage, EventID>::~EventDispatcher() {} + +template <typename EventMessage, typename EventID> +void EventDispatcher<EventMessage, EventID>::raise_event( + const Event<EventMessage, EventID>& event) { + // create local list + ObserverList list; + { + sync_primitives::AutoLock auto_lock(state_lock_); + // check if event is notification + if (hmi_apis::messageType::notification == event.event_message_type()) { + // ObserversMap iterator + typename ObserversMap::iterator it = observers_[event.id()].begin(); + for (; observers_[event.id()].end() != it; ++it) { + list = it->second; + } + } + + if ((hmi_apis::messageType::response == event.event_message_type()) || + (hmi_apis::messageType::error_response == event.event_message_type())) { + list = observers_[event.id()][event.event_message_correlation_id()]; + } + } + + // Call observers + typename ObserverList::iterator observers = list.begin(); + for (; list.end() != observers; ++observers) { + (*observers)->on_event(event); + } +} + +template <typename EventMessage, typename EventID> +void EventDispatcher<EventMessage, EventID>::add_observer( + const EventID& event_id, + int32_t hmi_correlation_id, + EventObserver<EventMessage, EventID>* const observer) { + sync_primitives::AutoLock auto_lock(state_lock_); + observers_[event_id][hmi_correlation_id].push_back(observer); +} + +template <typename EventMessage, typename EventID> +void EventDispatcher<EventMessage, EventID>::remove_observer( + const EventID& event_id, + const EventObserver<EventMessage, EventID>* const observer) { + sync_primitives::AutoLock auto_lock(state_lock_); + typename ObserversMap::iterator it = observers_[event_id].begin(); + for (; observers_[event_id].end() != it; ++it) { + // ObserverList iterator + typename ObserverList::iterator observer_it = it->second.begin(); + while (it->second.end() != observer_it) { + if (observer->id() == (*observer_it)->id()) { + observer_it = it->second.erase(observer_it); + } else { + ++observer_it; + } + } + } +} + +template <typename EventMessage, typename EventID> +void EventDispatcher<EventMessage, EventID>::remove_observer( + const EventObserver<EventMessage, EventID>* const observer) { + sync_primitives::AutoLock auto_lock(state_lock_); + typename EventObserverMap::iterator event_map = observers_.begin(); + for (; observers_.end() != event_map; ++event_map) { + typename ObserversMap::iterator it = event_map->second.begin(); + for (; event_map->second.end() != it; ++it) { + // ObserverList iterator + typename ObserverList::iterator observer_it = it->second.begin(); + while (it->second.end() != observer_it) { + if (observer->id() == (*observer_it)->id()) { + observer_it = it->second.erase(observer_it); + } else { + ++observer_it; + } + } + } + } +} +} + +#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_EVENT_ENGINE_EVENT_DISPATCHER_H_ diff --git a/src/components/remote_control/include/remote_control/event_engine/event_observer.h b/src/components/remote_control/include/remote_control/event_engine/event_observer.h new file mode 100644 index 0000000000..66a38da88b --- /dev/null +++ b/src/components/remote_control/include/remote_control/event_engine/event_observer.h @@ -0,0 +1,96 @@ +/* + Copyright (c) 2017, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_EVENT_ENGINE_EVENT_OBSERVER_H_ +#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_EVENT_ENGINE_EVENT_OBSERVER_H_ + +#include <string> +#include "remote_control/event_engine/event.h" + +namespace rc_event_engine { + +template <typename EventMessage, typename EventID> +class Event; + +template <typename EventMessage, typename EventID> +class EventObserver { + public: + // Typedef for possible Observer ID's from mobile_apis functionID enum + typedef unsigned long ObserverID; + + /* + * @brief Constructor + * + */ + EventObserver(); + + /* + * @brief Destructor + */ + virtual ~EventObserver(); + + /** + * @brief Retrieves observer unique id + * + * @return Unique Observer id + */ + const ObserverID& id() const { + return id_; + } + + /** + * @brief Interface method that is called whenever new event received + * + * @param event The received event + */ + virtual void on_event(const Event<EventMessage, EventID>& event) = 0; + + private: + ObserverID id_; + + DISALLOW_COPY_AND_ASSIGN(EventObserver); +}; + +template <typename EventMessage, typename EventID> +EventObserver<EventMessage, EventID>::EventObserver() + : id_(0) { + // Get unique id based on this + id_ = reinterpret_cast<unsigned long>(this); +} + +template <typename EventMessage, typename EventID> +EventObserver<EventMessage, EventID>::~EventObserver() { + // unsubscribe_from_all_events(); +} +} + +#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_EVENT_ENGINE_EVENT_OBSERVER_H_ diff --git a/src/components/remote_control/include/remote_control/message_helper.h b/src/components/remote_control/include/remote_control/message_helper.h new file mode 100644 index 0000000000..6358459da7 --- /dev/null +++ b/src/components/remote_control/include/remote_control/message_helper.h @@ -0,0 +1,122 @@ +/* + Copyright (c) 2017, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_MESSAGE_HELPER_H_ +#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_MESSAGE_HELPER_H_ + +#include <stdint.h> +#include <string> +#include <map> + +#include "utils/macro.h" +#include "json/json.h" +#include "interfaces/HMI_API.h" +#include "functional_module/function_ids.h" +#include "remote_control/remote_plugin_interface.h" +#include "application_manager/message.h" + +namespace remote_control { + +/** + * @brief MessageHelper class + **/ +class MessageHelper { + public: + static const std::string GetMobileAPIName( + functional_modules::RCFunctionID func_id); + + /** + * @brief Convert Json::Value to std::string + * + * @param value Value with json + * + * @return string with json + */ + static std::string ValueToString(const Json::Value& value); + + /** + * @brief Convert std::string to Json::Value + * + * @param string string with json + * + * @return Value created from string with json + */ + static Json::Value StringToValue(const std::string& string); + + /** + * Creates hmi request + * @param function_id - API function we create request for + * @param message_params - params in request + * @param rc_module - used module for requests handling + * @param hmi_app_id - app is used between SDL & HMI + * @return creted request - reqdy to be sent to hmi + */ + static application_manager::MessagePtr CreateHmiRequest( + const char* function_id, + const uint32_t hmi_app_id, + const Json::Value& message_params, + RemotePluginInterface& rc_module); + + /** @brief Converts string to hmi AccessMode enum value + * @param access_mode stringified value + * @return hmi AccessMode enum value if succedeed, otherwise - INVALID_ENUM + * value + */ + static hmi_apis::Common_RCAccessMode::eType AccessModeFromString( + const std::string& access_mode); + + /** + * @brief AccessModeToString converts enum values to string + * @param access_mode Access mode enum value + * @return Appropriate string value + */ + static std::string AccessModeToString( + const hmi_apis::Common_RCAccessMode::eType access_mode); + + private: + MessageHelper(); + + static const std::map<functional_modules::RCFunctionID, std::string> + kMobileAPINames; + DISALLOW_COPY_AND_ASSIGN(MessageHelper); +}; + +/** @brief Check for existence of specified key in Json::Value + * @param value Value with json + * @param key string with key name + * @return true if key exist + */ +bool IsMember(const Json::Value& value, const std::string& key); + +} // namespace remote_control + +#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_MESSAGE_HELPER_H_ diff --git a/src/components/remote_control/include/remote_control/module_helper.h b/src/components/remote_control/include/remote_control/module_helper.h new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/src/components/remote_control/include/remote_control/module_helper.h diff --git a/src/components/remote_control/include/remote_control/rc_app_extension.h b/src/components/remote_control/include/remote_control/rc_app_extension.h new file mode 100644 index 0000000000..485514faba --- /dev/null +++ b/src/components/remote_control/include/remote_control/rc_app_extension.h @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2017, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_APP_EXTENSION_H_ +#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_APP_EXTENSION_H_ + +#include <string> +#include <set> +#include "application_manager/service.h" +#include "application_manager/app_extension.h" +#include "remote_control/remote_control_plugin.h" +#include "json/json.h" + +namespace remote_control { + +class RCAppExtension : public application_manager::AppExtension { + public: + explicit RCAppExtension(application_manager::AppExtensionUID uid); + ~RCAppExtension(); + + /** + * @brief Subscribe to OnInteriorVehicleDataNotification + * @param module interior data specification(zone, data type) + */ + void SubscribeToInteriorVehicleData(const Json::Value& module_type); + + /** + * @brief Unsubscribe from OnInteriorVehicleDataNotification + * @param module interior data specification(zone, data type) + */ + void UnsubscribeFromInteriorVehicleData(const Json::Value& module_type); + + /** + * @brief UnsubscribeFromInteriorVehicleData removes all subscriptions for + * interior data + */ + void UnsubscribeFromInteriorVehicleData(); + + /** + * @brief Check if application subscribed to OnInteriorVehicleDataNotification + * @param module interior data specification(zone, data type) + */ + bool IsSubscibedToInteriorVehicleData(const Json::Value& module_type); + + private: + std::set<Json::Value> subscribed_interior_vehicle_data_; +}; + +typedef utils::SharedPtr<RCAppExtension> RCAppExtensionPtr; + +} // namespace remote_control + +#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_APP_EXTENSION_H_ diff --git a/src/components/remote_control/include/remote_control/rc_command_factory.h b/src/components/remote_control/include/remote_control/rc_command_factory.h new file mode 100644 index 0000000000..9463c4b1ef --- /dev/null +++ b/src/components/remote_control/include/remote_control/rc_command_factory.h @@ -0,0 +1,66 @@ +/* + Copyright (c) 2017, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_COMMAND_FACTORY_H_ +#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_COMMAND_FACTORY_H_ + +#include "utils/shared_ptr.h" +#include "remote_control/commands/command.h" +#include "remote_control/remote_control_plugin.h" +#include "application_manager/message.h" +#include "utils/macro.h" + +namespace remote_control { + +/** + * @brief Factory class for command creation + **/ +class RCCommandFactory { + public: + /** + * @brief Create command object and return pointer to it + * + * @param message Message shared pointer. + * @return Pointer to created command object. + **/ + static utils::SharedPtr<commands::Command> CreateCommand( + const application_manager::MessagePtr& msg, + RemotePluginInterface& rc_module); + + private: + RCCommandFactory(); + DISALLOW_COPY_AND_ASSIGN(RCCommandFactory); +}; + +} // namespace can_cooperaion + +#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_COMMAND_FACTORY_H_ diff --git a/src/components/remote_control/include/remote_control/rc_module_constants.h b/src/components/remote_control/include/remote_control/rc_module_constants.h new file mode 100644 index 0000000000..021e3cd6f0 --- /dev/null +++ b/src/components/remote_control/include/remote_control/rc_module_constants.h @@ -0,0 +1,233 @@ +/* + Copyright (c) 2017, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_MODULE_CONSTANTS_H_ +#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_MODULE_CONSTANTS_H_ + +namespace remote_control { + +namespace strings { +// RemoteControlCapabilities constants +const char kclimateControlCapabilities[] = "climateControlCapabilities"; +const char kradioControlCapabilities[] = "radioControlCapabilities"; +const char kbuttonCapabilities[] = "buttonCapabilities"; +// RemoteControlCapabilities constants + +const char kRadioControlData[] = "radioControlData"; +const char kClimateControlData[] = "climateControlData"; +} // strings + +namespace result_codes { +const char kSuccess[] = "SUCCESS"; +const char kUnsupportedRequest[] = "UNSUPPORTED_REQUEST"; +const char kUnsupportedResource[] = "UNSUPPORTED_RESOURCE"; +const char kDisallowed[] = "DISALLOWED"; +const char kRejected[] = "REJECTED"; +const char kAborted[] = "ABORTED"; +const char kIgnored[] = "IGNORED"; +const char kRetry[] = "RETRY"; +const char kInUse[] = "IN_USE"; +const char kVehicleDataNotAvailable[] = "VEHICLE_DATA_NOT_AVAILABLE"; +const char kTimedOut[] = "TIMED_OUT"; +const char kInvalidData[] = "INVALID_DATA"; +const char kCharLimitExceeded[] = "CHAR_LIMIT_EXCEEDED"; +const char kInvalidId[] = "INVALID_ID"; +const char kDuplicateName[] = "DUPLICATE_NAME"; +const char kApplicationNotRegistered[] = "APPLICATION_NOT_REGISTERED"; +const char kOutOfMemory[] = "OUT_OF_MEMORY"; +const char kTooManyPendingRequests[] = "TOO_MANY_PENDING_REQUESTS"; +const char kWarnings[] = "WARNINGS"; +const char kWrongLanguage[] = "WRONG_LANGUAGE"; +const char kGenericError[] = "GENERIC_ERROR"; +const char kUserDisallowed[] = "USER_DISALLOWED"; +const char kReadOnly[] = "READ_ONLY"; +} // result_codes + +namespace json_keys { +const char kParams[] = "params"; +const char kSuccess[] = "success"; +const char kResultCode[] = "resultCode"; +const char kResult[] = "result"; +const char kInfo[] = "info"; +const char kId[] = "id"; +const char kJsonrpc[] = "jsonrpc"; +const char kMethod[] = "method"; +const char kError[] = "error"; +const char kMessage[] = "message"; +const char kData[] = "data"; +const char kAppId[] = "appID"; +const char kCode[] = "code"; +} // json_keys + +namespace message_params { +const char kName[] = "name"; + +// SetInteriorVehicleData request +const char kModuleData[] = "moduleData"; +// SetInteriorVehicleData request + +// GetInteriorVehicleData request +const char kSubscribe[] = "subscribe"; +// GetInteriorVehicleData request + +// GetInteriorVehicleData response +const char kIsSubscribed[] = "isSubscribed"; +// GetInteriorVehicleData response + +// OnRemoteControlSettings notification +const char kAccessMode[] = "accessMode"; +const char kAllowed[] = "allowed"; +// OnRemoteControlSettings notification + +// ButtonPress request +const char kModuleType[] = "moduleType"; +const char kButtonName[] = "buttonName"; +const char kButtonPressMode[] = "buttonPressMode"; +// ButtonPress request + +// RdsData struct +const char kPS[] = "PS"; +const char kRT[] = "RT"; +const char kCT[] = "CT"; +const char kPI[] = "PI"; +const char kPTY[] = "PTY"; +const char kTA[] = "TA"; +const char kTP[] = "TP"; +const char kREG[] = "REG"; +// RdsData struct + +// RadioControlData struct +const char kFrequencyInteger[] = "frequencyInteger"; +const char kFrequencyFraction[] = "frequencyFraction"; +const char kBand[] = "band"; +const char kRdsData[] = "rdsData"; +const char kAvailableHDs[] = "availableHDs"; +const char kHdChannel[] = "hdChannel"; +const char kSignalStrength[] = "signalStrength"; +const char kSignalChangeThreshold[] = "signalChangeThreshold"; +const char kRadioEnable[] = "radioEnable"; +const char kState[] = "state"; +// RadioControlData struct + +// ClimateControlData struct +const char kFanSpeed[] = "fanSpeed"; +const char kCurrentTemperature[] = "currentTemperature"; +const char kDesiredTemperature[] = "desiredTemperature"; +const char kTemperatureUnit[] = "temperatureUnit"; +const char kACEnable[] = "acEnable"; +const char kCirculateAirEnable[] = "circulateAirEnable"; +const char kAutoModeEnable[] = "autoModeEnable"; +const char kDefrostZone[] = "defrostZone"; +const char kDualModeEnable[] = "dualModeEnable"; +const char kACMaxEnable[] = "acMaxEnable"; +const char kVentilationMode[] = "ventilationMode"; +// ClimateControlData struct + +// ModuleData struct +const char kRadioControlData[] = "radioControlData"; +const char kClimateControlData[] = "climateControlData"; +// ModuleData struct + +const char kHMIAppID[] = "appID"; +const char kHmiLevel[] = "hmiLevel"; +const char kSysContext[] = "systemContext"; +const char kAudioState[] = "audioStreamingState"; +} // namespace message_params + +namespace enums_value { + +// ModuleType enum +const char kClimate[] = "CLIMATE"; +const char kRadio[] = "RADIO"; +// ModuleType enum + +// RadioBand enum +const char kAM[] = "AM"; +const char kFM[] = "FM"; +const char kXM[] = "XM"; +// RadioBand enum + +// RadioState enum +const char kAcquiring[] = "ACQUIRING"; +const char kAcquired[] = "ACQUIRED"; +const char kMulticast[] = "MULTICAST"; +const char kNotFound[] = "NOT_FOUND"; +// RadioState enum + +// DefrostZone enum +const char kFront[] = "FRONT"; +const char kRear[] = "REAR"; +const char kAll[] = "ALL"; +// DefrostZone enum + +// TemperatureUnit enum +const char kFahrenheit[] = "FAHRENHEIT"; +const char kCelsius[] = "CELSIUS"; +// TemperatureUnit enum + +// ButtonName enum +const char kACMax[] = "AC_MAX"; +const char kAC[] = "AC"; +const char kRecirculate[] = "RECIRCULATE"; +const char kFanUp[] = "FAN_UP"; +const char kFanDown[] = "FAN_DOWN"; +const char kTempUp[] = "TEMP_UP"; +const char kTempDown[] = "TEMP_DOWN"; +const char kDefrostMax[] = "DEFROST_MAX"; +const char kDefrost[] = "DEFROST"; +const char kDefrostRear[] = "DEFROST_REAR"; +const char kUpperVent[] = "UPPER_VENT"; +const char kLowerVent[] = "LOWER_VENT"; +const char kVolumeUp[] = "VOLUME_UP"; +const char kVolumeDown[] = "VOLUME_DOWN"; +const char kEject[] = "EJECT"; +const char kSource[] = "SOURCE"; +const char kShuffle[] = "SHUFFLE"; +const char kRepeat[] = "REPEAT"; +// ButtonName enum + +// ButtonPressMode enum +const char kLong[] = "LONG"; +const char kShort[] = "SHORT"; +// ButtonPressMode enum + +// Access mode enum +const char kAutoAllow[] = "AUTO_ALLOW"; +const char kAutoDeny[] = "AUTO_DENY"; +const char kAskDriver[] = "ASK_DRIVER"; +// Access mode enum + +} // namespace enums_value + +} // namespace remote_control + +#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_MODULE_CONSTANTS_H_ diff --git a/src/components/remote_control/include/remote_control/rc_module_timer.h b/src/components/remote_control/include/remote_control/rc_module_timer.h new file mode 100644 index 0000000000..813f26a885 --- /dev/null +++ b/src/components/remote_control/include/remote_control/rc_module_timer.h @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2017, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_MODULE_TIMER_H_ +#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_MODULE_TIMER_H_ + +#include "functional_module/timer/module_timer.h" + +namespace remote_control { + +class TrackableMessage : public functional_modules::Trackable { + public: + TrackableMessage(uint32_t app_id, uint32_t correlation_id) + : custom_interval_(0), app_id_(app_id), correlation_id_(correlation_id) {} + + functional_modules::TimeUnit custom_interval() const { + return custom_interval_; + } + + uint32_t app_id() const { + return app_id_; + } + + uint32_t correlation_id() const { + return correlation_id_; + } + + bool operator==(const TrackableMessage& other) const { + return (other.app_id_ == app_id_ && + other.correlation_id_ == correlation_id_); + } + + private: + functional_modules::TimeUnit custom_interval_; + uint32_t app_id_; + uint32_t correlation_id_; +}; + +} // namesapce remote_control + +#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_MODULE_TIMER_H_ diff --git a/src/components/remote_control/include/remote_control/remote_control_event.h b/src/components/remote_control/include/remote_control/remote_control_event.h new file mode 100644 index 0000000000..3c98f971ac --- /dev/null +++ b/src/components/remote_control/include/remote_control/remote_control_event.h @@ -0,0 +1,82 @@ +/* + Copyright (c) 2017, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REMOTE_CONTROL_EVENT_H_ +#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REMOTE_CONTROL_EVENT_H_ + +#include <string> + +#include "application_manager/message.h" + +#include "remote_control/event_engine/event.h" + +namespace remote_control { + +class RCPluginEvent + : public rc_event_engine::Event<application_manager::MessagePtr, + std::string> { + public: + /* + * @brief Constructor with parameters + * + * @param id Event ID. (HMI or CAN function name) + * @param message Message received in HMI or CAN response + */ + RCPluginEvent(application_manager::MessagePtr& message, + const std::string& id); + + /* + * @brief Destructor + */ + virtual ~RCPluginEvent(); + + /* + * @brief Retrieves event message request ID + */ + virtual int32_t event_message_function_id() const; + + /* + * @brief Retrieves event message correlation ID + */ + virtual int32_t event_message_correlation_id() const; + + /* + * @brief Retrieves event message response type + */ + virtual int32_t event_message_type() const; + + private: + DISALLOW_COPY_AND_ASSIGN(RCPluginEvent); +}; +} + +#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REMOTE_CONTROL_EVENT_H_ diff --git a/src/components/remote_control/include/remote_control/remote_control_plugin.h b/src/components/remote_control/include/remote_control/remote_control_plugin.h new file mode 100644 index 0000000000..6e36470b06 --- /dev/null +++ b/src/components/remote_control/include/remote_control/remote_control_plugin.h @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2017, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REMOTE_CONTROL_PLUGIN_H_ +#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REMOTE_CONTROL_PLUGIN_H_ + +#include <queue> +#include <string> + +#include "remote_control/remote_plugin_interface.h" +#include "functional_module/generic_module.h" +#include "remote_control/request_controller.h" +#include "utils/threads/message_loop_thread.h" +#include "remote_control/event_engine/event_dispatcher.h" +#include "remote_control/resource_allocation_manager_impl.h" + +namespace remote_control { +typedef rc_event_engine::EventDispatcher<application_manager::MessagePtr, + std::string> RCEventDispatcher; + +class RemoteControlPlugin : public RemotePluginInterface { + public: + RemoteControlPlugin(); + ~RemoteControlPlugin(); + + functional_modules::PluginInfo GetPluginInfo() const; + virtual functional_modules::ProcessResult ProcessMessage( + application_manager::MessagePtr msg); + virtual functional_modules::ProcessResult ProcessHMIMessage( + application_manager::MessagePtr msg); + + /** + * @brief Sends response to mobile application + * @param msg response mesage + */ + void SendResponseToMobile(application_manager::MessagePtr msg); + + /** + * @brief Sends timeout response to mobile application + * @param msg response mesage + */ + void SendTimeoutResponseToMobile(application_manager::MessagePtr msg); + + /** + * @brief Remove extension created for specified application + * @param app_id application id + */ + virtual void RemoveAppExtension(uint32_t app_id); + + /** + * @brief Check registering app can be handled by plugin + * @param msg Registration message + * @param app Application basis already create by Core + */ + bool IsAppForPlugin(application_manager::ApplicationSharedPtr app); + + /** + * @brief Notify about change of HMILevel of plugin's app + * @param app App with new HMILevel + * @param old_level Old HMILevel of app + */ + void OnAppHMILevelChanged(application_manager::ApplicationSharedPtr app, + mobile_apis::HMILevel::eType old_level); + + /** + * @brief Sends HMI status notification to mobile + * @param app application with changed HMI status + **/ + void SendHmiStatusNotification( + application_manager::ApplicationSharedPtr app) OVERRIDE; + + /** + * @brief Getter for event_dispatcher + * @return reference to RCEventDispatcher instance + */ + RCEventDispatcher& event_dispatcher() OVERRIDE; + + /** + * @brief Getter for resource_allocation_manager + * @return reference to ResourceAllocationManager instance + */ + ResourceAllocationManager& resource_allocation_manager() OVERRIDE; + + /** + * @brief Overriden setter for service + * @param service pointer to new service instance + */ + void set_service(application_manager::ServicePtr service) OVERRIDE; + + /* + * @brief OnApplicationEvent Processes application related events + * @param event Event + * @param application_id Application id + */ + void OnApplicationEvent(functional_modules::ApplicationEvent event, + const uint32_t application_id) OVERRIDE; + + /** + * @brief OnPolicyEvent Processes policy related events + * @param event Policy event + */ + void OnPolicyEvent(functional_modules::PolicyEvent event) OVERRIDE; + + protected: + /** + * @brief Remove extension for all applications + */ + virtual void RemoveAppExtensions() OVERRIDE; + + private: + /** + * @brief Trigger actions which should be done after plugin service instance + * have been changed + */ + void OnPluginServiceChanged(); + + /** + * @brief Subscribes on all RC related functions + */ + void SubscribeOnFunctions(); + + functional_modules::PluginInfo plugin_info_; + bool is_scan_started_; + request_controller::RequestController request_controller_; + + RCEventDispatcher event_dispatcher_; + + ResourceAllocationManagerImpl resource_allocation_manager_; + DISALLOW_COPY_AND_ASSIGN(RemoteControlPlugin); +}; + +} // namespace remote_control + +#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REMOTE_CONTROL_PLUGIN_H_ diff --git a/src/components/remote_control/include/remote_control/remote_plugin_interface.h b/src/components/remote_control/include/remote_control/remote_plugin_interface.h new file mode 100644 index 0000000000..51135d8a8a --- /dev/null +++ b/src/components/remote_control/include/remote_control/remote_plugin_interface.h @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2017, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REMOTE_PLUGIN_INTERFACE_H_ +#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REMOTE_PLUGIN_INTERFACE_H_ + +#include <queue> +#include <string> +#include "functional_module/generic_module.h" +#include "remote_control/request_controller.h" +#include "remote_control/event_engine/event_dispatcher.h" +#include "utils/threads/message_loop_thread.h" +#include "utils/shared_ptr.h" + +namespace remote_control { + +class RCAppExtension; +class ResourceAllocationManager; + +typedef utils::SharedPtr<RCAppExtension> RCAppExtensionPtr; + +class RemotePluginInterface : public functional_modules::GenericModule { + public: + RemotePluginInterface() : GenericModule(kCANModuleID) {} + virtual ~RemotePluginInterface() {} + virtual functional_modules::PluginInfo GetPluginInfo() const = 0; + virtual functional_modules::ProcessResult ProcessMessage( + application_manager::MessagePtr msg) = 0; + virtual functional_modules::ProcessResult ProcessHMIMessage( + application_manager::MessagePtr msg) = 0; + + /** + * @brief Sends response to mobile application + * @param msg response mesage + */ + virtual void SendResponseToMobile(application_manager::MessagePtr msg) = 0; + + /** + * @brief Sends timeout response to mobile application + * @param msg response mesage + */ + virtual void SendTimeoutResponseToMobile( + application_manager::MessagePtr msg) = 0; + + /** + * @brief Remove extension created for specified application + * @param app_id application id + */ + virtual void RemoveAppExtension(uint32_t app_id) = 0; + + /** + * @brief Check registering app can be handled by plugin + * @param msg Registration message + * @param app Application basis already create by Core + */ + virtual bool IsAppForPlugin( + application_manager::ApplicationSharedPtr app) = 0; + + /** + * @brief Notify about change of HMILevel of plugin's app + * @param app App with new HMILevel + * @param old_level Old HMILevel of app + */ + virtual void OnAppHMILevelChanged( + application_manager::ApplicationSharedPtr app, + mobile_apis::HMILevel::eType old_level) = 0; + + virtual void SendHmiStatusNotification( + application_manager::ApplicationSharedPtr app) = 0; + + typedef rc_event_engine::EventDispatcher<application_manager::MessagePtr, + std::string> RCPluginEventDispatcher; + + virtual RCPluginEventDispatcher& event_dispatcher() = 0; + + virtual ResourceAllocationManager& resource_allocation_manager() = 0; + + protected: + /** + * @brief Remove extension for all applications + */ + virtual void RemoveAppExtensions() = 0; + + static const functional_modules::ModuleID kCANModuleID = 153; +}; + +} // namespace remote_control + +#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REMOTE_PLUGIN_INTERFACE_H_ diff --git a/src/components/remote_control/include/remote_control/request_controller.h b/src/components/remote_control/include/remote_control/request_controller.h new file mode 100644 index 0000000000..8a79d9ebc4 --- /dev/null +++ b/src/components/remote_control/include/remote_control/request_controller.h @@ -0,0 +1,110 @@ +/** + * Copyright (c) 2017, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REQUEST_CONTROLLER_H_ +#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REQUEST_CONTROLLER_H_ + +#include <map> + +#include "remote_control/commands/command.h" +#include "remote_control/rc_module_timer.h" +#include "functional_module/timer/timer_director.h" +#include "utils/lock.h" + +namespace remote_control { + +namespace commands { +class Command; +} + +namespace request_controller { + +typedef utils::SharedPtr<commands::Command> MobileRequestPtr; +typedef uint32_t correlation_id; + +/** + * @brief RequestController class is used to manage mobile requests lifetime. + */ +class RequestController + : public functional_modules::TimerObserver<TrackableMessage> { + public: + /** + * @brief Class constructor + * + */ + RequestController(); + + /** + * @brief Class destructor + * + */ + virtual ~RequestController(); + + /** + * @brief Adds pointer to request. + * @param mobile_correlation_id mobile request correlation id + * @param command pointer to request created in mobile factory + */ + void AddRequest(const uint32_t mobile_correlation_id, + MobileRequestPtr request); + + /** + * @brief Removes request + * @param mobile_corellation_id mobile request correlation id + */ + void DeleteRequest(const uint32_t& mobile_correlation_id); + + /** + * @brief Sets timeout value for RC requests + * @param timeout_seconds new timeout value in seconds + */ + void SetRequestTimeout(const functional_modules::TimeUnit timeout_seconds); + + /** + * @brief Triggers actions when timeout for some request is expired + * @param expired reference to request which timeout was expired + */ + void OnTimeoutTriggered(const TrackableMessage& expired) OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(RequestController); + + std::map<correlation_id, MobileRequestPtr> mobile_request_list_; + functional_modules::ModuleTimer<TrackableMessage> timer_; + functional_modules::TimerDirector time_director_; + sync_primitives::Lock mobile_request_lock_; +}; + +} // namespace request_controller +} // namespace remote_control + +#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REQUEST_CONTROLLER_H_ diff --git a/src/components/remote_control/include/remote_control/resource_allocation_manager.h b/src/components/remote_control/include/remote_control/resource_allocation_manager.h new file mode 100644 index 0000000000..e9712370d9 --- /dev/null +++ b/src/components/remote_control/include/remote_control/resource_allocation_manager.h @@ -0,0 +1,114 @@ +#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RESOURCE_ALLOCATION_H +#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RESOURCE_ALLOCATION_H +#include <string> +#include "utils/macro.h" +#include "utils/shared_ptr.h" +#include "interfaces/HMI_API.h" +#include "remote_control/event_engine/event.h" +#include "functional_module/generic_module.h" + +namespace remote_control { + +/** + * Enum for list of results of allocation resources + */ +namespace AcquireResult { +enum eType { ALLOWED = 0, IN_USE, ASK_DRIVER, REJECTED }; +} + +/** + * Defines states of acquired resource + */ +namespace ResourceState { +enum eType { FREE = 0, BUSY }; +} + +/** + * @brief Resources defines list of resources + */ +typedef std::vector<std::string> Resources; + +class ResourceAllocationManager { + public: + /** + * @brief AcquireResource acquires resource by application + * @param module_type resource to acquire + * @param app_id application that acquire resource + * @return ALLOWED if resource acquired \ + * IN_USE if subscription is not allowed + * ASK_DRIVER if driver confirmation is required + */ + virtual AcquireResult::eType AcquireResource(const std::string& module_type, + const uint32_t app_id) = 0; + + /** + * @brief SetResourceState changes resource state. Resource must be acquired + * beforehand. + * @param module_type Resource to change its state + * @param app_id Application aquired resource before + * @param state State to set for resource + */ + virtual void SetResourceState(const std::string& module_type, + const uint32_t app_id, + const ResourceState::eType state) = 0; + + /** + * @brief IsResourceFree check resource state + * @param module_type Resource name + * @return True if free, otherwise - false + */ + virtual bool IsResourceFree(const std::string& module_type) const = 0; + + /** + * @brief AcquireResource forces acquiring resource by application + * @param module_type resource to acquire + * @param app_id application that acquire resource + */ + virtual void ForceAcquireResource(const std::string& module_type, + const uint32_t app_id) = 0; + + /** + * @brief OnDriverDisallowed callback for rejecting acquiring resource + * @param module_type resource type + * @param app_id application id + */ + virtual void OnDriverDisallowed(const std::string& module_type, + const uint32_t app_id) = 0; + + /** + * @brief OnApplicationEvent Processes application related events + * @param event Event + * @param application_id Application id + */ + virtual void OnApplicationEvent(functional_modules::ApplicationEvent event, + const uint32_t application_id) = 0; + + /** + * @brief OnPolicyEvent Processes policy related events + * @param event Policy event + */ + virtual void OnPolicyEvent(functional_modules::PolicyEvent event) = 0; + + /** + * @brief Set current access mode for acquiring resource + * @param access_mode + */ + virtual void SetAccessMode( + const hmi_apis::Common_RCAccessMode::eType access_mode) = 0; + + /** + * @brief Get last set access mode for acquiring resource + * @param access_mode + */ + virtual hmi_apis::Common_RCAccessMode::eType GetAccessMode() const = 0; + + /** + * @brief Remove all information about all allocations + */ + virtual void ResetAllAllocations() = 0; + + virtual ~ResourceAllocationManager() {} +}; + +} // namespace remote_control +#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RESOURCE_ALLOCATION_H diff --git a/src/components/remote_control/include/remote_control/resource_allocation_manager_impl.h b/src/components/remote_control/include/remote_control/resource_allocation_manager_impl.h new file mode 100644 index 0000000000..a62d1b091c --- /dev/null +++ b/src/components/remote_control/include/remote_control/resource_allocation_manager_impl.h @@ -0,0 +1,136 @@ +#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RESOURCE_ALLOCATION_IMPL_H +#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RESOURCE_ALLOCATION_IMPL_H +#include "remote_control/resource_allocation_manager.h" +#include "remote_control/remote_plugin_interface.h" +#include "utils/macro.h" +#include "utils/lock.h" + +namespace remote_control { + +typedef rc_event_engine::EventDispatcher<application_manager::MessagePtr, + std::string> RCEventDispatcher; + +class ResourceAllocationManagerImpl : public ResourceAllocationManager { + public: + ResourceAllocationManagerImpl(RemotePluginInterface& rc_plugin); + + ~ResourceAllocationManagerImpl(); + + AcquireResult::eType AcquireResource(const std::string& module_type, + const uint32_t app_id) OVERRIDE FINAL; + + void SetResourceState(const std::string& module_type, + const uint32_t app_id, + const ResourceState::eType state) FINAL; + + bool IsResourceFree(const std::string& module_type) const FINAL; + + void SetAccessMode( + const hmi_apis::Common_RCAccessMode::eType access_mode) FINAL; + + hmi_apis::Common_RCAccessMode::eType GetAccessMode() const FINAL; + + void ForceAcquireResource(const std::string& module_type, + const uint32_t app_id) FINAL; + + void OnDriverDisallowed(const std::string& module_type, + const uint32_t app_id) FINAL; + + /** + * @brief OnApplicationEvent Processes application related events + * @param event Event + * @param application_id Application id + */ + void OnApplicationEvent(functional_modules::ApplicationEvent event, + const uint32_t application_id) FINAL; + + /** + * @brief OnPolicyEvent Processes policy related events + * @param event Policy event + */ + void OnPolicyEvent(functional_modules::PolicyEvent event) FINAL; + + void ResetAllAllocations() FINAL; + + private: + typedef std::vector<application_manager::ApplicationSharedPtr> Apps; + + /** + * @brief IsModuleTypeRejected check if current resource was rejected by + * driver for current application + * @param module_type resource to check + * @param app_id application id + * @return true if current resource was rejected by driver for current + * application, otherwise - false + */ + bool IsModuleTypeRejected(const std::string& module_type, + const uint32_t app_id); + + /** + * @brief ReleaseResource Releases resource acquired by application + * @param module_type Module name + * @param application_id Application id + */ + void ReleaseResource(const std::string& module_type, + const uint32_t application_id); + + /** + * @brief GetAcquiredResources Provides resources acquired by particular + * application currently + * @param application_id Application id + * @return List of acquired resources by specific application + */ + Resources GetAcquiredResources(const uint32_t application_id) const; + + /** + * @brief ProcessApplicationPolicyUpdate Checks if allowed modules list is + * changed for registered RC applications and releases in case some modules + * now out of the list + */ + void ProcessApplicationPolicyUpdate(); + + /** + * @brief GetApplicationExtention Provides access to application RC extention + * @param application Application + * @return Pointer to RC extention of application or NULL if not available + */ + RCAppExtensionPtr GetApplicationExtention( + application_manager::ApplicationSharedPtr application); + + /** + * @brief RemoveAppsSubscriptions Removes subscriptions for interior data for + * applications in the list + * @param apps Application list + */ + void RemoveAppsSubscriptions(const Apps& apps); + + /** + * @brief AllocatedResources contains link between resource and application + * owning that resource + */ + typedef std::map<std::string, uint32_t> AllocatedResources; + AllocatedResources allocated_resources_; + mutable sync_primitives::Lock allocated_resources_lock_; + + /** + * @brief ResourcesState contains states of ALLOCATED resources + */ + typedef std::map<std::string, ResourceState::eType> ResourcesState; + ResourcesState resources_state_; + mutable sync_primitives::Lock resources_state_lock_; + + /** + * @brief RejectedResources type for connecting list of resources rejected by + * driver for application + * application_id : [vector of rejected resources] + */ + typedef std::map<uint32_t, std::vector<std::string> > RejectedResources; + RejectedResources rejected_resources_for_application_; + mutable sync_primitives::Lock rejected_resources_for_application_lock_; + + hmi_apis::Common_RCAccessMode::eType current_access_mode_; + RemotePluginInterface& rc_plugin_; +}; +} // remote_control + +#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RESOURCE_ALLOCATION_IMPL_H diff --git a/src/components/remote_control/src/commands/base_command_notification.cc b/src/components/remote_control/src/commands/base_command_notification.cc new file mode 100644 index 0000000000..2de82abdef --- /dev/null +++ b/src/components/remote_control/src/commands/base_command_notification.cc @@ -0,0 +1,154 @@ +/* + Copyright (c) 2017, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "remote_control/commands/base_command_notification.h" +#include "json/json.h" +#include "remote_control/remote_control_plugin.h" +#include "remote_control/rc_module_constants.h" +#include "application_manager/application_manager.h" + +namespace remote_control { + +namespace commands { + +CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule") + +BaseCommandNotification::BaseCommandNotification( + const application_manager::MessagePtr& message, + RemotePluginInterface& rc_module) + : Command(rc_module), service_(rc_module_.service()), message_(message) { + Json::Value value; + Json::Reader reader; + reader.parse(message_->json_message(), value); + if (value.isMember(json_keys::kParams)) { + Json::FastWriter writer; + message_->set_json_message(writer.write(value[json_keys::kParams])); + } else { + message_->set_json_message(""); + } +} + +BaseCommandNotification::~BaseCommandNotification() {} + +RCAppExtensionPtr BaseCommandNotification::GetAppExtension( + application_manager::ApplicationSharedPtr app) const { + if (!app) { + return NULL; + } + + functional_modules::ModuleID id = rc_module_.GetModuleID(); + + RCAppExtensionPtr rc_app_extension; + application_manager::AppExtensionPtr app_extension = app->QueryInterface(id); + if (!app_extension) { + return NULL; + } + + rc_app_extension = + application_manager::AppExtensionPtr::static_pointer_cast<RCAppExtension>( + app_extension); + + return rc_app_extension; +} + +void BaseCommandNotification::Run() { + LOG4CXX_AUTO_TRACE(logger_); + Execute(); +} + +void BaseCommandNotification::NotifyApplications() { + LOG4CXX_AUTO_TRACE(logger_); + typedef std::vector<application_manager::ApplicationSharedPtr> AppList; + AppList applications = service_->GetApplications(rc_module_.GetModuleID()); + for (AppList::iterator i = applications.begin(); i != applications.end(); + ++i) { + application_manager::MessagePtr message( + new application_manager::Message(*message_)); + message->set_connection_key((*i)->app_id()); + NotifyOneApplication(message); + } +} + +void BaseCommandNotification::NotifyOneApplication( + application_manager::MessagePtr message) { + LOG4CXX_AUTO_TRACE(logger_); + if (CheckPolicy(message)) { + service_->SendMessageToMobile(message); + } else { + LOG4CXX_WARN(logger_, + "Function \"" << message->function_name() << "\" (#" + << message->function_id() + << ") not allowed by policy"); + } +} + +bool BaseCommandNotification::CheckPolicy( + application_manager::MessagePtr message) { + LOG4CXX_AUTO_TRACE(logger_); + application_manager::ApplicationSharedPtr app = + service_->GetApplication(message->connection_key()); + + if (!app) { + LOG4CXX_WARN(logger_, + "Application " << message->connection_key() + << "isn't registered"); + return false; + } + + mobile_apis::Result::eType permission = + service_->CheckPolicyPermissions(message); + + Json::Value value; + Json::Reader reader; + LOG4CXX_DEBUG(logger_, "Notification: " << message->json_message()); + reader.parse(message->json_message(), value); + + return permission == mobile_apis::Result::eType::SUCCESS && + service_->CheckModule(app->app_id(), ModuleType(value)); +} + +std::string BaseCommandNotification::ModuleType(const Json::Value& message) { + return ""; +} + +bool BaseCommandNotification::Validate() { + return true; +} + +std::vector<std::string> BaseCommandNotification::ControlData( + const Json::Value& message) { + return std::vector<std::string>(); +} + +} // namespace commands + +} // namespace remote_control diff --git a/src/components/remote_control/src/commands/base_command_request.cc b/src/components/remote_control/src/commands/base_command_request.cc new file mode 100644 index 0000000000..bc6202d2a8 --- /dev/null +++ b/src/components/remote_control/src/commands/base_command_request.cc @@ -0,0 +1,564 @@ +/* + Copyright (c) 2017, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "remote_control/commands/base_command_request.h" +#include <cstring> +#include "utils/make_shared.h" +#include "remote_control/event_engine/event_dispatcher.h" +#include "remote_control/message_helper.h" +#include "remote_control/remote_control_plugin.h" +#include "remote_control/rc_module_constants.h" +#include "application_manager/application_manager_impl.h" + +namespace remote_control { + +namespace commands { + +using rc_event_engine::EventDispatcher; + +CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule") + +BaseCommandRequest::BaseCommandRequest( + const application_manager::MessagePtr& message, + RemotePluginInterface& rc_module) + : Command(rc_module) + , message_(message) + , msg_json_(MessageHelper::StringToValue(message->json_message())) + , auto_allowed_(false) { + service_ = rc_module_.service(); + app_ = service_->GetApplication(message_->connection_key()); +} + +BaseCommandRequest::~BaseCommandRequest() { + rc_module_.event_dispatcher().remove_observer(this); +} + +void BaseCommandRequest::OnTimeout() { + LOG4CXX_AUTO_TRACE(logger_); + SetResourceState(msg_json_, ResourceState::FREE); + + PrepareResponse( + false, result_codes::kGenericError, "Request timeout expired."); + rc_module_.SendTimeoutResponseToMobile(message_); +} + +void BaseCommandRequest::PrepareResponse(const bool success, + const char* result_code, + const std::string& info) { + message_->set_message_type(application_manager::MessageType::kResponse); + Json::Value msg_params; + + if (!response_params_.isNull()) { + msg_params = response_params_; + } + + msg_params[json_keys::kSuccess] = success; + msg_params[json_keys::kResultCode] = result_code; + if (!info.empty()) { + msg_params[json_keys::kInfo] = info; + } + + Json::FastWriter writer; + std::string params = writer.write(msg_params); + message_->set_json_message(params); +} + +void BaseCommandRequest::SendResponse(const bool success, + const char* result_code, + const std::string& info) { + LOG4CXX_AUTO_TRACE(logger_); + SetResourceState(msg_json_, ResourceState::FREE); + PrepareResponse(success, result_code, info); + rc_module_.SendResponseToMobile(message_); +} + +void BaseCommandRequest::SendMessageToHMI( + const application_manager::MessagePtr& message_to_send) { + LOG4CXX_AUTO_TRACE(logger_); + using application_manager::HmiInterfaces; + + const bool is_rc_available = + service_->IsInterfaceAvailable(HmiInterfaces::HMI_INTERFACE_RC); + LOG4CXX_DEBUG(logger_, "HMI interface RC is available: " << is_rc_available); + if (!is_rc_available) { + const bool success = false; + const char* result_code = result_codes::kUnsupportedResource; + const std::string info = "Remote control is not supported by system"; + + SendResponse(success, result_code, info); + return; + } + + const std::string function_name = message_to_send->function_name(); + const int32_t correlation_id = message_to_send->correlation_id(); + LOG4CXX_DEBUG(logger_, + "Subsribing to response for function: " + << function_name + << " and correlation id: " << correlation_id); + + rc_module_.event_dispatcher().add_observer( + function_name, correlation_id, this); + + LOG4CXX_DEBUG(logger_, "HMI Request:\n " << message_to_send->json_message()); + + service_->SendMessageToHMI(message_to_send); +} + +void BaseCommandRequest::SendRequest(const char* function_id, + const Json::Value& message_params) { + LOG4CXX_AUTO_TRACE(logger_); + application_manager::MessagePtr message_to_send = + CreateHmiRequest(function_id, message_params); + SendMessageToHMI(message_to_send); +} + +application_manager::MessagePtr BaseCommandRequest::CreateHmiRequest( + const char* function_id, const Json::Value& message_params) { + LOG4CXX_AUTO_TRACE(logger_); + const uint32_t hmi_app_id = app_->hmi_app_id(); + return MessageHelper::CreateHmiRequest( + function_id, hmi_app_id, message_params, rc_module_); +} + +bool BaseCommandRequest::Validate() { + return application_manager::MessageValidationResult::SUCCESS == + service_->ValidateMessageBySchema(*message_); +} + +bool BaseCommandRequest::ParseJsonString(Json::Value* parsed_msg) { + LOG4CXX_AUTO_TRACE(logger_); + DCHECK(parsed_msg); + if (!parsed_msg) + return false; + + (*parsed_msg) = MessageHelper::StringToValue(message_->json_message()); + if (Json::ValueType::nullValue == parsed_msg->type()) { + LOG4CXX_ERROR(logger_, + "Invalid JSON received in " << message_->json_message()); + SendResponse( + false, result_codes::kInvalidData, "Mobile request validation failed!"); + return false; + } + return true; +} + +const char* BaseCommandRequest::GetMobileResultCode( + const hmi_apis::Common_Result::eType& hmi_code) const { + LOG4CXX_AUTO_TRACE(logger_); + switch (hmi_code) { + case hmi_apis::Common_Result::SUCCESS: { + return result_codes::kSuccess; + } + case hmi_apis::Common_Result::UNSUPPORTED_REQUEST: { + return result_codes::kUnsupportedRequest; + } + case hmi_apis::Common_Result::UNSUPPORTED_RESOURCE: { + return result_codes::kUnsupportedResource; + } + case hmi_apis::Common_Result::DISALLOWED: { + return result_codes::kDisallowed; + } + case hmi_apis::Common_Result::REJECTED: { + return result_codes::kRejected; + } + case hmi_apis::Common_Result::ABORTED: { + return result_codes::kAborted; + } + case hmi_apis::Common_Result::IGNORED: { + return result_codes::kIgnored; + } + case hmi_apis::Common_Result::RETRY: { + return result_codes::kRetry; + } + case hmi_apis::Common_Result::IN_USE: { + return result_codes::kInUse; + } + case hmi_apis::Common_Result::DATA_NOT_AVAILABLE: { + return result_codes::kVehicleDataNotAvailable; + } + case hmi_apis::Common_Result::TIMED_OUT: { + return result_codes::kTimedOut; + } + case hmi_apis::Common_Result::INVALID_DATA: { + return result_codes::kInvalidData; + } + case hmi_apis::Common_Result::CHAR_LIMIT_EXCEEDED: { + return result_codes::kCharLimitExceeded; + } + case hmi_apis::Common_Result::INVALID_ID: { + return result_codes::kInvalidId; + } + case hmi_apis::Common_Result::DUPLICATE_NAME: { + return result_codes::kDuplicateName; + } + case hmi_apis::Common_Result::APPLICATION_NOT_REGISTERED: { + return result_codes::kApplicationNotRegistered; + } + case hmi_apis::Common_Result::WRONG_LANGUAGE: { + return result_codes::kWrongLanguage; + } + case hmi_apis::Common_Result::OUT_OF_MEMORY: { + return result_codes::kOutOfMemory; + } + case hmi_apis::Common_Result::TOO_MANY_PENDING_REQUESTS: { + return result_codes::kTooManyPendingRequests; + } + case hmi_apis::Common_Result::NO_APPS_REGISTERED: { + return result_codes::kApplicationNotRegistered; + } + case hmi_apis::Common_Result::NO_DEVICES_CONNECTED: { + return result_codes::kApplicationNotRegistered; + } + case hmi_apis::Common_Result::WARNINGS: { + return result_codes::kWarnings; + } + case hmi_apis::Common_Result::GENERIC_ERROR: { + return result_codes::kGenericError; + } + case hmi_apis::Common_Result::USER_DISALLOWED: { + return result_codes::kUserDisallowed; + } + case hmi_apis::Common_Result::READ_ONLY: { + return result_codes::kReadOnly; + } + default: { + LOG4CXX_ERROR(logger_, "Unknown HMI result code " << hmi_code); + return result_codes::kGenericError; + } + } +} + +RCAppExtensionPtr BaseCommandRequest::GetAppExtension( + application_manager::ApplicationSharedPtr app) const { + LOG4CXX_AUTO_TRACE(logger_); + if (!app) { + return NULL; + } + + functional_modules::ModuleID id = rc_module_.GetModuleID(); + + RCAppExtensionPtr rc_app_extension; + application_manager::AppExtensionPtr app_extension = app->QueryInterface(id); + if (!app_extension) { + LOG4CXX_DEBUG(logger_, "New app extension will be created"); + app_extension = new RCAppExtension(id); + app->AddExtension(app_extension); + } + + rc_app_extension = + application_manager::AppExtensionPtr::static_pointer_cast<RCAppExtension>( + app_extension); + + return rc_app_extension; +} + +bool BaseCommandRequest::ParseResultCode(const Json::Value& value, + std::string& result_code, + std::string& info) { + LOG4CXX_AUTO_TRACE(logger_); + result_code = result_codes::kInvalidData; + info = ""; + + if (IsMember(value, json_keys::kResult) && + IsMember(value[json_keys::kResult], json_keys::kCode)) { + result_code = + GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>( + value[json_keys::kResult][json_keys::kCode].asInt())); + } else if (IsMember(value, json_keys::kError) && + IsMember(value[json_keys::kError], json_keys::kCode)) { + result_code = + GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>( + value[json_keys::kError][json_keys::kCode].asInt())); + + if (IsMember(value[json_keys::kError], json_keys::kMessage)) { + info = value[json_keys::kError][json_keys::kMessage].asCString(); + } + } + + if ((result_codes::kSuccess == result_code) || + (result_codes::kWarnings == result_code)) { + return true; + } + + return false; +} + +void BaseCommandRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + if (!Validate()) { + LOG4CXX_WARN(logger_, "Request message validation failed !"); + SendResponse( + false, result_codes::kInvalidData, "Validation by schema failed"); + return; + } + LOG4CXX_TRACE(logger_, "Request message validated successfully!"); + using application_manager::HmiInterfaces; + if (!service_->IsInterfaceAvailable(HmiInterfaces::HMI_INTERFACE_RC)) { + LOG4CXX_WARN(logger_, "HMI interface RC is not available"); + SendResponse(false, + result_codes::kUnsupportedResource, + "Remote control is not supported by system"); + return; + } + LOG4CXX_TRACE(logger_, "RC interface is available!"); + if (CheckPolicyPermissions() && CheckDriverConsent()) { + if (AcquireResources()) { + Execute(); // run child's logic + } + // If resource is not aqcuired, AcquireResources method will either + // send response to mobile or + // send additional request to HMI to ask driver consent + } +} + +bool BaseCommandRequest::CheckPolicyPermissions() { + LOG4CXX_AUTO_TRACE(logger_); + if (!app_) { + LOG4CXX_ERROR(logger_, "Application doesn't registered!"); + SendResponse(false, result_codes::kApplicationNotRegistered, ""); + return false; + } + + if (!service_->IsRemoteControlApplication(app_)) { + LOG4CXX_WARN(logger_, "Application has no remote control functions"); + SendResponse(false, result_codes::kDisallowed, ""); + return false; + } + + mobile_apis::Result::eType ret = service_->CheckPolicyPermissions(message_); + if (ret != mobile_apis::Result::eType::SUCCESS) { + LOG4CXX_WARN(logger_, + "Function \"" << message_->function_name() << "\" (#" + << message_->function_id() + << ") not allowed by policy"); + + SendResponse(false, result_codes::kDisallowed, ""); + return false; + } + + return true; +} + +application_manager::TypeAccess BaseCommandRequest::CheckModule( + const Json::Value& message) { + const std::string& module = ModuleType(message); + return service_->CheckModule(app_->app_id(), module) + ? application_manager::TypeAccess::kAllowed + : application_manager::TypeAccess::kDisallowed; +} + +bool BaseCommandRequest::CheckDriverConsent() { + LOG4CXX_AUTO_TRACE(logger_); + RCAppExtensionPtr extension = GetAppExtension(app_); + if (!extension) { + return false; + } + Json::Value value; + Json::Reader reader; + LOG4CXX_DEBUG(logger_, "Request: " << message_->json_message()); + reader.parse(message_->json_message(), value); + + application_manager::TypeAccess access = CheckModule(value); + + if (IsAutoAllowed(access)) { + set_auto_allowed(true); + return true; + } else { + SendDisallowed(access); + } + return false; +} + +bool BaseCommandRequest::AcquireResources() { + LOG4CXX_AUTO_TRACE(logger_); + const Json::Value message_params = + MessageHelper::StringToValue(message_->json_message()); + + if (!IsResourceFree(ModuleType(message_params))) { + LOG4CXX_WARN(logger_, "Resource is busy."); + SendResponse(false, result_codes::kInUse, ""); + return false; + } + + AcquireResult::eType acquire_result = AcquireResource(message_params); + switch (acquire_result) { + case AcquireResult::ALLOWED: { + SetResourceState(msg_json_, ResourceState::BUSY); + return true; + } + case AcquireResult::IN_USE: { + SendResponse(false, result_codes::kInUse, ""); + return false; + } + case AcquireResult::ASK_DRIVER: { + SetResourceState(msg_json_, ResourceState::BUSY); + + Json::Value value; + Json::Reader reader; + LOG4CXX_DEBUG(logger_, "Request: " << message_->json_message()); + reader.parse(message_->json_message(), value); + + SendGetUserConsent(value); + + return false; + } + case AcquireResult::REJECTED: { + SendResponse(false, result_codes::kRejected, ""); + return false; + } + } + + return false; +} + +bool BaseCommandRequest::IsAutoAllowed( + application_manager::TypeAccess access) const { + return access == application_manager::kAllowed; +} + +void BaseCommandRequest::SendDisallowed( + application_manager::TypeAccess access) { + LOG4CXX_AUTO_TRACE(logger_); + std::string info; + switch (access) { + case application_manager::kAllowed: + return; + case application_manager::kDisallowed: + info = disallowed_info_.empty() + ? "The RPC is disallowed by vehicle settings" + : disallowed_info_; + break; + default: + info = "Unknown issue"; + } + LOG4CXX_ERROR(logger_, info); + SendResponse(false, result_codes::kDisallowed, info); +} + +void BaseCommandRequest::SendGetUserConsent(const Json::Value& value) { + LOG4CXX_AUTO_TRACE(logger_); + DCHECK(app_); + Json::Value params; + params[json_keys::kAppId] = app_->hmi_app_id(); + params[message_params::kModuleType] = ModuleType(value); + SendRequest(functional_modules::hmi_api::get_user_consent, params); +} + +std::string BaseCommandRequest::ModuleType(const Json::Value& message) { + return ""; +} + +std::vector<std::string> BaseCommandRequest::ControlData( + const Json::Value& message) { + return std::vector<std::string>(); +} + +void BaseCommandRequest::on_event( + const rc_event_engine::Event<application_manager::MessagePtr, std::string>& + event) { + LOG4CXX_AUTO_TRACE(logger_); + + SetResourceState(msg_json_, ResourceState::FREE); + + if (event.id() == functional_modules::hmi_api::get_user_consent) { + ProcessAccessResponse(event); + } else { + OnEvent(event); // run child's logic + } +} + +void BaseCommandRequest::ProcessAccessResponse( + const rc_event_engine::Event<application_manager::MessagePtr, std::string>& + event) { + LOG4CXX_AUTO_TRACE(logger_); + if (!app_) { + LOG4CXX_ERROR(logger_, "Application doesn't registered!"); + SendResponse(false, result_codes::kApplicationNotRegistered, ""); + return; + } + + application_manager::Message& hmi_response = *(event.event_message()); + const application_manager::MessageValidationResult validate_result = + service_->ValidateMessageBySchema(hmi_response); + LOG4CXX_DEBUG(logger_, + "HMI response validation result is " << validate_result); + + if (validate_result != + application_manager::MessageValidationResult::SUCCESS) { + SendResponse( + false, result_codes::kGenericError, "HMI has sent invalid parameters"); + return; + } + + Json::Value value; + Json::Reader reader; + reader.parse(event.event_message()->json_message(), value); + + std::string result_code; + std::string info; + const bool is_succeeded = ParseResultCode(value, result_code, info); + + bool is_allowed = false; + if (is_succeeded) { + if (IsMember(value[json_keys::kResult], message_params::kAllowed) && + value[json_keys::kResult][message_params::kAllowed].isBool()) { + is_allowed = value[json_keys::kResult][message_params::kAllowed].asBool(); + } + + const std::string module = ModuleType(msg_json_); + + // Check the actual User's answer. + LOG4CXX_DEBUG(logger_, + "Setting allowed access for " << app_->app_id() << " for " + << module); + if (is_allowed) { + rc_module_.resource_allocation_manager().ForceAcquireResource( + module, app_->app_id()); + + Execute(); // run child's logic + } else { + rc_module_.resource_allocation_manager().OnDriverDisallowed( + module, app_->app_id()); + + SendResponse( + false, + result_codes::kRejected, + "The resource is in use and the driver disallows this remote " + "control RPC"); + } + } else { + SendResponse(false, result_code.c_str(), info); + } +} + +} // namespace commands +} // namespace remote_control diff --git a/src/components/remote_control/src/commands/button_press_request.cc b/src/components/remote_control/src/commands/button_press_request.cc new file mode 100644 index 0000000000..1e5eef1e64 --- /dev/null +++ b/src/components/remote_control/src/commands/button_press_request.cc @@ -0,0 +1,264 @@ +/* + Copyright (c) 2017, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "remote_control/commands/button_press_request.h" +#include "remote_control/message_helper.h" +#include "remote_control/rc_module_constants.h" +#include "functional_module/function_ids.h" +#include "json/json.h" +#include "utils/helpers.h" +#include "interfaces/MOBILE_API.h" + +namespace remote_control { + +namespace commands { + +using namespace json_keys; +using namespace message_params; + +typedef std::map<std::string, mobile_apis::ButtonName::eType> ButtonsMap; + +CREATE_LOGGERPTR_GLOBAL(logger_, "ButtonPressRequest") + +ButtonPressRequest::ButtonPressRequest( + const application_manager::MessagePtr& message, + RemotePluginInterface& rc_module) + : BaseCommandRequest(message, rc_module) {} + +ButtonPressRequest::~ButtonPressRequest() {} + +const std::vector<std::string> buttons_climate() { + std::vector<std::string> data; + data.push_back(enums_value::kACMax); + data.push_back(enums_value::kAC); + data.push_back(enums_value::kRecirculate); + data.push_back(enums_value::kFanUp); + data.push_back(enums_value::kFanDown); + data.push_back(enums_value::kTempUp); + data.push_back(enums_value::kTempDown); + data.push_back(enums_value::kDefrostMax); + data.push_back(enums_value::kDefrost); + data.push_back(enums_value::kDefrostRear); + data.push_back(enums_value::kUpperVent); + data.push_back(enums_value::kLowerVent); + return data; +} + +const std::vector<std::string> buttons_radio() { + std::vector<std::string> data; + data.push_back(enums_value::kVolumeUp); + data.push_back(enums_value::kVolumeDown); + data.push_back(enums_value::kEject); + data.push_back(enums_value::kSource); + data.push_back(enums_value::kShuffle); + data.push_back(enums_value::kRepeat); + return data; +} + +const ButtonsMap buttons_map() { + using namespace mobile_apis; + + ButtonsMap buttons_map; + buttons_map[enums_value::kACMax] = ButtonName::AC_MAX; + buttons_map[enums_value::kAC] = ButtonName::AC; + buttons_map[enums_value::kRecirculate] = ButtonName::RECIRCULATE; + buttons_map[enums_value::kFanUp] = ButtonName::FAN_UP; + buttons_map[enums_value::kFanDown] = ButtonName::FAN_DOWN; + buttons_map[enums_value::kTempUp] = ButtonName::TEMP_UP; + buttons_map[enums_value::kTempDown] = ButtonName::TEMP_DOWN; + buttons_map[enums_value::kDefrostMax] = ButtonName::DEFROST_MAX; + buttons_map[enums_value::kDefrost] = ButtonName::DEFROST; + buttons_map[enums_value::kDefrostRear] = ButtonName::DEFROST_REAR; + buttons_map[enums_value::kUpperVent] = ButtonName::UPPER_VENT; + buttons_map[enums_value::kLowerVent] = ButtonName::LOWER_VENT; + buttons_map[enums_value::kVolumeUp] = ButtonName::VOLUME_UP; + buttons_map[enums_value::kVolumeDown] = ButtonName::VOLUME_DOWN; + buttons_map[enums_value::kEject] = ButtonName::EJECT; + buttons_map[enums_value::kSource] = ButtonName::SOURCE; + buttons_map[enums_value::kShuffle] = ButtonName::SHUFFLE; + buttons_map[enums_value::kRepeat] = ButtonName::REPEAT; + + return buttons_map; +} + +bool CheckIfButtonExistInRCCaps( + const smart_objects::SmartObject& rc_capabilities, + const mobile_apis::ButtonName::eType button) { + if (rc_capabilities.keyExists(strings::kbuttonCapabilities)) { + const smart_objects::SmartObject& button_caps = + rc_capabilities[strings::kbuttonCapabilities]; + smart_objects::SmartArray::iterator it = button_caps.asArray()->begin(); + for (; it != button_caps.asArray()->end(); ++it) { + smart_objects::SmartObject& so = *it; + int64_t current_id = so[message_params::kName].asInt(); + if (-1 == current_id) { + // capabilities received from HMI contains enum values + // capabilities loaded from file contains string values + // TODO : unificate capabilities storing + const std::string& bt_name = so[message_params::kName].asString(); + static ButtonsMap btn_map = buttons_map(); + current_id = btn_map[bt_name]; + } + const mobile_apis::ButtonName::eType current_button = + static_cast<mobile_apis::ButtonName::eType>(current_id); + if (current_button == button) { + LOG4CXX_TRACE(logger_, + "Button id " << current_button + << " exist in capabilities"); + return true; + } + } + } + LOG4CXX_TRACE(logger_, + "Button id " << button << " do not exist in capabilities"); + return false; +} + +bool CheckButtonName(const std::string& module_type, + const std::string& button_name, + const smart_objects::SmartObject* rc_capabilities) { + LOG4CXX_AUTO_TRACE(logger_); + if (rc_capabilities == NULL) { + LOG4CXX_ERROR(logger_, "No remote controll capabilities available"); + return false; + } + + if (enums_value::kRadio == module_type) { + if (!helpers::in_range(buttons_radio(), button_name)) { + LOG4CXX_WARN(logger_, + "Trying to acceess climate button with module type radio"); + return false; + } + } + + if (enums_value::kClimate == module_type) { + if (!helpers::in_range(buttons_climate(), button_name)) { + LOG4CXX_WARN(logger_, + "Trying to acceess radio button with module type climate"); + return false; + } + } + return true; +} + +void ButtonPressRequest::Execute() { + LOG4CXX_AUTO_TRACE(logger_); + + const Json::Value request_params = + MessageHelper::StringToValue(message_->json_message()); + + const std::string button_name = request_params[kButtonName].asString(); + const std::string module_type = request_params[kModuleType].asString(); + + static ButtonsMap btn_map = buttons_map(); + mobile_apis::ButtonName::eType button_id = + mobile_apis::ButtonName::INVALID_ENUM; + if (btn_map.end() != btn_map.find(button_name)) { + button_id = btn_map[button_name]; + } + + const smart_objects::SmartObject* rc_capabilities = + service()->GetRCCapabilities(); + const bool button_name_matches_module_type = + CheckButtonName(module_type, button_name, rc_capabilities); + const bool button_id_exist_in_caps = + rc_capabilities && + CheckIfButtonExistInRCCaps(*rc_capabilities, button_id); + + if (button_name_matches_module_type && button_id_exist_in_caps) { + SendRequest(functional_modules::hmi_api::button_press, request_params); + } else if (!button_name_matches_module_type) { + LOG4CXX_WARN(logger_, "Request module type and button name mismatch!"); + SendResponse(false, + result_codes::kInvalidData, + "Request module type and button name mismatch!"); + } else { + LOG4CXX_WARN(logger_, "Requested button is not exists in capabilities!"); + SendResponse(false, + result_codes::kUnsupportedResource, + "Requested button is not exists in capabilities!"); + } +} + +AcquireResult::eType ButtonPressRequest::AcquireResource( + const Json::Value& message) { + ResourceAllocationManager& allocation_manager = + rc_module_.resource_allocation_manager(); + const std::string& module_type = ModuleType(message); + const uint32_t app_id = app()->app_id(); + return allocation_manager.AcquireResource(module_type, app_id); +} + +bool ButtonPressRequest::IsResourceFree(const std::string& module_type) const { + return rc_module_.resource_allocation_manager().IsResourceFree(module_type); +} + +void ButtonPressRequest::SetResourceState(const Json::Value& message, + const ResourceState::eType state) { + const std::string& module_type = ModuleType(message); + const uint32_t app_id = app()->app_id(); + + ResourceAllocationManager& allocation_manager = + rc_module_.resource_allocation_manager(); + allocation_manager.SetResourceState(module_type, app_id, state); +} + +void ButtonPressRequest::OnEvent( + const rc_event_engine::Event<application_manager::MessagePtr, std::string>& + event) { + LOG4CXX_AUTO_TRACE(logger_); + DCHECK_OR_RETURN_VOID( + (functional_modules::hmi_api::button_press == event.id())); + + application_manager::Message& hmi_response = *(event.event_message()); + const Json::Value value = + MessageHelper::StringToValue(hmi_response.json_message()); + + std::string result_code; + std::string info; + + bool is_response_successful = ParseResultCode(value, result_code, info); + + if (remote_control::result_codes::kReadOnly == result_code) { + is_response_successful = false; + result_code = result_codes::kGenericError; + } + SendResponse(is_response_successful, result_code.c_str(), info); +} + +std::string ButtonPressRequest::ModuleType(const Json::Value& message) { + return message.get(message_params::kModuleType, Json::Value("")).asString(); +} + +} // namespace commands + +} // namespace remote_control diff --git a/src/components/remote_control/src/commands/get_interior_vehicle_data_request.cc b/src/components/remote_control/src/commands/get_interior_vehicle_data_request.cc new file mode 100644 index 0000000000..6a7e746aa5 --- /dev/null +++ b/src/components/remote_control/src/commands/get_interior_vehicle_data_request.cc @@ -0,0 +1,224 @@ +/* + Copyright (c) 2017, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include <map> + +#include "remote_control/commands/get_interior_vehicle_data_request.h" +#include "remote_control/rc_module_constants.h" +#include "remote_control/message_helper.h" +#include "remote_control/remote_control_plugin.h" +#include "functional_module/function_ids.h" +#include "json/json.h" + +namespace remote_control { + +namespace commands { + +using namespace enums_value; +using namespace json_keys; +using namespace message_params; + +CREATE_LOGGERPTR_GLOBAL(logger_, "GetInteriorVehicleDataRequest") + +GetInteriorVehicleDataRequest::GetInteriorVehicleDataRequest( + const application_manager::MessagePtr& message, + RemotePluginInterface& rc_module) + : BaseCommandRequest(message, rc_module) {} + +bool CheckIfModuleTypeExistInCapabilities( + const smart_objects::SmartObject& rc_capabilities, + const std::string& module_type) { + LOG4CXX_AUTO_TRACE(logger_); + if (enums_value::kRadio == module_type && + !rc_capabilities.keyExists(strings::kradioControlCapabilities)) { + LOG4CXX_DEBUG(logger_, " Radio control capabilities not present"); + return false; + } + if (enums_value::kClimate == module_type && + !rc_capabilities.keyExists(strings::kclimateControlCapabilities)) { + LOG4CXX_DEBUG(logger_, " Climate control capabilities not present"); + return false; + } + + return true; +} + +void GetInteriorVehicleDataRequest::Execute() { + LOG4CXX_AUTO_TRACE(logger_); + Json::Value request_params = + MessageHelper::StringToValue(message_->json_message()); + + const smart_objects::SmartObject* capabilities = + service()->GetRCCapabilities(); + if (capabilities && + !CheckIfModuleTypeExistInCapabilities(*capabilities, + ModuleType(request_params))) { + LOG4CXX_WARN(logger_, "Accessing not supported module data"); + SendResponse(false, + result_codes::kUnsupportedResource, + "Accessing not supported module data"); + return; + } + if (HasRequestExcessiveSubscription(request_params)) { + RemoveExcessiveSubscription(request_params); + } + + SendRequest(functional_modules::hmi_api::get_interior_vehicle_data, + request_params); +} + +void GetInteriorVehicleDataRequest::OnEvent( + const rc_event_engine::Event<application_manager::MessagePtr, std::string>& + event) { + LOG4CXX_AUTO_TRACE(logger_); + DCHECK_OR_RETURN_VOID( + (functional_modules::hmi_api::get_interior_vehicle_data == event.id())); + + application_manager::Message& hmi_response = *(event.event_message()); + const bool validate_result = + application_manager::MessageValidationResult::SUCCESS == + service()->ValidateMessageBySchema(hmi_response); + LOG4CXX_DEBUG(logger_, + "HMI response validation result is " << validate_result); + const Json::Value value = + MessageHelper::StringToValue(hmi_response.json_message()); + std::string result_code; + std::string info; + bool success = validate_result && ParseResultCode(value, result_code, info); + + if (!validate_result || + remote_control::result_codes::kReadOnly == result_code) { + success = false; + result_code = result_codes::kGenericError; + } + + if (success) { + ProccessSubscription(value); + response_params_[kModuleData] = + value[json_keys::kResult][message_params::kModuleData]; + } + SendResponse(success, result_code.c_str(), info); +} + +void GetInteriorVehicleDataRequest::ProccessSubscription( + const Json::Value& hmi_response) { + LOG4CXX_AUTO_TRACE(logger_); + Json::Value request_params; + Json::Reader reader; + reader.parse(message_->json_message(), request_params); + + const bool is_subscribe_present_in_request = + IsMember(request_params, kSubscribe); + const bool isSubscribed_present_in_response = + IsMember(hmi_response[json_keys::kResult], message_params::kIsSubscribed); + + if (!is_subscribe_present_in_request && !isSubscribed_present_in_response) { + return; + } + + RCAppExtensionPtr extension = GetAppExtension(app()); + if (is_subscribe_present_in_request && !isSubscribed_present_in_response) { + LOG4CXX_WARN(logger_, + "conditional mandatory parameter " + << kIsSubscribed << " missed in hmi response"); + response_params_[kIsSubscribed] = + extension->IsSubscibedToInteriorVehicleData( + request_params[kModuleType]); + return; + } + + if (!is_subscribe_present_in_request && isSubscribed_present_in_response) { + LOG4CXX_WARN(logger_, + "Parameter " << message_params::kIsSubscribed + << " is ignored due to absence '" + << message_params::kSubscribe + << "' parameter in request"); + return; + } + + const bool request_subscribe = request_params[kSubscribe].asBool(); + const bool response_subscribe = + hmi_response[json_keys::kResult][message_params::kIsSubscribed].asBool(); + response_params_[message_params::kIsSubscribed] = response_subscribe; + LOG4CXX_TRACE(logger_, "request_subscribe = " << request_subscribe); + LOG4CXX_TRACE(logger_, "response_subscribe = " << response_subscribe); + if (request_subscribe == response_subscribe) { + if (response_subscribe) { + LOG4CXX_DEBUG(logger_, + "SubscribeToInteriorVehicleData " + << app()->app_id() << " " + << request_params[kModuleType].asString()); + extension->SubscribeToInteriorVehicleData(request_params[kModuleType]); + } else { + LOG4CXX_DEBUG(logger_, + "UnsubscribeFromInteriorVehicleData " + << app()->app_id() << " " + << request_params[kModuleType].asString()); + extension->UnsubscribeFromInteriorVehicleData( + request_params[kModuleType]); + } + } +} + +bool GetInteriorVehicleDataRequest::HasRequestExcessiveSubscription( + const Json::Value& request_params) { + LOG4CXX_AUTO_TRACE(logger_); + const bool is_subscribe_present_in_request = + IsMember(request_params, kSubscribe); + if (is_subscribe_present_in_request) { + RCAppExtensionPtr extension = GetAppExtension(app()); + const bool is_app_already_subscribed = + extension->IsSubscibedToInteriorVehicleData( + request_params[kModuleType]); + const bool app_wants_to_subscribe = request_params[kSubscribe].asBool(); + if (!app_wants_to_subscribe && !is_app_already_subscribed) { + return true; + } + return app_wants_to_subscribe && is_app_already_subscribed; + } + return false; +} + +void GetInteriorVehicleDataRequest::RemoveExcessiveSubscription( + Json::Value& request_params) { + LOG4CXX_AUTO_TRACE(logger_); + request_params.removeMember(kSubscribe); +} + +std::string GetInteriorVehicleDataRequest::ModuleType( + const Json::Value& message) { + return message.get(message_params::kModuleType, "").asString(); +} + +} // namespace commands + +} // namespace remote_control diff --git a/src/components/remote_control/src/commands/on_interior_vehicle_data_notification.cc b/src/components/remote_control/src/commands/on_interior_vehicle_data_notification.cc new file mode 100644 index 0000000000..fccd8392c7 --- /dev/null +++ b/src/components/remote_control/src/commands/on_interior_vehicle_data_notification.cc @@ -0,0 +1,103 @@ +/* + Copyright (c) 2017, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "remote_control/commands/on_interior_vehicle_data_notification.h" +#include <algorithm> +#include <vector> +#include "json/json.h" +#include "utils/make_shared.h" +#include "remote_control/rc_module_constants.h" +#include "remote_control/message_helper.h" +#include "remote_control/remote_control_plugin.h" +#include "remote_control/rc_app_extension.h" + +namespace remote_control { + +namespace commands { + +CREATE_LOGGERPTR_GLOBAL(logger_, "OnInteriorVehicleDataNotification") + +OnInteriorVehicleDataNotification::OnInteriorVehicleDataNotification( + const application_manager::MessagePtr& message, + RemotePluginInterface& rc_module) + : BaseCommandNotification(message, rc_module) {} + +OnInteriorVehicleDataNotification::~OnInteriorVehicleDataNotification() {} + +void OnInteriorVehicleDataNotification::Execute() { + LOG4CXX_AUTO_TRACE(logger_); + + Json::Value json; + + application_manager::MessagePtr msg = message(); + + json = MessageHelper::StringToValue(msg->json_message()); + + Json::Value module_type = ModuleType(json); + + typedef std::vector<application_manager::ApplicationSharedPtr> AppPtrs; + AppPtrs apps = service_->GetApplications(rc_module_.GetModuleID()); + + for (AppPtrs::iterator it = apps.begin(); it != apps.end(); ++it) { + DCHECK(*it); + application_manager::Application& app = **it; + + RCAppExtensionPtr extension = + application_manager::AppExtensionPtr::static_pointer_cast< + RCAppExtension>(app.QueryInterface(rc_module_.GetModuleID())); + DCHECK(extension); + LOG4CXX_TRACE(logger_, "Check subscription for " << app.app_id()); + if (extension->IsSubscibedToInteriorVehicleData(module_type)) { + application_manager::MessagePtr message = + utils::MakeShared<application_manager::Message>(*msg); + message->set_message_type( + application_manager::MessageType::kNotification); + message->set_protocol_version(app.protocol_version()); + message->set_function_id(functional_modules::ON_INTERIOR_VEHICLE_DATA); + message->set_function_name(MessageHelper::GetMobileAPIName( + functional_modules::ON_INTERIOR_VEHICLE_DATA)); + message->set_connection_key(app.app_id()); + NotifyOneApplication(message); + } + } +} + +std::string OnInteriorVehicleDataNotification::ModuleType( + const Json::Value& message) { + const Json::Value& module_data = + message.get(message_params::kModuleData, Json::Value(Json::objectValue)); + return module_data.get(message_params::kModuleType, "").asString(); +} + +} // namespace commands + +} // namespace remote_control diff --git a/src/components/remote_control/src/commands/on_remote_control_settings_notification.cc b/src/components/remote_control/src/commands/on_remote_control_settings_notification.cc new file mode 100644 index 0000000000..f18180aa21 --- /dev/null +++ b/src/components/remote_control/src/commands/on_remote_control_settings_notification.cc @@ -0,0 +1,122 @@ +/* + Copyright (c) 2017, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "remote_control/commands/on_remote_control_settings_notification.h" +#include <algorithm> +#include <vector> +#include "json/json.h" +#include "remote_control/rc_module_constants.h" +#include "remote_control/message_helper.h" +#include "remote_control/remote_control_plugin.h" +#include "remote_control/rc_app_extension.h" +#include "functional_module/function_ids.h" + +namespace remote_control { + +namespace commands { + +CREATE_LOGGERPTR_GLOBAL(logger_, "OnRemoteControlSettingsNotification"); + +OnRemoteControlSettingsNotification::OnRemoteControlSettingsNotification( + const application_manager::MessagePtr& message, + RemotePluginInterface& rc_module) + : BaseCommandNotification(message, rc_module) {} + +void UnsubscribeFromInteriorVehicleDataForAllModules( + RCAppExtensionPtr extension) { + LOG4CXX_AUTO_TRACE(logger_); + const Json::Value climate(enums_value::kClimate); + extension->UnsubscribeFromInteriorVehicleData(climate); + const Json::Value radio(enums_value::kRadio); + extension->UnsubscribeFromInteriorVehicleData(radio); +} + +void OnRemoteControlSettingsNotification::DisallowRCFunctionality() { + LOG4CXX_AUTO_TRACE(logger_); + typedef std::vector<application_manager::ApplicationSharedPtr> Apps; + Apps apps = service_->GetApplications(rc_module_.GetModuleID()); + for (Apps::iterator it = apps.begin(); it != apps.end(); ++it) { + application_manager::ApplicationSharedPtr app = *it; + DCHECK(app); + service_->ChangeNotifyHMILevel(app, mobile_apis::HMILevel::eType::HMI_NONE); + + const RCAppExtensionPtr extension = + application_manager::AppExtensionPtr::static_pointer_cast< + RCAppExtension>(app->QueryInterface(rc_module_.GetModuleID())); + if (extension) { + UnsubscribeFromInteriorVehicleDataForAllModules(extension); + } + } +} + +void OnRemoteControlSettingsNotification::Execute() { + LOG4CXX_AUTO_TRACE(logger_); + const Json::Value value = + MessageHelper::StringToValue(message()->json_message()); + + if (!value.isMember(message_params::kAllowed)) { + LOG4CXX_DEBUG(logger_, + "Notification is ignored due to \"allow\" parameter absense"); + LOG4CXX_DEBUG(logger_, "RC Functionality remains unchanged"); + return; + } + ResourceAllocationManager& allocation_manager = + rc_module_.resource_allocation_manager(); + const bool is_allowed = value[message_params::kAllowed].asBool(); + if (is_allowed) { + hmi_apis::Common_RCAccessMode::eType access_mode = + hmi_apis::Common_RCAccessMode::INVALID_ENUM; + LOG4CXX_DEBUG(logger_, "Allowing RC Functionality"); + if (value.isMember(message_params::kAccessMode)) { + const std::string access_mode_str = + value.get(message_params::kAccessMode, enums_value::kAutoAllow) + .asString(); + + access_mode = MessageHelper::AccessModeFromString(access_mode_str); + LOG4CXX_DEBUG(logger_, "Setting up access mode : " << access_mode_str); + } else { + access_mode = allocation_manager.GetAccessMode(); + LOG4CXX_DEBUG(logger_, + "No access mode received. Using last known: " + << MessageHelper::AccessModeToString(access_mode)); + } + allocation_manager.SetAccessMode(access_mode); + } else { + LOG4CXX_DEBUG(logger_, "Disallowing RC Functionality"); + DisallowRCFunctionality(); + allocation_manager.ResetAllAllocations(); + } +} + +} // namespace commands + +} // namespace remote_control diff --git a/src/components/remote_control/src/commands/set_interior_vehicle_data_request.cc b/src/components/remote_control/src/commands/set_interior_vehicle_data_request.cc new file mode 100644 index 0000000000..70fbd9280e --- /dev/null +++ b/src/components/remote_control/src/commands/set_interior_vehicle_data_request.cc @@ -0,0 +1,350 @@ +/* + Copyright (c) 2017, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "remote_control/commands/set_interior_vehicle_data_request.h" +#include <algorithm> +#include "remote_control/rc_module_constants.h" +#include "remote_control/message_helper.h" +#include "functional_module/function_ids.h" +#include "json/json.h" +#include "utils/helpers.h" + +namespace remote_control { + +namespace commands { + +using namespace json_keys; +using namespace message_params; + +namespace { +std::vector<std::string> GetModuleReadOnlyParams( + const std::string& module_type) { + std::vector<std::string> module_ro_params; + if (enums_value::kClimate == module_type) { + module_ro_params.push_back(kCurrentTemperature); + } else if (enums_value::kRadio == module_type) { + module_ro_params.push_back(kRdsData); + module_ro_params.push_back(kAvailableHDs); + module_ro_params.push_back(kSignalStrength); + module_ro_params.push_back(kSignalChangeThreshold); + module_ro_params.push_back(kState); + } + return module_ro_params; +} + +const std::map<std::string, std::string> GetModuleDataToCapabilitiesMapping() { + std::map<std::string, std::string> mapping; + // climate + mapping["fanSpeed"] = "fanSpeedAvailable"; + mapping["currentTemperature"] = "currentTemperatureAvailable"; + mapping["desiredTemperature"] = "desiredTemperatureAvailable"; + mapping["acEnable"] = "acEnableAvailable"; + mapping["circulateAirEnable"] = "circulateAirEnableAvailable"; + mapping["autoModeEnable"] = "autoModeEnableAvailable"; + mapping["defrostZone"] = "defrostZoneAvailable"; + mapping["dualModeEnable"] = "dualModeEnableAvailable"; + mapping["acMaxEnable"] = "acMaxEnableAvailable"; + mapping["ventilationMode"] = "ventilationModeAvailable"; + + // radio + mapping["band"] = "radioBandAvailable"; + mapping["frequencyInteger"] = "radioFrequencyAvailable"; + mapping["frequencyFraction"] = "radioFrequencyAvailable"; + mapping["rdsData"] = "rdsDataAvailable"; + mapping["availableHDs"] = "availableHDsAvailable"; + mapping["hdChannel"] = "availableHDsAvailable"; + mapping["signalStrength"] = "signalStrengthAvailable"; + mapping["signalChangeThreshold"] = "signalChangeThresholdAvailable"; + mapping["radioEnable"] = "radioEnableAvailable"; + mapping["state"] = "stateAvailable"; + + return mapping; +} +} // namespace + +CREATE_LOGGERPTR_GLOBAL(logger_, "SetInteriorVehicleDataRequest") + +SetInteriorVehicleDataRequest::SetInteriorVehicleDataRequest( + const application_manager::MessagePtr& message, + RemotePluginInterface& rc_module) + : BaseCommandRequest(message, rc_module) {} + +SetInteriorVehicleDataRequest::~SetInteriorVehicleDataRequest() {} + +bool CheckControlDataByCapabilities( + const smart_objects::SmartObject& module_caps, + const Json::Value& control_data) { + std::map<std::string, std::string> mapping = + GetModuleDataToCapabilitiesMapping(); + Json::Value::Members control_data_keys = control_data.getMemberNames(); + + Json::Value::Members::const_iterator it = control_data_keys.begin(); + for (; it != control_data_keys.end(); ++it) { + const std::string& request_parameter = *it; + const std::string& caps_key = mapping[request_parameter]; + const smart_objects::SmartObject& capabilities_status = module_caps[0]; + LOG4CXX_DEBUG(logger_, + "Checking request parameter " + << request_parameter + << " with capabilities. Appropriate key is " << caps_key); + if (!capabilities_status.keyExists(caps_key)) { + LOG4CXX_DEBUG(logger_, + "Capability " + << caps_key + << " is missed in RemoteControl capabilities"); + return false; + } + if (!capabilities_status[caps_key].asBool()) { + LOG4CXX_DEBUG(logger_, + "Capability " + << caps_key + << " is switched off in RemoteControl capabilities"); + return false; + } + } + return true; +} + +bool CheckIfModuleDataExistInCapabilities( + const smart_objects::SmartObject& rc_capabilities, + const Json::Value& module_data) { + LOG4CXX_AUTO_TRACE(logger_); + bool is_radio_data_valid = true; + bool is_climate_data_valid = true; + if (IsMember(module_data, kRadioControlData)) { + if (!rc_capabilities.keyExists(strings::kradioControlCapabilities)) { + LOG4CXX_DEBUG(logger_, " Radio control capabilities not present"); + return false; + } + const smart_objects::SmartObject& radio_caps = + rc_capabilities[strings::kradioControlCapabilities]; + is_radio_data_valid = CheckControlDataByCapabilities( + radio_caps, module_data[strings::kRadioControlData]); + } + if (IsMember(module_data, kClimateControlData)) { + if (!rc_capabilities.keyExists(strings::kclimateControlCapabilities)) { + LOG4CXX_DEBUG(logger_, " Climate control capabilities not present"); + return false; + } + const smart_objects::SmartObject& climate_caps = + rc_capabilities[strings::kclimateControlCapabilities]; + is_climate_data_valid = CheckControlDataByCapabilities( + climate_caps, module_data[strings::kClimateControlData]); + } + + return is_radio_data_valid && is_climate_data_valid; +} + +void SetInteriorVehicleDataRequest::Execute() { + LOG4CXX_AUTO_TRACE(logger_); + + Json::Value request_params = + MessageHelper::StringToValue(message_->json_message()); + const Json::Value module_data = request_params[kModuleData]; + const std::string module_type = module_data[kModuleType].asString(); + bool module_type_and_data_match = true; + + if (enums_value::kRadio == module_type) { + module_type_and_data_match = !IsMember(module_data, kClimateControlData); + } + + if (enums_value::kClimate == module_type) { + module_type_and_data_match = !IsMember(module_data, kRadioControlData); + } + + if (module_type_and_data_match) { + const smart_objects::SmartObject* capabilities = + service()->GetRCCapabilities(); + if (capabilities && + !CheckIfModuleDataExistInCapabilities(*capabilities, module_data)) { + LOG4CXX_WARN(logger_, "Accessing not supported module data"); + SendResponse(false, + result_codes::kUnsupportedResource, + "Accessing not supported module data"); + return; + } + if (AreAllParamsReadOnly(request_params)) { + LOG4CXX_WARN(logger_, "All request params in module type are READ ONLY!"); + SendResponse(false, + result_codes::kReadOnly, + "All request params in module type are READ ONLY!"); + return; + } + if (AreReadOnlyParamsPresent(request_params)) { + LOG4CXX_DEBUG(logger_, "Request module type has READ ONLY parameters"); + LOG4CXX_DEBUG(logger_, "Cutting-off READ ONLY parameters... "); + CutOffReadOnlyParams(request_params); + } + application_manager::MessagePtr hmi_request = CreateHmiRequest( + functional_modules::hmi_api::set_interior_vehicle_data, request_params); + service()->RemoveHMIFakeParameters(hmi_request); + SendMessageToHMI(hmi_request); + } else { + LOG4CXX_WARN(logger_, "Request module type & data mismatch!"); + SendResponse(false, + result_codes::kInvalidData, + "Request module type & data mismatch!"); + } +} + +AcquireResult::eType SetInteriorVehicleDataRequest::AcquireResource( + const Json::Value& message) { + return rc_module_.resource_allocation_manager().AcquireResource( + ModuleType(message), app()->app_id()); +} + +bool SetInteriorVehicleDataRequest::IsResourceFree( + const std::string& module_type) const { + return rc_module_.resource_allocation_manager().IsResourceFree(module_type); +} + +void SetInteriorVehicleDataRequest::SetResourceState( + const Json::Value& message, const ResourceState::eType state) { + const std::string& module_type = ModuleType(message); + const uint32_t app_id = app()->app_id(); + + ResourceAllocationManager& allocation_manager = + rc_module_.resource_allocation_manager(); + + allocation_manager.SetResourceState(module_type, app_id, state); +} + +bool SetInteriorVehicleDataRequest::AreReadOnlyParamsPresent( + const Json::Value& request_params) { + LOG4CXX_AUTO_TRACE(logger_); + std::vector<std::string> module_type_params = ControlData(request_params); + std::vector<std::string>::iterator it = module_type_params.begin(); + std::vector<std::string> ro_params = + GetModuleReadOnlyParams(ModuleType(request_params)); + for (; it != module_type_params.end(); ++it) { + if (helpers::in_range(ro_params, *it)) { + return true; + } + } + return false; +} + +void SetInteriorVehicleDataRequest::CutOffReadOnlyParams( + Json::Value& request_params) { + LOG4CXX_AUTO_TRACE(logger_); + std::vector<std::string> module_type_params = ControlData(request_params); + std::vector<std::string>::iterator it = module_type_params.begin(); + const std::string module_type = ModuleType(request_params); + std::vector<std::string> ro_params = GetModuleReadOnlyParams(module_type); + for (; it != module_type_params.end(); ++it) { + if (helpers::in_range(ro_params, *it)) { + if (enums_value::kClimate == module_type) { + request_params[message_params::kModuleData] + [message_params::kClimateControlData].removeMember(*it); + LOG4CXX_DEBUG(logger_, "Cutting-off READ ONLY parameter: " << *it); + } else if (enums_value::kRadio == module_type) { + request_params[message_params::kModuleData] + [message_params::kRadioControlData].removeMember(*it); + LOG4CXX_DEBUG(logger_, "Cutting-off READ ONLY parameter: " << *it); + } + } + } +} + +bool SetInteriorVehicleDataRequest::AreAllParamsReadOnly( + const Json::Value& request_params) { + LOG4CXX_AUTO_TRACE(logger_); + std::vector<std::string> module_type_params = ControlData(request_params); + std::vector<std::string>::iterator it = module_type_params.begin(); + std::vector<std::string> ro_params = + GetModuleReadOnlyParams(ModuleType(request_params)); + for (; it != module_type_params.end(); ++it) { + if (!helpers::in_range(ro_params, *it)) { + return false; + } + } + return true; +} + +void SetInteriorVehicleDataRequest::OnEvent( + const rc_event_engine::Event<application_manager::MessagePtr, std::string>& + event) { + LOG4CXX_AUTO_TRACE(logger_); + DCHECK_OR_RETURN_VOID( + (functional_modules::hmi_api::set_interior_vehicle_data == event.id())); + + application_manager::Message& hmi_response = *(event.event_message()); + if (application_manager::MessageValidationResult::SUCCESS != + service()->ValidateMessageBySchema(hmi_response)) { + SendResponse(false, result_codes::kGenericError, ""); + return; + } + + LOG4CXX_DEBUG(logger_, "HMI response is valid"); + const Json::Value value = + MessageHelper::StringToValue(hmi_response.json_message()); + + std::string result_code; + std::string info; + + const bool is_response_successful = ParseResultCode(value, result_code, info); + + if (is_response_successful) { + response_params_[message_params::kModuleData] = + value[json_keys::kResult][message_params::kModuleData]; + } + + SendResponse(is_response_successful, result_code.c_str(), info); +} + +std::string SetInteriorVehicleDataRequest::ModuleType( + const Json::Value& message) { + const Json::Value& module_data = + message.get(message_params::kModuleData, Json::Value(Json::objectValue)); + return module_data.get(message_params::kModuleType, "").asString(); +} + +std::vector<std::string> SetInteriorVehicleDataRequest::ControlData( + const Json::Value& message) { + Json::Value data = + message.get(message_params::kModuleData, Json::Value(Json::objectValue)); + std::string module = ModuleType(message); + Json::Value params; + if (module == enums_value::kRadio) { + params = data.get(message_params::kRadioControlData, + Json::Value(Json::objectValue)); + } + if (module == enums_value::kClimate) { + params = data.get(message_params::kClimateControlData, + Json::Value(Json::objectValue)); + } + return params.getMemberNames(); +} + +} // namespace commands + +} // namespace remote_control diff --git a/src/components/remote_control/src/message_helper.cc b/src/components/remote_control/src/message_helper.cc new file mode 100644 index 0000000000..140e0a977a --- /dev/null +++ b/src/components/remote_control/src/message_helper.cc @@ -0,0 +1,154 @@ +/* + Copyright (c) 2017, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include <string> +#include "remote_control/message_helper.h" +#include "remote_control/rc_module_constants.h" +#include "utils/make_shared.h" + +namespace remote_control { +using functional_modules::RCFunctionID; +namespace { +std::map<RCFunctionID, std::string> GenerateAPINames() { + std::map<RCFunctionID, std::string> result; + result.insert(std::make_pair<RCFunctionID, std::string>( + RCFunctionID::BUTTON_PRESS, "ButtonPress")); + result.insert(std::make_pair<RCFunctionID, std::string>( + RCFunctionID::GET_INTERIOR_VEHICLE_DATA, "GetInteriorVehicleData")); + result.insert(std::make_pair<RCFunctionID, std::string>( + RCFunctionID::SET_INTERIOR_VEHICLE_DATA, "SetInteriorVehicleData")); + result.insert(std::make_pair<RCFunctionID, std::string>( + RCFunctionID::ON_INTERIOR_VEHICLE_DATA, "OnInteriorVehicleData")); + result.insert(std::make_pair<RCFunctionID, std::string>( + RCFunctionID::ON_REMOTE_CONTROL_SETTINGS, "OnRemoteControlSettings")); + return result; +} + +std::map<std::string, hmi_apis::Common_RCAccessMode::eType> access_modes{ + {enums_value::kAutoAllow, hmi_apis::Common_RCAccessMode::AUTO_ALLOW}, + {enums_value::kAutoDeny, hmi_apis::Common_RCAccessMode::AUTO_DENY}, + {enums_value::kAskDriver, hmi_apis::Common_RCAccessMode::ASK_DRIVER}}; +} + +const std::map<RCFunctionID, std::string> MessageHelper::kMobileAPINames = + GenerateAPINames(); + +const std::string MessageHelper::GetMobileAPIName(RCFunctionID func_id) { + std::map<RCFunctionID, std::string>::const_iterator it = + kMobileAPINames.find(func_id); + if (kMobileAPINames.end() != it) { + return it->second; + } else { + return ""; + } +} + +std::string MessageHelper::ValueToString(const Json::Value& value) { + Json::FastWriter writer; + + return writer.write(value); +} + +Json::Value MessageHelper::StringToValue(const std::string& string) { + Json::Reader reader; + Json::Value json; + + return reader.parse(string, json) ? json + : Json::Value(Json::ValueType::nullValue); +} + +bool IsMember(const Json::Value& value, const std::string& key) { + if (!value.isObject()) { + return false; + } + + return value.isMember(key); +} + +application_manager::MessagePtr MessageHelper::CreateHmiRequest( + const char* function_id, + const uint32_t hmi_app_id, + const Json::Value& message_params, + RemotePluginInterface& rc_module) { + using namespace json_keys; + Json::Value msg; + + msg[json_keys::kId] = rc_module.service()->GetNextCorrelationID(); + + msg[json_keys::kJsonrpc] = "2.0"; + msg[json_keys::kMethod] = function_id; + if (!message_params.isNull()) { + msg[json_keys::kParams] = message_params; + } + + msg[json_keys::kParams][json_keys::kAppId] = hmi_app_id; + + Json::FastWriter writer; + application_manager::MessagePtr message_to_send = + utils::MakeShared<application_manager::Message>( + application_manager::Message( + protocol_handler::MessagePriority::kDefault)); + message_to_send->set_protocol_version( + protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_HMI); + message_to_send->set_correlation_id(msg[json_keys::kId].asInt()); + message_to_send->set_function_name(msg[json_keys::kMethod].asString()); + std::string json_msg = writer.write(msg); + message_to_send->set_json_message(json_msg); + message_to_send->set_message_type(application_manager::MessageType::kRequest); + + return message_to_send; +} + +hmi_apis::Common_RCAccessMode::eType MessageHelper::AccessModeFromString( + const std::string& access_mode) { + std::map<std::string, hmi_apis::Common_RCAccessMode::eType>::const_iterator + mode = access_modes.find(access_mode); + return access_modes.end() != mode + ? mode->second + : hmi_apis::Common_RCAccessMode::INVALID_ENUM; +} + +std::string MessageHelper::AccessModeToString( + const hmi_apis::Common_RCAccessMode::eType access_mode) { + std::map<std::string, hmi_apis::Common_RCAccessMode::eType>::const_iterator + it = access_modes.begin(); + for (; access_modes.end() != it; ++it) { + if (access_mode == it->second) { + return it->first; + } + } + const std::string error = "UNKNOW_ACCESS_MODE"; + DCHECK_OR_RETURN(false, error); + return error; +} + +} // namespace remote_control diff --git a/src/components/remote_control/src/module_helper.cc b/src/components/remote_control/src/module_helper.cc new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/src/components/remote_control/src/module_helper.cc diff --git a/src/components/remote_control/src/rc_app_extension.cc b/src/components/remote_control/src/rc_app_extension.cc new file mode 100644 index 0000000000..3431a713f9 --- /dev/null +++ b/src/components/remote_control/src/rc_app_extension.cc @@ -0,0 +1,62 @@ +/* + Copyright (c) 2017, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "remote_control/rc_app_extension.h" + +namespace remote_control { +RCAppExtension::RCAppExtension(application_manager::AppExtensionUID uid) + : AppExtension(uid) {} + +void RCAppExtension::SubscribeToInteriorVehicleData( + const Json::Value& module_type) { + subscribed_interior_vehicle_data_.insert(module_type); +} + +void RCAppExtension::UnsubscribeFromInteriorVehicleData( + const Json::Value& module_type) { + subscribed_interior_vehicle_data_.erase(module_type); +} + +void RCAppExtension::UnsubscribeFromInteriorVehicleData() { + subscribed_interior_vehicle_data_.clear(); +} + +bool RCAppExtension::IsSubscibedToInteriorVehicleData( + const Json::Value& module_type) { + std::set<Json::Value>::iterator it = + subscribed_interior_vehicle_data_.find(module_type); + + return (it != subscribed_interior_vehicle_data_.end()); +} + +RCAppExtension::~RCAppExtension() {} +} // namespace remote_control diff --git a/src/components/remote_control/src/rc_command_factory.cc b/src/components/remote_control/src/rc_command_factory.cc new file mode 100644 index 0000000000..93b90b64ac --- /dev/null +++ b/src/components/remote_control/src/rc_command_factory.cc @@ -0,0 +1,86 @@ +/* + Copyright (c) 2017, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "utils/shared_ptr.h" +#include "utils/make_shared.h" +#include "remote_control/rc_command_factory.h" +#include "functional_module/function_ids.h" +#include "remote_control/commands/get_interior_vehicle_data_request.h" +#include "remote_control/commands/set_interior_vehicle_data_request.h" +#include "remote_control/commands/button_press_request.h" +#include "remote_control/commands/on_interior_vehicle_data_notification.h" +#include "remote_control/commands/on_remote_control_settings_notification.h" + +namespace remote_control { + +CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControl") + +using functional_modules::RCFunctionID; + +utils::SharedPtr<commands::Command> RCCommandFactory::CreateCommand( + const application_manager::MessagePtr& msg, + RemotePluginInterface& rc_module) { + switch (msg->function_id()) { + case RCFunctionID::GET_INTERIOR_VEHICLE_DATA: { + return utils::MakeShared<commands::GetInteriorVehicleDataRequest>( + msg, rc_module); + break; + } + case RCFunctionID::SET_INTERIOR_VEHICLE_DATA: { + return utils::MakeShared<commands::SetInteriorVehicleDataRequest>( + msg, rc_module); + break; + } + case RCFunctionID::BUTTON_PRESS: { + return utils::MakeShared<commands::ButtonPressRequest>(msg, rc_module); + break; + } + case RCFunctionID::ON_INTERIOR_VEHICLE_DATA: { + return utils::MakeShared<commands::OnInteriorVehicleDataNotification>( + msg, rc_module); + break; + } + case RCFunctionID::ON_REMOTE_CONTROL_SETTINGS: { + return utils::MakeShared<commands::OnRemoteControlSettingsNotification>( + msg, rc_module); + break; + } + default: { + utils::SharedPtr<commands::Command> invalid_command; + LOG4CXX_DEBUG(logger_, + "RSDL unable to proces function " << msg->function_id()); + return invalid_command; + } + } +} + +} // namespace remote_control diff --git a/src/components/remote_control/src/remote_control_event.cc b/src/components/remote_control/src/remote_control_event.cc new file mode 100644 index 0000000000..e4f887ffc6 --- /dev/null +++ b/src/components/remote_control/src/remote_control_event.cc @@ -0,0 +1,56 @@ +/* + Copyright (c) 2017, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "remote_control/remote_control_event.h" + +namespace remote_control { + +RCPluginEvent::RCPluginEvent(application_manager::MessagePtr& message, + const std::string& id) + : rc_event_engine::Event<application_manager::MessagePtr, std::string>( + message, id) {} + +RCPluginEvent::~RCPluginEvent() {} + +int32_t RCPluginEvent::event_message_function_id() const { + return event_message_->function_id(); +} + +int32_t RCPluginEvent::event_message_correlation_id() const { + return event_message_->correlation_id(); +} + +int32_t RCPluginEvent::event_message_type() const { + return event_message_->type(); +} + +} // namespace remote_control diff --git a/src/components/remote_control/src/remote_control_plugin.cc b/src/components/remote_control/src/remote_control_plugin.cc new file mode 100644 index 0000000000..e5a073d15e --- /dev/null +++ b/src/components/remote_control/src/remote_control_plugin.cc @@ -0,0 +1,334 @@ +/* + Copyright (c) 2017, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "remote_control/remote_control_plugin.h" +#include "remote_control/rc_command_factory.h" +#include "remote_control/remote_control_event.h" +#include "remote_control/rc_module_constants.h" +#include "remote_control/rc_app_extension.h" +#include "remote_control/message_helper.h" +#include "utils/logger.h" +#include "interfaces/MOBILE_API.h" +#include "utils/macro.h" +#include "utils/make_shared.h" +#include "application_manager/smart_object_keys.h" + +namespace remote_control { + +using functional_modules::ProcessResult; +using functional_modules::GenericModule; +using functional_modules::PluginInfo; +using functional_modules::RCFunctionID; +namespace hmi_api = functional_modules::hmi_api; + +using namespace json_keys; + +CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControl"); + +EXPORT_FUNCTION_IMPL(remote_control::RemoteControlPlugin); + +RemoteControlPlugin::RemoteControlPlugin() + : is_scan_started_(false), resource_allocation_manager_(*this) { + plugin_info_.name = "RemoteControlPlugin"; + plugin_info_.version = 1; + SubscribeOnFunctions(); +} + +void RemoteControlPlugin::SubscribeOnFunctions() { + plugin_info_.rc_function_list.push_back(RCFunctionID::BUTTON_PRESS); + plugin_info_.rc_function_list.push_back( + RCFunctionID::GET_INTERIOR_VEHICLE_DATA); + plugin_info_.rc_function_list.push_back( + RCFunctionID::SET_INTERIOR_VEHICLE_DATA); + plugin_info_.rc_function_list.push_back( + RCFunctionID::ON_INTERIOR_VEHICLE_DATA); + + plugin_info_.hmi_function_list.push_back(hmi_api::get_interior_vehicle_data); + plugin_info_.hmi_function_list.push_back(hmi_api::set_interior_vehicle_data); + plugin_info_.hmi_function_list.push_back(hmi_api::on_interior_vehicle_data); + plugin_info_.hmi_function_list.push_back(hmi_api::button_press); + plugin_info_.hmi_function_list.push_back(hmi_api::get_user_consent); + plugin_info_.hmi_function_list.push_back(hmi_api::on_remote_control_settings); +} + +RemoteControlPlugin::~RemoteControlPlugin() { + RemoveAppExtensions(); +} + +functional_modules::PluginInfo RemoteControlPlugin::GetPluginInfo() const { + return plugin_info_; +} + +const std::string ExtractFunctionAndAddMetadata( + const Json::Value& value, application_manager::Message& out_msg) { + if (value.isMember(json_keys::kMethod)) { + const std::string& function_name = + value.get(json_keys::kMethod, "").asCString(); + + // Existence of method name must be guaranteed by plugin manager + DCHECK_OR_RETURN(!function_name.empty(), ""); + + if (value.isMember(json_keys::kId)) { + out_msg.set_correlation_id(value.get(json_keys::kId, "").asInt()); + out_msg.set_message_type(application_manager::MessageType::kRequest); + } else { + out_msg.set_message_type(application_manager::MessageType::kNotification); + } + return function_name; + } + + if (value.isMember(json_keys::kResult)) { + const Json::Value& result = value.get(json_keys::kResult, Json::Value()); + const std::string& function_name = + result.get(json_keys::kMethod, "").asCString(); + out_msg.set_correlation_id(value.get(json_keys::kId, "").asInt()); + + // Existence of method name must be guaranteed by plugin manager + DCHECK_OR_RETURN(!function_name.empty(), ""); + + out_msg.set_message_type(application_manager::MessageType::kResponse); + return function_name; + } + + if (value.isMember(json_keys::kError)) { + const Json::Value& error = value.get(json_keys::kError, Json::Value()); + const Json::Value& data = error.get(json_keys::kData, Json::Value()); + const std::string& function_name = + data.get(json_keys::kMethod, "").asCString(); + + // Existence of method name must be guaranteed by plugin manager + DCHECK_OR_RETURN(!function_name.empty(), ""); + + out_msg.set_message_type(application_manager::MessageType::kErrorResponse); + out_msg.set_correlation_id(value.get(json_keys::kId, "").asInt()); + return function_name; + } + return std::string(); +} + +ProcessResult RemoteControlPlugin::ProcessMessage( + application_manager::MessagePtr msg) { + DCHECK_OR_RETURN(msg, ProcessResult::FAILED); + + const std::string& function_name = MessageHelper::GetMobileAPIName( + static_cast<functional_modules::RCFunctionID>(msg->function_id())); + + LOG4CXX_DEBUG(logger_, "Function name to set : " << function_name); + msg->set_function_name(function_name); + + LOG4CXX_DEBUG(logger_, "Mobile message: " << msg->json_message()); + + request_controller::MobileRequestPtr command( + RCCommandFactory::CreateCommand(msg, *this)); + if (command) { + request_controller_.AddRequest(msg->correlation_id(), command); + command->Run(); + } else { + return ProcessResult::CANNOT_PROCESS; + } + + return ProcessResult::PROCESSED; +} + +ProcessResult RemoteControlPlugin::ProcessHMIMessage( + application_manager::MessagePtr msg) { + LOG4CXX_AUTO_TRACE(logger_); + + Json::Value value; + Json::Reader reader; + reader.parse(msg->json_message(), value); + LOG4CXX_TRACE(logger_, "Process " << msg->json_message()); + const std::string& function_name = ExtractFunctionAndAddMetadata(value, *msg); + + // Existence of method name must be guaranteed by plugin manager + DCHECK_OR_RETURN(!function_name.empty(), ProcessResult::FAILED); + + LOG4CXX_DEBUG(logger_, "Process " << function_name); + + switch (msg->type()) { + case application_manager::MessageType::kResponse: + case application_manager::MessageType::kErrorResponse: { + RCPluginEvent event(msg, function_name); + LOG4CXX_DEBUG(logger_, "Response received"); + event_dispatcher_.raise_event(event); + return ProcessResult::PROCESSED; + } + case application_manager::MessageType::kRequest: + case application_manager::MessageType::kNotification: { + if (hmi_api::on_interior_vehicle_data == function_name) { + msg->set_function_id(functional_modules::ON_INTERIOR_VEHICLE_DATA); + } + if (hmi_api::on_remote_control_settings == function_name) { + msg->set_function_id(functional_modules::ON_REMOTE_CONTROL_SETTINGS); + } + const application_manager::MessageValidationResult validation_result = + service()->ValidateMessageBySchema(*msg); + utils::SharedPtr<commands::Command> command = + RCCommandFactory::CreateCommand(msg, *this); + if ((validation_result == + application_manager::MessageValidationResult::SUCCESS) && + command) { + command->Run(); + return ProcessResult::PROCESSED; + } + LOG4CXX_DEBUG(logger_, "Message validation failed"); + break; + } + default: { LOG4CXX_DEBUG(logger_, "Unknown message type"); } + } + return ProcessResult::CANNOT_PROCESS; +} + +void RemoteControlPlugin::SendHmiStatusNotification( + application_manager::ApplicationSharedPtr app) { + LOG4CXX_AUTO_TRACE(logger_); + application_manager::MessagePtr msg = new application_manager::Message( + protocol_handler::MessagePriority::kDefault); + Json::Value msg_params; + + msg->set_function_id(mobile_apis::FunctionID::OnHMIStatusID); + msg->set_message_type(application_manager::MessageType::kNotification); + + msg->set_connection_key(app->app_id()); + msg->set_protocol_version(app->protocol_version()); + + msg_params["hmiLevel"] = static_cast<uint32_t>(app->hmi_level()); + + msg_params["audioStreamingState"] = + static_cast<uint32_t>(app->audio_streaming_state()); + + msg_params["systemContext"] = static_cast<uint32_t>(app->system_context()); + + msg->set_json_message(MessageHelper::ValueToString(msg_params)); + + service()->SendMessageToMobile(msg); +} + +void RemoteControlPlugin::SendResponseToMobile( + application_manager::MessagePtr msg) { + LOG4CXX_DEBUG(logger_, "Response to mobile: " << msg->json_message()); + service()->SendMessageToMobile(msg); + request_controller_.DeleteRequest(msg->correlation_id()); +} + +void RemoteControlPlugin::SendTimeoutResponseToMobile( + application_manager::MessagePtr msg) { + LOG4CXX_DEBUG( + logger_, + "Timeout is expired. Response to mobile: " << msg->json_message()); + service()->SendMessageToMobile(msg); +} + +void RemoteControlPlugin::RemoveAppExtensions() { + std::vector<application_manager::ApplicationSharedPtr> applications = + service()->GetApplications(GetModuleID()); + + std::vector<application_manager::ApplicationSharedPtr>::iterator it = + applications.begin(); + + for (; it != applications.end(); ++it) { + application_manager::ApplicationSharedPtr app = *it; + if (app) { + app->RemoveExtension(GetModuleID()); + } + } +} + +void RemoteControlPlugin::RemoveAppExtension(uint32_t app_id) { + application_manager::ApplicationSharedPtr app = + service()->GetApplication(app_id); + + if (app) { + app->RemoveExtension(GetModuleID()); + } +} + +bool RemoteControlPlugin::IsAppForPlugin( + application_manager::ApplicationSharedPtr app) { + LOG4CXX_AUTO_TRACE(logger_); + application_manager::AppExtensionPtr app_extension = + app->QueryInterface(GetModuleID()); + if (app_extension) { + return true; + } + + if (service()->IsRemoteControlApplication(app)) { + RCAppExtensionPtr rc_app_extension = new RCAppExtension(GetModuleID()); + app->AddExtension(rc_app_extension); + service()->NotifyHMIAboutHMILevel(app, app->hmi_level()); + return true; + } + return false; +} + +void RemoteControlPlugin::OnAppHMILevelChanged( + application_manager::ApplicationSharedPtr app, + mobile_apis::HMILevel::eType) { + LOG4CXX_DEBUG(logger_, + "RSDL application " << app->name().AsMBString() + << " has changed hmi level to " + << app->hmi_level()); + service()->NotifyHMIAboutHMILevel(app, app->hmi_level()); +} + +void RemoteControlPlugin::OnPluginServiceChanged() { + LOG4CXX_AUTO_TRACE(logger_); + const functional_modules::TimeUnit timeout_msec = + service()->GetSettings().default_timeout(); + request_controller_.SetRequestTimeout(timeout_msec / 1000); +} + +void RemoteControlPlugin::set_service(application_manager::ServicePtr service) { + RemotePluginInterface::set_service(service); + OnPluginServiceChanged(); +} + +RCEventDispatcher& RemoteControlPlugin::event_dispatcher() { + return event_dispatcher_; +} + +ResourceAllocationManager& RemoteControlPlugin::resource_allocation_manager() { + return resource_allocation_manager_; +} + +void RemoteControlPlugin::OnApplicationEvent( + functional_modules::ApplicationEvent event, const uint32_t application_id) { + LOG4CXX_AUTO_TRACE(logger_); + resource_allocation_manager_.OnApplicationEvent(event, application_id); +} + +void RemoteControlPlugin::OnPolicyEvent(functional_modules::PolicyEvent event) { + LOG4CXX_AUTO_TRACE(logger_); + resource_allocation_manager_.OnPolicyEvent(event); +} + +} // namespace remote_control diff --git a/src/components/remote_control/src/request_controller.cc b/src/components/remote_control/src/request_controller.cc new file mode 100644 index 0000000000..9ffc639898 --- /dev/null +++ b/src/components/remote_control/src/request_controller.cc @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2017, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "remote_control/request_controller.h" +#include "json/json.h" +#include "utils/logger.h" + +namespace remote_control { +namespace request_controller { + +CREATE_LOGGERPTR_GLOBAL(logger_, "RCRequestController") + +RequestController::RequestController() { + timer_.AddObserver(this); + time_director_.RegisterTimer(timer_); +} + +RequestController::~RequestController() { + time_director_.UnregisterTimer(timer_); + timer_.RemoveObserver(this); +} + +void RequestController::AddRequest(const uint32_t mobile_correlation_id, + MobileRequestPtr request) { + // TODO(VS) Research and fix be problem with overlap correlation ids from two + // different apllications(on two different mobile devices) + sync_primitives::AutoLock lock(mobile_request_lock_); + LOG4CXX_DEBUG(logger_, + "Add request with correlation_id: " << mobile_correlation_id); + mobile_request_list_[mobile_correlation_id] = request; + // TODO(VS): add app id + timer_.AddTrackable(TrackableMessage(0, mobile_correlation_id)); + time_director_.ResetTimer(timer_); +} + +void RequestController::DeleteRequest(const uint32_t& mobile_correlation_id) { + sync_primitives::AutoLock lock(mobile_request_lock_); + LOG4CXX_DEBUG( + logger_, "Delete request with correlation_id: " << mobile_correlation_id); + mobile_request_list_.erase(mobile_correlation_id); + // TODO(VS): add app id + timer_.RemoveTrackable(TrackableMessage(0, mobile_correlation_id)); +} + +void RequestController::OnTimeoutTriggered(const TrackableMessage& expired) { + sync_primitives::AutoLock lock(mobile_request_lock_); + LOG4CXX_DEBUG(logger_, + "Timeout is expired for request with correlation_id: " + << expired.correlation_id()); + std::map<correlation_id, MobileRequestPtr>::iterator it = + mobile_request_list_.find(expired.correlation_id()); + if (mobile_request_list_.end() == it) { + // no corresponding request found, error. + return; + } + it->second->OnTimeout(); + mobile_request_list_.erase(it); +} + +void RequestController::SetRequestTimeout( + const functional_modules::TimeUnit timeout_seconds) { + LOG4CXX_DEBUG(logger_, "RC request timeout is set to " << timeout_seconds); + timer_.set_period(timeout_seconds); +} + +} // namespace request_controller +} // namespace remote_control diff --git a/src/components/remote_control/src/resource_allocation_manager_impl.cc b/src/components/remote_control/src/resource_allocation_manager_impl.cc new file mode 100644 index 0000000000..fd6c2d8fb8 --- /dev/null +++ b/src/components/remote_control/src/resource_allocation_manager_impl.cc @@ -0,0 +1,373 @@ +#include "remote_control/resource_allocation_manager_impl.h" +#include "application_manager/application.h" +#include "application_manager/message_helper.h" +#include "remote_control/rc_module_constants.h" +#include "json/json.h" +#include "utils/helpers.h" +#include "utils/make_shared.h" +#include "remote_control/message_helper.h" +#include "remote_control/rc_app_extension.h" + +namespace remote_control { + +CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule") + +ResourceAllocationManagerImpl::ResourceAllocationManagerImpl( + RemotePluginInterface& rc_plugin) + : current_access_mode_(hmi_apis::Common_RCAccessMode::AUTO_ALLOW) + , rc_plugin_(rc_plugin) {} + +ResourceAllocationManagerImpl::~ResourceAllocationManagerImpl() {} + +AcquireResult::eType ResourceAllocationManagerImpl::AcquireResource( + const std::string& module_type, const uint32_t app_id) { + LOG4CXX_AUTO_TRACE(logger_); + const application_manager::ApplicationSharedPtr acquiring_app = + rc_plugin_.service()->GetApplication(app_id); + if (!acquiring_app) { + LOG4CXX_WARN(logger_, "App with app_id: " << app_id << "does not exist!"); + return AcquireResult::IN_USE; + } + + sync_primitives::AutoLock lock(allocated_resources_lock_); + const AllocatedResources::const_iterator allocated_it = + allocated_resources_.find(module_type); + if (allocated_resources_.end() == allocated_it) { + allocated_resources_[module_type] = app_id; + LOG4CXX_DEBUG(logger_, + "Resource is not acquired yet. " + << "App: " << app_id << " is allowed to acquire " + << module_type); + return AcquireResult::ALLOWED; + } + + if (app_id == allocated_resources_[module_type]) { + LOG4CXX_DEBUG(logger_, + "App: " << app_id << " is already acquired resource " + << module_type); + return AcquireResult::ALLOWED; + } + + if (IsModuleTypeRejected(module_type, app_id)) { + LOG4CXX_DEBUG(logger_, + "Driver disallowed app: " << app_id << " to acquire " + << module_type); + return AcquireResult::REJECTED; + } + + const mobile_apis::HMILevel::eType acquiring_app_hmi_level = + acquiring_app->hmi_level(); + + if (mobile_apis::HMILevel::HMI_FULL != acquiring_app_hmi_level) { + LOG4CXX_DEBUG( + logger_, + "Aquiring resources is not allowed in HMI level: " + << application_manager::MessageHelper::StringifiedHMILevel( + acquiring_app_hmi_level) << ". App: " << app_id + << " is disallowed to acquire " << module_type); + return AcquireResult::REJECTED; + } + + switch (current_access_mode_) { + case hmi_apis::Common_RCAccessMode::AUTO_DENY: { + LOG4CXX_DEBUG(logger_, + "Current access_mode is AUTO_DENY. " + << "App: " << app_id << " is disallowed to acquire " + << module_type); + return AcquireResult::IN_USE; + } + case hmi_apis::Common_RCAccessMode::ASK_DRIVER: { + LOG4CXX_DEBUG(logger_, + "Current access_mode is ASK_DRIVER. " + "Driver confirmation is required for app: " + << app_id << " to acquire " << module_type); + return AcquireResult::ASK_DRIVER; + } + case hmi_apis::Common_RCAccessMode::AUTO_ALLOW: { + LOG4CXX_DEBUG(logger_, + "Current access_mode is AUTO_ALLOW. " + << "App: " << app_id << " is allowed to acquire " + << module_type); + + allocated_resources_[module_type] = app_id; + return AcquireResult::ALLOWED; + } + default: { DCHECK_OR_RETURN(false, AcquireResult::IN_USE); } + } +} + +void ResourceAllocationManagerImpl::ReleaseResource( + const std::string& module_type, const uint32_t application_id) { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, "Release " << module_type << " by " << application_id); + AllocatedResources::const_iterator allocation = + allocated_resources_.find(module_type); + if (allocated_resources_.end() == allocation) { + LOG4CXX_DEBUG(logger_, "Resource " << module_type << " is not allocated."); + return; + } + + if (application_id != allocation->second) { + LOG4CXX_DEBUG(logger_, + "Resource " << module_type + << " is allocated by different application " + << allocation->second); + return; + } + + allocated_resources_.erase(allocation); + LOG4CXX_DEBUG(logger_, "Resource " << module_type << " is released."); + return; +} + +void ResourceAllocationManagerImpl::ProcessApplicationPolicyUpdate() { + typedef std::vector<application_manager::ApplicationSharedPtr> Apps; + Apps app_list = + rc_plugin_.service()->GetApplications(rc_plugin_.GetModuleID()); + Apps::const_iterator app = app_list.begin(); + for (; app_list.end() != app; ++app) { + application_manager::ApplicationSharedPtr app_ptr = *app; + const uint32_t application_id = app_ptr->app_id(); + Resources acquired_modules = GetAcquiredResources(application_id); + std::sort(acquired_modules.begin(), acquired_modules.end()); + + Resources allowed_modules; + rc_plugin_.service()->GetModuleTypes((*app)->policy_app_id(), + &allowed_modules); + std::sort(allowed_modules.begin(), allowed_modules.end()); + + LOG4CXX_DEBUG(logger_, + "Acquired modules: " << acquired_modules.size() + << " , allowed modules: " + << allowed_modules.size()); + + Resources disallowed_modules; + std::set_difference(acquired_modules.begin(), + acquired_modules.end(), + allowed_modules.begin(), + allowed_modules.end(), + std::back_inserter(disallowed_modules)); + + RCAppExtensionPtr rc_extention = GetApplicationExtention(app_ptr); + Resources::const_iterator module = disallowed_modules.begin(); + for (; disallowed_modules.end() != module; ++module) { + ReleaseResource(*module, application_id); + if (rc_extention) { + rc_extention->UnsubscribeFromInteriorVehicleData(Json::Value(*module)); + } + } + } +} + +RCAppExtensionPtr ResourceAllocationManagerImpl::GetApplicationExtention( + application_manager::ApplicationSharedPtr application) { + LOG4CXX_AUTO_TRACE(logger_); + if (!application) { + return NULL; + } + + RCAppExtensionPtr rc_app_extension; + application_manager::AppExtensionPtr app_extension = + application->QueryInterface(rc_plugin_.GetModuleID()); + if (!app_extension) { + return NULL; + } + + rc_app_extension = + application_manager::AppExtensionPtr::static_pointer_cast<RCAppExtension>( + app_extension); + + return rc_app_extension; +} + +void ResourceAllocationManagerImpl::RemoveAppsSubscriptions(const Apps& apps) { + Apps::const_iterator app = apps.begin(); + for (; apps.end() != app; ++app) { + application_manager::ApplicationSharedPtr app_ptr = *app; + if (!app_ptr) { + continue; + } + RCAppExtensionPtr rc_extention = GetApplicationExtention(app_ptr); + if (rc_extention) { + rc_extention->UnsubscribeFromInteriorVehicleData(); + } + } +} + +std::vector<std::string> ResourceAllocationManagerImpl::GetAcquiredResources( + const uint32_t application_id) const { + LOG4CXX_AUTO_TRACE(logger_); + Resources allocated_resources; + AllocatedResources::const_iterator allocation = allocated_resources_.begin(); + for (; allocated_resources_.end() != allocation; ++allocation) { + if (application_id == allocation->second) { + allocated_resources.push_back(allocation->first); + } + } + + LOG4CXX_DEBUG(logger_, + "Application " << application_id << " acquired " + << allocated_resources.size() + << " resource(s)."); + + return allocated_resources; +} + +void ResourceAllocationManagerImpl::SetResourceState( + const std::string& module_type, + const uint32_t app_id, + const ResourceState::eType state) { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, + "Setting state for " << module_type << " by app_id " << app_id + << " to state " << state); + { + sync_primitives::AutoLock lock(allocated_resources_lock_); + const AllocatedResources::const_iterator allocated_it = + allocated_resources_.find(module_type); + + const bool acquired = allocated_resources_.end() != allocated_it; + if (acquired) { + LOG4CXX_DEBUG(logger_, + "Resource " << module_type << " is already acquired." + << " Owner application id is " + << allocated_it->second + << " Changing application id is " << app_id); + } else { + LOG4CXX_DEBUG(logger_, + "Resource " << module_type << " is not acquired yet"); + } + } + + sync_primitives::AutoLock lock(resources_state_lock_); + resources_state_[module_type] = state; + LOG4CXX_DEBUG(logger_, "Resource " << module_type << " got state " << state); +} + +bool ResourceAllocationManagerImpl::IsResourceFree( + const std::string& module_type) const { + LOG4CXX_AUTO_TRACE(logger_); + + sync_primitives::AutoLock lock(resources_state_lock_); + const ResourcesState::const_iterator resource = + resources_state_.find(module_type); + + if (resources_state_.end() == resource) { + LOG4CXX_DEBUG(logger_, "Resource " << module_type << " is free."); + return true; + } + + LOG4CXX_DEBUG(logger_, + "Resource " << module_type << " state is " << resource->second); + + return ResourceState::FREE == resource->second; +} + +void ResourceAllocationManagerImpl::SetAccessMode( + const hmi_apis::Common_RCAccessMode::eType access_mode) { + if (hmi_apis::Common_RCAccessMode::ASK_DRIVER != access_mode) { + sync_primitives::AutoLock lock(rejected_resources_for_application_lock_); + rejected_resources_for_application_.clear(); + } + current_access_mode_ = access_mode; +} + +hmi_apis::Common_RCAccessMode::eType +ResourceAllocationManagerImpl::GetAccessMode() const { + return current_access_mode_; +} + +void ResourceAllocationManagerImpl::ForceAcquireResource( + const std::string& module_type, const uint32_t app_id) { + LOG4CXX_DEBUG(logger_, "Force " << app_id << " acquiring " << module_type); + sync_primitives::AutoLock lock(allocated_resources_lock_); + allocated_resources_[module_type] = app_id; +} + +bool ResourceAllocationManagerImpl::IsModuleTypeRejected( + const std::string& module_type, const uint32_t app_id) { + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock lock(rejected_resources_for_application_lock_); + RejectedResources::iterator it = + rejected_resources_for_application_.find(app_id); + + if (rejected_resources_for_application_.end() == it) { + return false; + } + + const std::vector<std::string>& list_of_rejected_resources = + rejected_resources_for_application_[app_id]; + + return helpers::in_range(list_of_rejected_resources, module_type); +} + +void ResourceAllocationManagerImpl::OnDriverDisallowed( + const std::string& module_type, const uint32_t app_id) { + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock lock(rejected_resources_for_application_lock_); + RejectedResources::iterator it = + rejected_resources_for_application_.find(app_id); + + if (rejected_resources_for_application_.end() == it) { + rejected_resources_for_application_[app_id] = std::vector<std::string>(); + } + std::vector<std::string>& list_of_rejected_resources = + rejected_resources_for_application_[app_id]; + list_of_rejected_resources.push_back(module_type); +} + +void ResourceAllocationManagerImpl::OnApplicationEvent( + functional_modules::ApplicationEvent event, const uint32_t application_id) { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, "Event " << event << " came for " << application_id); + + if (functional_modules::ApplicationEvent::kApplicationExit == event || + functional_modules::ApplicationEvent::kApplicationUnregistered == event) { + Resources acquired_modules = GetAcquiredResources(application_id); + Resources::const_iterator module = acquired_modules.begin(); + for (; acquired_modules.end() != module; ++module) { + ReleaseResource(*module, application_id); + } + + Apps app_list; + app_list.push_back(rc_plugin_.service()->GetApplication(application_id)); + RemoveAppsSubscriptions(app_list); + } +} + +void ResourceAllocationManagerImpl::OnPolicyEvent( + functional_modules::PolicyEvent event) { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, "Event " << event); + + if (functional_modules::PolicyEvent::kApplicationPolicyUpdated == event) { + ProcessApplicationPolicyUpdate(); + return; + } + + if (functional_modules::PolicyEvent::kApplicationsDisabled == event) { + ResetAllAllocations(); + application_manager::ServicePtr s = rc_plugin_.service(); + Apps app_list = s->GetApplications(rc_plugin_.GetModuleID()); + RemoveAppsSubscriptions(app_list); + return; + } +} + +void ResourceAllocationManagerImpl::ResetAllAllocations() { + LOG4CXX_AUTO_TRACE(logger_); + { + sync_primitives::AutoLock lock(resources_state_lock_); + resources_state_.clear(); + } + { + sync_primitives::AutoLock lock(allocated_resources_lock_); + allocated_resources_.clear(); + } + { + sync_primitives::AutoLock lock(rejected_resources_for_application_lock_); + rejected_resources_for_application_.clear(); + } +} + +} // namespace remote_control diff --git a/src/components/remote_control/test/CMakeLists.txt b/src/components/remote_control/test/CMakeLists.txt new file mode 100644 index 0000000000..6457b56397 --- /dev/null +++ b/src/components/remote_control/test/CMakeLists.txt @@ -0,0 +1,67 @@ +include_directories ( + ${LOG4CXX_INCLUDE_DIRECTORY} + ${GMOCK_INCLUDE_DIRECTORY} + ${CMAKE_SOURCE_DIR}/src/components/functional_module/include/ + ${CMAKE_SOURCE_DIR}/src/components/functional_module/test/ + ${CMAKE_SOURCE_DIR}/src/components/remote_control/include/ + ${CMAKE_SOURCE_DIR}/src/components/remote_control/test/include/ + ${CMAKE_SOURCE_DIR}/src/components/include/ + ${CMAKE_SOURCE_DIR}/src/components/application_manager/test/include/ + ${CMAKE_SOURCE_DIR}/src/components/connection_handler/include/ + ${CMAKE_SOURCE_DIR}/src/components/smart_objects/include/ + ${CMAKE_SOURCE_DIR}/src/components/policy/src/policy/usage_statistics/include/ + ${JSONCPP_INCLUDE_DIRECTORY} + ${CMAKE_BINARY_DIR}/src/components/ + include/ +) + +set (SOURCES + src/rc_module_test.cc + src/rc_app_extension_test.cc + src/resource_allocation_manager_impl_test.cc + ${CMAKE_SOURCE_DIR}/src/components/application_manager/test/mock_message_helper.cc +) + +set (LIBRARIES + gtest + gmock + gmock_main + RemoteControlModule + SmartObjects + gcov + Policy +) + +if (ENABLE_TEST_COV_COUNT) + set(GCOV_FLAGS "-ftest-coverage -fprofile-arcs") +else() + set(GCOV_FLAGS "") +endif() + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCOV_FLAGS}") + +# use, i.e. don't skip the full RPATH for the build tree +#SET(CMAKE_SKIP_BUILD_RPATH FALSE) + +# when building, don't use the install RPATH already +# (but later on when installing) +#SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) + +#SET(RPATH_DIRECTORIES +# ${CMAKE_BINARY_DIR}/src/components/remote_control/ +# /usr/local/lib +# /usr/local +# ${CMAKE_BINARY_DIR}/src/components/utils +#) + +#SET(CMAKE_INSTALL_RPATH "${RPATH_DIRECTORIES}") + +add_custom_command( +OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libPolicy.so + COMMAND ${CMAKE_COMMAND} -E + copy ${COMPONENTS_DIR}/policy/libPolicy.so ${CMAKE_CURRENT_BINARY_DIR}) + set(CMAKE_EXE_LINKER_FLAGS + "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath=${CMAKE_CURRENT_BINARY_DIR}") + +create_test("remote_control_test" "${SOURCES}" "${LIBRARIES}") +add_subdirectory(commands) diff --git a/src/components/remote_control/test/commands/CMakeLists.txt b/src/components/remote_control/test/commands/CMakeLists.txt new file mode 100644 index 0000000000..09c706fc2f --- /dev/null +++ b/src/components/remote_control/test/commands/CMakeLists.txt @@ -0,0 +1,62 @@ +# Copyright (c) 2017, Ford Motor Company +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following +# disclaimer in the documentation and/or other materials provided with the +# distribution. +# +# Neither the name of the Ford Motor Company nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake) + +include_directories( + ${GMOCK_INCLUDE_DIRECTORY} + ${COMPONENTS_DIR}/remote_control/include/ + ${COMPONENTS_DIR}/remote_control/include/remote_control/ + ${COMPONENTS_DIR}/remote_control/include/remote_control/commands/ + ${COMPONENTS_DIR}/remote_control/test/include +) + +set(RC_COMMANDS_TEST_DIR ${RC_TEST_DIR}/commands) + +file(GLOB SOURCES + ${COMPONENTS_DIR}/application_manager/test/mock_message_helper.cc + ${RC_COMMANDS_TEST_DIR}/* +) + +set(LIBRARIES + gmock + RemoteControlModule + Utils + SmartObjects + jsoncpp + HMI_API + MOBILE_API + ApplicationManager + AMHMICommandsLibrary + AMMobileCommandsLibrary + connectionHandler +) + +create_test("rc_commands_test" "${SOURCES}" "${LIBRARIES}" ) diff --git a/src/components/remote_control/test/commands/button_press_request_test.cc b/src/components/remote_control/test/commands/button_press_request_test.cc new file mode 100644 index 0000000000..06a48fc077 --- /dev/null +++ b/src/components/remote_control/test/commands/button_press_request_test.cc @@ -0,0 +1,344 @@ +/* + * Copyright (c) 2017, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "remote_control/commands/button_press_request.h" +#include "gtest/gtest.h" +#include "mock_remote_control_plugin.h" +#include "mock_application.h" +#include "mock_resource_allocation_manager.h" +#include "remote_control/rc_app_extension.h" +#include "remote_control/remote_control_event.h" +#include "remote_control/rc_module_constants.h" +#include "remote_control/message_helper.h" +#include "remote_control/rc_command_factory.h" +#include "remote_control/event_engine/event_dispatcher.h" +#include "remote_control/rc_module_constants.h" +#include "functional_module/function_ids.h" +#include "include/mock_service.h" +#include "utils/shared_ptr.h" +#include "utils/make_shared.h" + +using functional_modules::RCFunctionID; +using application_manager::ServicePtr; + +using application_manager::MockService; +using test::components::remote_control_test::MockApplication; + +using ::testing::_; +using ::testing::Mock; +using ::testing::NiceMock; +using ::testing::Return; +using ::testing::ReturnRef; +using ::testing::SaveArg; +using ::application_manager::Message; +using ::application_manager::MessageType; +using ::protocol_handler::MessagePriority; +using remote_control::RemotePluginInterface; +using remote_control::MessageHelper; + +namespace { +const int kModuleId = 153; + +const std::string kCorrectMobileRequest = + "{\"moduleType\":\"CLIMATE\",\"buttonName\":\"AC\",\"buttonPressMode\":" + "\"SHORT\"}"; +const std::string kWrongMobileRequest = + "{\"moduleType\":\"RADIO\",\"buttonName\":\"AC\",\"buttonPressMode\":" + "\"SHORT\"}"; +const std::string kValidHmiResponse = + "{\"result\":{\"code\":0,\"method\":\"Buttons.ButtonPress\"},\"id\":31," + "\"jsonrpc\":\"2.0\"} "; +const std::string KReadOnlyHmiResponse = + "{\"jsonrpc\":\"2.0\",\"error\":{\"code\":26,\"data\":{\"method\":" + "\"Buttons.ButtonPress\"},\"message\":\"Read only parameters " + "received\"},\"id\":31}"; +const uint32_t kAppId = 11u; +} + +namespace test { +namespace components { +namespace remote_control_test { +namespace button_press_request_test { + +class ButtonPressRequestTest : public ::testing::Test { + public: + ButtonPressRequestTest() + : rc_capabilities_(smart_objects::SmartType_Map) + , mock_service_(utils::MakeShared<NiceMock<MockService> >()) + , mock_app_(utils::MakeShared<NiceMock<MockApplication> >()) + , rc_app_extention_( + utils::MakeShared<remote_control::RCAppExtension>(kModuleId)) { + ON_CALL(mock_module_, service()).WillByDefault(Return(mock_service_)); + ON_CALL(mock_module_, resource_allocation_manager()) + .WillByDefault(ReturnRef(mock_allocation_manager_)); + ON_CALL(*mock_service_, GetApplication(kAppId)) + .WillByDefault(Return(mock_app_)); + EXPECT_CALL(mock_module_, event_dispatcher()) + .WillRepeatedly(ReturnRef(event_dispatcher_)); + ServicePtr exp_service(mock_service_); + mock_module_.set_service(exp_service); + } + + smart_objects::SmartObject ButtonCapability( + const mobile_apis::ButtonName::eType button_name) { + smart_objects::SmartObject button(smart_objects::SmartType_Map); + button["name"] = button_name; + return button; + } + + void SetUp() OVERRIDE { + using namespace remote_control; + using namespace mobile_apis; + + std::vector<ButtonName::eType> button_names; + button_names.push_back(ButtonName::AC_MAX); + button_names.push_back(ButtonName::AC); + button_names.push_back(ButtonName::RECIRCULATE); + button_names.push_back(ButtonName::FAN_UP); + button_names.push_back(ButtonName::FAN_DOWN); + button_names.push_back(ButtonName::TEMP_UP); + button_names.push_back(ButtonName::TEMP_DOWN); + button_names.push_back(ButtonName::DEFROST_MAX); + button_names.push_back(ButtonName::DEFROST); + button_names.push_back(ButtonName::DEFROST_REAR); + button_names.push_back(ButtonName::UPPER_VENT); + button_names.push_back(ButtonName::LOWER_VENT); + button_names.push_back(ButtonName::VOLUME_UP); + button_names.push_back(ButtonName::VOLUME_DOWN); + button_names.push_back(ButtonName::EJECT); + button_names.push_back(ButtonName::SOURCE); + button_names.push_back(ButtonName::SHUFFLE); + button_names.push_back(ButtonName::REPEAT); + + smart_objects::SmartObject button_caps(smart_objects::SmartType_Array); + for (size_t i = 0; i < button_names.size(); i++) { + button_caps[i] = ButtonCapability(button_names[i]); + } + rc_capabilities_[strings::kbuttonCapabilities] = button_caps; + ON_CALL(*mock_service_, GetRCCapabilities()) + .WillByDefault(Return(&rc_capabilities_)); + ON_CALL(*mock_service_, IsInterfaceAvailable(_)) + .WillByDefault(Return(true)); + ON_CALL(*mock_service_, IsRemoteControlApplication(_)) + .WillByDefault(Return(true)); + } + + remote_control::request_controller::MobileRequestPtr CreateCommand( + application_manager::MessagePtr msg) { + return remote_control::RCCommandFactory::CreateCommand(msg, mock_module_); + } + + application_manager::MessagePtr CreateBasicMessage() { + application_manager::MessagePtr message = utils::MakeShared<Message>( + MessagePriority::FromServiceType(protocol_handler::ServiceType::kRpc)); + message->set_function_id(RCFunctionID::BUTTON_PRESS); + message->set_function_name( + MessageHelper::GetMobileAPIName(functional_modules::BUTTON_PRESS)); + message->set_connection_key(kAppId); + return message; + } + + protected: + smart_objects::SmartObject rc_capabilities_; + utils::SharedPtr<NiceMock<application_manager::MockService> > mock_service_; + utils::SharedPtr<NiceMock<MockApplication> > mock_app_; + utils::SharedPtr<remote_control::RCAppExtension> rc_app_extention_; + testing::NiceMock<remote_control_test::MockRemotePluginInterface> + mock_module_; + testing::NiceMock<remote_control_test::MockResourceAllocationManager> + mock_allocation_manager_; + RemotePluginInterface::RCPluginEventDispatcher event_dispatcher_; +}; + +TEST_F(ButtonPressRequestTest, + Execute_ButtonNameMatchesModuleType_ExpectCorrectMessageSentToHMI) { + namespace json_keys = remote_control::json_keys; + // Arrange + application_manager::MessagePtr mobile_message = CreateBasicMessage(); + mobile_message->set_json_message(kCorrectMobileRequest); + // Expectations + ON_CALL(*mock_app_, app_id()) + .WillByDefault(Return(mobile_message->connection_key())); + EXPECT_CALL(*mock_service_, GetApplication(mobile_message->connection_key())) + .WillOnce(Return(mock_app_)); + EXPECT_CALL(*mock_service_, ValidateMessageBySchema(*mobile_message)) + .WillOnce(Return(application_manager::MessageValidationResult::SUCCESS)); + EXPECT_CALL(*mock_service_, CheckPolicyPermissions(mobile_message)) + .WillOnce(Return(mobile_apis::Result::eType::SUCCESS)); + application_manager::AppExtensionPtr invalid_ext; + EXPECT_CALL(*mock_app_, QueryInterface(kModuleId)) + .WillOnce(Return(invalid_ext)) + .WillRepeatedly(Return(rc_app_extention_)); + application_manager::AppExtensionPtr app_extension; + EXPECT_CALL(*mock_app_, AddExtension(_)) + .WillOnce(DoAll(SaveArg<0>(&app_extension), Return(true))); + EXPECT_CALL(*mock_service_, CheckModule(_, _)).WillOnce(Return(true)); + EXPECT_CALL(*mock_service_, GetNextCorrelationID()).WillOnce(Return(1)); + + const std::string resource = "CLIMATE"; + + EXPECT_CALL(mock_allocation_manager_, IsResourceFree(resource)) + .WillOnce(Return(true)); + EXPECT_CALL(mock_allocation_manager_, AcquireResource(resource, kAppId)) + .WillOnce(Return(remote_control::AcquireResult::ALLOWED)); + EXPECT_CALL( + mock_allocation_manager_, + SetResourceState(resource, kAppId, remote_control::ResourceState::BUSY)); + + application_manager::MessagePtr result_msg; + EXPECT_CALL(*mock_service_, SendMessageToHMI(_)) + .WillOnce(SaveArg<0>(&result_msg)); + + // Act + remote_control::request_controller::MobileRequestPtr command = + CreateCommand(mobile_message); + command->Run(); + // Assertions + EXPECT_EQ(kModuleId, app_extension->uid()); + EXPECT_EQ(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_HMI, + result_msg->protocol_version()); + EXPECT_EQ(1, result_msg->correlation_id()); + EXPECT_EQ(application_manager::MessageType::kRequest, result_msg->type()); + const Json::Value& hmi_request_params = + MessageHelper::StringToValue(result_msg->json_message()); + EXPECT_EQ(functional_modules::hmi_api::button_press, + hmi_request_params[json_keys::kMethod].asString()); +} + +TEST_F( + ButtonPressRequestTest, + Execute_ButtonNameDoesNotMatchModuleType_ExpectMessageNotSentToHMI_AndFalseSentToMobile) { + namespace json_keys = remote_control::json_keys; + namespace result_codes = remote_control::result_codes; + // Arrange + application_manager::MessagePtr mobile_message = CreateBasicMessage(); + mobile_message->set_json_message(kWrongMobileRequest); + // Expectations + EXPECT_CALL(*mock_service_, GetApplication(mobile_message->connection_key())) + .WillOnce(Return(mock_app_)); + EXPECT_CALL(*mock_service_, ValidateMessageBySchema(*mobile_message)) + .WillOnce(Return(application_manager::MessageValidationResult::SUCCESS)); + EXPECT_CALL(*mock_service_, CheckPolicyPermissions(mobile_message)) + .WillOnce(Return(mobile_apis::Result::eType::SUCCESS)); + application_manager::AppExtensionPtr invalid_ext; + EXPECT_CALL(*mock_app_, QueryInterface(kModuleId)) + .WillOnce(Return(invalid_ext)) + .WillRepeatedly(Return(rc_app_extention_)); + application_manager::AppExtensionPtr app_extension; + EXPECT_CALL(*mock_app_, AddExtension(_)) + .WillOnce(DoAll(SaveArg<0>(&app_extension), Return(true))); + EXPECT_CALL(*mock_service_, CheckModule(_, _)).WillOnce(Return(true)); + EXPECT_CALL(mock_allocation_manager_, IsResourceFree(_)) + .WillOnce(Return(true)); + EXPECT_CALL(mock_allocation_manager_, AcquireResource(_, _)) + .WillOnce(Return(::remote_control::AcquireResult::ALLOWED)); + EXPECT_CALL(*mock_service_, SendMessageToHMI(_)).Times(0); + application_manager::MessagePtr result_msg; + EXPECT_CALL(mock_module_, SendResponseToMobile(_)) + .WillOnce(SaveArg<0>(&result_msg)); + // Act + remote_control::request_controller::MobileRequestPtr command = + CreateCommand(mobile_message); + command->Run(); + // Assertions + const Json::Value& response_params = + MessageHelper::StringToValue(result_msg->json_message()); + EXPECT_FALSE(response_params[result_codes::kSuccess].asBool()); + EXPECT_EQ(result_codes::kInvalidData, + response_params[json_keys::kResultCode].asString()); +} + +TEST_F(ButtonPressRequestTest, OnEvent_ExpectSuccessfullResponseSentToMobile) { + namespace json_keys = remote_control::json_keys; + namespace result_codes = remote_control::result_codes; + // Arrange + application_manager::MessagePtr mobile_message = CreateBasicMessage(); + mobile_message->set_json_message(kCorrectMobileRequest); + + application_manager::MessagePtr hmi_message = CreateBasicMessage(); + hmi_message->set_json_message(kValidHmiResponse); + hmi_message->set_message_type(application_manager::MessageType::kResponse); + // Expectations + EXPECT_CALL(*mock_service_, GetApplication(mobile_message->connection_key())) + .WillOnce(Return(mock_app_)); + application_manager::MessagePtr result_msg; + EXPECT_CALL(mock_module_, SendResponseToMobile(_)) + .WillOnce(SaveArg<0>(&result_msg)); + // Act + remote_control::RCPluginEvent event( + hmi_message, functional_modules::hmi_api::button_press); + remote_control::request_controller::MobileRequestPtr command = + CreateCommand(mobile_message); + command->on_event(event); + // Assertions + const Json::Value& response_params = + MessageHelper::StringToValue(result_msg->json_message()); + EXPECT_TRUE(response_params[json_keys::kSuccess].asBool()); + EXPECT_EQ(result_codes::kSuccess, + response_params[json_keys::kResultCode].asString()); +} + +TEST_F(ButtonPressRequestTest, + OnEvent_ReadOnlyParamFromHMI_ExpectFalseSentToMobile) { + namespace json_keys = remote_control::json_keys; + namespace result_codes = remote_control::result_codes; + // Arrange + application_manager::MessagePtr mobile_message = CreateBasicMessage(); + mobile_message->set_json_message(kCorrectMobileRequest); + + application_manager::MessagePtr hmi_message = CreateBasicMessage(); + hmi_message->set_json_message(KReadOnlyHmiResponse); + hmi_message->set_message_type(application_manager::MessageType::kResponse); + // Expectations + EXPECT_CALL(*mock_service_, GetApplication(mobile_message->connection_key())) + .WillOnce(Return(mock_app_)); + application_manager::MessagePtr result_msg; + EXPECT_CALL(mock_module_, SendResponseToMobile(_)) + .WillOnce(SaveArg<0>(&result_msg)); + // Act + remote_control::RCPluginEvent event( + hmi_message, functional_modules::hmi_api::button_press); + remote_control::request_controller::MobileRequestPtr command = + CreateCommand(mobile_message); + command->on_event(event); + // Assertions + const Json::Value& response_params = + MessageHelper::StringToValue(result_msg->json_message()); + EXPECT_FALSE(response_params[json_keys::kSuccess].asBool()); + EXPECT_EQ(result_codes::kGenericError, + response_params[json_keys::kResultCode].asString()); +} + +} // namespace button_press_request_test +} // namespace remote_control_test +} // namespace components +} // namespace test diff --git a/src/components/remote_control/test/commands/get_interior_vehicle_data_request_test.cc b/src/components/remote_control/test/commands/get_interior_vehicle_data_request_test.cc new file mode 100644 index 0000000000..4ad833aa60 --- /dev/null +++ b/src/components/remote_control/test/commands/get_interior_vehicle_data_request_test.cc @@ -0,0 +1,291 @@ +/* + * Copyright (c) 2017, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "remote_control/commands/get_interior_vehicle_data_request.h" +#include "gtest/gtest.h" +#include "mock_remote_control_plugin.h" +#include "mock_application.h" +#include "remote_control/rc_app_extension.h" +#include "remote_control/remote_control_event.h" +#include "remote_control/rc_module_constants.h" +#include "remote_control/message_helper.h" +#include "remote_control/rc_command_factory.h" +#include "remote_control/event_engine/event_dispatcher.h" +#include "functional_module/function_ids.h" +#include "include/mock_service.h" +#include "utils/shared_ptr.h" +#include "utils/make_shared.h" + +using functional_modules::RCFunctionID; +using application_manager::ServicePtr; + +using application_manager::MockService; +using test::components::remote_control_test::MockApplication; + +using ::testing::_; +using ::testing::Mock; +using ::testing::NiceMock; +using ::testing::StrictMock; +using ::testing::Return; +using ::testing::ReturnRef; +using ::testing::SaveArg; +using ::application_manager::Message; +using ::application_manager::MessageType; +using ::application_manager::ApplicationSharedPtr; +using ::protocol_handler::MessagePriority; +using remote_control::RemotePluginInterface; +using remote_control::MessageHelper; +using namespace remote_control; + +namespace { +const int32_t kConnectionKey = 5; +const int kModuleId = 153; +const std::string kInvalidMobileRequest = "{{\"moduleTip\":\"LUXOFT\"}}"; +const std::string kValidMobileRequest = + "{\"subscribe\":true,\"moduleDescription\":{\"moduleType\":\"CLIMATE\"}}"; +const std::string kValidHmiResponse = + "{\"jsonrpc\":\"2.0\",\"id\":51,\"result\":{\"code\":0,\"method\":\"RC." + "GetInteriorVehicleData\",\"moduleData\":{\"moduleType\":\"CLIMATE\"," + "\"climateControlData\":{\"fanSpeed\":0,\"currentTemperature\":{\"unit\":" + "\"CELSIUS\",\"value\":20},\"desiredTemperature\":{\"unit\":\"CELSIUS\"," + "\"value\":25},\"acEnable\":true,\"circulateAirEnable\":true," + "\"autoModeEnable\":true,\"defrostZone\":\"ALL\",\"dualModeEnable\":true," + "\"acMaxEnable\":true,\"ventilationMode\":\"BOTH\"}},\"isSubscribed\":" + "true}}"; +const std::string kInvalidHmiResponse = + "{\"jsonrpc\":\"2.0\",\"id\":51,\"result\":{\"code\":21,\"method\":\"RC." + "GetInteriorVehicleData\",\"moduleData\":{\"moduleType\":\"CLIMATE\"," + "\"ControlData\":{\"Speed\":0,\"outsideTemperature\":{\"unit\":" + "\"CELSIUS\",\"value\":\"high\"},\"desiredTemperature\":{\"unit\":" + "\"CELSIUS\"," + "\"value\":25},\"acEnable\":true,\"circulateAirEnable\":true," + "\"autoModeEnable\":true,\"defrostZone\":\"ALL\",\"dualModeEnable\":true," + "\"acMaxEnable\":true,\"ventilationMode\":\"BOTH\"}},\"isSubscribed\":" + "false}}"; +} + +namespace test { +namespace components { +namespace remote_control_test { +namespace get_interior_vehicle_data_request_test { + +class GetInteriorVehicleDataRequestTest : public ::testing::Test { + public: + typedef utils::SharedPtr<remote_control::commands::BaseCommandRequest> + GIVDRequestPtr; + typedef rc_event_engine::Event<application_manager::MessagePtr, std::string> + GIVD_HMI_Response; + GetInteriorVehicleDataRequestTest() + : mock_service_(utils::MakeShared<NiceMock<MockService> >()) + , mock_app_(utils::MakeShared<NiceMock<MockApplication> >()) + , rc_app_extention_( + utils::MakeShared<remote_control::RCAppExtension>(kModuleId)) { + ON_CALL(*mock_app_, app_id()).WillByDefault(Return(app_id_)); + ON_CALL(mock_module_, service()).WillByDefault(Return(mock_service_)); + ON_CALL(*mock_service_, GetApplication(app_id_)) + .WillByDefault(Return(mock_app_)); + ON_CALL(*mock_service_, IsInterfaceAvailable(_)) + .WillByDefault(Return(true)); + ON_CALL(*mock_service_, IsRemoteControlApplication(_)) + .WillByDefault(Return(true)); + EXPECT_CALL(mock_module_, event_dispatcher()) + .WillRepeatedly(ReturnRef(event_dispatcher_)); + ServicePtr exp_service(mock_service_); + mock_module_.set_service(exp_service); + } + + remote_control::request_controller::MobileRequestPtr CreateCommand( + application_manager::MessagePtr msg) { + return remote_control::RCCommandFactory::CreateCommand(msg, mock_module_); + } + + application_manager::MessagePtr CreateBasicMessage() { + application_manager::MessagePtr message = utils::MakeShared<Message>( + MessagePriority::FromServiceType(protocol_handler::ServiceType::kRpc)); + message->set_connection_key(kConnectionKey); + message->set_function_id(RCFunctionID::GET_INTERIOR_VEHICLE_DATA); + message->set_function_name("GetInteriorVehicleData"); + return message; + } + + protected: + utils::SharedPtr<NiceMock<application_manager::MockService> > mock_service_; + utils::SharedPtr<NiceMock<MockApplication> > mock_app_; + utils::SharedPtr<remote_control::RCAppExtension> rc_app_extention_; + remote_control_test::MockRemotePluginInterface mock_module_; + RemotePluginInterface::RCPluginEventDispatcher event_dispatcher_; + const uint32_t app_id_ = 11u; +}; + +TEST_F(GetInteriorVehicleDataRequestTest, + Execute_MessageValidationOk_ExpectCorrectMessageSentToHMI) { + // Arrange + application_manager::MessagePtr mobile_message = CreateBasicMessage(); + mobile_message->set_json_message(kValidMobileRequest); + // Expectations + EXPECT_CALL(mock_module_, service()).Times(2).WillOnce(Return(mock_service_)); + EXPECT_CALL(*mock_service_, GetApplication(mobile_message->connection_key())) + .WillOnce(Return(mock_app_)); + EXPECT_CALL(*mock_service_, ValidateMessageBySchema(*mobile_message)) + .WillOnce(Return(application_manager::MessageValidationResult::SUCCESS)); + EXPECT_CALL(*mock_service_, CheckPolicyPermissions(mobile_message)) + .WillOnce(Return(mobile_apis::Result::eType::SUCCESS)); + application_manager::AppExtensionPtr invalid_ext; + EXPECT_CALL(*mock_app_, QueryInterface(kModuleId)) + .WillOnce(Return(invalid_ext)) + .WillRepeatedly(Return(rc_app_extention_)); + application_manager::AppExtensionPtr app_extension; + EXPECT_CALL(*mock_app_, AddExtension(_)) + .WillOnce(DoAll(SaveArg<0>(&app_extension), Return(true))); + EXPECT_CALL(*mock_service_, CheckModule(_, _)).WillOnce(Return(true)); + EXPECT_CALL(*mock_service_, GetNextCorrelationID()).WillOnce(Return(1)); + application_manager::MessagePtr result_msg; + EXPECT_CALL(*mock_service_, SendMessageToHMI(_)) + .WillOnce(SaveArg<0>(&result_msg)); + // Act + remote_control::request_controller::MobileRequestPtr command = + CreateCommand(mobile_message); + command->Run(); + // Assertions + EXPECT_EQ(kModuleId, app_extension->uid()); + EXPECT_EQ(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_HMI, + result_msg->protocol_version()); + EXPECT_EQ(1, result_msg->correlation_id()); + EXPECT_EQ(application_manager::MessageType::kRequest, result_msg->type()); + const Json::Value hmi_request_params = + MessageHelper::StringToValue(result_msg->json_message()); + EXPECT_EQ(functional_modules::hmi_api::get_interior_vehicle_data, + hmi_request_params[json_keys::kMethod].asString()); +} + +TEST_F( + GetInteriorVehicleDataRequestTest, + Execute_MessageValidationFailed_ExpectMessageNotSentToHMI_AndFalseSentToMobile) { + // Arrange + application_manager::MessagePtr mobile_message = CreateBasicMessage(); + mobile_message->set_json_message(kInvalidMobileRequest); + // Expectations + EXPECT_CALL(mock_module_, service()).WillOnce(Return(mock_service_)); + EXPECT_CALL(*mock_service_, GetApplication(mobile_message->connection_key())) + .WillOnce(Return(mock_app_)); + EXPECT_CALL(*mock_service_, ValidateMessageBySchema(*mobile_message)) + .WillOnce( + Return(application_manager::MessageValidationResult::INVALID_JSON)); + EXPECT_CALL(*mock_service_, SendMessageToHMI(_)).Times(0); + application_manager::MessagePtr result_msg; + EXPECT_CALL(mock_module_, SendResponseToMobile(_)) + .WillOnce(SaveArg<0>(&result_msg)); + // Act + remote_control::request_controller::MobileRequestPtr command = + CreateCommand(mobile_message); + command->Run(); + // Assertions + const Json::Value response_params = + MessageHelper::StringToValue(result_msg->json_message()); + EXPECT_FALSE(response_params[result_codes::kSuccess].asBool()); + EXPECT_EQ(result_codes::kInvalidData, + response_params[json_keys::kResultCode].asString()); +} + +TEST_F(GetInteriorVehicleDataRequestTest, + OnEvent_ValidHmiResponse_ExpectSuccessfullResponseSentToMobile) { + // Arrange + application_manager::MessagePtr mobile_message = CreateBasicMessage(); + mobile_message->set_json_message(kValidMobileRequest); + + application_manager::MessagePtr hmi_message = CreateBasicMessage(); + hmi_message->set_json_message(kValidHmiResponse); + hmi_message->set_message_type(application_manager::MessageType::kResponse); + // Expectations + EXPECT_CALL(mock_module_, service()).WillOnce(Return(mock_service_)); + EXPECT_CALL(*mock_service_, GetApplication(mobile_message->connection_key())) + .WillOnce(Return(mock_app_)); + EXPECT_CALL(*mock_service_, ValidateMessageBySchema(*hmi_message)) + .WillOnce(Return(application_manager::MessageValidationResult::SUCCESS)); + EXPECT_CALL(*mock_app_, QueryInterface(kModuleId)) + .WillOnce(Return(rc_app_extention_)); + application_manager::MessagePtr result_msg; + EXPECT_CALL(mock_module_, SendResponseToMobile(_)) + .WillOnce(SaveArg<0>(&result_msg)); + // Act + remote_control::RCPluginEvent event( + hmi_message, functional_modules::hmi_api::get_interior_vehicle_data); + remote_control::request_controller::MobileRequestPtr command = + CreateCommand(mobile_message); + command->on_event(event); + // Assertions + const Json::Value response_params = + MessageHelper::StringToValue(result_msg->json_message()); + EXPECT_TRUE(response_params[json_keys::kSuccess].asBool()); + EXPECT_EQ(result_codes::kSuccess, + response_params[json_keys::kResultCode].asString()); +} + +TEST_F(GetInteriorVehicleDataRequestTest, + OnEvent_InvalidHmiResponse_ExpectGenericErrorResponseSentToMobile) { + // Arrange + application_manager::MessagePtr mobile_message = CreateBasicMessage(); + mobile_message->set_json_message(kValidMobileRequest); + application_manager::MessagePtr hmi_message = CreateBasicMessage(); + hmi_message->set_json_message(kInvalidHmiResponse); + hmi_message->set_message_type(application_manager::MessageType::kResponse); + // Expectations + EXPECT_CALL(mock_module_, service()).WillOnce(Return(mock_service_)); + EXPECT_CALL(*mock_service_, GetApplication(mobile_message->connection_key())) + .WillOnce(Return(mock_app_)); + EXPECT_CALL(*mock_service_, ValidateMessageBySchema(*hmi_message)) + .WillOnce( + Return(application_manager::MessageValidationResult::INVALID_JSON)); + application_manager::MessagePtr result_msg; + EXPECT_CALL(mock_module_, SendResponseToMobile(_)) + .WillOnce(SaveArg<0>(&result_msg)); + // Act + remote_control::request_controller::MobileRequestPtr command = + CreateCommand(mobile_message); + remote_control::RCPluginEvent event( + hmi_message, functional_modules::hmi_api::get_interior_vehicle_data); + command->on_event(event); + const Json::Value response_params = + MessageHelper::StringToValue(result_msg->json_message()); + EXPECT_FALSE(response_params[json_keys::kSuccess].asBool()); + EXPECT_EQ(result_codes::kGenericError, + response_params[json_keys::kResultCode].asString()); + const Json::Value hmi_response = + MessageHelper::StringToValue(hmi_message->json_message()); + EXPECT_EQ(hmi_response[json_keys::kInfo].asString(), + response_params[json_keys::kInfo].asString()); +} + +} // namespace get_interior_vehicle_data_request_test +} // namespace remote_control_test +} // namespace components +} // namespace test diff --git a/src/components/remote_control/test/commands/on_interior_vehicle_data_notification_test.cc b/src/components/remote_control/test/commands/on_interior_vehicle_data_notification_test.cc new file mode 100644 index 0000000000..7329890e94 --- /dev/null +++ b/src/components/remote_control/test/commands/on_interior_vehicle_data_notification_test.cc @@ -0,0 +1,182 @@ +/* + * Copyright (c) 2017, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "remote_control/commands/on_interior_vehicle_data_notification.h" +#include "gtest/gtest.h" +#include "mock_remote_control_plugin.h" +#include "mock_application.h" +#include "remote_control/rc_app_extension.h" +#include "remote_control/remote_control_event.h" +#include "remote_control/rc_module_constants.h" +#include "remote_control/message_helper.h" +#include "remote_control/rc_command_factory.h" +#include "remote_control/event_engine/event_dispatcher.h" +#include "functional_module/function_ids.h" +#include "include/mock_service.h" +#include "utils/shared_ptr.h" +#include "utils/make_shared.h" + +using functional_modules::RCFunctionID; +using application_manager::ServicePtr; + +using application_manager::MockService; +using test::components::remote_control_test::MockApplication; + +using ::testing::_; +using ::testing::Mock; +using ::testing::NiceMock; +using ::testing::Return; +using ::testing::SaveArg; +using ::application_manager::Message; +using ::application_manager::MessageType; +using ::application_manager::ApplicationSharedPtr; +using ::protocol_handler::MessagePriority; +using remote_control::RemotePluginInterface; +using remote_control::MessageHelper; +using namespace remote_control; + +namespace { +const int kModuleId = 153; +const std::string kJson = + "{ \"jsonrpc\": \"2.0\",\"method\": \"RC.OnInteriorVehicleData\",\ + \"params\":{\"moduleData\":{\ + \"moduleType\": \"CLIMATE\",\"climateControlData\": {\"fanSpeed\": 100}}}}"; +const uint32_t kAppId_ = 11u; +} + +namespace test { +namespace components { +namespace remote_control_test { +namespace on_interior_vehicle_data_notification_test { + +class OnInteriorVehicleDataNotificationTest : public ::testing::Test { + public: + OnInteriorVehicleDataNotificationTest() + : mock_service_(utils::MakeShared<NiceMock<MockService> >()) + , mock_app_(utils::MakeShared<NiceMock<MockApplication> >()) + , rc_app_extention_( + utils::MakeShared<remote_control::RCAppExtension>(kModuleId)) { + ON_CALL(mock_module_, service()).WillByDefault(Return(mock_service_)); + ServicePtr exp_service(mock_service_); + mock_module_.set_service(exp_service); + } + + remote_control::request_controller::MobileRequestPtr CreateCommand( + application_manager::MessagePtr msg) { + return remote_control::RCCommandFactory::CreateCommand(msg, mock_module_); + } + + application_manager::MessagePtr CreateBasicMessage() { + application_manager::MessagePtr message = utils::MakeShared<Message>( + MessagePriority::FromServiceType(protocol_handler::ServiceType::kRpc)); + message->set_function_id(RCFunctionID::ON_INTERIOR_VEHICLE_DATA); + message->set_function_name("OnInteriorVehicleData"); + message->set_json_message(kJson); + return message; + } + + protected: + utils::SharedPtr<NiceMock<application_manager::MockService> > mock_service_; + utils::SharedPtr<NiceMock<MockApplication> > mock_app_; + utils::SharedPtr<remote_control::RCAppExtension> rc_app_extention_; + remote_control_test::MockRemotePluginInterface mock_module_; + std::vector<ApplicationSharedPtr> apps_; +}; + +TEST_F(OnInteriorVehicleDataNotificationTest, + Execute_SendMessageToMobile_IfAppIsSubscribed) { + // Arrange + application_manager::MessagePtr message = CreateBasicMessage(); + Json::Value json_value = MessageHelper::StringToValue(kJson); + Json::Value module_type = + json_value[json_keys::kParams][message_params::kModuleData] + [message_params::kModuleType]; + rc_app_extention_->SubscribeToInteriorVehicleData(module_type); + apps_.push_back(mock_app_); + // Expectations + EXPECT_CALL(mock_module_, service()).WillOnce(Return(mock_service_)); + EXPECT_CALL(*mock_service_, GetApplications(kModuleId)) + .WillOnce(Return(apps_)); + EXPECT_CALL(*mock_app_, QueryInterface(kModuleId)) + .WillOnce(Return(rc_app_extention_)); + + ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId_)); + EXPECT_CALL(*mock_app_, protocol_version()) + .WillRepeatedly( + Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3)); + EXPECT_CALL(*mock_service_, GetApplication(kAppId_)) + .WillOnce(Return(mock_app_)); + EXPECT_CALL(*mock_service_, CheckPolicyPermissions(_)) + .WillOnce(Return(mobile_apis::Result::eType::SUCCESS)); + EXPECT_CALL(*mock_service_, CheckModule(kAppId_, enums_value::kClimate)) + .WillOnce(Return(true)); + application_manager::MessagePtr result_msg; + EXPECT_CALL(*mock_service_, SendMessageToMobile(_)) + .WillOnce(SaveArg<0>(&result_msg)); + // Act + remote_control::request_controller::MobileRequestPtr command = + CreateCommand(message); + command->Run(); + // Assertions + EXPECT_EQ(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3, + result_msg->protocol_version()); + EXPECT_EQ(application_manager::MessageType::kNotification, + result_msg->type()); + EXPECT_EQ(functional_modules::ON_INTERIOR_VEHICLE_DATA, + result_msg->function_id()); + EXPECT_EQ(MessageHelper::GetMobileAPIName( + functional_modules::ON_INTERIOR_VEHICLE_DATA), + result_msg->function_name()); +} + +TEST_F(OnInteriorVehicleDataNotificationTest, + Execute_NotSendMessageToMobile_IfAppUnsubscribed) { + // Arrange + application_manager::MessagePtr message = CreateBasicMessage(); + apps_.push_back(mock_app_); + // Expectations + EXPECT_CALL(mock_module_, service()).WillOnce(Return(mock_service_)); + EXPECT_CALL(*mock_service_, GetApplications(kModuleId)) + .WillOnce(Return(apps_)); + EXPECT_CALL(*mock_app_, QueryInterface(kModuleId)) + .WillOnce(Return(rc_app_extention_)); + EXPECT_CALL(*mock_service_, SendMessageToMobile(_)).Times(0); + // Act + remote_control::request_controller::MobileRequestPtr command = + CreateCommand(message); + command->Run(); +} + +} // namespace on_interior_vehicle_data_notification_test +} // namespace remote_control_test +} // namespace components +} // namespace test diff --git a/src/components/remote_control/test/commands/on_remote_control_settings_test.cc b/src/components/remote_control/test/commands/on_remote_control_settings_test.cc new file mode 100644 index 0000000000..5c13ea63d5 --- /dev/null +++ b/src/components/remote_control/test/commands/on_remote_control_settings_test.cc @@ -0,0 +1,326 @@ +/* + * Copyright (c) 2017, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "remote_control/commands/on_remote_control_settings_notification.h" +#include "gtest/gtest.h" +#include "mock_remote_control_plugin.h" +#include "mock_application.h" +#include "mock_resource_allocation_manager.h" +#include "remote_control/rc_app_extension.h" +#include "remote_control/remote_control_event.h" +#include "remote_control/rc_module_constants.h" +#include "remote_control/message_helper.h" +#include "remote_control/rc_command_factory.h" +#include "remote_control/event_engine/event_dispatcher.h" +#include "functional_module/function_ids.h" +#include "include/mock_service.h" +#include "utils/shared_ptr.h" +#include "utils/make_shared.h" + +using functional_modules::RCFunctionID; +using application_manager::ServicePtr; + +using application_manager::MockService; +using test::components::remote_control_test::MockApplication; + +using ::testing::_; +using ::testing::Mock; +using ::testing::NiceMock; +using ::testing::Return; +using ::testing::ReturnRef; +using ::testing::SaveArg; +using ::application_manager::Message; +using ::application_manager::MessageType; +using ::application_manager::ApplicationSharedPtr; +using ::protocol_handler::MessagePriority; +using remote_control::RemotePluginInterface; +using remote_control::MessageHelper; +using namespace remote_control; + +namespace { +const int kModuleId = 153; +const std::string kAllowedTrueAUTO_ALLOWJson = + "{ \"jsonrpc\": \"2.0\",\"method\": \"RC.OnRemoteControlSettings\",\ + \"params\":{\"accessMode\": \"AUTO_ALLOW\", \"allowed\":true}}"; +const std::string kAllowedTrueASK_DRIVERJson = + "{ \"jsonrpc\": \"2.0\",\"method\": \"RC.OnRemoteControlSettings\",\ + \"params\":{\"accessMode\": \"ASK_DRIVER\", \"allowed\":true}}"; +const std::string kAllowedTrueAUTO_DENYJson = + "{ \"jsonrpc\": \"2.0\",\"method\": \"RC.OnRemoteControlSettings\",\ + \"params\":{\"accessMode\": \"AUTO_DENY\", \"allowed\":true}}"; +const std::string kAllowedFalseAUTO_ALLOWJson = + "{ \"jsonrpc\": \"2.0\",\"method\": \"RC.OnRemoteControlSettings\",\ + \"params\":{\"accessMode\": \"AUTO_ALLOW\", \"allowed\":false}}"; +const std::string kAllowedFalseASK_DRIVERJson = + "{ \"jsonrpc\": \"2.0\",\"method\": \"RC.OnRemoteControlSettings\",\ + \"params\":{\"accessMode\": \"ASK_DRIVER\", \"allowed\":false}}"; +const std::string kAllowedFalseAUTO_DENYJson = + "{ \"jsonrpc\": \"2.0\",\"method\": \"RC.OnRemoteControlSettings\",\ + \"params\":{\"accessMode\": \"AUTO_DENY\", \"allowed\":false}}"; +const std::string kWithoutParamsJson = + "{ \"jsonrpc\": \"2.0\",\"method\": \"RC.OnRemoteControlSettings\"}"; +} + +namespace test { +namespace components { +namespace remote_control_test { +namespace on_remote_control_settings_notification_test { + +class OnRemoteControlSettingsNotificationTest : public ::testing::Test { + public: + OnRemoteControlSettingsNotificationTest() + : mock_service_(utils::MakeShared<NiceMock<MockService> >()) + , mock_app_(utils::MakeShared<NiceMock<MockApplication> >()) + , rc_app_extention_( + utils::MakeShared<remote_control::RCAppExtension>(kModuleId)) { + ON_CALL(mock_module_, resource_allocation_manager()) + .WillByDefault(ReturnRef(mock_allocation_manager_)); + ON_CALL(*mock_service_, IsInterfaceAvailable(_)) + .WillByDefault(Return(true)); + ON_CALL(*mock_service_, IsRemoteControlApplication(_)) + .WillByDefault(Return(true)); + apps_.push_back(mock_app_); + } + + remote_control::request_controller::MobileRequestPtr CreateCommand( + application_manager::MessagePtr msg) { + return remote_control::RCCommandFactory::CreateCommand(msg, mock_module_); + } + + application_manager::MessagePtr CreateBasicMessage( + const std::string& json_message) { + application_manager::MessagePtr message = utils::MakeShared<Message>( + MessagePriority::FromServiceType(protocol_handler::ServiceType::kRpc)); + message->set_function_id(RCFunctionID::ON_REMOTE_CONTROL_SETTINGS); + message->set_function_name( + MessageHelper::GetMobileAPIName(functional_modules::BUTTON_PRESS)); + message->set_json_message(json_message); + return message; + } + + protected: + utils::SharedPtr<NiceMock<application_manager::MockService> > mock_service_; + utils::SharedPtr<NiceMock<MockApplication> > mock_app_; + utils::SharedPtr<remote_control::RCAppExtension> rc_app_extention_; + remote_control_test::MockRemotePluginInterface mock_module_; + std::vector<ApplicationSharedPtr> apps_; + testing::NiceMock<remote_control_test::MockResourceAllocationManager> + mock_allocation_manager_; +}; + +TEST_F(OnRemoteControlSettingsNotificationTest, + Execute_SetAccessModeAUTO_ALLOW_IfAllowedTrue) { + // Arrange + const Json::Value value = + MessageHelper::StringToValue(kAllowedTrueAUTO_ALLOWJson); + const std::string access_mode = + value[json_keys::kParams][message_params::kAccessMode].asString(); + const hmi_apis::Common_RCAccessMode::eType access_mode_ = + MessageHelper::AccessModeFromString(access_mode); + // Expectations + EXPECT_CALL(mock_module_, service()).WillOnce(Return(mock_service_)); + EXPECT_CALL(mock_allocation_manager_, SetAccessMode(access_mode_)); + + application_manager::MessagePtr message = + CreateBasicMessage(kAllowedTrueAUTO_ALLOWJson); + // Act + remote_control::request_controller::MobileRequestPtr command = + CreateCommand(message); + command->Run(); +} + +TEST_F(OnRemoteControlSettingsNotificationTest, + Execute_SetAccessModeAUTO_DENY_IfAllowedTrue) { + // Arrange + const Json::Value value = + MessageHelper::StringToValue(kAllowedTrueAUTO_DENYJson); + const std::string access_mode = + value[json_keys::kParams][message_params::kAccessMode].asString(); + const hmi_apis::Common_RCAccessMode::eType access_mode_ = + MessageHelper::AccessModeFromString(access_mode); + // Expectations + EXPECT_CALL(mock_module_, service()).WillOnce(Return(mock_service_)); + EXPECT_CALL(mock_allocation_manager_, SetAccessMode(access_mode_)); + + application_manager::MessagePtr message = + CreateBasicMessage(kAllowedTrueAUTO_DENYJson); + // Act + remote_control::request_controller::MobileRequestPtr command = + CreateCommand(message); + command->Run(); +} + +TEST_F(OnRemoteControlSettingsNotificationTest, + Execute_SetAccessModeASK_DRIVER_IfAllowedTrue) { + // Arrange + const Json::Value value = + MessageHelper::StringToValue(kAllowedTrueASK_DRIVERJson); + const std::string access_mode = + value[json_keys::kParams][message_params::kAccessMode].asString(); + const hmi_apis::Common_RCAccessMode::eType access_mode_ = + MessageHelper::AccessModeFromString(access_mode); + // Expectations + EXPECT_CALL(mock_module_, service()).WillOnce(Return(mock_service_)); + EXPECT_CALL(mock_allocation_manager_, SetAccessMode(access_mode_)); + application_manager::MessagePtr message = + CreateBasicMessage(kAllowedTrueASK_DRIVERJson); + // Act + remote_control::request_controller::MobileRequestPtr command = + CreateCommand(message); + command->Run(); +} + +TEST_F(OnRemoteControlSettingsNotificationTest, + Execute_DisallowRCFunctionality_IfAllowedFalseAccessModeAUTO_ALLOW) { + // Arrange + const Json::Value module_type(enums_value::kClimate); + rc_app_extention_->SubscribeToInteriorVehicleData(module_type); + const Json::Value value = + MessageHelper::StringToValue(kAllowedFalseAUTO_ALLOWJson); + const std::string access_mode = + value[json_keys::kParams][message_params::kAccessMode].asString(); + const hmi_apis::Common_RCAccessMode::eType access_mode_ = + MessageHelper::AccessModeFromString(access_mode); + // Expectations + EXPECT_CALL(mock_module_, service()).WillOnce(Return(mock_service_)); + EXPECT_CALL(mock_allocation_manager_, SetAccessMode(access_mode_)).Times(0); + EXPECT_CALL(*mock_service_, GetApplications(kModuleId)) + .WillOnce(Return(apps_)); + EXPECT_CALL( + *mock_service_, + ChangeNotifyHMILevel(apps_[0], mobile_apis::HMILevel::eType::HMI_NONE)); + EXPECT_CALL(*mock_app_, QueryInterface(kModuleId)) + .WillOnce(Return(rc_app_extention_)); + EXPECT_EQ(rc_app_extention_->IsSubscibedToInteriorVehicleData(module_type), + true); + application_manager::MessagePtr message = + CreateBasicMessage(kAllowedFalseAUTO_ALLOWJson); + // Act + remote_control::request_controller::MobileRequestPtr command = + CreateCommand(message); + command->Run(); + // Assertions + EXPECT_EQ(rc_app_extention_->IsSubscibedToInteriorVehicleData(module_type), + false); +} + +TEST_F(OnRemoteControlSettingsNotificationTest, + Execute_DisallowRCFunctionality_IfAllowedFalseAccessModeASK_DRIVER) { + // Arrange + const Json::Value module_type(enums_value::kRadio); + rc_app_extention_->SubscribeToInteriorVehicleData(module_type); + const Json::Value value = + MessageHelper::StringToValue(kAllowedFalseASK_DRIVERJson); + const std::string access_mode = + value[json_keys::kParams][message_params::kAccessMode].asString(); + const hmi_apis::Common_RCAccessMode::eType access_mode_ = + MessageHelper::AccessModeFromString(access_mode); + // Expectations + EXPECT_CALL(mock_module_, service()).WillOnce(Return(mock_service_)); + EXPECT_CALL(mock_allocation_manager_, SetAccessMode(access_mode_)).Times(0); + EXPECT_CALL(*mock_service_, GetApplications(kModuleId)) + .WillOnce(Return(apps_)); + EXPECT_CALL( + *mock_service_, + ChangeNotifyHMILevel(apps_[0], mobile_apis::HMILevel::eType::HMI_NONE)); + EXPECT_CALL(*mock_app_, QueryInterface(kModuleId)) + .WillOnce(Return(rc_app_extention_)); + EXPECT_EQ(rc_app_extention_->IsSubscibedToInteriorVehicleData(module_type), + true); + application_manager::MessagePtr message = + CreateBasicMessage(kAllowedFalseASK_DRIVERJson); + // Act + remote_control::request_controller::MobileRequestPtr command = + CreateCommand(message); + command->Run(); + // Assertions + EXPECT_EQ(rc_app_extention_->IsSubscibedToInteriorVehicleData(module_type), + false); +} + +TEST_F(OnRemoteControlSettingsNotificationTest, + Execute_DisallowRCFunctionality_IfAllowedFalseAccessModeAUTO_DENY) { + // Arrange + const Json::Value module_type(enums_value::kClimate); + rc_app_extention_->SubscribeToInteriorVehicleData(module_type); + const Json::Value value = + MessageHelper::StringToValue(kAllowedFalseAUTO_DENYJson); + const std::string access_mode = + value[json_keys::kParams][message_params::kAccessMode].asString(); + const hmi_apis::Common_RCAccessMode::eType access_mode_ = + MessageHelper::AccessModeFromString(access_mode); + // Expectations + EXPECT_CALL(mock_module_, service()).WillOnce(Return(mock_service_)); + EXPECT_CALL(mock_allocation_manager_, SetAccessMode(access_mode_)).Times(0); + EXPECT_CALL(*mock_service_, GetApplications(kModuleId)) + .WillOnce(Return(apps_)); + EXPECT_CALL( + *mock_service_, + ChangeNotifyHMILevel(apps_[0], mobile_apis::HMILevel::eType::HMI_NONE)); + EXPECT_CALL(*mock_app_, QueryInterface(kModuleId)) + .WillOnce(Return(rc_app_extention_)); + EXPECT_EQ(rc_app_extention_->IsSubscibedToInteriorVehicleData(module_type), + true); + application_manager::MessagePtr message = + CreateBasicMessage(kAllowedFalseAUTO_DENYJson); + // Act + remote_control::request_controller::MobileRequestPtr command = + CreateCommand(message); + command->Run(); + // Assertions + EXPECT_EQ(rc_app_extention_->IsSubscibedToInteriorVehicleData(module_type), + false); +} + +TEST_F(OnRemoteControlSettingsNotificationTest, + Execute_NothingHappens_IfParamsOmitted) { + // Expectations + EXPECT_CALL(mock_module_, service()).WillOnce(Return(mock_service_)); + EXPECT_CALL(mock_allocation_manager_, SetAccessMode(_)).Times(0); + EXPECT_CALL(*mock_service_, GetApplications(kModuleId)).Times(0); + EXPECT_CALL(*mock_app_, QueryInterface(kModuleId)).Times(0); + EXPECT_CALL(*mock_service_, + ChangeNotifyHMILevel( + apps_[0], mobile_apis::HMILevel::eType::HMI_NONE)).Times(0); + + application_manager::MessagePtr message = + CreateBasicMessage(kWithoutParamsJson); + // Act + remote_control::request_controller::MobileRequestPtr command = + CreateCommand(message); + command->Run(); +} + +} // namespace on_remote_control_settings_notification_test +} // namespace remote_control_test +} // namespace components +} // namespace test diff --git a/src/components/remote_control/test/commands/set_interior_vehicle_data_request_test.cc b/src/components/remote_control/test/commands/set_interior_vehicle_data_request_test.cc new file mode 100644 index 0000000000..a219bc086d --- /dev/null +++ b/src/components/remote_control/test/commands/set_interior_vehicle_data_request_test.cc @@ -0,0 +1,433 @@ +/* + * Copyright (c) 2017, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "remote_control/commands/set_interior_vehicle_data_request.h" +#include "gtest/gtest.h" +#include "mock_remote_control_plugin.h" +#include "mock_application.h" +#include "mock_resource_allocation_manager.h" +#include "remote_control/rc_app_extension.h" +#include "remote_control/remote_control_event.h" +#include "remote_control/rc_module_constants.h" +#include "remote_control/message_helper.h" +#include "remote_control/rc_command_factory.h" +#include "remote_control/event_engine/event_dispatcher.h" +#include "functional_module/function_ids.h" +#include "include/mock_service.h" +#include "utils/shared_ptr.h" +#include "utils/make_shared.h" + +using functional_modules::RCFunctionID; +using application_manager::ServicePtr; + +using application_manager::MockService; +using test::components::remote_control_test::MockApplication; + +using ::testing::_; +using ::testing::Mock; +using ::testing::NiceMock; +using ::testing::StrictMock; +using ::testing::Return; +using ::testing::ReturnRef; +using ::testing::SaveArg; +using ::application_manager::Message; +using ::application_manager::MessageType; +using ::application_manager::ApplicationSharedPtr; +using ::protocol_handler::MessagePriority; +using remote_control::RemotePluginInterface; +using remote_control::MessageHelper; +using namespace remote_control; + +namespace { +const uint32_t kAppId = 11u; +const int32_t kConnectionKey = 5; +const int kModuleId = 153; +const uint32_t kCorrelationId = 1u; +const std::string kValidMobileRequestWithOnlySettableParams = + "{\"moduleData\":{\"moduleType\":\"CLIMATE\", " + "\"climateControlData\":{\"defrostZone\":" + "\"FRONT\", \"fanSpeed\":10}}}"; +const std::string kValidMobileRequestWithSettableAndReadOnlyParams = + "{\"moduleData\":{\"moduleType\":\"CLIMATE\", " + "\"climateControlData\":{\"defrostZone\":" + "\"FRONT\", \"fanSpeed\":10, \"currentTemperature\":{\"unit\":\"CELSIUS\", " + "\"value\":17.5}}}}"; +const std::string kValidMobileRequestWithoutSettableAndWithReadOnlyParams = + "{\"moduleData\":{\"moduleType\":\"CLIMATE\", \"climateControlData\":" + "{\"currentTemperature\":{\"unit\":\"CELSIUS\", \"value\":17.5}}}}"; +const std::string kInvalidMobileRequest = "{{\"moduleTip\":\"LUXOFT\"}}"; +const std::string kValidHmiResponse = + "{\"jsonrpc\":\"2.0\",\"id\":51,\"result\":{\"code\":0,\"method\":\"RC." + "SetInteriorVehicleData\",\"moduleData\":{\"moduleType\":\"CLIMATE\"," + "\"climateControlData\":{\"fanSpeed\":0,\"desiredTemperature\":{\"unit\":" + "\"CELSIUS\"," + "\"value\":25},\"acEnable\":true,\"circulateAirEnable\":true," + "\"autoModeEnable\":true,\"defrostZone\":\"ALL\",\"dualModeEnable\":true," + "\"acMaxEnable\":true,\"ventilationMode\":\"BOTH\"}}}}"; +const std::string kInvalidHmiResponse = + "{\"jsonrpc\":\"2.0\",\"id\":51,\"result\":{\"code\":21,\"method\":\"RC." + "SetInteriorVehicleData\",\"moduleData\":{\"moduleType\":\"CLIMATE\"," + "\"ControlData\":{\"Speed\":0,\"outsideTemperature\":{\"unit\":" + "\"CELSIUS\",\"value\":\"high\"},\"desiredTemperature\":{\"unit\":" + "\"CELSIUS\"," + "\"value\":25},\"acEnable\":true,\"circulateAirEnable\":true," + "\"autoModeEnable\":true,\"defrostZone\":\"ALL\",\"dualModeEnable\":true," + "\"acMaxEnable\":true,\"ventilationMode\":\"BOTH\"}},\"isSubscribed\":" + "false}}"; +} + +namespace test { +namespace components { +namespace remote_control_test { +namespace set_interior_vehicle_data_request_test { + +class SetInteriorVehicleDataRequestTest : public ::testing::Test { + public: + SetInteriorVehicleDataRequestTest() + : mock_service_(utils::MakeShared<NiceMock<MockService> >()) + , mock_app_(utils::MakeShared<NiceMock<MockApplication> >()) + , rc_app_extention_( + utils::MakeShared<remote_control::RCAppExtension>(kModuleId)) { + ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId)); + ON_CALL(mock_module_, resource_allocation_manager()) + .WillByDefault(ReturnRef(mock_allocation_manager_)); + ON_CALL(mock_module_, service()).WillByDefault(Return(mock_service_)); + ON_CALL(*mock_service_, GetApplication(_)).WillByDefault(Return(mock_app_)); + ON_CALL(*mock_service_, IsInterfaceAvailable(_)) + .WillByDefault(Return(true)); + ON_CALL(*mock_service_, IsRemoteControlApplication(_)) + .WillByDefault(Return(true)); + ON_CALL(mock_module_, event_dispatcher()) + .WillByDefault(ReturnRef(event_dispatcher_)); + ServicePtr exp_service(mock_service_); + } + + remote_control::request_controller::MobileRequestPtr CreateCommand( + application_manager::MessagePtr msg) { + return remote_control::RCCommandFactory::CreateCommand(msg, mock_module_); + } + + application_manager::MessagePtr CreateBasicMessage() { + application_manager::MessagePtr message = utils::MakeShared<Message>( + MessagePriority::FromServiceType(protocol_handler::ServiceType::kRpc)); + message->set_connection_key(kConnectionKey); + message->set_function_id(RCFunctionID::SET_INTERIOR_VEHICLE_DATA); + message->set_function_name(MessageHelper::GetMobileAPIName( + functional_modules::SET_INTERIOR_VEHICLE_DATA)); + return message; + } + + protected: + utils::SharedPtr<NiceMock<application_manager::MockService> > mock_service_; + utils::SharedPtr<NiceMock<MockApplication> > mock_app_; + utils::SharedPtr<remote_control::RCAppExtension> rc_app_extention_; + testing::NiceMock<remote_control_test::MockRemotePluginInterface> + mock_module_; + testing::NiceMock<remote_control_test::MockResourceAllocationManager> + mock_allocation_manager_; + RemotePluginInterface::RCPluginEventDispatcher event_dispatcher_; +}; + +TEST_F(SetInteriorVehicleDataRequestTest, + Execute_ValidWithoutReadOnlyParams_ExpectResendToHMI) { + // Arrange + application_manager::MessagePtr mobile_message = CreateBasicMessage(); + mobile_message->set_json_message(kValidMobileRequestWithOnlySettableParams); + + // Expectations + EXPECT_CALL(*mock_service_, ValidateMessageBySchema(*mobile_message)) + .WillOnce(Return(application_manager::MessageValidationResult::SUCCESS)); + EXPECT_CALL(*mock_service_, CheckPolicyPermissions(mobile_message)) + .WillOnce(Return(mobile_apis::Result::eType::SUCCESS)); + application_manager::AppExtensionPtr invalid_ext; + EXPECT_CALL(*mock_app_, QueryInterface(kModuleId)) + .WillOnce(Return(invalid_ext)) + .WillRepeatedly(Return(rc_app_extention_)); + + application_manager::AppExtensionPtr app_extension; + EXPECT_CALL(*mock_app_, AddExtension(_)) + .WillOnce(DoAll(SaveArg<0>(&app_extension), Return(true))); + EXPECT_CALL(*mock_service_, CheckModule(_, _)).WillOnce(Return(true)); + EXPECT_CALL(*mock_service_, GetNextCorrelationID()) + .WillOnce(Return(kCorrelationId)); + + const std::string resource = "CLIMATE"; + + EXPECT_CALL(mock_allocation_manager_, IsResourceFree(resource)) + .WillOnce(Return(true)); + EXPECT_CALL(mock_allocation_manager_, AcquireResource(resource, kAppId)) + .WillOnce(Return(remote_control::AcquireResult::ALLOWED)); + EXPECT_CALL( + mock_allocation_manager_, + SetResourceState(resource, kAppId, remote_control::ResourceState::BUSY)); + + application_manager::MessagePtr result_msg; + EXPECT_CALL(*mock_service_, SendMessageToHMI(_)) + .WillOnce(SaveArg<0>(&result_msg)); + + // Act + remote_control::request_controller::MobileRequestPtr command = + CreateCommand(mobile_message); + command->Run(); + + // Assertions + EXPECT_EQ(kModuleId, app_extension->uid()); + EXPECT_EQ(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_HMI, + result_msg->protocol_version()); + EXPECT_EQ(1, result_msg->correlation_id()); + EXPECT_EQ(application_manager::MessageType::kRequest, result_msg->type()); + const Json::Value hmi_request_params = + MessageHelper::StringToValue(result_msg->json_message()); + EXPECT_EQ(functional_modules::hmi_api::set_interior_vehicle_data, + hmi_request_params[json_keys::kMethod].asString()); + const Json::Value hmi_request_climate_control_data = + hmi_request_params[json_keys::kParams][message_params::kModuleData] + [message_params::kClimateControlData]; + EXPECT_EQ(2u, hmi_request_climate_control_data.size()); + const Json::Value hmi_request_module_data_fan_speed = + hmi_request_climate_control_data[message_params::kFanSpeed]; + const Json::Value hmi_request_module_data_defrost_zone = + hmi_request_climate_control_data[message_params::kDefrostZone]; + EXPECT_EQ("FRONT", hmi_request_module_data_defrost_zone.asString()); + EXPECT_EQ(10, hmi_request_module_data_fan_speed.asInt()); +} + +TEST_F( + SetInteriorVehicleDataRequestTest, + Execute_ValidWithSettableAndReadOnlyParams_ExpectCutReadOnlyAndResendToHMI) { + // Arrange + application_manager::MessagePtr mobile_message = CreateBasicMessage(); + mobile_message->set_json_message( + kValidMobileRequestWithSettableAndReadOnlyParams); + + // Expectations + EXPECT_CALL(*mock_service_, ValidateMessageBySchema(*mobile_message)) + .WillOnce(Return(application_manager::MessageValidationResult::SUCCESS)); + EXPECT_CALL(*mock_service_, CheckPolicyPermissions(mobile_message)) + .WillOnce(Return(mobile_apis::Result::eType::SUCCESS)); + + application_manager::AppExtensionPtr invalid_ext; + EXPECT_CALL(*mock_app_, QueryInterface(kModuleId)) + .WillOnce(Return(invalid_ext)) + .WillRepeatedly(Return(rc_app_extention_)); + + application_manager::AppExtensionPtr app_extension; + EXPECT_CALL(*mock_app_, AddExtension(_)) + .WillOnce(DoAll(SaveArg<0>(&app_extension), Return(true))); + EXPECT_CALL(*mock_service_, CheckModule(_, _)).WillOnce(Return(true)); + EXPECT_CALL(*mock_service_, GetNextCorrelationID()) + .WillOnce(Return(kCorrelationId)); + + const std::string resource = "CLIMATE"; + + EXPECT_CALL(mock_allocation_manager_, IsResourceFree(resource)) + .WillOnce(Return(true)); + EXPECT_CALL(mock_allocation_manager_, AcquireResource(resource, kAppId)) + .WillOnce(Return(remote_control::AcquireResult::ALLOWED)); + EXPECT_CALL( + mock_allocation_manager_, + SetResourceState(resource, kAppId, remote_control::ResourceState::BUSY)); + + application_manager::MessagePtr result_msg; + EXPECT_CALL(*mock_service_, SendMessageToHMI(_)) + .WillOnce(SaveArg<0>(&result_msg)); + + // Act + remote_control::request_controller::MobileRequestPtr command = + CreateCommand(mobile_message); + command->Run(); + + // Assertions + EXPECT_EQ(kModuleId, app_extension->uid()); + EXPECT_EQ(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_HMI, + result_msg->protocol_version()); + EXPECT_EQ(1, result_msg->correlation_id()); + EXPECT_EQ(application_manager::MessageType::kRequest, result_msg->type()); + const Json::Value hmi_request_params = + MessageHelper::StringToValue(result_msg->json_message()); + EXPECT_EQ(functional_modules::hmi_api::set_interior_vehicle_data, + hmi_request_params[json_keys::kMethod].asString()); + const Json::Value hmi_request_climate_control_data = + hmi_request_params[json_keys::kParams][message_params::kModuleData] + [message_params::kClimateControlData]; + EXPECT_EQ(2u, hmi_request_climate_control_data.size()); + const Json::Value hmi_request_module_data_fan_speed = + hmi_request_climate_control_data[message_params::kFanSpeed]; + const Json::Value hmi_request_module_data_defrost_zone = + hmi_request_climate_control_data[message_params::kDefrostZone]; + EXPECT_EQ("FRONT", hmi_request_module_data_defrost_zone.asString()); + EXPECT_EQ(10, hmi_request_module_data_fan_speed.asInt()); +} + +TEST_F(SetInteriorVehicleDataRequestTest, + Execute_ValidWithOnlyParamsReadOnly_ExpectResponseReadOnly) { + // Arrange + application_manager::MessagePtr mobile_message = CreateBasicMessage(); + mobile_message->set_json_message( + kValidMobileRequestWithoutSettableAndWithReadOnlyParams); + + // Expectations + EXPECT_CALL(*mock_service_, ValidateMessageBySchema(*mobile_message)) + .WillOnce(Return(application_manager::MessageValidationResult::SUCCESS)); + EXPECT_CALL(*mock_service_, CheckPolicyPermissions(mobile_message)) + .WillOnce(Return(mobile_apis::Result::eType::SUCCESS)); + EXPECT_CALL(mock_allocation_manager_, IsResourceFree(_)) + .WillOnce(Return(true)); + EXPECT_CALL(mock_allocation_manager_, AcquireResource(_, _)) + .WillOnce(Return(::remote_control::AcquireResult::ALLOWED)); + application_manager::AppExtensionPtr invalid_ext; + EXPECT_CALL(*mock_app_, QueryInterface(kModuleId)) + .WillOnce(Return(invalid_ext)) + .WillRepeatedly(Return(rc_app_extention_)); + + application_manager::AppExtensionPtr app_extension; + EXPECT_CALL(*mock_app_, AddExtension(_)) + .WillOnce(DoAll(SaveArg<0>(&app_extension), Return(true))); + EXPECT_CALL(*mock_service_, CheckModule(_, _)).WillOnce(Return(true)); + EXPECT_CALL(*mock_service_, SendMessageToHMI(_)).Times(0); + + application_manager::MessagePtr result_msg; + EXPECT_CALL(mock_module_, SendResponseToMobile(_)) + .WillOnce(SaveArg<0>(&result_msg)); + + // Act + remote_control::request_controller::MobileRequestPtr command = + CreateCommand(mobile_message); + command->Run(); + + // Assertions + const Json::Value response_params = + MessageHelper::StringToValue(result_msg->json_message()); + EXPECT_FALSE(response_params[result_codes::kSuccess].asBool()); + EXPECT_EQ(result_codes::kReadOnly, + response_params[json_keys::kResultCode].asString()); +} + +TEST_F( + SetInteriorVehicleDataRequestTest, + Execute_MessageValidationFailed_ExpectMessageNotSentToHMI_AndFalseSentToMobile) { + // Arrange + application_manager::MessagePtr mobile_message = CreateBasicMessage(); + mobile_message->set_json_message(kInvalidMobileRequest); + + // Expectations + EXPECT_CALL(*mock_service_, ValidateMessageBySchema(*mobile_message)) + .WillOnce( + Return(application_manager::MessageValidationResult::INVALID_JSON)); + EXPECT_CALL(*mock_service_, SendMessageToHMI(_)).Times(0); + application_manager::MessagePtr result_msg; + EXPECT_CALL(mock_module_, SendResponseToMobile(_)) + .WillOnce(SaveArg<0>(&result_msg)); + + // Act + remote_control::request_controller::MobileRequestPtr command = + CreateCommand(mobile_message); + command->Run(); + + // Assertions + const Json::Value response_params = + MessageHelper::StringToValue(result_msg->json_message()); + EXPECT_FALSE(response_params[result_codes::kSuccess].asBool()); + EXPECT_EQ(result_codes::kInvalidData, + response_params[json_keys::kResultCode].asString()); +} + +TEST_F(SetInteriorVehicleDataRequestTest, + OnEvent_ValidHmiResponse_ExpectSuccessfulResponseSentToMobile) { + // Arrange + application_manager::MessagePtr mobile_message = CreateBasicMessage(); + mobile_message->set_json_message(kValidMobileRequestWithOnlySettableParams); + + application_manager::MessagePtr hmi_message = CreateBasicMessage(); + hmi_message->set_json_message(kValidHmiResponse); + hmi_message->set_message_type(application_manager::MessageType::kResponse); + + // Expectations + EXPECT_CALL(*mock_service_, ValidateMessageBySchema(*hmi_message)) + .WillOnce(Return(application_manager::MessageValidationResult::SUCCESS)); + application_manager::MessagePtr result_msg; + EXPECT_CALL(mock_module_, SendResponseToMobile(_)) + .WillOnce(SaveArg<0>(&result_msg)); + + // Act + remote_control::RCPluginEvent event( + hmi_message, functional_modules::hmi_api::set_interior_vehicle_data); + remote_control::request_controller::MobileRequestPtr command = + CreateCommand(mobile_message); + command->on_event(event); + + // Assertions + const Json::Value response_params = + MessageHelper::StringToValue(result_msg->json_message()); + EXPECT_TRUE(response_params[json_keys::kSuccess].asBool()); + EXPECT_EQ(result_codes::kSuccess, + response_params[json_keys::kResultCode].asString()); +} + +TEST_F(SetInteriorVehicleDataRequestTest, + OnEvent_InvalidHmiResponse_ExpectGenericErrorResponseSentToMobile) { + // Arrange + application_manager::MessagePtr mobile_message = CreateBasicMessage(); + mobile_message->set_json_message(kValidMobileRequestWithOnlySettableParams); + application_manager::MessagePtr hmi_message = CreateBasicMessage(); + hmi_message->set_json_message(kInvalidHmiResponse); + hmi_message->set_message_type(application_manager::MessageType::kResponse); + + // Expectations + EXPECT_CALL(*mock_service_, ValidateMessageBySchema(*hmi_message)) + .WillOnce( + Return(application_manager::MessageValidationResult::INVALID_JSON)); + application_manager::MessagePtr result_msg; + EXPECT_CALL(mock_module_, SendResponseToMobile(_)) + .WillOnce(SaveArg<0>(&result_msg)); + + // Act + remote_control::request_controller::MobileRequestPtr command = + CreateCommand(mobile_message); + remote_control::RCPluginEvent event( + hmi_message, functional_modules::hmi_api::set_interior_vehicle_data); + command->on_event(event); + const Json::Value response_params = + MessageHelper::StringToValue(result_msg->json_message()); + EXPECT_FALSE(response_params[json_keys::kSuccess].asBool()); + EXPECT_EQ(result_codes::kGenericError, + response_params[json_keys::kResultCode].asString()); + const Json::Value hmi_response = + MessageHelper::StringToValue(hmi_message->json_message()); + EXPECT_EQ(hmi_response[json_keys::kInfo].asString(), + response_params[json_keys::kInfo].asString()); +} + +} // namespace set_interior_vehicle_data_request_test +} // namespace remote_control_test +} // namespace components +} // namespace test diff --git a/src/components/remote_control/test/include/mock_application.h b/src/components/remote_control/test/include/mock_application.h new file mode 100644 index 0000000000..2c4ce641ee --- /dev/null +++ b/src/components/remote_control/test/include/mock_application.h @@ -0,0 +1,335 @@ +/* + * Copyright (c) 2017, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_REMOTE_CONTROL_TEST_INCLUDE_MOCK_APPLICATION_H_ +#define SRC_COMPONENTS_REMOTE_CONTROL_TEST_INCLUDE_MOCK_APPLICATION_H_ + +#include <string> + +#include <string> +#include "gmock/gmock.h" +#include "application_manager/application.h" +#include "interfaces/MOBILE_API.h" +#include "application_manager/app_extension.h" +#include "smart_objects/smart_object.h" +#include "utils/custom_string.h" +#include "application_manager/usage_statistics.h" + +namespace test { +namespace components { +namespace remote_control_test { + +namespace am = application_manager; +namespace mobile_api = mobile_apis; +namespace custom_str = utils::custom_string; + +namespace custom_str = utils::custom_string; +class MockApplication : public ::application_manager::Application { + public: + MockApplication() {} + MOCK_CONST_METHOD0(active_message, const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(curHash, const std::string&()); + MOCK_METHOD0(UpdateHash, void()); + MOCK_CONST_METHOD0(flag_sending_hash_change_after_awake, bool()); + MOCK_METHOD1(set_flag_sending_hash_change_after_awake, void(bool flag)); + MOCK_CONST_METHOD0(is_application_data_changed, bool()); + MOCK_METHOD1(set_is_application_data_changed, + void(bool state_application_data)); + MOCK_METHOD0(CloseActiveMessage, void()); + MOCK_CONST_METHOD0(IsFullscreen, bool()); + MOCK_METHOD0(ChangeSupportingAppHMIType, void()); + MOCK_CONST_METHOD0(is_navi, bool()); + MOCK_METHOD1(set_is_navi, void(bool allow)); + MOCK_CONST_METHOD0(video_streaming_approved, bool()); + MOCK_METHOD1(set_video_streaming_approved, void(bool state)); + MOCK_CONST_METHOD0(audio_streaming_approved, bool()); + MOCK_METHOD1(set_audio_streaming_approved, void(bool state)); + MOCK_CONST_METHOD0(video_streaming_allowed, bool()); + MOCK_METHOD1(set_video_streaming_allowed, void(bool state)); + MOCK_CONST_METHOD0(audio_streaming_allowed, bool()); + MOCK_METHOD1(set_audio_streaming_allowed, void(bool state)); + MOCK_CONST_METHOD0(is_audio, bool()); + MOCK_METHOD2(SetVideoConfig, + bool(protocol_handler::ServiceType service_type, + const smart_objects::SmartObject& params)); + MOCK_METHOD1(StartStreaming, + void(protocol_handler::ServiceType service_type)); + MOCK_METHOD1(StopStreaming, void(protocol_handler::ServiceType service_type)); + MOCK_METHOD1(StopStreamingForce, + void(protocol_handler::ServiceType service_type)); + MOCK_METHOD1(SuspendStreaming, + void(protocol_handler::ServiceType service_type)); + MOCK_METHOD1(WakeUpStreaming, + void(protocol_handler::ServiceType service_type)); + MOCK_CONST_METHOD0(is_voice_communication_supported, bool()); + MOCK_METHOD1(set_voice_communication_supported, + void(bool is_voice_communication_supported)); + MOCK_CONST_METHOD0(app_allowed, bool()); + MOCK_CONST_METHOD0(has_been_activated, bool()); + MOCK_METHOD1(set_activated, bool(bool is_active)); + MOCK_CONST_METHOD0(version, const ::application_manager::Version&()); + MOCK_METHOD1(set_hmi_application_id, void(uint32_t hmi_app_id)); + MOCK_CONST_METHOD0(hmi_app_id, uint32_t()); + MOCK_CONST_METHOD0(name, const custom_str::CustomString&()); + MOCK_METHOD1(set_folder_name, void(const std::string& folder_name)); + MOCK_CONST_METHOD0(folder_name, const std::string()); + MOCK_CONST_METHOD0(is_media_application, bool()); + MOCK_CONST_METHOD0(hmi_level, const mobile_apis::HMILevel::eType()); + MOCK_CONST_METHOD0(put_file_in_none_count, const uint32_t()); + MOCK_CONST_METHOD0(delete_file_in_none_count, const uint32_t()); + MOCK_CONST_METHOD0(list_files_in_none_count, const uint32_t()); + MOCK_CONST_METHOD0(system_context, const mobile_apis::SystemContext::eType()); + MOCK_CONST_METHOD0(audio_streaming_state, + const mobile_apis::AudioStreamingState::eType()); + MOCK_CONST_METHOD0(app_icon_path, const std::string&()); + MOCK_CONST_METHOD0(device, connection_handler::DeviceHandle()); + MOCK_CONST_METHOD0(CurrentHmiState, const application_manager::HmiStatePtr()); + MOCK_CONST_METHOD0(RegularHmiState, const application_manager::HmiStatePtr()); + MOCK_CONST_METHOD0(PostponedHmiState, + const application_manager::HmiStatePtr()); + MOCK_METHOD1(set_tts_properties_in_none, void(bool active)); + MOCK_METHOD0(tts_properties_in_none, bool()); + MOCK_METHOD1(set_tts_properties_in_full, void(bool active)); + MOCK_METHOD0(tts_properties_in_full, bool()); + MOCK_METHOD1(set_version, + void(const ::application_manager::Version& version)); + MOCK_METHOD1(set_name, void(const custom_str::CustomString& name)); + MOCK_METHOD1(set_is_media_application, void(bool is_media)); + MOCK_METHOD0(increment_put_file_in_none_count, void()); + MOCK_METHOD0(increment_delete_file_in_none_count, void()); + MOCK_METHOD0(increment_list_files_in_none_count, void()); + MOCK_METHOD1(set_app_icon_path, bool(const std::string& file_name)); + MOCK_METHOD1(set_app_allowed, void(const bool allowed)); + MOCK_METHOD1(set_device, void(connection_handler::DeviceHandle device)); + MOCK_CONST_METHOD0(get_grammar_id, uint32_t()); + MOCK_METHOD1(set_grammar_id, void(uint32_t value)); + MOCK_METHOD1( + set_protocol_version, + void(const ::protocol_handler::MajorProtocolVersion& protocol_version)); + MOCK_CONST_METHOD0(protocol_version, + ::protocol_handler::MajorProtocolVersion()); + MOCK_METHOD1(set_is_resuming, void(bool)); + MOCK_CONST_METHOD0(is_resuming, bool()); + MOCK_METHOD1(AddFile, bool(const ::application_manager::AppFile& file)); + MOCK_CONST_METHOD0(getAppFiles, const ::application_manager::AppFilesMap&()); + MOCK_METHOD1(UpdateFile, bool(const ::application_manager::AppFile& file)); + MOCK_METHOD1(DeleteFile, bool(const std::string& file_name)); + MOCK_METHOD1( + GetFile, + const ::application_manager::AppFile*(const std::string& file_name)); + MOCK_METHOD1(SubscribeToButton, + bool(mobile_apis::ButtonName::eType btn_name)); + MOCK_METHOD1(IsSubscribedToButton, + bool(mobile_apis::ButtonName::eType btn_name)); + MOCK_METHOD1(UnsubscribeFromButton, + bool(mobile_apis::ButtonName::eType btn_name)); + MOCK_METHOD1(SubscribeToIVI, bool(uint32_t vehicle_info_type)); + MOCK_CONST_METHOD1(IsSubscribedToIVI, bool(uint32_t vehicle_info_type)); + MOCK_METHOD1(UnsubscribeFromIVI, bool(uint32_t vehicle_info_type)); + MOCK_METHOD0(ResetDataInNone, void()); + MOCK_METHOD2(AreCommandLimitsExceeded, + bool(mobile_apis::FunctionID::eType cmd_id, + ::application_manager::TLimitSource source)); + MOCK_METHOD0(usage_report, ::application_manager::UsageStatistics&()); + MOCK_METHOD1(SetRegularState, void(::application_manager::HmiStatePtr state)); + MOCK_METHOD1(SetPostponedState, + void(::application_manager::HmiStatePtr state)); + MOCK_METHOD0(RemovePostponedState, void()); + MOCK_METHOD1(AddHMIState, void(::application_manager::HmiStatePtr state)); + MOCK_METHOD1(RemoveHMIState, + void(::application_manager::HmiState::StateID state_id)); + MOCK_METHOD2(SubscribeToSoftButtons, + void(int32_t cmd_id, + const ::application_manager::SoftButtonID& softbuttons_id)); + MOCK_METHOD1(IsSubscribedToSoftButton, bool(const uint32_t softbutton_id)); + MOCK_METHOD1(UnsubscribeFromSoftButtons, void(int32_t cmd_id)); + MOCK_CONST_METHOD0(IsAudioApplication, bool()); + MOCK_METHOD0(LoadPersistentFiles, void()); + // InitialApplicationData methods + MOCK_CONST_METHOD0(app_types, const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(vr_synonyms, const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(policy_app_id, std::string()); + MOCK_CONST_METHOD0(tts_name, const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(ngn_media_screen_name, + const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(language, const mobile_apis::Language::eType&()); + MOCK_CONST_METHOD0(ui_language, const mobile_apis::Language::eType&()); + MOCK_METHOD1(set_app_types, + void(const smart_objects::SmartObject& app_types)); + MOCK_METHOD1(set_vr_synonyms, + void(const smart_objects::SmartObject& vr_synonyms)); + MOCK_METHOD1(set_policy_app_id, void(const std::string& policy_app_id)); + MOCK_METHOD1(set_tts_name, void(const smart_objects::SmartObject& tts_name)); + MOCK_METHOD1(set_ngn_media_screen_name, + void(const smart_objects::SmartObject& ngn_name)); + MOCK_METHOD1(set_language, + void(const mobile_apis::Language::eType& language)); + MOCK_METHOD1(set_ui_language, + void(const mobile_apis::Language::eType& ui_language)); + // DynamicApplicationData methods + MOCK_CONST_METHOD0(help_prompt, const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(timeout_prompt, const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(vr_help_title, const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(vr_help, const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(tbt_state, const mobile_apis::TBTState::eType&()); + MOCK_CONST_METHOD0(show_command, const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(tbt_show_command, const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0( + SubscribedButtons, + DataAccessor< ::application_manager::ButtonSubscriptions>()); + MOCK_CONST_METHOD0( + SubscribedIVI, + DataAccessor< ::application_manager::VehicleInfoSubscriptions>()); + MOCK_CONST_METHOD0(keyboard_props, const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(menu_title, const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(menu_icon, const smart_objects::SmartObject*()); + MOCK_METHOD1(load_global_properties, + void(const smart_objects::SmartObject& so)); + MOCK_METHOD1(set_help_prompt, + void(const smart_objects::SmartObject& help_prompt)); + MOCK_METHOD1(set_timeout_prompt, + void(const smart_objects::SmartObject& timeout_prompt)); + MOCK_METHOD1(set_vr_help_title, + void(const smart_objects::SmartObject& vr_help_title)); + MOCK_METHOD0(reset_vr_help_title, void()); + MOCK_METHOD1(set_vr_help, void(const smart_objects::SmartObject& vr_help)); + MOCK_METHOD0(reset_vr_help, void()); + MOCK_METHOD1(set_tbt_state, + void(const mobile_apis::TBTState::eType& tbt_state)); + MOCK_METHOD1(set_show_command, + void(const smart_objects::SmartObject& show_command)); + MOCK_METHOD1(set_tbt_show_command, + void(const smart_objects::SmartObject& tbt_show)); + MOCK_METHOD1(set_keyboard_props, + void(const smart_objects::SmartObject& keyboard_props)); + MOCK_METHOD1(set_menu_title, + void(const smart_objects::SmartObject& menu_title)); + MOCK_METHOD1(set_menu_icon, + void(const smart_objects::SmartObject& menu_icon)); + MOCK_CONST_METHOD0(audio_stream_retry_number, uint32_t()); + MOCK_METHOD1(set_audio_stream_retry_number, + void(const uint32_t& audio_stream_retry_number)); + MOCK_CONST_METHOD0(video_stream_retry_number, uint32_t()); + MOCK_METHOD1(set_video_stream_retry_number, + void(const uint32_t& video_stream_retry_number)); + MOCK_METHOD2(AddCommand, + void(uint32_t cmd_id, + const smart_objects::SmartObject& command)); + MOCK_METHOD1(RemoveCommand, void(uint32_t cmd_id)); + MOCK_METHOD1(FindCommand, smart_objects::SmartObject*(uint32_t cmd_id)); + MOCK_METHOD2(AddSubMenu, + void(uint32_t menu_id, const smart_objects::SmartObject& menu)); + MOCK_METHOD1(RemoveSubMenu, void(uint32_t menu_id)); + MOCK_CONST_METHOD1(FindSubMenu, + smart_objects::SmartObject*(uint32_t menu_id)); + MOCK_METHOD1(IsSubMenuNameAlreadyExist, bool(const std::string& name)); + MOCK_METHOD2(AddChoiceSet, + void(uint32_t choice_set_id, + const smart_objects::SmartObject& choice_set)); + MOCK_METHOD1(RemoveChoiceSet, void(uint32_t choice_set_id)); + MOCK_METHOD1(FindChoiceSet, + smart_objects::SmartObject*(uint32_t choice_set_id)); + MOCK_METHOD3(AddPerformInteractionChoiceSet, + void(uint32_t correlation_id, + uint32_t choice_set_id, + const smart_objects::SmartObject& choice_set)); + MOCK_METHOD1(DeletePerformInteractionChoiceSet, + void(uint32_t correlation_id)); + MOCK_CONST_METHOD0( + performinteraction_choice_set_map, + DataAccessor< ::application_manager::PerformChoiceSetMap>()); + MOCK_CONST_METHOD0(commands_map, + DataAccessor< ::application_manager::CommandsMap>()); + MOCK_CONST_METHOD0(sub_menu_map, + DataAccessor< ::application_manager::SubMenuMap>()); + MOCK_CONST_METHOD0(choice_set_map, + DataAccessor< ::application_manager::ChoiceSetMap>()); + MOCK_METHOD1(set_perform_interaction_active, void(uint32_t active)); + MOCK_CONST_METHOD0(is_perform_interaction_active, uint32_t()); + MOCK_METHOD1(set_perform_interaction_mode, void(int32_t mode)); + MOCK_CONST_METHOD0(perform_interaction_mode, int32_t()); + MOCK_METHOD1(set_perform_interaction_layout, + void(mobile_apis::LayoutMode::eType mode)); + MOCK_CONST_METHOD0(perform_interaction_layout, + mobile_apis::LayoutMode::eType()); + MOCK_METHOD1(set_reset_global_properties_active, void(bool active)); + MOCK_CONST_METHOD0(is_reset_global_properties_active, bool()); + MOCK_CONST_METHOD0(app_id, uint32_t()); + MOCK_CONST_METHOD0(mac_address, const std::string&()); + MOCK_CONST_METHOD0(bundle_id, const std::string&()); + MOCK_METHOD1(set_bundle_id, void(const std::string& bundle_id)); + MOCK_METHOD0(GetAvailableDiskSpace, uint32_t()); + + MOCK_METHOD1(set_mobile_projection_enabled, void(bool)); + MOCK_CONST_METHOD0(mobile_projection_enabled, bool()); + + MOCK_METHOD1(set_mobile_app_id, void(const std::string& policy_app_id)); + MOCK_CONST_METHOD0(is_foreground, bool()); + MOCK_METHOD1(set_foreground, void(bool is_foreground)); + MOCK_CONST_METHOD0(IsRegistered, bool()); + MOCK_CONST_METHOD0(SchemaUrl, std::string()); + MOCK_CONST_METHOD0(PackageName, std::string()); + +#ifdef SDL_REMOTE_CONTROL + MOCK_METHOD1( + set_system_context, + void(const application_manager::mobile_api::SystemContext::eType&)); + MOCK_METHOD1( + set_audio_streaming_state, + void(const application_manager::mobile_api::AudioStreamingState::eType& + state)); + MOCK_METHOD1(IsSubscribedToInteriorVehicleData, + bool(smart_objects::SmartObject module)); + MOCK_METHOD1(SubscribeToInteriorVehicleData, + bool(smart_objects::SmartObject module)); + MOCK_METHOD1(UnsubscribeFromInteriorVehicleData, + bool(smart_objects::SmartObject module)); + MOCK_METHOD1( + set_hmi_level, + void(const application_manager::mobile_api::HMILevel::eType& hmi_level)); + MOCK_METHOD1(QueryInterface, + application_manager::AppExtensionPtr( + application_manager::AppExtensionUID uid)); + MOCK_METHOD1(AddExtension, + bool(application_manager::AppExtensionPtr extention)); + MOCK_METHOD1(RemoveExtension, bool(application_manager::AppExtensionUID uid)); + MOCK_METHOD0(RemoveExtensions, void()); + MOCK_CONST_METHOD0(SubscribesIVI, const std::set<uint32_t>&()); + +#endif // SDL_REMOTE_CONTROL +}; + +} // namespace remote_control_test +} // namespace components +} // namespace test + +#endif // SRC_COMPONENTS_REMOTE_CONTROL_TEST_INCLUDE_MOCK_APPLICATION_H_ diff --git a/src/components/remote_control/test/include/mock_remote_control_plugin.h b/src/components/remote_control/test/include/mock_remote_control_plugin.h new file mode 100644 index 0000000000..2e221ca75d --- /dev/null +++ b/src/components/remote_control/test/include/mock_remote_control_plugin.h @@ -0,0 +1,54 @@ +#ifndef SRC_COMPONENTS_REMOTE_CONTROL_TEST_INCLUDE_MOCK_REMOTE_CONTROL_PLUGIN_H_ +#define SRC_COMPONENTS_REMOTE_CONTROL_TEST_INCLUDE_MOCK_REMOTE_CONTROL_PLUGIN_H_ + +#include <stdint.h> +#include "remote_control/remote_plugin_interface.h" +#include "remote_control/resource_allocation_manager.h" +#include "application_manager/message.h" +#include "mock_application.h" + +namespace test { +namespace components { +namespace remote_control_test { + +class RCAppExtension; +typedef utils::SharedPtr<RCAppExtension> RCAppExtensionPtr; + +class MockRemotePluginInterface : public remote_control::RemotePluginInterface { + public: + MOCK_CONST_METHOD0(GetPluginInfo, functional_modules::PluginInfo()); + MOCK_METHOD1( + ProcessMessage, + functional_modules::ProcessResult(application_manager::MessagePtr msg)); + MOCK_METHOD1( + ProcessHMIMessage, + functional_modules::ProcessResult(application_manager::MessagePtr msg)); + MOCK_METHOD1(SendResponseToMobile, void(application_manager::MessagePtr msg)); + MOCK_METHOD1(SendTimeoutResponseToMobile, + void(application_manager::MessagePtr msg)); + MOCK_METHOD1(RemoveAppExtension, void(uint32_t app_id)); + MOCK_METHOD1(IsAppForPlugin, + bool(application_manager::ApplicationSharedPtr app)); + MOCK_METHOD2(OnAppHMILevelChanged, + void(application_manager::ApplicationSharedPtr app, + mobile_apis::HMILevel::eType old_level)); + MOCK_METHOD1(OnUnregisterApplication, void(const uint32_t app_id)); + MOCK_METHOD1(SendHmiStatusNotification, + void(application_manager::ApplicationSharedPtr app)); + MOCK_METHOD0(event_dispatcher, RCPluginEventDispatcher&()); + MOCK_METHOD0(RemoveAppExtensions, void()); + MOCK_METHOD0(service, application_manager::ServicePtr()); + MOCK_CONST_METHOD0(GetModuleID, functional_modules::ModuleID()); + MOCK_METHOD0(resource_allocation_manager, + remote_control::ResourceAllocationManager&()); + MOCK_METHOD2(OnApplicationEvent, + void(functional_modules::ApplicationEvent event, + const uint32_t application_id)); + MOCK_METHOD1(OnPolicyEvent, void(functional_modules::PolicyEvent event)); +}; + +} // namespace remote_control_test +} // namespace components +} // namespace test + +#endif // SRC_COMPONENTS_REMOTE_CONTROL_TEST_INCLUDE_MOCK_REMOTE_CONTROL_PLUGIN_H_ diff --git a/src/components/remote_control/test/include/mock_resource_allocation_manager.h b/src/components/remote_control/test/include/mock_resource_allocation_manager.h new file mode 100644 index 0000000000..d55af2b00d --- /dev/null +++ b/src/components/remote_control/test/include/mock_resource_allocation_manager.h @@ -0,0 +1,40 @@ +#ifndef SRC_COMPONENTS_REMOTE_CONTROL_TEST_INCLUDE_MOCK_RESOURCE_ALLOCATION_MANAGER_H_ +#define SRC_COMPONENTS_REMOTE_CONTROL_TEST_INCLUDE_MOCK_RESOURCE_ALLOCATION_MANAGER_H_ + +#include "gmock/gmock.h" +#include "remote_control/resource_allocation_manager.h" + +namespace test { +namespace components { +namespace remote_control_test { + +class MockResourceAllocationManager + : public remote_control::ResourceAllocationManager { + public: + MOCK_METHOD2(AcquireResource, + remote_control::AcquireResult::eType( + const std::string& module_type, const uint32_t app_id)); + MOCK_METHOD2(ForceAcquireResource, + void(const std::string& module_type, const uint32_t app_id)); + MOCK_METHOD2(OnDriverDisallowed, + void(const std::string& module_type, const uint32_t app_id)); + MOCK_METHOD2(OnApplicationEvent, + void(functional_modules::ApplicationEvent event, + const uint32_t application_id)); + MOCK_METHOD1(OnPolicyEvent, void(functional_modules::PolicyEvent event)); + MOCK_METHOD1(SetAccessMode, + void(const hmi_apis::Common_RCAccessMode::eType access_mode)); + MOCK_CONST_METHOD0(GetAccessMode, hmi_apis::Common_RCAccessMode::eType()); + MOCK_METHOD3(SetResourceState, + void(const std::string& module_type, + const uint32_t app_id, + const remote_control::ResourceState::eType state)); + MOCK_CONST_METHOD1(IsResourceFree, bool(const std::string& module_type)); + MOCK_METHOD0(ResetAllAllocations, void()); +}; + +} // namespace remote_control_test +} // namespace components +} // namespace test + +#endif // SRC_COMPONENTS_REMOTE_CONTROL_TEST_INCLUDE_MOCK_RESOURCE_ALLOCATION_MANAGER_H_ diff --git a/src/components/remote_control/test/src/rc_app_extension_test.cc b/src/components/remote_control/test/src/rc_app_extension_test.cc new file mode 100644 index 0000000000..78388ccbf1 --- /dev/null +++ b/src/components/remote_control/test/src/rc_app_extension_test.cc @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2015, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "gtest/gtest.h" +#include "remote_control/rc_app_extension.h" + +namespace remote_control { + +TEST(CanAppExtensionTest, Create) { + RCAppExtension extension(7); + ASSERT_TRUE(extension.uid() == 7); +} + +} // namespace remote_control diff --git a/src/components/remote_control/test/src/rc_library_test.cc b/src/components/remote_control/test/src/rc_library_test.cc new file mode 100644 index 0000000000..77a57c4c3f --- /dev/null +++ b/src/components/remote_control/test/src/rc_library_test.cc @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2015, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include <dlfcn.h> +#include "gtest/gtest.h" +#include "remote_control/remote_control_plugin.h" +#include "mock_service.h" + +using functional_modules::PluginInfo; +using application_manager::MockService; + +using ::testing::Return; + +namespace remote_control { + +::testing::AssertionResult IsError(void* error) { + if (error) { + return ::testing::AssertionSuccess() << static_cast<const char*>(error); + } else { + return ::testing::AssertionFailure() << error; + } +} + +TEST(CanLibraryTest, Load) { + const std::string kLibraryPath = "libRemoteControlModule.so"; + + void* handle = dlopen(kLibraryPath.c_str(), RTLD_LAZY); + EXPECT_FALSE(IsError(dlerror())); + ASSERT_TRUE(handle != NULL); + + const std::string kSymbol = "Create"; + void* symbol = dlsym(handle, kSymbol.c_str()); + EXPECT_FALSE(IsError(dlerror())); + ASSERT_TRUE(symbol != NULL); + + typedef CANModule* (*Create)(); + Create create_manager = reinterpret_cast<Create>(symbol); + CANModule* module = create_manager(); + ASSERT_TRUE(module != NULL); + + PluginInfo plugin = module->GetPluginInfo(); + EXPECT_EQ(plugin.name, "RemoteControlPlugin"); + EXPECT_EQ(plugin.version, 1); + + MockService* service = new MockService(); + module->set_service(service); + std::vector<application_manager::ApplicationSharedPtr> apps; + EXPECT_CALL(*service, GetApplications(module->GetModuleID())) + .Times(1) + .WillOnce(Return(apps)); + + // in order for all sub-threads to start before shutting them down + // The logic conditions must be chosen to insure that the "signal" is + // executed if the "wait" is ever processed. + // (see http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html) + sleep(3); + // CANModule::destroy(); + int ret = dlclose(handle); + EXPECT_FALSE(ret); + EXPECT_FALSE(IsError(dlerror())); +} + +} // namespace remote_control diff --git a/src/components/remote_control/test/src/rc_module_test.cc b/src/components/remote_control/test/src/rc_module_test.cc new file mode 100644 index 0000000000..57efb90551 --- /dev/null +++ b/src/components/remote_control/test/src/rc_module_test.cc @@ -0,0 +1,263 @@ +/* + * Copyright (c) 2015, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "gtest/gtest.h" +#include "remote_control/remote_control_plugin.h" +#include "remote_control/rc_app_extension.h" +#include "remote_control/rc_module_constants.h" +#include "remote_control/message_helper.h" +#include "functional_module/module_observer.h" +#include "application_manager/mock_application.h" +#include "include/mock_service.h" +#include "utils/shared_ptr.h" +#include "utils/make_shared.h" +#include "application_manager/mock_message_helper.h" +#include "application_manager/mock_application_manager_settings.h" + +using functional_modules::PluginInfo; +using functional_modules::ProcessResult; +using functional_modules::RCFunctionID; +using application_manager::ServicePtr; + +using application_manager::MockService; +using application_manager::MockMessageHelper; +using test::components::application_manager_test::MockApplication; +using test::components::application_manager_test:: + MockApplicationManagerSettings; + +using ::testing::_; +using ::testing::Mock; +using ::testing::NiceMock; +using ::testing::StrictMock; +using ::testing::Return; +using ::testing::ReturnRef; +using ::testing::Eq; +using ::application_manager::Message; +using ::application_manager::MessageType; +using ::application_manager::ApplicationSharedPtr; +using ::protocol_handler::MessagePriority; + +namespace { +const bool kDeviceHandle = 1u; +const std::string kDeviceId = "1"; +const std::string kDeviceName = "1"; +const uint32_t kDefaultTimeout = 10000; +} + +namespace remote_control { + +class RCModuleTest : public ::testing::Test { + public: + RCModuleTest() + : mock_service_(utils::MakeShared<NiceMock<MockService> >()) + , mock_settings_( + utils::MakeShared<NiceMock<MockApplicationManagerSettings> >()) + , mock_message_helper_(*MockMessageHelper::message_helper_mock()) + , app0_(utils::MakeShared<NiceMock<MockApplication> >()) + , app1_(utils::MakeShared<NiceMock<MockApplication> >()) + , message_(utils::MakeShared<Message>(MessagePriority::FromServiceType( + protocol_handler::ServiceType::kRpc))) + , rc_app_extention_( + utils::MakeShared<RCAppExtension>(module_.GetModuleID())) {} + + void HandleMessage() { + module_.ProcessHMIMessage(message_); + } + + protected: + RemoteControlPlugin module_; + utils::SharedPtr<NiceMock<MockService> > mock_service_; + utils::SharedPtr<NiceMock<MockApplicationManagerSettings> > mock_settings_; + MockMessageHelper& mock_message_helper_; + std::vector<ApplicationSharedPtr> apps_; + utils::SharedPtr<NiceMock<MockApplication> > app0_; + utils::SharedPtr<NiceMock<MockApplication> > app1_; + application_manager::MessagePtr message_; + utils::SharedPtr<RCAppExtension> rc_app_extention_; + + void SetUp() OVERRIDE { + Mock::VerifyAndClearExpectations(&mock_message_helper_); + ON_CALL(*mock_service_, GetSettings()) + .WillByDefault(ReturnRef(*mock_settings_)); + ON_CALL(*mock_settings_, default_timeout()) + .WillByDefault(ReturnRef(kDefaultTimeout)); + ServicePtr exp_service(mock_service_); + module_.set_service(exp_service); + ServicePtr out_service = module_.service(); + EXPECT_EQ(exp_service.get(), out_service.get()); + } + + void TearDown() OVERRIDE { + Mock::VerifyAndClearExpectations(&mock_message_helper_); + EXPECT_CALL(*mock_service_, GetApplications(module_.GetModuleID())) + .WillOnce(Return(apps_)); + } +}; + +TEST_F(RCModuleTest, Create) { + EXPECT_EQ(153, module_.GetModuleID()); + PluginInfo plugin = module_.GetPluginInfo(); + EXPECT_EQ(plugin.name, "RemoteControlPlugin"); + EXPECT_EQ(plugin.version, 1); +} + +TEST_F(RCModuleTest, ProcessMessageWrongMessage) { + message_->set_function_id(-1); + EXPECT_CALL(*mock_service_, SendMessageToMobile(_)).Times(0); + EXPECT_EQ(ProcessResult::CANNOT_PROCESS, module_.ProcessMessage(message_)); +} + +TEST_F(RCModuleTest, ProcessMessageEmptyapps_List) { + message_->set_function_id(RCFunctionID::ON_INTERIOR_VEHICLE_DATA); + message_->set_function_name("OnInteriorVehicleData"); + + std::string json = + "{\"jsonrpc\": \"2.0\", \"method\": \"RC.OnInteriorVehicleData\",\ + \"params\": {\"moduleData\": {\"moduleType\": \"CLIMATE\",\ + \"climateControlData\": {\"fanSpeed\": 100} }}}"; + message_->set_json_message(json); + + EXPECT_CALL(*mock_service_, ValidateMessageBySchema(_)) + .WillOnce(Return( + application_manager::MessageValidationResult::SCHEMA_MISMATCH)); + EXPECT_CALL(*mock_service_, SendMessageToMobile(_)).Times(0); + + // EXPECT_EQ(ProcessResult::PROCESSED, module_.ProcessMessage(message_)); + EXPECT_EQ(ProcessResult::CANNOT_PROCESS, module_.ProcessHMIMessage(message_)); +} + +TEST_F(RCModuleTest, ProcessMessagePass) { + message_->set_function_id(RCFunctionID::ON_INTERIOR_VEHICLE_DATA); + + std::string json = + "{ \"jsonrpc\": \"2.0\",\"method\": \"RC.OnInteriorVehicleData\",\ + \"params\":{\"moduleData\":{\ + \"moduleType\": \"CLIMATE\",\"climateControlData\": {\"fanSpeed\": 100}}}}"; + + message_->set_json_message(json); + + application_manager::BinaryData buf; + application_manager::BinaryData* data = &buf; + data->push_back(1); + + message_->set_binary_data(data); + + Json::Value json_value = MessageHelper::StringToValue(json); + Json::Value module_type = + json_value[json_keys::kParams][message_params::kModuleData] + [message_params::kModuleType]; + apps_.push_back(app0_); + rc_app_extention_->SubscribeToInteriorVehicleData(module_type); + EXPECT_CALL(*mock_service_, ValidateMessageBySchema(_)) + .WillOnce(Return(application_manager::MessageValidationResult::SUCCESS)); + EXPECT_CALL(*app0_, QueryInterface(module_.GetModuleID())) + .WillOnce(Return(rc_app_extention_)); + EXPECT_CALL(*app0_, app_id()).WillRepeatedly(Return(1)); + EXPECT_CALL(*app0_, protocol_version()) + .WillRepeatedly( + Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4)); + EXPECT_CALL(*mock_service_, GetApplications(module_.GetModuleID())) + .WillOnce(Return(apps_)); + EXPECT_CALL(*mock_service_, GetApplication(1)).WillOnce(Return(app0_)); + EXPECT_CALL(*mock_service_, CheckPolicyPermissions(_)) + .WillOnce(Return(mobile_apis::Result::eType::SUCCESS)); + EXPECT_CALL(*mock_service_, CheckModule(1, "CLIMATE")).WillOnce(Return(true)); + EXPECT_CALL(*mock_service_, SendMessageToMobile(_)); + + EXPECT_EQ(ProcessResult::PROCESSED, module_.ProcessHMIMessage(message_)); +} + +TEST_F(RCModuleTest, RemoveAppExtensionPassWay) { + EXPECT_CALL(*mock_service_, GetApplication(1)).WillOnce(Return(app0_)); + EXPECT_CALL(*app0_, RemoveExtension(module_.GetModuleID())); + + module_.RemoveAppExtension(1); +} + +TEST_F(RCModuleTest, RemoveAppExtensionIfAppNoExist) { + ApplicationSharedPtr invalid_app; + + EXPECT_CALL(*mock_service_, GetApplication(_)).WillOnce(Return(invalid_app)); + + module_.RemoveAppExtension(1); +} + +TEST_F(RCModuleTest, SendResponseToMobile) { + EXPECT_CALL(*mock_service_, SendMessageToMobile(message_)); + + module_.SendResponseToMobile(message_); +} + +TEST_F(RCModuleTest, IsAppForPluginSuccess) { + application_manager::AppExtensionPtr invalid_ext; + EXPECT_CALL(*app0_, QueryInterface(module_.GetModuleID())) + .WillOnce(Return(invalid_ext)) + .WillRepeatedly(Return(rc_app_extention_)); + EXPECT_CALL(*app0_, AddExtension(_)).WillOnce(Return(true)); + mobile_apis::HMILevel::eType hmi = mobile_apis::HMILevel::eType::HMI_FULL; + EXPECT_CALL(*app0_, hmi_level()).WillRepeatedly(Return(hmi)); + ON_CALL(*app0_, device()).WillByDefault(Return(1)); + EXPECT_CALL(*mock_service_, NotifyHMIAboutHMILevel(Eq(app0_), _)); + EXPECT_CALL(*mock_service_, IsRemoteControlApplication(Eq(app0_))) + .WillOnce(Return(true)); + ASSERT_TRUE(module_.IsAppForPlugin(app0_)); +} + +TEST_F(RCModuleTest, IsAppForPluginNotNew) { + EXPECT_CALL(*app0_, QueryInterface(module_.GetModuleID())) + .WillOnce(Return(rc_app_extention_)); + EXPECT_CALL(*mock_service_, NotifyHMIAboutHMILevel(Eq(app0_), _)).Times(0); + ASSERT_TRUE(module_.IsAppForPlugin(app0_)); +} + +TEST_F(RCModuleTest, IsAppForPluginFail) { + application_manager::AppExtensionPtr invalid_ext; + EXPECT_CALL(*app0_, QueryInterface(module_.GetModuleID())) + .WillOnce(Return(invalid_ext)); + EXPECT_CALL(*mock_service_, IsRemoteControlApplication(Eq(app0_))) + .Times(1) + .WillOnce(Return(false)); + ASSERT_FALSE(module_.IsAppForPlugin(app0_)); +} + +TEST_F(RCModuleTest, OnAppHMILevelChanged) { + const application_manager::custom_str::CustomString name("name"); + ON_CALL(*app0_, name()).WillByDefault(ReturnRef(name)); + mobile_apis::HMILevel::eType hmi = mobile_apis::HMILevel::eType::HMI_NONE; + EXPECT_CALL(*app0_, hmi_level()).WillRepeatedly(Return(hmi)); + EXPECT_CALL(*mock_service_, + NotifyHMIAboutHMILevel(Eq(app0_), + mobile_apis::HMILevel::eType::HMI_NONE)); + module_.OnAppHMILevelChanged(app0_, mobile_apis::HMILevel::eType::HMI_FULL); +} + +} // namespace remote_control diff --git a/src/components/remote_control/test/src/resource_allocation_manager_impl_test.cc b/src/components/remote_control/test/src/resource_allocation_manager_impl_test.cc new file mode 100644 index 0000000000..4d1b399add --- /dev/null +++ b/src/components/remote_control/test/src/resource_allocation_manager_impl_test.cc @@ -0,0 +1,470 @@ +/* + * Copyright (c) 2017, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ + +#include "gtest/gtest.h" +#include <algorithm> +#include "remote_control/resource_allocation_manager_impl.h" +#include "mock_resource_allocation_manager.h" +#include "mock_remote_control_plugin.h" +#include "remote_control/rc_app_extension.h" +#include "remote_control/rc_module_constants.h" +#include "remote_control/message_helper.h" +#include "functional_module/module_observer.h" +#include "application_manager/mock_application.h" +#include "include/mock_service.h" +#include "utils/shared_ptr.h" +#include "utils/make_shared.h" +#include "interfaces/HMI_API.h" +#include "interfaces/MOBILE_API.h" + +using functional_modules::PluginInfo; +using functional_modules::ProcessResult; +using functional_modules::RCFunctionID; +using application_manager::ServicePtr; + +using application_manager::MockService; +using namespace test::components; +using application_manager_test::MockApplication; + +using ::testing::_; +using ::testing::Mock; +using ::testing::NiceMock; +using ::testing::StrictMock; +using ::testing::Return; +using ::testing::ReturnRef; +using ::testing::SaveArg; +using ::testing::Eq; +using ::testing::DoAll; +using ::testing::SetArgPointee; +using ::application_manager::Message; +using ::application_manager::MessageType; +using ::application_manager::ApplicationSharedPtr; +using ::protocol_handler::MessagePriority; + +namespace { +const bool kDeviceHandle = 1u; +const std::string kModuleType1 = "CLIMATE"; +const std::string kModuleType2 = "RADIO"; +const int32_t kConnectionKey = 5; +const int32_t kCorrelationId = 5; +const uint32_t kAppId1 = 11u; +const uint32_t kAppId2 = 22u; +const std::string policy_app_id_1_ = "policy_id_1"; +const functional_modules::ModuleID kDefaultModuleID = 0; +} + +namespace remote_control { + +class RAManagerTest : public ::testing::Test { + public: + RAManagerTest() + : mock_service_(utils::MakeShared<NiceMock<MockService> >()) + , mock_app_1_(utils::MakeShared<NiceMock<MockApplication> >()) + , mock_app_2_(utils::MakeShared<NiceMock<MockApplication> >()) + , message_(utils::MakeShared<Message>(MessagePriority::FromServiceType( + protocol_handler::ServiceType::kRpc))) { + EXPECT_CALL(mock_module_, service()).WillRepeatedly(Return(mock_service_)); + EXPECT_CALL(mock_module_, GetModuleID()) + .WillRepeatedly(Return(kDefaultModuleID)); + } + + void CheckResultWithHMILevelAndAccessMode( + ResourceAllocationManagerImpl& ra_manager, + mobile_apis::HMILevel::eType app_level, + const remote_control::AcquireResult::eType expected_result, + const hmi_apis::Common_RCAccessMode::eType access_mode) { + // Arrange + EXPECT_CALL(*mock_service_, GetApplication(kAppId1)) + .WillOnce(Return(mock_app_1_)); + ra_manager.SetAccessMode(access_mode); + EXPECT_EQ(remote_control::AcquireResult::ALLOWED, + ra_manager.AcquireResource(kModuleType1, kAppId1)); + EXPECT_CALL(*mock_service_, GetApplication(kAppId2)) + .WillOnce(Return(mock_app_2_)); + EXPECT_CALL(*mock_app_2_, hmi_level()).WillOnce(Return(app_level)); + // Second app tries to get already acquired resource by 1st app + EXPECT_EQ(expected_result, + ra_manager.AcquireResource(kModuleType1, kAppId2)); + } + + protected: + utils::SharedPtr<NiceMock<MockService> > mock_service_; + utils::SharedPtr<NiceMock<MockApplication> > mock_app_1_; + utils::SharedPtr<NiceMock<MockApplication> > mock_app_2_; + application_manager::MessagePtr message_; + remote_control_test::MockRemotePluginInterface mock_module_; + RemotePluginInterface::RCPluginEventDispatcher event_dispatcher_; +}; + +TEST_F(RAManagerTest, AcquireResource_NoAppRegistered_Expect_InUse) { + // Arrange + EXPECT_CALL(*mock_service_, GetApplication(kAppId1)) + .WillOnce(Return(ApplicationSharedPtr())); + ResourceAllocationManagerImpl ra_manager(mock_module_); + // Act & Assert + EXPECT_EQ(remote_control::AcquireResult::IN_USE, + ra_manager.AcquireResource(kModuleType1, kAppId1)); +} + +TEST_F(RAManagerTest, + AcquireResource_AppRegisteredAnyHmiLevelResourceFree_Expect_Allowed) { + // Arrange + EXPECT_CALL(*mock_service_, GetApplication(kAppId1)) + .WillOnce(Return(mock_app_1_)); + ResourceAllocationManagerImpl ra_manager(mock_module_); + // Act & Assert + EXPECT_EQ(remote_control::AcquireResult::ALLOWED, + ra_manager.AcquireResource(kModuleType1, kAppId1)); +} + +TEST_F( + RAManagerTest, + AcquireResource_AppInAnyHmiLevelWantsToAcquireSameResourceTwice_Expect_Allowed) { + // Arrange + EXPECT_CALL(*mock_service_, GetApplication(kAppId1)) + .WillOnce(Return(mock_app_1_)); + ResourceAllocationManagerImpl ra_manager(mock_module_); + EXPECT_EQ(remote_control::AcquireResult::ALLOWED, + ra_manager.AcquireResource(kModuleType1, kAppId1)); + EXPECT_CALL(*mock_service_, GetApplication(kAppId1)) + .WillOnce(Return(mock_app_1_)); + // Same app tries to get already acquired resource + EXPECT_EQ(remote_control::AcquireResult::ALLOWED, + ra_manager.AcquireResource(kModuleType1, kAppId1)); +} + +TEST_F( + RAManagerTest, + AcquireResource_App2_NotInFULLWantsToGetAcquiredResource_Expect_Rejected) { + using namespace mobile_apis; + using namespace hmi_apis; + using namespace remote_control; + const HMILevel::eType app_level = HMILevel::eType::HMI_BACKGROUND; + const AcquireResult::eType expected_result = AcquireResult::REJECTED; + const Common_RCAccessMode::eType access_mode = + Common_RCAccessMode::eType::AUTO_ALLOW; + ResourceAllocationManagerImpl ra_manager(mock_module_); + CheckResultWithHMILevelAndAccessMode( + ra_manager, app_level, expected_result, access_mode); +} + +TEST_F( + RAManagerTest, + AcquireResource_App2_InFULLWantsToGetAcquiredResource_AUTO_DENY_Expect_InUse) { + using namespace mobile_apis; + using namespace hmi_apis; + using namespace remote_control; + const HMILevel::eType app_level = HMILevel::eType::HMI_FULL; + const AcquireResult::eType expected_result = AcquireResult::IN_USE; + const Common_RCAccessMode::eType access_mode = + Common_RCAccessMode::eType::AUTO_DENY; + ResourceAllocationManagerImpl ra_manager(mock_module_); + CheckResultWithHMILevelAndAccessMode( + ra_manager, app_level, expected_result, access_mode); +} + +TEST_F( + RAManagerTest, + AcquireResource_App2_InFULLWantsToGetAcquiredResource_AUTO_ALLOW_Expect_Allowed) { + using namespace mobile_apis; + using namespace hmi_apis; + using namespace remote_control; + const HMILevel::eType app_level = HMILevel::eType::HMI_FULL; + const AcquireResult::eType expected_result = AcquireResult::ALLOWED; + const Common_RCAccessMode::eType access_mode = + Common_RCAccessMode::eType::AUTO_ALLOW; + ResourceAllocationManagerImpl ra_manager(mock_module_); + CheckResultWithHMILevelAndAccessMode( + ra_manager, app_level, expected_result, access_mode); +} + +TEST_F( + RAManagerTest, + AcquireResource_App2_InFULLWantsToGetAcquiredResource_ASK_DRIVER_Expect_AskDriver) { + using namespace mobile_apis; + using namespace hmi_apis; + using namespace remote_control; + const HMILevel::eType app_level = HMILevel::eType::HMI_FULL; + const AcquireResult::eType expected_result = AcquireResult::ASK_DRIVER; + const Common_RCAccessMode::eType access_mode = + Common_RCAccessMode::eType::ASK_DRIVER; + ResourceAllocationManagerImpl ra_manager(mock_module_); + CheckResultWithHMILevelAndAccessMode( + ra_manager, app_level, expected_result, access_mode); +} + +TEST_F(RAManagerTest, + AcquireResource_AcquiredModuleIsRejectedForApp2_ExpectApp2Rejected) { + // Arrange + ResourceAllocationManagerImpl ra_manager(mock_module_); + EXPECT_CALL(*mock_service_, GetApplication(kAppId1)) + .WillOnce(Return(mock_app_1_)); + EXPECT_EQ(AcquireResult::ALLOWED, + ra_manager.AcquireResource(kModuleType1, kAppId1)); + + // Act + ra_manager.OnDriverDisallowed(kModuleType1, kAppId2); + + // Assert + EXPECT_CALL(*mock_service_, GetApplication(kAppId2)) + .WillOnce(Return(mock_app_2_)); + EXPECT_EQ(AcquireResult::REJECTED, + ra_manager.AcquireResource(kModuleType1, kAppId2)); +} + +TEST_F(RAManagerTest, AppExit_ReleaseResource) { + // Arrange + ResourceAllocationManagerImpl ra_manager(mock_module_); + ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::eType::AUTO_DENY); + + EXPECT_CALL(*mock_service_, GetApplication(kAppId1)) + .WillRepeatedly(Return(mock_app_1_)); + + RCAppExtensionPtr rc_extention_ptr = utils::MakeShared<RCAppExtension>( + application_manager::AppExtensionUID(kDefaultModuleID)); + + EXPECT_CALL(*mock_app_1_, QueryInterface(_)) + .WillOnce(Return(rc_extention_ptr)); + + EXPECT_EQ(remote_control::AcquireResult::ALLOWED, + ra_manager.AcquireResource(kModuleType1, kAppId1)); + + // Act + ra_manager.OnApplicationEvent( + functional_modules::ApplicationEvent::kApplicationExit, kAppId1); + + EXPECT_CALL(*mock_service_, GetApplication(kAppId2)) + .WillRepeatedly(Return(mock_app_2_)); + + EXPECT_EQ(remote_control::AcquireResult::ALLOWED, + ra_manager.AcquireResource(kModuleType1, kAppId2)); +} + +TEST_F(RAManagerTest, AnotherAppExit_NoReleaseResource) { + // Arrange + ResourceAllocationManagerImpl ra_manager(mock_module_); + ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::eType::AUTO_DENY); + + EXPECT_CALL(*mock_service_, GetApplication(kAppId1)) + .WillOnce(Return(mock_app_1_)); + + EXPECT_EQ(remote_control::AcquireResult::ALLOWED, + ra_manager.AcquireResource(kModuleType1, kAppId1)); + + EXPECT_CALL(*mock_service_, GetApplication(kAppId2)) + .WillRepeatedly(Return(mock_app_2_)); + + RCAppExtensionPtr rc_extention_ptr = utils::MakeShared<RCAppExtension>( + application_manager::AppExtensionUID(kDefaultModuleID)); + + EXPECT_CALL(*mock_app_2_, QueryInterface(_)) + .WillOnce(Return(rc_extention_ptr)); + + // Act + ra_manager.OnApplicationEvent( + functional_modules::ApplicationEvent::kApplicationExit, kAppId2); + + EXPECT_CALL(*mock_service_, GetApplication(kAppId2)) + .WillOnce(Return(mock_app_2_)); + EXPECT_CALL(*mock_app_2_, hmi_level()) + .WillOnce(Return(mobile_apis::HMILevel::HMI_FULL)); + EXPECT_EQ(remote_control::AcquireResult::IN_USE, + ra_manager.AcquireResource(kModuleType1, kAppId2)); +} + +TEST_F(RAManagerTest, AppUnregistered_ReleaseResource) { + // Arrange + ResourceAllocationManagerImpl ra_manager(mock_module_); + ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::eType::AUTO_DENY); + + RCAppExtensionPtr rc_extention_ptr = utils::MakeShared<RCAppExtension>( + application_manager::AppExtensionUID(kDefaultModuleID)); + + EXPECT_CALL(*mock_app_1_, QueryInterface(_)) + .WillOnce(Return(rc_extention_ptr)); + + EXPECT_CALL(*mock_service_, GetApplication(kAppId1)) + .WillRepeatedly(Return(mock_app_1_)); + + EXPECT_EQ(remote_control::AcquireResult::ALLOWED, + ra_manager.AcquireResource(kModuleType1, kAppId1)); + + // Act + ra_manager.OnApplicationEvent( + functional_modules::ApplicationEvent::kApplicationUnregistered, kAppId1); + + EXPECT_CALL(*mock_service_, GetApplication(kAppId2)) + .WillOnce(Return(mock_app_2_)); + + EXPECT_EQ(remote_control::AcquireResult::ALLOWED, + ra_manager.AcquireResource(kModuleType1, kAppId2)); +} + +TEST_F(RAManagerTest, AnotherAppUnregistered_NoReleaseResource) { + // Arrange + ResourceAllocationManagerImpl ra_manager(mock_module_); + ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::eType::AUTO_DENY); + + EXPECT_CALL(*mock_service_, GetApplication(kAppId1)) + .WillOnce(Return(mock_app_1_)); + EXPECT_EQ(remote_control::AcquireResult::ALLOWED, + ra_manager.AcquireResource(kModuleType1, kAppId1)); + + EXPECT_CALL(*mock_service_, GetApplication(kAppId2)) + .WillRepeatedly(Return(mock_app_2_)); + + RCAppExtensionPtr rc_extention_ptr = utils::MakeShared<RCAppExtension>( + application_manager::AppExtensionUID(kDefaultModuleID)); + + EXPECT_CALL(*mock_app_2_, QueryInterface(_)) + .WillOnce(Return(rc_extention_ptr)); + + // Act + ra_manager.OnApplicationEvent( + functional_modules::ApplicationEvent::kApplicationUnregistered, kAppId2); + + EXPECT_CALL(*mock_service_, GetApplication(kAppId2)) + .WillOnce(Return(mock_app_2_)); + EXPECT_CALL(*mock_app_2_, hmi_level()) + .WillOnce(Return(mobile_apis::HMILevel::HMI_FULL)); + EXPECT_EQ(remote_control::AcquireResult::IN_USE, + ra_manager.AcquireResource(kModuleType1, kAppId2)); +} + +TEST_F(RAManagerTest, AppsDisallowed_ReleaseAllResources) { + // Arrange + ResourceAllocationManagerImpl ra_manager(mock_module_); + ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::eType::AUTO_DENY); + + EXPECT_CALL(*mock_service_, GetApplication(kAppId1)) + .WillRepeatedly(Return(mock_app_1_)); + + EXPECT_EQ(remote_control::AcquireResult::ALLOWED, + ra_manager.AcquireResource(kModuleType1, kAppId1)); + EXPECT_EQ(remote_control::AcquireResult::ALLOWED, + ra_manager.AcquireResource(kModuleType2, kAppId1)); + + std::vector<ApplicationSharedPtr> apps; + apps.push_back(mock_app_1_); + EXPECT_CALL(*mock_service_, GetApplications(_)).WillRepeatedly(Return(apps)); + + RCAppExtensionPtr rc_extention_ptr = utils::MakeShared<RCAppExtension>( + application_manager::AppExtensionUID(kDefaultModuleID)); + + EXPECT_CALL(*mock_app_1_, QueryInterface(_)) + .WillOnce(Return(rc_extention_ptr)); + + // Act + ra_manager.OnPolicyEvent( + functional_modules::PolicyEvent::kApplicationsDisabled); + + EXPECT_CALL(*mock_service_, GetApplication(kAppId2)) + .WillRepeatedly(Return(mock_app_2_)); + EXPECT_CALL(*mock_app_2_, hmi_level()) + .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL)); + EXPECT_EQ(remote_control::AcquireResult::ALLOWED, + ra_manager.AcquireResource(kModuleType1, kAppId2)); + EXPECT_EQ(remote_control::AcquireResult::ALLOWED, + ra_manager.AcquireResource(kModuleType2, kAppId2)); +} + +TEST_F(RAManagerTest, AppGotRevokedModulesWithPTU_ReleaseRevokedResource) { + // Arrange + ResourceAllocationManagerImpl ra_manager(mock_module_); + ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::eType::AUTO_DENY); + + EXPECT_CALL(*mock_service_, GetApplication(kAppId1)) + .WillRepeatedly(Return(mock_app_1_)); + + RCAppExtensionPtr rc_extention_ptr = utils::MakeShared<RCAppExtension>( + application_manager::AppExtensionUID(kDefaultModuleID)); + + EXPECT_CALL(*mock_app_1_, QueryInterface(_)) + .WillOnce(Return(rc_extention_ptr)); + + EXPECT_CALL(*mock_service_, GetApplication(kAppId1)) + .WillRepeatedly(Return(mock_app_1_)); + + EXPECT_CALL(*mock_app_1_, app_id()).WillRepeatedly(Return(kAppId1)); + + EXPECT_CALL(*mock_app_1_, policy_app_id()) + .WillRepeatedly(Return(policy_app_id_1_)); + + EXPECT_EQ(remote_control::AcquireResult::ALLOWED, + ra_manager.AcquireResource(kModuleType1, kAppId1)); + EXPECT_EQ(remote_control::AcquireResult::ALLOWED, + ra_manager.AcquireResource(kModuleType2, kAppId1)); + + std::vector<application_manager::ApplicationSharedPtr> apps; + apps.push_back(mock_app_1_); + EXPECT_CALL(*mock_service_, GetApplications(_)).WillOnce(Return(apps)); + + Resources allowed_modules; + allowed_modules.push_back(kModuleType1); + + EXPECT_CALL(*mock_service_, GetModuleTypes(policy_app_id_1_, _)) + .WillOnce(DoAll(SetArgPointee<1>(allowed_modules), Return(true))); + + // Act + ra_manager.OnPolicyEvent( + functional_modules::PolicyEvent::kApplicationPolicyUpdated); + + EXPECT_CALL(*mock_service_, GetApplication(kAppId2)) + .WillRepeatedly(Return(mock_app_2_)); + EXPECT_CALL(*mock_app_2_, hmi_level()) + .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL)); + EXPECT_EQ(remote_control::AcquireResult::IN_USE, + ra_manager.AcquireResource(kModuleType1, kAppId2)); + EXPECT_EQ(remote_control::AcquireResult::ALLOWED, + ra_manager.AcquireResource(kModuleType2, kAppId2)); +} + +TEST_F(RAManagerTest, GetAccessMode_ExpectedSameAsHadSet) { + ResourceAllocationManagerImpl ra_manager(mock_module_); + + ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::AUTO_DENY); + EXPECT_EQ(hmi_apis::Common_RCAccessMode::AUTO_DENY, + ra_manager.GetAccessMode()); + + ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::ASK_DRIVER); + EXPECT_EQ(hmi_apis::Common_RCAccessMode::ASK_DRIVER, + ra_manager.GetAccessMode()); + + ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::AUTO_ALLOW); + EXPECT_EQ(hmi_apis::Common_RCAccessMode::AUTO_ALLOW, + ra_manager.GetAccessMode()); + + ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::INVALID_ENUM); + EXPECT_EQ(hmi_apis::Common_RCAccessMode::INVALID_ENUM, + ra_manager.GetAccessMode()); +} + +} // namespace remote_control diff --git a/src/components/security_manager/include/security_manager/crypto_manager_impl.h b/src/components/security_manager/include/security_manager/crypto_manager_impl.h index 6aea2e28b1..4daf58b004 100644 --- a/src/components/security_manager/include/security_manager/crypto_manager_impl.h +++ b/src/components/security_manager/include/security_manager/crypto_manager_impl.h @@ -80,6 +80,15 @@ class CryptoManagerImpl : public CryptoManager { private: void PrintCertInfo(); + + /** + * @brief Removes disallowed for printing certificate information from input + * data + * @param in_data input data with certificate information + * @return filtered string with allowed for printing information + */ + const std::string RemoveDisallowedInfo(X509_NAME* in_data) const; + HandshakeResult CheckCertContext(); bool ReadHandshakeData(const uint8_t** const out_data, size_t* out_data_size); diff --git a/src/components/security_manager/src/crypto_manager_impl.cc b/src/components/security_manager/src/crypto_manager_impl.cc index f44198953b..00fcb1385a 100644 --- a/src/components/security_manager/src/crypto_manager_impl.cc +++ b/src/components/security_manager/src/crypto_manager_impl.cc @@ -300,36 +300,23 @@ bool CryptoManagerImpl::set_certificate(const std::string& cert_data) { return false; } - BIO* bio = BIO_new(BIO_f_base64()); - BIO* bmem = BIO_new_mem_buf((char*)cert_data.c_str(), cert_data.length()); - bmem = BIO_push(bio, bmem); - - char* buf = new char[cert_data.length()]; - int len = BIO_read(bmem, buf, cert_data.length()); - - BIO* bio_cert = BIO_new(BIO_s_mem()); - if (NULL == bio_cert) { - LOG4CXX_WARN(logger_, "Unable to update certificate. BIO not created"); - return false; - } + BIO* bio_cert = + BIO_new_mem_buf(const_cast<char*>(cert_data.c_str()), cert_data.length()); utils::ScopeGuard bio_guard = utils::MakeGuard(BIO_free, bio_cert); UNUSED(bio_guard) - int k = 0; - if ((k = BIO_write(bio_cert, buf, len)) <= 0) { - LOG4CXX_WARN(logger_, "Unable to write into BIO"); - return false; - } - PKCS12* p12 = d2i_PKCS12_bio(bio_cert, NULL); - if (NULL == p12) { - LOG4CXX_ERROR(logger_, "Unable to parse certificate"); - return false; - } + X509* cert = NULL; + PEM_read_bio_X509(bio_cert, &cert, 0, 0); EVP_PKEY* pkey = NULL; - X509* cert = NULL; - PKCS12_parse(p12, NULL, &pkey, &cert, NULL); + if (1 == BIO_reset(bio_cert)) { + PEM_read_bio_PrivateKey(bio_cert, &pkey, 0, 0); + } else { + LOG4CXX_WARN(logger_, + "Unabled to reset BIO in order to read private key, " + << LastError()); + } if (NULL == cert || NULL == pkey) { LOG4CXX_WARN(logger_, "Either certificate or key not valid."); diff --git a/src/components/security_manager/src/ssl_context_impl.cc b/src/components/security_manager/src/ssl_context_impl.cc index e387739015..5be5ff8363 100644 --- a/src/components/security_manager/src/ssl_context_impl.cc +++ b/src/components/security_manager/src/ssl_context_impl.cc @@ -32,12 +32,14 @@ #include "security_manager/crypto_manager_impl.h" #include <assert.h> -#include <openssl/bio.h> -#include <openssl/ssl.h> -#include <openssl/err.h> #include <memory.h> #include <map> #include <algorithm> +#include <vector> + +#include <openssl/bio.h> +#include <openssl/ssl.h> +#include <openssl/err.h> #include "utils/macro.h" @@ -137,32 +139,69 @@ std::map<std::string, CryptoManagerImpl::SSLContextImpl::BlockSizeGetter> CryptoManagerImpl::SSLContextImpl::max_block_sizes = CryptoManagerImpl::SSLContextImpl::create_max_block_sizes(); +const std::string CryptoManagerImpl::SSLContextImpl::RemoveDisallowedInfo( + X509_NAME* in_data) const { + if (!in_data) { + return std::string(); + } + + char* tmp_char_str = X509_NAME_oneline(in_data, NULL, 0); + std::string out_str(tmp_char_str); + OPENSSL_free(tmp_char_str); + + typedef std::vector<std::string> StringVector; + StringVector disallowed_params; + disallowed_params.push_back("CN"); + disallowed_params.push_back("serialNumber"); + + const char str_delimiter = '/', param_delimiter = '='; + for (StringVector::const_iterator it = disallowed_params.begin(); + it != disallowed_params.end(); + ++it) { + const std::string search_str = str_delimiter + (*it) + param_delimiter; + const size_t occurence_start = out_str.find(search_str); + if (std::string::npos == occurence_start) { + continue; + } + + const size_t occurence_end = + out_str.find(str_delimiter, occurence_start + 1); + out_str.erase(occurence_start, occurence_end - occurence_start); + } + + return out_str; +} + void CryptoManagerImpl::SSLContextImpl::PrintCertData( X509* cert, const std::string& cert_owner) { - if (cert) { - X509_NAME* subj_name = X509_get_subject_name(cert); - char* subj = X509_NAME_oneline(subj_name, NULL, 0); - if (subj) { - std::replace(subj, subj + strlen(subj), '/', ' '); - LOG4CXX_DEBUG(logger_, cert_owner << " subject:" << subj); - OPENSSL_free(subj); - } - char* issuer = X509_NAME_oneline(X509_get_issuer_name(cert), NULL, 0); - if (issuer) { - std::replace(issuer, issuer + strlen(issuer), '/', ' '); - LOG4CXX_DEBUG(logger_, cert_owner << " issuer:" << issuer); - OPENSSL_free(issuer); - } + if (!cert) { + LOG4CXX_DEBUG(logger_, "Empty certificate data"); + return; + } - ASN1_TIME* notBefore = X509_get_notBefore(cert); - ASN1_TIME* notAfter = X509_get_notAfter(cert); + std::string subj = RemoveDisallowedInfo(X509_get_subject_name(cert)); + if (!subj.empty()) { + std::replace(subj.begin(), subj.end(), '/', ' '); + LOG4CXX_DEBUG(logger_, cert_owner << " subject:" << subj); + } - if (notBefore) { - LOG4CXX_DEBUG(logger_, " Start date: " << (char*)notBefore->data); - } - if (notAfter) { - LOG4CXX_DEBUG(logger_, " End date: " << (char*)notAfter->data); - } + std::string issuer = RemoveDisallowedInfo(X509_get_issuer_name(cert)); + if (!issuer.empty()) { + std::replace(issuer.begin(), issuer.end(), '/', ' '); + LOG4CXX_DEBUG(logger_, cert_owner << " issuer:" << issuer); + } + + ASN1_TIME* not_before = X509_get_notBefore(cert); + if (not_before) { + LOG4CXX_DEBUG( + logger_, + "Start date: " << static_cast<unsigned char*>(not_before->data)); + } + + ASN1_TIME* not_after = X509_get_notAfter(cert); + if (not_after) { + LOG4CXX_DEBUG(logger_, + "End date: " << static_cast<unsigned char*>(not_after->data)); } } diff --git a/src/components/security_manager/test/crypto_manager_impl_test.cc b/src/components/security_manager/test/crypto_manager_impl_test.cc index 7fef33f1df..b30684e5f6 100644 --- a/src/components/security_manager/test/crypto_manager_impl_test.cc +++ b/src/components/security_manager/test/crypto_manager_impl_test.cc @@ -39,6 +39,7 @@ #include <fstream> #include <sstream> +#include "utils/make_shared.h" #include "gtest/gtest.h" #include "security_manager/crypto_manager_impl.h" #include "security_manager/mock_security_manager_settings.h" @@ -64,10 +65,14 @@ namespace test { namespace components { namespace crypto_manager_test { +using security_manager::CryptoManagerImpl; + class CryptoManagerTest : public testing::Test { protected: + typedef NiceMock<security_manager_test::MockCryptoManagerSettings> + MockCryptoManagerSettings; static void SetUpTestCase() { - std::ifstream certificate_file("server/spt_credential.p12.enc"); + std::ifstream certificate_file("server/spt_credential.pem"); ASSERT_TRUE(certificate_file.is_open()) << "Could not open certificate data file"; @@ -81,16 +86,9 @@ class CryptoManagerTest : public testing::Test { void SetUp() OVERRIDE { ASSERT_FALSE(certificate_data_base64_.empty()); mock_security_manager_settings_ = - new NiceMock<security_manager_test::MockCryptoManagerSettings>(); - utils::SharedPtr<security_manager::CryptoManagerSettings> scrypto = - utils::SharedPtr<security_manager::CryptoManagerSettings>:: - static_pointer_cast<security_manager::CryptoManagerSettings>( - mock_security_manager_settings_); - crypto_manager_ = new security_manager::CryptoManagerImpl(scrypto); - } - - void TearDown() OVERRIDE { - delete mock_security_manager_settings_; + utils::MakeShared<MockCryptoManagerSettings>(); + crypto_manager_ = + utils::MakeShared<CryptoManagerImpl>(mock_security_manager_settings_); } void InitSecurityManager() { @@ -117,11 +115,9 @@ class CryptoManagerTest : public testing::Test { .WillByDefault(Return(false)); } - security_manager::CryptoManager* crypto_manager_; + utils::SharedPtr<CryptoManagerImpl> crypto_manager_; + utils::SharedPtr<MockCryptoManagerSettings> mock_security_manager_settings_; static std::string certificate_data_base64_; - - NiceMock<security_manager_test::MockCryptoManagerSettings>* - mock_security_manager_settings_; }; std::string CryptoManagerTest::certificate_data_base64_; diff --git a/src/components/security_manager/test/ssl_certificate_handshake_test.cc b/src/components/security_manager/test/ssl_certificate_handshake_test.cc index 3d62dd5d6a..9375d6cc32 100644 --- a/src/components/security_manager/test/ssl_certificate_handshake_test.cc +++ b/src/components/security_manager/test/ssl_certificate_handshake_test.cc @@ -56,12 +56,12 @@ namespace custom_str = utils::custom_string; namespace { const std::string server_ca_cert_filename = "server"; const std::string client_ca_cert_filename = "client"; -const std::string client_certificate = "client/client_credential.p12.enc"; -const std::string server_certificate = "server/spt_credential.p12.enc"; +const std::string client_certificate = "client/client_credential.pem"; +const std::string server_certificate = "server/spt_credential.pem"; const std::string server_unsigned_cert_file = - "server/spt_credential_unsigned.p12.enc"; + "server/spt_credential_unsigned.pem"; const std::string server_expired_cert_file = - "server/spt_credential_expired.p12.enc"; + "server/spt_credential_expired.pem"; const bool verify_peer = true; const bool skip_peer_verification = false; diff --git a/src/components/security_manager/test/ssl_context_test.cc b/src/components/security_manager/test/ssl_context_test.cc index 9223a74505..945059e58c 100644 --- a/src/components/security_manager/test/ssl_context_test.cc +++ b/src/components/security_manager/test/ssl_context_test.cc @@ -88,9 +88,9 @@ struct ProtocolAndCipher { class SSLTest : public testing::Test { protected: static void SetUpTestCase() { - SetCertificate("server/spt_credential_unsigned.p12.enc", + SetCertificate("server/spt_credential_unsigned.pem", server_certificate_data_base64_); - SetCertificate("client/client_credential_unsigned.p12.enc", + SetCertificate("client/client_credential_unsigned.pem", client_certificate_data_base64_); } diff --git a/src/components/telemetry_monitor/CMakeLists.txt b/src/components/telemetry_monitor/CMakeLists.txt index bb33857ecd..bb419a92e9 100644 --- a/src/components/telemetry_monitor/CMakeLists.txt +++ b/src/components/telemetry_monitor/CMakeLists.txt @@ -39,9 +39,11 @@ include_directories ( ${COMPONENTS_DIR}/connection_handler/include/ ${COMPONENTS_DIR}/transport_manager/include/ ${COMPONENTS_DIR}/application_manager/include/ + ${COMPONENTS_DIR}/remote_control/include/ ${POLICY_PATH}/include/ ${POLICY_GLOBAL_INCLUDE_PATH}/ ${COMPONENTS_DIR}/rpc_base/include/ + ${COMPONENTS_DIR}/functional_module/include/ ${COMPONENTS_DIR}/hmi_message_handler/include/ ${COMPONENTS_DIR}/formatters/include/ ${COMPONENTS_DIR}/media_manager/include/ diff --git a/src/components/telemetry_monitor/src/telemetry_monitor.cc b/src/components/telemetry_monitor/src/telemetry_monitor.cc index 759b843961..88c484ffd4 100644 --- a/src/components/telemetry_monitor/src/telemetry_monitor.cc +++ b/src/components/telemetry_monitor/src/telemetry_monitor.cc @@ -1,34 +1,34 @@ /* - * Copyright (c) 2014, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ +* Copyright (c) 2014, Ford Motor Company +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following +* disclaimer in the documentation and/or other materials provided with the +* distribution. +* +* Neither the name of the Ford Motor Company nor the names of its contributors +* may be used to endorse or promote products derived from this software +* without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*/ #include "telemetry_monitor/telemetry_monitor.h" @@ -59,7 +59,7 @@ TelemetryMonitor::TelemetryMonitor(const std::string& server_address, , ph_observer(this) {} void TelemetryMonitor::Start() { - streamer_ = new Streamer(this); + streamer_ = streamer_ ? streamer_ : new Streamer(this); thread_ = threads::CreateThread("TelemetryMonitor", streamer_); } @@ -86,6 +86,7 @@ int16_t TelemetryMonitor::port() const { TelemetryMonitor::~TelemetryMonitor() { Stop(); + delete streamer_; } void TelemetryMonitor::Init( @@ -170,6 +171,7 @@ void Streamer::exitThreadMain() { LOG4CXX_AUTO_TRACE(logger_); Stop(); messages_.Shutdown(); + ThreadDelegate::exitThreadMain(); } void Streamer::Start() { diff --git a/src/components/telemetry_monitor/test/telemetry_monitor_test.cc b/src/components/telemetry_monitor/test/telemetry_monitor_test.cc index 5043524a06..090c7ab5b7 100644 --- a/src/components/telemetry_monitor/test/telemetry_monitor_test.cc +++ b/src/components/telemetry_monitor/test/telemetry_monitor_test.cc @@ -90,14 +90,14 @@ TEST(TelemetryMonitorTest, MessageProcess) { EXPECT_CALL(am_observeble, SetTelemetryObserver(_)); EXPECT_CALL(transport_manager_mock, SetTelemetryObserver(_)); telemetry_monitor::TelemetryMonitor telemetry_monitor(server_address, port); - StreamerMock streamer_mock(&telemetry_monitor); + StreamerMock* streamer_mock = new StreamerMock(&telemetry_monitor); + // streamer_mock will be freed by telemetry_monitor on destruction telemetry_monitor.Start(); - - telemetry_monitor.set_streamer(&streamer_mock); + telemetry_monitor.set_streamer(streamer_mock); telemetry_monitor.Init( &protocol_handler_mock, &am_observeble, &transport_manager_mock); utils::SharedPtr<telemetry_monitor::MetricWrapper> test_metric; - EXPECT_CALL(streamer_mock, PushMessage(test_metric)); + EXPECT_CALL(*streamer_mock, PushMessage(test_metric)); telemetry_monitor.SendMetric(test_metric); } diff --git a/src/components/transport_manager/test/transport_manager_impl_test.cc b/src/components/transport_manager/test/transport_manager_impl_test.cc index 14362050a2..c7cf3b2cb2 100644 --- a/src/components/transport_manager/test/transport_manager_impl_test.cc +++ b/src/components/transport_manager/test/transport_manager_impl_test.cc @@ -70,10 +70,10 @@ const uint32_t kAsyncExpectationsTimeout = 10000u; class TransportManagerImplTest : public ::testing::Test { protected: TransportManagerImplTest() - : tm_(settings) - , device_handle_(1) + : device_handle_(1) , mac_address_("MA:CA:DR:ES:S") - , dev_info_(device_handle_, mac_address_, "TestDeviceName", "BTMAC") {} + , dev_info_(device_handle_, mac_address_, "TestDeviceName", "BTMAC") + , tm_(settings) {} void SetUp() OVERRIDE { resumption::LastStateImpl last_state_("app_storage_folder", @@ -313,7 +313,6 @@ class TransportManagerImplTest : public ::testing::Test { ASSERT_EQ(E_SUCCESS, tm_.Stop()); } MockTransportManagerSettings settings; - MockTransportManagerImpl tm_; #ifdef TELEMETRY_MONITOR MockTMTelemetryObserver mock_metric_observer_; #endif // TELEMETRY_MONITOR @@ -329,6 +328,7 @@ class TransportManagerImplTest : public ::testing::Test { const DeviceInfo dev_info_; DeviceList device_list_; BaseErrorPtr error_; + MockTransportManagerImpl tm_; }; TEST_F(TransportManagerImplTest, SearchDevices_AdaptersNotAdded) { diff --git a/src/components/utils/include/utils/file_system.h b/src/components/utils/include/utils/file_system.h index 5862241c9c..22c200934f 100644 --- a/src/components/utils/include/utils/file_system.h +++ b/src/components/utils/include/utils/file_system.h @@ -38,6 +38,7 @@ #include <string> #include <vector> #include <iostream> +#include <fstream> namespace file_system { @@ -153,6 +154,14 @@ std::string CurrentWorkingDirectory(); std::string GetAbsolutePath(const std::string& path); /** + * @brief Checks if file name contains invalid symbols e.g. '/' + * @param file_name file name to check + * @return true if file name does not contain any invalid symbol otherwise + * returns false + */ +bool IsFileNameValid(const std::string& file_name); + +/** * @brief Removes file * * @param name path to file diff --git a/src/components/utils/include/utils/log_message_loop_thread.h b/src/components/utils/include/utils/log_message_loop_thread.h index deea1a07c0..d6a9edd072 100644 --- a/src/components/utils/include/utils/log_message_loop_thread.h +++ b/src/components/utils/include/utils/log_message_loop_thread.h @@ -66,6 +66,8 @@ class LogMessageLoopThread : public LogMessageLoopThreadTemplate { LogMessageLoopThread(); ~LogMessageLoopThread(); + private: + LogMessageHandler* handler_; DISALLOW_COPY_AND_ASSIGN(LogMessageLoopThread); }; diff --git a/src/components/utils/src/file_system.cc b/src/components/utils/src/file_system.cc index 947b5b090a..62a91ad1f3 100644 --- a/src/components/utils/src/file_system.cc +++ b/src/components/utils/src/file_system.cc @@ -73,15 +73,8 @@ size_t file_system::DirectorySize(const std::string& path) { size_t size = 0; int32_t return_code = 0; DIR* directory = NULL; - -#ifndef __QNXNTO__ struct dirent dir_element_; struct dirent* dir_element = &dir_element_; -#else - char* direntbuffer = new char[offsetof(struct dirent, d_name) + - pathconf(path.c_str(), _PC_NAME_MAX) + 1]; - struct dirent* dir_element = new (direntbuffer) dirent; -#endif struct dirent* result = NULL; struct stat file_info = {0}; directory = opendir(path.c_str()); @@ -97,19 +90,12 @@ size_t file_system::DirectorySize(const std::string& path) { if (file_system::IsDirectory(full_element_path)) { size += DirectorySize(full_element_path); } else { - if (0 != stat(full_element_path.c_str(), &file_info)) { - LOG4CXX_WARN_WITH_ERRNO( - logger_, "Could not get file info: " << full_element_path); - } else { - size += file_info.st_size; - } + stat(full_element_path.c_str(), &file_info); + size += file_info.st_size; } } } closedir(directory); -#ifdef __QNXNTO__ - delete[] direntbuffer; -#endif return size; } @@ -231,6 +217,10 @@ std::string file_system::GetAbsolutePath(const std::string& path) { return std::string(abs_path); } +bool file_system::IsFileNameValid(const std::string& file_name) { + return file_name.end() == std::find(file_name.begin(), file_name.end(), '/'); +} + bool file_system::DeleteFile(const std::string& name) { if (FileExists(name) && IsAccessible(name, W_OK)) { return !remove(name.c_str()); @@ -241,15 +231,8 @@ bool file_system::DeleteFile(const std::string& name) { void file_system::remove_directory_content(const std::string& directory_name) { int32_t return_code = 0; DIR* directory = NULL; -#ifndef __QNXNTO__ struct dirent dir_element_; struct dirent* dir_element = &dir_element_; -#else - char* direntbuffer = - new char[offsetof(struct dirent, d_name) + - pathconf(directory_name.c_str(), _PC_NAME_MAX) + 1]; - struct dirent* dir_element = new (direntbuffer) dirent; -#endif struct dirent* result = NULL; directory = opendir(directory_name.c_str()); @@ -279,9 +262,6 @@ void file_system::remove_directory_content(const std::string& directory_name) { } closedir(directory); -#ifdef __QNXNTO__ - delete[] direntbuffer; -#endif } bool file_system::RemoveDirectory(const std::string& directory_name, @@ -317,15 +297,8 @@ std::vector<std::string> file_system::ListFiles( int32_t return_code = 0; DIR* directory = NULL; -#ifndef __QNXNTO__ struct dirent dir_element_; struct dirent* dir_element = &dir_element_; -#else - char* direntbuffer = - new char[offsetof(struct dirent, d_name) + - pathconf(directory_name.c_str(), _PC_NAME_MAX) + 1]; - struct dirent* dir_element = new (direntbuffer) dirent; -#endif struct dirent* result = NULL; directory = opendir(directory_name.c_str()); @@ -345,10 +318,6 @@ std::vector<std::string> file_system::ListFiles( closedir(directory); } -#ifdef __QNXNTO__ - delete[] direntbuffer; -#endif - return listFiles; } @@ -426,11 +395,7 @@ uint64_t file_system::GetFileModificationTime(const std::string& path) { if (0 != stat(path.c_str(), &info)) { LOG4CXX_WARN_WITH_ERRNO(logger_, "Could not get file mod time: " << path); } -#ifndef __QNXNTO__ return static_cast<uint64_t>(info.st_mtim.tv_nsec); -#else - return static_cast<uint64_t>(info.st_mtime); -#endif } bool file_system::CopyFile(const std::string& src, const std::string& dst) { diff --git a/src/components/utils/src/log_message_loop_thread.cc b/src/components/utils/src/log_message_loop_thread.cc index 77bc8107eb..2b7f28fbfd 100644 --- a/src/components/utils/src/log_message_loop_thread.cc +++ b/src/components/utils/src/log_message_loop_thread.cc @@ -44,12 +44,14 @@ void LogMessageHandler::Handle(const LogMessage message) { } LogMessageLoopThread::LogMessageLoopThread() - : LogMessageLoopThreadTemplate("Logger", new LogMessageHandler()) {} + : LogMessageLoopThreadTemplate("Logger", + handler_ = new LogMessageHandler()) {} LogMessageLoopThread::~LogMessageLoopThread() { // we'll have to drop messages // while deleting logger thread logger_status = DeletingLoggerThread; + delete handler_; } } // namespace logger diff --git a/src/components/utils/src/threads/thread_delegate.cc b/src/components/utils/src/threads/thread_delegate.cc index 7bdce000da..917603f92c 100644 --- a/src/components/utils/src/threads/thread_delegate.cc +++ b/src/components/utils/src/threads/thread_delegate.cc @@ -52,6 +52,7 @@ void ThreadDelegate::exitThreadMain() { } else { pthread_cancel(thread_->thread_handle()); } + thread_ = NULL; } } diff --git a/src/components/utils/test/async_runner_test.cc b/src/components/utils/test/async_runner_test.cc index 3dd6383588..65abad65c2 100644 --- a/src/components/utils/test/async_runner_test.cc +++ b/src/components/utils/test/async_runner_test.cc @@ -30,57 +30,72 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <ctime> #include <stdlib.h> - -#include "gtest/gtest.h" - +#include <ctime> +#include <memory> #include "utils/lock.h" -#include "utils/conditional_variable.h" #include "utils/threads/async_runner.h" +#include "utils/conditional_variable.h" +#include "utils/shared_ptr.h" +#include "utils/make_shared.h" + +#include "gtest/gtest.h" +#include "gmock/gmock.h" namespace test { namespace components { -namespace utils_test { +namespace utils { -using namespace sync_primitives; using namespace threads; namespace { -uint32_t check_value = 0; +size_t kCheckValue = 0u; +const size_t kDelegatesAmount = 4u; } // ThreadDelegate successor class TestThreadDelegate : public ThreadDelegate { public: + TestThreadDelegate(sync_primitives::ConditionalVariable& cond_var, + sync_primitives::Lock& test_lock) + : cond_var_(cond_var), test_lock_(test_lock) {} + void threadMain() { - ++check_value; + sync_primitives::AutoLock lock(test_lock_); + ++kCheckValue; + cond_var_.NotifyOne(); } + + protected: + sync_primitives::ConditionalVariable& cond_var_; + sync_primitives::Lock& test_lock_; +}; + +class MockThreadDelegate : public ThreadDelegate { + public: + MOCK_METHOD0(threadMain, void()); + MOCK_METHOD0(exitThreadMain, void()); }; class AsyncRunnerTest : public ::testing::Test { public: - AsyncRunnerTest() : kDelegatesNum_(1), asr_pt_(NULL) { + AsyncRunnerTest() { + // Clear global value before test execution + kCheckValue = 0; CreateAsyncRunner(); CreateThreadsArray(); } ~AsyncRunnerTest() { - DeleteAsyncRunner(); DeleteThreadsArray(); } protected: - Lock test_lock_; - uint32_t kDelegatesNum_; - ConditionalVariable cond_var_; - TestThreadDelegate** delegates_; - AsyncRunner* asr_pt_; + ThreadDelegate** delegates_; + ::utils::SharedPtr<AsyncRunner> async_runner_; void CreateThreadsArray() { - srand(std::time(NULL)); - kDelegatesNum_ = (rand() % 20 + 1); - delegates_ = new TestThreadDelegate* [kDelegatesNum_]; + delegates_ = new ThreadDelegate* [kDelegatesAmount]; } void DeleteThreadsArray() { @@ -88,53 +103,38 @@ class AsyncRunnerTest : public ::testing::Test { } void CreateAsyncRunner() { - asr_pt_ = new AsyncRunner("test"); - } - void DeleteAsyncRunner() { - delete asr_pt_; + async_runner_ = ::utils::MakeShared<AsyncRunner>("test"); } }; TEST_F(AsyncRunnerTest, ASyncRunManyDelegates_ExpectSuccessfulAllDelegatesRun) { - AutoLock lock(test_lock_); - // Clear global value before test - check_value = 0; // Create Delegates and run - for (unsigned int i = 0; i < kDelegatesNum_; ++i) { - delegates_[i] = new TestThreadDelegate(); - asr_pt_->AsyncRun(delegates_[i]); + sync_primitives::ConditionalVariable cond_var; + sync_primitives::Lock test_lock; + for (size_t i = 0; i < kDelegatesAmount; ++i) { + sync_primitives::AutoLock lock(test_lock); + delegates_[i] = new TestThreadDelegate(cond_var, test_lock); + async_runner_->AsyncRun(delegates_[i]); + // Wait for delegate to be run + cond_var.WaitFor(lock, 1500); } - // Wait for 2 secs. Give this time to delegates to be run - cond_var_.WaitFor(lock, 2000); - // Expect all delegates run successfully - EXPECT_EQ(kDelegatesNum_, check_value); + // Expect all delegates started successfully + EXPECT_EQ(kDelegatesAmount, kCheckValue); } -// TODO(VVeremjova) APPLINK-12834 Sometimes delegates do not run -TEST_F(AsyncRunnerTest, - DISABLED_RunManyDelegatesAndStop_ExpectSuccessfulDelegatesStop) { - AutoLock lock(test_lock_); - // Clear global value before test - check_value = 0; - // Create Delegates - for (unsigned int i = 0; i < kDelegatesNum_; ++i) { - delegates_[i] = new TestThreadDelegate(); - } - // Wait for 2 secs - cond_var_.WaitFor(lock, 2000); - // Run created delegates - for (unsigned int i = 0; i < kDelegatesNum_; ++i) { - if (kDelegatesNum_ > 1) { - if (i == kDelegatesNum_ / 2) { - asr_pt_->Stop(); - } - } - asr_pt_->AsyncRun(delegates_[i]); +TEST_F(AsyncRunnerTest, StopThenRun_ExpectDelegateNotStarted) { + // Create Delegate mock + MockThreadDelegate mock_thread_delegate; + // Check that delegate was not started due to Stop() called before AsyncRun() + EXPECT_CALL(mock_thread_delegate, threadMain()).Times(0); + { + ::utils::SharedPtr<AsyncRunner> async_runner = + ::utils::MakeShared<AsyncRunner>("test"); + async_runner->Stop(); + async_runner->AsyncRun(&mock_thread_delegate); } - // Expect 3 delegates run successlully. The other stopped. - EXPECT_EQ(kDelegatesNum_ / 2, check_value); } -} // namespace utils_test +} // namespace utils } // namespace components } // namespace test diff --git a/src/components/utils/test/conditional_variable_test.cc b/src/components/utils/test/conditional_variable_test.cc index 86c9dfa2e0..524d53cafa 100644 --- a/src/components/utils/test/conditional_variable_test.cc +++ b/src/components/utils/test/conditional_variable_test.cc @@ -123,7 +123,7 @@ TEST_F( CheckWaitForWithTimeout1sec_ThreadBlockedForTimeout_ExpectSuccessfulWakeUp) { sync_primitives::AutoLock test_lock(test_mutex_); sync_primitives::ConditionalVariable::WaitStatus wait_st = - cond_var_.WaitFor(test_lock, 1000); + cond_var_.WaitFor(test_lock, 10); EXPECT_EQ(sync_primitives::ConditionalVariable::kTimeout, wait_st); } diff --git a/src/components/utils/test/messagemeter_test.cc b/src/components/utils/test/messagemeter_test.cc index efaaa41252..4ec14ac1cc 100644 --- a/src/components/utils/test/messagemeter_test.cc +++ b/src/components/utils/test/messagemeter_test.cc @@ -126,7 +126,8 @@ TEST(MessageMeterTest, AddingWithNullTimeRange) { } } -TEST_P(MessageMeterTest, TrackMessage_AddingOverPeriod_CorrectCountOfMessages) { +TEST_P(MessageMeterTest, + DISABLED_TrackMessage_AddingOverPeriod_CorrectCountOfMessages) { size_t messages = 0; const TimevalStruct start_time = date_time::DateTime::getCurrentTime(); // Add messages for less range period @@ -150,7 +151,7 @@ TEST_P(MessageMeterTest, TrackMessage_AddingOverPeriod_CorrectCountOfMessages) { } TEST_P(MessageMeterTest, - TrackMessage_AddingOverPeriodMultiIds_CorrectCountOfMessages) { + DISABLED_TrackMessage_AddingOverPeriodMultiIds_CorrectCountOfMessages) { size_t messages = 0; const TimevalStruct start_time = date_time::DateTime::getCurrentTime(); // Add messages for less range period @@ -184,7 +185,8 @@ TEST_P(MessageMeterTest, } } -TEST_P(MessageMeterTest, Frequency_CountingOverPeriod_CorrectCountOfMessages) { +TEST_P(MessageMeterTest, + DISABLED_Frequency_CountingOverPeriod_CorrectCountOfMessages) { const size_t one_message = 1; const TimevalStruct start_time = date_time::DateTime::getCurrentTime(); EXPECT_EQ(one_message, meter.TrackMessage(id1)); @@ -206,7 +208,7 @@ TEST_P(MessageMeterTest, Frequency_CountingOverPeriod_CorrectCountOfMessages) { } } -TEST_P(MessageMeterTest, CountingOutOfPeriod) { +TEST_P(MessageMeterTest, DISABLED_CountingOutOfPeriod) { const size_t one_message = 1; EXPECT_EQ(one_message, meter.TrackMessage(id1)); EXPECT_EQ(one_message, meter.TrackMessage(id2)); diff --git a/src/components/utils/test/scope_guard_test.cc b/src/components/utils/test/scope_guard_test.cc index 85abbd90de..5e685d6aba 100644 --- a/src/components/utils/test/scope_guard_test.cc +++ b/src/components/utils/test/scope_guard_test.cc @@ -43,7 +43,7 @@ using ::utils::MakeGuard; using ::utils::MakeObjGuard; using ::testing::Mock; -class TestObject { +class TestCalleeObject { public: MOCK_METHOD0(function_to_call, void()); MOCK_METHOD1(function_to_call_with_param, void(void*)); @@ -68,21 +68,21 @@ TEST(ScopeGuardTest, CallFreeFunctionWithParam) { } TEST(ScopeGuardTest, CallObjectFunction) { - TestObject obj; + TestCalleeObject obj; Mock::AllowLeak(&obj); // Google tests bug EXPECT_CALL(obj, function_to_call()).Times(1); { - ScopeGuard guard = MakeObjGuard(obj, &TestObject::function_to_call); + ScopeGuard guard = MakeObjGuard(obj, &TestCalleeObject::function_to_call); UNUSED(guard); } } TEST(ScopeGuardTest, CallObjectFunctionWithParam) { - TestObject obj; + TestCalleeObject obj; EXPECT_CALL(obj, function_to_call_with_param(&obj)).Times(1); { ScopeGuard guard = - MakeObjGuard(obj, &TestObject::function_to_call_with_param, &obj); + MakeObjGuard(obj, &TestCalleeObject::function_to_call_with_param, &obj); UNUSED(guard); } } @@ -98,20 +98,20 @@ TEST(ScopeGuardTest, DismissCallFreeFunctionWithParam) { } TEST(ScopeGuardTest, DismissCallObjectFunction) { - TestObject obj; + TestCalleeObject obj; EXPECT_CALL(obj, function_to_call()).Times(0); { - ScopeGuard guard = MakeObjGuard(obj, &TestObject::function_to_call); + ScopeGuard guard = MakeObjGuard(obj, &TestCalleeObject::function_to_call); guard.Dismiss(); } } TEST(ScopeGuardTest, DismissCallObjectFunctionWithParam) { - TestObject obj; + TestCalleeObject obj; EXPECT_CALL(obj, function_to_call_with_param(&obj)).Times(0); { ScopeGuard guard = - MakeObjGuard(obj, &TestObject::function_to_call_with_param, &obj); + MakeObjGuard(obj, &TestCalleeObject::function_to_call_with_param, &obj); guard.Dismiss(); } } diff --git a/src/components/utils/test/shared_ptr_test.cc b/src/components/utils/test/shared_ptr_test.cc index a30f2f66eb..99fe4f7dd7 100644 --- a/src/components/utils/test/shared_ptr_test.cc +++ b/src/components/utils/test/shared_ptr_test.cc @@ -507,7 +507,7 @@ TEST(SharedPtrTest, ValidMethodTest_ExpectCorrectValidation) { ASSERT_FALSE(p2.valid()); } -TEST(SharedPtrTest, StressTest) { +TEST(SharedPtrTest, DISABLED_StressTest) { // Arrange const size_t kNumIterations = 1024U * 1024U; diff --git a/src/components/utils/test/sqlite_wrapper/sql_query_test.cc b/src/components/utils/test/sqlite_wrapper/sql_query_test.cc index b481e45fd3..c10c26a2c7 100644 --- a/src/components/utils/test/sqlite_wrapper/sql_query_test.cc +++ b/src/components/utils/test/sqlite_wrapper/sql_query_test.cc @@ -97,7 +97,9 @@ class SQLQueryTest : public ::testing::Test { }; sqlite3* SQLQueryTest::conn = 0; -const std::string SQLQueryTest::kDatabaseName = "test-query"; + +// mounting /tmp as tmpfs will descrease utils unit tests runing time +const std::string SQLQueryTest::kDatabaseName = "/tmp/test-query"; TEST_F(SQLQueryTest, Query_CreateQuery_QueryInDBEqualCreated) { // arrange diff --git a/tools/InterfaceGenerator/generator/parsers/RPCBase.py b/tools/InterfaceGenerator/generator/parsers/RPCBase.py index 22f3fd2c2d..59edf4a9b3 100755 --- a/tools/InterfaceGenerator/generator/parsers/RPCBase.py +++ b/tools/InterfaceGenerator/generator/parsers/RPCBase.py @@ -548,8 +548,12 @@ class Parser(object): """ params, subelements, attrib = self._parse_base_item(element, "") - params["is_mandatory"] = self._extract_optional_bool_attrib( - attrib, "mandatory", True) + is_mandatory = self._extract_attrib(attrib, "mandatory") + if is_mandatory is None: + raise ParseError("'mandatory' is not specified for parameter '" + + params["name"] + "'") + + params["is_mandatory"] = self._get_bool_from_string(is_mandatory) scope = self._extract_attrib(attrib, "scope") if scope is not None: diff --git a/tools/Utils/generate_test_certificates.py b/tools/Utils/generate_test_certificates.py index 73b6f53cc8..2c1d2cddbf 100755 --- a/tools/Utils/generate_test_certificates.py +++ b/tools/Utils/generate_test_certificates.py @@ -118,12 +118,13 @@ def gen_pkcs12(out, key_file, cert_file, verification_certificate) : "-name 'SPT key and certificates'", "-CAfile ", verification_certificate, \ " -passout pass:") - """ - Encode certificate $out to base 64 - """ - with open(out, "rb") as cert: - with open(out + ".enc", "wb") as enc_cert: - enc_cert.write(cert.read().encode("base64")) +def gen_pem_file(out, key_file, cert_file, verification_certificate) : + """Join $key_file, $cert_file, $verification_certificate in pem file named $out""" + files = [key_file, cert_file, verification_certificate] + with open(out, "wb") as cert: + for fl in files: + with open(fl) as infile: + cert.write(infile.read()) def answers(name, app_id, country, state, locality, organization, unit, email) : """Answer string generator @@ -228,47 +229,53 @@ def main(): server_key_file = os.path.join(server_dir, "server.key") server_cert_file = os.path.join(server_dir, "server.crt") server_pkcs12_file = os.path.join(server_dir, "spt_credential.p12") + server_pem_file = os.path.join(server_dir, "spt_credential.pem") gen_rsa_key(server_key_file, 2048) gen_cert(server_cert_file, server_key_file, ford_server_cert_file, ford_server_key_file, days, server_answer) gen_pkcs12(server_pkcs12_file, server_key_file, server_cert_file, client_verification_ca_cert_file) + gen_pem_file(server_pem_file, server_key_file, server_cert_file, client_verification_ca_cert_file) print print " --== Server unsigned certificate generating ==-- " server_unsigned_cert_file = os.path.join(server_dir, "server_unsigned.crt") server_pkcs12_unsigned_file = os.path.join(server_dir, "spt_credential_unsigned.p12") + server_pem_unsigned_file = os.path.join(server_dir, "spt_credential_unsigned.pem") gen_root_cert(server_unsigned_cert_file, server_key_file, days, server_unsigned_answer) gen_pkcs12(server_pkcs12_unsigned_file, server_key_file, server_unsigned_cert_file, client_verification_ca_cert_file) + gen_pem_file(server_pem_unsigned_file, server_key_file, server_unsigned_cert_file, client_verification_ca_cert_file) print print " --== Server expired certificate generating ==-- " server_expired_cert_file = os.path.join(server_dir, "server_expired.crt") server_pkcs12_expired_file = os.path.join(server_dir, "spt_credential_expired.p12") + server_pem_expired_file = os.path.join(server_dir, "spt_credential_expired.pem") gen_expire_cert(server_expired_cert_file, server_key_file, ford_server_cert_file, ford_server_key_file, days, server_expired_answer) gen_pkcs12(server_pkcs12_expired_file, server_key_file, server_expired_cert_file, client_verification_ca_cert_file) + gen_pem_file(server_pem_expired_file, server_key_file, server_expired_cert_file, client_verification_ca_cert_file) print print " --== Client pkcs12 certificate generating ==-- " client_key_file = os.path.join(client_dir, "client.key") client_cert_file = os.path.join(client_dir, "client.crt") - client_pkcs12_file = os.path.join(client_dir, "client_credential.p12") + client_pkcs12_file = os.path.join(client_dir, "client_credential.pem") gen_rsa_key(client_key_file, 2048) gen_cert(client_cert_file, client_key_file, ford_client_cert_file, ford_client_key_file, days, client_answer) - gen_pkcs12(client_pkcs12_file, client_key_file, client_cert_file, server_verification_ca_cert_file) + gen_pem_file(client_pkcs12_file, client_key_file, client_cert_file, server_verification_ca_cert_file) print print " --== Client pkcs12 unsigned certificate generating ==-- " client_unsigned_cert_file = os.path.join(client_dir, "client_unsigned.crt") - client_pkcs12_unsigned_file = os.path.join(client_dir, "client_credential_unsigned.p12") + client_pkcs12_unsigned_file = os.path.join(client_dir, "client_credential_unsigned.pem") gen_root_cert(client_unsigned_cert_file, client_key_file, days, client_unsigned_answer) - gen_pkcs12(client_pkcs12_unsigned_file, client_key_file, client_unsigned_cert_file, server_verification_ca_cert_file) + gen_pem_file(client_pkcs12_unsigned_file, client_key_file, client_unsigned_cert_file, server_verification_ca_cert_file) print print " --== Client pkcs12 expired certificate generating ==-- " client_expired_cert_file = os.path.join(client_dir, "client_expired.crt") - client_pkcs12_expired_file = os.path.join(client_dir, "client_credential_expired.p12") + client_pkcs12_expired_file = os.path.join(client_dir, "client_credential_expired.pem") gen_expire_cert(client_expired_cert_file, client_key_file, ford_client_cert_file, ford_client_key_file, days, client_expired_answer) - gen_pkcs12(client_pkcs12_expired_file, client_key_file, client_expired_cert_file, server_verification_ca_cert_file) + gen_pem_file(client_pkcs12_expired_file, client_key_file, client_expired_cert_file, server_verification_ca_cert_file) subprocess.call(["c_rehash", server_dir]) subprocess.call(["c_rehash", client_dir]) diff --git a/tools/intergen/test/test_hmi_interface.xml b/tools/intergen/test/test_hmi_interface.xml index e091909833..16f2892327 100644 --- a/tools/intergen/test/test_hmi_interface.xml +++ b/tools/intergen/test/test_hmi_interface.xml @@ -175,6 +175,51 @@ <element name="NO-NO" internal_name="NO_NO"> <description>Norwegian - Norway</description> </element> + <element name="NL-BE" internal_name="NL_BE"> + <description>Dutch (Flemish) - Belgium</description> + </element> + <element name="EL-GR" internal_name="EL_GR"> + <description>Greek - Greece</description> + </element> + <element name="HU-HU" internal_name="HU_HU"> + <description>Hungarian - Hungary</description> + </element> + <element name="FI-FI" internal_name="FI_FI"> + <description>Finnish - Finland</description> + </element> + <element name="SK-SK" internal_name="SK_SK"> + <description>Slovak - Slovakia</description> + </element> + <element name="EN-IN" internal_name="EN_IN"> + <description>English - India</description> + </element> + <element name="TH-TH" internal_name="TH_TH"> + <description>Thai - Thailand</description> + </element> + <element name="EN-SA" internal_name="EN_SA"> + <description>English - Middle East</description> + </element> + <element name="HE-IL" internal_name="HE_IL"> + <description>Hebrew - Israel</description> + </element> + <element name="RO-RO" internal_name="RO_RO"> + <description>Romanian - Romania</description> + </element> + <element name="UK-UA" internal_name="UK_UA"> + <description>Ukrainian - Ukraine</description> + </element> + <element name="ID-ID" internal_name="ID_ID"> + <description>Indonesian - Indonesia</description> + </element> + <element name="VI-VN" internal_name="VI_VN"> + <description>Vietnamese - Vietnam</description> + </element> + <element name="MS-MY" internal_name="MS_MY"> + <description>Malay - Malaysia</description> + </element> + <element name="HI-IN" internal_name="HI_IN"> + <description>Hindi - India</description> + </element> </enum> <enum name="SoftButtonType"> |