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 "policies/policy_manager_impl.h"
52 #include "utils/singleton.h"
55 # include "CMessageBroker.hpp"
56 # include "mb_tcpserver.hpp"
57 # include "networking.h" // cpplint: Include the directory when naming .h files
59 #include "system.h" // cpplint: Include the directory when naming .h files
61 namespace main_namespace {
62 class LifeCycle : public utils::Singleton<LifeCycle> {
64 bool StartComponents();
67 * Initialize MessageBroker component
68 * @return true if success otherwise false.
70 bool InitMessageSystem();
71 void StopComponents();
72 static void StopComponentsOnSignal(int32_t params);
76 transport_manager::TransportManager* transport_manager_;
77 protocol_handler::ProtocolHandlerImpl* protocol_handler_;
78 connection_handler::ConnectionHandlerImpl* connection_handler_;
79 application_manager::ApplicationManagerImpl* app_manager_;
80 hmi_message_handler::HMIMessageHandlerImpl* hmi_handler_;
82 hmi_message_handler::DBusMessageAdapter* dbus_adapter_;
85 hmi_message_handler::MessageBrokerAdapter* mb_adapter_;
87 media_manager::MediaManagerImpl* media_manager_;
88 policies::PolicyManagerImpl* policy_manager_;
91 NsMessageBroker::CMessageBroker* message_broker_;
92 NsMessageBroker::TcpServer* message_broker_server_;
93 System::Thread* mb_thread_;
94 System::Thread* mb_server_thread_;
95 System::Thread* mb_adapter_thread_;
98 System::Thread* dbus_adapter_thread_;
102 static log4cxx::LoggerPtr logger_;
103 # endif // ENABLE_LOG
105 DISALLOW_COPY_AND_ASSIGN(LifeCycle);
107 FRIEND_BASE_SINGLETON_CLASS(LifeCycle);
109 } // namespace main_namespace
111 #endif // SRC_APPMAIN_LIFE_CYCLE_H_