diff options
author | jacobkeeler <jacob.keeler@livioradio.com> | 2018-02-26 11:28:28 -0500 |
---|---|---|
committer | jacobkeeler <jacob.keeler@livioradio.com> | 2018-02-26 11:28:28 -0500 |
commit | 83518a7e7382001163ab6b0f099c0e56540bba62 (patch) | |
tree | 14d48f2404e9d6abb0c06cd5fbb813b24705ba2b /src/components/dbus | |
parent | 7d2448880702778fde64860e575e80e8ee6446c0 (diff) | |
download | sdl_core-83518a7e7382001163ab6b0f099c0e56540bba62.tar.gz |
Fix DBus build issue due to new message broker
Diffstat (limited to 'src/components/dbus')
-rw-r--r-- | src/components/dbus/include/dbus/dbus_message_controller.h | 37 | ||||
-rw-r--r-- | src/components/dbus/src/dbus_message_controller.cc | 17 |
2 files changed, 38 insertions, 16 deletions
diff --git a/src/components/dbus/include/dbus/dbus_message_controller.h b/src/components/dbus/include/dbus/dbus_message_controller.h index 973cc86fae..a4a3718ce3 100644 --- a/src/components/dbus/include/dbus/dbus_message_controller.h +++ b/src/components/dbus/include/dbus/dbus_message_controller.h @@ -43,11 +43,11 @@ namespace dbus { class DBusMessageController : public DBusAdapter { public: /** - * \brief constructs DBus message controller - * \param sdlServiceName name of service SDL - * \param sdlObjectPath path of object SDL - * \param hmiServiceName name of service HMI - * \param hmiObjectPath path of object HMI + * @brief constructs DBus message controller + * @param sdlServiceName name of service SDL + * @param sdlObjectPath path of object SDL + * @param hmiServiceName name of service HMI + * @param hmiObjectPath path of object HMI */ DBusMessageController(const std::string& sdlServiceName, const std::string& sdlObjectPath, @@ -55,28 +55,41 @@ class DBusMessageController : public DBusAdapter { const std::string& hmiObjectPath); /** - * \brief destructs DBus message controller + * @brief destructs DBus message controller */ virtual ~DBusMessageController(); /** - * \brief subscribes to the DBus signal. - * \param interface name of interface in HMI - * \param signal name of signal + * @brief subscribes to the DBus signal. + * @param interface name of interface in HMI + * @param signal name of signal */ void SubscribeTo(const std::string& interface, const std::string& signal); /** - * \brief Method for receiving thread. + * @brief Method for receiving thread. */ void* MethodForReceiverThread(void*); + /** + * @brief Main thread loop. + */ + bool Run(); + + /** + * @brief Signal shutdown for thread loop. + */ + void Shutdown(); + protected: /** - * \brief sends message to core - * \param obj + * @brief sends message to core + * @param obj */ virtual void SendMessageToCore(const smart_objects::SmartObject& obj) = 0; + + private: + bool shutdown_; }; } // namespace dbus diff --git a/src/components/dbus/src/dbus_message_controller.cc b/src/components/dbus/src/dbus_message_controller.cc index a8bd7a1050..59f08d6695 100644 --- a/src/components/dbus/src/dbus_message_controller.cc +++ b/src/components/dbus/src/dbus_message_controller.cc @@ -41,8 +41,8 @@ DBusMessageController::DBusMessageController(const std::string& sdlServiceName, const std::string& sdlObjectPath, const std::string& hmiServiceName, const std::string& hmiObjectPath) - : DBusAdapter( - sdlServiceName, sdlObjectPath, hmiServiceName, hmiObjectPath) {} + : DBusAdapter(sdlServiceName, sdlObjectPath, hmiServiceName, hmiObjectPath) + , shutdown_(false) {} void DBusMessageController::SubscribeTo(const std::string& interface, const std::string& signal) { @@ -67,7 +67,12 @@ void DBusMessageController::SubscribeTo(const std::string& interface, DBusMessageController::~DBusMessageController() {} void* DBusMessageController::MethodForReceiverThread(void*) { - while (true) { + Run(); + return NULL; +} + +bool DBusMessageController::Run() { + while (!shutdown_) { smart_objects::SmartObject obj(smart_objects::SmartType_Map); obj[sos::S_PARAMS][sos::S_PROTOCOL_VERSION] = 2; obj[sos::S_PARAMS][sos::S_PROTOCOL_TYPE] = 1; @@ -75,7 +80,11 @@ void* DBusMessageController::MethodForReceiverThread(void*) { SendMessageToCore(obj); } } - return NULL; + return true; +} + +void DBusMessageController::Shutdown() { + shutdown_ = true; } } // namespace dbus |