From ea5d724fe899e65933b5de33e2957c4cd33338e7 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Tue, 30 Jan 2018 15:45:15 -0500 Subject: Fix DBus Build --- CMakeLists.txt | 4 ++ src/3rd_party/CMakeLists.txt | 12 ---- src/appMain/life_cycle.cc | 2 + src/components/application_manager/CMakeLists.txt | 6 +- src/components/dbus/CMakeLists.txt | 2 +- src/components/dbus/test/CMakeLists.txt | 3 +- .../dbus/test/dbus_message_controller_test.cc | 8 +-- .../include/dbus/mock_dbus_message_controller.h | 76 ++++++++++++++++++++++ .../dbus/test/include/dbus/mock_subscriber.h | 62 ++++++++++++++++++ src/components/dbus/test/mock_subscriber.cc | 71 ++++++++++++++++++++ src/components/hmi_message_handler/CMakeLists.txt | 2 +- .../hmi_message_handler/test/CMakeLists.txt | 12 +--- .../mock_dbus_message_controller.h | 76 ---------------------- .../include/hmi_message_handler/mock_subscriber.h | 62 ------------------ .../hmi_message_handler/test/mock_subscriber.cc | 71 -------------------- src/components/interfaces/QT_HMI_API.xml | 38 +++++++++++ src/components/rpc_base/test/CMakeLists.txt | 1 - tools/cmake/modules/FindDBus.cmake | 59 +++++++++++++++++ tools/intergen/test/CMakeLists.txt | 2 +- 19 files changed, 327 insertions(+), 242 deletions(-) create mode 100644 src/components/dbus/test/include/dbus/mock_dbus_message_controller.h create mode 100644 src/components/dbus/test/include/dbus/mock_subscriber.h create mode 100644 src/components/dbus/test/mock_subscriber.cc delete mode 100644 src/components/hmi_message_handler/test/include/hmi_message_handler/mock_dbus_message_controller.h delete mode 100644 src/components/hmi_message_handler/test/include/hmi_message_handler/mock_subscriber.h delete mode 100644 src/components/hmi_message_handler/test/mock_subscriber.cc create mode 100644 tools/cmake/modules/FindDBus.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 7730b57c2d..bc049a5a28 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -374,6 +374,10 @@ if (HMIADAPTER STREQUAL "dbus") set(HMI_DBUS_API ON) add_definitions(-DDBUS_HMIADAPTER) add_definitions(-DHMI_DBUS_API) + + find_package(DBus REQUIRED) + set(DBUS_LIBS_DIRECTORY ${DBUS_LIBRARY_DIRS} PARENT_SCOPE) + message(${DBUS_INCLUDE_DIRS}) endif() if (HMIADAPTER STREQUAL "messagebroker") set(HMI_JSON_API ON) diff --git a/src/3rd_party/CMakeLists.txt b/src/3rd_party/CMakeLists.txt index c5b4640a77..b2ed272416 100644 --- a/src/3rd_party/CMakeLists.txt +++ b/src/3rd_party/CMakeLists.txt @@ -172,18 +172,6 @@ if(ENABLE_LOG) add_subdirectory(apache-log4cxx-cmake) endif() -# --- D-Bus -if(HMI_DBUS_API) - - # --- D-Bus - set(DBUS_INCLUDE_DIR ${3RD_PARTY_INSTALL_PREFIX}/include) - set(DBUS_INCLUDE_DIR_ARCH ${3RD_PARTY_INSTALL_PREFIX_ARCH}/include) - set(DBUS_INCLUDE_DIRS ${DBUS_INCLUDE_DIR} ${DBUS_INCLUDE_DIR_ARCH}) - set(DBUS_INCLUDE_DIRS ${DBUS_INCLUDE_DIRS} PARENT_SCOPE) - set(DBUS_LIBS_DIRECTORY ${3RD_PARTY_INSTALL_PREFIX_ARCH}/lib PARENT_SCOPE) - message(${DBUS_INCLUDE_DIR}) -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) diff --git a/src/appMain/life_cycle.cc b/src/appMain/life_cycle.cc index 119227ea03..7487052129 100644 --- a/src/appMain/life_cycle.cc +++ b/src/appMain/life_cycle.cc @@ -54,10 +54,12 @@ namespace main_namespace { CREATE_LOGGERPTR_GLOBAL(logger_, "SDLMain") namespace { +#ifdef MESSAGEBROKER_HMIADAPTER void NameMessageBrokerThread(const System::Thread& thread, const std::string& name) { Thread::SetNameForId(thread.GetId(), name); } +#endif // MESSAGEBROKER_HMIADAPTER void StopThread(System::Thread* thread) { if (thread) { diff --git a/src/components/application_manager/CMakeLists.txt b/src/components/application_manager/CMakeLists.txt index 7a49ce6b81..6c3a355cfc 100644 --- a/src/components/application_manager/CMakeLists.txt +++ b/src/components/application_manager/CMakeLists.txt @@ -344,9 +344,6 @@ set (HMI_COMMANDS_SOURCES ${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 ${COMMANDS_SOURCE_DIR}/hmi/vi_get_vehicle_data_request.cc ${COMMANDS_SOURCE_DIR}/hmi/vi_get_vehicle_data_response.cc ${COMMANDS_SOURCE_DIR}/hmi/vi_subscribe_vehicle_data_request.cc @@ -356,6 +353,9 @@ set (HMI_COMMANDS_SOURCES_JSON ${COMMANDS_SOURCE_DIR}/hmi/on_vi_vehicle_data_notification.cc ) +set (HMI_COMMANDS_SOURCES_JSON +) + set (HMI_COMMANDS_SOURCES_DBUS ${COMMANDS_SOURCE_DIR}/hmi/on_vi_gps_data_notification.cc ${COMMANDS_SOURCE_DIR}/hmi/on_vi_speed_notification.cc diff --git a/src/components/dbus/CMakeLists.txt b/src/components/dbus/CMakeLists.txt index 07ca2586d0..eb198b620c 100644 --- a/src/components/dbus/CMakeLists.txt +++ b/src/components/dbus/CMakeLists.txt @@ -52,7 +52,7 @@ collect_sources(SOURCES "${PATHS}") set(LIBRARIES HMI_API Utils - dbus-1 -L${DBUS_LIBS_DIRECTORY} + dbus-1 ) add_custom_command( diff --git a/src/components/dbus/test/CMakeLists.txt b/src/components/dbus/test/CMakeLists.txt index 1b3df2c0e7..914bd2ca84 100644 --- a/src/components/dbus/test/CMakeLists.txt +++ b/src/components/dbus/test/CMakeLists.txt @@ -33,11 +33,12 @@ include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake) include_directories ( ${GMOCK_INCLUDE_DIRECTORY} ${COMPONENTS_DIR}/dbus/include/ + ${COMPONENTS_DIR}/dbus/test/include/ ) #FIXME: exclude some tests set (EXCLUDE_PATHS - test_dbus_message_controller.cc + dbus_message_controller_test.cc ) collect_sources(SOURCES "${CMAKE_CURRENT_SOURCE_DIR}" ${EXCLUDE_PATHS}) diff --git a/src/components/dbus/test/dbus_message_controller_test.cc b/src/components/dbus/test/dbus_message_controller_test.cc index 5c5d4e69d5..c06e144f9b 100644 --- a/src/components/dbus/test/dbus_message_controller_test.cc +++ b/src/components/dbus/test/dbus_message_controller_test.cc @@ -36,14 +36,14 @@ #include #include #include -#include "hmi_message_handler/mock_dbus_message_controller.h" -#include "hmi_message_handler/mock_subscriber.h" +#include "dbus/mock_dbus_message_controller.h" +#include "dbus/mock_subscriber.h" using ::testing::_; namespace test { namespace components { -namespace hmi_message_handler { +namespace dbus { ACTION_P(SignalTest, test) { if (test->thread_id != pthread_self()) { @@ -111,6 +111,6 @@ TEST_F(DBusMessageControllerTest, DISABLED_Send) { controller_->Send(kText); } -} // namespace hmi_message_handler +} // namespace dbus } // namespace components } // namespace test diff --git a/src/components/dbus/test/include/dbus/mock_dbus_message_controller.h b/src/components/dbus/test/include/dbus/mock_dbus_message_controller.h new file mode 100644 index 0000000000..2fe4267b35 --- /dev/null +++ b/src/components/dbus/test/include/dbus/mock_dbus_message_controller.h @@ -0,0 +1,76 @@ +/* +* 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. +*/ + +#ifndef SRC_COMPONENTS_DBUS_TEST_INCLUDE_DBUS_MOCK_DBUS_MESSAGE_CONTROLLER_H_ +#define SRC_COMPONENTS_DBUS_TEST_INCLUDE_DBUS_MOCK_DBUS_MESSAGE_CONTROLLER_H_ + +#include +#include "dbus/dbus_message_controller.h" + +namespace test { +namespace components { +namespace dbus_test { + +class MockDBusMessageController + : public ::dbus::DBusMessageController { + public: + MOCK_METHOD1(Recv, void(std::string&)); + + MockDBusMessageController(const std::string& serviceName, + const std::string& path) + : DBusMessageController(serviceName, path), thread_() {} + + virtual void processResponse(std::string method, Json::Value& root) {} + virtual void processRequest(Json::Value& root) {} + virtual void processNotification(Json::Value& root) {} + + bool Init() { + return ::hmi_message_handler::DBusMessageController::Init() && + pthread_create(&thread_, 0, &Run, this) == 0; + } + + private: + pthread_t thread_; + static void* Run(void* data) { + if (NULL != data) { + static_cast(data) + ->MethodForReceiverThread(nullptr); + } + return 0; + } +}; + +} // namespace dbus_test +} // namespace components +} // namespace test + +#endif // SRC_COMPONENTS_DBUS_TEST_INCLUDE_DBUS_MOCK_DBUS_MESSAGE_CONTROLLER_H_ diff --git a/src/components/dbus/test/include/dbus/mock_subscriber.h b/src/components/dbus/test/include/dbus/mock_subscriber.h new file mode 100644 index 0000000000..b2a369e371 --- /dev/null +++ b/src/components/dbus/test/include/dbus/mock_subscriber.h @@ -0,0 +1,62 @@ +/* +* 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. +*/ + +#ifndef SRC_COMPONENTS_DBUS_TEST_INCLUDE_DBUS_MOCK_SUBSCRIBER_H_ +#define SRC_COMPONENTS_DBUS_TEST_INCLUDE_DBUS_MOCK_SUBSCRIBER_H_ + +#include + +struct DBusConnection; + +namespace test { +namespace components { +namespace dbus { + +class MockSubscriber { + public: + MockSubscriber(const std::string nameService, const std::string path); + virtual ~MockSubscriber(); + virtual void Receive(); + bool Start(); + void Send(const std::string& message); + + private: + std::string nameService_; + std::string path_; + DBusConnection* conn_; +}; + +} // namespace dbus +} // namespace components +} // namespace test + +#endif // SRC_COMPONENTS_DBUS_TEST_INCLUDE_DBUS_MOCK_SUBSCRIBER_H_ diff --git a/src/components/dbus/test/mock_subscriber.cc b/src/components/dbus/test/mock_subscriber.cc new file mode 100644 index 0000000000..2c5dccaa50 --- /dev/null +++ b/src/components/dbus/test/mock_subscriber.cc @@ -0,0 +1,71 @@ +/** +* 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 "dbus/dbus.h" +#include "dbus/mock_subscriber.h" + +namespace test { +namespace components { +namespace dbus { + +MockSubscriber::MockSubscriber(const std::string nameService, + const std::string path) + : nameService_(nameService), path_(path), conn_(NULL) {} + +MockSubscriber::~MockSubscriber() {} + +void MockSubscriber::Receive() {} + +bool MockSubscriber::Start() { + DBusError err; + dbus_error_init(&err); + conn_ = dbus_bus_get(DBUS_BUS_SESSION, &err); + if (dbus_error_is_set(&err)) { + dbus_error_free(&err); + return false; + } + + std::string rule = "type='signal',interface='" + nameService_ + "'"; + dbus_bus_add_match(conn_, rule.c_str(), &err); + dbus_connection_flush(conn_); + if (dbus_error_is_set(&err)) { + dbus_error_free(&err); + return false; + } + return true; +} + +void MockSubscriber::Send(const std::string& message) {} + +} // namespace dbus +} // namespace components +} // namespace test diff --git a/src/components/hmi_message_handler/CMakeLists.txt b/src/components/hmi_message_handler/CMakeLists.txt index c1dfca5e67..b127d8dcc5 100644 --- a/src/components/hmi_message_handler/CMakeLists.txt +++ b/src/components/hmi_message_handler/CMakeLists.txt @@ -54,7 +54,7 @@ set(PATHS ) if (HMIADAPTER STREQUAL "dbus") - set(EXCLUDE_PATHS) + set(EXCLUDE_PATHS messagebroker_adapter.cc) set(DBUS_ADAPTER DBus) else() set(EXCLUDE_PATHS dbus_message_adapter.cc) diff --git a/src/components/hmi_message_handler/test/CMakeLists.txt b/src/components/hmi_message_handler/test/CMakeLists.txt index 0d7ccd9ee1..020c5843a5 100644 --- a/src/components/hmi_message_handler/test/CMakeLists.txt +++ b/src/components/hmi_message_handler/test/CMakeLists.txt @@ -42,10 +42,11 @@ if (HMIADAPTER STREQUAL "messagebroker") message_broker_client message_broker_server ) + set(EXCLUDE_PATHS) +else() + set(EXCLUDE_PATHS hmi_message_handler_impl_test.cc) endif() -set(EXCLUDE_PATHS) - set(LIBRARIES gmock ApplicationManager @@ -55,13 +56,6 @@ set(LIBRARIES ConfigProfile ) -if(NOT HMI_DBUS_API}) - list (APPEND EXCLUDE_PATHS - mock_subscriber.cc - dbus_message_adapter_test.cc - ) -endif() - collect_sources(SOURCES "${CMAKE_CURRENT_SOURCE_DIR}" "${EXCLUDE_PATHS}") create_test(hmi_message_handler_test "${SOURCES}" "${LIBRARIES}") diff --git a/src/components/hmi_message_handler/test/include/hmi_message_handler/mock_dbus_message_controller.h b/src/components/hmi_message_handler/test/include/hmi_message_handler/mock_dbus_message_controller.h deleted file mode 100644 index 86ebf100bb..0000000000 --- a/src/components/hmi_message_handler/test/include/hmi_message_handler/mock_dbus_message_controller.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -* 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. -*/ - -#ifndef SRC_COMPONENTS_HMI_MESSAGE_HANDLER_TEST_INCLUDE_HMI_MESSAGE_HANDLER_MOCK_DBUS_MESSAGE_CONTROLLER_H_ -#define SRC_COMPONENTS_HMI_MESSAGE_HANDLER_TEST_INCLUDE_HMI_MESSAGE_HANDLER_MOCK_DBUS_MESSAGE_CONTROLLER_H_ - -#include -#include "hmi_message_handler/dbus_message_controller.h" - -namespace test { -namespace components { -namespace hmi_message_handler_test { - -class MockDBusMessageController - : public ::hmi_message_handler::DBusMessageController { - public: - MOCK_METHOD1(Recv, void(std::string&)); - - MockDBusMessageController(const std::string& serviceName, - const std::string& path) - : DBusMessageController(serviceName, path), thread_() {} - - virtual void processResponse(std::string method, Json::Value& root) {} - virtual void processRequest(Json::Value& root) {} - virtual void processNotification(Json::Value& root) {} - - bool Init() { - return ::hmi_message_handler::DBusMessageController::Init() && - pthread_create(&thread_, 0, &Run, this) == 0; - } - - private: - pthread_t thread_; - static void* Run(void* data) { - if (NULL != data) { - static_cast(data) - ->MethodForReceiverThread(nullptr); - } - return 0; - } -}; - -} // namespace hmi_message_handler_test -} // namespace components -} // namespace test - -#endif // SRC_COMPONENTS_HMI_MESSAGE_HANDLER_TEST_INCLUDE_HMI_MESSAGE_HANDLER_MOCK_DBUS_MESSAGE_CONTROLLER_H_ diff --git a/src/components/hmi_message_handler/test/include/hmi_message_handler/mock_subscriber.h b/src/components/hmi_message_handler/test/include/hmi_message_handler/mock_subscriber.h deleted file mode 100644 index 9e9074e70c..0000000000 --- a/src/components/hmi_message_handler/test/include/hmi_message_handler/mock_subscriber.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -* 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. -*/ - -#ifndef SRC_COMPONENTS_HMI_MESSAGE_HANDLER_TEST_INCLUDE_HMI_MESSAGE_HANDLER_MOCK_SUBSCRIBER_H_ -#define SRC_COMPONENTS_HMI_MESSAGE_HANDLER_TEST_INCLUDE_HMI_MESSAGE_HANDLER_MOCK_SUBSCRIBER_H_ - -#include - -struct DBusConnection; - -namespace test { -namespace components { -namespace hmi_message_handler_test { - -class MockSubscriber { - public: - MockSubscriber(const std::string nameService, const std::string path); - virtual ~MockSubscriber(); - virtual void Receive(); - bool Start(); - void Send(const std::string& message); - - private: - std::string nameService_; - std::string path_; - DBusConnection* conn_; -}; - -} // namespace hmi_message_handler_test -} // namespace components -} // namespace test - -#endif // SRC_COMPONENTS_HMI_MESSAGE_HANDLER_TEST_INCLUDE_HMI_MESSAGE_HANDLER_MOCK_SUBSCRIBER_H_ diff --git a/src/components/hmi_message_handler/test/mock_subscriber.cc b/src/components/hmi_message_handler/test/mock_subscriber.cc deleted file mode 100644 index 0fc9110a1d..0000000000 --- a/src/components/hmi_message_handler/test/mock_subscriber.cc +++ /dev/null @@ -1,71 +0,0 @@ -/** -* 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 "dbus/dbus.h" -#include "hmi_message_handler/mock_subscriber.h" - -namespace test { -namespace components { -namespace hmi_message_handler_test { - -MockSubscriber::MockSubscriber(const std::string& nameService, - const std::string& path) - : nameService_(nameService), path_(path), conn_(NULL) {} - -MockSubscriber::~MockSubscriber() {} - -void MockSubscriber::Receive() {} - -bool MockSubscriber::Start() { - DBusError err; - dbus_error_init(&err); - conn_ = dbus_bus_get(DBUS_BUS_SESSION, &err); - if (dbus_error_is_set(&err)) { - dbus_error_free(&err); - return false; - } - - std::string rule = "type='signal',interface='" + nameService_ + "'"; - dbus_bus_add_match(conn_, rule.c_str(), &err); - dbus_connection_flush(conn_); - if (dbus_error_is_set(&err)) { - dbus_error_free(&err); - return false; - } - return true; -} - -void MockSubscriber::Send(const std::string& message) {} - -} // namespace hmi_message_handler_test -} // namespace components -} // namespace test diff --git a/src/components/interfaces/QT_HMI_API.xml b/src/components/interfaces/QT_HMI_API.xml index 08451b5461..0e5d765964 100644 --- a/src/components/interfaces/QT_HMI_API.xml +++ b/src/components/interfaces/QT_HMI_API.xml @@ -525,6 +525,44 @@ + + + The data in this field contains the title of the currently playing audio track. + + + The data in this field contains the artist or creator of the currently playing audio track. + + + The data in this field contains the album title of the currently playing audio track. + + + The data in this field contains the creation year of the currently playing audio track. + + + The data in this field contains the genre of the currently playing audio track. + + + The data in this field contains the name of the current source for the media. + + + The data in this field is a rating. + + + The data in this field is the current temperature. + + + The data in this field is the maximum temperature for the day. + + + The data in this field is the minimum temperature for the day. + + + The data in this field describes the current weather (ex. cloudy, clear, etc.). + + + The data in this field describes the current humidity value. + + The image field for SoftButton diff --git a/src/components/rpc_base/test/CMakeLists.txt b/src/components/rpc_base/test/CMakeLists.txt index 566f0ddcde..ca4f41fe76 100644 --- a/src/components/rpc_base/test/CMakeLists.txt +++ b/src/components/rpc_base/test/CMakeLists.txt @@ -34,7 +34,6 @@ include_directories( ${COMPONENTS_DIR}/dbus/include ${COMPONENTS_DIR}/dbus/src ${COMPONENTS_DIR}/rpc_base/include - ${CMAKE_SOURCE_DIR}/src/3rd_party/dbus-1.7.8 ${GMOCK_INCLUDE_DIRECTORY} ${JSONCPP_INCLUDE_DIRECTORY} ) diff --git a/tools/cmake/modules/FindDBus.cmake b/tools/cmake/modules/FindDBus.cmake new file mode 100644 index 0000000000..1d0f29dd75 --- /dev/null +++ b/tools/cmake/modules/FindDBus.cmake @@ -0,0 +1,59 @@ +# - Try to find DBus +# Once done, this will define +# +# DBUS_FOUND - system has DBus +# DBUS_INCLUDE_DIRS - the DBus include directories +# DBUS_LIBRARIES - link these to use DBus +# +# Copyright (C) 2012 Raphael Kubo da Costa +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS 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 ITS +# 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. + +FIND_PACKAGE(PkgConfig) +PKG_CHECK_MODULES(PC_DBUS QUIET dbus-1) + +FIND_LIBRARY(DBUS_LIBRARIES + NAMES dbus-1 + HINTS ${PC_DBUS_LIBDIR} + ${PC_DBUS_LIBRARY_DIRS} +) + +FIND_PATH(DBUS_INCLUDE_DIR + NAMES dbus/dbus.h + HINTS ${PC_DBUS_INCLUDEDIR} + ${PC_DBUS_INCLUDE_DIRS} +) + +GET_FILENAME_COMPONENT(_DBUS_LIBRARY_DIR ${DBUS_LIBRARIES} PATH) +FIND_PATH(DBUS_ARCH_INCLUDE_DIR + NAMES dbus/dbus-arch-deps.h + HINTS ${PC_DBUS_INCLUDEDIR} + ${PC_DBUS_INCLUDE_DIRS} + ${_DBUS_LIBRARY_DIR} + ${DBUS_INCLUDE_DIR} + PATH_SUFFIXES include +) + +SET(DBUS_INCLUDE_DIRS ${DBUS_INCLUDE_DIR} ${DBUS_ARCH_INCLUDE_DIR}) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(DBUS REQUIRED_VARS DBUS_INCLUDE_DIRS DBUS_LIBRARIES) \ No newline at end of file diff --git a/tools/intergen/test/CMakeLists.txt b/tools/intergen/test/CMakeLists.txt index 27d506443e..f2973dd71c 100644 --- a/tools/intergen/test/CMakeLists.txt +++ b/tools/intergen/test/CMakeLists.txt @@ -76,7 +76,7 @@ if (${HMI_DBUS_API}) ${CMAKE_SOURCE_DIR}/src/components/dbus/include ${DBUS_INCLUDE_DIRS} ) - set (LIBRARIES ${LIBRARIES} dbus) + set (LIBRARIES ${LIBRARIES} DBus) set (SOURCES ${SOURCES} generated_interface_dbus_tests.cc) endif () -- cgit v1.2.1