3 * \brief Signal (i.e. SIGINT) handling.
4 * Copyright (c) 2013, Ford Motor Company
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
10 * Redistributions of source code must retain the above copyright notice, this
11 * list of conditions and the following disclaimer.
13 * Redistributions in binary form must reproduce the above copyright notice,
14 * this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided with the
18 * Neither the name of the Ford Motor Company nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
35 #ifndef SRC_APPMAIN_LIFE_CYCLE_H_
36 #define SRC_APPMAIN_LIFE_CYCLE_H_
38 #include "hmi_message_handler/hmi_message_handler_impl.h"
40 # include "hmi_message_handler/dbus_message_adapter.h"
43 # include "hmi_message_handler/messagebroker_adapter.h"
45 #include "application_manager/application_manager_impl.h"
46 #include "connection_handler/connection_handler_impl.h"
47 #include "protocol_handler/protocol_handler_impl.h"
48 #include "transport_manager/transport_manager.h"
49 #include "transport_manager/transport_manager_default.h"
50 #include "media_manager/media_manager_impl.h"
51 #include "utils/singleton.h"
54 # include "CMessageBroker.hpp"
55 # include "mb_tcpserver.hpp"
56 # include "networking.h" // cpplint: Include the directory when naming .h files
58 #include "system.h" // cpplint: Include the directory when naming .h files
60 namespace main_namespace {
61 class LifeCycle : public utils::Singleton<LifeCycle> {
63 bool StartComponents();
66 * Initialize MessageBroker component
67 * @return true if success otherwise false.
69 bool InitMessageSystem();
70 void StopComponents();
71 static void StopComponentsOnSignal(int32_t params);
75 transport_manager::TransportManager* transport_manager_;
76 protocol_handler::ProtocolHandlerImpl* protocol_handler_;
77 connection_handler::ConnectionHandlerImpl* connection_handler_;
78 application_manager::ApplicationManagerImpl* app_manager_;
79 hmi_message_handler::HMIMessageHandlerImpl* hmi_handler_;
81 hmi_message_handler::DBusMessageAdapter* dbus_adapter_;
84 hmi_message_handler::MessageBrokerAdapter* mb_adapter_;
86 media_manager::MediaManagerImpl* media_manager_;
89 NsMessageBroker::CMessageBroker* message_broker_;
90 NsMessageBroker::TcpServer* message_broker_server_;
91 System::Thread* mb_thread_;
92 System::Thread* mb_server_thread_;
93 System::Thread* mb_adapter_thread_;
96 System::Thread* dbus_adapter_thread_;
100 static log4cxx::LoggerPtr logger_;
101 # endif // ENABLE_LOG
103 DISALLOW_COPY_AND_ASSIGN(LifeCycle);
105 FRIEND_BASE_SINGLETON_CLASS(LifeCycle);
107 } // namespace main_namespace
109 #endif // SRC_APPMAIN_LIFE_CYCLE_H_