summaryrefslogtreecommitdiff
path: root/src/components/hmi_message_handler
diff options
context:
space:
mode:
authorJustin Dickow <jjdickow@gmail.com>2015-01-24 16:58:15 -0500
committerJustin Dickow <jjdickow@gmail.com>2015-01-24 16:58:15 -0500
commita24079cb8de5563376dcf782cdb9fe3cae063841 (patch)
tree1fca30dde1aa30c7ac11fb6b009d2bd6420bd648 /src/components/hmi_message_handler
parentf948dd4539eeecb2c32084cc39b68923fc94e3dd (diff)
downloadsdl_core-a24079cb8de5563376dcf782cdb9fe3cae063841.tar.gz
HmiStatus modify
HU DCHECK occurs during multisession registration Remove unused variable SIGSEGV handler added to flush logger queue FixIncomplete device list in UpdateDeviceList request Fix Memory leak on PutFile break Fix Thread and Timer Fix OnHmiStatus Notification Fix Url array sending for endpoints. Fix HashChange Fix SDL parse incoming JSON message with both members error and result as success message Fix Core crashes while connecting mobile app Signed-off-by: Justin Dickow <jjdickow@gmail.com>
Diffstat (limited to 'src/components/hmi_message_handler')
-rw-r--r--src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_adapter.h2
-rw-r--r--src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_handler.h2
-rw-r--r--src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_handler_impl.h2
-rw-r--r--src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_observer.h2
-rw-r--r--src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_sender.h2
-rw-r--r--src/components/hmi_message_handler/include/hmi_message_handler/messagebroker_adapter.h2
-rw-r--r--src/components/hmi_message_handler/include/hmi_message_handler/mqueue_adapter.h65
-rw-r--r--src/components/hmi_message_handler/src/dbus_message_adapter.cc4
-rw-r--r--src/components/hmi_message_handler/src/hmi_message_adapter.cc2
-rw-r--r--src/components/hmi_message_handler/src/hmi_message_handler_impl.cc2
-rw-r--r--src/components/hmi_message_handler/src/messagebroker_adapter.cc12
-rw-r--r--src/components/hmi_message_handler/src/mqueue_adapter.cc83
12 files changed, 91 insertions, 89 deletions
diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_adapter.h b/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_adapter.h
index dc515318a0..5ed37031ea 100644
--- a/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_adapter.h
+++ b/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_adapter.h
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_handler.h b/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_handler.h
index 828ae9a00e..3e06c65085 100644
--- a/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_handler.h
+++ b/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_handler.h
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
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 071ce2c549..d638f370d8 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_observer.h b/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_observer.h
index f77a1f6a50..f2f84b13e7 100644
--- a/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_observer.h
+++ b/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_observer.h
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_sender.h b/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_sender.h
index 2712857305..d704a4df65 100644
--- a/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_sender.h
+++ b/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_sender.h
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/messagebroker_adapter.h b/src/components/hmi_message_handler/include/hmi_message_handler/messagebroker_adapter.h
index df344c80fd..4580b18ee1 100644
--- a/src/components/hmi_message_handler/include/hmi_message_handler/messagebroker_adapter.h
+++ b/src/components/hmi_message_handler/include/hmi_message_handler/messagebroker_adapter.h
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/mqueue_adapter.h b/src/components/hmi_message_handler/include/hmi_message_handler/mqueue_adapter.h
index 9d78fefc69..126ea3a66e 100644
--- a/src/components/hmi_message_handler/include/hmi_message_handler/mqueue_adapter.h
+++ b/src/components/hmi_message_handler/include/hmi_message_handler/mqueue_adapter.h
@@ -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.
+ */
#ifndef SRC_COMPONENTS_HMI_MESSAGE_HANDLER_INCLUDE_HMI_MESSAGE_HANDLER_MQUEUE_ADAPTER_H_
#define SRC_COMPONENTS_HMI_MESSAGE_HANDLER_INCLUDE_HMI_MESSAGE_HANDLER_MQUEUE_ADAPTER_H_
@@ -40,6 +40,8 @@
namespace hmi_message_handler {
+class ReceiverThreadDelegate;
+
/**
* \brief HMI message adapter for mqueue
*/
@@ -55,9 +57,10 @@ class MqueueAdapter : public HMIMessageAdapter {
private:
mqd_t sdl_to_hmi_mqueue_;
mqd_t hmi_to_sdl_mqueue_;
+
+ ReceiverThreadDelegate* receiver_thread_delegate_;
threads::Thread* receiver_thread_;
};
} // namespace hmi_message_handler
-
#endif // SRC_COMPONENTS_HMI_MESSAGE_HANDLER_INCLUDE_HMI_MESSAGE_HANDLER_MQUEUE_ADAPTER_H_
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 a79674df67..c08f090f1d 100644
--- a/src/components/hmi_message_handler/src/dbus_message_adapter.cc
+++ b/src/components/hmi_message_handler/src/dbus_message_adapter.cc
@@ -86,7 +86,7 @@ void DBusMessageAdapter::SendMessageToHMI(MessageSharedPointer message) {
break;
case hmi_apis::messageType::INVALID_ENUM:
default:
- LOG4CXX_INFO(logger_, "Message type is invalid");
+ LOG4CXX_WARN(logger_, "Message type is invalid");
}
}
@@ -156,7 +156,7 @@ void DBusMessageAdapter::SubscribeTo() {
}
void DBusMessageAdapter::SendMessageToCore(const smart_objects::SmartObject& obj) {
- LOG4CXX_INFO(logger_, "DBusMessageAdapter::SendMessageToCore");
+ LOG4CXX_AUTO_TRACE(logger_);
if (!handler()) {
LOG4CXX_WARN(logger_, "DBusMessageAdapter hasn't handler");
diff --git a/src/components/hmi_message_handler/src/hmi_message_adapter.cc b/src/components/hmi_message_handler/src/hmi_message_adapter.cc
index 343f13f00a..d8c280bea7 100644
--- a/src/components/hmi_message_handler/src/hmi_message_adapter.cc
+++ b/src/components/hmi_message_handler/src/hmi_message_adapter.cc
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
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 ed37ee677c..887d145617 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
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
diff --git a/src/components/hmi_message_handler/src/messagebroker_adapter.cc b/src/components/hmi_message_handler/src/messagebroker_adapter.cc
index 8779d2ea6d..d0dd5c09ba 100644
--- a/src/components/hmi_message_handler/src/messagebroker_adapter.cc
+++ b/src/components/hmi_message_handler/src/messagebroker_adapter.cc
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -74,17 +74,17 @@ void MessageBrokerAdapter::SendMessageToHMI(
void MessageBrokerAdapter::processResponse(std::string method,
Json::Value& root) {
- LOG4CXX_INFO(logger_, "MessageBrokerAdapter::processResponse");
+ LOG4CXX_AUTO_TRACE(logger_);
ProcessRecievedFromMB(root);
}
void MessageBrokerAdapter::processRequest(Json::Value& root) {
- LOG4CXX_INFO(logger_, "MessageBrokerAdapter::processRequest");
+ LOG4CXX_AUTO_TRACE(logger_);
ProcessRecievedFromMB(root);
}
void MessageBrokerAdapter::processNotification(Json::Value& root) {
- LOG4CXX_INFO(logger_, "MessageBrokerAdapter::processNotification");
+ LOG4CXX_AUTO_TRACE(logger_);
ProcessRecievedFromMB(root);
}
@@ -137,13 +137,15 @@ void MessageBrokerAdapter::SubscribeTo() {
void* MessageBrokerAdapter::SubscribeAndBeginReceiverThread(void* param) {
PassToThread(threads::Thread::CurrentId());
+ // For PASA we don't need to subscribe and register controller
+ // this will prevent from errors on start up
registerController();
SubscribeTo();
return MethodForReceiverThread(param);
}
void MessageBrokerAdapter::ProcessRecievedFromMB(Json::Value& root) {
- LOG4CXX_INFO(logger_, "MessageBrokerAdapter::ProcessRecievedFromMB");
+ LOG4CXX_AUTO_TRACE(logger_);
if (root.isNull()) {
// LOG
return;
diff --git a/src/components/hmi_message_handler/src/mqueue_adapter.cc b/src/components/hmi_message_handler/src/mqueue_adapter.cc
index b1524b5f03..825c27c048 100644
--- a/src/components/hmi_message_handler/src/mqueue_adapter.cc
+++ b/src/components/hmi_message_handler/src/mqueue_adapter.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 "hmi_message_handler/mqueue_adapter.h"
#include "hmi_message_handler/hmi_message_handler.h"
@@ -61,7 +61,7 @@ class ReceiverThreadDelegate : public threads::ThreadDelegate {
continue;
}
const std::string message_string(buffer, buffer + size);
- LOG4CXX_INFO(logger_, "Message: " << message_string);
+ LOG4CXX_DEBUG(logger_, "Message: " << message_string);
MessageSharedPointer message(new application_manager::Message(
protocol_handler::MessagePriority::kDefault));
message->set_json_message(message_string);
@@ -78,7 +78,7 @@ MqueueAdapter::MqueueAdapter(HMIMessageHandler* hmi_message_handler)
: HMIMessageAdapter(hmi_message_handler),
sdl_to_hmi_mqueue_(-1),
hmi_to_sdl_mqueue_(-1),
- receiver_thread_() {
+ receiver_thread_(NULL) {
mq_attr mq_attributes;
mq_attributes.mq_maxmsg = kMqueueSize;
mq_attributes.mq_msgsize = kMqueueMessageSize;
@@ -96,18 +96,17 @@ MqueueAdapter::MqueueAdapter(HMIMessageHandler* hmi_message_handler)
<< kHmiToSdlQueue << ", error " << errno);
return;
}
- ReceiverThreadDelegate* receiver_thread_delegate =
- new ReceiverThreadDelegate(hmi_to_sdl_mqueue_, hmi_message_handler);
- receiver_thread_ =
- threads::CreateThread("MqueueAdapter", receiver_thread_delegate);
+ receiver_thread_delegate_ = new ReceiverThreadDelegate(hmi_to_sdl_mqueue_,
+ hmi_message_handler);
+ receiver_thread_ = threads::CreateThread("MqueueAdapter",
+ receiver_thread_delegate_);
receiver_thread_->start();
}
MqueueAdapter::~MqueueAdapter() {
- if (receiver_thread_) {
- receiver_thread_->stop();
- threads::DeleteThread(receiver_thread_);
- }
+ receiver_thread_->join();
+ delete receiver_thread_delegate_;
+ threads::DeleteThread(receiver_thread_);
if (-1 != hmi_to_sdl_mqueue_) mq_close(hmi_to_sdl_mqueue_);
if (-1 != sdl_to_hmi_mqueue_) mq_close(sdl_to_hmi_mqueue_);
mq_unlink(kHmiToSdlQueue);
@@ -115,7 +114,7 @@ MqueueAdapter::~MqueueAdapter() {
}
void MqueueAdapter::SendMessageToHMI(const MessageSharedPointer message) {
- LOG4CXX_TRACE_ENTER(logger_);
+ LOG4CXX_AUTO_TRACE(logger_);
if (-1 == sdl_to_hmi_mqueue_) {
LOG4CXX_ERROR(logger_, "Message queue is not opened");
@@ -131,8 +130,6 @@ void MqueueAdapter::SendMessageToHMI(const MessageSharedPointer message) {
LOG4CXX_ERROR(logger_, "Could not send message, error " << errno);
return;
}
-
- LOG4CXX_TRACE_EXIT(logger_);
}
void MqueueAdapter::SubscribeTo() {